SequenceLocks is the BIP68 specification
ProvedBitcoinBlock.sequenceLocks_iffsequenceLocksOk u height mtp ltf tx = true iff the BIP68 mission's satisfiesBIP68 holds for the transaction's version, the lock-time flags, the context (height, median times) and the inputs' sequences and coin heights — with no admissibility hypothesis, through the published fold_acceptance.
Deprecated. Superseded by BitcoinBlockV2.sequenceLocks_iff (revision 2 of the block mission): the p2shSigOpCount of this revision counted every push of scriptSig instead of only the redeem script, over-counting P2SH sigops; the V2 declarations carry the corrected definition.
import Definitions.Def_BitcoinBlock import Definitions.Def_BitcoinSer
theorem BitcoinBlock.sequenceLocks_iff (u : Ledger) (height : Nat) (mtp : Nat → Nat) (ltf : Nat) (tx : BitcoinSer.Tx) :
BitcoinBlock.sequenceLocksOk u height mtp ltf tx = true ↔
BitcoinBIP68.satisfiesBIP68 (BitVec.ofNat 32 tx.version) (BitVec.ofNat 32 ltf) ⟨height, mtp⟩
(tx.vin.map fun i => ⟨BitVec.ofNat 32 i.nSequence, (BitcoinBlock.accessCoin u i.prevout).height⟩) := 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: BitcoinBlock.sequenceLocks_iff
Binders
- : a ledger (association list from outpoints to coins ).
- .
- : an arbitrary function (median time past by height).
- : the lock-time flags word.
- : a serialized transaction (version , inputs with sequence and prevout, outputs, lock time).
There are no hypotheses.
Conclusion
where , (both as 32-bit words), and is the list, in input order, of pairs ; returns the coin of the first ledger entry with that key, or the dummy coin (height , value ) if there is none.
Left side, unfolded
is from the BIP68 core transcription: compute an accumulator starting at (integers):
- if and bit of is set ("enabled"), fold over : for an input with sequence and coin height : if bit of is set, nothing changes (height is recorded); else if bit of is set, (natural subtraction in ; the shift is inside 32 bits, so it equals ); else ;
- if not enabled, the accumulator stays .
Then the result is (integers; natural subtraction in ).
Right side, unfolded
is the proposition: , or every input is satisfied, where is , and an input is satisfied when (disabled), or — if is odd (time-based) — , otherwise (all in with natural subtraction in and ).
Edge cases silently included
No admissibility or overflow hypotheses from the BIP68 model are assumed ( may be , coin heights may exceed , may be anything); makes and false when enabled with a non-disabled input; empty (left: and , true; right: vacuous); missing coins give height (so ); , and sequences are unbounded naturals truncated to 32 bits.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.