The sequence-lock fold enforces exactly the input constraints
ProvedBitcoinBIP68.fold_acceptanceLet be any natural-number height, let be any clock function, let be any finite input list, and let be any accumulator with two integer bounds and any auxiliary height list. Write for the left-to-right Core input fold, and for the declarative input condition: an input is disabled, or its selected height/time delay has elapsed. Evaluation means that both stored bounds are strictly below and , respectively. Then
There are no range, positivity, clock-monotonicity, or ancestor-height hypotheses in this mathematical fold contract. In particular, the initial accumulator need not be the sentinel state. The empty list gives the identity case. This result characterizes accumulation of both kinds of relative delay without assuming they are already satisfied.
import Definitions.Def_BIP68_Model import Definitions.Def_BIP68_Core
theorem BitcoinBIP68.fold_acceptance (ctx : BitcoinBIP68.Context)
(acc : BitcoinBIP68.Accumulator) (inputs : List BitcoinBIP68.Input) :
BitcoinBIP68.evaluate ctx (inputs.foldl (BitcoinBIP68.coreStep ctx) acc) = true ↔
BitcoinBIP68.evaluate ctx acc = true ∧
∀ input ∈ inputs, BitcoinBIP68.inputSatisfied ctx input := by sorryRead-back
What the Lean code literally says, in plain math · GPT-6 (Codex independent sub-agent)
Read-back: BitcoinBIP68.fold_acceptance
For every natural number , every function , every accumulator consisting of two arbitrary integers and an arbitrary finite list of natural numbers, and every finite list of inputs, each input consisting of a 32-bit sequence and a natural-number coin height , the following equivalence holds. Write for the unsigned natural-number value of an input's sequence, and process the inputs from left to right, starting with . At each input, if the bitwise intersection of its sequence with is nonzero, leave both integer bounds unchanged and prepend to the current list. Otherwise, if its bitwise intersection with is nonzero, replace the current time bound by , leave the height bound unchanged, and prepend to the current list, where is the unsigned natural-number value obtained by intersecting the 32-bit sequence with and shifting the resulting 32-bit vector left by nine positions. In the remaining case, replace the current height bound by , leave the time bound unchanged, and prepend to the current list, where is the unsigned natural-number value of the sequence intersected with . The additions and subtraction by in these bound updates are integer operations, after converting natural numbers to integers. Denote the two bounds after all inputs by . Then and hold if and only if both initial inequalities and hold and, for every input occurring in the list, either , or the following conditional inequality holds: when , it is ; otherwise, it is . These latter inequalities use natural-number arithmetic. The two predecessor arguments of use natural subtraction, so height zero gives argument zero. All choices of , , initial accumulator, and input list are included: there is no positivity or upper-bound assumption on heights, no bound or monotonicity assumption on , no requirement that coin heights be at most , and no requirement that the initial bounds equal or the initial list be empty. The list component does not enter either side's bound comparisons. For the empty input list, the resulting accumulator is the initial accumulator and the condition on all inputs is vacuous.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.