The retarget timespan is clamped to [T/4, 4T]
ProvedBitcoinPow.clamp_boundsFor every signed elapsed time , the clamped timespan used by CalculateNextWorkRequired satisfies
with . Negative inputs, which arise when timestamps go backwards, are raised to ; this bounds every difficulty change to a factor of four in either direction.
import Definitions.Def_BitcoinPow
theorem BitcoinPow.clamp_bounds (actual : Int) :
((BitcoinPow.targetTimespan / 4 : Nat) : Int) ≤ BitcoinPow.clampTimespan actual ∧
BitcoinPow.clampTimespan actual ≤ ((BitcoinPow.targetTimespan * 4 : Nat) : 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)
Statement. For every integer (positive, zero, or negative), the integer satisfies both
with non-strict inequalities, where is the natural number cast to an integer and is the natural number cast to an integer ().
The function, unfolded. is the custom function on integers
(the first test is evaluated first, then the second).
Binders and hypotheses. One universally quantified integer and no hypotheses. The conclusion is a conjunction of two inequalities between integers. Negative and are included (both land in the first branch). The endpoints are included: and both return itself. Nothing is said about the relationship between and beyond these two bounds.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.