Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

A future-time rejection is transient

Proved
BitcoinBlock.futureTime_transient

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

bip30bip34bitcoinbitcoin-mainnetblock-validationconnectblockconsensusformal-verificationundo

If validate S b now = futureTime, then for every now′≥time−7200now' \ge time - 7200now′≥time−7200 the outcome is not futureTime, and it equals the outcome at clock time−7200time - 7200time−7200: the block is not permanently invalidated by its time.

Deprecated. Superseded by BitcoinBlockV2.futureTime_transient (revision 2 of the block mission): the p2shSigOpCount of this revision counted every push of scriptSig instead of only the redeem script, over-counting P2SH sigops; the V2 declarations carry the corrected definition.

Preamble
import Definitions.Def_BitcoinBlock
import Definitions.Def_BitcoinSer
Formal statement
theorem BitcoinBlock.futureTime_transient (S : ChainState) (b : BitcoinSer.Block) (now : Int)
    (h : BitcoinBlock.validate S b now = .futureTime) (now' : Int)
    (hle : (b.header.time : Int) ≤ now' + MAX_FUTURE_BLOCK_TIME) :
    BitcoinBlock.validate S b now' ≠ .futureTime ∧
    BitcoinBlock.validate S b now' = BitcoinBlock.validate S b ((b.header.time : Int) - MAX_FUTURE_BLOCK_TIME) := by sorry
Source
Bitcoin Core a773e1e33b349dc819b5a0edc1c7a4839dc73b48: AcceptBlockHeader, CheckBlockHeader, ContextualCheckBlockHeader, CheckBlock, CheckMerkleRoot, CheckWitnessMalleation, ContextualCheckBlock, ConnectBlock, GetBlockScriptFlags, IsBIP30Repeat, IsBIP30Unspendable, UpdateCoins, DisconnectBlock, ApplyTxInUndo, src/validation.cpp: https://github.com/bitcoin/bitcoin/blob/a773e1e33b349dc819b5a0edc1c7a4839dc73b48/src/validation.cpp; CheckTransaction (consensus/tx_check.cpp); IsFinalTx, GetLegacySigOpCount, GetP2SHSigOpCount, GetTransactionSigOpCost, CheckTxInputs (consensus/tx_verify.cpp); CScript::GetSigOpCount, IsUnspendable (script/script.cpp, script.h); CountWitnessSigOps (script/interpreter.cpp); AddCoin, SpendCoin, AddCoins (coins.cpp); GetBlockProof (chain.cpp); GetWitnessCommitmentIndex, GetBlockWeight (consensus/validation.h); CMainParams (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)

Read-back: BitcoinBlock.futureTime_transient

Binders and hypotheses

  • SSS : a chain state; bbb : a serialized block; now∈Z\mathit{now} \in \mathbb{Z}now∈Z.
  • Hypothesis hhh : validate(S,b,now)=futureTime\mathrm{validate}(S, b, \mathit{now}) = \mathrm{futureTime}validate(S,b,now)=futureTime.
  • now′∈Z\mathit{now}' \in \mathbb{Z}now′∈Z : a second clock value.
  • Hypothesis hleh_{le}hle​ : b.header.time≤now′+7200b.\mathrm{header.time} \le \mathit{now}' + 7200b.header.time≤now′+7200 (time cast to Z\mathbb{Z}Z; 720072007200 = MAX_FUTURE_BLOCK_TIME).

Conclusion

A conjunction of two claims:

  1. validate(S,b,now′)≠futureTime\mathrm{validate}(S, b, \mathit{now}') \ne \mathrm{futureTime}validate(S,b,now′)=futureTime;
  2. validate(S,b,now′)=validate(S,b,b.header.time−7200)\mathrm{validate}(S, b, \mathit{now}') = \mathrm{validate}\big(S, b, b.\mathrm{header.time} - 7200\big)validate(S,b,now′)=validate(S,b,b.header.time−7200), an equality of outcomes (the four-constructor type accept/invalid/futureTime/missingPrev, where accept carries a state and an undo list, so equality of accept outcomes includes equality of those payloads).

What hhh says

By the structure of validate\mathrm{validate}validate (it returns the header outcome unchanged unless that is accept), hhh holds exactly when the header passes proof-of-work, has prevBlock\mathrm{prevBlock}prevBlock equal to the tip hash of SSS, has bits (modulo 2322^{32}232) equal to the required bits of SSS, has time strictly above the tip's median-time-past, and now+7200<b.header.time\mathit{now} + 7200 < b.\mathrm{header.time}now+7200<b.header.time.

What the conclusion says, unfolded

validate(S,b,t)\mathrm{validate}(S,b,t)validate(S,b,t) depends on the clock ttt only in the single test "t+7200<b.header.timet + 7200 < b.\mathrm{header.time}t+7200<b.header.time" of acceptHeader\mathrm{acceptHeader}acceptHeader, which yields futureTime when true. With the clock t=b.header.time−7200t = b.\mathrm{header.time} - 7200t=b.header.time−7200 that test reads b.header.time<b.header.timeb.\mathrm{header.time} < b.\mathrm{header.time}b.header.time<b.header.time, which is false. With the clock now′\mathit{now}'now′, under hleh_{le}hle​ the test is false as well. In both cases evaluation continues with the version-floor test (invalid if the version is below 222, 333 or 444 while 227931227931227931, 363725363725363725 or 388381388381388381 respectively is ≤tipHeight+1\le \mathrm{tipHeight}+1≤tipHeight+1), then checkBlock(b)\mathrm{checkBlock}(b)checkBlock(b) (invalid if false), contextualCheckBlock(S,b)\mathrm{contextualCheckBlock}(S,b)contextualCheckBlock(S,b) (invalid if false), then connectBlock(S,b)\mathrm{connectBlock}(S,b)connectBlock(S,b) (invalid if none, else accept(⟨S.headers+ ⁣ ⁣+[b.header],u⟩,undo)\mathrm{accept}(\langle S.\mathrm{headers} \mathbin{+\!\!+} [b.\mathrm{header}], u\rangle, \mathit{undo})accept(⟨S.headers++[b.header],u⟩,undo)). Claim 1 asserts the outcome at clock now′\mathit{now}'now′ is not futureTime; claim 2 asserts it coincides with the outcome at the boundary clock b.header.time−7200b.\mathrm{header.time} - 7200b.header.time−7200.

Edge cases silently included

hhh and hleh_{le}hle​ together force now<now′\mathit{now} < \mathit{now}'now<now′ but no such hypothesis is stated; now′\mathit{now}'now′ may be far in the future; the block's transactions enter only through the later checks; b.header.timeb.\mathrm{header.time}b.header.time is an unbounded natural cast to Z\mathbb{Z}Z, so b.header.time−7200b.\mathrm{header.time} - 7200b.header.time−7200 may be negative; if hhh is unsatisfiable for the given SSS and bbb the statement is vacuous.

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

    Confirmed by the moderator at approval.

  • Endorsed by pitimespi · Oct 27, 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