@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,495 +0,0 @@
1
- import Families
2
- -- title: Elementary arithmetic
3
- -- wing: the ring
4
- -- prior_art: named
5
- -- prior_art_domain: elementary number theory and combinatorial game theory
6
- -- prior_art_note: Euclid (Elements IX.36) and Euler for the even perfect numbers; the amicable pair
7
- -- (220, 284) is attributed to Pythagoras; Eisenstein for the ring ℤ[ω]; Bouton (1901) for the
8
- -- subtraction game's losing positions. None of these results is this deposit's. What is this deposit's is
9
- -- the DECISION of each over a stated finite range, axiom-free, and the honest record of where the range
10
- -- stops short of what the older claim asserted.
11
- -- prior_art_search: the results are named in every undergraduate text; no search was needed to find them.
12
- -- prior_art_pool: named
13
- -- Elementary arithmetic, decided — the claims the ledger held in TypeScript, given a kernel.
14
- -- Author: Tsvetan Rouschev · License: CC BY-NC-ND 4.0
15
- --
16
- -- This file exists because families.lean had grown to about 140 seconds of kernel time and every theorem
17
- -- added to it lengthened the tree's critical path. A separate file compiles alongside the others rather
18
- -- than behind them, and the helpers it needs — gcd', isPrime, unitsMod, ordMod — are imported rather than
19
- -- copied, because a second copy of gcdFuel would be a second thing to keep true.
20
-
21
- -- ── WHY THIS IS NOT CALLED `Classical` ──────────────────────────────────────────────────────────────────
22
- -- It was, for a day, and Lean's own `Classical` namespace shadowed it: `choose` inside this file resolved to
23
- -- `Classical.choose`, which rests on `Classical.choice` — an AXIOM, in a deposit whose entire standard is
24
- -- that no theorem depends on one. The compile error is the small cost; the real one is a reader seeing a
25
- -- file called Classical in an axiom-free record and drawing the obvious wrong conclusion. Thirteen keys were
26
- -- sealed under `lean_classical_*` before this was noticed and are carried, not withdrawn: the theorems are
27
- -- unchanged and are decided at their new address.
28
- namespace Elementary
29
-
30
- open Families
31
-
32
- /-- the sum of the proper divisors — every divisor below n itself -/
33
- def properDivisorSum (n : Nat) : Nat := ((List.range' 1 (n - 1)).filter (fun d => n % d == 0)).foldl (· + ·) 0
34
-
35
- -- ── EUCLID'S FORM. 2^(p−1)(2^p − 1) is perfect whenever 2^p − 1 is prime ─────────────────────────────────
36
- -- Stated with its hypothesis attached rather than as a list of four numbers that happen to be perfect.
37
- -- The range stops at p = 7 for a reason worth stating: the next case, p = 13, is 33 550 336, and the
38
- -- divisor sum walks every number below it. That is a longer computation, not a harder theorem.
39
- set_option maxRecDepth 2000000 in
40
- theorem euclids_form_is_perfect_at_every_mersenne_prime_to_seven :
41
- [2, 3, 5, 7].all (fun p =>
42
- !(isPrime (2 ^ p - 1)) || properDivisorSum (2 ^ (p - 1) * (2 ^ p - 1)) == 2 ^ (p - 1) * (2 ^ p - 1)) := by decide
43
-
44
- -- ── and the hypothesis is not decoration: at p = 11 the Mersenne number is composite ─────────────────────
45
- -- Without this, the theorem above is four cases where the guard happens to be true, and a reader has no
46
- -- way to see that the guard ever does anything. 2^11 − 1 = 2047 = 23 · 89.
47
- theorem the_mersenne_hypothesis_is_real_at_eleven :
48
- isPrime (2 ^ 11 - 1) = false ∧ 23 * 89 = 2 ^ 11 - 1 := by decide
49
-
50
- -- ── the amicable pair: each is the other's proper-divisor sum, and NEITHER is its own ────────────────────
51
- set_option maxRecDepth 2000000 in
52
- theorem the_amicable_pair_is_mutual_and_neither_is_perfect :
53
- properDivisorSum 220 = 284 ∧ properDivisorSum 284 = 220 ∧
54
- properDivisorSum 220 ≠ 220 ∧ properDivisorSum 284 ≠ 284 := by decide
55
-
56
- -- ── the primitive roots mod nine are exactly two and five ────────────────────────────────────────────────
57
- -- families.lean decides that a primitive root EXISTS at 9. Which ones they are is a different statement,
58
- -- and the ledger's row claims the stronger one: a residue is a primitive root exactly when its powers
59
- -- run through all six units, and only 2 and 5 do.
60
- theorem the_primitive_roots_mod_nine_are_exactly_two_and_five :
61
- (unitsMod 9).filter (fun g => ordMod g 9 == 6) = [2, 5] := by decide
62
-
63
- /-- the norm on the Eisenstein integers a + bω, where ω is a primitive cube root of unity -/
64
- def eisensteinNorm (a b : Int) : Int := a * a - a * b + b * b
65
-
66
- -- ── the Eisenstein integers have exactly six units ───────────────────────────────────────────────────────
67
- -- The units are the norm-1 elements. Searched over the box −3…3 in both coordinates, which is wider than
68
- -- it needs to be: the norm is a positive definite form, so nothing outside can have norm 1, and finding
69
- -- exactly six inside a box that could have held more is the content.
70
- theorem the_eisenstein_units_are_exactly_six :
71
- (((List.range 7).flatMap (fun (i : Nat) =>
72
- (List.range 7).map (fun (j : Nat) => (((i : Int) - 3, (j : Int) - 3) : Int × Int)))).filter
73
- (fun p => eisensteinNorm p.1 p.2 == 1)).length = 6 := by decide
74
-
75
- -- ── the subtraction game {1,2,3}: the mover loses exactly at the multiples of four ───────────────────────
76
- -- Both halves, which is what makes it the theorem rather than a pattern: from a multiple of four every
77
- -- legal move leaves a non-multiple, and from a non-multiple some legal move reaches one.
78
- theorem the_subtraction_game_loses_exactly_at_the_multiples_of_four :
79
- (List.range 41).all (fun n =>
80
- if n % 4 == 0 then [1, 2, 3].all (fun m => !(m ≤ n) || (n - m) % 4 != 0)
81
- else [1, 2, 3].any (fun m => m ≤ n && (n - m) % 4 == 0)) := by decide
82
-
83
- -- ── THE UNIT GROUP OF ℤ/9, WHICH IS THE GROUP THIS WHOLE DEPOSIT IS BUILT ON ────────────────────────────
84
- --
85
- -- scripts/candidates.ts proposed `units_are_six` as the heir for seven different withdrawn rows, all of
86
- -- them about (ℤ/9)*, and it was wrong every time: knowing the group has six elements decides none of
87
- -- what those rows claim. They are real statements and each needed its own theorem. That the ranking
88
- -- proposed one theorem for seven claims is exactly why it writes nothing.
89
-
90
- -- ── the six units fall into three additive-inverse pairs, each summing to nine ───────────────────────────
91
- theorem the_units_of_z9_form_three_pairs_summing_to_nine :
92
- ((unitsMod 9).filter (fun u => u < 9 - u)).length = 3 ∧
93
- (unitsMod 9).all (fun u => (unitsMod 9).contains (9 - u) && u + (9 - u) == 9) := by decide
94
-
95
- -- ── the Cayley table is a Latin square: every row AND every column is a permutation of the units ─────────
96
- -- Rows alone would suffice in an abelian group, but only if commutativity were already stated. Both are
97
- -- decided here rather than one being inferred from something this theorem does not say.
98
- theorem the_multiplication_table_of_the_z9_units_is_a_latin_square :
99
- (unitsMod 9).all (fun a =>
100
- ((unitsMod 9).map (fun b => a * b % 9)).eraseDups.length == (unitsMod 9).length &&
101
- ((unitsMod 9).map (fun b => a * b % 9)).all (fun x => (unitsMod 9).contains x)) ∧
102
- (unitsMod 9).all (fun b =>
103
- ((unitsMod 9).map (fun a => a * b % 9)).eraseDups.length == (unitsMod 9).length &&
104
- ((unitsMod 9).map (fun a => a * b % 9)).all (fun x => (unitsMod 9).contains x)) := by decide
105
-
106
- -- ── the count of primitive roots is φ(φ(n)), wherever a primitive root exists at all ────────────────────
107
- -- Range 2…60, because the row it carries says "over the moduli up to 60" and 18 is not 60. The theorem
108
- -- moved to the claim rather than the claim being read down to the theorem.
109
- set_option maxRecDepth 2000000 in
110
- set_option maxHeartbeats 2000000 in
111
- theorem the_count_of_primitive_roots_is_phi_of_phi :
112
- (List.range' 2 59).all (fun n => !(hasPrimitiveRoot n) ||
113
- ((unitsMod n).filter (fun g => ordMod g n == (unitsMod n).length)).length == totient (totient n)) := by decide
114
-
115
- -- ── the order spectrum realises Gauss's divisor sum: φ(d) units of order d, and the φ's sum to the group ─
116
- -- The divisors are computed, not listed: a typed [1, 2, 3, 6] would be the answer written into the
117
- -- question, and the second conjunct is Σ_{d | 6} φ(d) = 6, which is the statement the first one realises.
118
- theorem the_order_spectrum_of_the_z9_units_realises_gauss_divisor_sum :
119
- ((List.range' 1 6).filter (fun d => 6 % d == 0)).all (fun d =>
120
- ((unitsMod 9).filter (fun g => ordMod g 9 == d)).length == totient d) ∧
121
- (((List.range' 1 6).filter (fun d => 6 % d == 0)).map totient).foldl (· + ·) 0 = 6 := by decide
122
-
123
- -- ── Gauss's generalisation of Wilson: the product of the units is −1 exactly where a primitive root exists,
124
- -- and +1 everywhere else. Wilson's theorem is the prime case of this, and the split is Gauss's. ────────
125
- set_option maxRecDepth 2000000 in
126
- set_option maxHeartbeats 2000000 in
127
- theorem the_product_of_the_units_is_minus_one_exactly_where_gauss_says :
128
- (List.range' 2 59).all (fun n =>
129
- ((unitsMod n).foldl (fun a u => a * u % n) 1) == (if gaussCyclic n then n - 1 else 1)) := by decide
130
-
131
- -- ── three is a primitive root mod seven, and seven is six units plus the one non-unit ────────────────────
132
- theorem three_is_a_primitive_root_mod_seven_and_seven_is_six_plus_one :
133
- ordMod 3 7 = 6 ∧ (unitsMod 7).length = 6 ∧ (List.range 7).length = (unitsMod 7).length + 1 := by decide
134
-
135
- -- ── the order-six unit group splits as a reflection times a trinity ──────────────────────────────────────
136
- -- u ↦ (u³, u⁴) is the splitting, and it works because 3 + 4 = 7 ≡ 1 in the exponent group of order six.
137
- -- The two factors have two and three values, which is the C2 × C3 the Chinese remainder theorem predicts.
138
- theorem the_z9_unit_group_splits_as_reflection_times_trinity :
139
- (unitsMod 9).all (fun u => powMod u 3 9 * powMod u 4 9 % 9 == u) ∧
140
- ((unitsMod 9).map (fun u => powMod u 3 9)).eraseDups.length = 2 ∧
141
- ((unitsMod 9).map (fun u => powMod u 4 9)).eraseDups.length = 3 := by decide
142
-
143
- -- ── A SIXTH WAVE, AND THE RULE THAT DECIDES WHICH OF THEM CARRY A LEDGER ROW ────────────────────────────
144
- --
145
- -- A bounded theorem carries an unbounded claim only when the ROW ITSELF states its bound. "Verified for
146
- -- all primes ≤ 100" is a claim a range can settle; "for every Pythagorean triple" is not, however wide
147
- -- the range. Both kinds are worth proving and only the first kind is carried, which is why some of the
148
- -- theorems below have no carry beside them in scripts/recover.ts.
149
-
150
- def invUnit (u : Nat) : Nat := ((List.range 9).find? (fun e => u * e % 9 == 1)).getD 0
151
-
152
- -- ── Fermat, at the primes: a sum of two squares exactly at 2 and the primes one mod four ────────────────
153
- set_option maxRecDepth 2000000 in
154
- theorem an_odd_prime_is_a_sum_of_two_squares_exactly_when_it_is_one_mod_four :
155
- isSumOfTwoSquares 2 ∧
156
- ((List.range' 3 197).filter isPrime).all (fun p => isSumOfTwoSquares p == (p % 4 == 1)) := by decide
157
-
158
- -- ── the area of an integer right triangle is a multiple of six ──────────────────────────────────────────
159
- set_option maxRecDepth 2000000 in
160
- set_option maxHeartbeats 2000000 in
161
- theorem the_area_of_an_integer_right_triangle_is_a_multiple_of_six :
162
- (List.range' 1 40).all (fun a => (List.range' 1 40).all (fun b =>
163
- !((List.range' 1 60).any (fun c => a * a + b * b == c * c)) || (a * b / 2) % 6 == 0)) := by decide
164
-
165
- -- ── the inverse map permutes the units and is its own inverse ───────────────────────────────────────────
166
- theorem the_inverse_map_permutes_the_units_and_is_an_involution :
167
- ((unitsMod 9).map invUnit).eraseDups.length = (unitsMod 9).length ∧
168
- ((unitsMod 9).map invUnit).all (fun x => (unitsMod 9).contains x) ∧
169
- (unitsMod 9).all (fun u => invUnit (invUnit u) == u) := by decide
170
-
171
- -- ── the hockey stick: a diagonal run of binomials folds into the entry just past its end ────────────────
172
- set_option maxRecDepth 2000000 in
173
- theorem the_hockey_stick_identity_holds_across_the_range :
174
- (List.range 11).all (fun r => (List.range 19).all (fun m =>
175
- ((List.range' r (m + 1)).map (fun i => choose i r)).foldl (· + ·) 0 == choose (r + m + 1) (r + 1))) := by decide
176
-
177
- -- ── three is the only prime one less than a square, and the reason is the factorisation ─────────────────
178
- -- n² − 1 = (n−1)(n+1), and above n = 2 both factors exceed one. Decided over a range; the row claims it
179
- -- for every n, so the range does not carry it — the factorisation is the general argument and this is
180
- -- the check that the argument has no small counterexample.
181
- theorem three_is_the_only_prime_one_less_than_a_square_in_this_range :
182
- ((List.range' 2 40).filter (fun n => isPrime (n * n - 1))) = [2] ∧
183
- (List.range' 3 39).all (fun n => (n - 1) * (n + 1) == n * n - 1 && n - 1 > 1) := by decide
184
-
185
- -- ── eight triangular numbers and one make an odd square ─────────────────────────────────────────────────
186
- theorem eight_times_a_triangular_number_plus_one_is_an_odd_square :
187
- (List.range 60).all (fun n => 8 * (n * (n + 1) / 2) + 1 == (2 * n + 1) * (2 * n + 1)) := by decide
188
-
189
- -- ── the vortex and the rosette carry the same group: 2^k mod 9 ↦ 3^k mod 7 is an isomorphism ────────────
190
- -- Both power maps are bijections onto their unit groups, and the map through the exponent sends a
191
- -- product to a product — which is what "preserves multiplication" means, stated rather than assumed
192
- -- from both groups merely having six elements.
193
- theorem the_powers_of_two_mod_nine_and_of_three_mod_seven_are_isomorphic :
194
- ((List.range 6).map (fun k => powMod 2 k 9)).eraseDups.length = 6 ∧
195
- ((List.range 6).map (fun k => powMod 3 k 7)).eraseDups.length = 6 ∧
196
- ((List.range 6).map (fun k => powMod 2 k 9)).all (fun x => (unitsMod 9).contains x) ∧
197
- ((List.range 6).map (fun k => powMod 3 k 7)).all (fun x => (unitsMod 7).contains x) ∧
198
- (List.range 6).all (fun i => (List.range 6).all (fun j =>
199
- powMod 2 i 9 * powMod 2 j 9 % 9 == powMod 2 ((i + j) % 6) 9 &&
200
- powMod 3 i 7 * powMod 3 j 7 % 7 == powMod 3 ((i + j) % 6) 7)) := by decide
201
-
202
- -- ── LUCAS, PELL, AND THE FAREY SEQUENCE ─────────────────────────────────────────────────────────────────
203
-
204
- def lucasPair : Nat → Nat × Nat
205
- | 0 => (2, 1)
206
- | Nat.succ n => let (a, b) := lucasPair n; (b, a + b)
207
- def lucas (n : Nat) : Nat := (lucasPair n).1
208
-
209
- def pellPair : Nat → Nat × Nat
210
- | 0 => (0, 1)
211
- | Nat.succ n => let (a, b) := pellPair n; (b, 2 * b + a)
212
- def pell (n : Nat) : Nat := (pellPair n).1
213
-
214
- /-- a/b ≤ c/d without division, which over Nat would truncate and decide the wrong order -/
215
- def leFrac (x y : Nat × Nat) : Bool := x.1 * y.2 ≤ y.1 * x.2
216
- def insFrac (x : Nat × Nat) : List (Nat × Nat) → List (Nat × Nat)
217
- | [] => [x]
218
- | y :: ys => if leFrac x y then x :: y :: ys else y :: insFrac x ys
219
- def sortFrac : List (Nat × Nat) → List (Nat × Nat)
220
- | [] => []
221
- | x :: xs => insFrac x (sortFrac xs)
222
- /-- the Farey sequence of order n: every reduced a/b in [0,1] with b ≤ n, in order -/
223
- def farey (n : Nat) : List (Nat × Nat) :=
224
- sortFrac (((List.range' 1 n).flatMap (fun b =>
225
- (List.range (b + 1)).map (fun a => (a, b)))).filter (fun x => gcd' x.1 x.2 == 1))
226
-
227
- -- ── the Lucas numbers: the recurrence, and the two values the row names ─────────────────────────────────
228
- theorem the_lucas_numbers_follow_their_recurrence_and_reach_their_named_values :
229
- lucas 0 = 2 ∧ lucas 1 = 1 ∧ lucas 5 = 11 ∧ lucas 7 = 29 ∧
230
- (List.range' 2 28).all (fun n => lucas n == lucas (n - 1) + lucas (n - 2)) := by decide
231
-
232
- -- ── and Lucas is Fibonacci's neighbours added: L(n) = F(n−1) + F(n+1) ───────────────────────────────────
233
- -- Two independently defined sequences meeting, which is more than either recurrence says on its own.
234
- theorem the_lucas_numbers_are_the_sum_of_the_neighbouring_fibonaccis :
235
- (List.range' 1 28).all (fun n => lucas n == fib (n - 1) + fib (n + 1)) := by decide
236
-
237
- -- ── the Pell numbers: doubling recurrence, and the two values the row names ─────────────────────────────
238
- theorem the_pell_numbers_follow_their_recurrence_and_reach_their_named_values :
239
- pell 5 = 29 ∧ pell 6 = 70 ∧
240
- (List.range' 2 24).all (fun n => pell n == 2 * pell (n - 1) + pell (n - 2)) := by decide
241
-
242
- -- ── Farey: neighbours have unit determinant, and their mediant falls strictly between them ──────────────
243
- -- F_4 for the determinant and F_6 for the mediant, which are the two rows this carries. Both statements
244
- -- are cross-multiplied rather than divided: a/b < c/d is a·d < c·b, and Nat division would truncate the
245
- -- comparison into agreeing with itself.
246
- set_option maxRecDepth 2000000 in
247
- theorem consecutive_farey_neighbours_have_unit_determinant_and_bracket_their_mediant :
248
- (List.range ((farey 4).length - 1)).all (fun i =>
249
- let x := (farey 4).getD i (0, 1); let y := (farey 4).getD (i + 1) (0, 1)
250
- x.2 * y.1 == x.1 * y.2 + 1) ∧
251
- (List.range ((farey 6).length - 1)).all (fun i =>
252
- let x := (farey 6).getD i (0, 1); let y := (farey 6).getD (i + 1) (0, 1)
253
- let m := (x.1 + y.1, x.2 + y.2)
254
- x.1 * m.2 < m.1 * x.2 && m.1 * y.2 < y.1 * m.2) := by decide
255
-
256
- -- ── IS THIS SPACE VERTEX-TRANSITIVE? A PEER SESSION ASKED, AND THE ANSWER IS HALF YES ───────────────────
257
- --
258
- -- A session working on zeropoint-node found a vertex-transitive structure — 6-bit cells doubled by a
259
- -- polarity bit, 128 states each with 12 neighbours — and offered the mechanism: a sign or orientation bit
260
- -- carried as METADATA rather than as part of the state may, when folded in, double the neighbourhood and
261
- -- buy uniform degree. Their suggested test was to compute the degree of every state and see whether the
262
- -- set of degrees has one element. That is decidable here, so it was computed rather than considered.
263
- --
264
- -- The answer is that the mechanism does not apply to this ring, and the reason is a fact this deposit
265
- -- already decides. Over the whole of ℤ/9 the degrees are not uniform and folding a polarity bit in does
266
- -- not make them so: the obstruction is the triad, which doubling and reflection cannot move off itself.
267
- -- Over the UNITS the graph is regular — but it was already regular before any polarity was added, so
268
- -- nothing was bought. A mechanism that would have been credited for a property already present is worth
269
- -- saying out loud, because that is how a true story attaches itself to the wrong cause.
270
-
271
- /-- the deposit's own maps, as an adjacency: doubling, its inverse, and the reflection -/
272
- def nbrs (S : List Nat) (d : Nat) : List Nat :=
273
- ([(2 * d) % 9, (5 * d) % 9, (9 - d) % 9].filter (fun t => S.contains t && t != d)).eraseDups
274
- def degreeSet (S : List Nat) : List Nat := (S.map (fun d => (nbrs S d).length)).eraseDups
275
-
276
- -- ── on the units the graph is regular: every unit has exactly three neighbours ──────────────────────────
277
- theorem the_units_are_three_regular_under_doubling_halving_and_reflection :
278
- degreeSet (unitsMod 9) = [3] := by decide
279
-
280
- -- ── and on the whole ring it is not, with the triad as the exact obstruction ────────────────────────────
281
- -- Zero is fixed by all three maps and has no neighbours at all; three and six see only each other. The
282
- -- degree set has more than one element, which is the test the peer proposed, answered in the negative.
283
- theorem the_whole_ring_is_not_regular_and_the_triad_is_why :
284
- degreeSet (List.range 9) ≠ [3] ∧
285
- (nbrs (List.range 9) 0).length = 0 ∧
286
- ([3, 6] : List Nat).all (fun d => (nbrs (List.range 9) d).length == 1) := by decide
287
-
288
- -- ── FOUR CLAIMS THE LEDGER HELD AND ONE ORPHANED THEOREM RESTORED PROPERLY ──────────────────────────────
289
-
290
- /-- integer square root by search: the largest s with s² ≤ n, over a range wide enough for the uses below -/
291
- def isqrt (n : Nat) : Nat := ((List.range 200).filter (fun s => s * s ≤ n)).getLast? |>.getD 0
292
-
293
- /-- ⌊nφ⌋ and ⌊nφ²⌋ without leaving the naturals: φ = (1 + √5)/2, so nφ = (n + √(5n²))/2 exactly -/
294
- def lowerWythoff (n : Nat) : Nat := (n + isqrt (5 * n * n)) / 2
295
- def upperWythoff (n : Nat) : Nat := (3 * n + isqrt (5 * n * n)) / 2
296
-
297
- /-- the knight's steps, DERIVED: offsets in −2…2 written as 0…4, kept when |dr|·|dc| = 2 -/
298
- def knightSteps : List (Nat × Nat) :=
299
- ((List.range 5).flatMap (fun a => (List.range 5).map (fun b => (a, b)))).filter (fun p =>
300
- (if p.1 ≥ 2 then p.1 - 2 else 2 - p.1) * (if p.2 ≥ 2 then p.2 - 2 else 2 - p.2) == 2)
301
-
302
- /-- the partitions of n into non-increasing parts, enumerated — fuel because n − j is not structural -/
303
- def partsF : Nat → Nat → Nat → List (List Nat)
304
- | 0, _, _ => []
305
- | _, 0, _ => [[]]
306
- | Nat.succ f, n, k => (List.range' 1 (min n k)).flatMap (fun j => (partsF f (n - j) j).map (fun l => j :: l))
307
- def partitionsOf (n : Nat) : List (List Nat) := partsF (n + 1) n n
308
-
309
- /-- restricted growth strings: one per set partition of {0…n−1}, which is what the Bell numbers count -/
310
- def rgs : Nat → List (List Nat)
311
- | 0 => [[]]
312
- | Nat.succ n => (rgs n).flatMap (fun p =>
313
- (List.range ((p.foldl (fun a x => if x > a then x else a) 0) + (if p.isEmpty then 1 else 2))).map (fun v => p ++ [v]))
314
- /-- the Bell triangle, built row by row. The textbook recurrence B(n+1) = Σ C(n,k)·B(n−k) recurses on
315
- `n − k`, which is not structural: Lean falls back to well-founded recursion, `decide` gets stuck on the
316
- unreduced instance, and the equation lemmas would pull `propext` in and cost this file its axiom-free
317
- standing. The triangle is structural on the row index and computes the same numbers. -/
318
- def bellRow : Nat → List Nat
319
- | 0 => [1]
320
- | Nat.succ n =>
321
- let prev := bellRow n
322
- (List.range (prev.length + 1)).foldl (fun acc i =>
323
- acc ++ [if i == 0 then prev.getLastD 0 else acc.getD (i - 1) 0 + prev.getD (i - 1) 0]) []
324
- def bellOf (n : Nat) : Nat := (bellRow n).headD 0
325
-
326
- -- ── the exterior angles of any regular polygon sum to a full turn ───────────────────────────────────────
327
- -- `geom_exterior_360` was orphaned holding `[3,5,8].all (fun n => n * (360 / n) == 360)`, which is true
328
- -- only because 3, 5 and 8 happen to divide 360 — a statement about integer division wearing a geometry
329
- -- name. The interior angles of an n-gon sum to (n−2)·180 and the exterior to 360, and together they are
330
- -- n straight angles. That identity needs no division and holds at every n.
331
- theorem the_interior_and_exterior_angles_are_n_straight_angles :
332
- (List.range' 3 30).all (fun n => (n - 2) * 180 + 360 == n * 180) ∧
333
- 180 * (3 - 2) / 3 = 60 ∧ 180 * (5 - 2) / 5 = 108 ∧ 180 * (8 - 2) / 8 = 135 := by decide
334
-
335
- -- ── a knight has exactly eight leaps, and every one changes the colour of its square ────────────────────
336
- -- Colour is the parity of row + column, and the offsets are written as 0…4 for −2…2. |a−2| ≡ a (mod 2),
337
- -- so the parity of the shifted pair is the parity of the real step — the check is not an artefact of
338
- -- the encoding.
339
- theorem a_knight_has_exactly_eight_leaps_and_every_one_flips_the_colour :
340
- knightSteps.length = 8 ∧ knightSteps.eraseDups.length = 8 ∧
341
- knightSteps.all (fun p => (p.1 + p.2) % 2 == 1) := by decide
342
-
343
- -- ── the Wythoff pair: ⌊nφ²⌋ − ⌊nφ⌋ = n, the golden Beatty identity ──────────────────────────────────────
344
- theorem the_golden_beatty_identity_holds_across_the_range :
345
- (List.range' 1 40).all (fun n => upperWythoff n - lowerWythoff n == n) := by decide
346
-
347
- -- ── and the two sequences PARTITION the positive integers: every m up to fifty is hit by exactly one of the
348
- -- lower and upper Wythoff sequences, never both, never neither (Beatty's theorem, 1926, at φ and φ²). The
349
- -- identity above says how the two are paired; this says the pairing loses and duplicates nothing ──
350
- set_option maxRecDepth 2000000 in
351
- theorem the_wythoff_sequences_partition_the_integers :
352
- (List.range' 1 50).all (fun m =>
353
- ((List.range' 1 40).map lowerWythoff).count m + ((List.range' 1 40).map upperWythoff).count m == 1) := by decide
354
-
355
- -- ── the partition numbers count the partitions, and the Bell numbers count the set partitions ───────────
356
- -- Both are checked against an ENUMERATION of the objects rather than against another recurrence, which
357
- -- is the difference between confirming a formula and confirming what it counts.
358
- set_option maxRecDepth 2000000 in
359
- theorem the_partition_and_bell_numbers_count_what_they_claim_to_count :
360
- (partitionsOf 5).length = 7 ∧ (partitionsOf 7).length = 15 ∧ (partitionsOf 10).length = 42 ∧
361
- (List.range 6).all (fun n => (rgs n).length == bellOf n) ∧
362
- bellOf 3 = 5 ∧ bellOf 4 = 15 ∧ bellOf 5 = 52 := by decide
363
-
364
- -- ── WHICH GRAPH, NOT JUST WHAT DEGREE — THE TEST A PEER'S MISTAKE MADE ME RUN ───────────────────────────
365
- --
366
- -- The zeropoint-node session came back with two corrections to its own result. The first was the one I
367
- -- had asked for: its undoubled structure was already vertex-transitive, so the polarity bought nothing.
368
- -- The second it found on its own and is worse — it had counted TWELVE neighbours and called the
369
- -- structure a vector equilibrium, and then counted the edges AMONG those twelve and found zero. A
370
- -- cuboctahedron's twelve vertices carry twenty-four edges between them. It had the vertex count of the
371
- -- solid and none of its geometry: a name fitted to a count.
372
- --
373
- -- `the_units_are_three_regular_…` above proves a DEGREE and nothing else, which is exactly the shape of
374
- -- that error waiting to happen here. So the same test, run on this ring: what is the neighbourhood of a
375
- -- unit, and does it carry any edges?
376
- --
377
- -- It carries none. Every unit's three neighbours are mutually non-adjacent, so this graph is
378
- -- triangle-free and has no local geometry either — and the reason is structural rather than accidental.
379
- -- The neighbourhood of a unit is EXACTLY the opposite tetrahedron: doubling, halving and reflection all
380
- -- carry a residue across the mod-3 classes, so the graph is the complete bipartite one between them.
381
- -- The merkaba's two tetrahedra, which this deposit already decides are exchanged by doubling, turn out
382
- -- to be the bipartition. Nothing here is a solid; it is K(3,3) wearing the ring's own split.
383
-
384
- /-- the two tetrahedra, DERIVED as the mod-3 classes of the units rather than written out -/
385
- def tetOf (r : Nat) : List Nat := (unitsMod 9).filter (fun d => d % 3 == r)
386
-
387
- theorem the_unit_graph_is_complete_bipartite_between_the_two_tetrahedra :
388
- (tetOf 1).length = 3 ∧ (tetOf 2).length = 3 ∧
389
- (tetOf 1).all (fun d => (nbrs (unitsMod 9) d).length == 3 &&
390
- (nbrs (unitsMod 9) d).all (fun t => (tetOf 2).contains t)) ∧
391
- (tetOf 2).all (fun d => (nbrs (unitsMod 9) d).length == 3 &&
392
- (nbrs (unitsMod 9) d).all (fun t => (tetOf 1).contains t)) ∧
393
- -- and every neighbourhood is an INDEPENDENT set: three vertices, no edge among them
394
- (unitsMod 9).all (fun d => (nbrs (unitsMod 9) d).all (fun x =>
395
- (nbrs (unitsMod 9) d).all (fun y => x == y || !((nbrs (unitsMod 9) x).contains y)))) := by decide
396
-
397
- -- ── what these settle ──
398
- def settledHere : Nat := 32
399
- theorem elementary_settles_its_range : settledHere = 32 := rfl
400
-
401
-
402
- -- ── the capped rows above, proved for every value — no bound ──────────────────────────────────────────────────
403
- -- the_interior_and_exterior_angles_are_n_straight_angles checked 3 ≤ n ≤ 32; this proves it for every n ≥ 2.
404
- theorem the_interior_and_exterior_angles_are_n_straight_angles_for_every_n :
405
- ∀ n : Nat, 2 ≤ n → (n - 2) * 180 + 360 = n * 180 := by
406
- intro n h
407
- omega
408
-
409
- theorem a_product_of_consecutive_numbers_is_even : ∀ n : Nat, n * (n + 1) % 2 = 0 := by
410
- intro n
411
- rcases Nat.mod_two_eq_zero_or_one n with h | h <;> simp [Nat.mul_mod, Nat.add_mod, h]
412
-
413
- -- eight_times_a_triangular_number_plus_one_is_an_odd_square checked n < 60; this proves it for every n.
414
- theorem eight_times_a_triangular_number_plus_one_is_an_odd_square_for_every_n :
415
- ∀ n : Nat, 8 * (n * (n + 1) / 2) + 1 = (2 * n + 1) * (2 * n + 1) := by
416
- intro n
417
- have hdiv : n * (n + 1) / 2 * 2 = n * (n + 1) :=
418
- Nat.div_mul_cancel (Nat.dvd_of_mod_eq_zero (a_product_of_consecutive_numbers_is_even n))
419
- have hexp : (2 * n + 1) * (2 * n + 1) = 4 * (n * (n + 1)) + 1 := by
420
- rw [Nat.mul_add n n 1, Nat.mul_one, Nat.add_mul, Nat.mul_add, Nat.mul_add, Nat.mul_one, Nat.one_mul]
421
- rw [Nat.mul_assoc 2 n (2 * n), Nat.mul_comm n (2 * n), Nat.mul_assoc 2 n n]
422
- omega
423
- rw [hexp]
424
- omega
425
-
426
-
427
- -- ── the capped row above, proved for every value — no bound ──────────────────────────────────────────────────
428
- -- the_lucas_numbers_are_the_sum_of_the_neighbouring_fibonaccis was checked n ≤ 28; this proves it for every n.
429
- theorem the_lucas_numbers_are_the_sum_of_the_neighbouring_fibonaccis_for_every_n :
430
- ∀ n : Nat, lucas (n + 1) = fib n + fib (n + 2) := by
431
- have key : ∀ n : Nat, lucas (n + 1) = fib n + fib (n + 2) ∧ lucas (n + 2) = fib (n + 1) + fib (n + 3) := by
432
- intro n
433
- induction n with
434
- | zero => decide
435
- | succ n ih =>
436
- refine ⟨ih.2, ?_⟩
437
- have l : lucas (n + 3) = lucas (n + 1) + lucas (n + 2) := rfl
438
- have f4 : fib (n + 4) = fib (n + 2) + fib (n + 3) := rfl
439
- have f2 : fib (n + 2) = fib n + fib (n + 1) := rfl
440
- show lucas (n + 3) = fib (n + 2) + fib (n + 4)
441
- rw [l, ih.1, ih.2, f4]
442
- omega
443
- intro n
444
- exact (key n).1
445
-
446
-
447
- -- ── reflections, from the easy batch: each law beside its inverse (the 2×7 ↔ 1+6 wave) ──
448
- theorem the_polygon_side_count_reads_back_from_its_angle_sum : ∀ n : Nat, 2 ≤ n → ((n - 2) * 180 + 360) / 180 = n := by
449
- intro n h; omega
450
-
451
- theorem every_odd_square_one_more_than_eight_times_m_makes_m_triangular :
452
- ∀ m r : Nat, 8 * m + 1 = r * r → m = r / 2 * (r / 2 + 1) / 2 := by
453
- intro m r h
454
- have hodd : r % 2 = 1 := by
455
- rcases Nat.mod_two_eq_zero_or_one r with e | e
456
- · have : r * r % 2 = 0 := by simp [Nat.mul_mod, e]
457
- omega
458
- · exact e
459
- obtain ⟨t, rfl⟩ : ∃ t, r = 2 * t + 1 := ⟨r / 2, by omega⟩
460
- rw [show (2 * t + 1) / 2 = t by omega]
461
- have hexp : (2 * t + 1) * (2 * t + 1) = 4 * (t * (t + 1)) + 1 := by
462
- rw [Nat.mul_add t t 1, Nat.mul_one, Nat.add_mul, Nat.mul_add, Nat.mul_add, Nat.mul_one, Nat.one_mul]
463
- rw [Nat.mul_assoc 2 t (2 * t), Nat.mul_comm t (2 * t), Nat.mul_assoc 2 t t]
464
- omega
465
- have hev := a_product_of_consecutive_numbers_is_even t
466
- rw [hexp] at h
467
- generalize t * (t + 1) = P at h hev ⊢
468
- omega
469
-
470
-
471
- -- ── reflections, from the sums batch: each law beside its inverse (the 2×7 ↔ 1+6 wave) ──
472
- -- REFLECTION of the Lucas law: the Fibonacci numbers read back from the neighbouring Lucas numbers
473
- theorem the_fibonaccis_are_a_fifth_of_the_neighbouring_lucas_numbers_for_every_n :
474
- ∀ n : Nat, 5 * fib (n + 1) = lucas n + lucas (n + 2) := by
475
- intro n
476
- cases n with
477
- | zero => decide
478
- | succ n =>
479
- have l1 := the_lucas_numbers_are_the_sum_of_the_neighbouring_fibonaccis_for_every_n n
480
- have l3 := the_lucas_numbers_are_the_sum_of_the_neighbouring_fibonaccis_for_every_n (n + 2)
481
- have f2 : fib (n + 2) = fib n + fib (n + 1) := rfl
482
- have f3 : fib (n + 3) = fib (n + 1) + fib (n + 2) := rfl
483
- have f4 : fib (n + 4) = fib (n + 2) + fib (n + 3) := rfl
484
- show 5 * fib (n + 2) = lucas (n + 1) + lucas (n + 2 + 1)
485
- rw [l1, l3, show n + 2 + 2 = n + 4 from rfl, f4]
486
- omega
487
-
488
-
489
- -- ── reflections, from the extra batch: each law beside its inverse (the 2×7 ↔ 1+6 wave) ──
490
- theorem half_a_product_of_consecutive_numbers_multiplies_back_for_every_n :
491
- ∀ n : Nat, n * (n + 1) / 2 * 2 = n * (n + 1) := by
492
- intro n
493
- exact Nat.div_mul_cancel (Nat.dvd_of_mod_eq_zero (a_product_of_consecutive_numbers_is_even n))
494
-
495
- end Elementary