Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Platonic JEPAs: finite world, positive-pair laws, JEPA objectives, spectral and alignment quantities

Definition
PlatonicJEPA_Basic

by Xeroth · Nov 23, 2026 · Mathlib 0df444a (Lean v4.33.1)

machine-learningplatonic-representation-hypothesisrepresentation-learningspectral-theory

Objects of Section 2 and Appendix A.1 of Balestriero and LeCun (2026).

  1. World and positive pairs. A world is a finite set ZZZ of states with probabilities p(z)>0p(z)>0p(z)>0, ∑zp(z)=1\sum_z p(z)=1∑z​p(z)=1. A positive-pair law is a symmetric law π(z,z′)≥0\pi(z,z')\ge0π(z,z′)≥0 on pairs of states whose marginals both equal ppp.
  2. Embeddings and rotations. An embedding is h:Z→Rkh:Z\to\mathbb{R}^kh:Z→Rk, with ∥a∥2=∑iai2\|a\|^2=\sum_i a_i^2∥a∥2=∑i​ai2​. An orthogonal Q∈O(k)Q\in O(k)Q∈O(k) acts by a↦Qaa\mapsto Qaa↦Qa. The law of the embeddings is ∑zp(z) δh(z)\sum_z p(z)\,\delta_{h(z)}∑z​p(z)δh(z)​.
  3. JEPA objective (eq. 1). For a prediction term ℓ\ellℓ and an anti-collapse term Ω\OmegaΩ that depends on hhh only through the law of its embeddings and may equal +∞+\infty+∞, Lπ(h)=∑z,z′π(z,z′) ℓ(h(z),h(z′))+Ω(h)L_\pi(h)=\sum_{z,z'}\pi(z,z')\,\ell(h(z),h(z'))+\Omega(h)Lπ​(h)=∑z,z′​π(z,z′)ℓ(h(z),h(z′))+Ω(h). A modality that renders zzz as g(z)g(z)g(z) trains an encoder fff on its observations with Lm(f)=∑z,z′π(z,z′) ℓ(f(g(z)),f(g(z′)))+Ω(f∘g)L_m(f)=\sum_{z,z'}\pi(z,z')\,\ell(f(g(z)),f(g(z')))+\Omega(f\circ g)Lm​(f)=∑z,z′​π(z,z′)ℓ(f(g(z)),f(g(z′)))+Ω(f∘g).
  4. Spectral JEPA (Proposition 1). hhh is whitened if ∑zp(z)h(z)=0\sum_z p(z)h(z)=0∑z​p(z)h(z)=0 and ∑zp(z)h(z)h(z)⊤=Ik\sum_z p(z)h(z)h(z)^\top=I_k∑z​p(z)h(z)h(z)⊤=Ik​. The prediction loss is ∑z,z′π(z,z′)∥h(z)−h(z′)∥2\sum_{z,z'}\pi(z,z')\|h(z)-h(z')\|^2∑z,z′​π(z,z′)∥h(z)−h(z′)∥2, and a spectral minimiser minimises it among whitened embeddings.
  5. Spectrum. Kπ=D−1/2ΠD−1/2K_\pi=D^{-1/2}\Pi D^{-1/2}Kπ​=D−1/2ΠD−1/2 with D=diag(p)D=\mathrm{diag}(p)D=diag(p) and Πzz′=π(z,z′)\Pi_{zz'}=\pi(z,z')Πzz′​=π(z,z′). Its eigenvalues are μ0≥μ1≥⋯\mu_0\ge\mu_1\ge\cdotsμ0​≥μ1​≥⋯ with multiplicity. The top space is the span of the eigenvectors of KπK_\piKπ​ with eigenvalue at least μk\mu_kμk​. ∥⋅∥2\|\cdot\|_2∥⋅∥2​ and ∥⋅∥F\|\cdot\|_F∥⋅∥F​ are the spectral and Frobenius norms.
  6. Nuisance (Section 2.3). An observation of state zzz carries a nuisance ν∼q\nu\sim qν∼q, drawn independently of zzz. An encoder is written e(z,ν)e(z,\nu)e(z,ν) and is centred and whitened under p(z)q(ν)p(z)q(\nu)p(z)q(ν). CfC_fCf​ is the covariance of E[e∣z]=∑νq(ν)e(z,ν)E[e\mid z]=\sum_\nu q(\nu)e(z,\nu)E[e∣z]=∑ν​q(ν)e(z,ν), and the scene-explained fraction is ρ(f)=tr⁡Cf1/2/k\rho(f)=\operatorname{tr}C_f^{1/2}/kρ(f)=trCf1/2​/k. A good-view JEPA's positive-pair law on observations is π(z,z′)q(ν)q(ν′)\pi(z,z')q(\nu)q(\nu')π(z,z′)q(ν)q(ν′).
  7. Next-token prediction (eq. 6). For a context embedding h∈Rkh\in\mathbb{R}^kh∈Rk and token vectors wvw_vwv​, A(h)=log⁡∑ve⟨h,wv⟩A(h)=\log\sum_v e^{\langle h,w_v\rangle}A(h)=log∑v​e⟨h,wv​⟩ and the loss is −⟨h,wy⟩+A(h)-\langle h,w_y\rangle+A(h)−⟨h,wy​⟩+A(h).

Formalization Note The eigenvalues μi\mu_iμi​ are the roots of the characteristic polynomial of KπK_\piKπ​, sorted in decreasing order. The paper's convention μ∣Z∣=−∞\mu_{|Z|}=-\inftyμ∣Z∣​=−∞ is written in each statement as a hypothesis that applies only when k+1<∣Z∣k+1<|Z|k+1<∣Z∣. tr⁡Cf1/2\operatorname{tr}C_f^{1/2}trCf1/2​ is the sum of the square roots of the eigenvalues of CfC_fCf​.

Definition code
import Mathlib

/-!
Balestriero and LeCun, *Proving and Improving the Platonic Representation Hypothesis with JEPAs*,
arXiv:2610.39302v1 (2026): the finite world, positive-pair laws, JEPA objectives, spectral
quantities and alignment quantities of Section 2 and Appendix A.1.
-/

open MeasureTheory

noncomputable section

namespace PlatonicJEPA

variable {Z : Type*} [Fintype Z] [DecidableEq Z] {k : ℕ}

/-- Squared Euclidean norm of an embedding `v ∈ ℝ^k`. -/
def sqNorm (v : Fin k → ℝ) : ℝ := ∑ i, v i ^ 2

/-- Section 2.1: `p` is a probability on the finite world with `p(z) > 0`, and `π` is a symmetric
law on pairs of world states, both of whose marginals equal `p`. -/
def IsPairLaw (p : Z → ℝ) (π : Z → Z → ℝ) : Prop :=
  (∀ z, 0 < p z) ∧ (∑ z, p z = 1) ∧ (∀ z z', 0 ≤ π z z') ∧ (∀ z z', π z z' = π z' z) ∧
    (∀ z, ∑ z', π z z' = p z)

/-- The law of the embeddings `h(z)`, `z ∼ p`. -/
def embLaw (p : Z → ℝ) (h : Z → Fin k → ℝ) : Measure (Fin k → ℝ) :=
  ∑ z, ENNReal.ofReal (p z) • Measure.dirac (h z)

/-- Eq. (1) written on world states: `L_π(h) = E_{(z,z')∼π} ℓ(h z, h z') + Ω(h)`, where the
anti-collapse term `Ω` depends on `h` only through the law of its embeddings and may be `+∞`. -/
def worldLoss (p : Z → ℝ) (π : Z → Z → ℝ) (ℓ : (Fin k → ℝ) → (Fin k → ℝ) → ℝ)
    (Ω : Measure (Fin k → ℝ) → EReal) (h : Z → Fin k → ℝ) : EReal :=
  ((∑ z, ∑ z', π z z' * ℓ (h z) (h z') : ℝ) : EReal) + Ω (embLaw p h)

/-- Eq. (1): the objective of a JEPA of a modality that renders state `z` as `g z`, for an
encoder `f` on that modality's observations. -/
def modalityLoss {X : Type*} (p : Z → ℝ) (π : Z → Z → ℝ) (ℓ : (Fin k → ℝ) → (Fin k → ℝ) → ℝ)
    (Ω : Measure (Fin k → ℝ) → EReal) (g : Z → X) (f : X → Fin k → ℝ) : EReal :=
  ((∑ z, ∑ z', π z z' * ℓ (f (g z)) (f (g z')) : ℝ) : EReal) + Ω (embLaw p (f ∘ g))

/-- Rotation of an embedding by an orthogonal matrix. -/
def rot (Q : Matrix.orthogonalGroup (Fin k) ℝ) (v : Fin k → ℝ) : Fin k → ℝ :=
  (Q : Matrix (Fin k) (Fin k) ℝ).mulVec v

/-- `h` is centred and whitened under `p`: `E_p h = 0`, `E_p h hᵀ = I_k`. -/
def IsWhitened (p : Z → ℝ) (h : Z → Fin k → ℝ) : Prop :=
  (∀ i, ∑ z, p z * h z i = 0) ∧ (∀ i j, ∑ z, p z * h z i * h z j = if i = j then 1 else 0)

/-- The prediction term with `ℓ(a,b) = ‖a - b‖²`: `E_{(z,z')∼π} ‖h z - h z'‖²`. -/
def predLoss (π : Z → Z → ℝ) (h : Z → Fin k → ℝ) : ℝ :=
  ∑ z, ∑ z', π z z' * sqNorm (h z - h z')

/-- Proposition 1: `h` minimises `L_π` for `ℓ(a,b) = ‖a-b‖²` and `Ω` the whitening constraint. -/
def IsSpectralMin (p : Z → ℝ) (π : Z → Z → ℝ) (h : Z → Fin k → ℝ) : Prop :=
  IsWhitened p h ∧ ∀ h' : Z → Fin k → ℝ, IsWhitened p h' → predLoss π h ≤ predLoss π h'

/-- The normalised adjacency `K_π = D^{-1/2} Π D^{-1/2}`. -/
def kerMat (p : Z → ℝ) (π : Z → Z → ℝ) : Matrix Z Z ℝ :=
  fun z z' => π z z' / Real.sqrt (p z * p z')

/-- The eigenvalues `μ₀ ≥ μ₁ ≥ …` of `K_π`, with multiplicity, as the roots of its characteristic
polynomial sorted in decreasing order (`μ_i := 0` for `i ≥ |Z|`; statements never use those). -/
def eigs (p : Z → ℝ) (π : Z → Z → ℝ) (i : ℕ) : ℝ :=
  ((kerMat p π).charpoly.roots.sort (· ≥ ·)).getD i 0

/-- The span of the eigenvectors of `K_π` whose eigenvalue is at least `μ_k`. -/
def topSpace (p : Z → ℝ) (π : Z → Z → ℝ) (k : ℕ) : Submodule ℝ (Z → ℝ) :=
  ⨆ (μ : ℝ) (_ : eigs p π k ≤ μ), Module.End.eigenspace (Matrix.toLin' (kerMat p π)) μ

/-- Spectral (operator) norm of a real matrix. -/
def specNorm (A : Matrix Z Z ℝ) : ℝ :=
  sSup ((fun v : Z → ℝ => Real.sqrt (∑ z, (A.mulVec v z) ^ 2)) '' {v | ∑ z, v z ^ 2 ≤ 1})

/-- Frobenius norm of a real matrix. -/
def frobNorm (A : Matrix Z Z ℝ) : ℝ := Real.sqrt (∑ z, ∑ z', A z z' ^ 2)

section Nuisance

variable {N : Type*} [Fintype N]

/-- Section 2.3: an encoder of observations `g(z, ν)`, written as `e z ν = f(g(z, ν))`, is centred and
whitened on its observations, whose law is `p(z) q(ν)`. -/
def IsWhitenedObs (p : Z → ℝ) (q : N → ℝ) (e : Z → N → Fin k → ℝ) : Prop :=
  IsWhitened (fun x : Z × N => p x.1 * q x.2) (fun x => e x.1 x.2)

/-- `E[f(x) | z]` for an observation `x = g(z, ν)`, `ν ∼ q`. -/
def condMean (q : N → ℝ) (e : Z → N → Fin k → ℝ) (z : Z) : Fin k → ℝ :=
  fun i => ∑ ν, q ν * e z ν i

/-- `C_f = Cov E[f(x) | z]` (the encoder is centred, so this is the second-moment matrix). -/
def stateCov (p : Z → ℝ) (q : N → ℝ) (e : Z → N → Fin k → ℝ) : Matrix (Fin k) (Fin k) ℝ :=
  fun i j => ∑ z, p z * condMean q e z i * condMean q e z j

/-- The scene-explained fraction `ρ(f) = tr C_f^{1/2} / k`, computed from the eigenvalues of
`C_f` (the roots of its characteristic polynomial, with multiplicity). -/
def rho (p : Z → ℝ) (q : N → ℝ) (e : Z → N → Fin k → ℝ) : ℝ :=
  (((stateCov p q e).charpoly.roots.map Real.sqrt).sum) / k

end Nuisance

/-- Proposition 3 (i): the positive-pair law of a good-view JEPA on observations `(z, ν)`:
`π(z, z') q(ν) q(ν')`. -/
def goodViewLaw {N : Type*} (π : Z → Z → ℝ) (q : N → ℝ) (x y : Z × N) : ℝ :=
  π x.1 y.1 * q x.2 * q y.2

/-- Eq. (6): the anti-collapse term of next-token prediction, `A(h) = log ∑_v exp ⟨h, w_v⟩`. -/
def ntpAntiCollapse {V : Type*} [Fintype V] (w : V → Fin k → ℝ) (h : Fin k → ℝ) : ℝ :=
  Real.log (∑ v, Real.exp (∑ i, h i * w v i))

/-- Eq. (6): the next-token loss `-⟨h, w_y⟩ + A(h)`. -/
def ntpLoss {V : Type*} [Fintype V] (w : V → Fin k → ℝ) (h : Fin k → ℝ) (y : V) : ℝ :=
  -(∑ i, h i * w y i) + ntpAntiCollapse w h

end PlatonicJEPA
Source
Balestriero and LeCun, Proving and Improving the Platonic Representation Hypothesis with JEPAs, arXiv:2610.39302v1 (2026), Section 2 (eq. 1, eq. 6) and Appendix A.1
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Throughout, ZZZ is an arbitrary finite type, possibly empty, with decidable equality. k∈Nk \in \mathbb{N}k∈N is a natural number, possibly 000. Rk\mathbb{R}^kRk means real vectors indexed by {0,…,k−1}\{0,\dots,k-1\}{0,…,k−1}. Functions p:Z→Rp : Z \to \mathbb{R}p:Z→R and π:Z×Z→R\pi : Z \times Z \to \mathbb{R}π:Z×Z→R are arbitrary real-valued functions unless a declaration states otherwise. No positivity or normalisation is assumed implicitly.

sqNorm. For a vector v∈Rkv \in \mathbb{R}^kv∈Rk,

∥v∥2:=∑i=0k−1vi2.\|v\|^2 := \sum_{i=0}^{k-1} v_i^2 .∥v∥2:=i=0∑k−1​vi2​.

When k=0k = 0k=0 the sum is empty and the value is 000.

IsPairLaw. For p:Z→Rp : Z \to \mathbb{R}p:Z→R and π:Z×Z→R\pi : Z \times Z \to \mathbb{R}π:Z×Z→R, the predicate IsPairLaw(p,π)\mathrm{IsPairLaw}(p,\pi)IsPairLaw(p,π) holds exactly when all five of the following hold:

  1. p(z)>0p(z) > 0p(z)>0 for every z∈Zz \in Zz∈Z;
  2. ∑z∈Zp(z)=1\sum_{z \in Z} p(z) = 1∑z∈Z​p(z)=1;
  3. π(z,z′)≥0\pi(z,z') \ge 0π(z,z′)≥0 for all z,z′z, z'z,z′;
  4. π(z,z′)=π(z′,z)\pi(z,z') = \pi(z',z)π(z,z′)=π(z′,z) for all z,z′z, z'z,z′;
  5. ∑z′∈Zπ(z,z′)=p(z)\sum_{z' \in Z} \pi(z,z') = p(z)∑z′∈Z​π(z,z′)=p(z) for every zzz. This is the row-marginal condition; the column marginal then follows from symmetry.

Total mass ∑z,z′π(z,z′)=1\sum_{z,z'} \pi(z,z') = 1∑z,z′​π(z,z′)=1 is not stated separately but follows from conditions 2 and 5. If ZZZ is empty, condition 2 fails, so the predicate can only hold when ZZZ is nonempty.

embLaw. For p:Z→Rp : Z \to \mathbb{R}p:Z→R and h:Z→Rkh : Z \to \mathbb{R}^kh:Z→Rk, embLaw(p,h)\mathrm{embLaw}(p,h)embLaw(p,h) is the measure on Rk\mathbb{R}^kRk

∑z∈Zmax⁡(p(z),0) δh(z),\sum_{z \in Z} \max\bigl(p(z),0\bigr)\, \delta_{h(z)} ,z∈Z∑​max(p(z),0)δh(z)​,

where δx\delta_xδx​ is the Dirac mass at xxx.

  • Negative values of ppp are silently replaced by 000.
  • Nothing requires ppp to sum to 111, so this is a finite measure of total mass ∑zmax⁡(p(z),0)\sum_z \max(p(z),0)∑z​max(p(z),0). It is a probability measure only when ppp is a probability vector.
  • If ZZZ is empty it is the zero measure.

worldLoss. The inputs are:

  • p:Z→Rp : Z \to \mathbb{R}p:Z→R and π:Z×Z→R\pi : Z \times Z \to \mathbb{R}π:Z×Z→R, both arbitrary;
  • an arbitrary real-valued function ℓ:Rk×Rk→R\ell : \mathbb{R}^k \times \mathbb{R}^k \to \mathbb{R}ℓ:Rk×Rk→R;
  • an arbitrary function Ω\OmegaΩ from measures on Rk\mathbb{R}^kRk to the extended reals [−∞,+∞][-\infty,+\infty][−∞,+∞];
  • h:Z→Rkh : Z \to \mathbb{R}^kh:Z→Rk.

The value is the extended real

Lπ(h):=(∑z∈Z∑z′∈Zπ(z,z′) ℓ(h(z),h(z′)))+Ω(embLaw(p,h)).L_\pi(h) := \Bigl(\sum_{z \in Z}\sum_{z' \in Z} \pi(z,z')\,\ell\bigl(h(z),h(z')\bigr)\Bigr) + \Omega\bigl(\mathrm{embLaw}(p,h)\bigr).Lπ​(h):=(z∈Z∑​z′∈Z∑​π(z,z′)ℓ(h(z),h(z′)))+Ω(embLaw(p,h)).

The double sum is a finite real number. Adding it to Ω(… )\Omega(\dots)Ω(…) gives +∞+\infty+∞ when Ω(… )=+∞\Omega(\dots) = +\inftyΩ(…)=+∞ and −∞-\infty−∞ when Ω(… )=−∞\Omega(\dots) = -\inftyΩ(…)=−∞. No hypothesis is placed on ppp, π\piπ, ℓ\ellℓ or Ω\OmegaΩ. In particular, Ω\OmegaΩ may depend on the measure in any way, and π\piπ need not be a pair law. Ω\OmegaΩ sees hhh only through the measure ∑zmax⁡(p(z),0) δh(z)\sum_z \max(p(z),0)\,\delta_{h(z)}∑z​max(p(z),0)δh(z)​.

modalityLoss. The inputs are an arbitrary type XXX, a map g:Z→Xg : Z \to Xg:Z→X and a map f:X→Rkf : X \to \mathbb{R}^kf:X→Rk, together with p,π,ℓ,Ωp, \pi, \ell, \Omegap,π,ℓ,Ω as in worldLoss. The value is

(∑z∑z′π(z,z′) ℓ(f(g(z)),f(g(z′))))+Ω(embLaw(p,f∘g))∈[−∞,+∞].\Bigl(\sum_{z}\sum_{z'} \pi(z,z')\,\ell\bigl(f(g(z)),f(g(z'))\bigr)\Bigr) + \Omega\bigl(\mathrm{embLaw}(p, f\circ g)\bigr) \in [-\infty,+\infty].(z∑​z′∑​π(z,z′)ℓ(f(g(z)),f(g(z′))))+Ω(embLaw(p,f∘g))∈[−∞,+∞].

This is literally the same expression as worldLoss evaluated at h=f∘gh = f \circ gh=f∘g. Again, no hypotheses are placed on any of the inputs.

rot. For a real orthogonal k×kk \times kk×k matrix QQQ (one with Q⊤Q=QQ⊤=IkQ^\top Q = Q Q^\top = I_kQ⊤Q=QQ⊤=Ik​) and v∈Rkv \in \mathbb{R}^kv∈Rk, the value is the matrix–vector product rot(Q,v):=Qv\mathrm{rot}(Q,v) := Qvrot(Q,v):=Qv.

IsWhitened. For p:Z→Rp : Z \to \mathbb{R}p:Z→R and h:Z→Rkh : Z \to \mathbb{R}^kh:Z→Rk with coordinates hi(z)h_i(z)hi​(z), IsWhitened(p,h)\mathrm{IsWhitened}(p,h)IsWhitened(p,h) holds exactly when both of the following hold:

∑z∈Zp(z) hi(z)=0for every i<k,\sum_{z \in Z} p(z)\,h_i(z) = 0 \quad\text{for every } i < k,z∈Z∑​p(z)hi​(z)=0for every i<k, ∑z∈Zp(z) hi(z) hj(z)=δijfor all i,j<k.\sum_{z \in Z} p(z)\,h_i(z)\,h_j(z) = \delta_{ij} \quad\text{for all } i,j < k .z∈Z∑​p(z)hi​(z)hj​(z)=δij​for all i,j<k.

Points to note:

  • ppp is not required to be positive or to sum to 111; the sums are taken with whatever weights ppp provides.
  • When k=0k = 0k=0 both conditions are vacuous, so every hhh is whitened.
  • When p>0p > 0p>0 everywhere, the conditions say that h0,…,hk−1h_0,\dots,h_{k-1}h0​,…,hk−1​ are orthonormal in the ppp-weighted inner product and orthogonal to the constant function 111. This can only happen if k≤∣Z∣−1k \le |Z| - 1k≤∣Z∣−1; for larger kkk the predicate is unsatisfiable.

predLoss. For π:Z×Z→R\pi : Z \times Z \to \mathbb{R}π:Z×Z→R and h:Z→Rkh : Z \to \mathbb{R}^kh:Z→Rk,

predLoss(π,h):=∑z∈Z∑z′∈Zπ(z,z′) ∥h(z)−h(z′)∥2,\mathrm{predLoss}(\pi,h) := \sum_{z \in Z}\sum_{z' \in Z} \pi(z,z')\,\bigl\|h(z)-h(z')\bigr\|^2 ,predLoss(π,h):=z∈Z∑​z′∈Z∑​π(z,z′)​h(z)−h(z′)​2,

where ∥⋅∥2\|\cdot\|^2∥⋅∥2 is the sum of squared coordinates. It does not involve ppp. Nothing is assumed about π\piπ, so negative weights are allowed.

IsSpectralMin. For ppp, π\piπ and h:Z→Rkh : Z \to \mathbb{R}^kh:Z→Rk, IsSpectralMin(p,π,h)\mathrm{IsSpectralMin}(p,\pi,h)IsSpectralMin(p,π,h) holds exactly when both of the following hold:

  1. hhh is whitened under ppp in the sense of IsWhitened above;
  2. for every h′:Z→Rkh' : Z \to \mathbb{R}^kh′:Z→Rk that is also whitened under ppp,
predLoss(π,h)≤predLoss(π,h′).\mathrm{predLoss}(\pi,h) \le \mathrm{predLoss}(\pi,h').predLoss(π,h)≤predLoss(π,h′).

That is, hhh attains the minimum of predLoss(π,⋅)\mathrm{predLoss}(\pi,\cdot)predLoss(π,⋅) over the whitened maps. Points to note:

  • No assumption is made that (p,π)(p,\pi)(p,π) is a pair law.
  • If no whitened map exists (for example p>0p>0p>0 and k≥∣Z∣k \ge |Z|k≥∣Z∣), the predicate is false for every hhh.
  • If k=0k = 0k=0, every hhh satisfies it.

kerMat. For ppp and π\piπ, this is the Z×ZZ \times ZZ×Z real matrix KKK with entries

Kzz′:=π(z,z′)p(z) p(z′).K_{z z'} := \frac{\pi(z,z')}{\sqrt{p(z)\,p(z')}} .Kzz′​:=p(z)p(z′)​π(z,z′)​.

The conventions used are:

  • the square root of a negative number is taken to be 000;
  • division by 000 yields 000.

Consequently Kzz′=0K_{zz'} = 0Kzz′​=0 whenever p(z) p(z′)≤0p(z)\,p(z') \le 0p(z)p(z′)≤0. When p>0p > 0p>0 this is D−1/2 Π D−1/2D^{-1/2}\,\Pi\,D^{-1/2}D−1/2ΠD−1/2, with D=diag(p)D = \mathrm{diag}(p)D=diag(p) and Π=(π(z,z′))\Pi = (\pi(z,z'))Π=(π(z,z′)).

eigs. For ppp, π\piπ and an index i∈Ni \in \mathbb{N}i∈N (starting at 000), μi:=eigs(p,π,i)\mu_i := \mathrm{eigs}(p,\pi,i)μi​:=eigs(p,π,i) is defined as follows:

  1. Take the characteristic polynomial of K=kerMat(p,π)K = \mathrm{kerMat}(p,\pi)K=kerMat(p,π) as a real polynomial.
  2. List its real roots with multiplicity.
  3. Sort them in non-increasing order.
  4. Return the iii-th entry, counting from 000. If iii is at least the length of this list, return 000.

Consequences of this definition:

  • Only real roots are listed. If KKK is not symmetric (for example if π\piπ is not symmetric) and has non-real eigenvalues, those are omitted. The list is then shorter than ∣Z∣|Z|∣Z∣, and μi=0\mu_i = 0μi​=0 from that shorter length onward.
  • When KKK is symmetric, the list has exactly ∣Z∣|Z|∣Z∣ entries: μ0≥μ1≥⋯≥μ∣Z∣−1\mu_0 \ge \mu_1 \ge \dots \ge \mu_{|Z|-1}μ0​≥μ1​≥⋯≥μ∣Z∣−1​.
  • The default value 000 for out-of-range indices is indistinguishable from a genuine eigenvalue 000.

topSpace. For ppp, π\piπ and a natural number kkk (this explicit argument is independent of the ambient kkk), topSpace(p,π,k)\mathrm{topSpace}(p,\pi,k)topSpace(p,π,k) is the subspace of RZ\mathbb{R}^ZRZ obtained as follows:

  1. Let K=kerMat(p,π)K = \mathrm{kerMat}(p,\pi)K=kerMat(p,π), acting on RZ\mathbb{R}^ZRZ by matrix multiplication.
  2. For each real μ\muμ, let ker⁡(K−μI)\ker(K - \mu I)ker(K−μI) be the corresponding eigenspace, which is {0}\{0\}{0} when μ\muμ is not an eigenvalue.
  3. Take the linear span of the union of these eigenspaces over all real μ\muμ with μ≥μk\mu \ge \mu_kμ≥μk​, where μk=eigs(p,π,k)\mu_k = \mathrm{eigs}(p,\pi,k)μk​=eigs(p,π,k).

Points to note:

  • With 0-based indexing, this is the span of eigenvectors for every real eigenvalue ≥μk\ge \mu_k≥μk​. That includes μ0,…,μk\mu_0,\dots,\mu_kμ0​,…,μk​ (i.e. k+1k+1k+1 listed values) and every further eigenvalue tied with μk\mu_kμk​.
  • If kkk is at least the length of the list of real eigenvalues, then μk=0\mu_k = 0μk​=0. The space is then the span of all eigenvectors with nonnegative eigenvalue.

specNorm. For a real Z×ZZ \times ZZ×Z matrix AAA,

specNorm(A):=sup⁡{∑z(Av)z2  :  v∈RZ, ∑zvz2≤1},\mathrm{specNorm}(A) := \sup\Bigl\{ \sqrt{\textstyle\sum_{z}(Av)_z^2} \;:\; v \in \mathbb{R}^Z,\ \textstyle\sum_z v_z^2 \le 1 \Bigr\},specNorm(A):=sup{∑z​(Av)z2​​:v∈RZ, ∑z​vz2​≤1},

i.e. the operator norm of AAA with respect to the Euclidean norm. The set is nonempty (it contains the value at v=0v=0v=0) and bounded, so this is an actual finite supremum. When ZZZ is empty the value is 000.

frobNorm. For a real Z×ZZ \times ZZ×Z matrix AAA,

frobNorm(A):=∑z∑z′Azz′2.\mathrm{frobNorm}(A) := \sqrt{\textstyle\sum_{z}\sum_{z'} A_{zz'}^2}.frobNorm(A):=∑z​∑z′​Azz′2​​.

In the next five declarations, NNN is an arbitrary finite type (a "nuisance" index set, possibly empty), q:N→Rq : N \to \mathbb{R}q:N→R is arbitrary, and e:Z×N→Rke : Z \times N \to \mathbb{R}^ke:Z×N→Rk has coordinates ei(z,ν)e_i(z,\nu)ei​(z,ν).

IsWhitenedObs. IsWhitenedObs(p,q,e)\mathrm{IsWhitenedObs}(p,q,e)IsWhitenedObs(p,q,e) is IsWhitened applied on the product set Z×NZ \times NZ×N, with weight (z,ν)↦p(z) q(ν)(z,\nu) \mapsto p(z)\,q(\nu)(z,ν)↦p(z)q(ν) and map (z,ν)↦e(z,ν)(z,\nu) \mapsto e(z,\nu)(z,ν)↦e(z,ν). Explicitly, it holds exactly when both of the following hold:

∑z∈Z∑ν∈Np(z) q(ν) ei(z,ν)=0(i<k),\sum_{z \in Z}\sum_{\nu \in N} p(z)\,q(\nu)\,e_i(z,\nu) = 0 \quad (i<k),z∈Z∑​ν∈N∑​p(z)q(ν)ei​(z,ν)=0(i<k), ∑z,νp(z) q(ν) ei(z,ν) ej(z,ν)=δij(i,j<k).\sum_{z,\nu} p(z)\,q(\nu)\,e_i(z,\nu)\,e_j(z,\nu) = \delta_{ij} \quad (i,j<k).z,ν∑​p(z)q(ν)ei​(z,ν)ej​(z,ν)=δij​(i,j<k).

Neither ppp nor qqq is required to be positive or normalised. When k=0k = 0k=0 the predicate holds trivially.

condMean. For qqq, eee and z∈Zz \in Zz∈Z, this is the vector m(z)∈Rkm(z) \in \mathbb{R}^km(z)∈Rk with coordinates

mi(z):=∑ν∈Nq(ν) ei(z,ν).m_i(z) := \sum_{\nu \in N} q(\nu)\,e_i(z,\nu).mi​(z):=ν∈N∑​q(ν)ei​(z,ν).

There is no division by ∑νq(ν)\sum_\nu q(\nu)∑ν​q(ν). It is a conditional mean only when qqq is a probability vector.

stateCov. For ppp, qqq and eee, this is the k×kk \times kk×k real matrix CCC with entries

Cij:=∑z∈Zp(z) mi(z) mj(z),C_{ij} := \sum_{z \in Z} p(z)\, m_i(z)\, m_j(z),Cij​:=z∈Z∑​p(z)mi​(z)mj​(z),

where mmm is the condMean above. No mean is subtracted, so CCC is the ppp-weighted second-moment matrix of z↦m(z)z \mapsto m(z)z↦m(z). CCC is symmetric by construction, and it is positive semidefinite when p≥0p \ge 0p≥0.

rho. For ppp, qqq and eee,

ρ:=1k∑λλ,\rho := \frac{1}{k}\sum_{\lambda} \sqrt{\lambda},ρ:=k1​λ∑​λ​,

where the sum runs over the real roots λ\lambdaλ of the characteristic polynomial of C=stateCov(p,q,e)C = \mathrm{stateCov}(p,q,e)C=stateCov(p,q,e), counted with multiplicity. The conventions used are:

  • λ:=0\sqrt{\lambda} := 0λ​:=0 for λ<0\lambda < 0λ<0;
  • division by k=0k = 0k=0 gives 000, so ρ=0\rho = 0ρ=0 when k=0k = 0k=0.

Since CCC is symmetric, it has kkk real eigenvalues. When p≥0p \ge 0p≥0 they are all nonnegative, and ρ=tr⁡(C1/2)/k\rho = \operatorname{tr}(C^{1/2})/kρ=tr(C1/2)/k.

goodViewLaw. For an arbitrary type NNN (not required to be finite here), π:Z×Z→R\pi : Z\times Z \to \mathbb{R}π:Z×Z→R, q:N→Rq : N \to \mathbb{R}q:N→R, and pairs x=(z,ν)x = (z,\nu)x=(z,ν), y=(z′,ν′)y = (z',\nu')y=(z′,ν′) in Z×NZ \times NZ×N, the value is

goodViewLaw(π,q)((z,ν),(z′,ν′)):=π(z,z′) q(ν) q(ν′).\mathrm{goodViewLaw}(\pi,q)\bigl((z,\nu),(z',\nu')\bigr) := \pi(z,z')\,q(\nu)\,q(\nu').goodViewLaw(π,q)((z,ν),(z′,ν′)):=π(z,z′)q(ν)q(ν′).

No properties of π\piπ or qqq are assumed.

ntpAntiCollapse. The inputs are an arbitrary finite type VVV (possibly empty), vectors wv∈Rkw_v \in \mathbb{R}^kwv​∈Rk for v∈Vv \in Vv∈V, and h∈Rkh \in \mathbb{R}^kh∈Rk. The value is

A(h):=log⁡∑v∈Vexp⁡(⟨h,wv⟩),⟨h,wv⟩=∑i<khi (wv)i.A(h) := \log \sum_{v \in V} \exp\bigl(\langle h, w_v\rangle\bigr), \qquad \langle h, w_v\rangle = \sum_{i<k} h_i\,(w_v)_i .A(h):=logv∈V∑​exp(⟨h,wv​⟩),⟨h,wv​⟩=i<k∑​hi​(wv​)i​.

If VVV is empty, the sum is 000 and the value is log⁡0\log 0log0, which is taken to be 000. Otherwise the sum is positive and this is the ordinary logarithm.

ntpLoss. For VVV, www and hhh as in ntpAntiCollapse, and a token y∈Vy \in Vy∈V,

ntpLoss(w,h,y):=−⟨h,wy⟩+A(h)=−⟨h,wy⟩+log⁡∑v∈Vexp⁡(⟨h,wv⟩).\mathrm{ntpLoss}(w,h,y) := -\langle h, w_y\rangle + A(h) = -\langle h, w_y\rangle + \log\sum_{v\in V}\exp\bigl(\langle h,w_v\rangle\bigr).ntpLoss(w,h,y):=−⟨h,wy​⟩+A(h)=−⟨h,wy​⟩+logv∈V∑​exp(⟨h,wv​⟩).

The existence of yyy forces VVV to be nonempty, so the logarithm here is the ordinary one.

Human review
  • Endorsed by Shuze Chen · Nov 23, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 23, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me