TorchLean

8.6. Models and Mathematical Examples🔗

The model API provides seeded architecture builders, while the proof library also studies compact mathematical models directly. This chapter samples both sides: an implemented MLP, reference specifications, and theorem families for approximation, diffusion, associative memory, reinforcement learning, attention, state-space models, and self-supervised objectives.

Definition8.6.1
groupuses 0used by 1L∃∀N

nn.M is the state monad used by seeded builders. It threads an explicit SeedStream through a pure construction and yields the same result whenever nn.run starts from the same seed.

Lean code for Definition8.6.11 definition
  • abbrevdefined in NN/API/Seeded.lean
    complete
    abbrev TorchLean.nn.M.{u_1} (α : Type u_1) : Type u_1
    abbrev TorchLean.nn.M.{u_1} (α : Type u_1) :
      Type u_1
    Seeded builder monad: a state monad over `TorchLean.rand.SeedStream`. 
Definition8.6.2
groupuses 1used by 0L∃∀N

This seeded builder constructs one batched, single-hidden-layer MLP: a linear layer, ReLU, and a second linear layer.

Lean code for Definition8.6.21 definition
  • defdefined in NN/API/Models/Mlp.lean
    complete
    def TorchLean.nn.models.mlpRelu (cfg : TorchLean.nn.models.MlpConfig) :
      TorchLean.nn.M
        (TorchLean.nn.Sequential (TorchLean.nn.models.mlpInShape cfg)
          (TorchLean.nn.models.mlpOutShape cfg))
    def TorchLean.nn.models.mlpRelu
      (cfg : TorchLean.nn.models.MlpConfig) :
      TorchLean.nn.M
        (TorchLean.nn.Sequential
          (TorchLean.nn.models.mlpInShape cfg)
          (TorchLean.nn.models.mlpOutShape
            cfg))
    Build a single-hidden-layer MLP with relu activation:
    
    `linear(inDim → hidDim) → relu → linear(hidDim → outDim)`.
    
Definition8.6.3
Group: Reference definitions used by the mathematical examples below. (2)
Group member previews
Preview
Definition 8.6.4
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0L∃∀N

A k-nearest-neighbor model stores k together with a list of fixed-length feature vectors and their labels or regression targets. The structure itself does not assert any statistical property.

Lean code for Definition8.6.31 definition
  • structure(2 fields)defined in NN/Spec/Models/Knn.lean
    complete
    structure Spec.KNN (α β : Type) (n : ) : Type
    structure Spec.KNN (α β : Type) (n : ) : Type
    A small kNN model container (parameters + stored dataset).
    
    This is a *lazy* model: inference consults the stored `dataset` at query time, rather than learning
    weights.
    
    k : 
    Number of neighbors to consult. 
    dataset : List (Spec.Tensor α (Spec.Shape.dim n Spec.Shape.scalar) × β)
    Training data: feature vectors paired with labels/targets. 
Definition8.6.4
Group: Reference definitions used by the mathematical examples below. (2)
Group member previews
Preview
Definition 8.6.3
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1L∃∀N

A Hopfield state is a Boolean vector. Given a weight matrix and one threshold per coordinate, this update applies the threshold rule at one index, with ties sent to the active state.

Lean code for Definition8.6.41 definition
  • complete
    def Spec.Hopfield.updateAt {α : Type} [AddCommMonoid α] [Mul α] [One α]
      [Neg α] [LE α] [DecidableRel fun x1 x2 => x1  x2] {n : }
      (p : Spec.Hopfield.Params α n) (s : Spec.Hopfield.State n)
      (u : Fin n) : Spec.Hopfield.State n
    def Spec.Hopfield.updateAt {α : Type}
      [AddCommMonoid α] [Mul α] [One α]
      [Neg α] [LE α]
      [DecidableRel fun x1 x2 => x1  x2]
      {n : } (p : Spec.Hopfield.Params α n)
      (s : Spec.Hopfield.State n)
      (u : Fin n) : Spec.Hopfield.State n
    Asynchronous update at a single coordinate `u`.
    
    We implement the standard thresholded sign rule:
    
    `s[u] := (θ_u ≤ net_u)`
    
    Interpreting `true ↦ +1` and `false ↦ -1`, this corresponds to:
    
    `x_u := +1` if `net_u ≥ θ_u`, otherwise `x_u := -1`.
    
    Tie-handling (`net_u = θ_u`) matters for formal convergence arguments; we pick the convention
    "ties go to `+1`" via `≤`.
    
Definition8.6.5
Group: Reference definitions used by the mathematical examples below. (2)
Group member previews
Preview
Definition 8.6.3
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1L∃∀N

Over a field, Hopfield energy is the usual quadratic weight term plus the linear threshold term on the Boolean state's \{-1,1\} encoding.

Lean code for Definition8.6.51 definition
  • complete
    def Spec.Hopfield.energy {α : Type} [Field α] {n : }
      (p : Spec.Hopfield.Params α n) (s : Spec.Hopfield.State n) : α
    def Spec.Hopfield.energy {α : Type} [Field α]
      {n : } (p : Spec.Hopfield.Params α n)
      (s : Spec.Hopfield.State n) : α
    The classical Hopfield energy for a state `s` (quadratic term + linear threshold term).
    
    With `x = actVec s` the `±1` encoding, the energy is:
    
    `E(s) = -1/2 * Σ_i Σ_j W_ij x_i x_j + Σ_i θ_i x_i`.
    
    When `W` is symmetric and has a zero diagonal, asynchronous updates are known to monotonically
    decrease (or not increase) `E`, which is the classic Lyapunov-style argument for convergence.
    
Theorem8.6.6
Group: Representative mathematical results attached to model semantics. (12)
Group member previews
Preview
Definition 8.6.7
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0L∃∀N

Let a<b and L>0. If a real function is L-Lipschitz on [a,b], then for every positive error tolerance there is a two-layer ReLU MLP that stays within that tolerance throughout the interval. This uses the real instance of the scalar context.

Lean code for Theorem8.6.61 theorem
  • theorem NN.MLTheory.Proofs.UniversalApproximation.relu_universal_approximation_Icc
      {f :   } {a b L : } (h_ab : a < b) (hL : 0 < L)
      (h_lip :
         x  Set.Icc a b,  y  Set.Icc a b, |f x - f y|  L * |x - y|)
      (ε : ) :
      ε > 0 
         hidDim l1 l2,
           x  Set.Icc a b,
            |f x -
                  NN.MLTheory.Proofs.UniversalApproximation.mlpEval1d hidDim
                    l1 l2 x| <
              ε
    theorem NN.MLTheory.Proofs.UniversalApproximation.relu_universal_approximation_Icc
      {f :   } {a b L : } (h_ab : a < b)
      (hL : 0 < L)
      (h_lip :
         x  Set.Icc a b,
           y  Set.Icc a b,
            |f x - f y|  L * |x - y|)
      (ε : ) :
      ε > 0 
         hidDim l1 l2,
           x  Set.Icc a b,
            |f x -
                  NN.MLTheory.Proofs.UniversalApproximation.mlpEval1d
                    hidDim l1 l2 x| <
              ε
    1D Universal Approximation (ReLU, one hidden layer), stated as an existence theorem for a 2-layer
      MLP.
    
    This is a wrapper around `relu_universal_approximation_Icc_hinge` that instantiates the linear
      layers
    as the explicit hinge construction.
    
Proof for Theorem 8.6.6

A uniform grid gives a piecewise-linear approximation. Its slope changes become shifted ReLU hinges, and the shape-indexed tensor semantics show that the explicit two-layer MLP computes the resulting hinge sum exactly.

Definition8.6.7
Group: Representative mathematical results attached to model semantics. (12)
Group member previews
Preview
Theorem 8.6.6
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1L∃∀N

A forward diffusion step scales the current value and adds independent Gaussian noise according to the schedule.

Lean code for Definition8.6.71 definition
  • def NN.Proofs.Probability.forwardKernel.{u_1} {E : Type u_1}
      [NormedAddCommGroup E] [InnerProductSpace  E] [FiniteDimensional  E]
      [MeasurableSpace E] (a b : ) : ProbabilityTheory.Kernel E E
    def NN.Proofs.Probability.forwardKernel.{u_1}
      {E : Type u_1} [NormedAddCommGroup E]
      [InnerProductSpace  E]
      [FiniteDimensional  E]
      [MeasurableSpace E] (a b : ) :
      ProbabilityTheory.Kernel E E
    Forward noising kernel for a diffusion step, as a Markov kernel. 
Theorem8.6.8
Group: Representative mathematical results attached to model semantics. (12)
Group member previews
Preview
Theorem 8.6.6
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0L∃∀N

On a finite-dimensional real inner-product space with its Borel structure, each measure returned by the forward diffusion kernel is Gaussian.

Lean code for Theorem8.6.81 theorem
  • complete
    theorem NN.Proofs.Probability.isGaussian_forwardKernel.{u_1} {E : Type u_1}
      [NormedAddCommGroup E] [InnerProductSpace  E] [FiniteDimensional  E]
      [MeasurableSpace E] [BorelSpace E] (a b : ) (x : E) :
      ProbabilityTheory.IsGaussian
        ((NN.Proofs.Probability.forwardKernel a b) x)
    theorem NN.Proofs.Probability.isGaussian_forwardKernel.{u_1}
      {E : Type u_1} [NormedAddCommGroup E]
      [InnerProductSpace  E]
      [FiniteDimensional  E]
      [MeasurableSpace E] [BorelSpace E]
      (a b : ) (x : E) :
      ProbabilityTheory.IsGaussian
        ((NN.Proofs.Probability.forwardKernel
            a b)
          x)
    Each transition distribution of the forward kernel is Gaussian. 
Proof for Theorem 8.6.8

The forward kernel is identified with the affine image of a standard Gaussian, and affine images preserve Gaussianity.

Theorem8.6.9
Group: Representative mathematical results attached to model semantics. (12)
Group member previews
Preview
Theorem 8.6.6
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 8.6.4
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 1L∃∀N

For symmetric Hopfield weights with a zero diagonal, a state-changing sweep of asynchronous coordinate updates either lowers the energy or leaves it unchanged while strictly increasing the number of active coordinates.

Lean code for Theorem8.6.91 theorem
  • complete
    theorem NN.MLTheory.Proofs.Hopfield.cycleUpdate_progress {n : }
      (p : Spec.Hopfield.Params  n)
      (hsym : NN.MLTheory.Proofs.Hopfield.SymmetricW p)
      (hdiag : NN.MLTheory.Proofs.Hopfield.DiagonalZero p)
      (s : Spec.Hopfield.State n)
      (hchange : NN.MLTheory.Proofs.Hopfield.cycleUpdate p s  s) :
      Spec.Hopfield.energy p (NN.MLTheory.Proofs.Hopfield.cycleUpdate p s) <
          Spec.Hopfield.energy p s 
        Spec.Hopfield.energy p
              (NN.MLTheory.Proofs.Hopfield.cycleUpdate p s) =
            Spec.Hopfield.energy p s 
          Spec.Hopfield.pluses
              (NN.MLTheory.Proofs.Hopfield.cycleUpdate p s) >
            Spec.Hopfield.pluses s
    theorem NN.MLTheory.Proofs.Hopfield.cycleUpdate_progress
      {n : } (p : Spec.Hopfield.Params  n)
      (hsym :
        NN.MLTheory.Proofs.Hopfield.SymmetricW
          p)
      (hdiag :
        NN.MLTheory.Proofs.Hopfield.DiagonalZero
          p)
      (s : Spec.Hopfield.State n)
      (hchange :
        NN.MLTheory.Proofs.Hopfield.cycleUpdate
            p s 
          s) :
      Spec.Hopfield.energy p
            (NN.MLTheory.Proofs.Hopfield.cycleUpdate
              p s) <
          Spec.Hopfield.energy p s 
        Spec.Hopfield.energy p
              (NN.MLTheory.Proofs.Hopfield.cycleUpdate
                p s) =
            Spec.Hopfield.energy p s 
          Spec.Hopfield.pluses
              (NN.MLTheory.Proofs.Hopfield.cycleUpdate
                p s) >
            Spec.Hopfield.pluses s
Proof for Theorem 8.6.9
Proof uses 2
Proof dependency previews
Preview
Definition 8.6.4
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

The proof folds the one-coordinate energy inequalities over the updates in one sweep. When the state changes without lowering energy, the tie rule forces the active-coordinate count to increase.

Theorem8.6.10
Group: Representative mathematical results attached to model semantics. (12)
Group member previews
Preview
Theorem 8.6.6
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0L∃∀N

Under the same symmetry and zero-diagonal assumptions, the cycle progress theorem shows that any state lying on a positive-period cycle is already fixed by one full sweep.

Lean code for Theorem8.6.101 theorem
  • theorem NN.MLTheory.Proofs.Hopfield.cycleUpdate_no_nontrivial_cycles {n : }
      (p : Spec.Hopfield.Params  n)
      (hsym : NN.MLTheory.Proofs.Hopfield.SymmetricW p)
      (hdiag : NN.MLTheory.Proofs.Hopfield.DiagonalZero p) {k : }
      (hk : 0 < k) (s : Spec.Hopfield.State n)
      (hcyc : (NN.MLTheory.Proofs.Hopfield.f p)^[k] s = s) :
      NN.MLTheory.Proofs.Hopfield.f p s = s
    theorem NN.MLTheory.Proofs.Hopfield.cycleUpdate_no_nontrivial_cycles
      {n : } (p : Spec.Hopfield.Params  n)
      (hsym :
        NN.MLTheory.Proofs.Hopfield.SymmetricW
          p)
      (hdiag :
        NN.MLTheory.Proofs.Hopfield.DiagonalZero
          p)
      {k : } (hk : 0 < k)
      (s : Spec.Hopfield.State n)
      (hcyc :
        (NN.MLTheory.Proofs.Hopfield.f p)^[k]
            s =
          s) :
      NN.MLTheory.Proofs.Hopfield.f p s = s
Proof for Theorem 8.6.10

By cycle progress, a non-fixed first step would force lexicographic progress in energy and active-coordinate count. That progress cannot return to its starting value after finitely many sweeps.

Definition8.6.11
Group: Representative mathematical results attached to model semantics. (12)
Group member previews
Preview
Theorem 8.6.6
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1L∃∀N

The distance between two real value functions is the supremum of their pointwise absolute differences.

Lean code for Definition8.6.111 definition
  • complete
    def Proofs.RL.Markov.valueSupDist {S : Type} [Nonempty S]
      (values₁ values₂ : Spec.RL.Markov.ValueFunction S) : 
    def Proofs.RL.Markov.valueSupDist {S : Type}
      [Nonempty S]
      (values₁ values₂ :
        Spec.RL.Markov.ValueFunction S) :
      
    Sup distance on value functions, using `sSup` over pointwise absolute differences. 
Theorem8.6.12
Group: Representative mathematical results attached to model semantics. (12)
Group member previews
Preview
Theorem 8.6.6
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 1L∃∀N

For a valid MDP with a nonempty state space and a finite nonempty action space, the Bellman optimality operator contracts the sup distance between bounded measurable value functions by the discount factor.

Lean code for Theorem8.6.121 theorem
  • theoremdefined in NN/Proofs/RL/MarkovMDP.lean
    complete
    theorem Proofs.RL.Markov.bellmanOptimality_contraction {S A : Type}
      [MeasurableSpace S] [MeasurableSpace A] [Nonempty S]
      (mdp : Spec.RL.Markov.MDP S A) (valid : Spec.RL.Markov.Valid mdp)
      [Fintype A] [Nonempty A]
      (values₁ values₂ : Spec.RL.Markov.ValueFunction S)
      (hMeas₁ : Measurable values₁) (hMeas₂ : Measurable values₂)
      (hBdd₁ : BddAbove (Set.range fun s => |values₁ s|))
      (hBdd₂ : BddAbove (Set.range fun s => |values₂ s|)) :
      Proofs.RL.Markov.valueSupDist
          (Spec.RL.Markov.bellmanOptimality mdp values₁)
          (Spec.RL.Markov.bellmanOptimality mdp values₂) 
        mdp.discount * Proofs.RL.Markov.valueSupDist values₁ values₂
    theorem Proofs.RL.Markov.bellmanOptimality_contraction
      {S A : Type} [MeasurableSpace S]
      [MeasurableSpace A] [Nonempty S]
      (mdp : Spec.RL.Markov.MDP S A)
      (valid : Spec.RL.Markov.Valid mdp)
      [Fintype A] [Nonempty A]
      (values₁ values₂ :
        Spec.RL.Markov.ValueFunction S)
      (hMeas₁ : Measurable values₁)
      (hMeas₂ : Measurable values₂)
      (hBdd₁ :
        BddAbove
          (Set.range fun s => |values₁ s|))
      (hBdd₂ :
        BddAbove
          (Set.range fun s => |values₂ s|)) :
      Proofs.RL.Markov.valueSupDist
          (Spec.RL.Markov.bellmanOptimality
            mdp values₁)
          (Spec.RL.Markov.bellmanOptimality
            mdp values₂) 
        mdp.discount *
          Proofs.RL.Markov.valueSupDist
            values₁ values₂
    Bellman optimality is a `γ`-contraction in the sup metric (finite action space):
    
    `valueSupDist (T* values₁) (T* values₂) ≤ γ * valueSupDist values₁ values₂`. 
Proof for Theorem 8.6.12

After unfolding the sup distance, the maximum over actions is nonexpansive, while integration scales the remaining pointwise difference by the discount factor.

Theorem8.6.13
Group: Representative mathematical results attached to model semantics. (12)
Group member previews
Preview
Theorem 8.6.6
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0L∃∀N

For the same class of MDPs, the contraction bound shows that bounded measurable fixed points of the Bellman optimality operator coincide.

Lean code for Theorem8.6.131 theorem
  • theoremdefined in NN/Proofs/RL/MarkovMDP.lean
    complete
    theorem Proofs.RL.Markov.bellmanOptimality_fixedPoint_unique {S A : Type}
      [MeasurableSpace S] [MeasurableSpace A] [Nonempty S]
      (mdp : Spec.RL.Markov.MDP S A) (valid : Spec.RL.Markov.Valid mdp)
      [Fintype A] [Nonempty A] (v w : Spec.RL.Markov.ValueFunction S)
      (hv : Spec.RL.Markov.bellmanOptimality mdp v = v)
      (hw : Spec.RL.Markov.bellmanOptimality mdp w = w)
      (hMeasV : Measurable v) (hMeasW : Measurable w)
      (hBddV : BddAbove (Set.range fun s => |v s|))
      (hBddW : BddAbove (Set.range fun s => |w s|)) : v = w
    theorem Proofs.RL.Markov.bellmanOptimality_fixedPoint_unique
      {S A : Type} [MeasurableSpace S]
      [MeasurableSpace A] [Nonempty S]
      (mdp : Spec.RL.Markov.MDP S A)
      (valid : Spec.RL.Markov.Valid mdp)
      [Fintype A] [Nonempty A]
      (v w : Spec.RL.Markov.ValueFunction S)
      (hv :
        Spec.RL.Markov.bellmanOptimality mdp
            v =
          v)
      (hw :
        Spec.RL.Markov.bellmanOptimality mdp
            w =
          w)
      (hMeasV : Measurable v)
      (hMeasW : Measurable w)
      (hBddV :
        BddAbove (Set.range fun s => |v s|))
      (hBddW :
        BddAbove (Set.range fun s => |w s|)) :
      v = w
    If the Bellman optimality operator has a fixed point, it is unique (finite action space).
    
Proof for Theorem 8.6.13

Applying the Bellman contraction to two fixed points forces their sup distance below every geometric iterate and hence to zero.

Theorem8.6.14
Group: Representative mathematical results attached to model semantics. (12)
Group member previews
Preview
Theorem 8.6.6
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 1L∃∀N

For attention over shape-indexed tensors, the causal mask marks every strict-future key as blocked.

Lean code for Theorem8.6.141 theorem
  • complete
    theorem NN.Proofs.Models.Attention.causalMask_blocks_future {n : }
      (i j : Fin n) (hij : i < j) :
      Spec.get2 (Spec.causalMask n) i j = false
    theorem NN.Proofs.Models.Attention.causalMask_blocks_future
      {n : } (i j : Fin n) (hij : i < j) :
      Spec.get2 (Spec.causalMask n) i j =
        false
    A causal mask rejects every strict future key position. 
Proof for Theorem 8.6.14

The typed mask is read at the two indices, and the result follows from the comparison used to construct that entry.

Theorem8.6.15
Group: Representative mathematical results attached to model semantics. (12)
Group member previews
Preview
Theorem 8.6.6
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0L∃∀N

Combined with the causal-mask result, exact hard-masked softmax assigns zero weight to every strict-future position.

Lean code for Theorem8.6.151 theorem
  • complete
    theorem NN.Proofs.Models.Attention.hardMaskedSoftmaxSpec_causal_future_zero
      {n : }
      (scores :
        Spec.Tensor 
          (Spec.Shape.dim n (Spec.Shape.dim n Spec.Shape.scalar)))
      (i j : Fin n) (hij : i < j) :
      Spec.get2 (Spec.hardMaskedSoftmaxSpec scores (Spec.causalMask n)) i
          j =
        0
    theorem NN.Proofs.Models.Attention.hardMaskedSoftmaxSpec_causal_future_zero
      {n : }
      (scores :
        Spec.Tensor 
          (Spec.Shape.dim n
            (Spec.Shape.dim n
              Spec.Shape.scalar)))
      (i j : Fin n) (hij : i < j) :
      Spec.get2
          (Spec.hardMaskedSoftmaxSpec scores
            (Spec.causalMask n))
          i j =
        0
    In exact hard-masked causal softmax, every strict-future attention weight is exactly zero. 
Proof for Theorem 8.6.15

The causal-mask theorem selects the blocked branch, whose output is definitionally zero.

Theorem8.6.16
Group: Representative mathematical results attached to model semantics. (12)
Group member previews
Preview
Theorem 8.6.6
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0L∃∀N

For compact Mamba runs over shape-indexed tensors, appending later inputs does not change the earlier output prefix.

Lean code for Theorem8.6.161 theorem
  • theorem NN.MLTheory.StateSpace.compactMamba_runList_append_outputs_prefix
      {α : Type} [Context α] {inputDim stateDim outputDim : }
      (m : Models.MambaBlockSpec α inputDim stateDim outputDim)
      (h0 : Spec.Tensor α (Spec.Shape.dim stateDim Spec.Shape.scalar))
      (xs ys :
        List (Spec.Tensor α (Spec.Shape.dim inputDim Spec.Shape.scalar))) :
      List.take xs.length (m.runList h0 (xs ++ ys)).2 = (m.runList h0 xs).2
    theorem NN.MLTheory.StateSpace.compactMamba_runList_append_outputs_prefix
      {α : Type} [Context α]
      {inputDim stateDim outputDim : }
      (m :
        Models.MambaBlockSpec α inputDim
          stateDim outputDim)
      (h0 :
        Spec.Tensor α
          (Spec.Shape.dim stateDim
            Spec.Shape.scalar))
      (xs ys :
        List
          (Spec.Tensor α
            (Spec.Shape.dim inputDim
              Spec.Shape.scalar))) :
      List.take xs.length
          (m.runList h0 (xs ++ ys)).2 =
        (m.runList h0 xs).2
    Compact Mamba prefix causality.
    
    If a sequence `xs` has already been processed, appending future tokens `ys` cannot change the
    outputs for `xs`.  This is the recurrent-model analogue of causal attention non-anticipation.
    
Proof for Theorem 8.6.16

Induction over the input list unfolds the recurrence on shape-indexed states and tokens, showing that the original scan steps and states are unchanged before the appended suffix begins.

Definition8.6.17
Group: Representative mathematical results attached to model semantics. (12)
Group member previews
Preview
Theorem 8.6.6
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1L∃∀N

This finite analogue of the VICReg variance term sums the natural-number hinge \gamma-v over already-computed coordinate summaries.

Lean code for Definition8.6.171 definition
  • def NN.MLTheory.SelfSupervised.varianceTerm (gamma : )
      (variances : List ) : 
    def NN.MLTheory.SelfSupervised.varianceTerm
      (gamma : ) (variances : List ) : 
    Sum of per-coordinate variance-floor penalties for one embedding branch. 
Theorem8.6.18
Group: Representative mathematical results attached to model semantics. (12)
Group member previews
Preview
Theorem 8.6.6
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0L∃∀N

If \gamma is positive, then the variance term is positive on any nonempty list in which every coordinate summary is zero. This finite arithmetic statement does not claim that an optimizer avoids collapse.

Lean code for Theorem8.6.181 theorem
  • complete
    theorem NN.MLTheory.SelfSupervised.varianceTerm_collapsed_positive {gamma d : }
      ( : 0 < gamma) :
      0 <
        NN.MLTheory.SelfSupervised.varianceTerm gamma
          (List.replicate (d + 1) 0)
    theorem NN.MLTheory.SelfSupervised.varianceTerm_collapsed_positive
      {gamma d : } ( : 0 < gamma) :
      0 <
        NN.MLTheory.SelfSupervised.varianceTerm
          gamma (List.replicate (d + 1) 0)
    If $\gamma>0$ and there is at least one collapsed coordinate, the variance term is positive. 
Proof for Theorem 8.6.18

The variance sum on d+1 zeros is rewritten as (d+1)\gamma, whose factors are both positive.