TorchLean API

NN.Floats.IEEEExec.BridgeFP32.Core

IEEE32Exec and FP32: Real Semantics Core #

Reals view of IEEE32Exec #

Real semantics (toReal?/toReal) live in NN.Floats.IEEEExec.RealSemantics. This bridge file uses them pervasively, but does not define them.

@[reducible, inline]

FP32 rounding viewed as a real function.

Instances For

    Basic checks for fp32Round #

    Rounding 0 to float32 yields 0.

    Helper lemmas (magnitude/rounding) #

    Most of the file consists of bridge lemmas: once we decide on the refinement statement, we need many small facts that connect:

    These lemmas are local: they exist to keep the later op-level theorems readable.

    Instances For

      Absolute value of a decoded dyadic.

      Informal: dyadicToReal d = ± (mant * 2^exp) and since mant ≥ 0, the absolute value is always mant * 2^exp regardless of the sign bit.

      Exact multiplication of dyadics commutes with decoding to reals.

      Informal: decoding the dyadic that multiplies mantissas and adds exponents gives the product of the decoded real values.

      Negating a dyadic (flipping its sign bit) negates its decoded real value.

      signBit (ofBits b) is literally the 31st bit of b (at the nat level).

      Flipping signMask toggles the sign bit and leaves everything else unchanged.

      If x decodes to the dyadic d, then neg x decodes to the same magnitude with a flipped sign.

      This lemma is one of the bitfield bridge steps that lets us transport algebraic facts from the dyadic semantics to IEEE32Exec.

      On finite values, toReal respects IEEE32Exec.neg.

      We phrase this as an equality on toReal for convenience, but the proof fundamentally uses the finiteness witness toDyadic? x = some d.