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 sqrtℚUp (accuracy ~10⁻¹⁰, output denominators arbitrary —
e.g. sqrtℚUp 2 = 50000000000/35355339059), 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.
sqrtApprox16 packages it as an Approx (same lower_sqrt and √2/√5
constants as sqrtApprox). Since upper square roots only ever appear in
check-hardening positions, swapping sqrtApprox → sqrtApprox16 in a checker
keeps it sound (any upper bound works) and — being tighter — only makes it
easier for certificate rows to pass.
sqrtℚUp16 as an UpperSqrt.
Equations
- RationalApprox.upperSqrt16 = { f := RationalApprox.sqrtℚUp16, bound := ⋯ }
Instances For
sqrtApprox with the fixed-point upper square root.
Equations
- One or more equations did not get rendered due to their size.