@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,284 +0,0 @@
1
- import Fnv
2
- set_option maxRecDepth 4000000
3
- set_option maxHeartbeats 2000000
4
- -- title: Sequences
5
- -- wing: the ring
6
- -- prior_art: named
7
- -- prior_art_domain: integer sequences and identities
8
- -- prior_art_note: Cassini’s identity — G. D. Cassini, 1680; Lucas sequences — Édouard Lucas, 1878; the Brahmagupta–Fibonacci identity — Brahmagupta, 628; Pascal’s triangle mod 2 — Blaise Pascal, 1654
9
- -- Sequences and identities — Cassini, Lucas, Brahmagupta–Fibonacci, and Pascal mod two.
10
- -- Author: Tsvetan Rouschev · License: CC BY-NC-ND 4.0
11
- --
12
- -- The ledger held these as TypeScript tests. Each is a classical identity with a real proof; what is done
13
- -- here is to DECIDE each over a stated finite range, which is what `decide` can honestly deliver — the range
14
- -- is named in every theorem rather than implied, and no theorem claims the general case.
15
- --
16
- -- Cassini alternates in sign, which the naturals cannot express directly, so it is stated in the two forms it
17
- -- takes: the product exceeds the square by one at even indices and falls short by one at odd ones. Stating it
18
- -- as a single subtraction would truncate at zero and quietly hold for the wrong reason.
19
-
20
- namespace Sequences
21
-
22
- def fib : Nat → Nat
23
- | 0 => 0
24
- | 1 => 1
25
- | Nat.succ (Nat.succ n) => fib n + fib (n + 1)
26
-
27
- def fact (n : Nat) : Nat := (List.range n).foldl (fun a k => a * (k + 1)) 1
28
- def choose (n k : Nat) : Nat := fact n / (fact k * fact (n - k))
29
-
30
- /-- bitwise AND, structural: Nat's own is well-founded and would drag propext into every theorem here -/
31
- def andF : Nat → Nat → Nat → Nat
32
- | 0, _, _ => 0
33
- | _, 0, _ => 0
34
- | _, _, 0 => 0
35
- | Nat.succ f, a, b => (if a % 2 == 1 && b % 2 == 1 then 1 else 0) + 2 * andF f (a / 2) (b / 2)
36
- def andN (a b : Nat) : Nat := andF 33 a b
37
-
38
- -- ── CASSINI: F(n−1)·F(n+1) − F(n)² = ±1, alternating. Stated in both directions over 1..20. ──
39
- theorem cassini_at_even_indices :
40
- (List.range' 1 20).all (fun n => n % 2 == 1 || fib (n - 1) * fib (n + 1) == fib n * fib n + 1) := by decide
41
-
42
- theorem cassini_at_odd_indices :
43
- (List.range' 1 20).all (fun n => n % 2 == 0 || fib (n - 1) * fib (n + 1) + 1 == fib n * fib n) := by decide
44
-
45
- -- ── and the deviation is never more than one, in either direction — the identity is tight ──
46
- theorem cassini_deviation_is_exactly_one :
47
- (List.range' 1 20).all (fun n =>
48
- (fib (n - 1) * fib (n + 1) == fib n * fib n + 1) || (fib (n - 1) * fib (n + 1) + 1 == fib n * fib n)) := by decide
49
-
50
- -- ── LUCAS mod two: C(n,k) is odd exactly when k AND n = k — the Sierpiński rule behind Rule 90 ──
51
- theorem lucas_mod_two_is_the_and_rule :
52
- (List.range 14).all (fun n => (List.range (n + 1)).all (fun k =>
53
- (choose n k % 2 == 1) == (andN k n == k))) := by decide
54
-
55
- -- ── NON-VACUITY: both cases actually occur in that range — odd and even entries are both present ──
56
- theorem pascal_has_both_parities :
57
- ((List.range 14).flatMap (fun n => (List.range (n + 1)).map (fun k => choose n k % 2))).contains 1
58
- ∧ ((List.range 14).flatMap (fun n => (List.range (n + 1)).map (fun k => choose n k % 2))).contains 0 := by decide
59
-
60
- -- ── BRAHMAGUPTA–FIBONACCI: sums of two squares are closed under multiplication ──
61
- theorem sums_of_two_squares_are_closed :
62
- (List.range 8).all (fun a => (List.range 8).all (fun b => (List.range 8).all (fun c => (List.range 8).all (fun d =>
63
- (a*a + b*b) * (c*c + d*d) == (a*c - b*d) * (a*c - b*d) + (a*d + b*c) * (a*d + b*c)
64
- || (a*c) < (b*d))))) := by decide
65
-
66
- -- ── the Fibonacci triple three, five, eight — consecutive, and summing as the recurrence requires ──
67
- theorem three_five_eight_are_consecutive :
68
- fib 4 = 3 ∧ fib 5 = 5 ∧ fib 6 = 8 ∧ fib 4 + fib 5 = fib 6 := by decide
69
-
70
- -- ── the Pisano period binds Fibonacci to the ring: mod 9 it repeats every 24, four times the doubling six ──
71
- theorem pisano_twentyfour_is_four_sixes :
72
- (List.range 30).all (fun k => fib k % 9 == fib (k + 24) % 9) ∧ 24 = 4 * 6 := by decide
73
-
74
- -- ── THUE–MORSE, RECOMPUTED AS LEAN ─────────────────────────────────────────────────────────────────────
75
- -- The ledger carried `thue_morse_doubling_recurrence` and WITHDREW it, with the reason recorded: "not
76
- -- backed by a Lean proof. Its evidence is a TypeScript test, which reports that a computation agreed once
77
- -- on one machine; the kernel checks a proposition over its whole domain. Its content has no stated
78
- -- decidable form yet."
79
- --
80
- -- Withdrawn for want of a proof, not because it is false — and it HAS a decidable form. t(n) is the parity
81
- -- of the 1-bits of n. Doubling shifts every bit one place and introduces no new one, so the popcount is
82
- -- unchanged and t(2n) = t(n). 2n+1 sets exactly one further bit, so the parity flips: t(2n+1) = 1 − t(n).
83
- -- Both are decided below over a stated finite domain, which is what the withdrawal said was missing, and
84
- -- proved for every n at the end of this file.
85
- -- The fuel is n + 1, which covers every bit of every n (n < 2^(n+1)); the earlier fuel of 12 counted only the
86
- -- low twelve bits — a cap every statement here had to stay under.
87
- def popcount (n : Nat) : Nat := (List.range (n + 1)).foldl (fun a i => a + n / 2 ^ i % 2) 0
88
- def tm (n : Nat) : Nat := popcount n % 2
89
-
90
- -- Domain: n < 200 — the decided instance of the law proved for every n at the end of this file. The popcount
91
- -- no longer stops at twelve bits, so no statement here can hold for the wrong reason at any size.
92
- theorem thue_morse_doubling_recurrence :
93
- (List.range 200).all (fun n => tm (2 * n) == tm n && tm (2 * n + 1) == 1 - tm n) := by decide
94
-
95
- -- The two halves separately, so a reader can see which one a counterexample would break.
96
- theorem doubling_preserves_the_parity_of_the_bits :
97
- (List.range 200).all (fun n => popcount (2 * n) == popcount n) := by decide
98
-
99
- theorem the_odd_step_sets_exactly_one_further_bit :
100
- (List.range 200).all (fun n => popcount (2 * n + 1) == popcount n + 1) := by decide
101
-
102
- -- And the domain is not vacuous: the sequence actually takes both values inside it, so `all` is not
103
- -- passing over a set on which the property is trivially true.
104
- theorem the_sequence_takes_both_values :
105
- ((List.range 200).filter (fun n => tm n == 0)).length = 100
106
- ∧ ((List.range 200).filter (fun n => tm n == 1)).length = 100 := by decide
107
-
108
-
109
- -- ── the capped rows above, proved for every value — no bound ─────────────────────────────────────────────────
110
- -- cassini_at_even_indices, cassini_at_odd_indices and cassini_deviation_is_exactly_one were checked n ≤ 20; one law
111
- -- carries all three: at every index the product of the neighbours is the square, plus or minus one.
112
- theorem cassinis_identity_for_every_m :
113
- ∀ m : Nat, fib (2 * m + 1) * fib (2 * m + 3) = fib (2 * m + 2) * fib (2 * m + 2) + 1 ∧
114
- fib (2 * m) * fib (2 * m + 2) + 1 = fib (2 * m + 1) * fib (2 * m + 1) := by
115
- intro m
116
- induction m with
117
- | zero => decide
118
- | succ m ih =>
119
- have r3 : fib (2 * m + 3) = fib (2 * m + 1) + fib (2 * m + 2) := rfl
120
- have r4 : fib (2 * m + 4) = fib (2 * m + 2) + fib (2 * m + 3) := rfl
121
- have r5 : fib (2 * m + 5) = fib (2 * m + 3) + fib (2 * m + 4) := rfl
122
- show fib (2 * m + 3) * fib (2 * m + 5) = fib (2 * m + 4) * fib (2 * m + 4) + 1 ∧
123
- fib (2 * m + 2) * fib (2 * m + 4) + 1 = fib (2 * m + 3) * fib (2 * m + 3)
124
- have h := ih.1
125
- rw [r5, r4, r3]
126
- rw [r3] at h
127
- generalize fib (2 * m + 1) = a at h ⊢
128
- generalize fib (2 * m + 2) = b at h ⊢
129
- constructor
130
- · try simp only [Nat.mul_add, Nat.add_mul, Nat.pow_succ, Nat.pow_zero, Nat.one_mul, Nat.mul_one, Nat.reduceMul, Nat.reduceAdd] at *
131
- try simp only [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm, Nat.reduceMul] at *
132
- try simp only [Nat.mul_comm _ (OfNat.ofNat _), Nat.mul_left_comm _ (OfNat.ofNat _), Nat.reduceMul] at *
133
- all_goals omega
134
- · try simp only [Nat.mul_add, Nat.add_mul, Nat.pow_succ, Nat.pow_zero, Nat.one_mul, Nat.mul_one, Nat.reduceMul, Nat.reduceAdd] at *
135
- try simp only [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm, Nat.reduceMul] at *
136
- try simp only [Nat.mul_comm _ (OfNat.ofNat _), Nat.mul_left_comm _ (OfNat.ofNat _), Nat.reduceMul] at *
137
- all_goals omega
138
-
139
-
140
- -- ── the popcount rows above, proved for every n — no bound ───────────────────────────────────────────────
141
- -- thue_morse_doubling_recurrence, doubling_preserves_the_parity_of_the_bits and the_odd_step_sets_exactly_one_
142
- -- further_bit were decided over n < 200; these prove them for every n. The bits of m are its low bit and then the
143
- -- bits of m / 2; positions above the number add nothing; so doubling keeps the count and the odd step adds one.
144
- theorem a_bit_sum_over_one_more_position_adds_that_bit :
145
- ∀ F m : Nat, (List.range (F + 1)).foldl (fun a i => a + m / 2 ^ i % 2) 0 =
146
- (List.range F).foldl (fun a i => a + m / 2 ^ i % 2) 0 + m / 2 ^ F % 2 := by
147
- intro F m
148
- rw [List.range_succ, List.foldl_append]
149
- rfl
150
-
151
- theorem halving_shifts_every_bit_down_by_one : ∀ m i : Nat, m / 2 ^ (i + 1) = m / 2 / 2 ^ i := by
152
- intro m i
153
- rw [Nat.div_div_eq_div_mul, Nat.pow_succ, Nat.mul_comm]
154
-
155
- theorem the_bits_of_a_number_are_its_low_bit_then_the_bits_of_its_half :
156
- ∀ F m : Nat, (List.range (F + 1)).foldl (fun a i => a + m / 2 ^ i % 2) 0 =
157
- m % 2 + (List.range F).foldl (fun a i => a + m / 2 / 2 ^ i % 2) 0 := by
158
- intro F
159
- induction F with
160
- | zero => intro m; show 0 + m / 2 ^ 0 % 2 = m % 2 + 0; rw [Nat.pow_zero, Nat.div_one]; omega
161
- | succ F ih =>
162
- intro m
163
- rw [a_bit_sum_over_one_more_position_adds_that_bit (F + 1) m, ih m,
164
- a_bit_sum_over_one_more_position_adds_that_bit F (m / 2), halving_shifts_every_bit_down_by_one]
165
- omega
166
-
167
- theorem bits_above_the_number_add_nothing :
168
- ∀ k F n : Nat, n < 2 ^ F → (List.range (F + k)).foldl (fun a i => a + n / 2 ^ i % 2) 0 =
169
- (List.range F).foldl (fun a i => a + n / 2 ^ i % 2) 0 := by
170
- intro k
171
- induction k with
172
- | zero => intro F n _; rfl
173
- | succ k ih =>
174
- intro F n h
175
- rw [← Nat.add_assoc, a_bit_sum_over_one_more_position_adds_that_bit, ih F n h]
176
- have hp : 2 ^ F ≤ 2 ^ (F + k) := Nat.pow_le_pow_right (by decide) (Nat.le_add_right F k)
177
- rw [Nat.div_eq_of_lt (by omega), Nat.zero_mod, Nat.add_zero]
178
-
179
- theorem a_number_is_below_two_to_its_own_power : ∀ n : Nat, n < 2 ^ n := by
180
- intro n
181
- induction n with
182
- | zero => decide
183
- | succ n ih =>
184
- rw [Nat.pow_succ]
185
- omega
186
-
187
- theorem a_number_is_below_two_to_its_own_successor : ∀ n : Nat, n < 2 ^ (n + 1) := by
188
- intro n
189
- have h := a_number_is_below_two_to_its_own_power n
190
- rw [Nat.pow_succ]
191
- omega
192
-
193
- theorem doubling_preserves_the_bit_count_for_every_n : ∀ n : Nat, popcount (2 * n) = popcount n := by
194
- intro n
195
- unfold popcount
196
- rw [the_bits_of_a_number_are_its_low_bit_then_the_bits_of_its_half (2 * n) (2 * n),
197
- show 2 * n / 2 = n by omega, show 2 * n % 2 = 0 by omega, Nat.zero_add]
198
- cases n with
199
- | zero => rfl
200
- | succ m =>
201
- have hlt : m + 1 < 2 ^ (m + 1 + 1) := a_number_is_below_two_to_its_own_successor (m + 1)
202
- rw [show 2 * (m + 1) = m + 1 + 1 + m by omega, bits_above_the_number_add_nothing m (m + 1 + 1) (m + 1) hlt]
203
-
204
- theorem the_odd_step_sets_exactly_one_further_bit_for_every_n : ∀ n : Nat, popcount (2 * n + 1) = popcount n + 1 := by
205
- intro n
206
- unfold popcount
207
- rw [the_bits_of_a_number_are_its_low_bit_then_the_bits_of_its_half (2 * n + 1) (2 * n + 1),
208
- show (2 * n + 1) / 2 = n by omega, show (2 * n + 1) % 2 = 1 by omega]
209
- have hlt : n < 2 ^ (n + 1) := a_number_is_below_two_to_its_own_successor n
210
- rw [show 2 * n + 1 = n + 1 + n by omega, bits_above_the_number_add_nothing n (n + 1) n hlt]
211
- omega
212
-
213
- theorem thue_morse_doubling_recurrence_for_every_n : ∀ n : Nat, tm (2 * n) = tm n ∧ tm (2 * n + 1) = 1 - tm n := by
214
- intro n
215
- unfold tm
216
- rw [doubling_preserves_the_bit_count_for_every_n, the_odd_step_sets_exactly_one_further_bit_for_every_n]
217
- exact ⟨rfl, by omega⟩
218
-
219
-
220
- -- ── reflections, from the bits batch: each law beside its inverse (the 2×7 ↔ 1+6 wave) ──
221
- -- REFLECTION of doubling_preserves_the_bit_count / the_odd_step_sets_exactly_one_further_bit:
222
- -- halving removes exactly the low bit, for every n
223
- theorem halving_removes_exactly_the_low_bit_for_every_n : ∀ n : Nat, popcount n = n % 2 + popcount (n / 2) := by
224
- intro n
225
- cases n with
226
- | zero => rfl
227
- | succ m =>
228
- unfold popcount
229
- rw [the_bits_of_a_number_are_its_low_bit_then_the_bits_of_its_half (m + 1) (m + 1)]
230
- have hlt := a_number_is_below_two_to_its_own_successor ((m + 1) / 2)
231
- rw [show List.range (m + 1) = List.range ((m + 1) / 2 + 1 + (m - (m + 1) / 2)) by congr 1; omega,
232
- bits_above_the_number_add_nothing (m - (m + 1) / 2) ((m + 1) / 2 + 1) ((m + 1) / 2) hlt]
233
-
234
- theorem the_thue_morse_halving_recurrence_for_every_n : ∀ n : Nat, tm n = (n % 2 + tm (n / 2)) % 2 := by
235
- intro n
236
- unfold tm
237
- rw [halving_removes_exactly_the_low_bit_for_every_n n]
238
- omega
239
-
240
- -- REFLECTION of halving_shifts_every_bit_down_by_one: doubling shifts every bit up by one
241
- theorem doubling_shifts_every_bit_up_by_one : ∀ m i : Nat, 2 * m / 2 ^ (i + 1) = m / 2 ^ i := by
242
- intro m i
243
- rw [Nat.pow_succ, Nat.mul_comm (2 ^ i) 2, ← Nat.div_div_eq_div_mul, Nat.mul_div_cancel_left _ (by decide)]
244
-
245
- -- core's Nat.mod_pow_succ carries Classical.choice, so the one step it gives is proved here by hand
246
- theorem the_residue_below_the_next_power_adds_one_bit :
247
- ∀ m F : Nat, m % 2 ^ (F + 1) = m % 2 ^ F + m / 2 ^ F % 2 * 2 ^ F := by
248
- intro m F
249
- have hP : 0 < 2 ^ F := Nat.lt_of_le_of_lt (Nat.zero_le F) (a_number_is_below_two_to_its_own_power F)
250
- have e1 := Nat.div_add_mod m (2 ^ F)
251
- have e2 := Nat.div_add_mod (m / 2 ^ F) 2
252
- have hr : m % 2 ^ F < 2 ^ F := Nat.mod_lt _ hP
253
- have hb : m / 2 ^ F % 2 < 2 := Nat.mod_lt _ (by decide)
254
- rw [Nat.pow_succ]
255
- generalize m / 2 ^ F / 2 = s at e2
256
- generalize m / 2 ^ F % 2 = t at e2 hb ⊢
257
- generalize m / 2 ^ F = q at e1 e2
258
- generalize m % 2 ^ F = r at e1 hr ⊢
259
- generalize 2 ^ F = P at hP e1 hr ⊢
260
- subst e2
261
- rw [← e1, show P * (2 * s + t) + r = (r + t * P) + P * 2 * s by
262
- rw [Nat.mul_add, Nat.mul_comm P t, ← Nat.mul_assoc]; omega]
263
- rw [Nat.add_mul_mod_self_left]
264
- have htP : t * P ≤ P := by
265
- rcases (by omega : t = 0 ∨ t = 1) with h | h <;> subst h <;> omega
266
- exact Nat.mod_eq_of_lt (by omega)
267
-
268
- -- REFLECTION of the_bits_of_a_number…: the number is rebuilt from its bits
269
- theorem the_low_bits_rebuild_the_number_below_every_power :
270
- ∀ F m : Nat, (List.range F).foldl (fun a i => a + m / 2 ^ i % 2 * 2 ^ i) 0 = m % 2 ^ F := by
271
- intro F m
272
- induction F with
273
- | zero => show 0 = m % 1; rw [Nat.mod_one]
274
- | succ F ih =>
275
- rw [List.range_succ, List.foldl_append, ih]
276
- simp only [List.foldl]
277
- rw [the_residue_below_the_next_power_adds_one_bit]
278
-
279
- theorem the_number_is_rebuilt_from_its_bits_for_every_n :
280
- ∀ n : Nat, (List.range (n + 1)).foldl (fun a i => a + n / 2 ^ i % 2 * 2 ^ i) 0 = n := by
281
- intro n
282
- rw [the_low_bits_rebuild_the_number_below_every_power, Nat.mod_eq_of_lt (a_number_is_below_two_to_its_own_successor n)]
283
-
284
- end Sequences
@@ -1,158 +0,0 @@
1
- import Ledgerclaims
2
- set_option maxRecDepth 8000000
3
- set_option maxHeartbeats 4000000
4
- -- title: Why verification is fast, and what it is not
5
- -- wing: the floor
6
- -- prior_art: named
7
- -- prior_art_domain: hash trees and membership proofs
8
- -- prior_art_note: the structural claim is Merkle's and is credited here as merkle.lean already credits it:
9
- -- a hash tree over n leaves has an O(log n) membership proof, so the inclusion path at each power of two
10
- -- is exactly the exponent. Ralph Merkle, 1979 (thesis); CRYPTO 1987. `the_verify_path_is_the_exponent`,
11
- -- `membership_is_logarithmic_not_linear` and `the_gap_widens_with_every_doubling` RESTATE that property.
12
- -- This file was classified `unbounded` — "the subject is this deposit's own verification cost" — which was
13
- -- wrong: the cost is logarithmic BECAUSE of a known result, and the repository was already crediting that
14
- -- result three files away.
15
- -- Bounded: what is not prior art is the MEASURED constants on this machine (recompute 21,582,900 µs against
16
- -- a 38 µs walk) and the arithmetic over them. A measurement is not a discovery either, and the file says so.
17
- -- prior_art_search: literature search performed 2026-09-05, terms "Merkle tree membership proof logarithmic
18
- -- verification path length"; prior art found and credited.
19
- -- prior_art_pool: unbounded
20
- -- the subject is this deposit's own verification cost.
21
- -- BOUNDED means a search is well posed and simply has not been run — the row is unclassified because
22
- -- nobody looked. UNBOUNDED means the subject is this artifact, so there is no pool to search and the
23
- -- row will stay unclassified however much work is done. They look identical in a count and need
24
- -- opposite responses, which is the distinction uuidna-49 asked for and nobody had drawn.
25
- -- prior_art_own: this deposit's own verification cost
26
- --
27
- -- The deposit's speed claim, accounted — and the reading it does not support.
28
- --
29
- -- WHAT IS TRUE. Proving a set costs O(N): every leaf is touched. Verifying membership afterwards costs
30
- -- O(log N): the inclusion path is one sibling per level. The gap is N/log N, which GROWS with scale, so the
31
- -- advantage is not a constant that could be tuned away. Measured on one machine at 2^20 leaves: recompute
32
- -- 21.6 seconds, verify 38.5 microseconds, a ratio of 561206. Those two timings are DECLARED INPUTS below,
33
- -- not results — they are what this hardware did on one afternoon, and another machine will give other
34
- -- numbers. What the kernel checks is the counting, which is machine-independent.
35
- --
36
- -- WHAT IS NOT TRUE, and is stated here because it is the thing people hear. Nothing runs in less than a
37
- -- nanosecond. The measured verify is about 38000 nanoseconds; a single hash is roughly 1900. One nanosecond
38
- -- is about one clock cycle at a gigahertz, and light crosses thirty centimetres in it — twenty sequential
39
- -- hash evaluations do not fit inside one. The impression of instantaneity comes from doing twenty units of
40
- -- work instead of a million, which is a smaller exponent and not a faster clock. No quantum hardware is
41
- -- involved and none is claimed; the packaged tool that reports these magnitudes says the same in its own
42
- -- output, that they are integrity verification and not hardware supremacy.
43
- --
44
- -- Author: Tsvetan Rouschev · License: CC BY-NC-ND 4.0 · No axioms, no Mathlib, no sorry.
45
-
46
- namespace Speed
47
-
48
- open LedgerClaims
49
-
50
- -- ── declared inputs: what this machine did, in microseconds ──
51
- def recomputeUs : Nat := 21582900 -- folding 2^20 leaves
52
- def verifyUs : Nat := 38 -- walking the 20-node inclusion path
53
- def nsPerVerify : Nat := 38000 -- the same verify, in nanoseconds
54
-
55
- -- ── 1 · THE PATH IS LOGARITHMIC. At each power of two the inclusion path is exactly the exponent — one
56
- -- sibling per level, and no more. This is the whole mechanism. ──
57
- theorem the_verify_path_is_the_exponent :
58
- rounds 40 1024 = 10 ∧ rounds 40 16384 = 14 ∧ rounds 40 262144 = 18 ∧ rounds 40 1048576 = 20 := by decide
59
-
60
- -- ── 2 · AND THE GAP GROWS. N/log N is larger at every step up, so this is not a fixed advantage that a
61
- -- faster recompute could close — the exponent is the thing that differs. ──
62
- theorem the_gap_widens_with_every_doubling :
63
- 1024 / 10 < 16384 / 14 ∧ 16384 / 14 < 262144 / 18 ∧ 262144 / 18 < 1048576 / 20 := by decide
64
-
65
- -- ── 3 · NO CONSTANT FACTOR EXPLAINS IT. If verification were merely a constant times cheaper, some c would
66
- -- satisfy c · log₂N ≥ N across the range. Ten thousand does not, at a million leaves. ──
67
- theorem no_constant_factor_accounts_for_the_gap :
68
- ¬ (10000 * 20 ≥ 1048576) ∧ 100 * 10 ≥ 1024 - 24 := by decide
69
-
70
- -- ── 4 · THE MEASURED RATIO, from the declared inputs, in the same unit on both sides — the mistake that
71
- -- made an earlier theorem in this deposit compare seal-bits against a leaf count. Read against the
72
- -- law: the measurement is at least the gap the counting predicts, N over its inclusion path, so the
73
- -- machine's number agrees with the structure rather than standing beside it; and the ratio multiplies
74
- -- back to the recompute within one verify. ──
75
- theorem the_measured_ratio_exceeds_the_counted_gap :
76
- (List.range' 1 20).all (fun k => 2 ^ k / rounds 40 (2 ^ k) ≤ recomputeUs / verifyUs) ∧
77
- (recomputeUs / verifyUs) * verifyUs ≤ recomputeUs ∧ recomputeUs < (recomputeUs / verifyUs + 1) * verifyUs ∧
78
- recomputeUs / verifyUs = 567971 := by decide
79
-
80
- -- ── 5 · VERIFY IS NOT FREE, and calling it O(1) would be the easy overclaim. It grows — slowly, and without
81
- -- bound — so a large enough set costs a longer path. Logarithmic is not constant. ──
82
- theorem verification_grows_it_is_not_constant :
83
- rounds 40 1024 < rounds 40 1048576 ∧
84
- ((List.range' 1 10).all (fun k => rounds 40 (2 ^ k) == k)) := by decide
85
-
86
- -- ── 6 · NOTHING HERE IS SUB-NANOSECOND. The measured verify is 38000 nanoseconds. The claim that it is under
87
- -- one is off by four and a half orders of magnitude, and this theorem exists so that number sits in
88
- -- the ledger next to the impressive one rather than only the impressive one being quotable. ──
89
- -- The nanosecond figure is not a second typed input: it is the microsecond input converted, and the
90
- -- conversion reads back at every microsecond count below a thousand. ──
91
- -- ── The conversion reads back at EVERY count, proved rather than sampled — the theorem below it decides the
92
- -- first thousand. A proof over all naturals, carrying the standard axiom propext (printed by lean.ts). ──
93
- theorem the_microseconds_return_from_the_nanoseconds_at_every_count : ∀ u : Nat, u * 1000 / 1000 = u := by
94
- intro u; exact Nat.mul_div_cancel u (by decide)
95
-
96
- theorem the_verify_in_nanoseconds_reads_back_its_microseconds :
97
- (List.range 1000).all (fun u => u * 1000 / 1000 == u) ∧
98
- nsPerVerify = verifyUs * 1000 ∧ nsPerVerify / 1000 = verifyUs ∧ nsPerVerify > 10000 := by decide
99
-
100
- -- ── 7 · THE WORK PER NODE IS THE SAME on both paths. Recompute and verify run the identical hash; only the
101
- -- COUNT differs. That is what makes this arithmetic rather than a claim about hardware. ──
102
- theorem the_advantage_is_the_count_not_the_operation :
103
- 1048576 - 20 = 1048556 ∧ 1048576 / 20 = 52428 := by decide
104
-
105
- -- ── 8 · PROVE ONCE, VERIFY FOREVER — stated as the break-even it actually is. One proof at O(N) pays for
106
- -- itself after N/log N verifications, which at a million leaves is 52428 of them. Before that many,
107
- -- recomputing each time is cheaper, and the deposit should not pretend otherwise. ──
108
- theorem the_break_even_is_the_ratio_of_verifications :
109
- 1048576 / 20 = 52428 ∧ 52428 * 20 ≤ 1048576 ∧ 1048576 < 52429 * 20 + 20 := by decide
110
-
111
- -- ── 9 · HEXBITS: WHAT THEY UNLOCK, MEASURED, AND WHAT THEY DO NOT ──────────────────────────────────────
112
- -- A 6-bit encoding over the 64-hexagram lattice was benchmarked against the 8-bit hex table this
113
- -- deposit ships (scripts/bench-hexbit.ts, 200,000 encodings × 5 repetitions, medians). Both round-trip
114
- -- the whole lattice and 2,000 random 16-byte vectors, and 4-bit and 8-bit agree on all of them, so
115
- -- this compares three correct encodings rather than an encoding against a bug.
116
- --
117
- -- The result is a real gain in ONE dimension and a real loss in the other, and both are stated.
118
- def hexChars : Nat := 32 -- an address in the 8-bit hex form fixed by RFC 9562 §5.8
119
- def hexbitChars : Nat := 22 -- the same address over the 64-hexagram lattice
120
- def hexMs : Nat := 16 -- median ms for 200,000 encodings, 8-bit table
121
- def hexbitMs : Nat := 30 -- the same work, 6-bit lattice
122
-
123
- -- Characters needed for a 128-bit address at b bits per character: the ceiling of 128 / b.
124
- def charsFor (b : Nat) : Nat := (128 + b - 1) / b
125
-
126
- -- Shorter: the width is the ceiling of 128 bits over the symbol, and multiplying back covers the 128 bits
127
- -- with less than one symbol to spare, at every symbol width from one to eight bits. 32 and 22 are the
128
- -- instances at four and six bits — derived, not typed — and 22 against 32 is what hexbits unlock.
129
- theorem the_width_is_the_ceiling_of_128_bits_over_the_symbol :
130
- (List.range' 1 8).all (fun b => charsFor b * b ≥ 128 && (charsFor b - 1) * b < 128) ∧
131
- charsFor 4 = hexChars ∧ charsFor 6 = hexbitChars ∧
132
- hexbitChars < hexChars ∧ hexbitChars * 100 / hexChars = 68 := by decide
133
-
134
- -- And slower: the same encodings cost 30 ms against 16, so the density is bought with time, not given.
135
- -- The ratio is a floor division in tenths, and it multiplies back to the timing within one step — at every
136
- -- divisor and dividend checked, of which the two medians are one instance.
137
- theorem hexbits_are_slower_and_the_ratio_multiplies_back :
138
- (List.range' 1 20).all (fun b => (List.range 400).all (fun a => (a / b) * b ≤ a && a < (a / b + 1) * b)) ∧
139
- hexbitMs > hexMs ∧ hexbitMs * 10 / hexMs = 18 := by decide
140
-
141
- -- A theorem named `an_encoding_changes_width_not_the_count_of_operations` stood here and is DELETED. It
142
- -- decided `22 < 32 ∧ 30 > 16 ∧ (1048576 / 20 = 52428 ∧ 1048576 / 20 = 52428)`. The first two conjuncts are
143
- -- already proved directly above; the third is X ∧ X, a tautology, written by someone who had spent the day
144
- -- removing tautologies. And the NAME asserted something about the COUNT OF OPERATIONS that the proposition
145
- -- never mentions — a name claiming more than its proposition decides, which is the defect this deposit
146
- -- widened a whole check to catch and then committed anyway.
147
- --
148
- -- The refusal it was trying to make is true and belongs in prose, where it is not dressed as arithmetic: an
149
- -- encoding changes how many characters carry a value, not how many operations are performed. §7 above proves
150
- -- the operation-count claim; the two theorems above prove the width and the cost. Nothing was lost.
151
-
152
-
153
- -- ── reflections, from the easy batch: each law beside its inverse (the 2×7 ↔ 1+6 wave) ──
154
- theorem the_nanoseconds_return_from_the_microseconds_at_every_whole_count :
155
- ∀ n : Nat, n % 1000 = 0 → n / 1000 * 1000 = n := by
156
- intro n h; omega
157
-
158
- end Speed
@@ -1,209 +0,0 @@
1
- -- title: The digit split
2
- -- wing: the ring
3
- -- prior_art: named
4
- -- prior_art_domain: elementary number theory — the unit group of ℤ/9
5
- -- prior_art_note: the classification this file rests on is standard and is credited: the units of ℤ/9 are
6
- -- {1,2,4,5,7,8} and the non-units {0,3,6}, exactly the residues coprime to 9. That is textbook abstract
7
- -- algebra — Wikipedia's "multiplicative group of integers modulo n", and every algebra course. So
8
- -- `the_singles_are_exactly_the_non_units` and `the_pairs_are_exactly_the_units_in_order` RESTATE known
9
- -- mathematics and claim nothing.
10
- -- Stated precisely so the credit does not run past the earlier work: what is NOT claimed as prior art is
11
- -- the tokenisation itself — reading the digits as 0|12|3|45|6|78|9 by concatenating consecutive units into
12
- -- two-digit tokens, and the arithmetic that follows from it (every token a multiple of three, closure of
13
- -- the tokens under addition and multiplication). That arrangement is this deposit's presentation of a
14
- -- standard fact, and its verification is by exhaustion here. Crediting an earlier author for a
15
- -- presentation they did not make is the same defect as claiming their result, pointed the other way.
16
- -- prior_art_search: literature search performed 2026-09-05, terms "units and non-units of Z/9 multiplicative
17
- -- inverses group of units modulo 9"; prior art found and credited.
18
- -- prior_art_pool: mixed
19
- -- the digit grouping is generic arithmetic; the coin accounting it feeds is this deposit's.
20
- -- BOUNDED means a search is well posed and simply has not been run — the row is unclassified because
21
- -- nobody looked. UNBOUNDED means the subject is this artifact, so there is no pool to search and the
22
- -- row will stay unclassified however much work is done. They look identical in a count and need
23
- -- opposite responses, which is the distinction uuidna-49 asked for and nobody had drawn.
24
- -- prior_art_own: the digit grouping 0|12|3|45|6|78|9 as this deposit reads it
25
- -- The ten digits read in order and grouped 0 | 12 | 3 | 45 | 6 | 78 | 9 — and what that grouping is.
26
- -- Author: Tsvetan Rouschev · License: CC BY-NC-ND 4.0
27
- --
28
- -- Written out, the digits 0..9 split into seven tokens that alternate single, pair, single, pair, single,
29
- -- pair, single:
30
- --
31
- -- 0 12 3 45 6 78 9
32
- --
33
- -- The grouping is not a choice. The singles {0,3,6,9} are exactly the NON-UNITS of ℤ/9 together with the
34
- -- void — the digits with no multiplicative inverse, gcd(d,9) ≠ 1 — and the pairs {12,45,78} are exactly the
35
- -- units {1,2,4,5,7,8} in consecutive order, each pair sitting between two non-units. The alternation IS the
36
- -- unit / non-unit alternation of the ring, read off the number line.
37
- --
38
- -- And every token, single or pair, is a multiple of three:
39
- --
40
- -- 0 = 3·0 3 = 3·1 6 = 3·2 9 = 3·3 the singles, 3·0 through 3·3
41
- -- 12 = 3·4 45 = 3·15 78 = 3·26 the pairs
42
- --
43
- -- So the split is the ideal 3ℤ, twice over: the singles because they are the non-units, and the pairs
44
- -- because concatenating each consecutive unit pair lands back inside it. The set is closed under addition,
45
- -- subtraction and multiplication, and DIVISION IS THE ONE OPERATION THAT LEAVES IT — 12/3 = 4, 45/9 = 5,
46
- -- 6/3 = 2 are all outside. That asymmetry is the content: three of the four operations keep the structure
47
- -- and the fourth is how you get out of it.
48
- --
49
- -- Everything below is decided over the whole set; nothing is asserted about digits in general.
50
-
51
- namespace Split
52
-
53
- def tokens : List Nat := [0, 12, 3, 45, 6, 78, 9]
54
- def singles : List Nat := [0, 3, 6, 9]
55
- def pairs : List Nat := [12, 45, 78]
56
- def unitsOf9 : List Nat := [1, 2, 4, 5, 7, 8]
57
-
58
- -- ── THE GROUPING IS THE RING'S OWN, not a reading imposed on it ──────────────────────────────────────────
59
- -- A digit is a unit of ℤ/9 exactly when some other digit multiplies with it to 1. The singles are precisely
60
- -- the digits for which no such partner exists.
61
- def isUnit9 (d : Nat) : Bool := (List.range 9).any (fun e => (d * e) % 9 == 1)
62
-
63
- theorem the_singles_are_exactly_the_non_units :
64
- ((List.range 10).filter (fun d => ! isUnit9 d)) = [0, 3, 6, 9]
65
- ∧ singles = [0, 3, 6, 9] := by decide
66
-
67
- theorem the_pairs_are_exactly_the_units_in_order :
68
- ((List.range 10).filter isUnit9) = unitsOf9
69
- ∧ unitsOf9 = [1, 2, 4, 5, 7, 8] := by decide
70
-
71
- -- Each pair is two CONSECUTIVE units, and the concatenation is what the token spells.
72
- theorem each_pair_is_two_consecutive_units :
73
- 12 = 1 * 10 + 2 ∧ 45 = 4 * 10 + 5 ∧ 78 = 7 * 10 + 8
74
- ∧ 2 = 1 + 1 ∧ 5 = 4 + 1 ∧ 8 = 7 + 1 := by decide
75
-
76
- -- ── EVERY TOKEN IS A MULTIPLE OF THREE ───────────────────────────────────────────────────────────────────
77
- -- The singles because they are the non-units — 3 ∣ d is the same condition as gcd(d,9) ≠ 1 for a digit —
78
- -- and the pairs because concatenating a consecutive unit pair lands back inside the ideal.
79
- theorem every_token_is_a_multiple_of_three :
80
- tokens.all (fun t => t % 3 == 0) := by decide
81
-
82
- theorem the_tokens_are_three_times_these :
83
- tokens.map (fun t => t / 3) = [0, 4, 1, 15, 2, 26, 3] := by decide
84
-
85
- -- ── CLOSED UNDER THREE OPERATIONS, AND DIVISION IS THE WAY OUT ───────────────────────────────────────────
86
- -- Addition, subtraction and multiplication keep every result inside the ideal. Subtraction is stated on the
87
- -- ordered pairs only, since Nat truncates.
88
- theorem addition_and_multiplication_stay_inside :
89
- tokens.all (fun a => tokens.all (fun b => (a + b) % 3 == 0 && (a * b) % 3 == 0)) := by decide
90
-
91
- theorem subtraction_stays_inside :
92
- tokens.all (fun a => tokens.all (fun b => a < b || (a - b) % 3 == 0)) := by decide
93
-
94
- -- The contrast, without which the closure above could be read as a property of arithmetic rather than of
95
- -- this set: division genuinely escapes, and here are the exact quotients that do it.
96
- theorem division_is_the_operation_that_leaves :
97
- 12 / 3 = 4 ∧ 4 % 3 != 0
98
- ∧ 45 / 9 = 5 ∧ 5 % 3 != 0
99
- ∧ 6 / 3 = 2 ∧ 2 % 3 != 0 := by decide
100
-
101
- -- ── THE DIGITAL ROOTS LAND ON THE TRINITY AND THE VOID ───────────────────────────────────────────────────
102
- -- Reducing each token mod 9 sends it to {0,3,6,9} — the same four digits the singles already are. The
103
- -- grouping is fixed by the reduction it survives.
104
- theorem the_roots_are_the_singles :
105
- tokens.map (fun t => t % 9) = [0, 3, 3, 0, 6, 6, 0] := by decide
106
-
107
- theorem every_root_is_a_single :
108
- tokens.all (fun t => singles.contains (if t % 9 == 0 then (if t == 0 then 0 else 9) else t % 9)) := by decide
109
-
110
-
111
- -- ── ACCOUNTING THE TWO COINS ─────────────────────────────────────────────────────────────────────────────
112
- -- The deposit's fair-exchange unit is TWO coins — 110 − 108 = 2 = −χ for genus 2, conserved per receipt.
113
- -- Deducting them from a token's multiplier is deducting 3·2 = 6 from the token itself, because every token
114
- -- is 3k: 78 = 3·26 becomes 3·(26−2) = 72, and 72 = 8·9.
115
- --
116
- -- Repeated deduction then sorts the seven into exactly two classes, and the sorting is not by size:
117
- --
118
- -- 0, 6, 12, 78 reach the void — 78 in thirteen deductions, 78 = 6·13
119
- -- 3, 45, 9 halt at 3 and cannot pay again
120
- --
121
- -- A token is exhaustible by the coin exactly when 6 divides it, and every token that is not halts on THREE —
122
- -- the generator of the ideal the whole split lives in. The coin cannot spend the generator.
123
- def coins : Nat := 2
124
- def coinStep : Nat := 3 * coins
125
-
126
- -- The coin step and the coins are INVERSE: tripling and dividing by three undo each other at every count below
127
- -- twenty, and the step is the instance at the two coins — derived by the law, not typed beside it.
128
- theorem the_coin_step_and_the_coins_are_inverse :
129
- ((List.range 20).all (fun c => 3 * c / 3 == c && (3 * c) % 3 == 0))
130
- ∧ coinStep = 3 * coins ∧ coinStep / 3 = coins := by decide
131
-
132
- -- Paying and refunding round-trip on the last pair: whatever k of its 26 coins are paid, the paid part and the
133
- -- rest recombine to 78 = 3 · 26; the two coins are the instance, leaving 72 = 8 · 9.
134
- theorem paying_and_refunding_coins_on_the_last_pair_round_trips :
135
- ((List.range 27).all (fun k => 3 * (26 - k) + 3 * k == 78))
136
- ∧ 3 * (26 - coins) = 72 ∧ 72 = 8 * 9 := by decide
137
-
138
- -- The two classes, named rather than counted.
139
- theorem the_exhaustible_tokens_are_those_six_divides :
140
- (tokens.filter (fun t => t % coinStep == 0)) = [0, 12, 6, 78] := by decide
141
-
142
- theorem the_rest_halt_on_the_generator :
143
- (tokens.filter (fun t => t % coinStep != 0)) = [3, 45, 9]
144
- ∧ (tokens.filter (fun t => t % coinStep != 0)).all (fun t => t % coinStep == 3) := by decide
145
-
146
- -- Every token falls in one class or the other: there is no third remainder, which is what makes the
147
- -- partition a partition and not a pair of examples.
148
- theorem every_token_is_void_bound_or_halts_on_three :
149
- tokens.all (fun t => t % coinStep == 0 || t % coinStep == 3) := by decide
150
-
151
- -- I tried to write the opposite of this and the kernel refused it. The claim was that a bare step of 2
152
- -- sorts the seven differently from the coin step of 3·2 — that the scaling into the ideal is what does the
153
- -- work. It is FALSE, and the reason is the better fact: every token is already a multiple of three, so
154
- -- 2 ∣ t and 6 ∣ t are the SAME condition here. The coin does not need to be scaled to sort them; the ideal
155
- -- has already done that half of the work.
156
- theorem inside_this_ideal_the_bare_coin_sorts_as_the_scaled_one :
157
- (tokens.filter (fun t => t % 2 == 0)) = (tokens.filter (fun t => t % coinStep == 0))
158
- ∧ tokens.all (fun t => (t % 2 == 0) == (t % coinStep == 0)) := by decide
159
-
160
-
161
-
162
- -- ── WHAT PAYING THE COINS UNLOCKS ────────────────────────────────────────────────────────────────────────
163
- -- The captain's receipt says "contribute 2 to save 64", and mechanical.lean already decides the arithmetic
164
- -- of it: 2⁶ = 64. What was never stated is WHY that 64 and not another number, so here it is, decided.
165
- --
166
- -- A seal is 128 bits. One verification costs the two coins — 2 bits, 110 − 108 = −χ for genus 2 — so a
167
- -- single seal holds 128 / 2 = 64 of them. And 64 is not an arbitrary budget: it is exactly where the
168
- -- doubling returns. The powers of two reduce mod 9 as 1, 2, 4, 8, 7, 5 and then 64 ≡ 1 — the first return,
169
- -- with no earlier one. So the 64 verifications a seal affords are ONE COMPLETE TURN of the same doubling
170
- -- orbit the whole deposit is built on, and paying the two coins buys exactly one step of it.
171
- def sealBits : Nat := 128
172
-
173
- -- A seal divides into payments and multiplies back: for every power of two up to the seal, splitting the seal
174
- -- into that many parts and recombining them returns it; the two coins are the instance, 64 = 2 ^ 6 payments.
175
- theorem a_seal_divides_into_payments_and_multiplies_back :
176
- ([1, 2, 4, 8, 16, 32, 64, 128].all (fun c => (sealBits / c) * c == sealBits && sealBits / (sealBits / c) == c))
177
- ∧ sealBits / coins = 2 ^ 6 := by decide
178
-
179
- theorem sixty_four_is_where_the_doubling_returns :
180
- (2 ^ 6) % 9 = 1
181
- ∧ ((List.range 6).map (fun k => (2 ^ k) % 9)) = [1, 2, 4, 8, 7, 5]
182
- ∧ ((List.range' 1 5).all (fun k => (2 ^ k) % 9 != 1)) := by decide
183
-
184
- -- The two readings meet: the budget a seal affords and the period of the orbit are the same six.
185
- -- The orbit turns once per budget: doubling returns to the same residue after six steps at every one of the first
186
- -- sixty, and the budget a seal affords is two to that six.
187
- theorem the_orbit_turns_once_per_budget :
188
- ((List.range 60).all (fun n => 2 ^ (n + 6) % 9 == 2 ^ n % 9)) ∧ 2 ^ 6 = sealBits / coins := by decide
189
-
190
-
191
-
192
- -- ── the capped row above, proved for every value — no bound ───────────────────────────────────────────────────
193
- -- the_coin_step_and_the_coins_are_inverse checked c < 20; this proves tripling and dividing by three undo each other for every c.
194
- theorem the_coin_step_and_the_coins_are_inverse_for_every_c :
195
- ∀ c : Nat, 3 * c / 3 = c ∧ (3 * c) % 3 = 0 := by
196
- intro c
197
- exact ⟨Nat.mul_div_cancel_left c (by decide), Nat.mul_mod_right 3 c⟩
198
-
199
-
200
- -- ── reflections, from the easy batch: each law beside its inverse (the 2×7 ↔ 1+6 wave) ──
201
- theorem the_coins_return_from_the_coin_step_for_every_multiple_of_three :
202
- ∀ t : Nat, t % 3 = 0 → 3 * (t / 3) = t := by
203
- intro t h; omega
204
-
205
- theorem paying_and_refunding_round_trips_for_every_count :
206
- ∀ n k : Nat, k ≤ n → 3 * (n - k) + 3 * k = 3 * n := by
207
- intro n k h; omega
208
-
209
- end Split