@ceccec/millennium-solutions 9.3.3 → 9.3.5

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 +29 -15
  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
package/src/prove/emit.ts DELETED
@@ -1,115 +0,0 @@
1
- // EMIT — write the mechanically translated claims as a Lean file, then let the gates judge it.
2
- //
3
- // Nothing here decides whether a theorem is true. It renders the claim the ledger already states, in Lean,
4
- // and hands it to the kernel. Four things must hold before anything is sealed, and they are checked by the
5
- // tools that own them rather than re-implemented here: it compiles, every theorem is axiom-free, the
6
- // ledger's own test still computes true at the same claim, and the emitted statement contains no construct
7
- // the translator refuses. A claim that fails any of them is left in the queue with its reason.
8
- import { readFileSync, writeFileSync } from 'node:fs'
9
- import { execSync } from 'node:child_process'
10
- import { queue } from './index.ts'
11
- import { translate, PREAMBLE, importsFor } from './translate.ts'
12
-
13
- const OUT = 'src/proof/mechanical.lean'
14
-
15
- export function emit(): { written: number; skipped: number; file: string } {
16
- const q = queue()
17
- const rendered = q.map((p) => ({ p, t: translate(p.body) })).filter((x) => x.t.ok) as
18
- { p: { key: string; name: string }; t: { ok: true; lean: string } }[]
19
-
20
- // IMPORT THE PORT, NEVER RESTATE IT. A rendered claim that needs toUuid uses address.lean's own definition,
21
- // which is pinned to the shipped implementation by its agreement theorems. Copying that definition into the
22
- // generated file would create a second toUuid to keep in step, which is the shape of every drift here.
23
- const needed = [...new Set(rendered.flatMap((x) => importsFor(x.t.lean)))].sort()
24
- // FRONTMATTER, because the page reads it. Regenerating this file used to strip the `-- title:` / `-- wing:`
25
- // block that every hand-written proof carries, so the one file produced by a machine was the one file the
26
- // documentation could not describe. A generator that cannot introduce its own output is not finished.
27
- let body = needed.map((m) => `import ${m}\n`).join('') + `set_option maxRecDepth 400000\n`
28
- body += `-- title: Mechanically translated\n-- wing: the machine\n-- prior_art: unclassified\n`
29
- body += `-- Generated by src/prove/emit.ts from the ledger's own tests — do not hand-edit; re-run the prover.\n`
30
- body += `--\n`
31
- body += `-- Each theorem below is a claim the ledger already asserts, rendered into Lean by a whitelist\n`
32
- body += `-- translation of the deposit's test vocabulary. The rendering is mechanical: no construct outside the\n`
33
- body += `-- vocabulary is translated, because a guess would produce a theorem that compiles and states something\n`
34
- body += `-- else. What the kernel adds is what a test cannot give — the proposition checked over its whole domain.\n\n`
35
- body += `namespace Mechanical\n\n${PREAMBLE}\n\n`
36
- for (const { p, t } of rendered) {
37
- body += `-- ${p.name.replace(/\n/g, ' ').slice(0, 110)}\n`
38
- body += `theorem ${p.key} : ${t.lean} := by decide\n\n`
39
- }
40
- body += `end Mechanical\n`
41
- writeFileSync(OUT, body)
42
-
43
- // QUARANTINE — a translator bug must never redden the build. Translation is a whitelist, not a proof that
44
- // the output type-checks: a method chain rendered without brackets parsed as something else entirely and
45
- // took the whole file down with an error that pointed nowhere near the cause. So the file is compiled here,
46
- // and any theorem the kernel will not accept is REMOVED and reported as a refusal carrying the kernel's own
47
- // words. A claim that cannot be rendered is not a failure of the build; it is the work list. What must never
48
- // happen is the two being confused, because then a bad rendering looks like a broken deposit.
49
- const compiles = (): string | null => {
50
- try { execSync('cd src/proof && LEAN_PATH=. lean mechanical.lean', { encoding: 'utf8', stdio: 'pipe' }); return null }
51
- catch (e) { return String((e as { stdout?: string; stderr?: string }).stdout ?? '') + String((e as { stderr?: string }).stderr ?? '') }
52
- }
53
- const quarantined: string[] = []
54
- for (let pass = 0; pass < 12; pass++) {
55
- const err = compiles()
56
- if (!err) break
57
- // A MISSING MODULE IS NOT A BAD THEOREM. `import Address` failing on line 1 yields no theorem position, so
58
- // the attribution below finds nothing and the bisection starts deleting — removing innocent theorems and
59
- // reporting them as kernel-rejected. The failure is environmental (the .olean is not built yet); say so
60
- // and stop, rather than mutilating the file to make a build error go away.
61
- if (/unknown module prefix|no such file or directory.*olean|No directory .* or file .*\.olean/i.test(err)) {
62
- console.error('✗ emit: a module this file imports is not built — run `node scripts/lean.ts` first so the .oleans exist.')
63
- console.error(' ' + err.split('\n').filter(Boolean).slice(0, 2).join('\n '))
64
- console.error(' Nothing was quarantined: this is not a theorem failing, it is the import path.')
65
- process.exit(1)
66
- }
67
- const lines = [...err.matchAll(/mechanical\.lean:(\d+):/g)].map((m) => Number(m[1]))
68
- const src = readFileSync(OUT, 'utf8').split('\n')
69
- const bad = new Set<string>()
70
- // when the kernel reported positions we can name the offenders directly; otherwise bisect below
71
- for (const ln of lines) {
72
- for (let i = Math.min(ln, src.length) - 1; i >= 0; i--) {
73
- const m = src[i].match(/^theorem ([A-Za-z_0-9]+) :/)
74
- if (m) { bad.add(m[1]); break }
75
- }
76
- }
77
- // NO LINE NUMBER, NO CULPRIT — bisect. A stack overflow aborts the kernel before it can say WHERE, so the
78
- // error carries no position at all and the loop above has nothing to remove. Halving the file finds the
79
- // offender in a handful of compiles instead of one per theorem, and it is the only method that works when
80
- // the failure is the compiler dying rather than reporting.
81
- if (!lines.length || !bad.size) {
82
- const all = readFileSync(OUT, 'utf8')
83
- const head = all.slice(0, all.indexOf('theorem '))
84
- const blocks = all.slice(all.indexOf('theorem ')).split(/\n\n(?=(?:-- [^\n]*\n)?theorem )/)
85
- const tail = blocks.length ? '' : ''
86
- let lo = 0, hi = blocks.length
87
- const tryRange = (a: number, b: number) => {
88
- writeFileSync(OUT, head + blocks.slice(a, b).join('\n\n') + '\n' + tail)
89
- return compiles() === null
90
- }
91
- while (hi - lo > 1) {
92
- const mid = Math.floor((lo + hi) / 2)
93
- if (!tryRange(lo, mid)) { hi = mid } else { lo = mid }
94
- }
95
- const culprit = blocks[lo]?.match(/^(?:-- [^\n]*\n)?theorem ([A-Za-z_0-9]+)/)?.[1]
96
- blocks.splice(lo, 1)
97
- writeFileSync(OUT, head + blocks.join('\n\n') + '\n' + tail)
98
- if (culprit) quarantined.push(culprit + ' (kernel aborted — no position reported; found by bisection)')
99
- continue
100
- }
101
- let out = readFileSync(OUT, 'utf8')
102
- for (const name of bad) {
103
- out = out.replace(new RegExp('(?:^-- [^\\n]*\\n)?^theorem ' + name + ' :[\\s\\S]*?:= by decide\\n\\n', 'm'), '')
104
- quarantined.push(name)
105
- }
106
- writeFileSync(OUT, out)
107
- }
108
- if (quarantined.length) console.log(' quarantined ' + quarantined.length + ' theorem(s) the kernel would not accept: ' + quarantined.slice(0, 6).join(', ') + (quarantined.length > 6 ? ' …' : ''))
109
- return { written: rendered.length, skipped: q.length - rendered.length, file: OUT }
110
- }
111
-
112
- if (process.argv[1]?.includes('emit')) {
113
- const r = emit()
114
- console.log(`✓ ${r.file} — ${r.written} claims rendered, ${r.skipped} left in the queue with a reason`)
115
- }
@@ -1,143 +0,0 @@
1
- #!/usr/bin/env node
2
- // THE PROVER — the deposit proving itself, without an author in the loop.
3
- //
4
- // Everything here was manual work: read the queue, pick a claim, write the Lean, compile it, audit the
5
- // axioms, seal it, check the chain. Each step was a place the process stopped and waited for a person. A step
6
- // that waits for a person is not part of the deposit; it is a habit of whoever was running it.
7
- //
8
- // What is AI-independent and what is not, stated plainly rather than blurred:
9
- //
10
- // INDEPENDENT — the queue (which entries are portable, derived from their own test bodies), translation of
11
- // MECHANICAL claim shapes to Lean, compilation, the axiom audit, agreement against the ledger's own test,
12
- // sealing with a chained receipt, and the refusal to seal anything that fails any of those.
13
- //
14
- // NOT INDEPENDENT — deciding what a NEW proposition should say when the claim has no mechanical shape.
15
- // Cassini needed splitting into two theorems because naturals cannot carry an alternating sign; nothing
16
- // here would have discovered that. Such claims are reported as needing an author, never faked.
17
- //
18
- // The honesty of this file rests on that second list being reported, not hidden. A prover that silently skips
19
- // what it cannot do looks complete and is not.
20
- import { readFileSync, writeFileSync, existsSync } from 'node:fs'
21
- import { ledger as loadLedger } from '../api/index.ts'
22
- import { execSync } from 'node:child_process'
23
- import { translate } from './translate.ts'
24
-
25
- const LEDGER = 'src/proof/discovered.json'
26
- const DISCOVER = 'scripts/discover.ts'
27
-
28
- export type Portable = { key: string; name: string; body: string; shape: Shape }
29
- export type Shape = 'modular-identity' | 'range-predicate' | 'exact-set' | 'unknown'
30
-
31
- /** Read each candidate entry's TEST BODY — the claim's own computation, not its prose.
32
- *
33
- * THE QUEUE IS NOT A FLAG. It used to be `led.filter(e => e.portable)`, and that flag was written once and
34
- * never recomputed: 176 entries carried it while 1688 withdrawn claims with perfectly runnable tests were
35
- * never asked. A stale marker had become the thing deciding what could be proved, so a claim was outside the
36
- * prover's reach for no reason anyone had checked — the same fault as revoking before folding, one level up.
37
- *
38
- * Every entry with a test body is queued now, and the translator's refusal list does the filtering WITH A
39
- * REASON. That is the only honest place for the decision: a refusal that names what it cannot read is a work
40
- * list, where a missing flag is silence. Entries already superseded by a Lean theorem are skipped because
41
- * they are done, not because they were filtered.
42
- */
43
- export function queue(): Portable[] {
44
- const led = loadLedger()
45
- const src = readFileSync(DISCOVER, 'utf8')
46
- const bodies = new Map([...src.matchAll(/out\.push\(\{ key: '([a-z_0-9]+)'[\s\S]*?test: \(\) => ([\s\S]*?)\}\)\n/g)]
47
- .map((m) => [m[1], m[2]] as [string, string]))
48
- // A SUPERSEDED CLAIM STAYS IN THE QUEUE, and skipping it was circular. `supersededBy` means "a Lean
49
- // theorem now carries this" — and for the mechanically rendered ones, that theorem IS the one emit writes
50
- // into mechanical.lean. Filtering them out stopped emit rendering them, mechanical.lean shrank from 75
51
- // theorems to 2, and 75 sealed keys instantly had no source: the successors were orphaned by the very
52
- // link that recorded their success. Being done is not a reason to stop regenerating the artefact that
53
- // makes it true.
54
- return led
55
- .filter((e) => bodies.has(e.key))
56
- .map((e) => {
57
- const body = bodies.get(e.key) ?? ''
58
- return { key: e.key, name: e.name, body, shape: classify(body) }
59
- })
60
- }
61
-
62
- /** The shape of a claim decides whether it can be translated without judgement. */
63
- export function classify(body: string): Shape {
64
- const b = body.replace(/\s+/g, ' ')
65
- if (/^[^=]*%\s*\d+\s*===\s*\d+\s*$/.test(b)) return 'modular-identity'
66
- if (/Array\.from\(\{ ?length: ?\d+ ?\}[\s\S]*\.every\(/.test(b)) return 'range-predicate'
67
- if (/JSON\.stringify\([^)]*\) === JSON\.stringify\(\[/.test(b)) return 'exact-set'
68
- return 'unknown'
69
- }
70
-
71
- /** Run the whole loop: queue → translate what is mechanical → verify → seal. Reports what it could not do. */
72
- export function run(opts: { emit?: boolean } = {}): string {
73
- const q = queue()
74
-
75
- // Ask the TRANSLATOR, not the shape classifier. The classifier was a guess at what might be renderable and
76
- // reported 173 needing an author when the translator renders 22 of them; a report that is confidently wrong
77
- // is worse than no report, because it sets the work queue.
78
- const attempted = q.map((p) => ({ p, t: translate(p.body) }))
79
- const mechanical = attempted.filter((x) => x.t.ok).map((x) => x.p)
80
- const needsAuthor = attempted.filter((x) => !x.t.ok).map((x) => x.p)
81
- const reasons = attempted.filter((x) => !x.t.ok).reduce<Record<string, number>>((a, x) =>
82
- ({ ...a, [(x.t as { why: string }).why.slice(0, 46)]: (a[(x.t as { why: string }).why.slice(0, 46)] ?? 0) + 1 }), {})
83
-
84
- const lines: string[] = []
85
- lines.push(`queue: ${q.length} portable entries`)
86
- lines.push(` mechanically translatable : ${mechanical.length}`)
87
- lines.push(` needs an author : ${needsAuthor.length} ← reported, never faked`)
88
- lines.push('')
89
- lines.push('why the rest are refused (by whitelist, never best-effort):')
90
- for (const [why, n] of Object.entries(reasons).sort((a, b) => b[1] - a[1]).slice(0, 6)) lines.push(` ${String(n).padStart(4)} ${why}`)
91
-
92
- if (opts.emit && mechanical.length) {
93
- // translation is left to lean-gen, which owns emission and its five gates; this loop only drives it
94
- try { lines.push('', execSync('node scripts/lean-gen.ts --emit', { encoding: 'utf8' }).trim()) }
95
- catch (e) { lines.push('', 'lean-gen FAILED: ' + String((e as { stdout?: Buffer }).stdout ?? e).slice(0, 300)) }
96
- try { lines.push(execSync('node scripts/lean.ts', { encoding: 'utf8' }).trim().split('\n').slice(-1)[0]) }
97
- catch { lines.push('lean verification FAILED — nothing sealed') ; return lines.join('\n') }
98
- try { lines.push(execSync('node scripts/seal-lean.ts --seal', { encoding: 'utf8' }).trim().split('\n').slice(-2).join('\n')) }
99
- catch (e) { lines.push('seal FAILED: ' + String((e as { stdout?: Buffer }).stdout ?? e).slice(0, 200)) }
100
- }
101
- // SHAPE REFUSALS, BUCKETED. "not a chain of simple bindings" was reported as one number, and a single
102
- // number is not a work list — it hides whether the blocker is one tractable pattern or a hundred different
103
- // programs. Twice I read that number as a shape problem and was wrong both times: the early-return
104
- // validation loop was hiding in it and needed no judgement at all. Bucketing is what surfaced it, so the
105
- // buckets stay, and each names an example so the next reader can check rather than trust the label.
106
- const shapes: Record<string, { n: number; eg: string }> = {}
107
- for (const p of q) {
108
- const t = translate(p.body)
109
- const why = 'why' in t ? t.why : null
110
- if (!why || !why.includes('simple bindings')) continue
111
- const b = p.body.replace(/\s+/g, ' ').replace(/^\{\s*|\s*\}$/g, '')
112
- const k =
113
- /\w+\s*\[\s*\w+\s*\]\s*=/.test(b) ? 'builds a table by index assignment (a recurrence — needs the recurrence named)'
114
- : /\bnew Map\b|\bmemo\b/.test(b) ? 'memoised closure (state across calls)'
115
- : /const\s*\[/.test(b) ? 'array destructuring'
116
- : /=>\s*\{/.test(b) ? 'binds a function with a statement body'
117
- : /\bfor\s*\(\s*const\b/.test(b) ? 'for-of over a computed list'
118
- : /\bwhile\b|\bdo\s*\{/.test(b) ? 'unbounded while/do'
119
- : 'other'
120
- shapes[k] = shapes[k] ?? { n: 0, eg: b.slice(0, 96) }
121
- shapes[k].n++
122
- }
123
- const shapeTotal = Object.values(shapes).reduce((a, x) => a + x.n, 0)
124
- if (shapeTotal) {
125
- lines.push('')
126
- lines.push(`the ${shapeTotal} refused on SHAPE, by what the body actually is:`)
127
- for (const [k, v] of Object.entries(shapes).sort((a, b) => b[1].n - a[1].n))
128
- lines.push(` ${String(v.n).padStart(4)} ${k}\n e.g. ${v.eg}`)
129
- }
130
-
131
- return lines.join('\n')
132
- }
133
-
134
- /** report() — the deposit's convention: every module states its own measured condition. */
135
- export function report(): string {
136
- const q = queue()
137
- const ok = q.filter((p) => translate(p.body).ok).length
138
- return `prover: ${q.length} portable · ${ok} mechanical · ${q.length - ok} need an author · integrity, not truth`
139
- }
140
-
141
- if (process.argv[1]?.endsWith('index.ts') && process.argv[1].includes('prove')) {
142
- console.log(run({ emit: process.argv.includes('--emit') }))
143
- }