Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

A valid target times the clamped timespan never wraps around 2^256

Proved
BitcoinDifficulty.no_wrap

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

bitcoinbitcoin-mainnetconsensusdifficultyformal-verificationproof-of-workretargettimewarp

For t≤t \let≤ powLimit (2224−12^{224}-12224−1) and ts≤4,838,400ts \le 4{,}838{,}400ts≤4,838,400 (four times the target timespan): t⋅ts<2256t \cdot ts < 2^{256}t⋅ts<2256. The modular multiplication of arith_uint256 is exact on every valid input.

Preamble
import Definitions.Def_BitcoinDifficulty
import Definitions.Def_BitcoinPow
open BitcoinDifficulty BitcoinPow
Formal statement
theorem BitcoinDifficulty.no_wrap (t : Nat) (ht : t ≤ BitcoinPow.powLimit) (ts : Nat) (hts : ts ≤ 4838400) :
    t * ts < BitcoinPow.width := by sorry
Source
Bitcoin Core a773e1e33b349dc819b5a0edc1c7a4839dc73b48: CalculateNextWorkRequired, GetNextWorkRequired, src/pow.cpp: https://github.com/bitcoin/bitcoin/blob/a773e1e33b349dc819b5a0edc1c7a4839dc73b48/src/pow.cpp; arith_uint256::SetCompact/GetCompact (arith_uint256.cpp); 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: theorem BitcoinDifficulty.no_wrap

Statement

Binders (universally quantified).

  • ttt, a natural number;
  • sss, a natural number (named ts).

Hypotheses.

  • (ht) t≤L=2224−1t \le L = 2^{224} - 1t≤L=2224−1;
  • (hts) s≤4,838,400s \le 4{,}838{,}400s≤4,838,400 (a literal numeral in the statement; it equals 4T=4⋅1,209,6004T = 4 \cdot 1{,}209{,}6004T=4⋅1,209,600, the upper clamp value, but the statement writes the number, not the named constant).

Conclusion.

t⋅s  <  2256,t \cdot s \;<\; 2^{256},t⋅s<2256,

a strict inequality between natural numbers, where 22562^{256}2256 is the constant called width.

Definitions used

Constants (from the imported proof-of-work definitions).

  • W=2256W = 2^{256}W=2256 (the modulus called width).
  • L=2224−1L = 2^{224} - 1L=2224−1 (the value called powLimit).
  • T=14⋅24⋅60⋅60=1,209,600T = 14 \cdot 24 \cdot 60 \cdot 60 = 1{,}209{,}600T=14⋅24⋅60⋅60=1,209,600 (the value called targetTimespan); hence ⌊T/4⌋=302,400\lfloor T/4 \rfloor = 302{,}400⌊T/4⌋=302,400 and 4T=4,838,4004T = 4{,}838{,}4004T=4,838,400.

Edge cases and what the quantifiers include

  • t=0t = 0t=0 and s=0s = 0s=0 are included (then t⋅s=0<2256t \cdot s = 0 < 2^{256}t⋅s=0<2256).
  • The statement is pure arithmetic on natural numbers: it does not mention the decoding DDD, the clamp κ\kappaκ, rawNextTarget, calculateNextWork, or any compact word, even though the file imports those definitions. The connection "sss is a clamped timespan" or "ttt is a decoded target" is not part of the statement.
  • The largest admitted product is (2224−1)⋅4,838,400(2^{224} - 1) \cdot 4{,}838{,}400(2224−1)⋅4,838,400; since 4,838,400<2234{,}838{,}400 < 2^{23}4,838,400<223, this is below 22472^{247}2247.
Human review
  • Endorsed by Shuze Chen · Oct 29, 2026

    Confirmed by the moderator at approval.

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