A push is never a proper prefix of another push
ProvedBitcoinUniqueness.pushBytes_prefixFor byte strings shorter than : if the canonical push of is a prefix of the canonical push of then . The first byte fixes the encoding class (direct, PUSHDATA1/2/4) and, with the length field, the length.
import Definitions.Def_BitcoinUniqueness import Definitions.Def_BitcoinSer import Definitions.Def_BitcoinSig open BitcoinUniqueness BitcoinSer BitcoinBlockV2
theorem BitcoinUniqueness.pushBytes_prefix (d d' : BitcoinSer.Bytes) (hd : d.length < 2 ^ 32) (hd' : d'.length < 2 ^ 32)
(h : (BitcoinSig.pushBytes d).isPrefixOf (BitcoinSig.pushBytes d') = true) : d = d' := 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: BitcoinUniqueness.pushBytes_prefix
Statement. For all byte strings and (finite lists of 8-bit words) such that
- and
- ,
if is a prefix (initial segment, possibly the whole string) of , then .
Formally:
where means for some byte string .
What pushBytes says
For a byte string with length :
where and write as one byte (reduced modulo 256, which is lossless in those branches), and is the -byte little-endian encoding of . In the last branch the length is encoded modulo ; the hypotheses make that encoding lossless.
Edge cases and scope
- : ; the claim then says no non-empty (of length below ) has a push beginning with the byte .
- The prefix relation is reflexive, so trivially satisfies the hypothesis; the content is the converse direction only.
- The two length bounds are hypotheses on the claim's scope; is defined for every byte string. The theorem says nothing about strings of length .
- The statement concerns only the canonical push encoding of two byte strings; no script parsing, block or chain state is involved.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.