ltl-accumulator-verified/verification/Proofs/Refactor.lean
mrwulf 406750887f S5.3 Fable re-audit: machine-verify the ConsRec base refactor (permanent artifact)
Re-derived S5.3 (all done under an Opus switch) from zero. consRecBinding
STATEMENT re-confirmed faithful to paper Thm 3 steps 1-2 (y=MTH D₁ = the
hash-fold condition; some=>collision / none=>x=MTH(D₁.take n₀) = the two
Lemma-2 outcomes); non-vacuous (some-branch is a SPECIFIC-pair IsCollision,
not pigeonhole-provable; none-branch a real equality needing hcons).

FINDING + FIX: Opus changed ConsRec's base definition (list-match →
decidable if) with only 'recompiled clean' as evidence — a definition
that mirrors the deployed verifier. Now machine-checked: consRec_base_
false_eq / consRec_base_true_eq prove the decidable-if base EQUALS the
exact list-match forms it replaced. Kept as PERMANENT cone-audited
theorems (F1 discipline: keep the evidence), not a throwaway probe.

QUEUED for S5.4: extractCons_correct (Theorem 3 endpoint) MUST carry a
permanent non-vacuity witness like extractIncl_nonvacuous/extractMTH_
nonvacuous. S7 must re-confirm the NEW ConsRec base vs Python.

26 certs green. LTL untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 19:25:04 +02:00

27 lines
1.1 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/- S5.3 Fable re-audit artifact (permanent, not a throwaway probe): the
S5.3 change of ConsRec's base from list-match to decidable `if` must be
SEMANTICS-PRESERVING — Opus's only evidence was "the chain recompiled".
These two theorems machine-check the equivalence against the exact
list-match forms that were replaced, so the refactor's faithfulness is
a permanent, cone-audited guarantee. -/
import Proofs.Basic
namespace LTLAcc
/-- b=false base: decidable-if form = the original `[s]` list-match. -/
theorem consRec_base_false_eq (C : List Hash) :
(if C.length = 1 then some ((C.getLastD default, C.getLastD default) : Hash × Hash) else none)
= (match C with | [s] => some (s, s) | _ => none) := by
cases C with
| nil => rfl
| cons a t => cases t with | nil => rfl | cons b u => simp
/-- b=true base: decidable-if form = the original `[]` list-match. -/
theorem consRec_base_true_eq (C : List Hash) (r : Hash) :
(if C = [] then some ((r, r) : Hash × Hash) else none)
= (match C with | [] => some (r, r) | _ => none) := by
cases C with
| nil => rfl
| cons a t => rfl
end LTLAcc