TorchLean API

NN.Floats.IEEEExec.Bridge.FP32.Core

IEEE32Exec and FP32: Real Semantics Core #

Reals view of IEEE32Exec #

Real semantics (toReal?/toReal) live in NN.Floats.IEEEExec.Semantics.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 exactly the 31st bit of b at the natural-number 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 uses the finiteness witness toDyadic? x = some d.

      The executable maximum-finite binary32 bit pattern denotes FP32.ieeeMaxFinite.

      This identifies the concrete endpoint 0x7f7fffff with the rounded-real guard (2 - 2⁻²³) * 2¹²⁷. Keeping this fact in the core bridge gives overflow and interval proofs a single canonical statement about the upper edge of finite binary32.

      Every finite executable binary32 value lies between the two maximum-finite endpoints.

      The proof reads the stored exponent and fraction fields directly. It covers normal numbers, subnormals, and both signed zeros; NaNs and infinities are excluded by hfin.

      The real denotation of every finite executable binary32 value belongs to the rounded-real binary32 format.

      This is the representability bridge from an IEEE bit pattern to fexp32. It is what permits format-level results, such as Sterbenz's lemma, to be applied directly to executable operands.