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 #

        ReLU function: max(0, x)

        Instances For

          ReLU is monotone

          ReLU is non-negative

          If x ≤ 0, then relu(x) = 0

          If 0 ≤ x, then relu(x) = x

          ReLU interval: if x ∈ [l, u], then relu(x) ∈ [max(0,l), max(0,u)]

          Square Interval Soundness #

          Square function

          Instances For

            Square is non-negative

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

            Minimum square in 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