TorchLean API

NN.MLTheory.CROWN.Extras.IntervalLemmas

Interval arithmetic lemmas (ℝ) #

This file provides foundational lemmas for interval arithmetic operations used in CROWN/LiRPA bound propagation soundness proofs.

It is primarily intended as a small toolbox for proof scripts and examples; it lives under NN/MLTheory/CROWN/Extras/ to keep the main CROWN modules focused on the bound propagation API.

Basic Interval Membership #

A value is in an interval [lo, hi]

Instances For
    theorem NN.MLTheory.CROWN.IntervalLemmas.inInterval_of_bounds {x lo hi : } (hlo : lo x) (hhi : x hi) :
    inInterval x lo hi

    Addition Interval Soundness #

    theorem NN.MLTheory.CROWN.IntervalLemmas.interval_add_sound {x y a b c d : } (hx : inInterval x a b) (hy : inInterval y c d) :
    inInterval (x + y) (a + c) (b + d)

    If x ∈ [a,b] and y ∈ [c,d], then x + y ∈ [a+c, b+d]

    Subtraction Interval Soundness #

    theorem NN.MLTheory.CROWN.IntervalLemmas.interval_sub_sound {x y a b c d : } (hx : inInterval x a b) (hy : inInterval y c d) :
    inInterval (x - y) (a - d) (b - c)

    If x ∈ [a,b] and y ∈ [c,d], then x - y ∈ [a-d, b-c]

    Multiplication Interval Soundness #

    Helper: minimum of four values

    Instances For

      Helper: maximum of four values

      Instances For
        theorem NN.MLTheory.CROWN.IntervalLemmas.interval_mul_sound {x y a b c d : } (hx : inInterval x a b) (hy : inInterval y c d) :
        inInterval (x * y) (min4 (a * c) (a * d) (b * c) (b * d)) (max4 (a * c) (a * d) (b * c) (b * d))

        For multiplication, the interval is [min(ac,ad,bc,bd), max(ac,ad,bc,bd)].

        The proof requires 9-case analysis based on signs of interval endpoints:

        1. a >= 0, c >= 0: min=ac, max=bd
        2. a >= 0, c < 0 <= d: min=bc, max=bd
        3. a >= 0, d < 0: min=bc, max=ad
        4. a < 0 <= b, c >= 0: min=ad, max=bd
        5. a < 0 <= b, c < 0 <= d: min=min(ad,bc), max=max(ac,bd)
        6. a < 0 <= b, d < 0: min=bc, max=ac
        7. b < 0, c >= 0: min=ad, max=bc
        8. b < 0, c < 0 <= d: min=ad, max=ac
        9. b < 0, d < 0: min=bd, max=ac

        The key insight is that extrema of the bilinear function x*y over a rectangle [a,b] x [c,d] occur at the corners.

        ReLU Interval Soundness #

        Real-valued ReLU used by the interval soundness lemmas.

        Instances For

          Monotonicity of ReLU on real inputs.

          ReLU outputs are always nonnegative.

          On the nonpositive branch, ReLU evaluates to zero.

          On the nonnegative branch, ReLU is the identity function.

          ReLU maps an input interval [l,u] into [max 0 l, max 0 u].

          Square Interval Soundness #

          Squaring function used by interval propagation lemmas.

          Instances For

            Squares over the reals are nonnegative.

            If 0 ≤ a ≤ b, then a² ≤ b²

            Lower endpoint for the range of x ↦ x^2 over an interval.

            Instances For

              Maximum square in an interval

              Instances For

                Square interval soundness: if x ∈ [l, u], then x² ∈ [minSq, maxSq]

                Negation Interval #

                Negation flips and swaps the interval: -[a,b] = [-b, -a]

                Absolute Value Interval #

                If x ∈ [l, u], then |x| is bounded