TorchLean API

NN.MLTheory.CROWN.Cert.AlphaCROWN

α-CROWN transfer step (graph dialect) #

This file defines a pure, per-node transfer rule for affine bound propagation in the NN.MLTheory.CROWN.Graph dialect, extended with an α-parameter for the ReLU lower relaxation (α-CROWN).

The step function is shared by:

This module does not implement the outer dual-parameter optimization loop used by α/β-CROWN; it only defines the local transfer rule for a fixed set of α-parameters.

References #

Affine bounds in the graph dialect #

A FlatAffineBounds α stores two affine maps (lower/upper) of the flattened input vector: $$ \ell(x) = A_\ell x + c_\ell,\qquad u(x) = A_u x + c_u. $$ These are propagated through the graph using local transfer rules.

The certificate checker recomputes these affine maps node-by-node, so the functions below are written in an executable style (using the repo’s Tensor operations), while still being usable in theorem statements over ℝ.

α-ReLU lower relaxation #

α-CROWN lower relaxation for ReLU #

For a pre-activation scalar $z\in[l,u]$, CROWN/DeepPoly uses:

In the unstable crossing case $l < 0 < u$, the lower relaxation can be parameterized by $\alpha\in[0,1]$ to interpolate between the sound choices $y \ge 0$ and $y \ge z$.

We encode this by using alphaRelaxLowerScalar for the lower bound, and using Runtime.Ops.ReLU.relaxScalar / relaxVector for the upper bound.

The α-CROWN lower relaxation of a scalar ReLU on [l, u] with slope parameter a.

A stable-active neuron gets the identity, a stable-inactive one gets zero, and an unstable one gets the tunable line y = a·x through the origin.

Instances For

    Vectorized α-CROWN lower relaxation for ReLU, applied componentwise.

    Instances For

      Node step function #

      Safe lookup of the affine bounds recorded for node id pid, none when out of range.

      Instances For

        Safe lookup of the optional α vector at node id pid.

        Instances For

          Default α vector used when the certificate omits α values.

          This matches TorchLean's default lower relaxation: pick slope 1 when u > -l, otherwise 0.

          Instances For

            One-node α-CROWN step function for a supported subset of IR ops.

            The step returns none when required parent bounds or parameters are missing, or when dimensions mismatch. Callers must validate node ids and the size of the IBP table before calling it; direct array indexing relies on those invariants.

            It is intended to be used for:

            • executable per-node certificate checking (recompute node id from certificate parents), and
            • proof-level soundness theorems about the checker.

            Supported node kinds #

            This step function handles the verifier core of the IR:

            • .input, .const, .detach
            • .linear, .matmul (ParamStore-driven linear operators in the verifier dialect)
            • .relu (CROWN upper + α-CROWN lower)
            • .sum (treated as a $1\times n$ linear layer)
            • .reshape, .flatten (shape-only, guarded by dimensional consistency)

            Custom computations return none, even when an IBP box is supplied: a source-evaluation proof does not supply a real-enclosure or derivative rule. Other node kinds fall back to a conservative constant affine enclosure derived from the IBP box at the same node id (if present). The checker remains total over graphs that contain operators outside this affine-transfer subset; end-to-end theorems account for those nodes through the soundness assumptions attached to their IBP boxes.

            Instances For