TorchLean API

NN.MLTheory.Proofs.Approximation.FloatInterval.Semantics

Floating-Point Interval Semantics #

Interval-domain semantics for IEEE32Exec neural networks.

This file formalizes the interval domain, concretization map, executable interval operators, and the exact-interval-image property used by the floating-point interval-approximation theorem of Hwang, Lee, Park, Park, and Saad, Floating-Point Neural Networks Are Provably Robust Universal Approximators (arXiv:2506.16065).

Basic aliases #

@[reducible, inline]

Shorthand for the executable binary32 float type used in this development.

Instances For

    IEEE32Exec is stored as a UInt32 bit-pattern, so the carrier is finite. We use this only to obtain Finset.univ for paper-style “finite hull” definitions; nothing is computed.

    Small helper lemmas about the IEEE32Exec order #

    Interval domain I (Eq. 6) #

    Concretization γ for abstract intervals (Eq. 7).

    Instances For
      @[implicit_reducible]

      Membership in an abstract interval, via the concretization γI.

      @[reducible, inline]

      Abstract boxes B ∈ I^d.

      Instances For

        Concretization γ for boxes (Eq. 7).

        Instances For

          A box is in [-1,1]^d (paper: “abstract boxes in [-1,1]^d”).

          Instances For
            @[inline]

            Point interval ⟨x,x⟩.

            Instances For
              @[inline]

              Point box ⟨x,x⟩^d.

              Instances For

                Executable interval operators for +, *, and ReLU #

                @[inline]

                Minimum of two IEEE32Exec values (NaN-aware, via IEEE32Exec.minimum).

                Instances For
                  @[inline]

                  Maximum of two IEEE32Exec values (NaN-aware, via IEEE32Exec.maximum).

                  Instances For
                    @[inline]

                    Minimum of four IEEE32Exec values, computed via nested min2.

                    Instances For
                      @[inline]

                      Maximum of four IEEE32Exec values, computed via nested max2.

                      Instances For
                        @[inline]

                        Return true iff any of the four arguments is NaN.

                        Instances For

                          Corner-based interval addition for IEEE32Exec.add.

                          Instances For

                            Corner-based interval multiplication for IEEE32Exec.mul.

                            Instances For
                              @[inline]

                              Executable ReLU for IEEE32Exec, defined via IEEE32Exec.maximum.

                              Instances For

                                Exact ReLU♯ for intervals, using monotonicity of ReLU: for ⟨a,b⟩, ReLU([a,b]) = [ReLU(a), ReLU(b)].

                                Instances For

                                  Eq. (8): exact interval hull on finite sets #

                                  Totalized extended-real interpretation (defaults to 0 only on NaN).

                                  Instances For

                                    Interval hull for a finite set of floats:

                                    • if the set contains a NaN (paper: ⊥ ∈ S), otherwise
                                    • the interval ⟨min S, max S⟩.
                                    Instances For

                                      Interval ops ⊕♯/⊗♯/σ♯ instantiated from hull #

                                      @[inline]

                                      Build a 2D box from two intervals (coordinate 0 is A, coordinate 1 is B).

                                      Instances For

                                        Interval summation ◦∑♯ from the paper: fold with addSharp.

                                        Instances For

                                          OpsExact implements the finite interval semantics used for exact interval-image statements.

                                          Proving its soundness for IEEE32Exec (+/*/ReLU) is substantial work. This file isolates that work behind an explicit interface, so higher-level semantic proofs can be completed once op-level soundness lemmas are available.

                                          Instances

                                            Exact interval-image property for rounded targets #

                                            Float interval set {x | a ≤ x ∧ x ≤ b} (avoids needing Preorder).

                                            Instances For

                                              m is a minimum of g on the set S, stated without choosing a canonical min.

                                              Instances For

                                                M is a maximum of g on the set S, stated without choosing a canonical max.

                                                Instances For

                                                  For each box B, the abstract output interval is exactly the interval hull of the rounded target's direct image on γ(B), expressed via existential min/max witnesses.

                                                  Instances For

                                                    Two-layer interval evaluator using OpsExact #

                                                    Parameters of a 2-layer MLP of shape d → h → 1 for the exact interval semantics (OpsExact).

                                                    • W1 : Fin hFin dF

                                                      Weight matrix for layer 1.

                                                    • b1 : Fin hF

                                                      Bias for layer 1.

                                                    • W2 : Fin 1Fin hF

                                                      Weight matrix for layer 2.

                                                    • b2 : Fin 1F

                                                      Bias for layer 2.

                                                    Instances For
                                                      def NN.MLTheory.Proofs.UniversalApproximation.FloatIntervalApprox.MLP2Exact.aff {d m : } (W : Fin mFin dF) (b : Fin mF) (x : Fin dF) :
                                                      Fin mF

                                                      Apply an affine layer to an input vector using IEEE32Exec arithmetic.

                                                      Instances For

                                                        Evaluate a 2-layer ReLU MLP on a concrete input, using the exact op wrappers (OpsExact.relu).

                                                        Instances For
                                                          noncomputable def NN.MLTheory.Proofs.UniversalApproximation.FloatIntervalApprox.MLP2Exact.affSharp {d m : } (W : Fin mFin dF) (b : Fin mF) (B : I.Box d) :

                                                          Interval affine transform aff♯ using corner multiplication and interval summation.

                                                          Instances For

                                                            Interval semantics ν♯ for 2-layer ReLU MLPs.

                                                            Instances For
                                                              theorem NN.MLTheory.Proofs.UniversalApproximation.FloatIntervalApprox.MLP2Exact.aff_sound [OpsExact.Sound] {d m : } (W : Fin mFin dF) (b : Fin mF) (B : I.Box d) (hW : ∀ (i : Fin m) (j : Fin d), TorchLean.Floats.IEEE754.IEEE32Exec.isNaN (W i j) = false) (hb : ∀ (i : Fin m), TorchLean.Floats.IEEE754.IEEE32Exec.isNaN (b i) = false) {x : Fin dF} :
                                                              x I.γ Baff W b x I.γ (affSharp W b B)
                                                              theorem NN.MLTheory.Proofs.UniversalApproximation.FloatIntervalApprox.MLP2Exact.eval_sound [OpsExact.Sound] {d h : } (net : Net d h) (B : I.Box d) (hW1 : ∀ (i : Fin h) (j : Fin d), TorchLean.Floats.IEEE754.IEEE32Exec.isNaN (net.W1 i j) = false) (hb1 : ∀ (i : Fin h), TorchLean.Floats.IEEE754.IEEE32Exec.isNaN (net.b1 i) = false) (hW2 : ∀ (i : Fin 1) (j : Fin h), TorchLean.Floats.IEEE754.IEEE32Exec.isNaN (net.W2 i j) = false) (hb2 : ∀ (i : Fin 1), TorchLean.Floats.IEEE754.IEEE32Exec.isNaN (net.b2 i) = false) {x : Fin dF} :
                                                              x I.γ Beval net x evalSharp net B