TorchLean API

NN.Floats.Interval.Comparison

Comparison helpers for executable interval demos #

This module contains small, reusable baselines for numerical-audit examples:

The important design point is separation: examples should print comparisons, not quietly define a second interval library. The primary TorchLean interval implementation is IEEE32Exec.Interval32; this module only provides baselines that make examples and regression tests easier to read.

Pretty-print an executable IEEE32Exec.Interval32, including endpoint bits.

Instances For

    Pretty-print a runtime Float32, including its raw IEEE-754 bit pattern.

    Instances For

      Closed interval with runtime Float32 endpoints.

      This is a baseline, not the verified interval implementation. Operations use ordinary runtime Float32 arithmetic and therefore do not provide outward-rounding guarantees. It is useful in demos because it shows exactly why IEEE32Exec.Interval32 exists.

      Instances For
        @[inline]

        Degenerate runtime-Float32 interval [x, x].

        Instances For
          @[inline]

          +0.0f by IEEE-754 binary32 bits.

          Instances For
            @[inline]

            -0.0f by IEEE-754 binary32 bits.

            Instances For
              @[inline]

              +∞ by IEEE-754 binary32 bits.

              Instances For
                @[inline]

                -∞ by IEEE-754 binary32 bits.

                Instances For

                  Minimum of four runtime Float32 values using Lean's runtime order.

                  Instances For

                    Maximum of four runtime Float32 values using Lean's runtime order.

                    Instances For
                      @[inline]

                      Naive endpoint addition; no directed rounding.

                      Instances For
                        @[inline]

                        Naive interval negation: -[lo, hi] = [-hi, -lo].

                        Instances For
                          @[inline]

                          Naive endpoint subtraction; no directed rounding.

                          Instances For

                            Classical four-corner multiplication using runtime Float32; no directed rounding.

                            Instances For
                              @[inline]

                              Conservative fallback interval [-∞, +∞].

                              Instances For
                                @[inline]

                                Boolean comparison wrapper; NaN comparisons evaluate to false.

                                Instances For

                                  Return true iff the interval contains zero, including signed-zero endpoints.

                                  Instances For

                                    Naive four-corner division when the denominator does not contain zero.

                                    If the denominator straddles zero, return whole, mirroring the shape of IEEE32Exec.Interval32.div but without directed rounding.

                                    Instances For

                                      Closed interval with exact rational endpoints.

                                      This is a compact reference domain for examples. It is intentionally small: enough for corner-rule checks and containment comparisons, not a replacement for a full real-analysis interval library.

                                      • lo :

                                        Lower endpoint.

                                      • hi :

                                        Upper endpoint.

                                      Instances For
                                        @[inline]

                                        Degenerate rational interval [x, x].

                                        Instances For

                                          Minimum of four rationals.

                                          Instances For

                                            Maximum of four rationals.

                                            Instances For
                                              @[inline]

                                              Exact interval addition over rationals.

                                              Instances For
                                                @[inline]

                                                Exact interval negation: -[lo, hi] = [-hi, -lo].

                                                Instances For
                                                  @[inline]

                                                  Exact interval subtraction over rationals.

                                                  Instances For

                                                    Classical four-corner multiplication over exact rationals.

                                                    Instances For

                                                      Boolean check that outer contains inner.

                                                      Instances For

                                                        Pretty-print an exact rational interval.

                                                        Instances For

                                                          Exact rational endpoint interval for a finite IEEE32Exec.Interval32; none for NaN/Inf.

                                                          Instances For

                                                            Exact rational value of a finite runtime Float32; none for NaN/Inf.

                                                            Instances For

                                                              Exact rational endpoint interval for a finite runtime-Float32 interval.

                                                              Instances For

                                                                Endpoint-evaluate a unary function over an IEEE32Exec interval.

                                                                This is intentionally not a sound transcendental interval rule in general; it is a comparison baseline for demos.

                                                                Instances For

                                                                  Endpoint-evaluate a unary function over a runtime-Float32 interval.

                                                                  This is the naive runtime baseline paired with intervalUnaryEndpoints.

                                                                  Instances For