The split division agrees with Div
ProvedBitcoinFeerateDiagram.divFallback_eq_divFor : divFallback (h, l) d rd = div (h · 2^32 + l) d rd.
import Definitions.Def_BitcoinFeerateDiagram open BitcoinFeerateDiagram BitcoinReplacement
theorem BitcoinFeerateDiagram.divFallback_eq_div (n : ℤ × ℤ) (d : ℤ) (hd : 0 < d) (rd : Bool) :
FeeFrac.divFallback n d rd = FeeFrac.div (n.1 * 2 ^ 32 + n.2) d rd := 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: BitcoinFeerateDiagram.divFallback_eq_div
Statement. For every pair of integers , every integer with
and every boolean ,
Binders and edge cases. The only hypothesis is . There is no restriction on or on : in particular may be negative or at least , and are not required to come from ; no word-size bounds are imposed. Both values of (true = "round down", false) are covered. Both sides are computed from truncated division (quotient toward zero, remainder with the sign of the dividend) followed by the correction term described below.
Definitions used, unfolded
Division conventions. Three kinds of division occur.
- Default integer division with remainder (Euclidean convention). For : and , also for negative (e.g. , ). For : and . For : and .
- Truncated division with remainder : the quotient is rounded toward zero, so the remainder is or has the sign of , with (e.g. , ). For : , .
- Rational division in , with the convention . For , is the greatest integer and the least integer .
Below, denotes if the condition holds and otherwise.
div. For integers and a boolean ("round down"), with and (truncated division):
Case by case: if the result is ; if it is when is true and when is false; if it is when is true and when is false. The definition places no condition on : for it gives , , hence ; for the remainder still carries the sign of .
divFallback. For a pair of integers , an integer and a boolean , using truncated division throughout:
No range restriction is placed on (it may be negative or ) or on .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.