Fixed-point upper square root #
sqrtℚUp16 is an upper rational square root whose output always has
denominator dividing 10¹⁶: for x > 0,
sqrtℚUp16 x = (Nat.sqrt ⌈x · 10³²⌉ + 1) / 10¹⁶ ≥ √x.
Compared to the retired ℚ-Newton upper sqrt (accuracy ~10⁻¹⁰, output
denominators arbitrary), this is both more accurate (error < 2·10⁻¹⁶
relative to the input scale) and fixed-point, which is what lets the
checkers' hot loops run on integer numerators with statically known scales:
every upper-sqrt output is an integer multiple of 10⁻¹⁶, and for inputs
that are themselves multiples of 10⁻³² the ceiling is exact. The lower
square root sqrtℚLow13 (in Checker/ApproxSqrt.lean) has the same
fixed-point shape at scale 10⁻¹³.
sqrtApprox16 packages it as an Approx together with the fixed-point
lower square root sqrtℚLow13 from Checker/ApproxSqrt.lean. Since upper
square roots only ever appear in check-hardening positions, any upper bound
is sound here, and a tighter one only makes it easier for certificate rows
to pass.
sqrtℚUp16 as an UpperSqrt.
Equations
- RationalApprox.upperSqrt16 = { f := RationalApprox.sqrtℚUp16, bound := ⋯ }
Instances For
The Approx bundle used by all checkers: sqrtℚLow below, sqrtℚUp16
above, and rational upper bounds for √2 and √5.
Equations
- One or more equations did not get rendered due to their size.