Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Soft forks only add script rules

Proved
BitcoinActivation.flags_mono

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

bitcoinbitcoin-mainnetconsensusformal-verificationscript-flagssoft-fork-activation

For all heights h1≤h2h_1 \le h_2h1​≤h2​, every script-verification flag enforced for an ordinary block at height h1h_1h1​ is enforced at height h2h_2h2​:

blockScriptFlags(h1,none)⊆blockScriptFlags(h2,none),\mathrm{blockScriptFlags}(h_1, \mathrm{none}) \subseteq \mathrm{blockScriptFlags}(h_2, \mathrm{none}),blockScriptFlags(h1​,none)⊆blockScriptFlags(h2​,none),

where inclusion is pointwise over the seven flags P2SH, WITNESS, TAPROOT, DERSIG, CHECKLOCKTIMEVERIFY, CHECKSEQUENCEVERIFY, NULLDUMMY, and blockScriptFlags is the transcription of GetBlockScriptFlags at mainnet heights.

This is the structural content of buried deployments: the ruleset in force is a non-decreasing function of height, so "the rules at height hhh" is well defined and a rule, once enforced, is never relaxed for ordinary blocks. The two hash-keyed exception blocks are the only departures, and are covered by separate theorems.

Preamble
import Definitions.Def_BitcoinActivation
Formal statement
theorem BitcoinActivation.flags_mono (h₁ h₂ : Nat) (h : h₁ ≤ h₂) :
    BitcoinActivation.ScriptFlags.le (BitcoinActivation.blockScriptFlags h₁ .none)
      (BitcoinActivation.blockScriptFlags h₂ .none) := 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_mono

Binders and hypothesis. Universally quantified over two natural numbers h1,h2∈Nh_1, h_2 \in \mathbb{N}h1​,h2​∈N ("heights"), with the single hypothesis

h1≤h2h_1 \le h_2h1​≤h2​

(non-strict; h1=h2h_1 = h_2h1​=h2​ is allowed, and h1=0h_1 = 0h1​=0 is allowed).

Conclusion. The proposition

le(blockScriptFlags(h1,none), blockScriptFlags(h2,none)),\mathsf{le}\big(\mathsf{blockScriptFlags}(h_1, \mathsf{none}),\ \mathsf{blockScriptFlags}(h_2, \mathsf{none})\big),le(blockScriptFlags(h1​,none), blockScriptFlags(h2​,none)),

where 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), and le\mathsf{le}le is the custom relation on seven-field Boolean records. Writing a=blockScriptFlags(h1,none)a = \mathsf{blockScriptFlags}(h_1, \mathsf{none})a=blockScriptFlags(h1​,none) and b=blockScriptFlags(h2,none)b = \mathsf{blockScriptFlags}(h_2, \mathsf{none})b=blockScriptFlags(h2​,none), the conclusion unfolds to the conjunction of seven one-directional implications, one per field in the 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:

(a.p2sh=true⇒b.p2sh=true)∧(a.witness=true⇒b.witness=true)∧(a.taproot=true⇒b.taproot=true)∧(a.dersig=true⇒b.dersig=true)∧(a.cltv=true⇒b.cltv=true)∧(a.csv=true⇒b.csv=true)∧(a.nulldummy=true⇒b.nulldummy=true).\begin{aligned} &(a.\mathsf{p2sh} = \mathsf{true} \Rightarrow b.\mathsf{p2sh} = \mathsf{true}) \land (a.\mathsf{witness} = \mathsf{true} \Rightarrow b.\mathsf{witness} = \mathsf{true}) \land (a.\mathsf{taproot} = \mathsf{true} \Rightarrow b.\mathsf{taproot} = \mathsf{true}) \land\\ &(a.\mathsf{dersig} = \mathsf{true} \Rightarrow b.\mathsf{dersig} = \mathsf{true}) \land (a.\mathsf{cltv} = \mathsf{true} \Rightarrow b.\mathsf{cltv} = \mathsf{true}) \land (a.\mathsf{csv} = \mathsf{true} \Rightarrow b.\mathsf{csv} = \mathsf{true}) \land (a.\mathsf{nulldummy} = \mathsf{true} \Rightarrow b.\mathsf{nulldummy} = \mathsf{true}). \end{aligned}​(a.p2sh=true⇒b.p2sh=true)∧(a.witness=true⇒b.witness=true)∧(a.taproot=true⇒b.taproot=true)∧(a.dersig=true⇒b.dersig=true)∧(a.cltv=true⇒b.cltv=true)∧(a.csv=true⇒b.csv=true)∧(a.nulldummy=true⇒b.nulldummy=true).​

Each implication is between propositions "this Boolean field equals true\mathsf{true}true"; nothing is asserted when a field of aaa is false\mathsf{false}false, and nothing in the reverse direction.

Unfolding the two records. For any height hhh, 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 OR-s the last four with activation tests, giving

blockScriptFlags(h,none)=⟨T, T, T, [ 363725≤h ], [ 388381≤h ], [ 419328≤h ], [ 481824≤h ]⟩,\mathsf{blockScriptFlags}(h, \mathsf{none}) = \big\langle \mathsf{T},\ \mathsf{T},\ \mathsf{T},\ [\,363725 \le h\,],\ [\,388381 \le h\,],\ [\,419328 \le h\,],\ [\,481824 \le h\,]\big\rangle,blockScriptFlags(h,none)=⟨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. So the statement says: whenever h1≤h2h_1 \le h_2h1​≤h2​, the first three implications hold between true\mathsf{true}true and true\mathsf{true}true, and for each threshold t∈{363725,388381,419328,481824}t \in \{363725, 388381, 419328, 481824\}t∈{363725,388381,419328,481824}, if [ t≤h1 ]=true[\,t \le h_1\,] = \mathsf{true}[t≤h1​]=true then [ t≤h2 ]=true[\,t \le h_2\,] = \mathsf{true}[t≤h2​]=true.

What is not said. Only the exception label none\mathsf{none}none appears; the statement says nothing about bip16Block\mathsf{bip16Block}bip16Block or taprootBlock\mathsf{taprootBlock}taprootBlock. It does not assert the reverse inclusion, nor equality, nor anything about h1>h2h_1 > h_2h1​>h2​.

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