TorchLean API

NN.Floats.IEEEExec.BridgeFP32.Compare

IEEE32Exec and FP32: Comparisons and Min/Max #

Comparisons and min/max (finite refinement) #

Comparisons are subtle in IEEE-754 because of NaNs and signed zeros. Since FP32 is a finite-only model, we only bridge the finite behavior here: comparisons/min/max agree with the corresponding real comparisons once NaNs/Infs are ruled out.

Dyadic comparison correctness (lt case).

cmpDyadic compares two decoded dyadics by aligning exponents and comparing signed integers. This theorem states that the .lt result agrees with the real-ordering of dyadicToReal.

Dyadic comparison correctness (eq case).

This is the equality variant of cmpDyadic_lt_iff.

Dyadic comparison correctness (gt case).

This is the greater-than variant of cmpDyadic_lt_iff, phrased as dyadicToReal b < dyadicToReal a.

Bridge for IEEE32Exec.compare on finite values.

When both operands decode to dyadics (toDyadic? = some), compare returns a result and it is exactly cmpDyadic of those dyadics.

compare x y = .lt if and only if toReal x < toReal y (finite path).

This is the user-facing ordering theorem that lets downstream reasoning switch between IEEE32Exec.compare and < on reals.

compare x y = .eq if and only if toReal x = toReal y (finite path).

Note: this equality is on the decoded real values; it ignores NaN payloads and signed-zero distinctions (those are handled explicitly elsewhere).

compare x y = .gt if and only if toReal y < toReal x (finite path).

This is the greater-than companion to compare_eq_some_lt_iff_toReal_lt.

Bridge for IEEE32Exec.minimum on finite values: its real meaning is min (toReal x) (toReal y).

This proof follows IEEE-754 style rules (including NaN propagation and signed-zero handling), but the statement is on toReal, which erases the sign of zero.

Bridge for IEEE32Exec.maximum on finite values: its real meaning is max (toReal x) (toReal y).

This is the companion of toReal_minimum_eq_min. As above, the conclusion is phrased in terms of toReal, so signed zeros are identified.