TorchLean API

NN.Floats.Interval.Comparison

Comparison helpers for executable interval examples #

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 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 baseline uses ordinary runtime Float32 arithmetic and provides no outward-rounding guarantee. Examples compare it with the verified IEEE32Exec.Interval32 implementation.

      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

                                      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 a runtime-Float32 interval.

                                                  This is the naive runtime baseline paired with intervalUnaryEndpoints.

                                                  Instances For