TorchLean API

FloatLib.Numerics.Enclosure.Interval.Basic

Intervals with arbitrary endpoint representations #

The endpoint pair does not impose an order, radix, infinity representation, or rounding policy. Contains interprets finite endpoints through an explicit partial decoder. Failed decoding excludes NaNs, NaRs, and other values outside the chosen scalar interpretation.

structure FloatLib.Numerics.Interval (α : Type u_1) :
Type u_1

An endpoint pair; construction alone does not assert that the bounds are ordered.

  • lo : α

    Lower endpoint.

  • hi : α

    Upper endpoint.

Instances For
    @[instance_reducible]
    def FloatLib.Numerics.instDecidableEqInterval.decEq {α✝ : Type u_1} [DecidableEq α✝] (x✝ x✝¹ : Interval α✝) :
    Decidable (x✝ = x✝¹)
    Instances For
      def FloatLib.Numerics.instReprInterval.repr {α✝ : Type u_1} [Repr α✝] :
      Interval α✝Std.Format
      Instances For
        @[instance_reducible]
        instance FloatLib.Numerics.instReprInterval {α✝ : Type u_1} [Repr α✝] :
        Repr (Interval α✝)
        def FloatLib.Numerics.Interval.point {α : Type u_1} (x : α) :

        A point interval preserves its endpoint representation exactly.

        Instances For
          def FloatLib.Numerics.Interval.map {α : Type u_1} {β : Type u_2} (f : αβ) (I : Interval α) :

          Change both endpoint representations by the same function.

          Instances For
            def FloatLib.Numerics.Interval.decode? {α : Type u_1} {β : Type u_2} (decode : αOption β) (I : Interval α) :

            Decode both finite endpoints, failing if either endpoint has no scalar interpretation.

            Instances For
              def FloatLib.Numerics.Interval.Contains {α : Type u_1} {β : Type u_2} [LE β] (decode : αOption β) (I : Interval α) (x : β) :

              Scalar membership requires successful decoding and both endpoint inequalities.

              Instances For
                def FloatLib.Numerics.Interval.ofBounds? {α : Type u_1} {β : Type u_2} [LinearOrder β] (decode : αOption β) (lo hi : α) :

                Keep finite ordered bounds; special values and reversed bounds return none.

                Instances For
                  structure FloatLib.Numerics.OutwardRounding (α : Type u_1) (β : Type u_2) [LE β] :
                  Type (max u_1 u_2)

                  Partial outward rounding for any endpoint carrier and ordered scalar interpretation.

                  Success certifies finite decoded bounds; failure can report overflow or an unavailable enclosure. In particular, this interface does not require bounded formats to represent infinities.

                  • decode : αOption β

                    Finite scalar interpretation of an encoded endpoint.

                  • enclose? : βOption (Interval α)

                    Try to bracket an exact scalar by representable endpoints.

                  • sound {x : β} {I : Interval α} : self.enclose? x = some IInterval.Contains self.decode I x

                    Every successful result encloses the exact scalar.

                  Instances For