BridgeERealTotal #
Extended-real (EReal) semantics for IEEE32Exec.
We use toReal? as the main “finite-only” semantic function in TorchLean. For some statements,
though, we really want to distinguish +∞ from -∞ instead of collapsing both to none.
This file packages a slightly richer view:
toEReal? x = noneexactly for NaN (unordered),toEReal? x = some ⊤/some ⊥for+∞/-∞,toEReal? x = some (↑(toReal x))for finite values.
We then prove “golden theorem”-style lemmas for core ops, where the finite branch refines to the
FP32 rounding-on-ℝ model (fp32Round) and the non-finite branch preserves IEEE-754 special
behavior.
Background:
- IEEE 754-2019: https://doi.org/10.1109/IEEESTD.2019.8766229
- Goldberg (1991): https://doi.org/10.1145/103162.103163
Extended-real interpretation of IEEE32Exec (none exactly for NaN).
Instances For
theorem
TorchLean.Floats.IEEE754.IEEE32Exec.toEReal?_eq_none_of_isNaN_eq_true
(x : IEEE32Exec)
(hx : x.isNaN = true)
:
Quick bridge: NaNs stay none.
theorem
TorchLean.Floats.IEEE754.IEEE32Exec.isNaN_eq_false_of_isInf_eq_true
(x : IEEE32Exec)
(hx : x.isInf = true)
:
Quick bridge: isInf rules out NaN.
Quick bridge: add becomes fp32Round in EReal.