Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Sequence locks are verified exactly from CSV activation

Proved
BitcoinActivation.lockTimeFlags_eq

by pitimespi · Oct 26, 2026 · Mathlib 0df444a (Lean v4.33.1)

bitcoinbitcoin-mainnetconsensusformal-verificationscript-flagssoft-fork-activation

For every height hhh, lockTimeFlags(h)(h)(h) is LOCKTIME_VERIFY_SEQUENCE when 419,328≤h419{,}328 \le h419,328≤h and 000 otherwise: BIP68 relative locks are enforced from the CSV activation height on.

Preamble
import Definitions.Def_BitcoinActivation
Formal statement
theorem BitcoinActivation.lockTimeFlags_eq (height : Nat) :
    BitcoinActivation.lockTimeFlags height =
      if 419328 ≤ height then BitcoinActivation.LOCKTIME_VERIFY_SEQUENCE else 0 := by sorry
Source
Bitcoin Core a773e1e33b349dc819b5a0edc1c7a4839dc73b48: GetBlockScriptFlags, src/validation.cpp lines 2249-2288: https://github.com/bitcoin/bitcoin/blob/a773e1e33b349dc819b5a0edc1c7a4839dc73b48/src/validation.cpp#L2249; DeploymentActiveAt / DeploymentActiveAfter (buried), src/deploymentstatus.h; BuriedDeployment and DeploymentHeight, src/consensus/params.h; CMainParams BIP34Height, BIP65Height, BIP66Height, CSVHeight, SegwitHeight, script_flag_exceptions, src/kernel/chainparams.cpp; LOCKTIME_VERIFY_SEQUENCE, src/consensus/consensus.h; nLockTimeFlags in ConnectBlock, src/validation.cpp line 2478
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: BitcoinActivation.lockTimeFlags_eq

Binders. Universally quantified over one natural number h∈Nh \in \mathbb{N}h∈N ("height"), with no hypotheses: every hhh, including h=0h = 0h=0, is covered.

Conclusion. An equality of natural numbers:

lockTimeFlags(h)  =  {LOCKTIME_VERIFY_SEQUENCEif 419328≤h,0otherwise (i.e. if h<419328).\mathsf{lockTimeFlags}(h) \;=\; \begin{cases} \mathsf{LOCKTIME\_VERIFY\_SEQUENCE} & \text{if } 419328 \le h,\\ 0 & \text{otherwise (i.e. if } h < 419328). \end{cases}lockTimeFlags(h)={LOCKTIME_VERIFY_SEQUENCE0​if 419328≤h,otherwise (i.e. if h<419328).​

The right-hand side is a case split on the decidable proposition 419328≤h419328 \le h419328≤h (non-strict, so h=419328h = 419328h=419328 falls in the first branch), written with the numeral 419328419328419328 directly rather than through any named height. The constant LOCKTIME_VERIFY_SEQUENCE\mathsf{LOCKTIME\_VERIFY\_SEQUENCE}LOCKTIME_VERIFY_SEQUENCE is, by its definition, the natural number 111; so the right-hand side is 111 when 419328≤h419328 \le h419328≤h and 000 otherwise.

Unfolding the left-hand side. By definition,

lockTimeFlags(h)={LOCKTIME_VERIFY_SEQUENCE=1if activeAt(h,csv)=true,0otherwise,\mathsf{lockTimeFlags}(h) = \begin{cases} \mathsf{LOCKTIME\_VERIFY\_SEQUENCE} = 1 & \text{if } \mathsf{activeAt}(h, \mathsf{csv}) = \mathsf{true},\\ 0 & \text{otherwise}, \end{cases}lockTimeFlags(h)={LOCKTIME_VERIFY_SEQUENCE=10​if activeAt(h,csv)=true,otherwise,​

where activeAt(h,csv)\mathsf{activeAt}(h, \mathsf{csv})activeAt(h,csv) is the Boolean truth value of deploymentHeight(csv)≤h\mathsf{deploymentHeight}(\mathsf{csv}) \le hdeploymentHeight(csv)≤h, and deploymentHeight(csv)=419328\mathsf{deploymentHeight}(\mathsf{csv}) = 419328deploymentHeight(csv)=419328. The left side's branch condition is thus a Boolean (the activation test for the label csv\mathsf{csv}csv used as a condition), while the right side's branch condition is the proposition 419328≤h419328 \le h419328≤h written out numerically.

What the statement asserts, concretely. For every natural hhh, the number produced by lockTimeFlags\mathsf{lockTimeFlags}lockTimeFlags (which is always 000 or 111) coincides with the number given by the explicit case split at the threshold 419328419328419328. It is an equality of natural numbers, not a logical equivalence, and it mentions no other deployment label and no record of script flags.

Human review
  • Endorsed by Shuze Chen · Oct 26, 2026

    Confirmed by the moderator at approval.

  • Endorsed by pitimespi · Oct 26, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me