TorchLean API

NN.MLTheory.CROWN.Operators.Arithmetic

NN.MLTheory.CROWN.Operators.Arithmetic #

IBP and affine transfer rules for arithmetic primitives (negation, absolute value, reciprocal, square root, powers, min/max) used by the CROWN bound propagation engine.

Negation #

Negation, $f(x)=-x$, is the simplest linear operation.

Instances For

    IBP for negation. Just swaps and negates bounds.

    Instances For

      Affine bounds for negation (exact).

      Instances For

        Derivative of negation (constant -1).

        Instances For

          Absolute Value #

          Absolute value: $f(x)=|x|$.

          Instances For

            Interval propagation rule for scalar absolute value over [l,u].

            Instances For

              Apply the scalar absolute-value interval rule coordinatewise to a vector box.

              Instances For
                def NN.MLTheory.CROWN.Operators.Arithmetic.affAbs {α : Type} [Context α] (l u : α) :
                α × α × α × α

                Affine lower and upper bounds for absolute value on an ordered interval [l, u].

                On an interval crossing zero, the lower bound is the zero line and the upper bound is the secant through (l, -l) and (u, u). The degenerate interval [0, 0] is represented by the zero line.

                Instances For

                  Reciprocal #

                  Reciprocal: $f(x)=1/x$.

                  Instances For

                    IBP for reciprocal on boxes, defined only when every coordinate interval excludes zero.

                    Instances For

                      Power #

                      def NN.MLTheory.CROWN.Operators.Arithmetic.posPow {α : Type} [Context α] (base : α) (exp : ) :
                      α

                      Helper for positive integer power.

                      Instances For

                        Integer power: $f(x)=x^n$.

                        Instances For

                          IBP for x².

                          Instances For
                            def NN.MLTheory.CROWN.Operators.Arithmetic.affSquare {α : Type} [Context α] (l u : α) :
                            α × α × α × α

                            Affine bounds for x².

                            Instances For

                              Min/Max #

                              Elementwise minimum of two boxes.

                              Instances For

                                Elementwise maximum of two boxes.

                                Instances For
                                  def NN.MLTheory.CROWN.Operators.Arithmetic.clampScalar {α : Type} [Context α] (x clampLo clampHi : α) :
                                  α

                                  Clamp one scalar with the same composition used by Spec.clampSpec: min clampHi (max clampLo x).

                                  In particular, when clampLo > clampHi, the result is clampHi. This agrees with PyTorch's documented behavior instead of silently switching the two bounds.

                                  Instances For
                                    def NN.MLTheory.CROWN.Operators.Arithmetic.ibpClampScalar {α : Type} [Context α] (xLo xHi clampLo clampHi : α) :
                                    α × α

                                    Clamp operation: clamp(x, lo, hi) = min(hi, max(lo, x)).

                                    Instances For

                                      Interval propagation for clamp, applied coordinatewise to a vector box.

                                      Instances For