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. Simplest linear operation.

Instances For

    IBP for negation. Just swaps and negates bounds.

    Instances For

      IBP for negation on boxes.

      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

              IBP for absolute value.

              Instances For

                IBP for absolute value on boxes.

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

                  Affine bounds for absolute value.

                  Instances For

                    Square Root #

                    Square-root approximation using two Babylonian refinement steps for a Context scalar.

                    Instances For

                      IBP for square root. Sqrt is monotone increasing on [0,∞).

                      Instances For

                        IBP for square root on boxes.

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

                          Affine bounds for square root (concave function). Upper: tangent line, Lower: secant line.

                          Instances For

                            Derivative bounds for sqrt: d/dx √x = 1/(2√x).

                            Instances For

                              Reciprocal #

                              Reciprocal: f(x) = 1/x.

                              Instances For

                                IBP for reciprocal. Warning: 1/x has asymptote at 0, so this is only valid when 0 ∉ [l,u].

                                Instances For

                                  Affine bounds for reciprocal (convex for x > 0). Lower: secant line, Upper: tangent line.

                                  Instances For

                                    Derivative bounds for reciprocal: d/dx (1/x) = -1/x².

                                    Instances For

                                      Power #

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

                                      Helper for positive integer power.

                                      Instances For

                                        Power: f(x) = x^n (integer power).

                                        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.ibpClampScalar {α : Type} [Context α] (x_lo x_hi clamp_lo clamp_hi : α) :
                                                  α × α

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

                                                  Instances For

                                                    IBP for clamp.

                                                    Instances For

                                                      Negation IBP is exact. This states the basic structure of negation bounds.

                                                      theorem NN.MLTheory.CROWN.Operators.Arithmetic.Theorems.abs_ibp_returns_pair {α : Type} [Context α] (l u : α) :
                                                      ∃ (lo : α) (hi : α), ibpAbsScalar l u = (lo, hi)

                                                      Absolute value IBP returns a pair.

                                                      theorem NN.MLTheory.CROWN.Operators.Arithmetic.Theorems.square_ibp_returns_pair {α : Type} [Context α] (l u : α) :
                                                      ∃ (lo : α) (hi : α), ibpSquareScalar l u = (lo, hi)

                                                      Square IBP returns a pair.