TorchLean API

FloatLib.Floats.Formats.BinaryInterchange.Interval.Core

Format-generic executable floating-point intervals #

Closed executable intervals have Model fmt endpoints, an endpoint order, and format-independent constructors. Outward-rounded arithmetic and activation ranges live in later modules.

The executable layer carries no soundness theorems, so applications can choose an exact real, extended-real, or format-model interpretation without changing the interval representation.

A closed executable interval with both endpoints in fmt.

  • lo : Model fmt

    Lower endpoint.

  • hi : Model fmt

    Upper endpoint.

Instances For
    @[instance_reducible]

    #eval shows both endpoints as their values.

    Membership using the numerical order of Model, in which NaNs are unordered.

    Instances For
      @[instance_reducible]

      Enable x ∈ I for format-generic executable intervals.

      @[simp]

      Unfold membership into lower- and upper-endpoint comparisons.

      An interval is valid when both endpoints are finite and ordered.

      For formats with infinity, whole is not valid under this finite-endpoint predicate. For finite formats, whole uses the two maximal finite endpoints and is valid.

      Instances For
        @[instance_reducible]

        Validity is decided by classifying and comparing the endpoints.

        An interval is extended-valid when both endpoints are non-NaN and are ordered.

        This predicate permits infinite endpoints. It is the closure invariant for outward-rounded IEEE operations: a finite input interval may produce an infinite endpoint on overflow without ceasing to denote an ordered interval.

        Instances For
          @[instance_reducible]

          Extended validity is decided by classifying and comparing the endpoints.

          @[inline]

          Degenerate interval [x, x].

          Instances For
            @[inline]

            Smallest endpoint hull containing both input intervals, with IEEE NaN propagation.

            Instances For
              @[inline]

              Minimum of four values, grouped to match the interval corner operations.

              Instances For
                @[inline]

                Maximum of four values, grouped to match the interval corner operations.

                Instances For
                  @[inline]

                  Conservative interval spanning the complete numerical range of fmt.

                  Formats with infinity use [-∞, +∞], and formats without infinity use their two maximal finite endpoints.

                  Instances For
                    @[inline]

                    Executable x ≤ y, which is false for unordered comparisons.

                    Instances For
                      @[inline]

                      Build an enclosure from ordered, non-NaN endpoints, or use the whole range.

                      The candidate pair is kept only when leB lo hi holds. It is replaced by whole fmt when either endpoint is a NaN (so the comparison is unordered) and also when lo > hi numerically, which can happen when a caller supplies reversed bounds. An indeterminate expression such as 0 * ∞ can produce NaN endpoints instead. Such endpoint calculations cannot justify a narrower bound, and for formats with infinity the fallback encloses every real number, so interval arithmetic composes.

                      Instances For
                        @[inline]

                        Whether the represented endpoint range contains numerical zero.

                        Instances For