ltl-accumulator-verified/verification/fidelity/run_fidelity.py

197 lines
8.6 KiB
Python
Raw Normal View History

#!/usr/bin/env python3
"""S7 definition-fidelity harness for ltl-accumulator-verified.
Differential-tests the LEAN definitions (transliterated in lean_defs.py:
MTH / Path / Root / ConsRec, post-refactor decidable-if base) against the
DEPLOYED pacta verifiers, over the EXACT case generation of the paper's
revision round 1: address both external reviews (GPT-5.6 + second Claude) No theorem was wrong; every fix is spec-surface, audit-mechanism, docs, or harness coverage. Changes: LEAN (Claude F1, GPT M4): - acceptIncl: the consumer's inclusion accept (m<n ∧ Root=some r) is now a named object, not just a theorem hypothesis. Root alone accepts out-of-range m; acceptIncl pins the guard. - acceptIncl_complete / acceptIncl_sound: route Thm 1/2 through it. - extractCons_correct_paper: Thm 3 at the paper's exact quantifiers (n₀≤n₁, no separate 0<n₀; n₀=0 discharged since D₀=[]=take 0). SCRIPT (GPT H1/H2, Claude F3): - Phase 3b: fail-closed audit-surface COVERAGE — every named decl under Proofs/ and gen/ must be in CONES or a documented EXCLUDE (sha256, Bytes); anonymous gen instances count-pinned; every CONES key must be queried by AxiomCheck (no pin-but-never-check). Tested: an unclassified theorem now makes the button exit 1. - H2: distinct markers — LEAN GREEN always, ATTESTATION GREEN only when fidelity actually ran; SKIP/absent-pacta no longer emit the strong marker. Attestation gate keys on ATTESTATION GREEN. - Phase 0: orphan-olean guard (every Proofs/*.olean needs a sibling .lean); deleted 6 orphans; untracked all *.olean/.lake from git and gitignored them (root cause of the F3 tarball leak). HARNESS (Claude F1, GPT M3): - added out-of-range families (m≥n, m>n, n₀>n₁, n₀=0); re-pinned counts 230,271 / 230,016 (match the reviewer's independent RFC difftest exactly); narrowed 'exhaustive' wording to the tested domain. DOCS: README stale rows fixed (freeze banner no longer contradicts table); KNOWN-GAPS gap 3 reworded (general Lemma 2 = specializations), +gaps 9 (cost), 10 (pin init), 11 (acceptIncl resolved); STATEMENT-MAP +acceptIncl rows, +Lemma-2-general note, +constant-vs-property clarification for §10(i). Button: EXIT 0, coverage complete, ATTESTATION GREEN, 230,271/230,016. 56 pinned cones over an ENFORCED surface. LTL untouched (12, bcd15f9d). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 20:53:47 +00:00
tests/test_paper_verifiers.py this run establishes agreement between the mechanized objects and the
deployed RFC 9162 code EXHAUSTIVELY OVER all size/index (and old/new
size) pairs through 256 FOR the two fixed generated datasets and the
listed mutation classes (honest, wrong-leaf, wrong-index, wrong-root,
truncated/padded proof, and out-of-range mn / n0>n1 / n0=0). It is not
Review round 4: F1* absorbed (lied-size boundary), acceptCons_sound, kit reproducibility Round-3 verdicts: GPT-5.6 conditionally approves (blockers closed, one portability finding); the Claude reviewer's Socratic addendum produced F1*, the strongest finding of the series — deployed verify_consistency and mechanized ConsRec are NOT extensionally equal. Reproduced exactly (witness verify_consistency(1,3,R2,R3,P(2→3))=True vs ConsRec reject; 3,405 divergences n<60; strictly one-sided; power-of-two seeding mechanism confirmed in source). - KNOWN-GAPS gap 14: witness, mechanism, one-sidedness, and the pinned-pair side condition under which Theorem 3 transfers to the deployed verifier (pacta's pin-store flow supplies it by construction). No pacta code change; deployed behavior matches upstream RFC 9162 implementations. - fidelity: lied-size family — 73,573 boundary cases, 3,867 expected divergences PINNED, one-sided direction asserted per case. Banner rescoped: agreement over pinned families, not extensional equality. - Theorem3.lean: acceptCons_sound (F2) — soundness over the named acceptCons predicate, n₀=0 discharged from the non-prefix premise, size bound derived from acceptance via new consRec_some_le. Cones read from #print axioms; CONES/AxiomCheck/allowlist updated (218 → 222 constants, diff = the two theorems + two generated auxiliaries). - F3/GPT§7: verification/lean-toolchain pin + run_bare.sh (reviewer's standalone runner, plain public lean — verified green: 61 cones, 222 constants, gate green) + AENEAS_ENV override in check.sh and selftest_audit.sh. - F4: awk field-equality replaces regex-with-dots in Phase 3b. - F5: git-tracked .pyc removed (worse than reported — it was in the repo, not just the kit); __pycache__ gitignored; round-4 kit ships a corpus MANIFEST.sha256 + pinned commit (also GPT's governance condition). check.sh exit 0, ATTESTATION GREEN; selftest exit 0, 9/9 + control. Live LTL untouched (12 leaves, bcd15f9d…); attestation still gated on ePrint decision + author review + explicit operator order. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 13:07:57 +00:00
a proof of extensional equality over all inputs and extensional
equality is in fact FALSE for consistency: the lied-size family below
pins the known one-sided divergence (deployed accepts claimed sizes an
honest proof was never generated for; the mechanized ConsRec rejects
KNOWN-GAPS gap 14). The Lean-to-Python bridge remains trusted
quoted-source inspection (see KNOWN-GAPS).
Requires the pacta repo on PYTHONPATH (its src/). Bound NMAX matches the
paper.
"""
import hashlib
import os
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
PACTA_SRC = os.environ.get("PACTA_SRC",
os.path.join(HERE, "..", "..", "..", "proof-aware-crypto-tooling-agent", "src"))
sys.path.insert(0, PACTA_SRC)
sys.path.insert(0, HERE)
# deployed (pacta) side
from pacta.transparency import ( # noqa: E402
consistency_proof, inclusion_proof, merkle_root,
verify_consistency, verify_inclusion,
)
# lean (mechanized) side
import lean_defs as L # noqa: E402
NMAX = int(os.environ.get("FIDELITY_NMAX", "256"))
Review round 4: F1* absorbed (lied-size boundary), acceptCons_sound, kit reproducibility Round-3 verdicts: GPT-5.6 conditionally approves (blockers closed, one portability finding); the Claude reviewer's Socratic addendum produced F1*, the strongest finding of the series — deployed verify_consistency and mechanized ConsRec are NOT extensionally equal. Reproduced exactly (witness verify_consistency(1,3,R2,R3,P(2→3))=True vs ConsRec reject; 3,405 divergences n<60; strictly one-sided; power-of-two seeding mechanism confirmed in source). - KNOWN-GAPS gap 14: witness, mechanism, one-sidedness, and the pinned-pair side condition under which Theorem 3 transfers to the deployed verifier (pacta's pin-store flow supplies it by construction). No pacta code change; deployed behavior matches upstream RFC 9162 implementations. - fidelity: lied-size family — 73,573 boundary cases, 3,867 expected divergences PINNED, one-sided direction asserted per case. Banner rescoped: agreement over pinned families, not extensional equality. - Theorem3.lean: acceptCons_sound (F2) — soundness over the named acceptCons predicate, n₀=0 discharged from the non-prefix premise, size bound derived from acceptance via new consRec_some_le. Cones read from #print axioms; CONES/AxiomCheck/allowlist updated (218 → 222 constants, diff = the two theorems + two generated auxiliaries). - F3/GPT§7: verification/lean-toolchain pin + run_bare.sh (reviewer's standalone runner, plain public lean — verified green: 61 cones, 222 constants, gate green) + AENEAS_ENV override in check.sh and selftest_audit.sh. - F4: awk field-equality replaces regex-with-dots in Phase 3b. - F5: git-tracked .pyc removed (worse than reported — it was in the repo, not just the kit); __pycache__ gitignored; round-4 kit ships a corpus MANIFEST.sha256 + pinned commit (also GPT's governance condition). check.sh exit 0, ATTESTATION GREEN; selftest exit 0, 9/9 + control. Live LTL untouched (12 leaves, bcd15f9d…); attestation still gated on ePrint decision + author review + explicit operator order. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 13:07:57 +00:00
# lied-size family pins (gap 14; valid for the default FIDELITY_LIED_NMAX=60):
verification: bind statements and specification bodies (P1-a); un-stale the fidelity pin STATEMENT BINDING (Phase 3d). The coverage gate pins every constant's name, kind and axiom cone, both directions, and none of selftest_audit.sh's nine attacks defeat it. It is nevertheless blind to what a declaration SAYS — and that is demonstrated here rather than argued: Wrapping one branch of `LTLAcc.pinAccept`'s body in `id (…)` is definitionally equal. Every downstream proof still compiles. The name, the kind, the type and the axiom cone are unchanged. The inventory gate reports "222 constants, environment == allowlist" — GREEN. That edit is harmless by construction; the point is that nothing stood between it and a genuinely vacuous redefinition of a specification. Proofs/Inventory.lean now also emits, for every inventoried constant, its fully-elaborated TYPE, and for every definition its fully-elaborated BODY — 266 lines over 222 constants. Proof terms are deliberately absent: by proof irrelevance a theorem's content is its statement. check.sh Phase 3d binds the SHA-256 and the block is committed as AUDIT-MANIFEST.txt so a mismatch is DIFFED, not merely reported. The existing gate is untouched, per the standing rule that the port flows FROM this repo, not to it: INV lines are byte-identical, inventory_gate.sh is unchanged, and all nine of its attacks still fail as before. selftest_statements.sh replays the defeq edit as case 1, asserting BOTH that the coverage gate passes it and that Phase 3d catches it — so if the coverage gate ever grows to see this, the test says so instead of quietly re-labelling. Cases 2-4 cover a hand-edited committed block, a truncated block, and a constant inventoried without a statement. FIDELITY PIN (unrelated, found while running the button). Phase 4 had been failing since 2026-07-23: LIED_PIN_DIV expected 3,867 divergences between the Lean model and the deployed consistency verifier, and observed 0. Cause is pacta ddbb5a4, which restored the RFC 9162 2.1.4.2 Step-7 terminal `sn == 0` condition; that one conjunct removes every divergence in the pinned 73,573-case family. KNOWN-GAPS gap 14 already recorded the closure on the day it landed — only this constant was stale, so the button had been red for five days with nobody running it. The pin now reads 0 with the history in a comment. Nothing about the paper, public log entry 13, or the attested commit 172a1d0 changes; the historical divergence stays reproducible at the tagged pre-fix commit. KNOWN-GAPS gap 16 records what the binding does not buy: identity, not meaning; an author who edits and re-pins in one commit is caught by review and not by the script; and proof terms are unbound by design. Button green end to end: ATTESTATION GREEN (Lean + fidelity). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-29 07:07:13 +00:00
# 73,573 boundary cases.
#
# The divergence count was 3,867 (3,405 lied-old-size + 462 lied-new-size,
# smallest witness n=3, m=2 claimed 1) until pacta `ddbb5a4` (2026-07-23)
# restored the RFC 9162 2.1.4.2 Step-7 terminal condition `sn == 0` to
# verify_consistency. That one conjunct removes EVERY divergence in this
# family, so the pin is now 0: the deployed verifier and the mechanized
# ConsRec model agree on all 73,573 boundary cases.
#
# The pin was left at 3,867 when the fix landed, which made this assertion —
# and therefore check.sh Phase 4 — fail from 2026-07-23 until it was noticed
# on 2026-07-28. KNOWN-GAPS.md gap 14 had already recorded the closure; only
# this constant was stale. Nothing about the paper, public log entry 13, or
# the attested commit 172a1d0 changes: the historical divergence remains
# truthfully recorded and reproducible at `vulnerable/sn0-consistency-fd2f6ba`.
Review round 4: F1* absorbed (lied-size boundary), acceptCons_sound, kit reproducibility Round-3 verdicts: GPT-5.6 conditionally approves (blockers closed, one portability finding); the Claude reviewer's Socratic addendum produced F1*, the strongest finding of the series — deployed verify_consistency and mechanized ConsRec are NOT extensionally equal. Reproduced exactly (witness verify_consistency(1,3,R2,R3,P(2→3))=True vs ConsRec reject; 3,405 divergences n<60; strictly one-sided; power-of-two seeding mechanism confirmed in source). - KNOWN-GAPS gap 14: witness, mechanism, one-sidedness, and the pinned-pair side condition under which Theorem 3 transfers to the deployed verifier (pacta's pin-store flow supplies it by construction). No pacta code change; deployed behavior matches upstream RFC 9162 implementations. - fidelity: lied-size family — 73,573 boundary cases, 3,867 expected divergences PINNED, one-sided direction asserted per case. Banner rescoped: agreement over pinned families, not extensional equality. - Theorem3.lean: acceptCons_sound (F2) — soundness over the named acceptCons predicate, n₀=0 discharged from the non-prefix premise, size bound derived from acceptance via new consRec_some_le. Cones read from #print axioms; CONES/AxiomCheck/allowlist updated (218 → 222 constants, diff = the two theorems + two generated auxiliaries). - F3/GPT§7: verification/lean-toolchain pin + run_bare.sh (reviewer's standalone runner, plain public lean — verified green: 61 cones, 222 constants, gate green) + AENEAS_ENV override in check.sh and selftest_audit.sh. - F4: awk field-equality replaces regex-with-dots in Phase 3b. - F5: git-tracked .pyc removed (worse than reported — it was in the repo, not just the kit); __pycache__ gitignored; round-4 kit ships a corpus MANIFEST.sha256 + pinned commit (also GPT's governance condition). check.sh exit 0, ATTESTATION GREEN; selftest exit 0, 9/9 + control. Live LTL untouched (12 leaves, bcd15f9d…); attestation still gated on ePrint decision + author review + explicit operator order. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 13:07:57 +00:00
LIED_PIN_TOTAL = 73_573
verification: bind statements and specification bodies (P1-a); un-stale the fidelity pin STATEMENT BINDING (Phase 3d). The coverage gate pins every constant's name, kind and axiom cone, both directions, and none of selftest_audit.sh's nine attacks defeat it. It is nevertheless blind to what a declaration SAYS — and that is demonstrated here rather than argued: Wrapping one branch of `LTLAcc.pinAccept`'s body in `id (…)` is definitionally equal. Every downstream proof still compiles. The name, the kind, the type and the axiom cone are unchanged. The inventory gate reports "222 constants, environment == allowlist" — GREEN. That edit is harmless by construction; the point is that nothing stood between it and a genuinely vacuous redefinition of a specification. Proofs/Inventory.lean now also emits, for every inventoried constant, its fully-elaborated TYPE, and for every definition its fully-elaborated BODY — 266 lines over 222 constants. Proof terms are deliberately absent: by proof irrelevance a theorem's content is its statement. check.sh Phase 3d binds the SHA-256 and the block is committed as AUDIT-MANIFEST.txt so a mismatch is DIFFED, not merely reported. The existing gate is untouched, per the standing rule that the port flows FROM this repo, not to it: INV lines are byte-identical, inventory_gate.sh is unchanged, and all nine of its attacks still fail as before. selftest_statements.sh replays the defeq edit as case 1, asserting BOTH that the coverage gate passes it and that Phase 3d catches it — so if the coverage gate ever grows to see this, the test says so instead of quietly re-labelling. Cases 2-4 cover a hand-edited committed block, a truncated block, and a constant inventoried without a statement. FIDELITY PIN (unrelated, found while running the button). Phase 4 had been failing since 2026-07-23: LIED_PIN_DIV expected 3,867 divergences between the Lean model and the deployed consistency verifier, and observed 0. Cause is pacta ddbb5a4, which restored the RFC 9162 2.1.4.2 Step-7 terminal `sn == 0` condition; that one conjunct removes every divergence in the pinned 73,573-case family. KNOWN-GAPS gap 14 already recorded the closure on the day it landed — only this constant was stale, so the button had been red for five days with nobody running it. The pin now reads 0 with the history in a comment. Nothing about the paper, public log entry 13, or the attested commit 172a1d0 changes; the historical divergence stays reproducible at the tagged pre-fix commit. KNOWN-GAPS gap 16 records what the binding does not buy: identity, not meaning; an author who edits and re-pins in one commit is caught by review and not by the script; and proof terms are unbound by design. Button green end to end: ATTESTATION GREEN (Lean + fidelity). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-29 07:07:13 +00:00
LIED_PIN_DIV = 0
def _h(b):
return hashlib.sha256(b).digest()
def inclusion():
total = 0
root_checks = 0
path_checks = 0
for n in range(1, NMAX + 1):
data = [bytes([i % 251]) + bytes([(i * 5) % 256]) * (i % 3) for i in range(n)]
root = merkle_root(data)
# root fidelity: Lean MTH == deployed merkle_root
assert L.MTH(data) == root, ("MTH drift", n)
root_checks += 1
for m in range(n):
P = inclusion_proof(data, m)
# path fidelity: Lean Path == deployed inclusion_proof
assert L.Path(m, data) == P, ("Path drift", n, m)
path_checks += 1
cases = [
(data[m], m, n, P, root),
(data[m] + b"!", m, n, P, root),
(data[m], (m + 1) % n, n, P, root),
(data[m], m, n, P, _h(b"q")),
revision round 1: address both external reviews (GPT-5.6 + second Claude) No theorem was wrong; every fix is spec-surface, audit-mechanism, docs, or harness coverage. Changes: LEAN (Claude F1, GPT M4): - acceptIncl: the consumer's inclusion accept (m<n ∧ Root=some r) is now a named object, not just a theorem hypothesis. Root alone accepts out-of-range m; acceptIncl pins the guard. - acceptIncl_complete / acceptIncl_sound: route Thm 1/2 through it. - extractCons_correct_paper: Thm 3 at the paper's exact quantifiers (n₀≤n₁, no separate 0<n₀; n₀=0 discharged since D₀=[]=take 0). SCRIPT (GPT H1/H2, Claude F3): - Phase 3b: fail-closed audit-surface COVERAGE — every named decl under Proofs/ and gen/ must be in CONES or a documented EXCLUDE (sha256, Bytes); anonymous gen instances count-pinned; every CONES key must be queried by AxiomCheck (no pin-but-never-check). Tested: an unclassified theorem now makes the button exit 1. - H2: distinct markers — LEAN GREEN always, ATTESTATION GREEN only when fidelity actually ran; SKIP/absent-pacta no longer emit the strong marker. Attestation gate keys on ATTESTATION GREEN. - Phase 0: orphan-olean guard (every Proofs/*.olean needs a sibling .lean); deleted 6 orphans; untracked all *.olean/.lake from git and gitignored them (root cause of the F3 tarball leak). HARNESS (Claude F1, GPT M3): - added out-of-range families (m≥n, m>n, n₀>n₁, n₀=0); re-pinned counts 230,271 / 230,016 (match the reviewer's independent RFC difftest exactly); narrowed 'exhaustive' wording to the tested domain. DOCS: README stale rows fixed (freeze banner no longer contradicts table); KNOWN-GAPS gap 3 reworded (general Lemma 2 = specializations), +gaps 9 (cost), 10 (pin init), 11 (acceptIncl resolved); STATEMENT-MAP +acceptIncl rows, +Lemma-2-general note, +constant-vs-property clarification for §10(i). Button: EXIT 0, coverage complete, ATTESTATION GREEN, 230,271/230,016. 56 pinned cones over an ENFORCED surface. LTL untouched (12, bcd15f9d). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 20:53:47 +00:00
(data[m], n, n, P, root), # out-of-range m = n (review F1)
(data[m], n + 3, n, P, root), # out-of-range m > n (review F1)
]
if P:
cases.append((data[m], m, n, P[:-1], root))
for d2, m2, n2, P2, r2 in cases:
total += 1
dep = verify_inclusion(d2, m2, n2, P2, r2)
lean = L.accept_incl(d2, m2, n2, P2, r2)
assert dep == lean, ("INCL VERIFIER DRIFT", n, m, dep, lean)
return total, root_checks, path_checks
def consistency():
total = 0
for n in range(1, NMAX + 1):
data = [bytes([i % 251]) + bytes([(i * 7) % 256]) * (i % 4) for i in range(n)]
r1 = merkle_root(data)
assert L.MTH(data) == r1, ("MTH drift (cons)", n)
for m in range(1, n + 1):
P = consistency_proof(data, m)
r0 = merkle_root(data[:m])
cases = [
(m, n, r0, r1, P), # honest consistency
(m, n, _h(b"x"), r1, P),
(m, n, r0, _h(b"y"), P),
(m, n, r0, r1, P + [_h(b"z")]),
revision round 1: address both external reviews (GPT-5.6 + second Claude) No theorem was wrong; every fix is spec-surface, audit-mechanism, docs, or harness coverage. Changes: LEAN (Claude F1, GPT M4): - acceptIncl: the consumer's inclusion accept (m<n ∧ Root=some r) is now a named object, not just a theorem hypothesis. Root alone accepts out-of-range m; acceptIncl pins the guard. - acceptIncl_complete / acceptIncl_sound: route Thm 1/2 through it. - extractCons_correct_paper: Thm 3 at the paper's exact quantifiers (n₀≤n₁, no separate 0<n₀; n₀=0 discharged since D₀=[]=take 0). SCRIPT (GPT H1/H2, Claude F3): - Phase 3b: fail-closed audit-surface COVERAGE — every named decl under Proofs/ and gen/ must be in CONES or a documented EXCLUDE (sha256, Bytes); anonymous gen instances count-pinned; every CONES key must be queried by AxiomCheck (no pin-but-never-check). Tested: an unclassified theorem now makes the button exit 1. - H2: distinct markers — LEAN GREEN always, ATTESTATION GREEN only when fidelity actually ran; SKIP/absent-pacta no longer emit the strong marker. Attestation gate keys on ATTESTATION GREEN. - Phase 0: orphan-olean guard (every Proofs/*.olean needs a sibling .lean); deleted 6 orphans; untracked all *.olean/.lake from git and gitignored them (root cause of the F3 tarball leak). HARNESS (Claude F1, GPT M3): - added out-of-range families (m≥n, m>n, n₀>n₁, n₀=0); re-pinned counts 230,271 / 230,016 (match the reviewer's independent RFC difftest exactly); narrowed 'exhaustive' wording to the tested domain. DOCS: README stale rows fixed (freeze banner no longer contradicts table); KNOWN-GAPS gap 3 reworded (general Lemma 2 = specializations), +gaps 9 (cost), 10 (pin init), 11 (acceptIncl resolved); STATEMENT-MAP +acceptIncl rows, +Lemma-2-general note, +constant-vs-property clarification for §10(i). Button: EXIT 0, coverage complete, ATTESTATION GREEN, 230,271/230,016. 56 pinned cones over an ENFORCED surface. LTL untouched (12, bcd15f9d). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 20:53:47 +00:00
(n + 1, n, r1, r0, P), # n0 > n1 (review F1)
(0, n, r0, r1, P), # n0 = 0 escape (review F1)
]
if P:
cases.append((m, n, r0, r1, P[:-1]))
for mm, nn, a, bb, pp in cases:
total += 1
dep = verify_consistency(mm, nn, a, bb, pp)
lean = L.accept_cons(mm, nn, a, bb, pp)
assert dep == lean, ("CONS VERIFIER DRIFT", n, m, dep, lean)
return total
Review round 4: F1* absorbed (lied-size boundary), acceptCons_sound, kit reproducibility Round-3 verdicts: GPT-5.6 conditionally approves (blockers closed, one portability finding); the Claude reviewer's Socratic addendum produced F1*, the strongest finding of the series — deployed verify_consistency and mechanized ConsRec are NOT extensionally equal. Reproduced exactly (witness verify_consistency(1,3,R2,R3,P(2→3))=True vs ConsRec reject; 3,405 divergences n<60; strictly one-sided; power-of-two seeding mechanism confirmed in source). - KNOWN-GAPS gap 14: witness, mechanism, one-sidedness, and the pinned-pair side condition under which Theorem 3 transfers to the deployed verifier (pacta's pin-store flow supplies it by construction). No pacta code change; deployed behavior matches upstream RFC 9162 implementations. - fidelity: lied-size family — 73,573 boundary cases, 3,867 expected divergences PINNED, one-sided direction asserted per case. Banner rescoped: agreement over pinned families, not extensional equality. - Theorem3.lean: acceptCons_sound (F2) — soundness over the named acceptCons predicate, n₀=0 discharged from the non-prefix premise, size bound derived from acceptance via new consRec_some_le. Cones read from #print axioms; CONES/AxiomCheck/allowlist updated (218 → 222 constants, diff = the two theorems + two generated auxiliaries). - F3/GPT§7: verification/lean-toolchain pin + run_bare.sh (reviewer's standalone runner, plain public lean — verified green: 61 cones, 222 constants, gate green) + AENEAS_ENV override in check.sh and selftest_audit.sh. - F4: awk field-equality replaces regex-with-dots in Phase 3b. - F5: git-tracked .pyc removed (worse than reported — it was in the repo, not just the kit); __pycache__ gitignored; round-4 kit ships a corpus MANIFEST.sha256 + pinned commit (also GPT's governance condition). check.sh exit 0, ATTESTATION GREEN; selftest exit 0, 9/9 + control. Live LTL untouched (12 leaves, bcd15f9d…); attestation still gated on ePrint decision + author review + explicit operator order. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 13:07:57 +00:00
def lied_sizes():
"""Lied-size boundary family (round-3 review, Claude F1* / gap 14).
The deployed RFC 9162 iterative verify_consistency accepts honest
proofs under CLAIMED sizes the proof was never generated for (when
the claimed old size is a power of two it seeds the walk with the
old root and uses the sizes only as bit-navigation state); the
mechanized ConsRec binds the split geometry to the sizes and
rejects. Divergences in this family are therefore EXPECTED and
documented what this pins is:
(a) the DIRECTION: every divergence must be deployed=True /
lean=False (the mechanized model is the stricter one; a
lean=True/deployed=False case would break soundness transfer
and fails the run immediately), and
(b) the exact divergence COUNT, so any drift in either verifier
shows up as a pin failure.
Inclusion showed zero divergences under identical abuse (round-3
addendum); the inclusion side is covered by the m>=n families above.
"""
lied_nmax = int(os.environ.get("FIDELITY_LIED_NMAX", "60"))
total = 0
div = 0
for n in range(2, lied_nmax):
data = [bytes([i % 251]) for i in range(n)]
r1 = merkle_root(data)
for m_true in range(1, n):
P = consistency_proof(data, m_true)
r0 = merkle_root(data[:m_true])
for m_lie in range(0, n + 1): # lied OLD size
if m_lie == m_true:
continue
total += 1
dep = verify_consistency(m_lie, n, r0, r1, P)
lean = L.accept_cons(m_lie, n, r0, r1, P)
if dep != lean:
div += 1
assert dep and not lean, (
"ONE-SIDEDNESS BROKEN: lean accepts, deployed rejects",
n, m_true, m_lie)
for n_lie in (n - 1, n + 1, n + 7): # lied NEW size
if n_lie < m_true or n_lie == n or n_lie < 1:
continue
total += 1
dep = verify_consistency(m_true, n_lie, r0, r1, P)
lean = L.accept_cons(m_true, n_lie, r0, r1, P)
if dep != lean:
div += 1
assert dep and not lean, (
"ONE-SIDEDNESS BROKEN: lean accepts, deployed rejects",
n, m_true, "n_lie", n_lie)
return total, div
def main():
print(f"S7 fidelity: Lean defs vs deployed pacta, NMAX={NMAX}")
ti, rc, pc = inclusion()
print(f" inclusion: {ti} verifier cases, {rc} MTH==merkle_root, {pc} Path==inclusion_proof — all agree")
tc = consistency()
Round 5 (housekeeping): doc-consistency welded into the button; both round-4 approvals recorded Round-4 verdicts: Claude reviewer — nothing blocks the freeze, no remaining findings; GPT-5.6 — approve after minor documentation fixes, attestation scoped to the mechanized model. This round is those fixes; no Lean surface changed. - 218/59 → 222/61 everywhere, and STRUCTURALLY: check.sh Phase 3c asserts the audit counts (STATEMENT-MAP + README vs allowlist/CONES) and the four fidelity pins (STATEMENT-MAP vs run_fidelity.py constants) on every run — stale-count drift is a red button now (R4-1, third recurrence of the class). - Gap 14 reworded to evidence-vs-inference (the invariant "is assumed", not "transfers"), witnesses cited (paper §5.3/§5.4; pacta sthstore.py/logclient.py — outside the fidelity target). New gap 15: deployment refinement invariant unmechanized (GPT's principal finding, split out because it carries the deployed-soundness claim). - Runbook: A1 marked done (both approvals on SD); B2 gains the REQUIRED scoped attestation wording (GPT §11) as a gate condition — entry 13 cannot claim "deployed verifier formally verified". - run_bare.sh fail-closes on Lean version AND commit (rejection path tested with a fake toolchain: FATAL, exit 1). - Harness: "consistency baseline family" line (GPT §8); gap 14 says "fixed offsets n−1/n+1/n+7" (R4-5). - RESPONSE round 5, incl. refutation of GPT §7 (the target tarball demonstrably contains MANIFEST.sha256 + TARGET-PROVENANCE.md; the round-5 kit also ships both unpacked as a courtesy). check.sh exit 0 ATTESTATION GREEN (Phases 0-4 incl. new 3c); selftest exit 0, 9/9 + control. Live LTL untouched (12 leaves, bcd15f9d…). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 07:40:20 +00:00
print(f" consistency baseline family: {tc} verifier cases (incl. honest), MTH checks — all agree")
Review round 4: F1* absorbed (lied-size boundary), acceptCons_sound, kit reproducibility Round-3 verdicts: GPT-5.6 conditionally approves (blockers closed, one portability finding); the Claude reviewer's Socratic addendum produced F1*, the strongest finding of the series — deployed verify_consistency and mechanized ConsRec are NOT extensionally equal. Reproduced exactly (witness verify_consistency(1,3,R2,R3,P(2→3))=True vs ConsRec reject; 3,405 divergences n<60; strictly one-sided; power-of-two seeding mechanism confirmed in source). - KNOWN-GAPS gap 14: witness, mechanism, one-sidedness, and the pinned-pair side condition under which Theorem 3 transfers to the deployed verifier (pacta's pin-store flow supplies it by construction). No pacta code change; deployed behavior matches upstream RFC 9162 implementations. - fidelity: lied-size family — 73,573 boundary cases, 3,867 expected divergences PINNED, one-sided direction asserted per case. Banner rescoped: agreement over pinned families, not extensional equality. - Theorem3.lean: acceptCons_sound (F2) — soundness over the named acceptCons predicate, n₀=0 discharged from the non-prefix premise, size bound derived from acceptance via new consRec_some_le. Cones read from #print axioms; CONES/AxiomCheck/allowlist updated (218 → 222 constants, diff = the two theorems + two generated auxiliaries). - F3/GPT§7: verification/lean-toolchain pin + run_bare.sh (reviewer's standalone runner, plain public lean — verified green: 61 cones, 222 constants, gate green) + AENEAS_ENV override in check.sh and selftest_audit.sh. - F4: awk field-equality replaces regex-with-dots in Phase 3b. - F5: git-tracked .pyc removed (worse than reported — it was in the repo, not just the kit); __pycache__ gitignored; round-4 kit ships a corpus MANIFEST.sha256 + pinned commit (also GPT's governance condition). check.sh exit 0, ATTESTATION GREEN; selftest exit 0, 9/9 + control. Live LTL untouched (12 leaves, bcd15f9d…); attestation still gated on ePrint decision + author review + explicit operator order. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 13:07:57 +00:00
tl, dl = lied_sizes()
print(f" lied-sizes: {tl} boundary cases, {dl} EXPECTED divergences, all deployed-accepts-only (gap 14)")
# pinned counts (identical generation to the paper's harness)
revision round 1: address both external reviews (GPT-5.6 + second Claude) No theorem was wrong; every fix is spec-surface, audit-mechanism, docs, or harness coverage. Changes: LEAN (Claude F1, GPT M4): - acceptIncl: the consumer's inclusion accept (m<n ∧ Root=some r) is now a named object, not just a theorem hypothesis. Root alone accepts out-of-range m; acceptIncl pins the guard. - acceptIncl_complete / acceptIncl_sound: route Thm 1/2 through it. - extractCons_correct_paper: Thm 3 at the paper's exact quantifiers (n₀≤n₁, no separate 0<n₀; n₀=0 discharged since D₀=[]=take 0). SCRIPT (GPT H1/H2, Claude F3): - Phase 3b: fail-closed audit-surface COVERAGE — every named decl under Proofs/ and gen/ must be in CONES or a documented EXCLUDE (sha256, Bytes); anonymous gen instances count-pinned; every CONES key must be queried by AxiomCheck (no pin-but-never-check). Tested: an unclassified theorem now makes the button exit 1. - H2: distinct markers — LEAN GREEN always, ATTESTATION GREEN only when fidelity actually ran; SKIP/absent-pacta no longer emit the strong marker. Attestation gate keys on ATTESTATION GREEN. - Phase 0: orphan-olean guard (every Proofs/*.olean needs a sibling .lean); deleted 6 orphans; untracked all *.olean/.lake from git and gitignored them (root cause of the F3 tarball leak). HARNESS (Claude F1, GPT M3): - added out-of-range families (m≥n, m>n, n₀>n₁, n₀=0); re-pinned counts 230,271 / 230,016 (match the reviewer's independent RFC difftest exactly); narrowed 'exhaustive' wording to the tested domain. DOCS: README stale rows fixed (freeze banner no longer contradicts table); KNOWN-GAPS gap 3 reworded (general Lemma 2 = specializations), +gaps 9 (cost), 10 (pin init), 11 (acceptIncl resolved); STATEMENT-MAP +acceptIncl rows, +Lemma-2-general note, +constant-vs-property clarification for §10(i). Button: EXIT 0, coverage complete, ATTESTATION GREEN, 230,271/230,016. 56 pinned cones over an ENFORCED surface. LTL untouched (12, bcd15f9d). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 20:53:47 +00:00
assert ti == 230_271, ti # re-pinned after adding out-of-range families (F1)
assert tc == 230_016, tc
Review round 4: F1* absorbed (lied-size boundary), acceptCons_sound, kit reproducibility Round-3 verdicts: GPT-5.6 conditionally approves (blockers closed, one portability finding); the Claude reviewer's Socratic addendum produced F1*, the strongest finding of the series — deployed verify_consistency and mechanized ConsRec are NOT extensionally equal. Reproduced exactly (witness verify_consistency(1,3,R2,R3,P(2→3))=True vs ConsRec reject; 3,405 divergences n<60; strictly one-sided; power-of-two seeding mechanism confirmed in source). - KNOWN-GAPS gap 14: witness, mechanism, one-sidedness, and the pinned-pair side condition under which Theorem 3 transfers to the deployed verifier (pacta's pin-store flow supplies it by construction). No pacta code change; deployed behavior matches upstream RFC 9162 implementations. - fidelity: lied-size family — 73,573 boundary cases, 3,867 expected divergences PINNED, one-sided direction asserted per case. Banner rescoped: agreement over pinned families, not extensional equality. - Theorem3.lean: acceptCons_sound (F2) — soundness over the named acceptCons predicate, n₀=0 discharged from the non-prefix premise, size bound derived from acceptance via new consRec_some_le. Cones read from #print axioms; CONES/AxiomCheck/allowlist updated (218 → 222 constants, diff = the two theorems + two generated auxiliaries). - F3/GPT§7: verification/lean-toolchain pin + run_bare.sh (reviewer's standalone runner, plain public lean — verified green: 61 cones, 222 constants, gate green) + AENEAS_ENV override in check.sh and selftest_audit.sh. - F4: awk field-equality replaces regex-with-dots in Phase 3b. - F5: git-tracked .pyc removed (worse than reported — it was in the repo, not just the kit); __pycache__ gitignored; round-4 kit ships a corpus MANIFEST.sha256 + pinned commit (also GPT's governance condition). check.sh exit 0, ATTESTATION GREEN; selftest exit 0, 9/9 + control. Live LTL untouched (12 leaves, bcd15f9d…); attestation still gated on ePrint decision + author review + explicit operator order. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 13:07:57 +00:00
assert (tl, dl) == (LIED_PIN_TOTAL, LIED_PIN_DIV), (tl, dl)
print(f" PINNED: inclusion={ti} (230,271) consistency={tc} (230,016) lied-sizes={tl}/{dl}")
print("=== FIDELITY GREEN: agreement over the pinned case families "
"(not extensional equality; KNOWN-GAPS gap 14) ===")
if __name__ == "__main__":
main()