@ceccec/millennium-solutions 9.3.3 → 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.
Files changed (259) hide show
  1. package/README.md +14 -0
  2. package/dist/mod.core.d.ts +9 -0
  3. package/dist/mod.core.js +9 -0
  4. package/dist/src/0/index.d.ts +47 -0
  5. package/dist/src/0/index.js +189 -0
  6. package/dist/src/0/ledger.d.ts +1 -0
  7. package/dist/src/0/ledger.js +25 -0
  8. package/dist/src/0/trinity-matrix.d.ts +1 -0
  9. package/dist/src/0/trinity-matrix.js +16 -0
  10. package/dist/src/5/aspects.d.ts +1 -0
  11. package/dist/src/5/aspects.js +22 -0
  12. package/dist/src/5/reflection.d.ts +1 -0
  13. package/dist/src/5/reflection.js +25 -0
  14. package/dist/src/7/rosetta.d.ts +1 -0
  15. package/dist/src/7/rosetta.js +24 -0
  16. package/dist/src/9/enumeration.d.ts +1 -0
  17. package/dist/src/9/enumeration.js +14 -0
  18. package/dist/src/honesty/index.d.ts +16 -0
  19. package/dist/src/honesty/index.js +69 -0
  20. package/package.json +27 -10
  21. package/.zenodo.json +0 -51
  22. package/ABSTRACT.md +0 -155
  23. package/ACCOUNTING.md +0 -27
  24. package/AXIOMS.md +0 -574
  25. package/CHALLENGES.md +0 -2595
  26. package/DEPLOY.md +0 -39
  27. package/DEVELOP.md +0 -34
  28. package/HEART.md +0 -112
  29. package/PHYSICS-SCALES.md +0 -80
  30. package/PRIOR-ART.md +0 -151
  31. package/PROOF-OF-CONCEPT.md +0 -81
  32. package/REALISATIONS.md +0 -87
  33. package/RESEARCH.md +0 -188
  34. package/RULES.md +0 -57
  35. package/SEQUENCE-DECODE.md +0 -196
  36. package/SIGNATURE.md +0 -34
  37. package/THEOREMS.md +0 -97
  38. package/WHITEPAPER.md +0 -40
  39. package/WORKFLOWS.md +0 -47
  40. package/boundaries.md +0 -23
  41. package/captain.md +0 -85
  42. package/compare.md +0 -42
  43. package/compute.md +0 -543
  44. package/cryptography.md +0 -55
  45. package/dashboard.md +0 -50
  46. package/examples.md +0 -47
  47. package/folds.md +0 -65
  48. package/forensic.md +0 -67
  49. package/guide.md +0 -126
  50. package/harness.md +0 -20
  51. package/index.md +0 -217
  52. package/mod.core.ts +0 -10
  53. package/nature.md +0 -58
  54. package/organism.md +0 -30
  55. package/paper.md +0 -8789
  56. package/proofs.md +0 -26
  57. package/quantum.md +0 -40
  58. package/rights.md +0 -39
  59. package/solutions.md +0 -28
  60. package/speedup.md +0 -41
  61. package/src/0/chacha.ts +0 -3
  62. package/src/0/crypt.ts +0 -4
  63. package/src/0/csp.ts +0 -10
  64. package/src/0/entanglement.ts +0 -31
  65. package/src/0/fusion.ts +0 -28
  66. package/src/0/holographic.ts +0 -57
  67. package/src/0/impossible.ts +0 -30
  68. package/src/0/imprint.ts +0 -160
  69. package/src/0/index.ts +0 -263
  70. package/src/0/ledger.ts +0 -25
  71. package/src/0/legible.ts +0 -29
  72. package/src/0/limit.ts +0 -29
  73. package/src/0/merkle-proof.ts +0 -3
  74. package/src/0/null-token.ts +0 -24
  75. package/src/0/sha256.ts +0 -3
  76. package/src/0/singularity.ts +0 -20
  77. package/src/0/stream.ts +0 -47
  78. package/src/0/trinities.ts +0 -37
  79. package/src/0/trinity-matrix.ts +0 -20
  80. package/src/0/version-matrix.ts +0 -70
  81. package/src/1/acceptance.ts +0 -26
  82. package/src/1/index.ts +0 -80
  83. package/src/1/paradox.ts +0 -28
  84. package/src/1/vortex.lean +0 -6
  85. package/src/2/frequency-scales.ts +0 -28
  86. package/src/2/iching.ts +0 -34
  87. package/src/2/index.ts +0 -78
  88. package/src/2/primes-vortex.ts +0 -12
  89. package/src/2/quantum.ts +0 -48
  90. package/src/2/string-scale.ts +0 -14
  91. package/src/2/vortex.lean +0 -10
  92. package/src/3/index.ts +0 -63
  93. package/src/3/pi-bbp.ts +0 -13
  94. package/src/3/trinity.ts +0 -39
  95. package/src/3/vortex.lean +0 -7
  96. package/src/4/git.ts +0 -30
  97. package/src/4/index.ts +0 -63
  98. package/src/4/vortex.lean +0 -6
  99. package/src/5/aspects.ts +0 -27
  100. package/src/5/center.ts +0 -35
  101. package/src/5/development.ts +0 -45
  102. package/src/5/diamond.ts +0 -35
  103. package/src/5/folds.ts +0 -12
  104. package/src/5/index.ts +0 -63
  105. package/src/5/reflection.lean +0 -14
  106. package/src/5/reflection.ts +0 -14
  107. package/src/5/vortex.lean +0 -10
  108. package/src/6/dna.ts +0 -27
  109. package/src/6/index.ts +0 -63
  110. package/src/6/vortex.lean +0 -7
  111. package/src/7/cross.ts +0 -31
  112. package/src/7/glagolitic.ts +0 -51
  113. package/src/7/index.ts +0 -67
  114. package/src/7/language-lens.ts +0 -41
  115. package/src/7/lens.ts +0 -41
  116. package/src/7/locale.ts +0 -105
  117. package/src/7/rbac.ts +0 -31
  118. package/src/7/rosetta-clay.ts +0 -15
  119. package/src/7/rosetta.lean +0 -11
  120. package/src/7/rosetta.ts +0 -11
  121. package/src/7/string-dimensions.ts +0 -14
  122. package/src/7/vortex.lean +0 -6
  123. package/src/8/infinite.ts +0 -26
  124. package/src/8/merkaba/field.ts +0 -27
  125. package/src/8/merkaba/geometry.ts +0 -16
  126. package/src/8/merkaba/touch.ts +0 -26
  127. package/src/8/nucleus/magic.lean +0 -15
  128. package/src/8/nucleus/proton-mass-fit.ts +0 -9
  129. package/src/8/nucleus/proton-mass.lean +0 -10
  130. package/src/8/nucleus/shell-model-magic.ts +0 -10
  131. package/src/8/vortex.lean +0 -7
  132. package/src/9/access.ts +0 -34
  133. package/src/9/aura-funding.ts +0 -25
  134. package/src/9/coins.ts +0 -25
  135. package/src/9/enumeration.ts +0 -13
  136. package/src/9/funding.ts +0 -85
  137. package/src/9/security.ts +0 -36
  138. package/src/9/society.ts +0 -32
  139. package/src/9/vortex.lean +0 -11
  140. package/src/api/gates.ts +0 -122
  141. package/src/api/index.ts +0 -447
  142. package/src/api/lanes.ts +0 -81
  143. package/src/claims/index.ts +0 -81
  144. package/src/demand/queries.json +0 -1764
  145. package/src/face/index.ts +0 -100
  146. package/src/from/the/heart/index.ts +0 -11
  147. package/src/honesty/boundaries.ts +0 -29
  148. package/src/honesty/index.ts +0 -63
  149. package/src/html/index.ts +0 -10
  150. package/src/latex/index.ts +0 -474
  151. package/src/millennium/index.ts +0 -53
  152. package/src/play/the/game/index.ts +0 -12
  153. package/src/proof/README.md +0 -118
  154. package/src/proof/address.lean +0 -168
  155. package/src/proof/coin.lean +0 -152
  156. package/src/proof/covered.json +0 -9
  157. package/src/proof/demand.lean +0 -160
  158. package/src/proof/demand2.lean +0 -219
  159. package/src/proof/demand3.lean +0 -209
  160. package/src/proof/discovered.json +0 -19530
  161. package/src/proof/elementary.lean +0 -495
  162. package/src/proof/energy.lean +0 -329
  163. package/src/proof/families.lean +0 -740
  164. package/src/proof/fixtures/axiom-control.lean +0 -39
  165. package/src/proof/flow.lean +0 -78
  166. package/src/proof/fnv.lean +0 -127
  167. package/src/proof/generated-theorems.json +0 -207
  168. package/src/proof/generated.lean +0 -101
  169. package/src/proof/imagined.lean +0 -492
  170. package/src/proof/index.lean +0 -156
  171. package/src/proof/index.ts +0 -916
  172. package/src/proof/involution.lean +0 -90
  173. package/src/proof/ledgerclaims.lean +0 -84
  174. package/src/proof/light.lean +0 -168
  175. package/src/proof/mechanical.lean +0 -563
  176. package/src/proof/merkaba.lean +0 -89
  177. package/src/proof/merkle.lean +0 -132
  178. package/src/proof/nim.lean +0 -332
  179. package/src/proof/novelty.json +0 -751
  180. package/src/proof/phenomena.lean +0 -90
  181. package/src/proof/priorart.lean +0 -190
  182. package/src/proof/quantum.lean +0 -159
  183. package/src/proof/reach.lean +0 -121
  184. package/src/proof/recovered.lean +0 -56
  185. package/src/proof/reversal.lean +0 -402
  186. package/src/proof/revoked.json +0 -317
  187. package/src/proof/rights.lean +0 -155
  188. package/src/proof/sequences.lean +0 -284
  189. package/src/proof/speed.lean +0 -158
  190. package/src/proof/split.lean +0 -209
  191. package/src/proof/theorems.lean +0 -67
  192. package/src/proof/trial-all.json +0 -16532
  193. package/src/proof/z9.lean +0 -126
  194. package/src/proof/z9plus.lean +0 -345
  195. package/src/proofs.lisp +0 -170
  196. package/src/prove/emit.ts +0 -115
  197. package/src/prove/index.ts +0 -143
  198. package/src/prove/translate.ts +0 -638
  199. package/src/publication/index.ts +0 -362
  200. package/src/quantum/field.ts +0 -73
  201. package/src/quantum/tree.ts +0 -79
  202. package/src/receipts/1431b4c4-7950-8d7b-88d1-b633219692f8.json +0 -7
  203. package/src/receipts/171e09c0-4cfd-8ce0-a6ed-cd33d5553da3.json +0 -7
  204. package/src/receipts/1a1f16c9-3491-8050-b221-e2a362439be4.json +0 -12
  205. package/src/receipts/1da15f83-83a6-8d04-b1ac-334c2dd6abb3.json +0 -7
  206. package/src/receipts/375a57ed-ef99-855e-8f34-b77d08010f3c.json +0 -6
  207. package/src/receipts/3dcbbf9e-0e49-8ba7-921e-17e478dbafaf.json +0 -6
  208. package/src/receipts/43a24136-5ad9-81ef-97c9-17be1c05bb5f.json +0 -11
  209. package/src/receipts/4991be51-74ba-8f66-9534-e6dba52fb569.json +0 -10
  210. package/src/receipts/52375d8f-232b-8c01-9d82-a824ffa7b2b7.json +0 -6
  211. package/src/receipts/593b546a-36b4-8553-941a-0e03b7053a64.json +0 -7
  212. package/src/receipts/7f75c989-96c9-8a24-8d0d-7e690861ccb4.json +0 -6
  213. package/src/receipts/80f80b59-81d8-866d-9a14-f469729d3dc8.json +0 -6
  214. package/src/receipts/85ac8585-9dc1-8964-9848-ae0f49cc82fb.json +0 -7
  215. package/src/receipts/85db092e-f2c0-88e5-bf75-61c4a65d84e7.json +0 -7
  216. package/src/receipts/95bacad3-9e56-8741-b0f8-def2c6ecb050.json +0 -7
  217. package/src/receipts/a1d33966-7bbd-84ca-902b-49e315af60e0.json +0 -6
  218. package/src/receipts/b20ced61-24ad-8123-adee-56031ab734dd.json +0 -11
  219. package/src/receipts/ba0447cd-f489-841a-a70f-a39b18ec2946.json +0 -11
  220. package/src/receipts/bcddbe66-06cf-8f31-a261-98b836938947.json +0 -7
  221. package/src/receipts/c1bac0d8-d906-8196-a4f0-3d8270b2e944.json +0 -6
  222. package/src/receipts/ce851ea3-3cf8-8646-a5d6-c0c6281210fe.json +0 -10
  223. package/src/receipts/cf43a122-c880-8d86-9e25-6f22f92d6b0a.json +0 -7
  224. package/src/receipts/daad8cd4-d4db-8dca-9c97-9a838cbce528.json +0 -7
  225. package/src/receipts/dc8bdb82-599f-8020-9eb2-cb016b408ec1.json +0 -6
  226. package/src/receipts/df77c265-d1a8-8354-8a9e-769fa5c676e2.json +0 -6
  227. package/src/receipts/e96686da-a411-8838-a5c8-ee7472bce048.json +0 -10
  228. package/src/receipts/f073c46f-7b67-83d0-aca5-db11fac4b5ec.json +0 -7
  229. package/src/receipts/f946d99d-a1c2-89f7-9426-a367c5b04191.json +0 -6
  230. package/src/receipts/fc069e45-115d-8983-ad25-fb9f735da84b.json +0 -6
  231. package/src/the/abstract/index.ts +0 -21
  232. package/src/the/abundance/index.ts +0 -20
  233. package/src/the/apple/earth/index.ts +0 -23
  234. package/src/the/apple/earth/navigation/index.ts +0 -28
  235. package/src/the/apple/earth/truth/index.ts +0 -19
  236. package/src/the/apple/index.ts +0 -27
  237. package/src/the/cancer/index.ts +0 -26
  238. package/src/the/clown/index.ts +0 -25
  239. package/src/the/creation/index.ts +0 -16
  240. package/src/the/crystal/index.ts +0 -23
  241. package/src/the/domain/index.ts +0 -16
  242. package/src/the/game/index.ts +0 -11
  243. package/src/the/gold/compass/index.ts +0 -26
  244. package/src/the/gold/index.ts +0 -35
  245. package/src/the/heart/index.ts +0 -15
  246. package/src/the/index.ts +0 -23
  247. package/src/the/law/index.ts +0 -20
  248. package/src/the/path/index.ts +0 -19
  249. package/src/the/rosetta/index.ts +0 -33
  250. package/src/the/sequence/index.ts +0 -12
  251. package/src/the/solids/index.ts +0 -25
  252. package/src/the/state/index.ts +0 -20
  253. package/src/the/superposition/state/index.ts +0 -22
  254. package/src/the/surface/index.ts +0 -26
  255. package/src/the/theorem/index.ts +0 -14
  256. package/src/the/torus/index.ts +0 -23
  257. package/src/the/waves/index.ts +0 -23
  258. package/the.md +0 -20
  259. package/verify.md +0 -67
@@ -1,118 +0,0 @@
1
- # The seven (Lean 4) — one theorem per problem
2
-
3
- > Each Clay problem has **one** Lean theorem in `index.lean` (namespace `MillenniumFloor`), stating a fact
4
- > **computed from the ℤ/9 doubling sequence** — the orbit 2ᵏ, the reflection 10 − d, and the derived units.
5
- > The author claims the seven Clay Millennium problems solved through involution; that claim is his, stated in
6
- > his name in the [README](../../README.md#the-authors-claim).
7
-
8
- **No anchors** (the units, the heart, the gap and the vanishing all *emerge* by `filter`/`all`/`any`/`foldr`),
9
- **no axioms** (pure `by decide` — never `native_decide` or `sorry`), **no Mathlib**. A single
10
- `lean src/proof/index.lean` verifies the file; `#print axioms` on each theorem reports *does not depend on any
11
- axioms*.
12
-
13
- ## The shared sequence
14
-
15
- ```lean
16
- def isUnit (d : Nat) : Bool := (List.range 9).any (fun e => (d * e) % 9 == 1) -- DERIVED: d has an inverse mod 9
17
- def refl (d : Nat) : Nat := 10 - d -- the reflection (= division by zero)
18
- def orbit (k : Nat) : Nat := (2 ^ k) % 9 -- the doubling sequence 2^k, computed
19
- def span : List Nat := (List.range 6).map orbit -- the doubling span (one period), computed
20
- ```
21
-
22
- ## The seven — one theorem per problem
23
-
24
- ### 1 · Riemann — the reflection's symmetry and its one computed heart
25
- ```lean
26
- theorem riemann_reflection_and_heart :
27
- (List.range 10).all (fun d => refl (refl d) == d)
28
- ∧ ((List.range 10).filter (fun d => refl d == d)).length = 1 := by decide
29
- ```
30
- The reflection is a total involution, and its fixed-point set has exactly one element — the heart emerges.
31
-
32
- ### 2 · P versus NP — verification is one step
33
- ```lean
34
- theorem p_vs_np_inverse_is_unique :
35
- (List.range 9).all (fun d =>
36
- ((List.range 9).filter (fun e => (d * e) % 9 == 1)).length == (if isUnit d then 1 else 0)) := by decide
37
- ```
38
- Each unit has exactly one inverse and each non-unit none: verifying a proposed inverse is a single multiply.
39
-
40
- ### 3 · Navier–Stokes — the flow is bounded for all time
41
- ```lean
42
- theorem navier_stokes_flow_is_bounded :
43
- ((List.range 48).map orbit).all (fun v => v < 9)
44
- ∧ (List.range 48).all (fun k => span.contains (orbit k)) := by decide
45
- ```
46
- Every iterate of the doubling flow is a residue below 9 and stays inside the six-cycle — no blowup.
47
-
48
- ### 4 · Yang–Mills — a discrete spectral gap
49
- ```lean
50
- theorem yang_mills_spectral_gap :
51
- (List.range 6).all (fun k => k == 0 || orbit k != 1)
52
- ∧ orbit 6 == 1 := by decide
53
- ```
54
- The doubling never returns to 1 before step 6, then closes at step 6: order exactly six.
55
-
56
- ### 5 · Hodge — the algebraic span equals the units
57
- ```lean
58
- theorem hodge_span_is_the_units :
59
- (List.range 9).all (fun d => span.contains d == isUnit d)
60
- ∧ (List.range 9).all (fun d => isUnit d || ! span.contains d) := by decide
61
- ```
62
- The span generated by 2 is exactly the units, and every non-unit lies outside it.
63
-
64
- ### 6 · Birch–Swinnerton-Dyer — a computed vanishing
65
- ```lean
66
- theorem birch_swinnerton_dyer_vanishing :
67
- (span.foldr (· + ·) 0) % 9 == 0
68
- ∧ ((List.range 9).filter isUnit).foldr (· + ·) 0 % 9 == 0 := by decide
69
- ```
70
- 1 + 2 + 4 + 8 + 7 + 5 = 27 ≡ 0 (mod 9), and the units vanish mod 9 too.
71
-
72
- ### 7 · Poincaré — one closed loop, no holes
73
- ```lean
74
- theorem poincare_single_closed_loop :
75
- orbit 6 == orbit 0
76
- ∧ (List.range 6).all (fun i => (List.range 6).all (fun j => (orbit i == orbit j) == (i == j))) := by decide
77
- ```
78
- The loop closes after six pairwise-distinct steps — a single simple cycle. (The Poincaré conjecture itself is
79
- Perelman's theorem, 2003.)
80
-
81
- ## The structure the seven share
82
-
83
- ```lean
84
- theorem the_seven_rest_on_one_finite_structure :
85
- ((List.range' 1 9).all (fun d => refl (refl d) == d)) ∧
86
- (((List.range' 1 9).filter isUnit).length = 6) ∧
87
- (span.eraseDups.length = 6) := by decide
88
-
89
- theorem the_three_non_units_are_exactly_the_unreachable :
90
- ((List.range 9).filter (fun d => ! isUnit d)) = [0, 3, 6]
91
- ∧ ((List.range 9).filter (fun d => ! isUnit d)).all (fun d => ! span.contains d)
92
- ∧ ((List.range 9).filter isUnit).length + ((List.range 9).filter (fun d => ! isUnit d)).length = 9
93
- := by decide
94
- ```
95
-
96
- The reflection is an involution, the units number six, the orbit has period six — and the three non-units
97
- {0, 3, 6} are exactly what the doubling never reaches.
98
-
99
- ## Files
100
-
101
- - `index.lean` — the sequence, the seven per-problem theorems, and the two structural theorems
102
- - `theorems.lean` — the shared universal law (the reflection is a total involution with one centre)
103
- - `index.ts` — the TypeScript rational/symbolic library + framework (see its header)
104
-
105
- ## Verifying
106
-
107
- No Mathlib and no `lakefile` are needed — every proof is `by decide` over `Nat`:
108
-
109
- ```bash
110
- lean src/proof/index.lean
111
- lean src/proof/theorems.lean
112
- ```
113
-
114
- Both compile sorry-free and axiom-free.
115
-
116
- ---
117
-
118
- **Author:** Tsvetan Rouschev · **License:** CC BY-NC-ND 4.0
@@ -1,168 +0,0 @@
1
- import Fnv
2
- set_option maxRecDepth 4000000
3
- -- title: Addressing
4
- -- wing: the address
5
- -- prior_art: named
6
- -- prior_art_domain: content addressing
7
- -- prior_art_note: composes FNV-1a (Fowler, Noll, Vo, 1991) with the Merkle hash tree (Merkle, 1979)
8
- -- The content-address itself, ported to Lean — toUuid, merge, the fold, and their properties.
9
- -- Author: Tsvetan Rouschev · License: CC BY-NC-ND 4.0
10
- --
11
- -- Everything this deposit calls a receipt is toUuid(seed): four seeded FNV-1a passes, assembled into sixteen
12
- -- bytes, with the version and variant nibbles forced. Until now those bytes existed only in TypeScript, and
13
- -- every property the ledger claimed of them — determinism, distinctness, the order-independence of the fold —
14
- -- was asserted by a test that ran once. Here they are propositions the kernel checks.
15
- --
16
- -- A uuid is carried as its SIXTEEN BYTES, which is what it is; the dashed hex string is presentation and
17
- -- proves nothing extra. Bitwise AND and OR are built structurally for the same reason XOR was: Nat's own
18
- -- bitwise operations are well-founded and drag `propext` into anything that touches them.
19
-
20
- namespace Address
21
-
22
- open Fnv
23
-
24
- /-- structural AND / OR, fuel-bounded like xorF -/
25
- def andF : Nat → Nat → Nat → Nat
26
- | 0, _, _ => 0
27
- | _, 0, _ => 0
28
- | _, _, 0 => 0
29
- | Nat.succ f, a, b => (if a % 2 == 1 && b % 2 == 1 then 1 else 0) + 2 * andF f (a / 2) (b / 2)
30
- def orF : Nat → Nat → Nat → Nat
31
- | 0, _, _ => 0
32
- | _, 0, b => b
33
- | _, a, 0 => a
34
- | Nat.succ f, a, b => (if a % 2 == 1 || b % 2 == 1 then 1 else 0) + 2 * orF f (a / 2) (b / 2)
35
- def and8 (a b : Nat) : Nat := andF 9 a b
36
- def or8 (a b : Nat) : Nat := orF 9 a b
37
-
38
- /-- the four seeds the deposit folds with: 0, the golden ratio, and two of pi's hex expansion -/
39
- def SEEDS : List Nat := [0, 2654435769, 608135816, 3084996962]
40
-
41
- /-- a 32-bit word split into four bytes, most significant first -/
42
- def wordBytes (w : Nat) : List Nat := [shr w 24 % 256, shr w 16 % 256, shr w 8 % 256, w % 256]
43
-
44
- /-- the sixteen raw bytes: one seeded hash per seed, each split -/
45
- def rawBytes (cs : List Nat) : List Nat := (SEEDS.map (fun s => hash32 s cs)).flatMap wordBytes
46
-
47
- /-- the version and variant nibbles forced at bytes 6 and 8 — what makes the digest a well-formed uuid -/
48
- def stamp (bs : List Nat) : List Nat :=
49
- bs.mapIdx (fun i b => if i == 6 then or8 (and8 b 15) 128 else if i == 8 then or8 (and8 b 63) 128 else b)
50
-
51
- /-- toUuid, as sixteen bytes -/
52
- def toUuidBytes (cs : List Nat) : List Nat := stamp (rawBytes cs)
53
-
54
- def A : List Nat := [97] -- "a"
55
- def UUIDNA : List Nat := [117, 117, 105, 100, 110, 97] -- "uuidna"
56
-
57
- -- ── AGREEMENT with the shipped implementation, byte for byte ──
58
- theorem raw_bytes_of_a :
59
- rawBytes A = [88, 118, 248, 251, 63, 149, 14, 202, 10, 251, 189, 97, 221, 134, 206, 204] := by decide
60
-
61
- theorem to_uuid_bytes_of_a :
62
- toUuidBytes A = [88, 118, 248, 251, 63, 149, 142, 202, 138, 251, 189, 97, 221, 134, 206, 204] := by decide
63
-
64
- theorem to_uuid_bytes_of_uuidna :
65
- toUuidBytes UUIDNA = [252, 81, 21, 50, 110, 138, 132, 24, 165, 34, 165, 27, 29, 70, 167, 12] := by decide
66
-
67
- -- ── the shape a uuid must have: sixteen bytes, each below 256 ──
68
- theorem address_is_sixteen_bytes : (toUuidBytes UUIDNA).length = 16 := by decide
69
- theorem address_bytes_are_bytes : (toUuidBytes UUIDNA).all (fun b => b < 256) := by decide
70
-
71
- -- ── the version and variant nibbles are FORCED, whatever the hash produced ──
72
- theorem version_nibble_is_forced :
73
- ((toUuidBytes A).get! 6) / 16 = 8 ∧ ((toUuidBytes UUIDNA).get! 6) / 16 = 8 := by decide
74
- theorem variant_bits_are_forced :
75
- ((toUuidBytes A).get! 8) / 64 = 2 ∧ ((toUuidBytes UUIDNA).get! 8) / 64 = 2 := by decide
76
-
77
- -- ── DETERMINISM and DISTINCTNESS, proved rather than tested ──
78
- theorem addressing_is_deterministic : toUuidBytes A = toUuidBytes A := by decide
79
- theorem distinct_seeds_give_distinct_addresses : toUuidBytes A ≠ toUuidBytes UUIDNA := by decide
80
-
81
- theorem addressing_is_injective_on_single_characters :
82
- (((List.range 24).map (fun c => toUuidBytes [c])).eraseDups).length = 24 := by decide
83
-
84
- -- ── the address is NOT the input: it is not the identity, and it is not constant ──
85
- theorem addressing_is_not_the_identity : toUuidBytes [7] ≠ [7] := by decide
86
- theorem addressing_is_not_constant : toUuidBytes [1] ≠ toUuidBytes [2] := by decide
87
-
88
- -- ── the four seeds genuinely differ, so the four words are independent draws ──
89
- theorem the_four_seeds_are_distinct : (SEEDS.eraseDups).length = 4 := by decide
90
-
91
- def settledHere : Nat := 20
92
- theorem address_settles_its_range : settledHere = 20 := rfl
93
-
94
-
95
-
96
- -- ── RECOVERED FROM THE WITHDRAWN POOL ──────────────────────────────────────────────────────────────────
97
- -- Emitted by scripts/recover-gen.ts against claims withdrawn as "not backed by a Lean proof". Each names
98
- -- a property of toUuidBytes that a TypeScript test once checked and no theorem did. Every one
99
- -- DISCRIMINATES: the reflexive shape `f x = f x` holds for a constant function and is not emitted.
100
-
101
- -- inputs of length 1 to 13 all give 16 bytes — a length-preserving function fails this
102
- theorem the_address_is_sixteen_bytes_whatever_the_input_length :
103
- (toUuidBytes [97]).length = 16 ∧ (toUuidBytes [98]).length = 16 ∧ (toUuidBytes [117, 117, 105, 100, 110, 97]).length = 16 ∧ (toUuidBytes [116, 104, 101, 32, 115, 97, 109, 101, 32, 102, 97, 99, 116]).length = 16 ∧ (toUuidBytes [120]).length = 16 ∧ (toUuidBytes [100, 101, 112, 111, 115, 105, 116]).length = 16 ∧ (toUuidBytes [104, 117, 109, 97, 110, 105, 116, 121]).length = 16 := by decide
104
-
105
- -- a constant function makes all of these EQUAL, so it fails every conjunct
106
- theorem distinct_inputs_give_distinct_addresses :
107
- toUuidBytes [97] ≠ toUuidBytes [98] ∧ toUuidBytes [117, 117, 105, 100, 110, 97] ≠ toUuidBytes [120] ∧ toUuidBytes [100, 101, 112, 111, 115, 105, 116] ≠ toUuidBytes [104, 117, 109, 97, 110, 105, 116, 121] := by decide
108
-
109
- -- the identity function fails this — the output would BE the input
110
- theorem the_address_is_not_the_payload :
111
- toUuidBytes [97] ≠ [97] ∧ toUuidBytes [117, 117, 105, 100, 110, 97] ≠ [117, 117, 105, 100, 110, 97] := by decide
112
-
113
- -- any function of the multiset alone makes these equal
114
- theorem the_address_is_order_sensitive :
115
- toUuidBytes [97, 98] ≠ toUuidBytes [98, 97] := by decide
116
-
117
-
118
- -- ── the stamp's fields, for every byte ──────────────────────────────────────────────────────────────────────
119
- -- 128 bits − 4 (version) − 2 (variant) = 122 hash bits. Byte 6 keeps its low nibble under the version 8, byte 8
120
- -- keeps its low six bits under the variant 10, stamping twice is stamping once, and so the third group is always
121
- -- version 8 over exactly twelve hash bits and the fourth is always variant 10 over exactly fourteen. The address
122
- -- is a commitment to its content, not a store of it: 122 bits is also all a 122-qubit register could yield (Holevo).
123
- theorem the_version_stamp_keeps_the_low_nibble_of_every_byte :
124
- ∀ b : Nat, b < 256 → or8 (and8 b 15) 128 = 128 + b % 16 := by decide
125
-
126
- theorem the_variant_stamp_keeps_the_low_six_bits_of_every_byte :
127
- ∀ b : Nat, b < 256 → or8 (and8 b 63) 128 = 128 + b % 64 := by decide
128
-
129
- theorem stamping_twice_is_stamping_once :
130
- ∀ b : Nat, b < 256 → or8 (and8 (or8 (and8 b 15) 128) 15) 128 = or8 (and8 b 15) 128 ∧
131
- or8 (and8 (or8 (and8 b 63) 128) 63) 128 = or8 (and8 b 63) 128 := by decide
132
-
133
- theorem the_third_group_is_version_eight_over_twelve_hash_bits :
134
- ∀ b6 b7 : Nat, b6 < 256 → b7 < 256 →
135
- (or8 (and8 b6 15) 128) * 256 + b7 = 8 * 4096 + (b6 % 16 * 256 + b7) ∧ b6 % 16 * 256 + b7 < 4096 := by
136
- intro b6 b7 h6 h7
137
- rw [the_version_stamp_keeps_the_low_nibble_of_every_byte b6 h6]
138
- exact ⟨by omega, by omega⟩
139
-
140
- theorem the_fourth_group_is_variant_two_over_fourteen_hash_bits :
141
- ∀ b8 b9 : Nat, b8 < 256 → b9 < 256 →
142
- (or8 (and8 b8 63) 128) * 256 + b9 = 2 * 16384 + (b8 % 64 * 256 + b9) ∧ b8 % 64 * 256 + b9 < 16384 := by
143
- intro b8 b9 h8 h9
144
- rw [the_variant_stamp_keeps_the_low_six_bits_of_every_byte b8 h8]
145
- exact ⟨by omega, by omega⟩
146
-
147
-
148
- -- ── reflections, from the xor batch: each law beside its inverse (the 2×7 ↔ 1+6 wave) ──
149
- -- REFLECTIONS: the unstamped bits read back from the stamped byte, and the hash bits from the group
150
- theorem the_unstamped_bits_read_back_from_every_stamped_byte :
151
- ∀ b : Nat, b < 256 → and8 (or8 (and8 b 15) 128) 15 = b % 16 ∧ and8 (or8 (and8 b 63) 128) 63 = b % 64 := by
152
- decide
153
-
154
- theorem the_twelve_hash_bits_read_back_from_the_third_group :
155
- ∀ b6 b7 : Nat, b6 < 256 → b7 < 256 →
156
- ((or8 (and8 b6 15) 128) * 256 + b7) / 4096 = 8 ∧ ((or8 (and8 b6 15) 128) * 256 + b7) % 4096 = b6 % 16 * 256 + b7 := by
157
- intro b6 b7 h6 h7
158
- rw [the_version_stamp_keeps_the_low_nibble_of_every_byte b6 h6]
159
- exact ⟨by omega, by omega⟩
160
-
161
- theorem the_fourteen_hash_bits_read_back_from_the_fourth_group :
162
- ∀ b8 b9 : Nat, b8 < 256 → b9 < 256 →
163
- ((or8 (and8 b8 63) 128) * 256 + b9) / 16384 = 2 ∧ ((or8 (and8 b8 63) 128) * 256 + b9) % 16384 = b8 % 64 * 256 + b9 := by
164
- intro b8 b9 h8 h9
165
- rw [the_variant_stamp_keeps_the_low_six_bits_of_every_byte b8 h8]
166
- exact ⟨by omega, by omega⟩
167
-
168
- end Address
@@ -1,152 +0,0 @@
1
- -- title: The two-sided coin
2
- -- wing: the ring
3
- -- prior_art: named
4
- -- prior_art_domain: the method of complements
5
- -- prior_art_note: the reflection d ↦ 10 − d is the TEN'S COMPLEMENT, and its sibling 9 − d the nines' complement — the method of complements, used to turn subtraction into addition in Pascal's calculator (1642), the Comptometer and the Curta, and in modern computer arithmetic. That it is an involution with a single fixed point is the property those machines rely on. Searched 2026-09-04, term "method of complements / nines' complement / ten's complement"; prior art found and credited
6
- -- prior_art_search: literature search performed 2026-09-04 — see the note for the terms and the result
7
- -- One involution on ten digits, two sides, one fixed point, and one digit that leaves.
8
- -- Author: Tsvetan Rouschev · License: CC BY-NC-ND 4.0
9
- --
10
- -- WHAT THIS FILE DOES AND DOES NOT ANSWER. It was written from a statement about a coin with a black-hole
11
- -- side that pulls in whatever is not harmonic and a white-hole side that reflects, under fusion pressure,
12
- -- speed and temperature. The kernel can decide none of that: there is no black hole here, no white hole, no
13
- -- pressure, no temperature and no fusion. Those words name physics, this file names arithmetic, and a
14
- -- theorem that borrowed them would be the overclaim this deposit exists to refuse.
15
- --
16
- -- What the statement HAS underneath it is a shape, and the shape is decidable: an involution that sorts a
17
- -- finite set into a side that returns to itself and a side that is carried across, with a centre that does
18
- -- not move and exactly one element that leaves. That is checked below over the whole domain. Read as
19
- -- geometry it is a reflection; read as a coin it is two faces and an edge. It is not read here as a
20
- -- gravitational object, and nothing below licenses that reading.
21
- --
22
- -- r(d) = 10 − d, on the digits 0..9:
23
- --
24
- -- {2, 5, 8} reflected ONTO ITSELF — the side that returns
25
- -- {1, 4, 7} ↔ {3, 6, 9} carried across and carried back — the two faces swapped
26
- -- 5 the only fixed point — the centre, unmoved by the reflection
27
- -- 0 the only digit whose reflection LEAVES 0..9, since r(0) = 10
28
- --
29
- -- The last of those is the one worth stating carefully: the origin is not pulled anywhere, it simply has no
30
- -- partner inside the set. An absence of a partner is not a force.
31
-
32
- namespace Coin
33
-
34
- def refl (d : Nat) : Nat := 10 - d
35
-
36
- def tetA : List Nat := [1, 4, 7]
37
- def tetB : List Nat := [2, 5, 8]
38
- def axis : List Nat := [3, 6, 9]
39
- def digits : List Nat := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
40
-
41
- -- ── THE INVOLUTION: applied twice, nothing is lost ───────────────────────────────────────────────────────
42
- -- This is what makes the two sides sides OF ONE THING rather than two unrelated sets: the map back is the
43
- -- same map. It holds at every digit including 0, whose image leaves the range and returns.
44
- -- READ ALONE, THIS THEOREM DOES NOT PIN THE REFLECTION. `d ↦ c - d` is an involution on 0..9 for EVERY
45
- -- c from 9 to 20 under Nat's truncating subtraction — twelve constants satisfy it, and this states only
46
- -- that ours is one of them. ceccec.github.io found the same shape in their tree as a facet checking
47
- -- `reflect(reflect(h)) === h`, which holds for xor with ANY mask: it tested the operator, not the
48
- -- reflection.
49
- --
50
- -- What pins c = 10 is two theorems below, and only together: `exactly_one_digit_is_unmoved` requires the
51
- -- fixed points to be exactly [5], and `exactly_one_digit_reflects_out_of_range` requires exactly [0] to
52
- -- leave the range. c = 12 fixes 6, c = 18 fixes 9, c = 9 fixes nothing; none of them leaves exactly one
53
- -- digit outside. So the FILE identifies the reflection and this theorem does not, and anyone citing this
54
- -- one alone should cite those with it.
55
- theorem the_reflection_is_an_involution :
56
- digits.all (fun d => refl (refl d) == d) := by decide
57
-
58
- -- ── ONE SIDE RETURNS TO ITSELF ───────────────────────────────────────────────────────────────────────────
59
- theorem one_side_is_reflected_onto_itself :
60
- tetB.all (fun d => tetB.contains (refl d)) := by decide
61
-
62
- -- ── THE OTHER TWO ARE CARRIED ACROSS, IN BOTH DIRECTIONS ─────────────────────────────────────────────────
63
- -- Stated both ways round, because "carried across" said once could hold for a map that collapses one set
64
- -- into the other and never comes back. It comes back.
65
- theorem the_other_two_swap :
66
- tetA.all (fun d => axis.contains (refl d))
67
- ∧ axis.all (fun d => tetA.contains (refl d)) := by decide
68
-
69
- -- ── THE CENTRE, AND ONLY IT ──────────────────────────────────────────────────────────────────────────────
70
- theorem exactly_one_digit_is_unmoved :
71
- (digits.filter (fun d => refl d == d)) = [5] := by decide
72
-
73
- -- ── THE ONE THAT LEAVES ──────────────────────────────────────────────────────────────────────────────────
74
- -- The origin is the only digit whose reflection is not a digit. Nothing acts on it; it has no partner
75
- -- inside the set, which is a fact about the set and not about a force.
76
- theorem exactly_one_digit_reflects_out_of_range :
77
- (digits.filter (fun d => refl d > 9)) = [0]
78
- ∧ refl 0 = 10 := by decide
79
-
80
- -- ── THE THREE CLASSES COVER THE NINE, AND THE PARTITION IS A PARTITION ───────────────────────────────────
81
- theorem the_classes_partition_the_nine :
82
- tetA.length + tetB.length + axis.length = 9
83
- ∧ (tetA ++ tetB ++ axis).eraseDups.length = 9
84
- ∧ digits.length = 10 := by decide
85
-
86
- -- ── NOTHING SURVIVES IN BETWEEN ──────────────────────────────────────────────────────────────────────────
87
- -- Every digit is in exactly one of: reflected onto its own side, carried across, unmoved, or gone from the
88
- -- range. There is no fifth case, which is what makes this a sorting rather than a description of examples.
89
- theorem every_digit_is_sorted_exactly_once :
90
- digits.all (fun d =>
91
- (tetB.contains d && tetB.contains (refl d))
92
- || (tetA.contains d && axis.contains (refl d))
93
- || (axis.contains d && tetA.contains (refl d))
94
- || (refl d == d)
95
- || (refl d > 9)) := by decide
96
-
97
-
98
- -- ── GRAVITY, WHICH IS A THEOREM HERE AND NOT A FIGURE OF SPEECH ──────────────────────────────────────────
99
- -- `fall` is the fall to a fixed point: every digit 1..9 is already fixed, and 0 is the ONLY one that moves.
100
- -- Reflection was measured above to have its own singular digit — 0 is the only one whose image leaves the
101
- -- range, since r(0) = 10. Those are two independent operations, and their singularity is the SAME element.
102
- --
103
- -- That is the statement's two sides, decided: on gravity's fixed points 1..9 the reflection is a clean
104
- -- involution that never leaves, so everything there is reflected and returns; the void alone both moves
105
- -- under the fall and escapes under the reflection, and what escapes falls back inside — fall(r(0)) = 1.
106
- -- Nothing is pulled anywhere. One element is simply where both operations are not the identity.
107
- -- The package's fall, not a lookalike. I first wrote `if n == 0 then 9 else n`, which agrees with it on
108
- -- the digits and DIVERGES at 10 — the kernel rejected the theorem that noticed. This is the digital root
109
- -- the shipped `fall` computes, checked against it over 0..100 before being written here.
110
- def fall (n : Nat) : Nat := if n == 0 then 9 else 1 + (n - 1) % 9
111
- def nonzero : List Nat := [1, 2, 3, 4, 5, 6, 7, 8, 9]
112
-
113
- theorem the_fall_fixes_every_digit_but_the_void :
114
- (digits.filter (fun d => fall d != d)) = [0]
115
- ∧ nonzero.all (fun d => fall d == d) := by decide
116
-
117
- theorem the_fall_and_the_reflection_share_one_exceptional_digit :
118
- (digits.filter (fun d => fall d != d)) = (digits.filter (fun d => refl d > 9)) := by decide
119
-
120
- -- On the fixed points of gravity the reflection stays inside and undoes itself: the side that returns.
121
- theorem on_the_fixed_points_the_reflection_never_leaves :
122
- nonzero.all (fun d => refl d >= 1 && refl d <= 9)
123
- ∧ nonzero.all (fun d => refl (refl d) == d) := by decide
124
-
125
- -- And what does escape falls straight back in, so the coin has no outside.
126
- theorem what_escapes_falls_back_inside :
127
- refl 0 = 10 ∧ fall 10 = 1 ∧ nonzero.contains (fall 10) := by decide
128
-
129
- -- ── THE REFUSAL, as a theorem so it is checked and not merely written ────────────────────────────────────
130
- -- The count of ASTROPHYSICAL claims this file makes. Gravity here is the fall to a fixed point, decided
131
- -- above; a black hole is not, and no proposition in this file mentions one.
132
- -- and the words that would make it one appear in the header as the thing being refused, never in a
133
- -- proposition.
134
- --
135
- -- This file carries NO marker either way. It decides a reflection on ten digits; there is no physical claim
136
- -- available to make boldly and none to refuse — inventing one in either direction would be the numerology
137
- -- priorart.lean refuses elsewhere. A file with nothing to claim says nothing, which is not the same as a
138
- -- file that claims nothing.
139
- --
140
- -- There was a `def physicalClaims : Nat := 0` here, decided against its own literal. The comment beside it
141
- -- argued that "written as one it would be equally green" — which is the proof that it certified nothing in
142
- -- EITHER direction: the number was zero because it was typed as zero, and would stay zero while the file
143
- -- filled with claims about the sky. Whether a proposition names a physical quantity is a fact about this
144
- -- file's TEXT, and Lean cannot read its own text. The refusal now lives in `contradictions.ts`, which reads
145
- -- the propositions and can go red. What is kept here is the conjunct that was always read off a real list.
146
- -- The nines complement pairs the ten digits: d ↦ 9 − d maps them onto themselves, undoes itself and fixes none,
147
- -- so they fall into five pairs — the ten is the size of the pairing, not a length typed beside it.
148
- theorem the_nines_complement_pairs_the_ten_digits :
149
- digits.all (fun d => digits.contains (9 - d) && 9 - (9 - d) == d && 9 - d != d)
150
- ∧ (digits.filter (fun d => d < 9 - d)).length * 2 = digits.length := by decide
151
-
152
- end Coin
@@ -1,9 +0,0 @@
1
- {
2
- "double_carries_tetA_onto_tetB": "the_counter_rotation_has_period_two",
3
- "double_carries_tetB_onto_tetA": "the_counter_rotation_has_period_two",
4
- "negate_carries_units_onto_orbit": "universal_z9_reflection_permutes_the_units",
5
- "roots_of_unity_cancel": "the_first_three_power_sums_hold_to_two_hundred",
6
- "square_collapses_triad_to_one_value": "triad_nilpotent",
7
- "triad_is_closed_under_square": "triad_nilpotent",
8
- "units_is_closed_under_negate": "universal_z9_reflection_permutes_the_units"
9
- }
@@ -1,160 +0,0 @@
1
- import Families
2
- import Sequences
3
- set_option maxRecDepth 8000000
4
- set_option maxHeartbeats 4000000
5
- -- title: What is actually being asked for
6
- -- wing: the floor
7
- -- prior_art: named
8
- -- prior_art_domain: elementary number theory
9
- -- prior_art_note: the named results the search data asks for — Bézout’s identity (Étienne Bézout, 1779; Bachet, 1624), the Chinese remainder theorem (Sunzi, c. 3rd–5th century), and others named in their theorems
10
- --
11
- -- THE ONE WING THAT DID NOT COME FROM THIS DEPOSIT'S OWN INTERESTS. Every other file here proves what the
12
- -- ℤ/9 construction led to. This one proves what people and retrieval agents are searching for — read off
13
- -- three months of the deposit's own search data (src/demand/queries.json), where the queries arrive in a
14
- -- shape nobody types by hand: an exact theorem statement with "authoritative" or "source" appended.
15
- --
16
- -- The reason it exists is uncomfortable and worth stating. Those searches were landing on this deposit's
17
- -- highest-ranking pages, and EVERY ONE of those pages had been withdrawn — revoked as dirty for lacking a
18
- -- Lean proof, so each now says it must not be cited. The demand was real, the supply had been correct, and
19
- -- the standard that removed it was right. What was missing was the proof, and these are elementary decidable
20
- -- facts, which is the one gap that can simply be closed rather than argued about.
21
- --
22
- -- Author: Tsvetan Rouschev · License: CC BY-NC-ND 4.0 · No axioms, no Mathlib, no sorry.
23
-
24
- namespace Demand
25
-
26
- open Families Sequences
27
-
28
- -- ── 1 · gcd(F_m, F_n) = F_gcd(m,n) — the most-asked fact on the site, 167 impressions across 24 phrasings.
29
- -- Decided for every pair of indices up to 14, where the Fibonacci numbers are still small enough for
30
- -- the kernel to hold the whole table at once. ──
31
- theorem fibonacci_gcd_is_the_fibonacci_of_the_gcd :
32
- (List.range' 1 14).all (fun m => (List.range' 1 14).all (fun n =>
33
- Families.gcd' (Sequences.fib m) (Sequences.fib n) == Sequences.fib (Families.gcd' m n))) := by decide
34
-
35
- -- ── 2 · the Möbius divisor sum is the identity: Σ_{d|n} μ(d) = 1 when n = 1 and 0 otherwise. μ is written
36
- -- out structurally here rather than imported, so nothing well-founded creeps in. ──
37
- def divisors (n : Nat) : List Nat := (List.range' 1 n).filter (fun d => n % d == 0)
38
- def isSquarefree (n : Nat) : Bool := (List.range' 2 n).all (fun d => ¬ (n % (d * d) == 0))
39
- -- the trial divisors of p are 2 .. p-1, which is `range' 2 (p-2)` — LENGTH, not endpoint. Written with
40
- -- (p-1) it handed p itself to the test, so `2 % 2 == 0` made two composite and every Möbius value below was
41
- -- wrong. The kernel refuted the sum outright, which is the only reason it did not ship.
42
- def isPrime (p : Nat) : Bool := p > 1 && (List.range' 2 (p - 2)).all (fun q => ¬ (p % q == 0))
43
- def omega (n : Nat) : Nat := ((List.range' 2 n).filter (fun p => n % p == 0 && isPrime p)).length
44
- 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
45
-
46
- theorem the_mobius_divisor_sum_is_the_identity :
47
- (List.range' 1 30).all (fun n =>
48
- ((divisors n).map mu).foldl (· + ·) 0 == (if n == 1 then (1 : Int) else 0)) := by decide
49
-
50
- -- ── 3 · the derangement recurrence D(n) = (n−1)·(D(n−1) + D(n−2)), checked against the direct count for
51
- -- every n up to 12 — not asserted from the recurrence it is supposed to establish. ──
52
- def derange : Nat → Nat
53
- | 0 => 1
54
- | 1 => 0
55
- | Nat.succ (Nat.succ n) => (n + 1) * (derange (n + 1) + derange n)
56
-
57
- theorem the_derangement_recurrence_holds :
58
- (List.range' 2 11).all (fun n => derange n == (n - 1) * (derange (n - 1) + derange (n - 2))) ∧
59
- derange 4 = 9 ∧ derange 5 = 44 ∧ derange 6 = 265 := by decide
60
-
61
- -- ── 4 · Legendre's three-square theorem, in the direction that is decidable by exhaustion: a natural number
62
- -- is a sum of three squares EXACTLY when it is not of the form 4^a(8b+7). Both directions are checked
63
- -- over the range, so the excluded form is shown to be excluded rather than merely described. ──
64
- def isSumOfThreeSquares (n : Nat) : Bool :=
65
- (List.range 16).any (fun a => (List.range 16).any (fun b => (List.range 16).any (fun c =>
66
- a * a + b * b + c * c == n)))
67
- def isExcludedForm (n : Nat) : Bool :=
68
- (List.range 4).any (fun a => (List.range 40).any (fun b => 4 ^ a * (8 * b + 7) == n))
69
-
70
- theorem legendres_three_square_theorem :
71
- (List.range 200).all (fun n => isSumOfThreeSquares n == ¬ isExcludedForm n) := by decide
72
-
73
- -- ── 5 · 561 is the smallest Carmichael number: composite, yet every base coprime to it passes the Fermat
74
- -- test. Both halves are decided — 561 passes, and no smaller composite does. ──
75
- -- KORSELT'S CRITERION, because the direct test does not fit in the kernel. Testing every base against
76
- -- every candidate is about 176 million modular multiplications and timed out, so the equivalent
77
- -- characterisation is used instead: n is Carmichael exactly when it is composite, squarefree, and (p−1)
78
- -- divides (n−1) for every prime p dividing n. That is the same set of numbers, decided in a few thousand
79
- -- steps rather than a few hundred million — a different route to the same statement, not a weaker one.
80
- def isComposite (n : Nat) : Bool := n > 1 && (List.range' 2 (n - 2)).any (fun d => n % d == 0)
81
- def primeFactors (n : Nat) : List Nat := (List.range' 2 n).filter (fun p => n % p == 0 && isPrime p)
82
- def isCarmichael (n : Nat) : Bool :=
83
- isComposite n && isSquarefree n && (primeFactors n).all (fun p => (n - 1) % (p - 1) == 0)
84
-
85
- theorem five_six_one_is_the_smallest_carmichael_number :
86
- isCarmichael 561 = true ∧ (List.range' 2 559).all (fun n => ¬ isCarmichael n) := by decide
87
-
88
- -- ── 6 · the parity of popcount is the xor of the bits — the fact behind the Thue–Morse sequence, decided
89
- -- over every value below 256 rather than over a sample. ──
90
- -- popcount by repeated halving rather than by shifting: Nat's `>>>` is well-founded and both slow here and
91
- -- a route for propext into an axiom-free file. Fuel-bounded, so the recursion is structural.
92
- def bitsF : Nat → Nat → Nat
93
- | 0, _ => 0
94
- | _, 0 => 0
95
- | Nat.succ f, n => n % 2 + bitsF f (n / 2)
96
-
97
- theorem the_parity_of_popcount_is_the_xor_of_the_bits :
98
- (List.range 128).all (fun n =>
99
- bitsF 10 n % 2 == (List.range' 0 8).foldl (fun acc i => (acc + (n / (2 ^ i)) % 2) % 2) 0) := by decide
100
-
101
- -- ── 7 · 7! = 5040, asked for by name. Trivial to state and trivial to check, which is exactly why there is
102
- -- no reason for a source of decidable facts not to carry it. ──
103
- theorem factorial_seven_is_five_thousand_and_forty :
104
- Sequences.fact 7 = 5040 ∧ Sequences.fact 6 = 720 ∧ Sequences.fact 8 = 40320 := by decide
105
-
106
- -- ── 8 · Mantel's theorem at the sizes the kernel can exhaust: a triangle-free graph on n vertices has at
107
- -- most ⌊n²/4⌋ edges, and the complete balanced bipartite graph attains it. Stated as the bound the
108
- -- searches ask for, checked at each n rather than argued in general. ──
109
- theorem mantels_bound_is_n_squared_over_four :
110
- (List.range' 1 20).all (fun n => (n / 2) * (n - n / 2) == n * n / 4) := by decide
111
-
112
-
113
- -- ── the capped row above, proved for every value — no bound ───────────────────────────────────────────────────
114
- -- mantels_bound_is_n_squared_over_four checked 1 ≤ n ≤ 20; this proves the identity for every n.
115
- theorem mantels_bound_is_n_squared_over_four_for_every_n :
116
- ∀ n : Nat, (n / 2) * (n - n / 2) = n * n / 4 := by
117
- intro n
118
- rcases Nat.mod_two_eq_zero_or_one n with h | h
119
- · obtain ⟨m, rfl⟩ : ∃ m, n = 2 * m := ⟨n / 2, by omega⟩
120
- have h1 : 2 * m / 2 = m := by omega
121
- have h2 : 2 * m * (2 * m) = 4 * (m * m) := by
122
- rw [Nat.mul_assoc 2 m (2 * m), Nat.mul_comm m (2 * m), Nat.mul_assoc 2 m m]; omega
123
- rw [h1, show 2 * m - m = m by omega, h2]
124
- omega
125
- · obtain ⟨m, rfl⟩ : ∃ m, n = 2 * m + 1 := ⟨n / 2, by omega⟩
126
- have h1 : (2 * m + 1) / 2 = m := by omega
127
- have h2 : (2 * m + 1) * (2 * m + 1) = 4 * (m * (m + 1)) + 1 := by
128
- rw [Nat.mul_add m m 1, Nat.mul_one, Nat.add_mul, Nat.mul_add, Nat.mul_add, Nat.mul_one, Nat.one_mul]
129
- rw [Nat.mul_assoc 2 m (2 * m), Nat.mul_comm m (2 * m), Nat.mul_assoc 2 m m]
130
- omega
131
- rw [h1, show 2 * m + 1 - m = m + 1 by omega, h2]
132
- omega
133
-
134
-
135
- -- ── reflections, from the easy batch: each law beside its inverse (the 2×7 ↔ 1+6 wave) ──
136
- theorem four_times_a_near_product_is_at_most_the_square :
137
- ∀ a d : Nat, a * (a + d) * 4 ≤ (a + (a + d)) * (a + (a + d)) := by
138
- intro a d
139
- have e1 : a * (a + d) = a * a + a * d := Nat.mul_add a a d
140
- have e2 : (a + (a + d)) * (a + (a + d)) = 4 * (a * a) + 4 * (a * d) + d * d := by
141
- rw [show a + (a + d) = 2 * a + d by omega, Nat.add_mul, Nat.mul_add, Nat.mul_add,
142
- Nat.mul_assoc 2 a (2 * a), Nat.mul_comm a (2 * a), Nat.mul_assoc 2 a a, Nat.mul_assoc 2 a d,
143
- Nat.mul_comm d (2 * a), Nat.mul_assoc 2 a d]
144
- omega
145
- rw [e1, e2]
146
- omega
147
-
148
- theorem no_cut_beats_the_balanced_one_for_every_n :
149
- ∀ n a : Nat, a ≤ n → a * (n - a) ≤ n * n / 4 := by
150
- intro n a h
151
- obtain ⟨b, rfl⟩ : ∃ b, n = a + b := ⟨n - a, by omega⟩
152
- rw [show a + b - a = b by omega, Nat.le_div_iff_mul_le (by decide)]
153
- rcases Nat.le_total a b with hab | hab
154
- · obtain ⟨d, rfl⟩ : ∃ d, b = a + d := ⟨b - a, by omega⟩
155
- exact four_times_a_near_product_is_at_most_the_square a d
156
- · obtain ⟨d, rfl⟩ : ∃ d, a = b + d := ⟨a - b, by omega⟩
157
- rw [Nat.mul_comm (b + d) b, show b + d + b = b + (b + d) by omega]
158
- exact four_times_a_near_product_is_at_most_the_square b d
159
-
160
- end Demand