ComputeTapbranchHash is symmetric
ProvedBitcoinTaproot.tapbranch_commFor all byte strings : tapbranchHash a b = tapbranchHash b a. The branch hash sorts its two children lexicographically, so the merkle path does not encode left/right.
import Definitions.Def_BitcoinTaproot open BitcoinTaproot BitcoinSer BitcoinSig BitcoinVerify open BitcoinScript hiding Bytes Byte
theorem BitcoinTaproot.tapbranch_comm (a b : Bytes) : BitcoinTaproot.tapbranchHash a b = BitcoinTaproot.tapbranchHash b a := by sorry
Read-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: BitcoinTaproot.tapbranch_comm
Binders. : byte strings (finite lists of 8-bit values).
Hypotheses. None.
Conclusion.
as an equality of byte strings, where, unfolded,
with the UTF-8 bytes of the tag string, and is the file's byte-wise lexicographic "strictly less" test: two empty strings are not less; an empty string is less than a non-empty one; a non-empty string is not less than an empty one; otherwise compare the first bytes as naturals, and on a tie recurse on the tails. SHA256 here is the bundle's own definition of SHA-256 on byte lists.
Edge cases the quantifiers include. (both sides hash ); or empty; a proper prefix of (then ); strings of arbitrary, unequal, non-32-byte lengths.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.