TorchLean API

NN.MLTheory.CROWN.Runtime.Ops

Runtime CROWN operators #

Executable helper operators for the graph-based CROWN/IBP engine.

This file keeps runtime certificate replay separate from proof imports:

These definitions live under NN.MLTheory.CROWN.Runtime.Ops, with no direct Mathlib dependency. The proof modules can cite these functions, but this file itself stays focused on the runtime support code used for fast certificate replay.

References (bound propagation background):

Parameters of a per-neuron affine relaxation y = slope * x + bias used in CROWN/DeepPoly.

  • slope : α

    Linear coefficient.

  • bias : α

    Constant offset.

Instances For

    Upper (over-approx) affine relaxation for ReLU on an interval [l,u].

    Returns parameters (slope, bias) for a line y = slope * x + bias that upper-bounds relu x for all x ∈ [l,u].

    Instances For

      Lower (under-approx) relaxation for ReLU.

      For crossing bounds l < 0 < u, basic CROWN/DeepPoly chooses either:

      Vectorized relax_scalar, applied componentwise to lo/hi.

      Instances For

        Vectorized relax_scalar_lower, applied componentwise to lo/hi.

        Instances For
          def NN.MLTheory.CROWN.Runtime.Ops.ReLU.propagateAffine {α : Type} [Context α] {inDim hidDim : } (relax : Spec.Tensor (ReLURelax α) (Spec.Shape.dim hidDim Spec.Shape.scalar)) (aff : AffineVec α inDim hidDim) :
          AffineVec α inDim hidDim

          Propagate an affine form through ReLU using a per-neuron relaxation.

          Given y ≈ A*x + c and per-output relaxations (slopeᵢ, biasᵢ), produces the affine form y' ≈ diag(slope) * (A*x + c) + bias.

          Instances For

            Generic elementwise bound propagation for monotone activations (min/max of endpoints).

            Instances For

              Interval bound propagation for sigmoid (monotone, so min/max of endpoints).

              Instances For

                Interval bound propagation for tanh (monotone, so min/max of endpoints).

                Instances For

                  Conservative IBP for sin using a 1-Lipschitz enclosure: sin([l,u]) ⊆ [sin(m)-r, sin(m)+r] ∩ [-1,1], m=(l+u)/2, r=(u-l)/2.

                  This avoids periodic case splits (no floor/ceil in Context α) while remaining sound.

                  Instances For

                    Same 1-Lipschitz enclosure as IBP.sin, but for cos.

                    Instances For