Before the BIP34 block can be an ancestor, the scan runs except at the two repeats
ProvedBitcoinUniqueness.scan_runs_earlybip30bip34bitcoinbitcoin-mainnetcoinbaseconsensusformal-verificationuniqueness
If the state has at most 227,931 headers and the block is not one of the two IsBIP30Repeat blocks at its height, then ScanRuns S b.
Preamble
import Definitions.Def_BitcoinUniqueness import Definitions.Def_BitcoinSer import Definitions.Def_BitcoinHeader open BitcoinUniqueness BitcoinSer BitcoinBlockV2
Formal statement
theorem BitcoinUniqueness.scan_runs_early (S : ChainState) (b : BitcoinSer.Block)
(h : S.headers.length ≤ BitcoinHeader.BIP34Height)
(hrep : BitcoinBlockV2.isBIP30Repeat S.nextHeight (BitcoinSer.headerHash b.header) = false) :
BitcoinUniqueness.ScanRuns S b := by sorrySource
Bitcoin Core a773e1e33b349dc819b5a0edc1c7a4839dc73b48: ConnectBlock (fEnforceBIP30, BIP34_IMPLIES_BIP30_LIMIT), ContextualCheckBlock (the BIP34 height push), src/validation.cpp: https://github.com/bitcoin/bitcoin/blob/a773e1e33b349dc819b5a0edc1c7a4839dc73b48/src/validation.cpp; CScript::push_int64, CScriptNum::serialize (script/script.h); BIP30, BIP34
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: BitcoinUniqueness.scan_runs_early
Statement. For every chain state (a list of headers and a ledger ) and every block , if
- (the length of the header list is at most the constant ), and
- , i.e. it is not the case that and the header hash of equals the fixed constant , and not the case that and the header hash of equals the fixed constant ,
then holds.
Formally, with and :
What ScanRuns says
is, by definition, with and (double-SHA-256 of the serialized header), which unfolds to
where holds iff or for two fixed 32-byte constants, and holds iff has an element at zero-based position (i.e. ) whose header hash equals a fixed 32-byte constant . The block enters only through .
Edge cases and scope
- The first hypothesis is stated on directly; by definition this is the same number as used inside .
- Under the header list has no element at position , so the test in the unfolded conclusion is false by the definition's "no such element" branch; the second hypothesis is exactly . The statement therefore asserts the first disjunct of the unfolded conclusion from hypotheses that are its two conjuncts (one of them in a syntactically different but definitionally equal form).
- (empty header list) is included; is included (the inequality is non-strict).
- No reachability or validity of or is assumed; the ledger and all header contents are arbitrary; the block enters only through its header hash.
- The statement says nothing about states with .
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.