The next required target never exceeds the proof-of-work limit
ProvedBitcoinPow.nextWork_le_powLimitFor every last word and all block times ,
The retarget caps its result at before re-encoding, and re-encoding rounds down, so the decoded next target is at most the limit. No hypothesis is placed on .
import Definitions.Def_BitcoinPow
theorem BitcoinPow.nextWork_le_powLimit (lastBits : BitVec 32) (lastTime firstTime : Int) :
BitcoinPow.setCompact (BitcoinPow.calculateNextWork lastBits lastTime firstTime) ≤ BitcoinPow.powLimit := 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)
Statement. For every 32-bit word ("lastBits") and all integers ("lastTime") and ("firstTime"),
with a non-strict inequality. Here ("setCompact") decodes a 32-bit word to a natural number and is the custom retargeting computation; both are unfolded below.
The decoding . For a 32-bit word with top byte and low 23 bits ,
The computation . Let be the natural number obtained by converting the integer
to a natural number (negative integers would become , but the clamp is always , so equals the clamp and ). Let
The result is the 32-bit word , where ("getCompact") is: with if and otherwise, ,
, and if , else , ; and .
Binders and hypotheses. Three universally quantified variables ( over all 32-bit words, and over all integers) and no hypotheses. In particular may have its "negative" bit 23 set, may have an "overflow" exponent (the statement uses , which ignores bit 23 and reduces modulo ), and may decode to (then , the result is the word , and the claim reads ). The time difference may be negative or zero. The claim concerns only the decoded value of the output word; it says nothing about the output word's bit 23, its exponent byte, or the flags of the output.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.