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 is separate from 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

    Membership using the numerical order of Model; 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 intentionally not valid under this finite-endpoint predicate. For finite formats, whole uses the two maximal finite endpoints and is valid.

      Instances For

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

        Unlike Valid, 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
          @[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 [-∞, +∞]; formats without infinity use their two maximal finite endpoints.

                  Instances For
                    @[inline]

                    Executable x ≤ y; unordered comparisons return false.

                    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 instead produce NaN endpoints. Indeterminate endpoint calculations cannot justify a narrower bound; for formats with infinity the fallback encloses every real number and permits interval arithmetic to compose.

                      Instances For
                        @[inline]

                        Whether the represented endpoint range contains numerical zero.

                        Instances For