@ceccec/millennium-solutions 9.3.2 → 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.
- package/README.md +54 -40
- package/dist/mod.core.d.ts +9 -0
- package/dist/mod.core.js +9 -0
- package/dist/src/0/index.d.ts +47 -0
- package/dist/src/0/index.js +189 -0
- package/dist/src/0/ledger.d.ts +1 -0
- package/dist/src/0/ledger.js +25 -0
- package/dist/src/0/trinity-matrix.d.ts +1 -0
- package/dist/src/0/trinity-matrix.js +16 -0
- package/dist/src/5/aspects.d.ts +1 -0
- package/dist/src/5/aspects.js +22 -0
- package/dist/src/5/reflection.d.ts +1 -0
- package/dist/src/5/reflection.js +25 -0
- package/dist/src/7/rosetta.d.ts +1 -0
- package/dist/src/7/rosetta.js +24 -0
- package/dist/src/9/enumeration.d.ts +1 -0
- package/dist/src/9/enumeration.js +14 -0
- package/dist/src/honesty/index.d.ts +16 -0
- package/dist/src/honesty/index.js +69 -0
- package/package.json +27 -10
- package/.zenodo.json +0 -51
- package/ABSTRACT.md +0 -155
- package/ACCOUNTING.md +0 -27
- package/AXIOMS.md +0 -574
- package/CHALLENGES.md +0 -2434
- package/DEPLOY.md +0 -39
- package/DEVELOP.md +0 -34
- package/HEART.md +0 -112
- package/PHYSICS-SCALES.md +0 -80
- package/PRIOR-ART.md +0 -151
- package/PROOF-OF-CONCEPT.md +0 -81
- package/REALISATIONS.md +0 -87
- package/RESEARCH.md +0 -188
- package/RULES.md +0 -57
- package/SEQUENCE-DECODE.md +0 -196
- package/SIGNATURE.md +0 -34
- package/THEOREMS.md +0 -97
- package/WHITEPAPER.md +0 -40
- package/WORKFLOWS.md +0 -47
- package/boundaries.md +0 -23
- package/captain.md +0 -85
- package/compare.md +0 -42
- package/compute.md +0 -543
- package/cryptography.md +0 -55
- package/dashboard.md +0 -50
- package/examples.md +0 -47
- package/folds.md +0 -65
- package/forensic.md +0 -67
- package/guide.md +0 -126
- package/harness.md +0 -20
- package/index.md +0 -217
- package/mod.core.ts +0 -10
- package/nature.md +0 -58
- package/organism.md +0 -30
- package/paper.md +0 -8100
- package/proofs.md +0 -26
- package/quantum.md +0 -40
- package/rights.md +0 -39
- package/solutions.md +0 -28
- package/speedup.md +0 -41
- package/src/0/chacha.ts +0 -3
- package/src/0/crypt.ts +0 -4
- package/src/0/csp.ts +0 -10
- package/src/0/entanglement.ts +0 -31
- package/src/0/fusion.ts +0 -28
- package/src/0/holographic.ts +0 -57
- package/src/0/impossible.ts +0 -30
- package/src/0/imprint.ts +0 -160
- package/src/0/index.ts +0 -263
- package/src/0/ledger.ts +0 -25
- package/src/0/legible.ts +0 -29
- package/src/0/limit.ts +0 -29
- package/src/0/merkle-proof.ts +0 -3
- package/src/0/null-token.ts +0 -24
- package/src/0/sha256.ts +0 -3
- package/src/0/singularity.ts +0 -20
- package/src/0/stream.ts +0 -47
- package/src/0/trinities.ts +0 -37
- package/src/0/trinity-matrix.ts +0 -20
- package/src/0/version-matrix.ts +0 -70
- package/src/1/acceptance.ts +0 -26
- package/src/1/index.ts +0 -80
- package/src/1/paradox.ts +0 -28
- package/src/1/vortex.lean +0 -6
- package/src/2/frequency-scales.ts +0 -28
- package/src/2/iching.ts +0 -34
- package/src/2/index.ts +0 -78
- package/src/2/primes-vortex.ts +0 -12
- package/src/2/quantum.ts +0 -48
- package/src/2/string-scale.ts +0 -14
- package/src/2/vortex.lean +0 -10
- package/src/3/index.ts +0 -63
- package/src/3/pi-bbp.ts +0 -13
- package/src/3/trinity.ts +0 -39
- package/src/3/vortex.lean +0 -7
- package/src/4/git.ts +0 -30
- package/src/4/index.ts +0 -63
- package/src/4/vortex.lean +0 -6
- package/src/5/aspects.ts +0 -27
- package/src/5/center.ts +0 -35
- package/src/5/development.ts +0 -45
- package/src/5/diamond.ts +0 -35
- package/src/5/folds.ts +0 -12
- package/src/5/index.ts +0 -63
- package/src/5/reflection.lean +0 -14
- package/src/5/reflection.ts +0 -14
- package/src/5/vortex.lean +0 -10
- package/src/6/dna.ts +0 -27
- package/src/6/index.ts +0 -63
- package/src/6/vortex.lean +0 -7
- package/src/7/cross.ts +0 -31
- package/src/7/glagolitic.ts +0 -51
- package/src/7/index.ts +0 -67
- package/src/7/language-lens.ts +0 -41
- package/src/7/lens.ts +0 -41
- package/src/7/locale.ts +0 -105
- package/src/7/rbac.ts +0 -31
- package/src/7/rosetta-clay.ts +0 -15
- package/src/7/rosetta.lean +0 -11
- package/src/7/rosetta.ts +0 -11
- package/src/7/string-dimensions.ts +0 -14
- package/src/7/vortex.lean +0 -6
- package/src/8/infinite.ts +0 -26
- package/src/8/merkaba/field.ts +0 -27
- package/src/8/merkaba/geometry.ts +0 -16
- package/src/8/merkaba/touch.ts +0 -26
- package/src/8/nucleus/magic.lean +0 -15
- package/src/8/nucleus/proton-mass-fit.ts +0 -9
- package/src/8/nucleus/proton-mass.lean +0 -10
- package/src/8/nucleus/shell-model-magic.ts +0 -10
- package/src/8/vortex.lean +0 -7
- package/src/9/access.ts +0 -34
- package/src/9/aura-funding.ts +0 -25
- package/src/9/coins.ts +0 -25
- package/src/9/enumeration.ts +0 -13
- package/src/9/funding.ts +0 -85
- package/src/9/security.ts +0 -36
- package/src/9/society.ts +0 -32
- package/src/9/vortex.lean +0 -11
- package/src/api/gates.ts +0 -122
- package/src/api/index.ts +0 -447
- package/src/api/lanes.ts +0 -81
- package/src/claims/index.ts +0 -81
- package/src/demand/queries.json +0 -1764
- package/src/face/index.ts +0 -100
- package/src/from/the/heart/index.ts +0 -11
- package/src/honesty/boundaries.ts +0 -29
- package/src/honesty/index.ts +0 -63
- package/src/html/index.ts +0 -10
- package/src/latex/index.ts +0 -474
- package/src/millennium/index.ts +0 -53
- package/src/play/the/game/index.ts +0 -12
- package/src/proof/README.md +0 -118
- package/src/proof/address.lean +0 -147
- package/src/proof/coin.lean +0 -152
- package/src/proof/covered.json +0 -9
- package/src/proof/demand.lean +0 -134
- package/src/proof/demand2.lean +0 -207
- package/src/proof/demand3.lean +0 -183
- package/src/proof/discovered.json +0 -19125
- package/src/proof/elementary.lean +0 -446
- package/src/proof/energy.lean +0 -291
- package/src/proof/families.lean +0 -648
- package/src/proof/fixtures/axiom-control.lean +0 -39
- package/src/proof/flow.lean +0 -54
- package/src/proof/fnv.lean +0 -116
- package/src/proof/generated-theorems.json +0 -207
- package/src/proof/generated.lean +0 -101
- package/src/proof/imagined.lean +0 -492
- package/src/proof/index.lean +0 -156
- package/src/proof/index.ts +0 -916
- package/src/proof/involution.lean +0 -90
- package/src/proof/ledgerclaims.lean +0 -84
- package/src/proof/light.lean +0 -158
- package/src/proof/mechanical.lean +0 -524
- package/src/proof/merkaba.lean +0 -89
- package/src/proof/merkle.lean +0 -132
- package/src/proof/nim.lean +0 -311
- package/src/proof/novelty.json +0 -751
- package/src/proof/phenomena.lean +0 -90
- package/src/proof/priorart.lean +0 -190
- package/src/proof/quantum.lean +0 -159
- package/src/proof/reach.lean +0 -105
- package/src/proof/recovered.lean +0 -56
- package/src/proof/reversal.lean +0 -148
- package/src/proof/revoked.json +0 -317
- package/src/proof/rights.lean +0 -155
- package/src/proof/sequences.lean +0 -219
- package/src/proof/speed.lean +0 -152
- package/src/proof/split.lean +0 -199
- package/src/proof/theorems.lean +0 -67
- package/src/proof/trial-all.json +0 -16046
- package/src/proof/z9.lean +0 -99
- package/src/proof/z9plus.lean +0 -300
- package/src/proofs.lisp +0 -170
- package/src/prove/emit.ts +0 -115
- package/src/prove/index.ts +0 -143
- package/src/prove/translate.ts +0 -638
- package/src/publication/index.ts +0 -362
- package/src/quantum/field.ts +0 -73
- package/src/quantum/tree.ts +0 -79
- package/src/receipts/1431b4c4-7950-8d7b-88d1-b633219692f8.json +0 -7
- package/src/receipts/171e09c0-4cfd-8ce0-a6ed-cd33d5553da3.json +0 -7
- package/src/receipts/1a1f16c9-3491-8050-b221-e2a362439be4.json +0 -12
- package/src/receipts/1da15f83-83a6-8d04-b1ac-334c2dd6abb3.json +0 -7
- package/src/receipts/375a57ed-ef99-855e-8f34-b77d08010f3c.json +0 -6
- package/src/receipts/3dcbbf9e-0e49-8ba7-921e-17e478dbafaf.json +0 -6
- package/src/receipts/43a24136-5ad9-81ef-97c9-17be1c05bb5f.json +0 -11
- package/src/receipts/4991be51-74ba-8f66-9534-e6dba52fb569.json +0 -10
- package/src/receipts/52375d8f-232b-8c01-9d82-a824ffa7b2b7.json +0 -6
- package/src/receipts/593b546a-36b4-8553-941a-0e03b7053a64.json +0 -7
- package/src/receipts/7f75c989-96c9-8a24-8d0d-7e690861ccb4.json +0 -6
- package/src/receipts/80f80b59-81d8-866d-9a14-f469729d3dc8.json +0 -6
- package/src/receipts/85ac8585-9dc1-8964-9848-ae0f49cc82fb.json +0 -7
- package/src/receipts/85db092e-f2c0-88e5-bf75-61c4a65d84e7.json +0 -7
- package/src/receipts/95bacad3-9e56-8741-b0f8-def2c6ecb050.json +0 -7
- package/src/receipts/a1d33966-7bbd-84ca-902b-49e315af60e0.json +0 -6
- package/src/receipts/b20ced61-24ad-8123-adee-56031ab734dd.json +0 -11
- package/src/receipts/ba0447cd-f489-841a-a70f-a39b18ec2946.json +0 -11
- package/src/receipts/bcddbe66-06cf-8f31-a261-98b836938947.json +0 -7
- package/src/receipts/c1bac0d8-d906-8196-a4f0-3d8270b2e944.json +0 -6
- package/src/receipts/ce851ea3-3cf8-8646-a5d6-c0c6281210fe.json +0 -10
- package/src/receipts/cf43a122-c880-8d86-9e25-6f22f92d6b0a.json +0 -7
- package/src/receipts/daad8cd4-d4db-8dca-9c97-9a838cbce528.json +0 -7
- package/src/receipts/dc8bdb82-599f-8020-9eb2-cb016b408ec1.json +0 -6
- package/src/receipts/df77c265-d1a8-8354-8a9e-769fa5c676e2.json +0 -6
- package/src/receipts/e96686da-a411-8838-a5c8-ee7472bce048.json +0 -10
- package/src/receipts/f073c46f-7b67-83d0-aca5-db11fac4b5ec.json +0 -7
- package/src/receipts/f946d99d-a1c2-89f7-9426-a367c5b04191.json +0 -6
- package/src/receipts/fc069e45-115d-8983-ad25-fb9f735da84b.json +0 -6
- package/src/the/abstract/index.ts +0 -21
- package/src/the/abundance/index.ts +0 -20
- package/src/the/apple/earth/index.ts +0 -23
- package/src/the/apple/earth/navigation/index.ts +0 -28
- package/src/the/apple/earth/truth/index.ts +0 -19
- package/src/the/apple/index.ts +0 -27
- package/src/the/cancer/index.ts +0 -26
- package/src/the/clown/index.ts +0 -25
- package/src/the/creation/index.ts +0 -16
- package/src/the/crystal/index.ts +0 -23
- package/src/the/domain/index.ts +0 -16
- package/src/the/game/index.ts +0 -11
- package/src/the/gold/compass/index.ts +0 -26
- package/src/the/gold/index.ts +0 -35
- package/src/the/heart/index.ts +0 -15
- package/src/the/index.ts +0 -23
- package/src/the/law/index.ts +0 -20
- package/src/the/path/index.ts +0 -19
- package/src/the/rosetta/index.ts +0 -33
- package/src/the/sequence/index.ts +0 -12
- package/src/the/solids/index.ts +0 -25
- package/src/the/state/index.ts +0 -20
- package/src/the/superposition/state/index.ts +0 -22
- package/src/the/surface/index.ts +0 -26
- package/src/the/theorem/index.ts +0 -14
- package/src/the/torus/index.ts +0 -23
- package/src/the/waves/index.ts +0 -23
- package/the.md +0 -20
- 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
|
-
}
|
package/src/prove/index.ts
DELETED
|
@@ -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
|
-
}
|