Sequence-lock calculation preserves exactly the relevant heights
ProvedBitcoinBIP68.height_vectorFor any unsigned 32-bit version and flags, any context, and any finite input list , let mean that version is at least two and flags bit zero is set. After calculation, the returned height list has the original length and order and satisfies
This is equality of ordered lists, including repeated entries. If enforcement is off, every input height is unchanged even when its sequence-disable bit is set. The theorem imposes no admissibility or no-overflow assumption on the mathematical model and includes the empty list. It records the height-vector side effect separately from acceptance.
import Definitions.Def_BIP68_Model import Definitions.Def_BIP68_Core
theorem BitcoinBIP68.height_vector (version flags : BitVec 32)
(ctx : BitcoinBIP68.Context) (inputs : List BitcoinBIP68.Input) :
BitcoinBIP68.returnedHeights (BitcoinBIP68.calculate version flags ctx inputs) =
BitcoinBIP68.expectedHeights version flags inputs := by sorryRead-back
What the Lean code literally says, in plain math · GPT-6 (Codex independent sub-agent)
For every pair of 32-bit bit vectors and , every context consisting of a natural number and an arbitrary function , and every finite ordered list of inputs , where each is a 32-bit bit vector and each is a natural number, the following calculation returns the list whose th entry is if the unsigned value of is at least , the unsigned value of is odd, and , and is otherwise. The calculation uses an accumulator with two integer fields and a list of natural numbers, initially . It is enabled precisely when the unsigned value of is at least and bitwise AND of with the 32-bit value is nonzero. When enabled, it processes the inputs from left to right: if bitwise AND of with is nonzero, it prepends to and leaves unchanged; otherwise, it prepends to and, if bitwise AND of with is nonzero, replaces by while leaving unchanged, and if that bitwise AND is zero, replaces by while leaving unchanged. Here is the unsigned value of the bitwise AND of with ; the term is obtained by shifting that masked 32-bit vector left by bits and taking its unsigned value, with no truncation of nonzero bits for these masked values. All additions and final subtractions in the accumulator updates are integer operations after converting the natural quantities to integers, whereas the argument of uses natural-number subtraction and is when . When the calculation is not enabled, it leaves and sets to the reverse of the input list of coin heights . Its returned list is the reverse of the final . The asserted equality is equality of ordered lists, including repeated entries, and applies to the empty input list, in which case both lists are empty. There are no hypotheses restricting , , the coin heights, or the bit vectors: in particular and coin heights may be zero, coin heights need not be bounded by , and no monotonicity or upper bound is imposed on .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.