TorchLean API

FloatLib.Floats.Formats.BinaryInterchange.Model.NumericalSystem

Binary models as numerical systems #

The NumericalSystem interface gives Model fmt a representation-independent semantic view. Its ordinary semantic domain is ; supported infinities retain their signs, and NaNs retain the stored fraction as a payload.

Model.toDyadic? supplies the executable exact dyadic decoder. This real-valued view lets generic refinement results compose with other numerical families.

Complete real-valued interpretation of an executable float.

Instances For
    @[reducible, inline]

    Real-valued numerical-system semantics of a binary format.

    Instances For
      @[reducible, inline]

      Proof-facing real interpretation of an executable float.

      This is a relation on the existing Model fmt carrier, not a second floating-point type. Represents x r says that the exact bits stored by x have the ordinary finite meaning r.

      Instances For
        @[simp]

        The generic numerical-system relation is the direct Model representation relation.

        Every finite executable float has its exact real interpretation as its total value.

        Every finite executable float denotes its real interpretation in the general interface.

        The general interface represents exactly the real value used by finite arithmetic theorems.

        @[simp]

        An executable float represents a real exactly when it is finite and its exact decoding is that real. This is the main bridge from the single executable carrier to proof-oriented real reasoning.

        The real decoding of x is represented exactly when x is finite.

        A represented executable float is finite.

        The exact real decoding of a represented executable float is its represented value.

        The finite real value represented by an executable bit pattern is unique.

        Executable negation represents the exact negative of every represented finite real value.

        Executable addition refines one nearest-even rounding for a conventional IEEE format, provided the result is finite.

        Executable subtraction refines one nearest-even rounding for a conventional IEEE format, provided the result is finite.

        Executable multiplication refines one nearest-even rounding for a conventional IEEE format, provided the result is finite.

        theorem FloatLib.Floats.Formats.BinaryInterchange.Model.fma_refines (fmt : FloatFormat) (hfmt : fmt.isIEEE = true) :
        Numerics.Operation.Finite3If (numericalSystem fmt) (numericalSystem fmt) (numericalSystem fmt) (numericalSystem fmt) fma (fun (x y z : ) => roundAt fmt (x * y + z)) fun (x x_1 x_2 result : (numericalSystem fmt).Code) => isFinite result = true

        For a conventional IEEE format, executable fused multiply-add refines one nearest-even rounding when the result remains finite.

        theorem FloatLib.Floats.Formats.BinaryInterchange.Model.cast_refines (src dst : FloatFormat) (hsrc : src.isIEEE = true) (hdst : dst.isIEEE = true) :
        Numerics.Operation.Finite1If (numericalSystem src) (numericalSystem dst) (cast src dst) (fun (x : ) => roundAt dst x) fun (x : (numericalSystem src).Code) (result : (numericalSystem dst).Code) => isFinite result = true

        A finite cross-format cast refines nearest-even rounding in its destination format.