ltl-accumulator-verified/verification/gen/LTLAcc/HashExternal.lean
mrwulf eb3df7503f S3/L4-L5: root binding (Lemma 2, Path instance) + Theorem 2, constructive
The crux layer — the statement whose HAND proof once carried the frontier
coverage bug is now kernel-checked.

- gen: hash outputs refactored to Hash = {l : List UInt8 // l.length = 32}.
  MECHANIZATION FINDING: the paper's pair-coincidence step ('equal hnode
  values of distinct argument pairs are a collision') is load-bearing on
  FIXED-WIDTH outputs — with unconstrained byte strings x++s = X++Y does
  not split. hnode_preimage_inj (cone: propext) makes this explicit via
  List.append_inj on equal-length components. Queued as a half-sentence
  for the paper's next cycle.
- HasCollision := ∃ x y, x ≠ y ∧ sha256 x = sha256 y — appears ONLY as a
  conclusion, never a hypothesis (no collision-resistance assumed).
- hnode_inj_or_collision / hleaf_inj_or_collision: the per-node dichotomy.
- root_binding: any accepting reconstruction from (v,P) to the honest root
  either IS the honest receipt (leaf hash AND full path P = Path m D — case
  (ii) pinning every consumed sibling) or exhibits a collision. Motive
  quantifies (v,P); induction on Path; k-fold discipline.
- incl_sound (Theorem 2, position binding): accepting a wrong leaf at m
  yields a collision. Cone [propext, Classical.choice, LTLAcc.sha256,
  Quot.sound] — the single hash axiom, pinned in check.sh. ALL GREEN.

Also: Root n=1 branch changed from list-match to decidable 'if P = []'
(well-founded unfolding generated a spurious exhaustiveness obligation);
Root_one_cons added. Fable-5 statement-audit passed. LTL untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 13:21:17 +02:00

22 lines
914 B
Text

/- The single sanctioned axiom site of this corpus (mirrors the role of
gen/ in the *-ed25519-verified repos): SHA-256 as an opaque function
into 32-byte outputs. No properties are assumed of it — in particular
NOT collision resistance; the soundness theorems downstream are
constructive, they EXHIBIT two distinct preimages with equal image.
The fixed output WIDTH is part of the function's type, not an
assumption about its behavior: it is what makes hnode argument pairs
recoverable from preimages (the paper's "65-byte preimages"
parenthetical, made explicit). -/
namespace LTLAcc
/-- A 32-byte hash value. -/
def Hash : Type := { l : List UInt8 // l.length = 32 }
instance : Inhabited Hash := ⟨⟨List.replicate 32 0, by simp⟩⟩
instance : DecidableEq Hash := fun a b =>
decidable_of_iff (a.val = b.val) Subtype.ext_iff.symm
axiom sha256 : List UInt8 → Hash
end LTLAcc