TorchLean API

FloatLib.Floats.Formats.Posit.Rounding.Real

Real-valued posit rounding specification #

The exact rational posit rounding specification has a noncomputable interpretation in . This interpretation belongs to the semantic proof layer: executable arithmetic continues to use the rational, dyadic, native-word, and fixed-limb kernels.

The real specification lets refinement theorems state correctness against conventional analytic operations such as Real.sqrt, without adding real-number evaluation to a runtime dependency.

Real value of the posit word with unsigned code code.

The intended domain is code < format.signMaskNat. In general the code is reduced modulo the format's modulus before decoding; zero and NaR map to zero, and other words retain their sign.

Instances For

    For a nonnegative target, the greatest code whose real denotation does not exceed it.

    Instances For

      Exact smallest positive real value of a posit format.

      Instances For

        Exact appended-bit rounding threshold interpreted in the reals.

        Instances For

          Round a real to a nonnegative posit code, sending nonpositive targets to zero.

          Instances For
            noncomputable def FloatLib.Floats.Formats.Posit.Model.RealRounding.roundPositive (format : Format) (target : ) :
            Model format

            Model-valued rounding of a nonnegative real target.

            Instances For
              noncomputable def FloatLib.Floats.Formats.Posit.Model.RealRounding.round (format : Format) (target : ) :
              Model format

              Round a signed real by the standard whole-word negation symmetry.

              Instances For

                Real lower-code search agrees with rational lower-code search after exact coercion.

                Real lower-code search is monotone in its target.

                The minimum positive value has lower code one.

                theorem FloatLib.Floats.Formats.Posit.Model.RealRounding.roundPositiveCode_bounds (format : Format) (target : ) (hpositive : 0 < target) (hminimum : minPositive format target) :
                lowerCode format target roundPositiveCode format target roundPositiveCode format target lowerCode format target + 1

                Interior positive rounding selects either its lower code or its immediate successor.

                theorem FloatLib.Floats.Formats.Posit.Model.RealRounding.roundPositiveCode_eq_lower_of_lt_threshold (format : Format) (target : ) (hpositive : 0 < target) (hminimum : minPositive format target) (hupper : lowerCode format target + 1 < format.signMaskNat) (hbelow : target < roundingThreshold format (lowerCode format target)) :
                roundPositiveCode format target = lowerCode format target

                An interior target below its appended-bit boundary selects the lower code.

                theorem FloatLib.Floats.Formats.Posit.Model.RealRounding.roundPositiveCode_eq_succ_of_threshold_lt (format : Format) (target : ) (hpositive : 0 < target) (hminimum : minPositive format target) (hupper : lowerCode format target + 1 < format.signMaskNat) (habove : roundingThreshold format (lowerCode format target) < target) :
                roundPositiveCode format target = lowerCode format target + 1

                An interior target above its appended-bit boundary selects the successor code.

                theorem FloatLib.Floats.Formats.Posit.Model.RealRounding.roundPositiveCode_eq_lower_of_not_succ_lt (format : Format) (target : ) (hpositive : 0 < target) (hminimum : minPositive format target) (hupper : ¬lowerCode format target + 1 < format.signMaskNat) :
                roundPositiveCode format target = lowerCode format target

                A saturated interior lower code is already the final rounded code.

                Exact real-valued positive rounding is monotone.

                Real rounding agrees with rational rounding after exact coercion.

                Model-valued real rounding agrees with rational rounding after exact coercion.

                theorem FloatLib.Floats.Formats.Posit.Model.RealRounding.round_ratCast (format : Format) (target : ) :
                round format target = roundRat format target

                Signed real rounding extends the executable exact-rational specification.