TorchLean API

FloatLib.Floats.Formats.DecimalInterchange.Sqrt.ScaleProof

Coefficient range for decimal square root #

Halving the base-ten logarithm of the squared scaled value determines the square-root grid. The proofs use integer logarithm bounds, without approximating the square root.

theorem FloatLib.Floats.Formats.DecimalInterchange.sqrtScaleShift_le_of_lt {p k : } (hp : 0 < p) {x : } (hx : 0 x) (h : x < 10 ^ (2 * (p + k))) :

A fitting square bounds the grid shift without computing its root.

theorem FloatLib.Floats.Formats.DecimalInterchange.sqrtQuantum_le_of_valid (f : Format) (s : Bool) (c : ) (q : ) (hvalid : Datum.Valid f (Datum.finite s c q)) :
sqrtQuantum f ((c * 10 ^ q) ^ 2) q

Every valid representation of an exact root is on a grid no finer than the selected grid.

The square of the scaled coefficient is strictly below the squared coefficient bound.

theorem FloatLib.Floats.Formats.DecimalInterchange.sqrtScaleShift_lower {p : } (hp : 0 < p) {x : } (hx : 0 x) (hk : 0 < sqrtScaleShift p x) :
10 ^ (2 * (p + sqrtScaleShift p x - 1)) x

A nonzero square-root grid shift retains a full leading digit before rounding.

Above the subnormal grid, the scaled radicand is at least the square of a full leading digit.