BLOCK_TIME_FUTURE characterized
ProvedBitcoinBlock.futureTime_iffvalidate S b now = futureTime iff the proof of work holds, the parent is the tip, the bits are the required ones, the time exceeds the median time past, and .
Deprecated. Superseded by BitcoinBlockV2.futureTime_iff (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.
import Definitions.Def_BitcoinBlock import Definitions.Def_BitcoinSer
theorem BitcoinBlock.futureTime_iff (S : ChainState) (b : BitcoinSer.Block) (now : Int) :
BitcoinBlock.validate S b now = .futureTime ↔
BitcoinBlock.checkHeaderPow b.header = true ∧ b.header.prevBlock = S.tipHash ∧
BitVec.ofNat 32 b.header.bits = S.requiredBits ∧ S.mtp < (b.header.time : Int) ∧
now + MAX_FUTURE_BLOCK_TIME < (b.header.time : Int) := by sorryRead-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_iff
Binders
- : a chain state .
- : a serialized block (header, transaction list).
- .
There are no hypotheses.
Conclusion
with times compared as integers and = MAX_FUTURE_BLOCK_TIME .
Left side, unfolded
first computes ; if that outcome is accept it proceeds to , and , whose only possible outcomes are invalid or accept; if it is anything else, returns it unchanged. Hence exactly when , which by the ordered chain of tests happens exactly when:
- (little-endian value of the double-SHA256 of the serialized header the compact target decoded from , that compact word being non-negative, non-zero, non-overflowing and decoding to at most ) — otherwise invalid;
- (hash of the last header, or of the genesis header if has no headers) — otherwise missingPrev;
- , where is the bits field modulo and is the tip's bits unless , in which case the retarget from the time of the header at index (natural subtraction; genesis header default) — otherwise invalid;
- , i.e. , where is the sorted median (index ) of the at most most recent header times, default — otherwise invalid;
- — then futureTime.
The version-floor test comes after and is not reached.
Right side
Precisely the conjunction of the five conditions above, in the same terms.
Edge cases silently included
Empty header list (tip defaults to genesis, , median ); unbounded and (bits reduced modulo , time cast to unreduced); the transaction list of is irrelevant on both sides; the version field is irrelevant on both sides.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.