@ceccec/millennium-solutions 0.1.1 → 9.0.6
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/.zenodo.json +33 -9
- package/ACCOUNTING.md +7 -7
- package/AXIOMS.md +559 -0
- package/CHALLENGES.md +2181 -2479
- package/CITATION.cff +1 -1
- package/DEPLOY.md +2 -2
- package/DEVELOP.md +1 -1
- package/LICENSE +6 -5
- package/PRIOR-ART.md +149 -0
- package/README.md +221 -123
- package/SIGNATURE.md +2 -2
- package/TRIAL.md +69 -0
- package/WHITEPAPER.md +5 -5
- package/captain.md +2 -2
- package/compare.md +4 -4
- package/compute.md +9 -0
- package/dashboard.md +1 -1
- package/examples.md +5 -5
- package/forensic.md +67 -0
- package/guide.md +5 -5
- package/index.md +209 -139
- package/package.json +88 -9
- package/paper.md +7183 -0
- package/quantum.md +42 -0
- package/rights.md +39 -0
- package/solutions.md +7 -7
- package/speedup.md +4 -4
- package/src/0/index.ts +12 -2
- package/src/1/index.ts +1 -1
- package/src/2/frequency-scales.ts +13 -1
- package/src/2/index.ts +1 -1
- package/src/3/index.ts +1 -1
- package/src/4/index.ts +1 -1
- package/src/5/index.ts +1 -1
- package/src/6/index.ts +1 -1
- package/src/7/index.ts +1 -1
- package/src/9/funding.ts +2 -2
- package/src/api/gates.ts +117 -0
- package/src/api/index.ts +488 -0
- package/src/api/lanes.ts +81 -0
- package/src/demand/queries.json +1764 -0
- package/src/face/index.ts +100 -0
- package/src/html/index.ts +10 -0
- package/src/latex/index.ts +474 -0
- package/src/millennium/index.ts +53 -0
- package/src/proof/README.md +1 -1
- package/src/proof/address.lean +117 -0
- package/src/proof/coin.lean +148 -0
- package/src/proof/covered.json +9 -0
- package/src/proof/demand.lean +112 -0
- package/src/proof/demand2.lean +171 -0
- package/src/proof/demand3.lean +117 -0
- package/src/proof/discovered.json +10965 -1864
- package/src/proof/elementary.lean +393 -0
- package/src/proof/energy.lean +215 -0
- package/src/proof/families.lean +435 -0
- package/src/proof/fixtures/axiom-control.lean +39 -0
- package/src/proof/fnv.lean +99 -0
- package/src/proof/generated-theorems.json +207 -0
- package/src/proof/generated.lean +101 -0
- package/src/proof/imagined.lean +492 -0
- package/src/proof/index.lean +98 -18
- package/src/proof/index.ts +2 -2
- package/src/proof/involution.lean +90 -0
- package/src/proof/ledgerclaims.lean +84 -0
- package/src/proof/light.lean +135 -0
- package/src/proof/mechanical.lean +421 -0
- package/src/proof/merkaba.lean +89 -0
- package/src/proof/merkle.lean +132 -0
- package/src/proof/nim.lean +105 -0
- package/src/proof/phenomena.lean +90 -0
- package/src/proof/priorart.lean +189 -0
- package/src/proof/quantum.lean +161 -0
- package/src/proof/reach.lean +84 -0
- package/src/proof/recovered.lean +56 -0
- package/src/proof/reversal.lean +73 -0
- package/src/proof/rights.lean +157 -0
- package/src/proof/sequences.lean +105 -0
- package/src/proof/speed.lean +129 -0
- package/src/proof/split.lean +180 -0
- package/src/proof/theorems.lean +48 -1
- package/src/proof/trial-all.json +15260 -0
- package/src/proof/z9.lean +92 -0
- package/src/proof/z9plus.lean +208 -0
- package/src/proofs.lisp +3 -3
- package/src/prove/emit.ts +115 -0
- package/src/prove/index.ts +143 -0
- package/src/prove/translate.ts +638 -0
- package/src/publication/index.ts +363 -0
- package/src/quantum/field.ts +73 -0
- package/src/quantum/tree.ts +79 -0
package/.zenodo.json
CHANGED
|
@@ -9,19 +9,43 @@
|
|
|
9
9
|
"affiliation": "PSG, Bulgaria"
|
|
10
10
|
}
|
|
11
11
|
],
|
|
12
|
-
"description": "A free, open, recomputable framework: an exact finite-arithmetic study on the ring Z/9 (the 'vortex') and the group (Z/7)* (the seven-ray Pliska 'rosette'), with a classical simulator of quantum algorithms (TypeScript, formalized in Lean 4, documented in VitePress). Observations: (1) division by zero is treated as a change of domain (n/0 := n^-1 mod 9 on units; 0 <-> infinity on the Riemann sphere); (2) inversion and ten's-complement reflection (10 - d) are involutions; (3) a 7 = 6 + 1 bijection maps the rosette (six units + center) onto the Clay set (six open problems + Poincare); (4) a mechanical entailment test reports 0/7. Conclusion (observed): the framework reflects/maps the Millennium Problems into one algebraic structure; it does NOT solve them and is not a physical theory. It is a proof of concept and a classical simulator. All results recompute from source.",
|
|
12
|
+
"description": "A free, open, recomputable framework: an exact finite-arithmetic study on the ring Z/9 (the 'vortex') and the group (Z/7)* (the seven-ray Pliska 'rosette'), with a classical simulator of quantum algorithms (TypeScript, formalized in Lean 4, documented in VitePress). Observations: (1) division by zero is treated as a change of domain (n/0 := n^-1 mod 9 on units; 0 <-> infinity on the Riemann sphere); (2) inversion and ten's-complement reflection (10 - d) are involutions; (3) a 7 = 6 + 1 bijection maps the rosette (six units + center) onto the Clay set (six open problems + Poincare); (4) a mechanical entailment test reports 0/7. Conclusion (observed): the framework reflects/maps the Millennium Problems into one algebraic structure; it does NOT solve them and is not a physical theory. It is a proof of concept and a classical simulator. All results recompute from source. EARLIER VERSIONS OF THIS RECORD CLAIMED MORE THAN THIS ONE DOES. The deposits this supersedes are titled 'All Seven Clay Millennium Problems Sealed via Universal sigma-Involution' (10.5281/zenodo.21781603) and 'Quantum Proofs of the Clay Millennium Problems v1.0' (10.5281/zenodo.21787144). Those titles assert what this version explicitly refuses: it proves 0 of the 7, a gate fails the build on any sentence claiming otherwise, and the correspondence with the Clay set is a mapping, not a solution. Published Zenodo records are permanent and cannot be retitled, so the discrepancy is stated here instead. A reader following the version chain should read the earlier titles as superseded by this one.",
|
|
13
13
|
"keywords": [
|
|
14
|
-
"modular arithmetic",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
14
|
+
"modular arithmetic",
|
|
15
|
+
"Z/9",
|
|
16
|
+
"group theory",
|
|
17
|
+
"Pliska rosette",
|
|
18
|
+
"Clay Millennium Problems",
|
|
19
|
+
"recreational mathematics",
|
|
20
|
+
"content-addressing",
|
|
21
|
+
"Lean 4",
|
|
22
|
+
"VitePress",
|
|
23
|
+
"quantum algorithm simulation",
|
|
24
|
+
"sacred geometry (interpretation)"
|
|
17
25
|
],
|
|
18
|
-
"license": "cc-by-nc-4.0",
|
|
26
|
+
"license": "cc-by-nc-nd-4.0",
|
|
19
27
|
"access_right": "open",
|
|
20
28
|
"version": "1.3.5",
|
|
21
29
|
"related_identifiers": [
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
{
|
|
31
|
+
"identifier": "10.5281/zenodo.21781603",
|
|
32
|
+
"relation": "isNewVersionOf",
|
|
33
|
+
"scheme": "doi"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"identifier": "10.5281/zenodo.21787144",
|
|
37
|
+
"relation": "isNewVersionOf",
|
|
38
|
+
"scheme": "doi"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"identifier": "10.5281/zenodo.21819217",
|
|
42
|
+
"relation": "isNewVersionOf",
|
|
43
|
+
"scheme": "doi"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"identifier": "https://github.com/ceccec/millennium-solutions",
|
|
47
|
+
"relation": "isSupplementTo",
|
|
48
|
+
"scheme": "url"
|
|
49
|
+
}
|
|
26
50
|
]
|
|
27
51
|
}
|
package/ACCOUNTING.md
CHANGED
|
@@ -8,20 +8,20 @@ Every figure recomputes from `src/` and the git tree on each build; nothing is e
|
|
|
8
8
|
|
|
9
9
|
| Quantity | Value |
|
|
10
10
|
|---|---|
|
|
11
|
-
| Decidable theorems (chained receipts) | **
|
|
11
|
+
| Decidable theorems (chained receipts) | **2,543** |
|
|
12
12
|
| Signed statement receipts | **29** |
|
|
13
13
|
| Coins per receipt | **2** |
|
|
14
|
-
| Coins on the ledger (theorems × 2) | **
|
|
14
|
+
| Coins on the ledger (theorems × 2) | **5,086** |
|
|
15
15
|
| Coins on signed receipts (× 2) | **58** |
|
|
16
|
-
| Released versions (git tags) | **
|
|
17
|
-
| Tracked, content-addressed files | **
|
|
16
|
+
| Released versions (git tags) | **847** |
|
|
17
|
+
| Tracked, content-addressed files | **475** |
|
|
18
18
|
|
|
19
|
-
Latest release: **
|
|
19
|
+
Latest release: **v8.9.9**. The fair-exchange unit is **2 coins = 2 bits** (110 − 108 = 2 = −χ genus-2) per receipt. One 64-bit harmony coin is minted per fused `src` `report()` module — see the [state dashboard](/dashboard) for the harmonic root.
|
|
20
20
|
|
|
21
21
|
## Bounty — denominated in bits
|
|
22
22
|
|
|
23
|
-
The bounty for each accepted contribution is **2 bits (2 coins)** — the same fair-exchange unit, earned by the deed (a gate-passing, receipted contribution) and owed by commercial use. Total bounty accounted on the ledger so far: **
|
|
23
|
+
The bounty for each accepted contribution is **2 bits (2 coins)** — the same fair-exchange unit, earned by the deed (a gate-passing, receipted contribution) and owed by commercial use. Total bounty accounted on the ledger so far: **5,086 bits**. This is an accounting bounty in bits/coins — **integrity, not a cash prize**; the deposit itself claims **0 / 7** of the Clay prize. Heroes and traitors by deeds, not claims.
|
|
24
24
|
|
|
25
25
|
**Not tracked here: tokens.** This repo measures coins (2 per receipt) and 64-bit harmony coins; it does not measure tokens, so no token count or token-to-coin rate is shown — measuring an unmeasured quantity would be an assertion without a receipt. Measure, do not assert.
|
|
26
26
|
|
|
27
|
-
Page content-address: `
|
|
27
|
+
Page content-address: `cc310268-78eb-888d-8990-f7d4503f747d`. Integrity, not truth. `entails → 0/7`.
|
package/AXIOMS.md
ADDED
|
@@ -0,0 +1,559 @@
|
|
|
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 **628** 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 **306** 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 306 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), 18 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 := 17
|
|
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), 8 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), 8 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), 7 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), 32 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 := 31
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### `energy.lean` — 18 definition(s), 19 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 mgH2 : Nat := 2016 -- H₂ = 2 × 1.008 g/mol
|
|
221
|
+
def mgO2 : Nat := 31998 -- O₂ = 2 × 15.999 g/mol
|
|
222
|
+
def mgH2O : Nat := 18015 -- H₂O = 18.015 g/mol
|
|
223
|
+
def balances (a b c : Nat) : Bool := (2 * a == 2 * b) && (a == 2 * c)
|
|
224
|
+
def atomsH2 : Nat × Nat := (2, 0)
|
|
225
|
+
def atomsO2 : Nat × Nat := (0, 2)
|
|
226
|
+
def atomsH2O : Nat × Nat := (2, 1)
|
|
227
|
+
def molH2 : Nat := 496 -- moles in 1 kg of H₂ (1000 g ÷ 2.016)
|
|
228
|
+
def molO2 : Nat := 248 -- the oxygen that comes with it, half as many moles
|
|
229
|
+
def mLperMol : Nat := 22414 -- millilitres per mole at STP
|
|
230
|
+
def whPerKgH2 : Nat := 33300 -- lower heating value, Wh per kg
|
|
231
|
+
def petrolWhL : Nat := 9700 -- Wh per litre of petrol, for scale
|
|
232
|
+
def tdsSeawater : Nat := 35000 -- mg of dissolved solids per litre
|
|
233
|
+
def tdsTapWater : Nat := 50 -- mg per litre, ordinary supply
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### `families.lean` — 44 definition(s), 41 theorem(s)
|
|
237
|
+
|
|
238
|
+
```lean
|
|
239
|
+
def primesUpTo30 : List Nat := [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
|
|
240
|
+
def fact (n : Nat) : Nat := (List.range n).foldl (fun a k => a * (k + 1)) 1
|
|
241
|
+
def choose (n k : Nat) : Nat := fact n / (fact k * fact (n - k))
|
|
242
|
+
def gcdFuel : Nat → Nat → Nat → Nat
|
|
243
|
+
def gcd ' (a b : Nat) : Nat := gcdFuel (a + b + 1) a b
|
|
244
|
+
def totient (n : Nat) : Nat := ((List.range n).filter (fun a => gcd' a n == 1)).length
|
|
245
|
+
def popcount (n : Nat) : Nat := ((List.range 16).filter (fun i => (n >>> i) % 2 == 1)).length
|
|
246
|
+
def isPrime (n : Nat) : Bool := n ≥ 2 && (List.range' 2 (n - 2)).all (fun d => n % d != 0)
|
|
247
|
+
def unitsMod (m : Nat) : List Nat := (List.range m).filter (fun a => gcd' a m == 1)
|
|
248
|
+
def powMod (g k m : Nat) : Nat := (List.range k).foldl (fun a _ => a * g % m) (1 % m)
|
|
249
|
+
def ordMod (g m : Nat) : Nat := ((List.range' 1 m).find? (fun k => powMod g k m == 1)).getD 0
|
|
250
|
+
def hasPrimitiveRoot (m : Nat) : Bool := (unitsMod m).any (fun g => ordMod g m == (unitsMod m).length)
|
|
251
|
+
def isOddPrimePower (n : Nat) : Bool :=
|
|
252
|
+
def gaussCyclic (m : Nat) : Bool :=
|
|
253
|
+
def permutesZ9 (k : Nat) : Bool := (List.range 9).all (fun y => (List.range 9).any (fun d => k * d % 9 == y))
|
|
254
|
+
def addOrbit (k : Nat) : List Nat := (List.range 9).map (fun t => (List.range t).foldl (fun a _ => (a + k) % 9) 0)
|
|
255
|
+
def addGeneratesZ9 (k : Nat) : Bool := (List.range 9).all (fun y => (addOrbit k).contains y)
|
|
256
|
+
def invOf (d : Nat) : Option Nat := (List.range 9).find? (fun e => d * e % 9 == 1)
|
|
257
|
+
def powSum (k n : Nat) : Nat := ((List.range' 1 n).map (fun i => i ^ k)).foldl (· + ·) 0
|
|
258
|
+
def faulhaber (k n : Nat) : Nat :=
|
|
259
|
+
def digitsF : Nat → Nat → List Nat
|
|
260
|
+
def digitsOf (n : Nat) : List Nat := digitsF 20 n
|
|
261
|
+
def reverseDigits (n : Nat) : Nat := (digitsOf n).foldl (fun a d => a * 10 + d) 0
|
|
262
|
+
def digitalRoot (n : Nat) : Nat := if n == 0 then 0 else 1 + (n - 1) % 9
|
|
263
|
+
def rootSum (g m : Nat) : Nat := ((List.range (ordMod g m)).map (fun k => powMod g k m)).foldl (· + ·) 0
|
|
264
|
+
def vpF : Nat → Nat → Nat → Nat
|
|
265
|
+
def vp (p n : Nat) : Nat := vpF 20 p n
|
|
266
|
+
def isSumOfTwoSquares (n : Nat) : Bool :=
|
|
267
|
+
def everyThreeModFourPrimeIsEven (n : Nat) : Bool :=
|
|
268
|
+
def digitSquareSum (n : Nat) : Nat := ((digitsOf n).map (fun d => d * d)).foldl (· + ·) 0
|
|
269
|
+
def iterF : Nat → Nat → Nat
|
|
270
|
+
def polyRec : Nat → Nat → Nat
|
|
271
|
+
def fibPair : Nat → Nat × Nat
|
|
272
|
+
def fib (n : Nat) : Nat := (fibPair n).1
|
|
273
|
+
def digitSum (n : Nat) : Nat := (digitsOf n).foldl (· + ·) 0
|
|
274
|
+
def cfPair : Nat → Nat × Nat
|
|
275
|
+
def catalanList : Nat → List Nat
|
|
276
|
+
def pisano (m : Nat) : Nat := ((List.range' 1 100).find? (fun k => fib k % m == 0 && fib (k + 1) % m == 1)).getD 0
|
|
277
|
+
def interleaveN (x : Nat) : List Nat → List (List Nat)
|
|
278
|
+
def permsN : List Nat → List (List Nat)
|
|
279
|
+
def isInvolution (p : List Nat) : Bool := (List.range p.length).all (fun i => p.getD (p.getD i 0) 0 == i)
|
|
280
|
+
def telephone : Nat → Nat
|
|
281
|
+
def schlafli : List (Nat × Nat) :=
|
|
282
|
+
def settledHere : Nat := 40
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### `fnv.lean` — 13 definition(s), 13 theorem(s)
|
|
286
|
+
|
|
287
|
+
```lean
|
|
288
|
+
def xorF : Nat → Nat → Nat → Nat
|
|
289
|
+
def M32 : Nat := 4294967296
|
|
290
|
+
def xor32 (a b : Nat) : Nat := xorF 33 a b
|
|
291
|
+
def shr (n k : Nat) : Nat := n / (2 ^ k)
|
|
292
|
+
def mul32 (a b : Nat) : Nat := (a * b) % M32
|
|
293
|
+
def FNV_OFFSET : Nat := 2166136261 -- 0x811c9dc5
|
|
294
|
+
def FNV_PRIME : Nat := 16777619 -- 0x01000193
|
|
295
|
+
def MIX1 : Nat := 2246822507 -- 0x85ebca6b
|
|
296
|
+
def MIX2 : Nat := 3266489909 -- 0xc2b2ae35
|
|
297
|
+
def step (h c : Nat) : Nat :=
|
|
298
|
+
def avalanche (h : Nat) : Nat :=
|
|
299
|
+
def hash32 (seed : Nat) (cs : List Nat) : Nat := avalanche (cs.foldl step (xor32 FNV_OFFSET seed))
|
|
300
|
+
def settledHere : Nat := 12
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### `index.lean` — 5 definition(s), 11 theorem(s)
|
|
304
|
+
|
|
305
|
+
```lean
|
|
306
|
+
def isUnit (d : Nat) : Bool := (List.range 9).any (fun e => (d * e) % 9 == 1) -- DERIVED: d has an inverse mod 9
|
|
307
|
+
def refl (d : Nat) : Nat := 10 - d -- the reflection (= division by zero)
|
|
308
|
+
def orbit (k : Nat) : Nat := (2 ^ k) % 9 -- the doubling sequence 2^k, computed
|
|
309
|
+
def span : List Nat := (List.range 6).map orbit -- the doubling span (one period), computed
|
|
310
|
+
def sequence : List Nat := [1, 2, 4, 8, 7, 5, 3, 6, 9, 0, 1]
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### `involution.lean` — 7 definition(s), 8 theorem(s)
|
|
314
|
+
|
|
315
|
+
```lean
|
|
316
|
+
def matchings : Nat → List Nat → List (List (Nat × Nat))
|
|
317
|
+
def nine : List Nat := [0, 1, 2, 3, 4, 5, 6, 7, 8]
|
|
318
|
+
def all : List (List (Nat × Nat)) := matchings 10 nine
|
|
319
|
+
def fixedPoints (m : List (Nat × Nat)) : Nat := (m.filter (fun p => p.1 == p.2)).length
|
|
320
|
+
def swaps (m : List (Nat × Nat)) : List (Nat × Nat) := m.filter (fun p => p.1 != p.2)
|
|
321
|
+
def constantSum (m : List (Nat × Nat)) : Bool :=
|
|
322
|
+
def coinLike : List (Nat × Nat) := [(0, 0), (1, 8), (2, 7), (3, 6), (4, 5)]
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### `ledgerclaims.lean` — 3 definition(s), 8 theorem(s)
|
|
326
|
+
|
|
327
|
+
```lean
|
|
328
|
+
def rounds : Nat → Nat → Nat
|
|
329
|
+
def saving (value verify : Nat) : Nat := value - verify
|
|
330
|
+
def addr4 (x : Nat) : Nat := x % 16
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### `light.lean` — 13 definition(s), 11 theorem(s)
|
|
334
|
+
|
|
335
|
+
```lean
|
|
336
|
+
def c : Nat := 299792458 -- m/s, exact
|
|
337
|
+
def dNuCs : Nat := 9192631770 -- Hz, exact — the caesium-133 hyperfine transition
|
|
338
|
+
def hDigits : Nat := 662607015 -- h = 6.62607015 × 10⁻³⁴ J s
|
|
339
|
+
def eDigits : Nat := 1602176634 -- e = 1.602176634 × 10⁻¹⁹ C
|
|
340
|
+
def kDigits : Nat := 1380649 -- k = 1.380649 × 10⁻²³ J/K
|
|
341
|
+
def naDigits : Nat := 602214076 -- N_A = 6.02214076 × 10²³ mol⁻¹
|
|
342
|
+
def kcd : Nat := 683 -- K_cd, lm/W, exact
|
|
343
|
+
def defining : List Nat := [c, dNuCs, hDigits, eDigits, kDigits, naDigits, kcd]
|
|
344
|
+
def travel (seconds : Nat) : Nat := c * seconds -- metres crossed in a whole number of seconds
|
|
345
|
+
def periods (seconds : Nat) : Nat := dNuCs * seconds -- caesium periods elapsed in the same interval
|
|
346
|
+
def root (n : Nat) : Nat := if n == 0 then 9 else 1 + (n - 1) % 9
|
|
347
|
+
def kcdDoubled : Nat := 1366 -- K_cd expressed against a unit half the size; the same luminous efficacy
|
|
348
|
+
def alternative : List Nat := [c, dNuCs, hDigits, eDigits, kDigits, naDigits, kcdDoubled]
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### `mechanical.lean` — 5 definition(s), 107 theorem(s)
|
|
352
|
+
|
|
353
|
+
```lean
|
|
354
|
+
def M9 (n : Nat) : Nat := n % 9
|
|
355
|
+
def DR (n : Nat) : Nat := if n == 0 then 0 else 1 + (n - 1) % 9
|
|
356
|
+
def gRange : List Nat := [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
|
|
357
|
+
def dbl : Nat → Nat
|
|
358
|
+
def forgetful (_ : Nat) : Nat := 0
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### `merkaba.lean` — 6 definition(s), 8 theorem(s)
|
|
362
|
+
|
|
363
|
+
```lean
|
|
364
|
+
def axis : List Nat := [3, 6, 0] -- {3,6,9} — the spindle
|
|
365
|
+
def tetA : List Nat := [1, 4, 7]
|
|
366
|
+
def tetB : List Nat := [2, 5, 8]
|
|
367
|
+
def dbl (l : List Nat) : List Nat := l.map (fun d => m9 (2 * d))
|
|
368
|
+
def tri (n : Nat) : Nat := n * (n + 1) / 2
|
|
369
|
+
def sumTri (n : Nat) : Nat := ((List.range' 1 n).map tri).foldl (· + ·) 0
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### `merkle.lean` — 18 definition(s), 12 theorem(s)
|
|
373
|
+
|
|
374
|
+
```lean
|
|
375
|
+
def hexDigit (n : Nat) : Nat := if n < 10 then 48 + n else 87 + n
|
|
376
|
+
def byteHex (b : Nat) : List Nat := [hexDigit (b / 16), hexDigit (b % 16)]
|
|
377
|
+
def uuidChars (bs : List Nat) : List Nat :=
|
|
378
|
+
def merge (a b : List Nat) : List Nat := toUuidBytes (uuidChars a ++ [58] ++ uuidChars b)
|
|
379
|
+
def leB : List Nat → List Nat → Bool
|
|
380
|
+
def insB (a : List Nat) : List (List Nat) → List (List Nat)
|
|
381
|
+
def sortB : List (List Nat) → List (List Nat)
|
|
382
|
+
def pairUp : List (List Nat) → List (List Nat)
|
|
383
|
+
def foldF : Nat → List (List Nat) → List (List Nat)
|
|
384
|
+
def EMPTY_SEED : List Nat := [101, 109, 112, 116, 121, 45, 109, 105, 110, 100] -- "empty-mind"
|
|
385
|
+
def merkleFold (leaves : List (List Nat)) : List Nat :=
|
|
386
|
+
def A : List Nat := toUuidBytes [97] -- address of "a"
|
|
387
|
+
def C : List Nat := toUuidBytes [99] -- address of "c"
|
|
388
|
+
def B : List Nat := toUuidBytes [98] -- address of "b"
|
|
389
|
+
def settledHere : Nat := 11
|
|
390
|
+
def interleave (x : List Nat) : List (List Nat) → List (List (List Nat))
|
|
391
|
+
def perms : List (List Nat) → List (List (List Nat))
|
|
392
|
+
def D : List Nat := toUuidBytes [100] -- address of "d"
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### `nim.lean` — 7 definition(s), 10 theorem(s)
|
|
396
|
+
|
|
397
|
+
```lean
|
|
398
|
+
def xorN (a b : Nat) : Nat := xorF 33 a b
|
|
399
|
+
def N : Nat := 6
|
|
400
|
+
def moves (a b : Nat) : List (Nat × Nat) :=
|
|
401
|
+
def lost : Nat → Nat → Nat → Bool
|
|
402
|
+
def isLost (a b : Nat) : Bool := lost (a + b + 1) a b
|
|
403
|
+
def mex (s : List Nat) : Nat := ((List.range (s.length + 1)).filter (fun m => ! s.contains m)).headD 0
|
|
404
|
+
def grundy1 : Nat → Nat → Nat
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### `phenomena.lean` — 3 definition(s), 4 theorem(s)
|
|
408
|
+
|
|
409
|
+
```lean
|
|
410
|
+
abbrev Entry := Nat × Nat
|
|
411
|
+
def entries : List Entry :=
|
|
412
|
+
def statusOf (e : Entry) : Nat := e.2
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
### `priorart.lean` — 5 definition(s), 9 theorem(s)
|
|
416
|
+
|
|
417
|
+
```lean
|
|
418
|
+
abbrev Source := Nat × Nat × Bool
|
|
419
|
+
def idOf (s : Source) : Nat := s.1
|
|
420
|
+
def kindOf (s : Source) : Nat := s.2.1
|
|
421
|
+
def novelty (s : Source) : Bool := s.2.2
|
|
422
|
+
def sources : List Source :=
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### `quantum.lean` — 11 definition(s), 12 theorem(s)
|
|
426
|
+
|
|
427
|
+
```lean
|
|
428
|
+
def insertEverywhere (x : Nat) : List Nat → List (List Nat)
|
|
429
|
+
def perms : List Nat → List (List Nat)
|
|
430
|
+
def ins (x : Nat) : List Nat → List Nat
|
|
431
|
+
def sort : List Nat → List Nat
|
|
432
|
+
def receipt (l : List Nat) : Nat := (sort l).foldl (fun a b => (a * 2 + b) % 9) 0
|
|
433
|
+
def naive (l : List Nat) : Nat := l.foldl (fun a b => (a * 2 + b) % 9) 0
|
|
434
|
+
def pairsOverNine : List (List Nat) :=
|
|
435
|
+
def settledHere : Nat := 11
|
|
436
|
+
def bit (n i : Nat) : Nat := n / (2 ^ i) % 2
|
|
437
|
+
def par3 (n : Nat) : Nat := (bit n 0 + bit n 1 + bit n 2) % 2
|
|
438
|
+
def ghzXSupport : List Nat := [0, 3, 5, 6]
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### `reach.lean` — 2 definition(s), 4 theorem(s)
|
|
442
|
+
|
|
443
|
+
```lean
|
|
444
|
+
def bounds : List Nat := List.range' 1 50
|
|
445
|
+
def largestDomainHere : Nat := 152568360000
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### `recovered.lean` — 3 definition(s), 15 theorem(s)
|
|
449
|
+
|
|
450
|
+
```lean
|
|
451
|
+
def units : List Nat := [1, 2, 4, 5, 7, 8]
|
|
452
|
+
def triad : List Nat := [3, 6, 9]
|
|
453
|
+
def pow9 (b k : Nat) : Nat := (List.range k).foldl (fun a _ => a * b % 9) 1
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### `reversal.lean` — 6 definition(s), 9 theorem(s)
|
|
457
|
+
|
|
458
|
+
```lean
|
|
459
|
+
def digitsF : Nat → Nat → List Nat
|
|
460
|
+
def digits (n : Nat) : List Nat := if n == 0 then [0] else digitsF (n + 1) n
|
|
461
|
+
def reverseNum (n : Nat) : Nat := (digits n).foldl (fun a d => a * 10 + d) 0
|
|
462
|
+
def digitSum (n : Nat) : Nat := (digits n).foldl (· + ·) 0
|
|
463
|
+
def isPrime (n : Nat) : Bool := n > 1 && (List.range n).all (fun d => d < 2 || n % d != 0)
|
|
464
|
+
def settledHere : Nat := 8
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### `rights.lean` — 7 definition(s), 9 theorem(s)
|
|
468
|
+
|
|
469
|
+
```lean
|
|
470
|
+
abbrev Instrument := Nat × Nat × Bool × Bool
|
|
471
|
+
def idOf (r : Instrument) : Nat := r.1
|
|
472
|
+
def kindOf (r : Instrument) : Nat := r.2.1
|
|
473
|
+
def auto (r : Instrument) : Bool := r.2.2.1
|
|
474
|
+
def claim (r : Instrument) : Bool := r.2.2.2
|
|
475
|
+
def instruments : List Instrument :=
|
|
476
|
+
def settledHere : Nat := 8
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### `sequences.lean` — 7 definition(s), 12 theorem(s)
|
|
480
|
+
|
|
481
|
+
```lean
|
|
482
|
+
def fib : Nat → Nat
|
|
483
|
+
def fact (n : Nat) : Nat := (List.range n).foldl (fun a k => a * (k + 1)) 1
|
|
484
|
+
def choose (n k : Nat) : Nat := fact n / (fact k * fact (n - k))
|
|
485
|
+
def andF : Nat → Nat → Nat → Nat
|
|
486
|
+
def andN (a b : Nat) : Nat := andF 33 a b
|
|
487
|
+
def popcount (n : Nat) : Nat := (List.range 12).foldl (fun a i => a + n / 2 ^ i % 2) 0
|
|
488
|
+
def tm (n : Nat) : Nat := popcount n % 2
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
### `speed.lean` — 7 definition(s), 10 theorem(s)
|
|
492
|
+
|
|
493
|
+
```lean
|
|
494
|
+
def recomputeUs : Nat := 21582900 -- folding 2^20 leaves
|
|
495
|
+
def verifyUs : Nat := 38 -- walking the 20-node inclusion path
|
|
496
|
+
def nsPerVerify : Nat := 38000 -- the same verify, in nanoseconds
|
|
497
|
+
def hexChars : Nat := 32 -- an address in the 8-bit hex form fixed by RFC 9562 §5.8
|
|
498
|
+
def hexbitChars : Nat := 22 -- the same address over the 64-hexagram lattice
|
|
499
|
+
def hexMs : Nat := 16 -- median ms for 200,000 encodings, 8-bit table
|
|
500
|
+
def hexbitMs : Nat := 30 -- the same work, 6-bit lattice
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
### `split.lean` — 8 definition(s), 19 theorem(s)
|
|
504
|
+
|
|
505
|
+
```lean
|
|
506
|
+
def tokens : List Nat := [0, 12, 3, 45, 6, 78, 9]
|
|
507
|
+
def singles : List Nat := [0, 3, 6, 9]
|
|
508
|
+
def pairs : List Nat := [12, 45, 78]
|
|
509
|
+
def unitsOf9 : List Nat := [1, 2, 4, 5, 7, 8]
|
|
510
|
+
def isUnit9 (d : Nat) : Bool := (List.range 9).any (fun e => (d * e) % 9 == 1)
|
|
511
|
+
def coins : Nat := 2
|
|
512
|
+
def coinStep : Nat := 3 * coins
|
|
513
|
+
def sealBits : Nat := 128
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
### `theorems.lean` — 1 definition(s), 8 theorem(s)
|
|
517
|
+
|
|
518
|
+
```lean
|
|
519
|
+
def refl (d : Nat) : Nat := 10 - d -- the shared reflection r(d) = 10 − d (the ½/heart-analogue centre)
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
### `z9.lean` — 7 definition(s), 21 theorem(s)
|
|
523
|
+
|
|
524
|
+
```lean
|
|
525
|
+
def B : Nat := 9
|
|
526
|
+
def m9 (n : Nat) : Nat := n % B
|
|
527
|
+
def isUnit (d : Nat) : Bool := (List.range B).any (fun e => m9 (d * e) == 1)
|
|
528
|
+
def units : List Nat := (List.range B).filter isUnit
|
|
529
|
+
def pow9 (b e : Nat) : Nat := m9 (b ^ e)
|
|
530
|
+
def orbit (k : Nat) : Nat := m9 (2 ^ k)
|
|
531
|
+
def settledHere : Nat := 20
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
### `z9plus.lean` — 16 definition(s), 32 theorem(s)
|
|
535
|
+
|
|
536
|
+
```lean
|
|
537
|
+
def m9 (n : Nat) : Nat := n % 9
|
|
538
|
+
def R : List Nat := List.range 9
|
|
539
|
+
def pw (b e : Nat) : Nat := m9 (b ^ e)
|
|
540
|
+
def generates (g : Nat) : Bool := ((List.range' 1 6).map (fun k => pw g k)).eraseDups.length == 6
|
|
541
|
+
def dr (n : Nat) : Nat := if n == 0 then 0 else if m9 n == 0 then 9 else m9 n
|
|
542
|
+
def ord (u : Nat) : Nat := ((List.range' 1 6).filter (fun k => pw u k == 1)).headD 0
|
|
543
|
+
def refl (d : Nat) : Nat := 10 - d
|
|
544
|
+
def orbit6 : List Nat := (List.range 6).map (fun k => pw 2 k)
|
|
545
|
+
def dbl (d : Nat) : Nat := m9 (d * 2)
|
|
546
|
+
def rfl9 (d : Nat) : Nat := m9 (10 - d)
|
|
547
|
+
def grow (s : List Nat) : List Nat := (s ++ s.map dbl ++ s.map rfl9).eraseDups
|
|
548
|
+
def closure : Nat → List Nat → List Nat
|
|
549
|
+
def fib : Nat → Nat
|
|
550
|
+
def fib9 (n : Nat) : Nat := m9 (fib n)
|
|
551
|
+
def gcdF : Nat → Nat → Nat → Nat
|
|
552
|
+
def gcd9 (a b : Nat) : Nat := gcdF (a + b + 1) a b
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
**628** declarations, **0** axiom dependencies, **306** definitions they rest on.
|
|
558
|
+
A content-address proves integrity, not truth, and an axiom index proves neither: it states what was
|
|
559
|
+
assumed, so a reader can disagree with the assumptions rather than guess at them. `0/7`.
|