verification: pin the whole declaration surface (P1-b)
Phase 2b asks the kernel whether any AXIOM is declared under Proofs/. Phase 3
pins the cones of the named certificates. Between them sat every other
declaration in the corpus — around three thousand of them — and a helper lemma
quietly acquiring a hash oracle in its cone moved nothing either phase looked
at.
Phase 2c closes that. Ported from ltl-accumulator-verified, where a nine-attack
self-test proved a source-regex enumerator evadable by attributed, private,
indented and `instance` declarations and by a nested-namespace basename
collision. Reading the compiled environment sees what the kernel saw; no name
shape hides. Every constant contributes module, name, kind and full axiom cone,
and the observed set must equal inventory-allowlist.txt exactly in BOTH
directions, with a count trailer so a truncated run cannot pass as an empty
diff.
FOUR THINGS THIS BUILD GOT WRONG, each caught by a check rather than by review:
- The number of inventory drivers is a per-repo FACT, not an assumption.
dalek and anza cannot import their corpus as one environment (Proofs.Basic
and Proofs.ConstSpecs both declare CurveFieldProofs.zero_spec); risc0 and
betrusted have no Proofs.Basic at all. Determined by compiling a probe.
check.sh now DISCOVERS its drivers from the filesystem instead of naming
two, and the generator refuses to split out a module the repo lacks.
- The split let one real declaration hide behind another's entry. Keyed on
name alone, the two zero_specs produced byte-identical records, so 3022
declarations were covered by 3021 allowlist entries. Caught by the count
trailer. Every record now carries its originating module.
- The gate's success line said "single sanctioned axiom", inherited from the
accumulator's policy. This corpus permits NONE. A success message
describing a different rule is how an assertion stops meaning anything.
- selftest-axgate.sh lifted Phase 2b with a range ending at "Phase 3", so
inserting Phase 2c between them made it swallow the new phase and die on
variables only check.sh defines — surfacing as the BASELINE case failing,
a self-test blaming a gate for its own extraction bug. Both self-tests now
stop at the next phase marker whatever it is called, and refuse to run if
they capture more than one phase. The guard is the fix; the range was the
symptom.
WHAT THIS IS NOT, recorded in TRUSTED-BASE.md at the same length as the claim:
- No independent cone walker. The accumulator cross-checks collectAxioms
against a hand-written walker. Ported here it was wrong in BOTH directions
on mathlib's inductive shapes: EdPoint gave [] against the kernel's three
axioms, and once extended, ProjPoint gave three against the kernel's none.
Two implementations disagreeing both ways are a second wrong answer, not a
check. These cones rest on collectAxioms alone.
- Thirteen Proofs/Scalar* modules are inventoried by nothing — the
second-button seam, still open. Phase 2c names every uncovered module on
every run so the omission is visible rather than inferred.
selftest-inventory.sh exercises the shipping gate with six cases, each
asserting a specific diagnostic, including the one that matters: a cone
widened by one oracle while name, module and kind stay put. Negative-tested by
disabling the gate's diff, which turns two cases red including one for the
wrong reason, correctly reported as such.
Verified green: 20 runs across the four repositories (four buttons, four
harness, four inventory, four axgate, four binding self-tests), zero red. The
four check-scalar.sh greens from the preceding sweep stand: that script neither
reads the pin file nor changed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-29 23:20:19 +00:00
|
|
|
|
/- ──────────────────────────────────────────────────────────────────────────
|
|
|
|
|
|
Proofs/InventoryCore.lean — shared machinery for the declaration inventory.
|
|
|
|
|
|
|
|
|
|
|
|
PORTED, NOT REINVENTED. This is the ltl-accumulator-verified design
|
|
|
|
|
|
(Proofs/Inventory.lean there), which survived a nine-attack self-test that
|
|
|
|
|
|
defeated a source-regex enumerator: attributed, private, indented and
|
|
|
|
|
|
`instance` declarations were all invisible to the regex, and a nested
|
|
|
|
|
|
`namespace Hidden theorem MTH` collided with the basename of an audited
|
|
|
|
|
|
declaration. Reading the compiled ENVIRONMENT sees exactly what the kernel
|
|
|
|
|
|
saw, and there is no name shape that can hide from it.
|
|
|
|
|
|
|
|
|
|
|
|
WHY TWO DRIVERS IMPORT THIS. Unlike the accumulator, this corpus cannot be
|
|
|
|
|
|
imported as one environment: `Proofs.Basic` and `Proofs.ConstSpecs` both
|
|
|
|
|
|
declare `CurveFieldProofs.zero_spec`. That is deliberate and documented —
|
|
|
|
|
|
Basic.lean is compiled by check.sh but imported by nothing, so the reuse is
|
|
|
|
|
|
harmless — but it makes a single whole-corpus import impossible. The corpus
|
|
|
|
|
|
therefore splits into the main chain and Basic, one driver each, and
|
|
|
|
|
|
check.sh concatenates their output before gating. The split is asserted in
|
|
|
|
|
|
check.sh against the compile manifest, so a module cannot fall between the
|
|
|
|
|
|
two drivers unnoticed.
|
|
|
|
|
|
|
|
|
|
|
|
The corpus module list lives in each DRIVER, not here, and is checked
|
|
|
|
|
|
textually against check.sh's manifest in both directions. A listed module
|
|
|
|
|
|
that is not actually imported is an elaboration error, not a silent skip.
|
|
|
|
|
|
────────────────────────────────────────────────────────────────────────── -/
|
|
|
|
|
|
import Lean
|
|
|
|
|
|
|
|
|
|
|
|
open Lean
|
|
|
|
|
|
|
|
|
|
|
|
namespace Ed25519Inventory
|
|
|
|
|
|
|
|
|
|
|
|
def kindOf : ConstantInfo → String
|
|
|
|
|
|
| .axiomInfo _ => "axiom"
|
|
|
|
|
|
| .defnInfo _ => "def"
|
|
|
|
|
|
| .thmInfo _ => "theorem"
|
|
|
|
|
|
| .opaqueInfo _ => "opaque"
|
|
|
|
|
|
| .quotInfo _ => "quot"
|
|
|
|
|
|
| .inductInfo _ => "inductive"
|
|
|
|
|
|
| .ctorInfo _ => "ctor"
|
|
|
|
|
|
| .recInfo _ => "recursor"
|
|
|
|
|
|
|
|
|
|
|
|
/-- Axiom cone of `n`, from the kernel's own collector — the same machinery
|
|
|
|
|
|
`#print axioms` uses.
|
|
|
|
|
|
|
|
|
|
|
|
NO INDEPENDENT SECOND WALKER HERE, and that is a deliberate REDUCTION in
|
|
|
|
|
|
strength against the ltl-accumulator design this is ported from. There, a
|
|
|
|
|
|
hand-written closure walker runs alongside `collectAxioms` and every
|
|
|
|
|
|
constant must get the same answer from both, so the two implementations
|
|
|
|
|
|
check each other. Porting that walker to this corpus was tried on
|
|
|
|
|
|
2026-07-29 and abandoned on evidence:
|
|
|
|
|
|
|
|
|
|
|
|
· without traversing inductive families it UNDER-approximated —
|
|
|
|
|
|
`CurveFieldProofs.EdPoint`: walker [] vs kernel [Classical.choice,
|
|
|
|
|
|
Quot.sound, propext];
|
|
|
|
|
|
· adding constructors, recursor rules and `all` groups made it
|
|
|
|
|
|
OVER-approximate — `CurveFieldProofs.ProjPoint`: walker
|
|
|
|
|
|
[Classical.choice, Quot.sound, propext] vs kernel [].
|
|
|
|
|
|
|
|
|
|
|
|
Disagreeing in BOTH directions means the second implementation is not an
|
|
|
|
|
|
independent check, it is a second wrong answer. Matching the kernel's
|
|
|
|
|
|
traversal exactly over mathlib's inductive shapes is a Lean-internals
|
|
|
|
|
|
project, not a gate, and shipping a walker that is wrong in two directions
|
|
|
|
|
|
would be worse than shipping none: it would fail builds for reasons that
|
|
|
|
|
|
are the checker's fault and teach everyone to ignore it.
|
|
|
|
|
|
|
|
|
|
|
|
CONSEQUENCE, stated so nobody assumes otherwise: on this corpus the cone
|
|
|
|
|
|
figures rest on `collectAxioms` alone. The accumulator's corpus is
|
|
|
|
|
|
mathlib-free, its walker agrees there, and it KEEPS the cross-check. This
|
|
|
|
|
|
is recorded in TRUSTED-BASE.md. -/
|
|
|
|
|
|
def axiomCone (n : Name) : MetaM (Array Name) := do
|
|
|
|
|
|
let cone ← collectAxioms n
|
|
|
|
|
|
return cone.qsort (fun a b => a.toString < b.toString)
|
|
|
|
|
|
|
|
|
|
|
|
/-- Emit `INV|name|kind|cone` for every constant originating in `corpus`.
|
|
|
|
|
|
EVERY constant is emitted — fully qualified, NO filtering. Compiler-
|
|
|
|
|
|
generated auxiliaries (equation lemmas, match/eq/induct helpers, private
|
|
|
|
|
|
manglings) are emitted too and pinned in the allowlist, so anything new,
|
|
|
|
|
|
renamed, removed, or with a changed cone shows up as a diff. -/
|
|
|
|
|
|
def emitInventory (corpus : Array Name) : MetaM Unit := do
|
|
|
|
|
|
let env ← getEnv
|
|
|
|
|
|
let mut idxs : Array Nat := #[]
|
|
|
|
|
|
for m in corpus do
|
|
|
|
|
|
match env.getModuleIdx? m with
|
|
|
|
|
|
| some i => idxs := idxs.push i
|
|
|
|
|
|
| none => throwError "INVENTORY ERROR: corpus module {m} is not imported"
|
|
|
|
|
|
let mut lines : Array String := #[]
|
|
|
|
|
|
for (n, ci) in env.constants.toList do
|
|
|
|
|
|
if let some i := env.getModuleIdxFor? n then
|
|
|
|
|
|
if idxs.contains i then
|
|
|
|
|
|
let cone ← axiomCone n
|
|
|
|
|
|
let coneStr := ",".intercalate (cone.toList.map (·.toString))
|
|
|
|
|
|
-- The ORIGINATING MODULE is part of the record, unlike the accumulator's
|
|
|
|
|
|
-- format. It has to be: this corpus contains two distinct declarations
|
|
|
|
|
|
-- both named `CurveFieldProofs.zero_spec` (Proofs.Basic and
|
|
|
|
|
|
-- Proofs.ConstSpecs), inventoried by different drivers. Keyed on name
|
|
|
|
|
|
-- alone their records were byte-identical, so the merged allowlist held
|
|
|
|
|
|
-- 3021 entries for 3022 declarations and one real declaration was
|
|
|
|
|
|
-- covered by an entry describing a different one. The count trailer
|
|
|
|
|
|
-- caught it; the module field is what fixes it.
|
|
|
|
|
|
let mdl := env.header.moduleNames[i]!
|
|
|
|
|
|
lines := lines.push s!"INV|{mdl}|{n}|{kindOf ci}|{coneStr}"
|
|
|
|
|
|
let sorted := lines.qsort (· < ·)
|
|
|
|
|
|
for l in sorted do
|
|
|
|
|
|
IO.println l
|
|
|
|
|
|
-- Output-integrity trailer: a truncated or crashed run must never pass as an
|
|
|
|
|
|
-- empty diff. inventory_gate.sh compares this against the lines it actually
|
|
|
|
|
|
-- received, in both directions.
|
|
|
|
|
|
IO.println s!"INV-COUNT|{sorted.size}"
|
|
|
|
|
|
|
Account for every constant the kernel sees, by set containment
THE GAP. The capability matrix in the control repo — built after the author
answered a capability question by grepping for a FILENAME rather than for the
property, three times in one session — asked whether each repository's auditor
enumerates itself. The four ed25519 forks answered no. Following that up found
something larger: `Proofs/Audit.lean`, the statement-binding driver from P1-a,
is compiled, is a member of the manifest, and was enumerated by NOTHING. The
kernel counted 3058 declarations where the inventory accounted for 3022, and
26 of the 36 missing were its.
THE PROPERTY, now enforced: every constant the kernel sees under this button's
manifest must appear, BY NAME, in either the corpus inventory or the
instruments' own surface. `emitDrivers` in InventoryCore walks the audit
modules and fails closed on an axiom (which would widen the trusted base
outside every cone) or on a standalone claim (which no certificate covers and
no allowlist pins), while admitting the obligations the elaborator generates
for a definition declared alongside it.
TWO WRONG FORMULATIONS FIRST, both recorded because the second is instructive:
· `kernel = corpus + instruments + N_DRIVERS`, where the last term was
justified as a per-driver "self-observation blind spot". It fitted dalek
and anza (2 drivers, residual 2) and broke on risc0 and betrusted
(1 driver, residual 2). The residual is 2 everywhere and has nothing to do
with drivers. This was curve-fitting from a sample of one, and it was named
as the highest-risk claim in the round-7 self-assessment BEFORE the data
refuted it.
· distinct-by-name counting, which collapses `CurveFieldProofs.zero_spec` —
a name that genuinely denotes two different declarations, in Proofs.Basic
and Proofs.ConstSpecs, walked by two drivers with separate environments.
THE MEASURED CAUSE of the residual. Lean materialises equation lemmas lazily,
when something forces an unfold, and each module that forces one gets its own
copy in its object file. `CurveFieldProofs.denote.eq_1` sits in both
SubNegSpec.olean and ConstSpecs.olean; `CurveFieldProofs.limbsVal.eq_1` in both
ReduceSpec.olean and ConstSpecs.olean. The kernel gate reads object files and
counts both copies; the environment holds one constant per name. Counts cannot
relate those two views in either direction — so the check compares SETS, which
is the idiom the rest of this estate already uses, and no constant remains that
could be widened to make a red run green.
Negative-tested: with the instrument walk disabled, the check names
Proofs.Audit's declarations as unaccounted.
ANZA also lacked one allowlist row, `subtle.Choice...from.eq_1`, the same
lazy-materialisation effect seen from the other side. Verified rather than
assumed before adding it: the parent is declared in gen/CurveField/
FunsExternal.lean — the model, pinned by bytes and not inventoried by
declaration — the lemma materialised in Proofs.CompressSpec which forced the
unfold, and all three other forks carry the lemma row while none carries the
parent.
CONSEQUENCE WORTH DISCLOSING: the audited declaration surface is not purely a
function of the corpus source. It depends on which proofs forced which
unfolds. This is now a known gap in the round-7 kit.
Also corrected here: Proofs/Inventory.lean's header claimed the audit drivers
were excluded from the compile manifest. They are lines 42-44 of PROOFS.
Certified by a full sweep: both buttons, all four forks, purged trees. 8/8.
2026-08-01 14:10:59 +00:00
|
|
|
|
/-- THE INSTRUMENTS' OWN SURFACE.
|
|
|
|
|
|
|
|
|
|
|
|
`emitInventory` walks the CORPUS. It says nothing about the modules that
|
|
|
|
|
|
perform the audit, and until 2026-07-31 nothing else enumerated them either:
|
|
|
|
|
|
the kernel counted 3058 declarations across this button's 43 modules while
|
|
|
|
|
|
the inventory accounted for 3022, and the 36-declaration difference — the
|
|
|
|
|
|
drivers' own machinery — was covered by no allowlist row.
|
|
|
|
|
|
|
|
|
|
|
|
That difference was never a soundness hole. The drivers ARE members of
|
|
|
|
|
|
check.sh's compile manifest, so Phase 2b's kernel-side gate reads their
|
|
|
|
|
|
`.olean`s and an axiom in one is rejected whatever its indentation. What was
|
|
|
|
|
|
missing is the weaker but still real property: that an instrument declares
|
|
|
|
|
|
nothing but inert machinery, and that every declaration the kernel sees is
|
|
|
|
|
|
ACCOUNTED FOR by exactly one of the two walks.
|
|
|
|
|
|
|
|
|
|
|
|
The policy is not "declare nothing" — these files legitimately declare their
|
|
|
|
|
|
own functions. It is that an instrument may not declare an AXIOM (which
|
|
|
|
|
|
would widen the trusted base outside every cone) nor a standalone CLAIM
|
|
|
|
|
|
(which no certificate covers and no allowlist pins). A theorem whose name
|
|
|
|
|
|
extends a constant declared alongside it is an artefact the elaborator
|
|
|
|
|
|
generated for a definition — well-founded recursion emits these — and is
|
|
|
|
|
|
allowed; a theorem whose parent is not a declared constant is not. -/
|
|
|
|
|
|
def emitDrivers (drivers : Array Name) : MetaM Unit := do
|
|
|
|
|
|
let env ← getEnv
|
|
|
|
|
|
let mut idxs : Array Nat := #[]
|
|
|
|
|
|
for m in drivers do
|
|
|
|
|
|
match env.getModuleIdx? m with
|
|
|
|
|
|
| some i => idxs := idxs.push i
|
|
|
|
|
|
| none => throwError "DRIVER SURFACE ERROR: driver module {m} is not imported"
|
|
|
|
|
|
-- Two passes: collect the names first, so the artefact test can ask whether a
|
|
|
|
|
|
-- theorem's parent is itself declared by an instrument.
|
|
|
|
|
|
let mut names : Std.HashSet Name := {}
|
|
|
|
|
|
let mut here : Array (Name × ConstantInfo) := #[]
|
|
|
|
|
|
for (n, ci) in env.constants.toList do
|
|
|
|
|
|
let mine : Bool :=
|
|
|
|
|
|
match env.getModuleIdxFor? n with
|
|
|
|
|
|
| some i => idxs.contains i
|
|
|
|
|
|
| none => true -- declared by the module being elaborated: this driver
|
|
|
|
|
|
if mine then
|
|
|
|
|
|
names := names.insert n
|
|
|
|
|
|
here := here.push (n, ci)
|
|
|
|
|
|
let mut lines : Array String := #[]
|
|
|
|
|
|
for (n, ci) in here do
|
|
|
|
|
|
let k := kindOf ci
|
|
|
|
|
|
if k == "axiom" then
|
|
|
|
|
|
throwError "DRIVER SURFACE VIOLATION: {n} is an axiom declared by the audit \
|
|
|
|
|
|
infrastructure. An instrument may not widen the trusted base."
|
|
|
|
|
|
if k == "theorem" && !names.contains n.getPrefix then
|
|
|
|
|
|
throwError "DRIVER SURFACE VIOLATION: {n} is a standalone theorem declared by \
|
|
|
|
|
|
the audit infrastructure. An instrument may declare definitions \
|
|
|
|
|
|
and whatever the elaborator generates for them — never a claim \
|
|
|
|
|
|
of its own."
|
audit: bind the scalar statements, and make the accounting identity mean audit
Closes four round-7/8 findings. Certified by the round-12 sweep: five
repositories, both buttons and every self-test, 48/48 GREEN.
── `scalar-statements-unbound` (gpt, round 7, CRITICAL) ────────────────────
The main button bound its 31 certificates' elaborated statements and reachable
specification bodies. This button bound NONE of its thirteen, while
TRUSTED-BASE item 8 said the audit covers "every certificate" — false across
the 44-certificate surface. The finding was raised in round 7, lost from the
round-8 work list by an F-number collision between two reviewers, and re-raised
in round 8.
Proofs/ScalarAudit.lean is generated from each fork's OWN Audit.lean, so the
canonicalisation is provably the same code: pp.all rendering, whitespace
normalisation, transitive specification closure. check-scalar.sh Phase 3c pins
the block's digest, requires the committed copy to match byte-for-byte so a
mismatch can be DIFFED, and cross-checks the auditor's certificate set against
the button's CERTS array.
dalek ecf3a3f8 · anza 0d942e47 · risc0 4b550a61 · betrusted 4b550a61
risc0 and betrusted share a digest and that is correct, not a collision: their
ScalarSubSpec.lean differs only in doc prose and in `black_box` entries inside
`simp only [...]` lists AFTER `:= by`. Proof scripts. They bind the same
statements over the same specifications, which is the documented scope.
selftest-scalar-statements.sh ships the two attacks the reviewer asked for:
ok gutted statement caught (cone unchanged)
ok rewritten specification body caught (name and cone unchanged)
The second rewrites a reachable reference body to `id (…)` — DEFINITIONALLY
EQUAL, so the corpus compiles and every proof typechecks and the cone is
byte-identical. Every earlier phase is blind to it.
── `drv-surface-no-cones` + `accounting-certifies-enumeration` (claude) ────
The round-7 accounting identity proved every kernel constant was ENUMERATED.
The reviewer showed enumeration is not audit: their planted claim WAS
enumerated, as DRV|LTLAccAudit.bait.smuggled|theorem with a real cone, and
nothing examined it — rows had no cone, no allowlist covered them, the
statement digest does not reach instruments, and Phase 2b gates DECLARED
AXIOMS, a different question. "Progress of one step, not two."
DRV rows now carry their axiom cone and are pinned in driver-allowlist.txt by
inventory_gate.sh with a DRV tag — the same implementation that pins the
corpus, in both directions, because a second copy of a coverage gate is a
second thing to drift. The axiom policy is per-surface and enforced per
surface: the corpus admits exactly the sanctioned boundary, the instruments
admit none, and an instrument axiom fails EVEN WHEN ALLOWLISTED.
Verified with the reviewer's own payload, both placements:
before the walk -> UNCLASSIFIED: DRV|…|bait.smuggled|theorem|Classical.choice,Quot.sound,propext
after the walk -> ACCOUNTING FAILED names it (kernel-side)
── `drv-naming-heuristic` (claude, round 7) ────────────────────────────────
Retired as load-bearing rather than patched. The rule admits a theorem whose
name extends a constant declared alongside it, and "breaks in one line" —
declare `def bait`, then `theorem bait.smuggled` walks through. It stays as a
fast readable first check; membership in a committed allowlist is what now
carries the weight, and a new row fails closed whatever it is called.
── what round 11 caught, which was mine ───────────────────────────────────
DRV rows first shipped WITHOUT their originating driver. dalek and anza run
two drivers, each declaring its own `corpus`; keyed on name alone those two
distinct declarations produced one byte-identical row, `sort -u` collapsed
them, and the trailers summed to 37 against 36. The estate had already learned
this on the corpus walk — INV rows carry their module because two modules both
declare CurveFieldProofs.zero_spec — and I rebuilt the record without it.
Rows now carry their driver, and the gate FAILS CLOSED ON DUPLICATE RECORDS
naming the collision: two declarations sharing one entry means one is covered
by the other's, which is exactly how a real declaration hides. The trailer
now checks what the drivers EMITTED, not what survives de-duplication —
conflating "the run was truncated" with "two rows were identical" is what let
a record-format defect present itself as an arithmetic complaint.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 10:15:26 +00:00
|
|
|
|
-- THE CONE, and it is the second half of the accounting identity.
|
|
|
|
|
|
--
|
|
|
|
|
|
-- Round-8 review (Claude, register keys `drv-surface-no-cones` and
|
|
|
|
|
|
-- `accounting-certifies-enumeration`). These rows carried name and kind
|
|
|
|
|
|
-- only. The round-7 accounting identity then proved every kernel constant
|
|
|
|
|
|
-- was ENUMERATED by one of the two walks — and the reviewer demonstrated
|
|
|
|
|
|
-- that enumeration is not audit: a claim planted in an instrument WAS
|
|
|
|
|
|
-- enumerated, as `DRV|…bait.smuggled|theorem`, with a real cone of
|
|
|
|
|
|
-- [propext, Classical.choice, Quot.sound], and then nothing looked at it.
|
|
|
|
|
|
-- No allowlist row covered the instrument surface, the statement digest
|
|
|
|
|
|
-- does not reach instruments, and Phase 2b gates DECLARED AXIOMS, which is
|
|
|
|
|
|
-- a different question from cones. Their summary: the identity "converted
|
|
|
|
|
|
-- 36 declarations nobody enumerated into 36 declarations nobody examined.
|
|
|
|
|
|
-- That is progress of one step, not two."
|
|
|
|
|
|
--
|
|
|
|
|
|
-- With the cone emitted here and the rows pinned in driver-allowlist.txt
|
|
|
|
|
|
-- by the same gate the corpus uses, the identity and the audit coincide:
|
|
|
|
|
|
-- a planted claim is a new row, and a new row fails closed. The
|
|
|
|
|
|
-- name-prefix rule above is kept as a fast first line of defence but is no
|
|
|
|
|
|
-- longer load-bearing — the reviewer showed it breaks in one line.
|
|
|
|
|
|
let cone ← axiomCone n
|
|
|
|
|
|
let coneStr := ",".intercalate (cone.toList.map (·.toString))
|
|
|
|
|
|
-- THE ORIGINATING DRIVER is part of the record, for the same reason the
|
|
|
|
|
|
-- INV rows carry their module: dalek and anza run TWO drivers, each
|
|
|
|
|
|
-- declaring its own `corpus`, and keyed on name alone those two distinct
|
|
|
|
|
|
-- declarations produced one byte-identical row. `sort -u` then collapsed
|
|
|
|
|
|
-- them, the trailers summed to 37 against 36 unique rows, and the gate
|
|
|
|
|
|
-- reported the surface truncated. Two declarations must never share a
|
|
|
|
|
|
-- record — that is what let a real declaration hide behind another one's
|
|
|
|
|
|
-- entry when this mistake was made on the corpus walk.
|
|
|
|
|
|
lines := lines.push s!"DRV|{env.mainModule}|{n}|{k}|{coneStr}"
|
Account for every constant the kernel sees, by set containment
THE GAP. The capability matrix in the control repo — built after the author
answered a capability question by grepping for a FILENAME rather than for the
property, three times in one session — asked whether each repository's auditor
enumerates itself. The four ed25519 forks answered no. Following that up found
something larger: `Proofs/Audit.lean`, the statement-binding driver from P1-a,
is compiled, is a member of the manifest, and was enumerated by NOTHING. The
kernel counted 3058 declarations where the inventory accounted for 3022, and
26 of the 36 missing were its.
THE PROPERTY, now enforced: every constant the kernel sees under this button's
manifest must appear, BY NAME, in either the corpus inventory or the
instruments' own surface. `emitDrivers` in InventoryCore walks the audit
modules and fails closed on an axiom (which would widen the trusted base
outside every cone) or on a standalone claim (which no certificate covers and
no allowlist pins), while admitting the obligations the elaborator generates
for a definition declared alongside it.
TWO WRONG FORMULATIONS FIRST, both recorded because the second is instructive:
· `kernel = corpus + instruments + N_DRIVERS`, where the last term was
justified as a per-driver "self-observation blind spot". It fitted dalek
and anza (2 drivers, residual 2) and broke on risc0 and betrusted
(1 driver, residual 2). The residual is 2 everywhere and has nothing to do
with drivers. This was curve-fitting from a sample of one, and it was named
as the highest-risk claim in the round-7 self-assessment BEFORE the data
refuted it.
· distinct-by-name counting, which collapses `CurveFieldProofs.zero_spec` —
a name that genuinely denotes two different declarations, in Proofs.Basic
and Proofs.ConstSpecs, walked by two drivers with separate environments.
THE MEASURED CAUSE of the residual. Lean materialises equation lemmas lazily,
when something forces an unfold, and each module that forces one gets its own
copy in its object file. `CurveFieldProofs.denote.eq_1` sits in both
SubNegSpec.olean and ConstSpecs.olean; `CurveFieldProofs.limbsVal.eq_1` in both
ReduceSpec.olean and ConstSpecs.olean. The kernel gate reads object files and
counts both copies; the environment holds one constant per name. Counts cannot
relate those two views in either direction — so the check compares SETS, which
is the idiom the rest of this estate already uses, and no constant remains that
could be widened to make a red run green.
Negative-tested: with the instrument walk disabled, the check names
Proofs.Audit's declarations as unaccounted.
ANZA also lacked one allowlist row, `subtle.Choice...from.eq_1`, the same
lazy-materialisation effect seen from the other side. Verified rather than
assumed before adding it: the parent is declared in gen/CurveField/
FunsExternal.lean — the model, pinned by bytes and not inventoried by
declaration — the lemma materialised in Proofs.CompressSpec which forced the
unfold, and all three other forks carry the lemma row while none carries the
parent.
CONSEQUENCE WORTH DISCLOSING: the audited declaration surface is not purely a
function of the corpus source. It depends on which proofs forced which
unfolds. This is now a known gap in the round-7 kit.
Also corrected here: Proofs/Inventory.lean's header claimed the audit drivers
were excluded from the compile manifest. They are lines 42-44 of PROOFS.
Certified by a full sweep: both buttons, all four forks, purged trees. 8/8.
2026-08-01 14:10:59 +00:00
|
|
|
|
let sorted := lines.qsort (· < ·)
|
|
|
|
|
|
for l in sorted do
|
|
|
|
|
|
IO.println l
|
|
|
|
|
|
IO.println s!"DRV-COUNT|{sorted.size}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
verification: pin the whole declaration surface (P1-b)
Phase 2b asks the kernel whether any AXIOM is declared under Proofs/. Phase 3
pins the cones of the named certificates. Between them sat every other
declaration in the corpus — around three thousand of them — and a helper lemma
quietly acquiring a hash oracle in its cone moved nothing either phase looked
at.
Phase 2c closes that. Ported from ltl-accumulator-verified, where a nine-attack
self-test proved a source-regex enumerator evadable by attributed, private,
indented and `instance` declarations and by a nested-namespace basename
collision. Reading the compiled environment sees what the kernel saw; no name
shape hides. Every constant contributes module, name, kind and full axiom cone,
and the observed set must equal inventory-allowlist.txt exactly in BOTH
directions, with a count trailer so a truncated run cannot pass as an empty
diff.
FOUR THINGS THIS BUILD GOT WRONG, each caught by a check rather than by review:
- The number of inventory drivers is a per-repo FACT, not an assumption.
dalek and anza cannot import their corpus as one environment (Proofs.Basic
and Proofs.ConstSpecs both declare CurveFieldProofs.zero_spec); risc0 and
betrusted have no Proofs.Basic at all. Determined by compiling a probe.
check.sh now DISCOVERS its drivers from the filesystem instead of naming
two, and the generator refuses to split out a module the repo lacks.
- The split let one real declaration hide behind another's entry. Keyed on
name alone, the two zero_specs produced byte-identical records, so 3022
declarations were covered by 3021 allowlist entries. Caught by the count
trailer. Every record now carries its originating module.
- The gate's success line said "single sanctioned axiom", inherited from the
accumulator's policy. This corpus permits NONE. A success message
describing a different rule is how an assertion stops meaning anything.
- selftest-axgate.sh lifted Phase 2b with a range ending at "Phase 3", so
inserting Phase 2c between them made it swallow the new phase and die on
variables only check.sh defines — surfacing as the BASELINE case failing,
a self-test blaming a gate for its own extraction bug. Both self-tests now
stop at the next phase marker whatever it is called, and refuse to run if
they capture more than one phase. The guard is the fix; the range was the
symptom.
WHAT THIS IS NOT, recorded in TRUSTED-BASE.md at the same length as the claim:
- No independent cone walker. The accumulator cross-checks collectAxioms
against a hand-written walker. Ported here it was wrong in BOTH directions
on mathlib's inductive shapes: EdPoint gave [] against the kernel's three
axioms, and once extended, ProjPoint gave three against the kernel's none.
Two implementations disagreeing both ways are a second wrong answer, not a
check. These cones rest on collectAxioms alone.
- Thirteen Proofs/Scalar* modules are inventoried by nothing — the
second-button seam, still open. Phase 2c names every uncovered module on
every run so the omission is visible rather than inferred.
selftest-inventory.sh exercises the shipping gate with six cases, each
asserting a specific diagnostic, including the one that matters: a cone
widened by one oracle while name, module and kind stay put. Negative-tested by
disabling the gate's diff, which turns two cases red including one for the
wrong reason, correctly reported as such.
Verified green: 20 runs across the four repositories (four buttons, four
harness, four inventory, four axgate, four binding self-tests), zero red. The
four check-scalar.sh greens from the preceding sweep stand: that script neither
reads the pin file nor changed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-29 23:20:19 +00:00
|
|
|
|
end Ed25519Inventory
|