TorchLean API

FloatLib.Floats.Formats.FixedPoint.Bounded.Semantics.Core

Rational contracts for bounded fixed point #

The bounded carrier denotes the subset of the unbounded fixed-point grid whose coefficients fit the signed storage width. This module defines the mathematical contract for three overflow policies:

The executable BitVec kernels live in Bounded.Core. Their refinement proofs are isolated in Semantics.Proof, keeping the contract reusable without importing the proof implementation.

Rational value represented by an integer coefficient at one fixed scale.

Instances For

    Recover the nearest integer coefficient of a rational scalar at one fixed scale.

    This is exact on every scalar represented by the bounded fixed-point system.

    Instances For
      def FloatLib.Floats.Formats.FixedPoint.Bounded.wrapAddValue (radix : Numerics.Radix) (fractionalDigits width : ) (left right : ) :

      Wrapping same-scale addition on scalar values.

      Instances For
        def FloatLib.Floats.Formats.FixedPoint.Bounded.wrapSubValue (radix : Numerics.Radix) (fractionalDigits width : ) (left right : ) :

        Wrapping same-scale subtraction on scalar values.

        Instances For

          Wrapping multiplication on scalar values at the composed output scale.

          Instances For
            def FloatLib.Floats.Formats.FixedPoint.Bounded.saturatingAddValue (radix : Numerics.Radix) (fractionalDigits width : ) (left right : ) :

            Saturating same-scale addition on scalar values.

            Instances For
              def FloatLib.Floats.Formats.FixedPoint.Bounded.saturatingSubValue (radix : Numerics.Radix) (fractionalDigits width : ) (left right : ) :

              Saturating same-scale subtraction on scalar values.

              Instances For

                Saturating multiplication on scalar values at the composed output scale.

                Instances For
                  @[inline]
                  def FloatLib.Floats.Formats.FixedPoint.Bounded.toUnbounded {radix : Numerics.Radix} {fractionalDigits width : } (code : Code radix fractionalDigits width) :
                  FixedPoint.Code radix fractionalDigits

                  Forgetting the coefficient bound yields the corresponding exact fixed-point code.

                  Instances For

                    Bounded fixed point interpreted as an exact rational numerical system.

                    Instances For
                      @[reducible, inline]

                      A bounded code with an erased proof of its complete denotation.

                      Instances For
                        @[reducible, inline]
                        abbrev FloatLib.Floats.Formats.FixedPoint.Bounded.AtFinite (radix : Numerics.Radix) (fractionalDigits width : ) (value : ) :

                        A bounded code with an erased proof of its exact rational value.

                        Instances For