Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The height-gated flags activate in a fixed order

Proved
BitcoinActivation.flags_order

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

bitcoinbitcoin-mainnetconsensusformal-verificationscript-flagssoft-fork-activation

For every height, in the flags of an ordinary block: CHECKLOCKTIMEVERIFY implies DERSIG, CHECKSEQUENCEVERIFY implies CHECKLOCKTIMEVERIFY, and NULLDUMMY implies CHECKSEQUENCEVERIFY — the order 363,725<388,381<419,328<481,824363{,}725 < 388{,}381 < 419{,}328 < 481{,}824363,725<388,381<419,328<481,824 of the activation heights.

Preamble
import Definitions.Def_BitcoinActivation
Formal statement
theorem BitcoinActivation.flags_order (height : Nat) :
    let f := BitcoinActivation.blockScriptFlags height .none
    (f.cltv = true → f.dersig = true) ∧ (f.csv = true → f.cltv = true) ∧
    (f.nulldummy = true → f.csv = true) := 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.flags_order

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.

Local abbreviation in the statement. The conclusion first introduces a local name: let

f:=blockScriptFlags(h,none),f := \mathsf{blockScriptFlags}(h, \mathsf{none}),f:=blockScriptFlags(h,none),

a seven-field Boolean record (fields in order p2sh,witness,taproot,dersig,cltv,csv,nulldummy\mathsf{p2sh}, \mathsf{witness}, \mathsf{taproot}, \mathsf{dersig}, \mathsf{cltv}, \mathsf{csv}, \mathsf{nulldummy}p2sh,witness,taproot,dersig,cltv,csv,nulldummy). Here none\mathsf{none}none is a constructor of the three-element type ScriptException={none,bip16Block,taprootBlock}\mathsf{ScriptException} = \{\mathsf{none}, \mathsf{bip16Block}, \mathsf{taprootBlock}\}ScriptException={none,bip16Block,taprootBlock}, not an "absent" option value. The abbreviation fff is part of the statement itself (a let-binding inside the proposition), not a separate hypothesis; it is merely a name for the record above.

Conclusion. The conjunction of three one-directional implications about fields of fff:

(f.cltv=true⇒f.dersig=true)  ∧  (f.csv=true⇒f.cltv=true)  ∧  (f.nulldummy=true⇒f.csv=true).(f.\mathsf{cltv} = \mathsf{true} \Rightarrow f.\mathsf{dersig} = \mathsf{true}) \;\land\; (f.\mathsf{csv} = \mathsf{true} \Rightarrow f.\mathsf{cltv} = \mathsf{true}) \;\land\; (f.\mathsf{nulldummy} = \mathsf{true} \Rightarrow f.\mathsf{csv} = \mathsf{true}).(f.cltv=true⇒f.dersig=true)∧(f.csv=true⇒f.cltv=true)∧(f.nulldummy=true⇒f.csv=true).

Each implication is between propositions of the form "this Boolean field equals true\mathsf{true}true". Nothing is asserted about the fields p2sh\mathsf{p2sh}p2sh, witness\mathsf{witness}witness, taproot\mathsf{taproot}taproot, and nothing in the reverse directions (e.g. it is not claimed that f.dersig=truef.\mathsf{dersig} = \mathsf{true}f.dersig=true implies f.cltv=truef.\mathsf{cltv} = \mathsf{true}f.cltv=true).

Unfolding fff. blockScriptFlags(h,none)\mathsf{blockScriptFlags}(h, \mathsf{none})blockScriptFlags(h,none) starts from exceptionBase(none)=baseFlags=⟨T,T,T,F,F,F,F⟩\mathsf{exceptionBase}(\mathsf{none}) = \mathsf{baseFlags} = \langle \mathsf{T},\mathsf{T},\mathsf{T},\mathsf{F},\mathsf{F},\mathsf{F},\mathsf{F}\rangleexceptionBase(none)=baseFlags=⟨T,T,T,F,F,F,F⟩, keeps the first three fields, and sets the last four by Boolean OR with activation tests, so

f=⟨T, T, T, [ 363725≤h ], [ 388381≤h ], [ 419328≤h ], [ 481824≤h ]⟩,f = \big\langle \mathsf{T},\ \mathsf{T},\ \mathsf{T},\ [\,363725 \le h\,],\ [\,388381 \le h\,],\ [\,419328 \le h\,],\ [\,481824 \le h\,]\big\rangle,f=⟨T, T, T, [363725≤h], [388381≤h], [419328≤h], [481824≤h]⟩,

where [ P ][\,P\,][P] is the Boolean truth value of the decidable inequality PPP (the four thresholds are the tabulated heights of derSig\mathsf{derSig}derSig, cltv\mathsf{cltv}cltv, csv\mathsf{csv}csv, segwit\mathsf{segwit}segwit respectively). Concretely the statement therefore says, for every natural hhh:

  • if 388381≤h388381 \le h388381≤h then 363725≤h363725 \le h363725≤h (as Booleans equal to true\mathsf{true}true);
  • if 419328≤h419328 \le h419328≤h then 388381≤h388381 \le h388381≤h;
  • if 481824≤h481824 \le h481824≤h then 419328≤h419328 \le h419328≤h.

Only the exception label none\mathsf{none}none is involved; the statement says nothing about bip16Block\mathsf{bip16Block}bip16Block or taprootBlock\mathsf{taprootBlock}taprootBlock, and nothing about lockTimeFlags\mathsf{lockTimeFlags}lockTimeFlags or activeAfter\mathsf{activeAfter}activeAfter.

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