Total-order laws and IEEE decimal tie rules #
Key injectivity establishes antisymmetry for full datums. The finite and NaN theorems identify the numerical, cohort, sign and payload ordering rules; the order laws alone would not establish agreement with those rules.
The ordering key loses no datum information, including NaN payloads or zero quanta.
@[simp]
theorem
FloatLib.Floats.Formats.DecimalInterchange.Datum.totalOrder_trans
{x y z : Datum}
(hxy : x.totalOrder y = true)
(hyz : y.totalOrder z = true)
:
Both directions hold precisely when the complete datums are identical.
theorem
FloatLib.Floats.Formats.DecimalInterchange.Datum.totalOrder_positive_finite_iff
(c d : ℕ)
(q r : ℤ)
:
(finite false c q).totalOrder (finite false d r) = true ↔ finiteValue false c q < finiteValue false d r ∨ finiteValue false c q = finiteValue false d r ∧ q ≤ r
On positive finite datums, numerical value precedes increasing quantum.
theorem
FloatLib.Floats.Formats.DecimalInterchange.Datum.totalOrder_negative_finite_iff
(c d : ℕ)
(q r : ℤ)
:
(finite true c q).totalOrder (finite true d r) = true ↔ finiteValue true c q < finiteValue true d r ∨ finiteValue true c q = finiteValue true d r ∧ r ≤ q
On negative finite datums, increasing numerical value precedes decreasing quantum.
theorem
FloatLib.Floats.Formats.DecimalInterchange.Datum.totalOrder_nan_payload_iff
(s t : Bool)
(p k : ℕ)
:
This implementation's equal-kind NaN payload order reverses with the sign. IEEE 754-2019 §5.10(d)(5)(iii) permits this choice.
@[simp]
theorem
FloatLib.Floats.Formats.DecimalInterchange.Datum.totalOrderMag_trans
{x y z : Datum}
(hxy : x.totalOrderMag y = true)
(hyz : y.totalOrderMag z = true)
:
Magnitude ordering identifies precisely datums differing at most in sign.