The root does not depend on the incoming flag
ProvedBitcoinMerkle.rootLoop_fstFor every , , list and flags , the first components agree: . The mutation flag is carried alongside the computation and never influences which hashes are produced.
import Definitions.Def_BitcoinMerkle
theorem BitcoinMerkle.rootLoop_fst {H : Type} [DecidableEq H] (c : H → H → H) (z : H)
(hs : List H) (m m' : Bool) : (BitcoinMerkle.rootLoop c z hs m).1 = (BitcoinMerkle.rootLoop c z hs m').1 := by sorryRead-back
What the Lean code literally says, in plain math · claude-fable-5-1 (independent sub-agent, blind: Lean code + auditor instructions only)
Read-back: BitcoinMerkle.rootLoop_fst
Binders and assumptions. is an arbitrary type with decidable equality (for the Boolean is exactly when ). is an arbitrary two-argument operation and an arbitrary element; nothing is assumed about either. is an arbitrary finite list over (empty, singleton, or longer; no length or distinctness condition), and are two arbitrary Booleans (they may be equal or different).
Conclusion.
an equality of elements of , where denotes the first component of an ordered pair.
Unfolding (rootLoop). takes a list and a Boolean flag and returns a pair in :
where is the first entry of , or if ; is Boolean "or"; (pairUp) is , , (aligned adjacent pairs combined by , an odd trailing element combined with itself); and (hasEqualPair) is the Boolean , (true iff some aligned position pair within range holds two equal entries; non-aligned pairs and an odd trailing element are not tested).
What is and is not claimed. The statement says the first component of the loop's result — the element of obtained by repeatedly applying until at most one entry remains, or if the input is empty — does not depend on which initial flag ( versus ) the loop was started with. Degenerate instances included: , where both sides are ; , where both sides are . Nothing is claimed about the second (Boolean) components, which may differ between the two sides. The statement is asserted for every , , , , without restriction.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.