BridgeFP32Total #
“Total” bridge theorems combining:
IEEE32Exec's proved NaN/Inf propagation rules, and- the
FP32-on-ℝrefinement theorems for the finite/no-overflow branch (BridgeFP32.lean).
The key end-user view is toReal?:
toReal? x = nonefor NaN/Inf,toReal? x = some rfor finite values, withr : ℝ.
In most of TorchLean, the finite path is treated as real arithmetic + float32 rounding while special-value behavior is kept explicit. This file packages that split in one place.
The per-op lemmas are phrased in the style:
toReal? (op …) = if isFinite (op …) then some (fp32Round …) else none.
That makes the trust boundary readable at the call site: the if is exactly where NaN/Inf (or
overflow-to-Inf) can occur.
Background references (for float32 rounding/special values):
- IEEE 754-2019: https://doi.org/10.1109/IEEESTD.2019.8766229
- Goldberg (1991): https://doi.org/10.1145/103162.103163
- Flocq (Boldo–Melquiond, 2011): https://doi.org/10.1109/ARITH.2011.40
Basic facts: isFinite ↔ toDyadic?/toReal? #
toDyadic? x = none implies x is not finite.
If x is not finite, then toDyadic? x = none.
toReal? returns none on non-finite values.
On finite values, toReal? x is just some (toReal x).
Helpers: NaN/Inf/zero interactions #
NaNs are not infinities.
Infinities are not zeros.
Per-op “finite branch” wrappers (hide dyadic witnesses) #
Subtraction refinement packaged for total reasoning (hide dyadic witnesses).
This is the “finite-path” wrapper around BridgeFP32.toReal_sub_eq_fp32Round, replacing explicit
toDyadic? witnesses with the more user-facing finiteness hypotheses.
Total packaging for minimum/maximum (covers ±Inf) #
Total characterization of toReal? (minimum x y) via toReal? x and toReal? y.
This lemma covers the cases where one side is +∞ (which acts as a neutral element for min) and
the cases where toReal? is none because of NaN.
Total characterization of toReal? (maximum x y) via toReal? x and toReal? y.
This lemma covers the cases where one side is -∞ (which acts as a neutral element for max) and
the cases where toReal? is none because of NaN.