Order theory for exact dyadics #
The executable cmpDyadic comparison agrees with real order. The proof reduces it to
cmpDyadicAligned, aligns both integer significands at the smaller exponent, and then cancels
their common positive power-of-two scale.
theorem
FloatLib.Floats.Formats.BinaryInterchange.Model.Dyadic.toReal_eq_signedSignificand_shiftLeft
(d : Numerics.Dyadic)
(exponent : ℤ)
(hexponent : exponent ≤ d.exponent)
:
d.toReal = ↑{ negative := d.negative, significand := d.significand.shiftLeft (d.exponent - exponent).toNat,
exponent := 0 }.signedSignificand * Flocq.bpow Numerics.binaryRadix exponent
Real semantics after moving a dyadic significand to any smaller exponent.
The aligned integer is the exact signed significand at scale 2^exponent.
Executable dyadic comparison returns .lt exactly when the real values are ordered.
Executable dyadic comparison returns .eq exactly when the real values are equal.
Executable dyadic comparison returns .gt exactly when the real values are reversed.
theorem
FloatLib.Floats.Formats.BinaryInterchange.Model.cmpDyadic_eq_compare
(a b : Numerics.Dyadic)
:
Executable dyadic comparison is the comparison of the real values.