@ceccec/millennium-solutions 9.3.2 → 9.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -40
- package/dist/mod.core.d.ts +9 -0
- package/dist/mod.core.js +9 -0
- package/dist/src/0/index.d.ts +47 -0
- package/dist/src/0/index.js +189 -0
- package/dist/src/0/ledger.d.ts +1 -0
- package/dist/src/0/ledger.js +25 -0
- package/dist/src/0/trinity-matrix.d.ts +1 -0
- package/dist/src/0/trinity-matrix.js +16 -0
- package/dist/src/5/aspects.d.ts +1 -0
- package/dist/src/5/aspects.js +22 -0
- package/dist/src/5/reflection.d.ts +1 -0
- package/dist/src/5/reflection.js +25 -0
- package/dist/src/7/rosetta.d.ts +1 -0
- package/dist/src/7/rosetta.js +24 -0
- package/dist/src/9/enumeration.d.ts +1 -0
- package/dist/src/9/enumeration.js +14 -0
- package/dist/src/honesty/index.d.ts +16 -0
- package/dist/src/honesty/index.js +69 -0
- package/package.json +27 -10
- package/.zenodo.json +0 -51
- package/ABSTRACT.md +0 -155
- package/ACCOUNTING.md +0 -27
- package/AXIOMS.md +0 -574
- package/CHALLENGES.md +0 -2434
- package/DEPLOY.md +0 -39
- package/DEVELOP.md +0 -34
- package/HEART.md +0 -112
- package/PHYSICS-SCALES.md +0 -80
- package/PRIOR-ART.md +0 -151
- package/PROOF-OF-CONCEPT.md +0 -81
- package/REALISATIONS.md +0 -87
- package/RESEARCH.md +0 -188
- package/RULES.md +0 -57
- package/SEQUENCE-DECODE.md +0 -196
- package/SIGNATURE.md +0 -34
- package/THEOREMS.md +0 -97
- package/WHITEPAPER.md +0 -40
- package/WORKFLOWS.md +0 -47
- package/boundaries.md +0 -23
- package/captain.md +0 -85
- package/compare.md +0 -42
- package/compute.md +0 -543
- package/cryptography.md +0 -55
- package/dashboard.md +0 -50
- package/examples.md +0 -47
- package/folds.md +0 -65
- package/forensic.md +0 -67
- package/guide.md +0 -126
- package/harness.md +0 -20
- package/index.md +0 -217
- package/mod.core.ts +0 -10
- package/nature.md +0 -58
- package/organism.md +0 -30
- package/paper.md +0 -8100
- package/proofs.md +0 -26
- package/quantum.md +0 -40
- package/rights.md +0 -39
- package/solutions.md +0 -28
- package/speedup.md +0 -41
- package/src/0/chacha.ts +0 -3
- package/src/0/crypt.ts +0 -4
- package/src/0/csp.ts +0 -10
- package/src/0/entanglement.ts +0 -31
- package/src/0/fusion.ts +0 -28
- package/src/0/holographic.ts +0 -57
- package/src/0/impossible.ts +0 -30
- package/src/0/imprint.ts +0 -160
- package/src/0/index.ts +0 -263
- package/src/0/ledger.ts +0 -25
- package/src/0/legible.ts +0 -29
- package/src/0/limit.ts +0 -29
- package/src/0/merkle-proof.ts +0 -3
- package/src/0/null-token.ts +0 -24
- package/src/0/sha256.ts +0 -3
- package/src/0/singularity.ts +0 -20
- package/src/0/stream.ts +0 -47
- package/src/0/trinities.ts +0 -37
- package/src/0/trinity-matrix.ts +0 -20
- package/src/0/version-matrix.ts +0 -70
- package/src/1/acceptance.ts +0 -26
- package/src/1/index.ts +0 -80
- package/src/1/paradox.ts +0 -28
- package/src/1/vortex.lean +0 -6
- package/src/2/frequency-scales.ts +0 -28
- package/src/2/iching.ts +0 -34
- package/src/2/index.ts +0 -78
- package/src/2/primes-vortex.ts +0 -12
- package/src/2/quantum.ts +0 -48
- package/src/2/string-scale.ts +0 -14
- package/src/2/vortex.lean +0 -10
- package/src/3/index.ts +0 -63
- package/src/3/pi-bbp.ts +0 -13
- package/src/3/trinity.ts +0 -39
- package/src/3/vortex.lean +0 -7
- package/src/4/git.ts +0 -30
- package/src/4/index.ts +0 -63
- package/src/4/vortex.lean +0 -6
- package/src/5/aspects.ts +0 -27
- package/src/5/center.ts +0 -35
- package/src/5/development.ts +0 -45
- package/src/5/diamond.ts +0 -35
- package/src/5/folds.ts +0 -12
- package/src/5/index.ts +0 -63
- package/src/5/reflection.lean +0 -14
- package/src/5/reflection.ts +0 -14
- package/src/5/vortex.lean +0 -10
- package/src/6/dna.ts +0 -27
- package/src/6/index.ts +0 -63
- package/src/6/vortex.lean +0 -7
- package/src/7/cross.ts +0 -31
- package/src/7/glagolitic.ts +0 -51
- package/src/7/index.ts +0 -67
- package/src/7/language-lens.ts +0 -41
- package/src/7/lens.ts +0 -41
- package/src/7/locale.ts +0 -105
- package/src/7/rbac.ts +0 -31
- package/src/7/rosetta-clay.ts +0 -15
- package/src/7/rosetta.lean +0 -11
- package/src/7/rosetta.ts +0 -11
- package/src/7/string-dimensions.ts +0 -14
- package/src/7/vortex.lean +0 -6
- package/src/8/infinite.ts +0 -26
- package/src/8/merkaba/field.ts +0 -27
- package/src/8/merkaba/geometry.ts +0 -16
- package/src/8/merkaba/touch.ts +0 -26
- package/src/8/nucleus/magic.lean +0 -15
- package/src/8/nucleus/proton-mass-fit.ts +0 -9
- package/src/8/nucleus/proton-mass.lean +0 -10
- package/src/8/nucleus/shell-model-magic.ts +0 -10
- package/src/8/vortex.lean +0 -7
- package/src/9/access.ts +0 -34
- package/src/9/aura-funding.ts +0 -25
- package/src/9/coins.ts +0 -25
- package/src/9/enumeration.ts +0 -13
- package/src/9/funding.ts +0 -85
- package/src/9/security.ts +0 -36
- package/src/9/society.ts +0 -32
- package/src/9/vortex.lean +0 -11
- package/src/api/gates.ts +0 -122
- package/src/api/index.ts +0 -447
- package/src/api/lanes.ts +0 -81
- package/src/claims/index.ts +0 -81
- package/src/demand/queries.json +0 -1764
- package/src/face/index.ts +0 -100
- package/src/from/the/heart/index.ts +0 -11
- package/src/honesty/boundaries.ts +0 -29
- package/src/honesty/index.ts +0 -63
- package/src/html/index.ts +0 -10
- package/src/latex/index.ts +0 -474
- package/src/millennium/index.ts +0 -53
- package/src/play/the/game/index.ts +0 -12
- package/src/proof/README.md +0 -118
- package/src/proof/address.lean +0 -147
- package/src/proof/coin.lean +0 -152
- package/src/proof/covered.json +0 -9
- package/src/proof/demand.lean +0 -134
- package/src/proof/demand2.lean +0 -207
- package/src/proof/demand3.lean +0 -183
- package/src/proof/discovered.json +0 -19125
- package/src/proof/elementary.lean +0 -446
- package/src/proof/energy.lean +0 -291
- package/src/proof/families.lean +0 -648
- package/src/proof/fixtures/axiom-control.lean +0 -39
- package/src/proof/flow.lean +0 -54
- package/src/proof/fnv.lean +0 -116
- package/src/proof/generated-theorems.json +0 -207
- package/src/proof/generated.lean +0 -101
- package/src/proof/imagined.lean +0 -492
- package/src/proof/index.lean +0 -156
- package/src/proof/index.ts +0 -916
- package/src/proof/involution.lean +0 -90
- package/src/proof/ledgerclaims.lean +0 -84
- package/src/proof/light.lean +0 -158
- package/src/proof/mechanical.lean +0 -524
- package/src/proof/merkaba.lean +0 -89
- package/src/proof/merkle.lean +0 -132
- package/src/proof/nim.lean +0 -311
- package/src/proof/novelty.json +0 -751
- package/src/proof/phenomena.lean +0 -90
- package/src/proof/priorart.lean +0 -190
- package/src/proof/quantum.lean +0 -159
- package/src/proof/reach.lean +0 -105
- package/src/proof/recovered.lean +0 -56
- package/src/proof/reversal.lean +0 -148
- package/src/proof/revoked.json +0 -317
- package/src/proof/rights.lean +0 -155
- package/src/proof/sequences.lean +0 -219
- package/src/proof/speed.lean +0 -152
- package/src/proof/split.lean +0 -199
- package/src/proof/theorems.lean +0 -67
- package/src/proof/trial-all.json +0 -16046
- package/src/proof/z9.lean +0 -99
- package/src/proof/z9plus.lean +0 -300
- package/src/proofs.lisp +0 -170
- package/src/prove/emit.ts +0 -115
- package/src/prove/index.ts +0 -143
- package/src/prove/translate.ts +0 -638
- package/src/publication/index.ts +0 -362
- package/src/quantum/field.ts +0 -73
- package/src/quantum/tree.ts +0 -79
- package/src/receipts/1431b4c4-7950-8d7b-88d1-b633219692f8.json +0 -7
- package/src/receipts/171e09c0-4cfd-8ce0-a6ed-cd33d5553da3.json +0 -7
- package/src/receipts/1a1f16c9-3491-8050-b221-e2a362439be4.json +0 -12
- package/src/receipts/1da15f83-83a6-8d04-b1ac-334c2dd6abb3.json +0 -7
- package/src/receipts/375a57ed-ef99-855e-8f34-b77d08010f3c.json +0 -6
- package/src/receipts/3dcbbf9e-0e49-8ba7-921e-17e478dbafaf.json +0 -6
- package/src/receipts/43a24136-5ad9-81ef-97c9-17be1c05bb5f.json +0 -11
- package/src/receipts/4991be51-74ba-8f66-9534-e6dba52fb569.json +0 -10
- package/src/receipts/52375d8f-232b-8c01-9d82-a824ffa7b2b7.json +0 -6
- package/src/receipts/593b546a-36b4-8553-941a-0e03b7053a64.json +0 -7
- package/src/receipts/7f75c989-96c9-8a24-8d0d-7e690861ccb4.json +0 -6
- package/src/receipts/80f80b59-81d8-866d-9a14-f469729d3dc8.json +0 -6
- package/src/receipts/85ac8585-9dc1-8964-9848-ae0f49cc82fb.json +0 -7
- package/src/receipts/85db092e-f2c0-88e5-bf75-61c4a65d84e7.json +0 -7
- package/src/receipts/95bacad3-9e56-8741-b0f8-def2c6ecb050.json +0 -7
- package/src/receipts/a1d33966-7bbd-84ca-902b-49e315af60e0.json +0 -6
- package/src/receipts/b20ced61-24ad-8123-adee-56031ab734dd.json +0 -11
- package/src/receipts/ba0447cd-f489-841a-a70f-a39b18ec2946.json +0 -11
- package/src/receipts/bcddbe66-06cf-8f31-a261-98b836938947.json +0 -7
- package/src/receipts/c1bac0d8-d906-8196-a4f0-3d8270b2e944.json +0 -6
- package/src/receipts/ce851ea3-3cf8-8646-a5d6-c0c6281210fe.json +0 -10
- package/src/receipts/cf43a122-c880-8d86-9e25-6f22f92d6b0a.json +0 -7
- package/src/receipts/daad8cd4-d4db-8dca-9c97-9a838cbce528.json +0 -7
- package/src/receipts/dc8bdb82-599f-8020-9eb2-cb016b408ec1.json +0 -6
- package/src/receipts/df77c265-d1a8-8354-8a9e-769fa5c676e2.json +0 -6
- package/src/receipts/e96686da-a411-8838-a5c8-ee7472bce048.json +0 -10
- package/src/receipts/f073c46f-7b67-83d0-aca5-db11fac4b5ec.json +0 -7
- package/src/receipts/f946d99d-a1c2-89f7-9426-a367c5b04191.json +0 -6
- package/src/receipts/fc069e45-115d-8983-ad25-fb9f735da84b.json +0 -6
- package/src/the/abstract/index.ts +0 -21
- package/src/the/abundance/index.ts +0 -20
- package/src/the/apple/earth/index.ts +0 -23
- package/src/the/apple/earth/navigation/index.ts +0 -28
- package/src/the/apple/earth/truth/index.ts +0 -19
- package/src/the/apple/index.ts +0 -27
- package/src/the/cancer/index.ts +0 -26
- package/src/the/clown/index.ts +0 -25
- package/src/the/creation/index.ts +0 -16
- package/src/the/crystal/index.ts +0 -23
- package/src/the/domain/index.ts +0 -16
- package/src/the/game/index.ts +0 -11
- package/src/the/gold/compass/index.ts +0 -26
- package/src/the/gold/index.ts +0 -35
- package/src/the/heart/index.ts +0 -15
- package/src/the/index.ts +0 -23
- package/src/the/law/index.ts +0 -20
- package/src/the/path/index.ts +0 -19
- package/src/the/rosetta/index.ts +0 -33
- package/src/the/sequence/index.ts +0 -12
- package/src/the/solids/index.ts +0 -25
- package/src/the/state/index.ts +0 -20
- package/src/the/superposition/state/index.ts +0 -22
- package/src/the/surface/index.ts +0 -26
- package/src/the/theorem/index.ts +0 -14
- package/src/the/torus/index.ts +0 -23
- package/src/the/waves/index.ts +0 -23
- package/the.md +0 -20
- package/verify.md +0 -67
package/AXIOMS.md
DELETED
|
@@ -1,574 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: The axiom index — what is assumed
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# The axiom index
|
|
6
|
-
|
|
7
|
-
Every declaration in `src/proof` is checked with `#print axioms` on each build, and a dependency on any
|
|
8
|
-
axiom fails the build rather than earning a footnote. All **735** report the same thing:
|
|
9
|
-
*does not depend on any axioms*.
|
|
10
|
-
|
|
11
|
-
That is a real property, and it is not the whole picture. **Axiom-free is not assumption-free.** These
|
|
12
|
-
theorems rest on **321** definitions, and every one of them is a choice. A theorem about
|
|
13
|
-
`fall` is a theorem about the digital root only because `fall` is *defined* to be it. Both halves are
|
|
14
|
-
indexed below, and the second is the longer one.
|
|
15
|
-
|
|
16
|
-
## The check can tell the difference
|
|
17
|
-
|
|
18
|
-
"No theorem depends on an axiom" reads identically whether the check works or is pointed at nothing, so
|
|
19
|
-
a negative control is kept at [`src/proof/fixtures/axiom-control.lean`](https://github.com/ceccec/millennium-solutions/blob/main/src/proof/fixtures/axiom-control.lean)
|
|
20
|
-
and run by this page's generator. It holds two theorems about the same kind of fact — one decided, one
|
|
21
|
-
obtained classically — and Lean reports:
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
'axiom_free_by_decision' does not depend on any axioms
|
|
25
|
-
'needs_all_three' depends on axioms: [propext, Classical.choice, Quot.sound]
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
One appeal to excluded middle costs all three axioms. That contrast is the reason the arithmetic here is
|
|
29
|
-
decided rather than argued, and it is measured on every run rather than asserted once.
|
|
30
|
-
|
|
31
|
-
## The three axioms of Lean 4, and what stands in each one's place
|
|
32
|
-
|
|
33
|
-
### `propext`
|
|
34
|
-
|
|
35
|
-
**What it buys.** propositional extensionality — two propositions that imply each other are EQUAL, so one can be rewritten as the other.
|
|
36
|
-
|
|
37
|
-
**What is here instead.** nothing here rewrites a proposition into another. A statement is evaluated on its own terms over a finite domain, and equality of propositions never has to be asserted because no proposition is ever substituted for another.
|
|
38
|
-
|
|
39
|
-
### `Classical.choice`
|
|
40
|
-
|
|
41
|
-
**What it buys.** the axiom of choice, and with it excluded middle — every proposition is true or false whether or not anything can decide which.
|
|
42
|
-
|
|
43
|
-
**What is here instead.** DECIDABILITY, which is the strictly stronger thing over a finite domain: not "p or not p" as a principle, but the kernel walking every case and reporting which. `by decide` needs no oracle because it does the work. This is the exact trade the deposit is built on, and it is why every domain here is finite: an infinite domain cannot be exhausted, so it would need the axiom back.
|
|
44
|
-
|
|
45
|
-
### `Quot.sound`
|
|
46
|
-
|
|
47
|
-
**What it buys.** quotient soundness — elements related by an equivalence become equal in the quotient.
|
|
48
|
-
|
|
49
|
-
**What is here instead.** no quotient is formed. Where a quotient would be natural — ℤ/9 — the deposit works with the representatives 0..8 and `% 9` directly, so the ring is a computation on Nat rather than a quotient type. Concretely: `fall`, `refl` and the residue maps are functions on Nat that the kernel evaluates.
|
|
50
|
-
|
|
51
|
-
There is no fourth. Lean 4's axiom base is exactly these three, so an index of them is complete rather
|
|
52
|
-
than a selection — and "depends on no axioms" means depends on none of these three, which is the whole
|
|
53
|
-
of what could have been depended on.
|
|
54
|
-
|
|
55
|
-
## What this check cannot see, and why it does not bite here
|
|
56
|
-
|
|
57
|
-
`#print axioms` had a known gap: `Lean.collectAxioms` did not collect axioms referenced *by other
|
|
58
|
-
axioms' types*, so a declaration could report a shorter list than it truly depended on — the reported
|
|
59
|
-
example is a `native_decide` proof showing `[Lean.ofReduceBool]` while missing `[Lean.trustCompiler]`
|
|
60
|
-
([leanprover/lean4#8840](https://github.com/leanprover/lean4/issues/8840), fixed by
|
|
61
|
-
[#8842](https://github.com/leanprover/lean4/pull/8842), merged 8 July 2025).
|
|
62
|
-
|
|
63
|
-
**This tree is pinned to `leanprover/lean4:v4.15.0`, which predates that fix.** Stating it plainly rather than
|
|
64
|
-
leaving it out: the tool this deposit's central claim rests on had a bug, and the toolchain here is on
|
|
65
|
-
the wrong side of it.
|
|
66
|
-
|
|
67
|
-
It cannot hide anything here, and the reason is structural rather than lucky. The gap is about axioms
|
|
68
|
-
referenced by OTHER AXIOMS. This tree declares no axioms of its own — checked — and forbids
|
|
69
|
-
`native_decide`, which is the one route in the reported example by which a stock axiom acquires a
|
|
70
|
-
dependency of its own. With zero axioms anywhere in the picture there is no transitive edge to miss.
|
|
71
|
-
That argument would collapse the moment a single `axiom` or one `native_decide` entered the tree, which
|
|
72
|
-
is why both are build failures and not conventions.
|
|
73
|
-
|
|
74
|
-
## Prior art, and the practice this follows
|
|
75
|
-
|
|
76
|
-
Auditing a Lean library's axiom footprint is established practice and this deposit did not invent it.
|
|
77
|
-
[`leanprover-community/axiom-audit`](https://github.com/leanprover-community/axiom-audit) does exactly
|
|
78
|
-
what `scripts/lean.ts` does — fails CI when a declaration transitively depends on an axiom outside an
|
|
79
|
-
allowlist, catching `sorry` (as `sorryAx`), `native_decide` (as `Lean.ofReduceBool`) and home-rolled
|
|
80
|
-
axioms — with the same default allowlist of the three above. Its documentation credits Robin Arnez for a
|
|
81
|
-
Mathlib-wide collection and Kim Morrison for an earlier library audit.
|
|
82
|
-
|
|
83
|
-
One thing it does better, recorded here as a lead rather than a claim: it inspects the **kernel
|
|
84
|
-
environment** from compiled `.olean` files instead of parsing source, which catches what a text search
|
|
85
|
-
misses. This deposit's per-theorem check is a real `#print axioms` elaboration and so is sound, but its
|
|
86
|
-
"declares no axiom of its own" test is a source-text match, and that is the weaker method by exactly the
|
|
87
|
-
margin that tool names.
|
|
88
|
-
|
|
89
|
-
The pins in the control fixture follow the community practice of guarding `#print axioms` with
|
|
90
|
-
`#guard_msgs`, which turns the axiom footprint into an executable regression test: the assertion is
|
|
91
|
-
checked by the elaborator, and drift fails the build with a mismatch instead of passing unnoticed.
|
|
92
|
-
|
|
93
|
-
## What IS assumed: the 321 definitions
|
|
94
|
-
|
|
95
|
-
Each of these is a primitive of this deposit — not derived, not proved, chosen. They are listed in full
|
|
96
|
-
because a reader checking a theorem must be able to read the definition it is about, and because a
|
|
97
|
-
deposit that reports its axiom count and hides its definition count is reporting the flattering half.
|
|
98
|
-
|
|
99
|
-
### `address.lean` — 12 definition(s), 23 theorem(s)
|
|
100
|
-
|
|
101
|
-
```lean
|
|
102
|
-
def andF : Nat → Nat → Nat → Nat
|
|
103
|
-
def orF : Nat → Nat → Nat → Nat
|
|
104
|
-
def and8 (a b : Nat) : Nat := andF 9 a b
|
|
105
|
-
def or8 (a b : Nat) : Nat := orF 9 a b
|
|
106
|
-
def SEEDS : List Nat := [0, 2654435769, 608135816, 3084996962]
|
|
107
|
-
def wordBytes (w : Nat) : List Nat := [shr w 24 % 256, shr w 16 % 256, shr w 8 % 256, w % 256]
|
|
108
|
-
def rawBytes (cs : List Nat) : List Nat := (SEEDS.map (fun s => hash32 s cs)).flatMap wordBytes
|
|
109
|
-
def stamp (bs : List Nat) : List Nat :=
|
|
110
|
-
def toUuidBytes (cs : List Nat) : List Nat := stamp (rawBytes cs)
|
|
111
|
-
def A : List Nat := [97] -- "a"
|
|
112
|
-
def UUIDNA : List Nat := [117, 117, 105, 100, 110, 97] -- "uuidna"
|
|
113
|
-
def settledHere : Nat := 20
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### `coin.lean` — 7 definition(s), 12 theorem(s)
|
|
117
|
-
|
|
118
|
-
```lean
|
|
119
|
-
def refl (d : Nat) : Nat := 10 - d
|
|
120
|
-
def tetA : List Nat := [1, 4, 7]
|
|
121
|
-
def tetB : List Nat := [2, 5, 8]
|
|
122
|
-
def axis : List Nat := [3, 6, 9]
|
|
123
|
-
def digits : List Nat := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
124
|
-
def fall (n : Nat) : Nat := if n == 0 then 9 else 1 + (n - 1) % 9
|
|
125
|
-
def nonzero : List Nat := [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### `demand.lean` — 12 definition(s), 9 theorem(s)
|
|
129
|
-
|
|
130
|
-
```lean
|
|
131
|
-
def divisors (n : Nat) : List Nat := (List.range' 1 n).filter (fun d => n % d == 0)
|
|
132
|
-
def isSquarefree (n : Nat) : Bool := (List.range' 2 n).all (fun d => ¬ (n % (d * d) == 0))
|
|
133
|
-
def isPrime (p : Nat) : Bool := p > 1 && (List.range' 2 (p - 2)).all (fun q => ¬ (p % q == 0))
|
|
134
|
-
def omega (n : Nat) : Nat := ((List.range' 2 n).filter (fun p => n % p == 0 && isPrime p)).length
|
|
135
|
-
def mu (n : Nat) : Int := if n == 1 then 1 else if isSquarefree n then (if omega n % 2 == 0 then 1 else -1) else 0
|
|
136
|
-
def derange : Nat → Nat
|
|
137
|
-
def isSumOfThreeSquares (n : Nat) : Bool :=
|
|
138
|
-
def isExcludedForm (n : Nat) : Bool :=
|
|
139
|
-
def isComposite (n : Nat) : Bool := n > 1 && (List.range' 2 (n - 2)).any (fun d => n % d == 0)
|
|
140
|
-
def primeFactors (n : Nat) : List Nat := (List.range' 2 n).filter (fun p => n % p == 0 && isPrime p)
|
|
141
|
-
def isCarmichael (n : Nat) : Bool :=
|
|
142
|
-
def bitsF : Nat → Nat → Nat
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### `demand2.lean` — 17 definition(s), 11 theorem(s)
|
|
146
|
-
|
|
147
|
-
```lean
|
|
148
|
-
def sumPow (p n : Nat) : Nat := (List.range' 1 n).foldl (fun a k => a + k ^ p) 0
|
|
149
|
-
def tri (n : Nat) : Nat := n * (n + 1) / 2
|
|
150
|
-
def isSquareBelow (bound m : Nat) : Bool := (List.range bound).any (fun r => r * r == m)
|
|
151
|
-
def pts : List (Int × Int) :=
|
|
152
|
-
def triples : List ((Int × Int) × (Int × Int) × (Int × Int)) :=
|
|
153
|
-
def cross (a b c : Int × Int) : Int := (b.1 - a.1) * (c.2 - a.2) - (c.1 - a.1) * (b.2 - a.2)
|
|
154
|
-
def interiorCount (a b c : Int × Int) : Int :=
|
|
155
|
-
def boundaryCount (a b c : Int × Int) : Int :=
|
|
156
|
-
def tuples : Nat → Nat → List (List Nat)
|
|
157
|
-
def permsOf (n : Nat) : List (List Nat) := (tuples n n).filter (fun r => r.eraseDups.length == n)
|
|
158
|
-
def discord (n : Nat) (r s : List Nat) : Bool := (List.range n).all (fun j => ¬ (r.getD j 0 == s.getD j 0))
|
|
159
|
-
def countRows : Nat → Nat → List (List Nat) → List (List Nat) → Nat
|
|
160
|
-
def latinSquares (n : Nat) : Nat := countRows n n (permsOf n) []
|
|
161
|
-
def crtCoversAllPairs (m n : Nat) : Bool :=
|
|
162
|
-
def perfectPowersUpTo (bound : Nat) : List Nat :=
|
|
163
|
-
def pp2000 : List Nat := perfectPowersUpTo 2000
|
|
164
|
-
def aliquot (n : Nat) : Nat := ((List.range' 1 (n - 1)).filter (fun d => n % d == 0)).foldl (· + ·) 0
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### `demand3.lean` — 12 definition(s), 15 theorem(s)
|
|
168
|
-
|
|
169
|
-
```lean
|
|
170
|
-
def isSumOfFour (n : Nat) : Bool :=
|
|
171
|
-
def isSumOfThree (n : Nat) : Bool :=
|
|
172
|
-
def cantor (a b : Nat) : Nat := (a + b) * (a + b + 1) / 2 + b
|
|
173
|
-
def block : List Nat := (List.range 8).flatMap (fun a => (List.range 8).map (fun b => cantor a b))
|
|
174
|
-
def repunit : Nat → Nat
|
|
175
|
-
def chi (g : Nat) : Int := 2 - 2 * (g : Int)
|
|
176
|
-
def isSquare (n : Nat) : Bool := (List.range 12).any (fun k => k * k == n)
|
|
177
|
-
def ins (x : Nat) : List Nat → List Nat
|
|
178
|
-
def sortDesc : List Nat → List Nat
|
|
179
|
-
def feasible (d : Nat) (rest : List Nat) : Bool :=
|
|
180
|
-
def step : List Nat → List Nat
|
|
181
|
-
def hh : Nat → List Nat → Bool
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### `elementary.lean` — 24 definition(s), 37 theorem(s)
|
|
185
|
-
|
|
186
|
-
```lean
|
|
187
|
-
def properDivisorSum (n : Nat) : Nat := ((List.range' 1 (n - 1)).filter (fun d => n % d == 0)).foldl (· + ·) 0
|
|
188
|
-
def eisensteinNorm (a b : Int) : Int := a * a - a * b + b * b
|
|
189
|
-
def invUnit (u : Nat) : Nat := ((List.range 9).find? (fun e => u * e % 9 == 1)).getD 0
|
|
190
|
-
def lucasPair : Nat → Nat × Nat
|
|
191
|
-
def lucas (n : Nat) : Nat := (lucasPair n).1
|
|
192
|
-
def pellPair : Nat → Nat × Nat
|
|
193
|
-
def pell (n : Nat) : Nat := (pellPair n).1
|
|
194
|
-
def leFrac (x y : Nat × Nat) : Bool := x.1 * y.2 ≤ y.1 * x.2
|
|
195
|
-
def insFrac (x : Nat × Nat) : List (Nat × Nat) → List (Nat × Nat)
|
|
196
|
-
def sortFrac : List (Nat × Nat) → List (Nat × Nat)
|
|
197
|
-
def farey (n : Nat) : List (Nat × Nat) :=
|
|
198
|
-
def nbrs (S : List Nat) (d : Nat) : List Nat :=
|
|
199
|
-
def degreeSet (S : List Nat) : List Nat := (S.map (fun d => (nbrs S d).length)).eraseDups
|
|
200
|
-
def isqrt (n : Nat) : Nat := ((List.range 200).filter (fun s => s * s ≤ n)).getLast? |>.getD 0
|
|
201
|
-
def lowerWythoff (n : Nat) : Nat := (n + isqrt (5 * n * n)) / 2
|
|
202
|
-
def upperWythoff (n : Nat) : Nat := (3 * n + isqrt (5 * n * n)) / 2
|
|
203
|
-
def knightSteps : List (Nat × Nat) :=
|
|
204
|
-
def partsF : Nat → Nat → Nat → List (List Nat)
|
|
205
|
-
def partitionsOf (n : Nat) : List (List Nat) := partsF (n + 1) n n
|
|
206
|
-
def rgs : Nat → List (List Nat)
|
|
207
|
-
def bellRow : Nat → List Nat
|
|
208
|
-
def bellOf (n : Nat) : Nat := (bellRow n).headD 0
|
|
209
|
-
def tetOf (r : Nat) : List Nat := (unitsMod 9).filter (fun d => d % 3 == r)
|
|
210
|
-
def settledHere : Nat := 32
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
### `energy.lean` — 31 definition(s), 22 theorem(s)
|
|
214
|
-
|
|
215
|
-
```lean
|
|
216
|
-
def splitCost : Nat := 52000 -- Wh to electrolyse 1 kg H₂ (real cells: 50–55 kWh/kg; ideal is ~39.4)
|
|
217
|
-
def burnYield : Nat := 12000 -- Wh recovered burning it at ~35% engine efficiency (LHV 33.3 kWh/kg)
|
|
218
|
-
def waterOut : Nat := 9 -- litres: 1 kg H₂ + 8 kg O₂ → 9 kg H₂O, the whole point of the exhaust
|
|
219
|
-
def roPerLitre : Nat := 4 -- Wh/litre for reverse osmosis, the ordinary way to clean a litre of water
|
|
220
|
-
def pct (part whole : Nat) : Nat := part * 100 / whole
|
|
221
|
-
def mgH2 : Nat := 2016 -- H₂ = 2 × 1.008 g/mol
|
|
222
|
-
def mgO2 : Nat := 31998 -- O₂ = 2 × 15.999 g/mol
|
|
223
|
-
def mgH2O : Nat := 18015 -- H₂O = 18.015 g/mol
|
|
224
|
-
def mgH : Nat := 1008
|
|
225
|
-
def mgO : Nat := 15999
|
|
226
|
-
def mass (h o : Nat) : Nat := h * mgH + o * mgO
|
|
227
|
-
def balances (a b c : Nat) : Bool := (2 * a == 2 * b) && (a == 2 * c)
|
|
228
|
-
def atomsH2 : Nat × Nat := (2, 0)
|
|
229
|
-
def atomsO2 : Nat × Nat := (0, 2)
|
|
230
|
-
def atomsH2O : Nat × Nat := (2, 1)
|
|
231
|
-
def per10k (part whole : Nat) : Nat := part * 10000 / whole
|
|
232
|
-
def bondHundredthsKJ : Nat := 28583 -- ΔH°f of liquid water, 285.83 kJ/mol, in hundredths
|
|
233
|
-
def splitE (e : Nat) : Nat := e + bondHundredthsKJ
|
|
234
|
-
def burnE (e : Nat) : Nat := e - bondHundredthsKJ
|
|
235
|
-
def molH2 : Nat := 496 -- moles in 1 kg of H₂ (1000 g ÷ 2.016)
|
|
236
|
-
def molO2 : Nat := 248 -- the oxygen that comes with it, half as many moles
|
|
237
|
-
def mLperMol : Nat := 22414 -- millilitres per mole at STP
|
|
238
|
-
def whPerKgH2 : Nat := 33300 -- lower heating value, Wh per kg
|
|
239
|
-
def petrolWhL : Nat := 9700 -- Wh per litre of petrol, for scale
|
|
240
|
-
def litresOf (mol : Nat) : Nat := mol * mLperMol / 1000
|
|
241
|
-
def molesOf (l : Nat) : Nat := l * 1000 / mLperMol
|
|
242
|
-
def whPerLitreAt (kgPerM3 : Nat) : Nat := kgPerM3 * whPerKgH2 / 1000
|
|
243
|
-
def tdsSeawater : Nat := 35000 -- mg of dissolved solids per litre
|
|
244
|
-
def tdsTapWater : Nat := 50 -- mg per litre, ordinary supply
|
|
245
|
-
def residueMg (litres tds : Nat) : Nat := litres * tds
|
|
246
|
-
def atomsOf (m : Nat) : Option (Nat × Nat) :=
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
### `families.lean` — 44 definition(s), 55 theorem(s)
|
|
250
|
-
|
|
251
|
-
```lean
|
|
252
|
-
def primesUpTo30 : List Nat := [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
|
|
253
|
-
def fact (n : Nat) : Nat := (List.range n).foldl (fun a k => a * (k + 1)) 1
|
|
254
|
-
def choose (n k : Nat) : Nat := fact n / (fact k * fact (n - k))
|
|
255
|
-
def gcdFuel : Nat → Nat → Nat → Nat
|
|
256
|
-
def gcd ' (a b : Nat) : Nat := gcdFuel (a + b + 1) a b
|
|
257
|
-
def totient (n : Nat) : Nat := ((List.range n).filter (fun a => gcd' a n == 1)).length
|
|
258
|
-
def popcount (n : Nat) : Nat := ((List.range 16).filter (fun i => (n >>> i) % 2 == 1)).length
|
|
259
|
-
def isPrime (n : Nat) : Bool := n ≥ 2 && (List.range' 2 (n - 2)).all (fun d => n % d != 0)
|
|
260
|
-
def unitsMod (m : Nat) : List Nat := (List.range m).filter (fun a => gcd' a m == 1)
|
|
261
|
-
def powMod (g k m : Nat) : Nat := (List.range k).foldl (fun a _ => a * g % m) (1 % m)
|
|
262
|
-
def ordMod (g m : Nat) : Nat := ((List.range' 1 m).find? (fun k => powMod g k m == 1)).getD 0
|
|
263
|
-
def hasPrimitiveRoot (m : Nat) : Bool := (unitsMod m).any (fun g => ordMod g m == (unitsMod m).length)
|
|
264
|
-
def isOddPrimePower (n : Nat) : Bool :=
|
|
265
|
-
def gaussCyclic (m : Nat) : Bool :=
|
|
266
|
-
def permutesZ9 (k : Nat) : Bool := (List.range 9).all (fun y => (List.range 9).any (fun d => k * d % 9 == y))
|
|
267
|
-
def addOrbit (k : Nat) : List Nat := (List.range 9).map (fun t => (List.range t).foldl (fun a _ => (a + k) % 9) 0)
|
|
268
|
-
def addGeneratesZ9 (k : Nat) : Bool := (List.range 9).all (fun y => (addOrbit k).contains y)
|
|
269
|
-
def invOf (d : Nat) : Option Nat := (List.range 9).find? (fun e => d * e % 9 == 1)
|
|
270
|
-
def powSum (k n : Nat) : Nat := ((List.range' 1 n).map (fun i => i ^ k)).foldl (· + ·) 0
|
|
271
|
-
def faulhaber (k n : Nat) : Nat :=
|
|
272
|
-
def digitsF : Nat → Nat → List Nat
|
|
273
|
-
def digitsOf (n : Nat) : List Nat := digitsF (n + 1) n
|
|
274
|
-
def reverseDigits (n : Nat) : Nat := (digitsOf n).foldl (fun a d => a * 10 + d) 0
|
|
275
|
-
def digitalRoot (n : Nat) : Nat := if n == 0 then 0 else 1 + (n - 1) % 9
|
|
276
|
-
def rootSum (g m : Nat) : Nat := ((List.range (ordMod g m)).map (fun k => powMod g k m)).foldl (· + ·) 0
|
|
277
|
-
def vpF : Nat → Nat → Nat → Nat
|
|
278
|
-
def vp (p n : Nat) : Nat := vpF 20 p n
|
|
279
|
-
def isSumOfTwoSquares (n : Nat) : Bool :=
|
|
280
|
-
def everyThreeModFourPrimeIsEven (n : Nat) : Bool :=
|
|
281
|
-
def digitSquareSum (n : Nat) : Nat := ((digitsOf n).map (fun d => d * d)).foldl (· + ·) 0
|
|
282
|
-
def iterF : Nat → Nat → Nat
|
|
283
|
-
def polyRec : Nat → Nat → Nat
|
|
284
|
-
def fibPair : Nat → Nat × Nat
|
|
285
|
-
def fib (n : Nat) : Nat := (fibPair n).1
|
|
286
|
-
def digitSum (n : Nat) : Nat := (digitsOf n).foldl (· + ·) 0
|
|
287
|
-
def cfPair : Nat → Nat × Nat
|
|
288
|
-
def catalanList : Nat → List Nat
|
|
289
|
-
def pisano (m : Nat) : Nat := ((List.range' 1 100).find? (fun k => fib k % m == 0 && fib (k + 1) % m == 1)).getD 0
|
|
290
|
-
def interleaveN (x : Nat) : List Nat → List (List Nat)
|
|
291
|
-
def permsN : List Nat → List (List Nat)
|
|
292
|
-
def isInvolution (p : List Nat) : Bool := (List.range p.length).all (fun i => p.getD (p.getD i 0) 0 == i)
|
|
293
|
-
def telephone : Nat → Nat
|
|
294
|
-
def schlafli : List (Nat × Nat) :=
|
|
295
|
-
def settledHere : Nat := 42
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
### `fnv.lean` — 13 definition(s), 14 theorem(s)
|
|
299
|
-
|
|
300
|
-
```lean
|
|
301
|
-
def xorF : Nat → Nat → Nat → Nat
|
|
302
|
-
def M32 : Nat := 4294967296
|
|
303
|
-
def xor32 (a b : Nat) : Nat := xorF 33 a b
|
|
304
|
-
def shr (n k : Nat) : Nat := n / (2 ^ k)
|
|
305
|
-
def mul32 (a b : Nat) : Nat := (a * b) % M32
|
|
306
|
-
def FNV_OFFSET : Nat := 2166136261 -- 0x811c9dc5
|
|
307
|
-
def FNV_PRIME : Nat := 16777619 -- 0x01000193
|
|
308
|
-
def MIX1 : Nat := 2246822507 -- 0x85ebca6b
|
|
309
|
-
def MIX2 : Nat := 3266489909 -- 0xc2b2ae35
|
|
310
|
-
def step (h c : Nat) : Nat :=
|
|
311
|
-
def avalanche (h : Nat) : Nat :=
|
|
312
|
-
def hash32 (seed : Nat) (cs : List Nat) : Nat := avalanche (cs.foldl step (xor32 FNV_OFFSET seed))
|
|
313
|
-
def settledHere : Nat := 12
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
### `index.lean` — 5 definition(s), 11 theorem(s)
|
|
317
|
-
|
|
318
|
-
```lean
|
|
319
|
-
def isUnit (d : Nat) : Bool := (List.range 9).any (fun e => (d * e) % 9 == 1) -- DERIVED: d has an inverse mod 9
|
|
320
|
-
def refl (d : Nat) : Nat := 10 - d -- the reflection (= division by zero)
|
|
321
|
-
def orbit (k : Nat) : Nat := (2 ^ k) % 9 -- the doubling sequence 2^k, computed
|
|
322
|
-
def span : List Nat := (List.range 6).map orbit -- the doubling span (one period), computed
|
|
323
|
-
def sequence : List Nat := [1, 2, 4, 8, 7, 5, 3, 6, 9, 0, 1]
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
### `involution.lean` — 7 definition(s), 8 theorem(s)
|
|
327
|
-
|
|
328
|
-
```lean
|
|
329
|
-
def matchings : Nat → List Nat → List (List (Nat × Nat))
|
|
330
|
-
def nine : List Nat := [0, 1, 2, 3, 4, 5, 6, 7, 8]
|
|
331
|
-
def all : List (List (Nat × Nat)) := matchings 10 nine
|
|
332
|
-
def fixedPoints (m : List (Nat × Nat)) : Nat := (m.filter (fun p => p.1 == p.2)).length
|
|
333
|
-
def swaps (m : List (Nat × Nat)) : List (Nat × Nat) := m.filter (fun p => p.1 != p.2)
|
|
334
|
-
def constantSum (m : List (Nat × Nat)) : Bool :=
|
|
335
|
-
def coinLike : List (Nat × Nat) := [(0, 0), (1, 8), (2, 7), (3, 6), (4, 5)]
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
### `ledgerclaims.lean` — 3 definition(s), 8 theorem(s)
|
|
339
|
-
|
|
340
|
-
```lean
|
|
341
|
-
def rounds : Nat → Nat → Nat
|
|
342
|
-
def saving (value verify : Nat) : Nat := value - verify
|
|
343
|
-
def addr4 (x : Nat) : Nat := x % 16
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
### `light.lean` — 13 definition(s), 14 theorem(s)
|
|
347
|
-
|
|
348
|
-
```lean
|
|
349
|
-
def c : Nat := 299792458 -- m/s, exact
|
|
350
|
-
def dNuCs : Nat := 9192631770 -- Hz, exact — the caesium-133 hyperfine transition
|
|
351
|
-
def hDigits : Nat := 662607015 -- h = 6.62607015 × 10⁻³⁴ J s
|
|
352
|
-
def eDigits : Nat := 1602176634 -- e = 1.602176634 × 10⁻¹⁹ C
|
|
353
|
-
def kDigits : Nat := 1380649 -- k = 1.380649 × 10⁻²³ J/K
|
|
354
|
-
def naDigits : Nat := 602214076 -- N_A = 6.02214076 × 10²³ mol⁻¹
|
|
355
|
-
def kcd : Nat := 683 -- K_cd, lm/W, exact
|
|
356
|
-
def defining : List Nat := [c, dNuCs, hDigits, eDigits, kDigits, naDigits, kcd]
|
|
357
|
-
def travel (seconds : Nat) : Nat := c * seconds -- metres crossed in a whole number of seconds
|
|
358
|
-
def periods (seconds : Nat) : Nat := dNuCs * seconds -- caesium periods elapsed in the same interval
|
|
359
|
-
def root (n : Nat) : Nat := if n == 0 then 9 else 1 + (n - 1) % 9
|
|
360
|
-
def kcdDoubled : Nat := 1366 -- K_cd expressed against a unit half the size; the same luminous efficacy
|
|
361
|
-
def alternative : List Nat := [c, dNuCs, hDigits, eDigits, kDigits, naDigits, kcdDoubled]
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
### `mechanical.lean` — 5 definition(s), 119 theorem(s)
|
|
365
|
-
|
|
366
|
-
```lean
|
|
367
|
-
def M9 (n : Nat) : Nat := n % 9
|
|
368
|
-
def DR (n : Nat) : Nat := if n == 0 then 0 else 1 + (n - 1) % 9
|
|
369
|
-
def gRange : List Nat := [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
|
|
370
|
-
def dbl : Nat → Nat
|
|
371
|
-
def forgetful (_ : Nat) : Nat := 0
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
### `merkaba.lean` — 6 definition(s), 8 theorem(s)
|
|
375
|
-
|
|
376
|
-
```lean
|
|
377
|
-
def axis : List Nat := [3, 6, 0] -- {3,6,9} — the spindle
|
|
378
|
-
def tetA : List Nat := [1, 4, 7]
|
|
379
|
-
def tetB : List Nat := [2, 5, 8]
|
|
380
|
-
def dbl (l : List Nat) : List Nat := l.map (fun d => m9 (2 * d))
|
|
381
|
-
def tri (n : Nat) : Nat := n * (n + 1) / 2
|
|
382
|
-
def sumTri (n : Nat) : Nat := ((List.range' 1 n).map tri).foldl (· + ·) 0
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
### `merkle.lean` — 18 definition(s), 12 theorem(s)
|
|
386
|
-
|
|
387
|
-
```lean
|
|
388
|
-
def hexDigit (n : Nat) : Nat := if n < 10 then 48 + n else 87 + n
|
|
389
|
-
def byteHex (b : Nat) : List Nat := [hexDigit (b / 16), hexDigit (b % 16)]
|
|
390
|
-
def uuidChars (bs : List Nat) : List Nat :=
|
|
391
|
-
def merge (a b : List Nat) : List Nat := toUuidBytes (uuidChars a ++ [58] ++ uuidChars b)
|
|
392
|
-
def leB : List Nat → List Nat → Bool
|
|
393
|
-
def insB (a : List Nat) : List (List Nat) → List (List Nat)
|
|
394
|
-
def sortB : List (List Nat) → List (List Nat)
|
|
395
|
-
def pairUp : List (List Nat) → List (List Nat)
|
|
396
|
-
def foldF : Nat → List (List Nat) → List (List Nat)
|
|
397
|
-
def EMPTY_SEED : List Nat := [101, 109, 112, 116, 121, 45, 109, 105, 110, 100] -- "empty-mind"
|
|
398
|
-
def merkleFold (leaves : List (List Nat)) : List Nat :=
|
|
399
|
-
def A : List Nat := toUuidBytes [97] -- address of "a"
|
|
400
|
-
def C : List Nat := toUuidBytes [99] -- address of "c"
|
|
401
|
-
def B : List Nat := toUuidBytes [98] -- address of "b"
|
|
402
|
-
def settledHere : Nat := 11
|
|
403
|
-
def interleave (x : List Nat) : List (List Nat) → List (List (List Nat))
|
|
404
|
-
def perms : List (List Nat) → List (List (List Nat))
|
|
405
|
-
def D : List Nat := toUuidBytes [100] -- address of "d"
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
### `nim.lean` — 7 definition(s), 25 theorem(s)
|
|
409
|
-
|
|
410
|
-
```lean
|
|
411
|
-
def xorN (a b : Nat) : Nat := xorF (a + b + 1) a b
|
|
412
|
-
def N : Nat := 6
|
|
413
|
-
def moves (a b : Nat) : List (Nat × Nat) :=
|
|
414
|
-
def lost : Nat → Nat → Nat → Bool
|
|
415
|
-
def isLost (a b : Nat) : Bool := lost (a + b + 1) a b
|
|
416
|
-
def mex (s : List Nat) : Nat := ((List.range (s.length + 1)).filter (fun m => ! s.contains m)).headD 0
|
|
417
|
-
def grundy1 : Nat → Nat → Nat
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
### `phenomena.lean` — 3 definition(s), 4 theorem(s)
|
|
421
|
-
|
|
422
|
-
```lean
|
|
423
|
-
abbrev Entry := Nat × Nat
|
|
424
|
-
def entries : List Entry :=
|
|
425
|
-
def statusOf (e : Entry) : Nat := e.2
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
### `priorart.lean` — 5 definition(s), 9 theorem(s)
|
|
429
|
-
|
|
430
|
-
```lean
|
|
431
|
-
abbrev Source := Nat × Nat × Bool
|
|
432
|
-
def idOf (s : Source) : Nat := s.1
|
|
433
|
-
def kindOf (s : Source) : Nat := s.2.1
|
|
434
|
-
def novelty (s : Source) : Bool := s.2.2
|
|
435
|
-
def sources : List Source :=
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
### `quantum.lean` — 11 definition(s), 12 theorem(s)
|
|
439
|
-
|
|
440
|
-
```lean
|
|
441
|
-
def insertEverywhere (x : Nat) : List Nat → List (List Nat)
|
|
442
|
-
def perms : List Nat → List (List Nat)
|
|
443
|
-
def ins (x : Nat) : List Nat → List Nat
|
|
444
|
-
def sort : List Nat → List Nat
|
|
445
|
-
def receipt (l : List Nat) : Nat := (sort l).foldl (fun a b => (a * 2 + b) % 9) 0
|
|
446
|
-
def naive (l : List Nat) : Nat := l.foldl (fun a b => (a * 2 + b) % 9) 0
|
|
447
|
-
def pairsOverNine : List (List Nat) :=
|
|
448
|
-
def settledHere : Nat := 11
|
|
449
|
-
def bit (n i : Nat) : Nat := n / (2 ^ i) % 2
|
|
450
|
-
def par3 (n : Nat) : Nat := (bit n 0 + bit n 1 + bit n 2) % 2
|
|
451
|
-
def ghzXSupport : List Nat := [0, 3, 5, 6]
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
### `reach.lean` — 2 definition(s), 8 theorem(s)
|
|
455
|
-
|
|
456
|
-
```lean
|
|
457
|
-
def bounds : List Nat := List.range' 1 50
|
|
458
|
-
def largestDomainHere : Nat := 152568360000
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
### `recovered.lean` — 3 definition(s), 15 theorem(s)
|
|
462
|
-
|
|
463
|
-
```lean
|
|
464
|
-
def units : List Nat := [1, 2, 4, 5, 7, 8]
|
|
465
|
-
def triad : List Nat := [3, 6, 9]
|
|
466
|
-
def pow9 (b k : Nat) : Nat := (List.range k).foldl (fun a _ => a * b % 9) 1
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
### `reversal.lean` — 6 definition(s), 15 theorem(s)
|
|
470
|
-
|
|
471
|
-
```lean
|
|
472
|
-
def digitsF : Nat → Nat → List Nat
|
|
473
|
-
def digits (n : Nat) : List Nat := if n == 0 then [0] else digitsF (n + 1) n
|
|
474
|
-
def reverseNum (n : Nat) : Nat := (digits n).foldl (fun a d => a * 10 + d) 0
|
|
475
|
-
def digitSum (n : Nat) : Nat := (digits n).foldl (· + ·) 0
|
|
476
|
-
def isPrime (n : Nat) : Bool := n > 1 && (List.range n).all (fun d => d < 2 || n % d != 0)
|
|
477
|
-
def settledHere : Nat := 8
|
|
478
|
-
```
|
|
479
|
-
|
|
480
|
-
### `rights.lean` — 7 definition(s), 9 theorem(s)
|
|
481
|
-
|
|
482
|
-
```lean
|
|
483
|
-
abbrev Instrument := Nat × Nat × Bool × Bool
|
|
484
|
-
def idOf (r : Instrument) : Nat := r.1
|
|
485
|
-
def kindOf (r : Instrument) : Nat := r.2.1
|
|
486
|
-
def auto (r : Instrument) : Bool := r.2.2.1
|
|
487
|
-
def claim (r : Instrument) : Bool := r.2.2.2
|
|
488
|
-
def instruments : List Instrument :=
|
|
489
|
-
def settledHere : Nat := 8
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
### `sequences.lean` — 7 definition(s), 22 theorem(s)
|
|
493
|
-
|
|
494
|
-
```lean
|
|
495
|
-
def fib : Nat → Nat
|
|
496
|
-
def fact (n : Nat) : Nat := (List.range n).foldl (fun a k => a * (k + 1)) 1
|
|
497
|
-
def choose (n k : Nat) : Nat := fact n / (fact k * fact (n - k))
|
|
498
|
-
def andF : Nat → Nat → Nat → Nat
|
|
499
|
-
def andN (a b : Nat) : Nat := andF 33 a b
|
|
500
|
-
def popcount (n : Nat) : Nat := (List.range (n + 1)).foldl (fun a i => a + n / 2 ^ i % 2) 0
|
|
501
|
-
def tm (n : Nat) : Nat := popcount n % 2
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
### `speed.lean` — 8 definition(s), 11 theorem(s)
|
|
505
|
-
|
|
506
|
-
```lean
|
|
507
|
-
def recomputeUs : Nat := 21582900 -- folding 2^20 leaves
|
|
508
|
-
def verifyUs : Nat := 38 -- walking the 20-node inclusion path
|
|
509
|
-
def nsPerVerify : Nat := 38000 -- the same verify, in nanoseconds
|
|
510
|
-
def hexChars : Nat := 32 -- an address in the 8-bit hex form fixed by RFC 9562 §5.8
|
|
511
|
-
def hexbitChars : Nat := 22 -- the same address over the 64-hexagram lattice
|
|
512
|
-
def hexMs : Nat := 16 -- median ms for 200,000 encodings, 8-bit table
|
|
513
|
-
def hexbitMs : Nat := 30 -- the same work, 6-bit lattice
|
|
514
|
-
def charsFor (b : Nat) : Nat := (128 + b - 1) / b
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
### `split.lean` — 8 definition(s), 20 theorem(s)
|
|
518
|
-
|
|
519
|
-
```lean
|
|
520
|
-
def tokens : List Nat := [0, 12, 3, 45, 6, 78, 9]
|
|
521
|
-
def singles : List Nat := [0, 3, 6, 9]
|
|
522
|
-
def pairs : List Nat := [12, 45, 78]
|
|
523
|
-
def unitsOf9 : List Nat := [1, 2, 4, 5, 7, 8]
|
|
524
|
-
def isUnit9 (d : Nat) : Bool := (List.range 9).any (fun e => (d * e) % 9 == 1)
|
|
525
|
-
def coins : Nat := 2
|
|
526
|
-
def coinStep : Nat := 3 * coins
|
|
527
|
-
def sealBits : Nat := 128
|
|
528
|
-
```
|
|
529
|
-
|
|
530
|
-
### `theorems.lean` — 1 definition(s), 8 theorem(s)
|
|
531
|
-
|
|
532
|
-
```lean
|
|
533
|
-
def refl (d : Nat) : Nat := 10 - d -- the shared reflection r(d) = 10 − d (the ½/heart-analogue centre)
|
|
534
|
-
```
|
|
535
|
-
|
|
536
|
-
### `z9.lean` — 8 definition(s), 22 theorem(s)
|
|
537
|
-
|
|
538
|
-
```lean
|
|
539
|
-
def B : Nat := 9
|
|
540
|
-
def m9 (n : Nat) : Nat := n % B
|
|
541
|
-
def isUnit (d : Nat) : Bool := (List.range B).any (fun e => m9 (d * e) == 1)
|
|
542
|
-
def units : List Nat := (List.range B).filter isUnit
|
|
543
|
-
def pow9 (b e : Nat) : Nat := m9 (b ^ e)
|
|
544
|
-
def orbit (k : Nat) : Nat := m9 (2 ^ k)
|
|
545
|
-
def logOrbit (u : Nat) : Option Nat := (List.range 6).find? (fun k => orbit k == u)
|
|
546
|
-
def settledHere : Nat := 21
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
### `z9plus.lean` — 16 definition(s), 43 theorem(s)
|
|
550
|
-
|
|
551
|
-
```lean
|
|
552
|
-
def m9 (n : Nat) : Nat := n % 9
|
|
553
|
-
def R : List Nat := List.range 9
|
|
554
|
-
def pw (b e : Nat) : Nat := m9 (b ^ e)
|
|
555
|
-
def generates (g : Nat) : Bool := ((List.range' 1 6).map (fun k => pw g k)).eraseDups.length == 6
|
|
556
|
-
def dr (n : Nat) : Nat := if n == 0 then 0 else if m9 n == 0 then 9 else m9 n
|
|
557
|
-
def ord (u : Nat) : Nat := ((List.range' 1 6).filter (fun k => pw u k == 1)).headD 0
|
|
558
|
-
def refl (d : Nat) : Nat := 10 - d
|
|
559
|
-
def orbit6 : List Nat := (List.range 6).map (fun k => pw 2 k)
|
|
560
|
-
def dbl (d : Nat) : Nat := m9 (d * 2)
|
|
561
|
-
def rfl9 (d : Nat) : Nat := m9 (10 - d)
|
|
562
|
-
def grow (s : List Nat) : List Nat := (s ++ s.map dbl ++ s.map rfl9).eraseDups
|
|
563
|
-
def closure : Nat → List Nat → List Nat
|
|
564
|
-
def fib : Nat → Nat
|
|
565
|
-
def fib9 (n : Nat) : Nat := m9 (fib n)
|
|
566
|
-
def gcdF : Nat → Nat → Nat → Nat
|
|
567
|
-
def gcd9 (a b : Nat) : Nat := gcdF (a + b + 1) a b
|
|
568
|
-
```
|
|
569
|
-
|
|
570
|
-
---
|
|
571
|
-
|
|
572
|
-
**735** declarations, **0** axiom dependencies, **321** definitions they rest on.
|
|
573
|
-
A content-address proves integrity, not truth, and an axiom index proves neither: it states what was
|
|
574
|
-
assumed, so a reader can disagree with the assumptions rather than guess at them.
|