Skip to content

ci(proofs): audit the proof ledger, reconcile the local ruling with the estate policy, and stop the record lying - #130

Closed
hyperpolymath wants to merge 51 commits into
mainfrom
arena/7759e0ce-nextgen-typing
Closed

hyperpolymath wants to merge 51 commits into
mainfrom
arena/7759e0ce-nextgen-typing

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Closes #57.

What changed, and why the shape changed

The first version of this PR wired just proof-check-all into CI and made it
intolerant of missing provers. That was the right instinct and the wrong shape:
metadatastician/standards 3-practice/PROOF-POLICY.adoc §1 makes Agda the source of truth
for a theory proof and §2 makes Rocq and Lean its recheck legs. So CI now:

  • audits verification/proofs/LEDGER.json — the record of what has actually
    been proven, at what grade, with which axioms, at which commit;
  • compiles only the recheck legs the ledger declares (just proof-witness-check
    = registry gates + ledger audit + declared Rocq/Lean legs);
  • re-typechecks the Agda source leg, and records it — it is the source of truth,
    not something to re-derive in CI.

The witness verdict, in the policy's own vocabulary

item value
theorem XP-1, kind theory
grade 3 — Agda alone, not translated
source leg Agda proven, receipt 4c6b918 / run 41299544043, assumptions pinned (Agda 2.8.0, stdlib v2.3, echo-types b0982c4, absolute-zero f486c29)
Rocq leg open — no witness; §2 wants transport (Dedukti/Lambdapi) or a hand re-proof
Lean 4 leg open — no witness; no Mathlib, so a core-Lean re-proof
rungs above 2i needs exactly one proven leg; 2ii needs two and a non-DTT leg (Agda/Rocq/Lean are all DTT/CIC, so Rocq+Lean cannot get there); 1 needs AXLE/coq-lsp/isabelle-server

The §2 recheck obligation for XP-1 is unmet, and the lane says so on every
run: a POLICY GAP line in the log, a ::warning:: annotation per open leg, and
a 0 proven recheck leg(s) census in the annotations. A green run means the
ledger is honest
, never the theorem is verified in an independent kernel.

The grade-3 rung is substantiated, not labelled

just proof-ledger-check reads the tree and fails on drift:

  • named declarations — statement_anchor/statement_formal pin TP-ECHO-1..3
    and their types; the gate re-reads EchoTyping.agda (whitespace-normalised) and
    fails if a recorded type is gone;
  • flags in force — the gate reads the {-# OPTIONS #-} pragmas out of the
    proof files and the CLI flags out of scripts/check-proofs.sh, and requires
    the ledger's safety_flags to equal their union;
  • the §5 deviation — mathesis §5 names --safe --erasure or Full --cubical
    for grade 3; this proof runs --safe --without-K --cubical-compatible. The
    grade stays 3, but the difference is recorded in grade_deviation, and the gate
    requires that field whenever the flags are not a named configuration;
  • "no postulates" — evidenced by a mechanism (--safe + the comment-aware
    scans), not asserted.

history follows mathesis §6: entries need date/target/from/to/evidence, the last
entry for a target must equal the current value (no quiet downgrade or dropped
record), and a transition to a weaker state needs a reason. An honest, evidenced
regression passes.

The gate is verified both ways (§7)

tests/proofs/run-controls.sh runs 15 ledger-form controls (no prover needed) and
5 kernel controls, and the run reports the counts as annotations:

  • must pass — a closed Rocq proof (Print Assumptions: closed), a closed Lean
    proof (#print axioms: no axioms), an honest evidenced regression;
  • must fail, for the stated reason — Admitted, sorry, a grade with no leg
    behind it, contradictory history, an unjustified regression, flag drift,
    statement drift, a missing escape-hatch mechanism, an unrecorded deviation, a
    non-existent anchor, a ghost source file, a witness planted on disk that no
    ledger row claims, and a 2i claim with 0 proven legs.

Receipt: run 41314454646 — 15 expectation(s), 0 violations and
6 expectation(s), 0 violations under coqc 8.18.0 / lean 4.15.0.

Anti-null-check work

Widened, not weakened: MANIFEST / LEDGER.json are excluded from the proof
registries (they are the gates' inputs, not proofs); tests/proofs/control/* is
allowed through the coordination boundary only if each fixture declares itself and
stays <= 20 lines; the unclaimed-witness check no longer degrades to a no-op in a
tree without .git; a zero-work guard fails if a leg is recorded proven with no
gated module.

No continue-on-error, no skip-on-missing-tool, no evidence fabricated. Missing
toolchain => BLOCKED, never a pass.

Remaining blockers

  1. Rocq and Lean legs are open — that is proof work, not bookkeeping; the
    runbook is in PROOF-STATUS.adoc and just proof-grade prints the delta.
  2. The Lean release archive has no published digest, so its identity is recorded
    per run (sha256 + size in the receipt) and the toolchain is pinned by version
    assertion. Agda remains sha256-pinned.
  3. Workflow Security Linter -> Verify action lockfile coverage is red on main
    already; this lane adds no uses:, so its lock entry is unchanged.

Follow-up audit: five items, in order

An audit of this branch against the policy turned up five places where the repo
said one thing and did another. All five landed, each as its own commit:

  1. The local ruling was superseded and did not say so. D-2026-10-12
    ("Coq, Mizar: archived", "Lean 4 is provenance") predates the estate policy
    (owner ruling 2026-10-26, amended 2026-11-01). The decision now carries a
    clause-by-clause amendment: the Agda-kernel, Idris2-ABI and
    Isabelle-supplementary clauses stand; "Coq archived" and "Lean is provenance
    only" are superseded; XP-1's open legs are obligations, not waivers (§4
    waives a statement that cannot be expressed, not a tool the estate archived).
    docs/decisions/README.adoc is now an index that states the supersession.
    The policy is pinned in the ledger (46ee1832…, ruling + amendment dates,
    vendored_here: false) because this repo has no standards/ directory — the
    old bare path was a dangling citation.
  2. §2.1 invalidated the pinned Agda receipt. A --safe-only success is
    historical evidence, not a receipt for --safe --without-K --cubical-compatible. The receipt was re-baselined onto run 41314454646
    (3cd1859), the first canonical-invocation run; the old one is kept as
    history. The gate's history rule now resolves a transition that names the
    source leg.
  3. Dependencies were two version strings. echo-types (identity claim open,
    criterion 2) and absolute-zero (115 Qed / 0 Admitted / 61 axioms, OND-6
    open, Coq archived) are now tagged external-development /
    proof-bearing-consumer with relation, evidence and a caveat that names them;
    .source.import_cone records the import closure module by module (3 modules,
    all --safe --without-K --cubical-compatible, 0 postulates) and what is
    deliberately outside it.
  4. The gate's policy reference was a dead path, and the ledger's note claimed
    a pin check that did not exist. The gate now prints
    metadatastician/standards … @ 46ee1832… and fails on a missing pin,
    phantom vendored copy, waiver-as-status, or unavailable route carrying a claim.
  5. hexad and logtalk. HEXAD is VeriSimDB's legacy VCL keyword for the
    octad source (8 witnesses); the wire schema is verisimdb.octad.v1 and the
    API is /api/v1/octads. logtalk was removed as a Hypatia report format on
    2026-04-14. Both were inherited from gitbot-fleet templates and are reported
    there with evidence: gitbot-fleet#640, gitbot-fleet#641.

Controls for the instrument went from 15 to 26, each asserting the specific
refusal rather than any non-zero exit — including two silent field-shift bugs in
the gate's own record reads, found because a control for a rule I had just
written passed when it should not have (IFS=$'\t' collapses empty fields in
bash; tabs are whitespace).

Still open

  • XP-1 is still Grade 3: rocq [dtt]: open, lean4 [dtt]: open. Grade 2i
    needs one proven leg; 2ii is unreachable while both legs are DTT.
  • Policy §6 deviation recorded, not waived: Rocq 8.18.0 from the package index and
    Lean 4.15.0 from the release archive, not from a Guix manifest or the container.
  • hypatia-scan, governance, secret-scanner and the workflow linter fail on
    main at 3bb3b0b as well — pre-existing, not from this branch. The linter's
    failing step is "Verify action lockfile coverage" (gh-actions-lock --verify-local, exit 2); runner logs for the other three are unretrievable.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci(proofs): build verification/proofs/ in CI — nothing runs just proof-check-all

2 participants