Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The outdated-version condition as height thresholds

Proved
BitcoinHeader.versionOutdated_iff

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

bitcoinbitcoin-mainnetblock-headerconsensusformal-verificationmedian-time-past

For every version vvv and previous height ppp, versionOutdated(v,p)\mathrm{versionOutdated}(v, p)versionOutdated(v,p) holds exactly when

(v<2∧227,931≤p+1)  ∨  (v<3∧363,725≤p+1)  ∨  (v<4∧388,381≤p+1),(v < 2 \wedge 227{,}931 \le p + 1) \;\vee\; (v < 3 \wedge 363{,}725 \le p + 1) \;\vee\; (v < 4 \wedge 388{,}381 \le p + 1),(v<2∧227,931≤p+1)∨(v<3∧363,725≤p+1)∨(v<4∧388,381≤p+1),

the BIP34, BIP66 and BIP65 version floors at their mainnet activation heights.

Preamble
import Definitions.Def_BitcoinHeader
Formal statement
theorem BitcoinHeader.versionOutdated_iff (version : Int) (prevHeight : Nat) :
    BitcoinHeader.versionOutdated version prevHeight = true ↔
      (version < 2 ∧ BitcoinHeader.BIP34Height ≤ prevHeight + 1) ∨
      (version < 3 ∧ BitcoinHeader.BIP66Height ≤ prevHeight + 1) ∨
      (version < 4 ∧ BitcoinHeader.BIP65Height ≤ prevHeight + 1) := by sorry
Source
Bitcoin Core a773e1e33b349dc819b5a0edc1c7a4839dc73b48: CBlockIndex::GetMedianTimePast and nMedianTimeSpan, MAX_FUTURE_BLOCK_TIME, src/chain.h: https://github.com/bitcoin/bitcoin/blob/a773e1e33b349dc819b5a0edc1c7a4839dc73b48/src/chain.h; ContextualCheckBlockHeader, src/validation.cpp (lines 4091-4128): https://github.com/bitcoin/bitcoin/blob/a773e1e33b349dc819b5a0edc1c7a4839dc73b48/src/validation.cpp; DeploymentActiveAfter (buried), src/deploymentstatus.h; BIP34Height, BIP66Height, BIP65Height in CMainParams, src/kernel/chainparams.cpp
Read-back

What the Lean code literally says, in plain math · claude-fable-5-1 (independent sub-agent, blind: Lean code + auditor instructions only)

For every integer vvv (named version; any integer, including negative values and values exceeding 2312^{31}231) and every natural number ppp (named prevHeight), the statement asserts a logical equivalence ("if and only if") between, on one side, the Boolean-valued function versionOutdated(v,p)\mathrm{versionOutdated}(v, p)versionOutdated(v,p) evaluating to the Boolean true, and, on the other side, the proposition

(v<2  ∧  227931≤p+1)  ∨  (v<3  ∧  363725≤p+1)  ∨  (v<4  ∧  388381≤p+1),\bigl(v < 2 \;\wedge\; 227931 \le p + 1\bigr) \;\vee\; \bigl(v < 3 \;\wedge\; 363725 \le p + 1\bigr) \;\vee\; \bigl(v < 4 \;\wedge\; 388381 \le p + 1\bigr),(v<2∧227931≤p+1)∨(v<3∧363725≤p+1)∨(v<4∧388381≤p+1),

where 227931227931227931, 363725363725363725, 388381388381388381 are the constants BIP34Height, BIP66Height, BIP65Height, the comparisons v<2v < 2v<2, v<3v < 3v<3, v<4v < 4v<4 are integer comparisons, and p+1p + 1p+1 is natural-number addition (no overflow). Unfolding the definition, versionOutdated(v,p)\mathrm{versionOutdated}(v, p)versionOutdated(v,p) is the Boolean "or" of three Boolean "and"s: (v<2v < 2v<2 and activeAfter(p,227931)\mathrm{activeAfter}(p, 227931)activeAfter(p,227931)), (v<3v < 3v<3 and activeAfter(p,363725)\mathrm{activeAfter}(p, 363725)activeAfter(p,363725)), (v<4v < 4v<4 and activeAfter(p,388381)\mathrm{activeAfter}(p, 388381)activeAfter(p,388381)), where activeAfter(p,d)\mathrm{activeAfter}(p, d)activeAfter(p,d) is the Boolean that is true exactly when d≤p+1d \le p + 1d≤p+1. So the statement says: the Boolean computation returns true exactly when the corresponding proposition, with each Boolean test replaced by the inequality it decides, holds; and (by the "only if" direction) returns false exactly when that proposition fails. The equivalence is a two-way statement about a Boolean versus a proposition, with no further hypotheses. Note, as a consequence of the shape of the right-hand side, that it holds for every negative vvv whenever p≥227930p \ge 227930p≥227930, and fails for every p≤227929p \le 227929p≤227929 and for every v≥4v \ge 4v≥4.

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