Documentation

Init.Data.Float.Model.Float

structure Float.Model :

The logical model for the Float type.

This is defined as the type of UInt64 with the additional restriction that bit patterns encoding a NaN must be exactly a chosen canonical NaN.

Most functions on Float.Model work by unpacking the Float.Model into the inductive type UnpackedFloat, performing the operation there, and then repacking the result into a Float.Model.

It is not a goal of this development to serve as the basis for a general-purpose floating-point library or to have any direct lemmas written about it at all. Rather, users interested in a library about floating-point numbers should develop such a library completely separately, and users interested in proving properties of their programs involving Float should prove that the operations defined here are equivalent to the operations defined in the separate library and then transfer lemmas from the library to the Float and Float32 types.

Instances For
    def Float.instDecidableEqModel.decEq (x✝ x✝¹ : Model) :
    Decidable (x✝ = x✝¹)
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Unpack a Float.Model into the corresponding UnpackedFloat.

      Equations
      Instances For

        Pack an UnpackedFloat into the corresponding Float.Model. This operation only gives a meaningful result if the float is already correctly rounded for the Format.binary64 format.

        Equations
        Instances For
          @[instance_reducible]
          Equations
          @[instance_reducible]
          Equations
          @[instance_reducible]
          Equations
          @[instance_reducible]
          Equations

          Negate a Float.Model.

          Equations
          Instances For
            @[instance_reducible]
            Equations

            Return a Float.Model with positive sign.

            Equations
            Instances For

              Compute the ordering between two Float.Model as specified by IEEE. Returns an Option Ordering to account for the fact that NaN is incomparable with everything. Also, positive and negative zero are equal.

              Equations
              Instances For

                Determine whether a is less than or equal to b according to IEEE rules.

                This is not a total ordering, and is not reflexive.

                Equations
                Instances For

                  Determine whether a is less than b according to IEEE rules.

                  This is not a total ordering.

                  Equations
                  Instances For

                    Determine whether a is equal to b according to IEEE rules.

                    This is not a reflexive relation.

                    Equations
                    Instances For
                      @[instance_reducible]
                      Equations
                      @[instance_reducible]
                      Equations
                      @[instance_reducible]
                      Equations

                      Returns true if the float represents a real number, i.e., it is neither infinite nor NaN.

                      Equations
                      Instances For

                        Returns true if the float is positive or negative infinity.

                        Equations
                        Instances For

                          Returns true if the float is NaN.

                          Equations
                          Instances For

                            Construct a Float.Model from its bit representation. This operation canonicalizes all NaN inputs into the canonical NaN.

                            Equations
                            Instances For

                              Converts an Int to a Float.Model, returning positive zero on zero.

                              Equations
                              Instances For

                                Converts a Nat to a Float.Model, returning positive zero on zero.

                                Equations
                                Instances For

                                  Converts an Int8 to a Float.Model, returning positive zero on zero.

                                  Equations
                                  Instances For

                                    Converts a Float.Model to a UInt8, truncating after the decimal point, sending NaN to 0 and clamping out-of-range values and infinities.

                                    Equations
                                    Instances For

                                      Converts a Float.Model to a UInt16, truncating after the decimal point, sending NaN to 0 and clamping out-of-range values and infinities.

                                      Equations
                                      Instances For

                                        Converts a Float.Model to a UInt32, truncating after the decimal point, sending NaN to 0 and clamping out-of-range values and infinities.

                                        Equations
                                        Instances For

                                          Converts a Float.Model to a UInt64, truncating after the decimal point, sending NaN to 0 and clamping out-of-range values and infinities.

                                          Equations
                                          Instances For

                                            Converts a Float.Model to a USize, truncating after the decimal point, sending NaN to 0 and clamping out-of-range values and infinities.

                                            Equations
                                            Instances For

                                              Converts a Float.Model to an Int8, truncating after the decimal point, sending NaN to 0 and clamping out-of-range values and infinities.

                                              Equations
                                              Instances For

                                                Converts a Float.Model to an Int16, truncating after the decimal point, sending NaN to 0 and clamping out-of-range values and infinities.

                                                Equations
                                                Instances For

                                                  Converts a Float.Model to an Int32, truncating after the decimal point, sending NaN to 0 and clamping out-of-range values and infinities.

                                                  Equations
                                                  Instances For

                                                    Converts a Float.Model to an Int64, truncating after the decimal point, sending NaN to 0 and clamping out-of-range values and infinities.

                                                    Equations
                                                    Instances For

                                                      Converts a Float.Model to an ISize, truncating after the decimal point, sending NaN to 0 and clamping out-of-range values and infinities.

                                                      Equations
                                                      Instances For
                                                        @[instance_reducible]
                                                        Equations