TorchLean API

NN.Proofs.Analysis.Lipschitz.Norm

Real-valued tensor norm facts #

This module owns the proof-oriented Tensor norm and distance definitions over , together with their algebraic properties. Neural-network Lipschitz bounds build on these facts in NN.Proofs.Analysis.Lipschitz.Network.

Scope and conventions #

PyTorch correspondence / citations #

Import NN.Proofs.Analysis.Lipschitz for both the norm foundation and network bounds, or this module when only the norm theory is needed.

Tensor norms and distance functions #

noncomputable def Proofs.tensorL2Norm {s : Spec.Shape} (t : TorchLean.Tensor s) :

$\ell_2$ norm (Euclidean norm) for tensors. Fundamental for measuring tensor magnitudes and distances.

Instances For
    noncomputable def Proofs.tensorLInftyNorm {s : Spec.Shape} (t : TorchLean.Tensor s) :

    $\ell_\infty$ norm (maximum norm) for tensors. Important for uniform convergence and pointwise bounds.

    Instances For
      noncomputable def Proofs.tensorL1Norm {s : Spec.Shape} (t : TorchLean.Tensor s) :

      $\ell_1$ norm (Manhattan norm) for tensors. Useful for sparsity-inducing regularization.

      Instances For
        noncomputable def Proofs.tensorL2Dist {s : Spec.Shape} (x y : TorchLean.Tensor s) :

        Distance function based on the $\ell_2$ norm.

        Instances For
          noncomputable def Proofs.tensorLInftyDist {s : Spec.Shape} (x y : TorchLean.Tensor s) :

          Distance function based on the $\ell_\infty$ norm.

          Instances For

            Bridges to the inner product space structure #

            The zero-filled tensor is the zero of the additive group.

            Scaling by a scalar is the module action.

            Spec.dot is the Euclidean inner product.

            tensorNormSquared is the squared Euclidean norm.

            tensorL2Dist is the Euclidean distance.

            Cross-library norm facts #

            NN.MLTheory.Robustness.Spec defines a scalar-polymorphic tensorLinfNorm. In this file we work over $\mathbb R$ and often use tensorL2Norm. The key inequality $\lVert v\rVert_\infty\le\lVert v\rVert_2$ is what lets $\ell_2$-based Lipschitz proofs feed directly into the $\ell_\infty$-robustness lemmas.

            For a real vector-valued tensor, the $\ell_\infty$ norm from NN.MLTheory.Robustness.Spec is bounded by the $\ell_2$ norm from this file:

            $\lVert v\rVert_\infty\le\lVert v\rVert_2$.

            Basic norm properties used throughout the Lipschitz development #

            The $\ell_2$ norm is nonnegative.

            The $\ell_2$ norm is zero if and only if the tensor is zero.

            Basic lemma: dot product with zero tensor is zero.

            Bilinearity of dot product over addition (distributive property).

            theorem Proofs.dot_quadratic_expand {s : Spec.Shape} (x y : TorchLean.Tensor s) (t : ) :
            Spec.dot (x.addSpec (y.scaleSpec t)) (x.addSpec (y.scaleSpec t)) = Spec.dot x x + 2 * t * Spec.dot x y + t ^ 2 * Spec.dot y y

            Bilinearity of the dot product: $\operatorname{dot}(x+ty,x+ty)=\lVert x\rVert^2+2t\langle x,y\rangle+t^2\lVert y\rVert^2$.

            Cauchy-Schwarz inequality for tensors. For any tensors $x$ and $y$, $|\langle x,y\rangle|\le\lVert x\rVert\,\lVert y\rVert$. This is a fundamental inequality in inner product spaces.

            Triangle inequality for the $\ell_2$ norm.

            Homogeneity of the $\ell_2$ norm.