Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Platonic Representation Theorem for JEPAs: world, positive pairs, spectral objective, nuisance, views and next-token loss

Definition
Arxiv2610_39302_Basic

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

davis-kahanorthogonal-procrustesrepresentation-learningself-supervised-learningspectral-embedding

Objects of Section 2 and Appendix A of Balestriero and LeCun (2026), and of the subsample interval of Appendix C.

  1. World and positive pairs (Section 2.1). A world is a finite set ZZZ of states with probabilities p(z)>0p(z)>0p(z)>0, ∑zp(z)=1\sum_zp(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 two marginals equal ppp. The same notion is used for a law WWW on pairs of observations with marginal ω\omegaω.
  2. Embeddings and rotations. An embedding is h:Z→Rkh:Z\to\mathbb{R}^kh:Z→Rk, with ∥a∥2=∑iai2\|a\|^2=\sum_ia_i^2∥a∥2=∑i​ai2​; an orthogonal matrix 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_zp(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 is a function of the law of the embeddings, 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), and a modality with rendering g:Z→Xg:Z\to Xg:Z→X and encoder f:X→Rkf:X\to\mathbb{R}^kf:X→Rk has 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). The standing assumptions are that ℓ(Qa,Qb)=ℓ(a,b)\ell(Qa,Qb)=\ell(a,b)ℓ(Qa,Qb)=ℓ(a,b), that rotating every embedding leaves Ω\OmegaΩ unchanged, and that Ω\OmegaΩ takes values in R∪{+∞}\mathbb{R}\cup\{+\infty\}R∪{+∞}. The minimisers of an objective are unique up to rotation if any two of them satisfy h′=Qhh'=Qhh′=Qh for some Q∈O(k)Q\in O(k)Q∈O(k).
  4. Spectral objective (Proposition 1). ℓ(a,b)=∥a−b∥2\ell(a,b)=\|a-b\|^2ℓ(a,b)=∥a−b∥2, and Ω\OmegaΩ is 000 if the law of the embeddings has mean 000 and second moment IkI_kIk​, and +∞+\infty+∞ otherwise. An embedding fff on a finite set with law ω\omegaω is centred and whitened if ∑xω(x)f(x)=0\sum_x\omega(x)f(x)=0∑x​ω(x)f(x)=0 and ∑xω(x)f(x)f(x)⊤=Ik\sum_x\omega(x)f(x)f(x)^\top=I_k∑x​ω(x)f(x)f(x)⊤=Ik​.
  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), Πzz′=π(z,z′)\Pi_{zz'}=\pi(z,z')Πzz′​=π(z,z′); its eigenvalues with multiplicity are 1=μ0≥μ1≥⋯1=\mu_0\ge\mu_1\ge\cdots1=μ0​≥μ1​≥⋯, with μi:=−∞\mu_i:=-\inftyμi​:=−∞ for i≥∣Z∣i\ge|Z|i≥∣Z∣. The Markov operator is Tπ=D−1ΠT_\pi=D^{-1}\PiTπ​=D−1Π. A spectral embedding is Φ(z)=(v1(z),…,vk(z))/p(z)\Phi(z)=(v_1(z),\dots,v_k(z))/\sqrt{p(z)}Φ(z)=(v1​(z),…,vk​(z))/p(z)​ for orthonormal eigenvectors v1,…,vkv_1,\dots,v_kv1​,…,vk​ of KπK_\piKπ​, orthogonal to D1/21D^{1/2}\mathbf 1D1/21, with eigenvalues μ1,…,μk\mu_1,\dots,\mu_kμ1​,…,μk​. ∥⋅∥2\|\cdot\|_2∥⋅∥2​ and ∥⋅∥F\|\cdot\|_F∥⋅∥F​ are the spectral and Frobenius norms, ∥f−g∥L2(ω)=(∑xω(x)∥f(x)−g(x)∥2)1/2\|f-g\|_{L^2(\omega)}=(\sum_x\omega(x)\|f(x)-g(x)\|^2)^{1/2}∥f−g∥L2(ω)​=(∑x​ω(x)∥f(x)−g(x)∥2)1/2, and the right side of eq. (3) is 22μk−μk+1min⁡(k∥Kπ1−Kπ2∥2,∥Kπ1−Kπ2∥F)\frac{2\sqrt2}{\mu_k-\mu_{k+1}}\min(\sqrt k\|K_{\pi_1}-K_{\pi_2}\|_2,\|K_{\pi_1}-K_{\pi_2}\|_F)μk​−μk+1​22​​min(k​∥Kπ1​​−Kπ2​​∥2​,∥Kπ1​​−Kπ2​​∥F​), read as 000 when k+1=∣Z∣k+1=|Z|k+1=∣Z∣.
  6. Observations and nuisance (Section 2.3). An observation xxx of a finite set XXX with law ω\omegaω is of the state s(x)s(x)s(x); its state marginal is ∑s(x)=zω(x)\sum_{s(x)=z}\omega(x)∑s(x)=z​ω(x). E[f∣z]E[f\mid z]E[f∣z] is the conditional mean, Cf=Cov(E[f(x)∣z])C_f=\mathrm{Cov}(E[f(x)\mid z])Cf​=Cov(E[f(x)∣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. With nuisance ν∼q\nu\sim qν∼q independent of zzz, the observations are pairs (z,ν)(z,\nu)(z,ν) with law p(z)q(ν)p(z)q(\nu)p(z)q(ν) and s(z,ν)=zs(z,\nu)=zs(z,ν)=z.
  7. Good and bad views (Proposition 3). A good-view JEPA has positive-pair law π(z,z′)q(ν)q(ν′)\pi(z,z')q(\nu)q(\nu')π(z,z′)q(ν)q(ν′). For row-stochastic AAA, BBB with stationary laws ppp, qqq, the bad-view law is the law of two corruptions x~,x~′∼Γ(⋅∣x)\tilde x,\tilde x'\sim\Gamma(\cdot\mid x)x~,x~′∼Γ(⋅∣x), drawn independently given one clean observation x∼p⊗qx\sim p\otimes qx∼p⊗q, with Γ=A⊗B\Gamma=A\otimes BΓ=A⊗B. The αi\alpha_iαi​ (resp. βj\beta_jβj​) are the eigenvalues of A∗AA^*AA∗A on L2(p)L^2(p)L2(p) (resp. B∗BB^*BB∗B on L2(q)L^2(q)L2(q)), i.e. those of the normalised kernel of A⊤DpAA^\top D_pAA⊤Dp​A. The ξ1≥ξ2≥⋯\xi_1\ge\xi_2\ge\cdotsξ1​≥ξ2​≥⋯ are the products αiβj\alpha_i\beta_jαi​βj​, (i,j)≠(0,0)(i,j)\ne(0,0)(i,j)=(0,0), with multiplicity, and rrr is the number of pairs (i,j)(i,j)(i,j) with j≥1j\ge1j≥1 and αiβj≥ξk\alpha_i\beta_j\ge\xi_kαi​βj​≥ξk​.
  8. Formal Theorem 4 (Appendix A.4). For a law WWW on pairs of observations: the induced world kernel πW(z,z′)=∑s(x)=z, s(x′)=z′W(x,x′)\pi_W(z,z')=\sum_{s(x)=z,\,s(x')=z'}W(x,x')πW​(z,z′)=∑s(x)=z,s(x′)=z′​W(x,x′); the conditional expectation PPP onto functions of the state in L2(ω)L^2(\omega)L2(ω); η=sup⁡{⟨h,TWh⟩ω:Ph=0, ∥h∥ω=1}\eta=\sup\{\langle h,T_Wh\rangle_\omega: Ph=0,\ \|h\|_\omega=1\}η=sup{⟨h,TW​h⟩ω​:Ph=0, ∥h∥ω​=1} (−∞-\infty−∞ if there is no such hhh); ε\varepsilonε and εHS\varepsilon^{\mathrm{HS}}εHS, the operator and Hilbert–Schmidt norms of (I−P)TWP(I-P)T_WP(I−P)TW​P on L2(ω)L^2(\omega)L2(ω); δ=μk−max⁡(μk+1,η)\delta=\mu_k-\max(\mu_{k+1},\eta)δ=μk​−max(μk+1​,η) for the eigenvalues μi\mu_iμi​ of πW\pi_WπW​; τ=22δmin⁡(k ε,2 εHS)\tau=\frac{2\sqrt2}{\delta}\min(\sqrt k\,\varepsilon,\sqrt2\,\varepsilon^{\mathrm{HS}})τ=δ22​​min(k​ε,2​εHS) (000 if δ=+∞\delta=+\inftyδ=+∞). A paired coupling is a law γ\gammaγ on X1×X2X_1\times X_2X1​×X2​ with marginals ω1,ω2\omega_1,\omega_2ω1​,ω2​ that only pairs observations of the same state. Merging observations by c:X→Yc:X\to Yc:X→Y sums ω\omegaω and WWW over the groups.
  9. Next-token prediction (eq. 6). A(h)=log⁡∑ve⟨h,wv⟩A(h)=\log\sum_ve^{\langle h,w_v\rangle}A(h)=log∑v​e⟨h,wv​⟩, the loss is −log⁡(e⟨h,wy⟩/∑ve⟨h,wv⟩)-\log\big(e^{\langle h,w_y\rangle}/\sum_ve^{\langle h,w_v\rangle}\big)−log(e⟨h,wy​⟩/∑v​e⟨h,wv​⟩), and the expected loss over finitely many contexts with weights P(c)P(c)P(c) and conditionals p(⋅∣c)p(\cdot\mid c)p(⋅∣c) is ∑cP(c)∑vp(v∣c) (loss)\sum_cP(c)\sum_vp(v\mid c)\,(\text{loss})∑c​P(c)∑v​p(v∣c)(loss).
  10. Subsample spread (Appendix C). For scores x1,…,xNx_1,\dots,x_Nx1​,…,xN​: xˉ\bar xxˉ, the subset mean xˉS\bar x_SxˉS​, s2=∑i(xi−xˉ)2/(N−1)s^2=\sum_i(x_i-\bar x)^2/(N-1)s2=∑i​(xi​−xˉ)2/(N−1), and the spread ((Nn)−1∑∣S∣=n(xˉS−xˉ)2)1/2\big(\binom Nn^{-1}\sum_{|S|=n}(\bar x_S-\bar x)^2\big)^{1/2}((nN​)−1∑∣S∣=n​(xˉS​−xˉ)2)1/2 over uniformly random nnn-subsets.

Formalization Note The eigenvalues μi\mu_iμi​ are the roots of the characteristic polynomial of KπK_\piKπ​ in decreasing order. The convention μ∣Z∣=−∞\mu_{|Z|}=-\inftyμ∣Z∣​=−∞ appears either as a hypothesis that applies only when k+1<∣Z∣k+1<|Z|k+1<∣Z∣ or through an extended-real eigenvalue equal to −∞-\infty−∞ beyond ∣Z∣|Z|∣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​. Operators on L2(ω)L^2(\omega)L2(ω) are written as matrices acting on functions X→RX\to\mathbb{R}X→R; their norms are taken in the L2(ω)L^2(\omega)L2(ω) metric.

Definition code
import Mathlib

/-!
Balestriero and LeCun, *Proving and Improving the Platonic Representation Hypothesis with JEPAs*,
arXiv:2610.39302v1 (2026). Objects of Section 2 (Sections 2.1-2.4) and Appendix A (A.1-A.5): the
finite world, positive-pair laws, the JEPA objective of eq. (1), the normalised adjacency and its
spectrum, spectral embeddings, observations with nuisance, good-view and bad-view positive laws,
the operators of the formal Theorem 4, and the next-token loss of eq. (6); and the subsample
spread of Appendix C ("Uncertainty on WIT").
-/

open MeasureTheory

noncomputable section

namespace Arxiv2610_39302

/-! ### Section 2.1: world, embeddings, JEPA objective -/

/-- Section 2.1: squared Euclidean norm `‖a‖² = ∑ᵢ aᵢ²` of an embedding `a ∈ ℝ^k`. -/
def sqNorm {k : ℕ} (a : Fin k → ℝ) : ℝ := ∑ i, a i ^ 2

/-- Proposition 1 (Section 2.1): the prediction term `ℓ(a, b) = ‖a - b‖²`. -/
def sqDist {k : ℕ} (a b : Fin k → ℝ) : ℝ := sqNorm (a - b)

/-- Section 2.1: the action `a ↦ Q a` of an orthogonal matrix `Q ∈ O(k)` on an embedding. -/
def rot {k : ℕ} (Q : Matrix.orthogonalGroup (Fin k) ℝ) (a : Fin k → ℝ) : Fin k → ℝ :=
  (Q : Matrix (Fin k) (Fin k) ℝ).mulVec a

/-- Section 2.1: `p` is a law on the finite set `Z` with `p(z) > 0`, and `π` is a symmetric law on
pairs whose two marginals equal `p` (a positive-pair distribution). Used verbatim for laws `W` on
pairs of observations with marginal `ω` (Appendix A.4, formal Theorem 4). -/
def IsPairLaw {Z : Type*} [Fintype Z] (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)

/-- Section 2.1: the distribution of the embeddings `h(z)`, `z ∼ p`, namely `∑_z p(z) δ_{h(z)}`. -/
def embLaw {Z : Type*} [Fintype Z] {k : ℕ} (p : Z → ℝ) (h : Z → Fin k → ℝ) :
    Measure (Fin k → ℝ) :=
  ∑ z, ENNReal.ofReal (p z) • Measure.dirac (h z)

/-- Section 2.1, standing assumptions on eq. (1): the prediction term is rotation invariant,
`ℓ(Qa, Qb) = ℓ(a, b)`; rotating every embedding leaves the anti-collapse term unchanged; and the
anti-collapse term takes values in `ℝ ∪ {+∞}` (a hard constraint is `Ω ∈ {0, ∞}`). The
anti-collapse term is a function of the law of the embeddings, as the paper requires. -/
def IsJEPAObjective {Z : Type*} [Fintype Z] {k : ℕ} (p : Z → ℝ)
    (ℓ : (Fin k → ℝ) → (Fin k → ℝ) → ℝ) (Om : Measure (Fin k → ℝ) → EReal) : Prop :=
  (∀ (Q : Matrix.orthogonalGroup (Fin k) ℝ) (a b : Fin k → ℝ), ℓ (rot Q a) (rot Q b) = ℓ a b) ∧
    (∀ (h : Z → Fin k → ℝ) (Q : Matrix.orthogonalGroup (Fin k) ℝ),
      Om (embLaw p (fun z => rot Q (h z))) = Om (embLaw p h)) ∧
    (∀ μ, Om μ ≠ ⊥)

/-- Section 2.1: the objective written on world states,
`L_π(h) = E_{(z,z')∼π} ℓ(h(z), h(z')) + Ω(h)`, for `h : Z → ℝ^k`. -/
def worldLoss {Z : Type*} [Fintype Z] {k : ℕ} (p : Z → ℝ) (π : Z → Z → ℝ)
    (ℓ : (Fin k → ℝ) → (Fin k → ℝ) → ℝ) (Om : Measure (Fin k → ℝ) → EReal)
    (h : Z → Fin k → ℝ) : EReal :=
  ((∑ z, ∑ z', π z z' * ℓ (h z) (h z') : ℝ) : EReal) + Om (embLaw p h)

/-- Eq. (1), Section 2.1: the objective `L_m(f) = E_{(z,z')∼π} ℓ(f(g(z)), f(g(z'))) + Ω(f)` of a
JEPA of a modality with rendering `g : Z → X` and encoder `f : X → ℝ^k`; `Ω` sees the law of the
embeddings `f(g(z))`, `z ∼ p`. -/
def modalityLoss {Z X : Type*} [Fintype Z] {k : ℕ} (p : Z → ℝ) (π : Z → Z → ℝ)
    (ℓ : (Fin k → ℝ) → (Fin k → ℝ) → ℝ) (Om : Measure (Fin k → ℝ) → EReal) (g : Z → X)
    (f : X → Fin k → ℝ) : EReal :=
  ((∑ z, ∑ z', π z z' * ℓ (f (g z)) (f (g z')) : ℝ) : EReal) + Om (embLaw p (fun z => f (g z)))

/-- Theorem 1 (Section 2.1): the minimisers of an objective `L` on embeddings `h : Z → ℝ^k` are
unique up to rotation: any two minimisers `h, h'` satisfy `h' = Q h` for some `Q ∈ O(k)`. -/
def UniqueUpToRotation {Z : Type*} {k : ℕ} (L : (Z → Fin k → ℝ) → EReal) : Prop :=
  ∀ h h' : Z → Fin k → ℝ, (∀ h'', L h ≤ L h'') → (∀ h'', L h' ≤ L h'') →
    ∃ Q : Matrix.orthogonalGroup (Fin k) ℝ, ∀ z, h' z = rot Q (h z)

open Classical in
/-- Proposition 1 (Section 2.1): the anti-collapse term that whitens the embeddings as a hard
constraint: `0` if the law `μ` of the embeddings has mean `0` and second moment `I_k`, `+∞`
otherwise. -/
def whiteningReg {k : ℕ} (μ : Measure (Fin k → ℝ)) : EReal :=
  if (∀ i, ∫ v, v i ∂μ = 0) ∧ (∀ i j, ∫ v, v i * v j ∂μ = if i = j then 1 else 0) then 0 else ⊤

/-- Proposition 1 (Section 2.1): the spectral objective, eq. (1) on world states with
`ℓ(a, b) = ‖a - b‖²` and the whitening constraint as anti-collapse term. -/
def spectralLoss {Z : Type*} [Fintype Z] {k : ℕ} (p : Z → ℝ) (π : Z → Z → ℝ)
    (h : Z → Fin k → ℝ) : EReal :=
  worldLoss p π sqDist whiteningReg h

/-- Proposition 1 and Section 2.3: `f : X → ℝ^k` is centred and whitened under the law `ω` on the
finite set `X`: `E_ω f = 0` and `E_ω f fᵀ = I_k`. -/
def IsWhitened {X : Type*} [Fintype X] {k : ℕ} (ω : X → ℝ) (f : X → Fin k → ℝ) : Prop :=
  (∀ i, ∑ x, ω x * f x i = 0) ∧ (∀ i j, ∑ x, ω x * f x i * f x j = if i = j then 1 else 0)

/-! ### Section 2.1 and Appendix A.1: spectrum -/

/-- Section 2.1: the normalised adjacency `K_π = D^{-1/2} Π D^{-1/2}`, `D = diag(p)`,
`Π_{zz'} = π(z, z')`. -/
def kerMat {Z : Type*} (p : Z → ℝ) (π : Z → Z → ℝ) : Matrix Z Z ℝ :=
  fun z z' => π z z' / Real.sqrt (p z * p z')

/-- Section 2.1: the eigenvalues `1 = μ₀ ≥ μ₁ ≥ ⋯` of `K_π` with multiplicity, as the roots of its
characteristic polynomial in decreasing order (`μ_i := 0` for `i ≥ |Z|`; statements never use
those values, see `extEig`). -/
def eigs {Z : Type*} [Fintype Z] [DecidableEq Z] (p : Z → ℝ) (π : Z → Z → ℝ) (i : ℕ) : ℝ :=
  ((kerMat p π).charpoly.roots.sort (· ≥ ·)).getD i 0

/-- Proposition 1 and Appendix A.4: `μ_i` with the paper's convention `μ_i := -∞` for
`i ≥ |Z|`, as an extended real. -/
def extEig {Z : Type*} [Fintype Z] [DecidableEq Z] (p : Z → ℝ) (π : Z → Z → ℝ) (i : ℕ) : EReal :=
  if i < Fintype.card Z then (eigs p π i : EReal) else ⊥

/-- Appendix A.1: the Markov operator `T_π = D^{-1} Π`, `(T_π h)(z) = E_π[h(z') | z]`, as a matrix
acting on functions `h : Z → ℝ`. -/
def markovOp {Z : Type*} (p : Z → ℝ) (π : Z → Z → ℝ) : Matrix Z Z ℝ :=
  fun z z' => π z z' / p z

/-- Proposition 1 (Section 2.1): `Φ` is a spectral embedding of `π`,
`Φ(z) = (v₁(z), …, v_k(z)) / √p(z)`, for orthonormal eigenvectors `v₁, …, v_k` of `K_π`, orthogonal
to `v₀ = D^{1/2} 1`, with eigenvalues `μ₁, …, μ_k` (any such choice when `K_π` has ties). -/
def IsSpectralEmbedding {Z : Type*} [Fintype Z] [DecidableEq Z] {k : ℕ} (p : Z → ℝ)
    (π : Z → Z → ℝ) (Phi : Z → Fin k → ℝ) : Prop :=
  ∃ v : Fin k → Z → ℝ, (∀ i j, ∑ z, v i z * v j z = if i = j then 1 else 0) ∧
    (∀ i, ∑ z, Real.sqrt (p z) * v i z = 0) ∧
    (∀ i : Fin k, (kerMat p π).mulVec (v i) = eigs p π (i.val + 1) • v i) ∧
    ∀ z i, Phi z i = v i z / Real.sqrt (p z)

/-- Theorem 2 (Section 2.2): the spectral (operator) norm `‖A‖₂` of a real matrix. -/
def specNorm {Z : Type*} [Fintype Z] (A : Matrix Z Z ℝ) : ℝ :=
  sSup ((fun v : Z → ℝ => Real.sqrt (∑ z, (A.mulVec v z) ^ 2)) '' {v | ∑ z, v z ^ 2 ≤ 1})

/-- Theorem 2 (Section 2.2): the Frobenius norm `‖A‖_F` of a real matrix. -/
def frobNorm {Z : Type*} [Fintype Z] (A : Matrix Z Z ℝ) : ℝ :=
  Real.sqrt (∑ z, ∑ z', A z z' ^ 2)

/-- Theorem 2 (Section 2.2) and formal Theorem 4: the `L²(ω)` distance
`(E_ω ‖f(x) - g(x)‖²)^{1/2}` of two embeddings. -/
def l2Dist {X : Type*} [Fintype X] {k : ℕ} (ω : X → ℝ) (f g : X → Fin k → ℝ) : ℝ :=
  Real.sqrt (∑ x, ω x * sqNorm (f x - g x))

/-- Eq. (3), Theorem 2 (Section 2.2): the bound
`(2√2 / δ) min(√k ‖K_{π₁} - K_{π₂}‖₂, ‖K_{π₁} - K_{π₂}‖_F)` with `δ = μ_k - μ_{k+1}` of `K_{π₂}`;
when `k + 1 = |Z|`, `μ_{k+1} = -∞` and the bound is `0`. -/
def kahanBound {Z : Type*} [Fintype Z] [DecidableEq Z] (p : Z → ℝ) (π₁ π₂ : Z → Z → ℝ)
    (k : ℕ) : ℝ :=
  if k + 1 < Fintype.card Z then
    2 * Real.sqrt 2 / (eigs p π₂ k - eigs p π₂ (k + 1)) *
      min (Real.sqrt k * specNorm (kerMat p π₁ - kerMat p π₂)) (frobNorm (kerMat p π₁ - kerMat p π₂))
  else 0

/-! ### Section 2.3 and Appendix A.4: observations, nuisance, good and bad views -/

/-- Section 2.3 and formal Theorem 4: the state marginal `z ↦ ∑_{x : s(x) = z} ω(x)` of a law `ω`
on observations, each observation `x` being of the world state `s(x)`. -/
def stateMarg {X Z : Type*} [Fintype X] [DecidableEq Z] (ω : X → ℝ) (s : X → Z) (z : Z) : ℝ :=
  ∑ x, if s x = z then ω x else 0

/-- Section 2.3: `E[f(x) | z]`, the conditional mean of the embedding given the world state. -/
def condMean {X Z : Type*} [Fintype X] [DecidableEq Z] {k : ℕ} (ω : X → ℝ) (s : X → Z)
    (f : X → Fin k → ℝ) (z : Z) : Fin k → ℝ :=
  fun i => (∑ x, if s x = z then ω x * f x i else 0) / stateMarg ω s z

/-- Section 2.3: `E_ω f`, the mean of the embedding. -/
def meanVec {X : Type*} [Fintype X] {k : ℕ} (ω : X → ℝ) (f : X → Fin k → ℝ) : Fin k → ℝ :=
  fun i => ∑ x, ω x * f x i

/-- Section 2.3: `C_f = Cov(E[f(x) | z])`, the covariance of the part of the embedding that the
world state explains. -/
def stateCov {X Z : Type*} [Fintype X] [Fintype Z] [DecidableEq Z] {k : ℕ} (ω : X → ℝ)
    (s : X → Z) (f : X → Fin k → ℝ) : Matrix (Fin k) (Fin k) ℝ :=
  fun i j => ∑ z, stateMarg ω s z * (condMean ω s f z i - meanVec ω f i) *
    (condMean ω s f z j - meanVec ω f j)

/-- Section 2.3: the scene-explained fraction `ρ(f) = tr C_f^{1/2} / k`, with `tr C_f^{1/2}` the sum
of the square roots of the eigenvalues of `C_f` (roots of its characteristic polynomial, with
multiplicity). -/
def rho {X Z : Type*} [Fintype X] [Fintype Z] [DecidableEq Z] {k : ℕ} (ω : X → ℝ) (s : X → Z)
    (f : X → Fin k → ℝ) : ℝ :=
  ((stateCov ω s f).charpoly.roots.map Real.sqrt).sum / k

/-- Section 2.3 and Appendix A.4: the law `p(z) q(ν)` of an observation `(z, ν)` of state `z` with
nuisance `ν ∼ q` drawn independently of `z`. -/
def prodLaw {Z N : Type*} (p : Z → ℝ) (q : N → ℝ) (x : Z × N) : ℝ := p x.1 * q x.2

/-- Proposition 3 (i), Appendix A.4: the positive-pair law of a good-view JEPA on observations
`(z, ν)`: `(z, z') ∼ π` and independent nuisances `ν, ν' ∼ q`, i.e. the kernel `Π ⊗ q qᵀ`. -/
def goodViewLaw {Z N : Type*} (π : Z → Z → ℝ) (q : N → ℝ) (x y : Z × N) : ℝ :=
  π x.1 y.1 * q x.2 * q y.2

/-- Proposition 3 (ii), Appendix A.4: `A` is row-stochastic with stationary law `p`
(`A ≥ 0`, `A 1 = 1`, `pᵀ A = pᵀ`). -/
def IsStationaryStochastic {Z : Type*} [Fintype Z] (p : Z → ℝ) (A : Matrix Z Z ℝ) : Prop :=
  (∀ z z', 0 ≤ A z z') ∧ (∀ z, ∑ z', A z z' = 1) ∧ (∀ z', ∑ z, p z * A z z' = p z')

/-- Proposition 3 (ii), Appendix A.4: the positive-pair law of a bad-view JEPA: two corruptions
`x̃, x̃' ∼ Γ(· | x)` of one clean observation `x ∼ p ⊗ q`, drawn independently given `x`, for the
product corruption `Γ = A ⊗ B`. -/
def badViewLaw {Z N : Type*} [Fintype Z] [Fintype N] (p : Z → ℝ) (q : N → ℝ) (A : Matrix Z Z ℝ)
    (B : Matrix N N ℝ) (x x' : Z × N) : ℝ :=
  ∑ y : Z × N, prodLaw p q y * (A y.1 x.1 * B y.2 x.2) * (A y.1 x'.1 * B y.2 x'.2)

/-- Proposition 3 (ii), Appendix A.4: the law `Aᵀ D_p A` of two corruptions of one state, whose
Markov operator on `L²(p)` is `A* A`. -/
def twoCorruptLaw {Z : Type*} [Fintype Z] (p : Z → ℝ) (A : Matrix Z Z ℝ) (z z' : Z) : ℝ :=
  ∑ y, p y * A y z * A y z'

/-- Proposition 3 (ii), Appendix A.4: the eigenvalues `1 = α₀ ≥ α₁ ≥ ⋯` of `A* A` on `L²(p)`
(for `B` and `q`: the `β_j`), i.e. the eigenvalues of the normalised kernel of `Aᵀ D_p A`. -/
def corrEig {Z : Type*} [Fintype Z] [DecidableEq Z] (p : Z → ℝ) (A : Matrix Z Z ℝ) (i : ℕ) : ℝ :=
  eigs p (twoCorruptLaw p A) i

/-- Proposition 3 (ii), Appendix A.4: the index pairs `(i, j) ≠ (0, 0)`, `i < |Z|`, `j < |N|`. -/
def badPairs (nZ nN : ℕ) : Finset (ℕ × ℕ) :=
  (Finset.range nZ ×ˢ Finset.range nN).erase (0, 0)

/-- Proposition 3 (ii), Appendix A.4: the eigenvalue `α_i β_j` of the bad-view kernel. -/
def badEig {Z N : Type*} [Fintype Z] [DecidableEq Z] [Fintype N] [DecidableEq N] (p : Z → ℝ)
    (q : N → ℝ) (A : Matrix Z Z ℝ) (B : Matrix N N ℝ) (ij : ℕ × ℕ) : ℝ :=
  corrEig p A ij.1 * corrEig q B ij.2

/-- Proposition 3 (ii), Appendix A.4: `ξ₁ ≥ ξ₂ ≥ ⋯`, the values `α_i β_j` with `(i, j) ≠ (0, 0)`,
with multiplicity, in decreasing order (`ξ_l` for `l ≥ 1`). -/
def xi {Z N : Type*} [Fintype Z] [DecidableEq Z] [Fintype N] [DecidableEq N] (p : Z → ℝ)
    (q : N → ℝ) (A : Matrix Z Z ℝ) (B : Matrix N N ℝ) (l : ℕ) : ℝ :=
  (((badPairs (Fintype.card Z) (Fintype.card N)).val.map (badEig p q A B)).sort (· ≥ ·)).getD
    (l - 1) 0

/-- Proposition 3 (ii), Appendix A.4: `r`, the number of the top `k` pairs `(i, j)` (those with
`α_i β_j ≥ ξ_k`; exactly `k` of them when `ξ_k > ξ_{k+1}`) that have `j ≥ 1`. -/
def nuisanceCount {Z N : Type*} [Fintype Z] [DecidableEq Z] [Fintype N] [DecidableEq N]
    (p : Z → ℝ) (q : N → ℝ) (A : Matrix Z Z ℝ) (B : Matrix N N ℝ) (k : ℕ) : ℕ :=
  ((badPairs (Fintype.card Z) (Fintype.card N)).filter
    (fun ij => 1 ≤ ij.2 ∧ xi p q A B k ≤ badEig p q A B ij)).card

/-! ### Appendix A.4: formal Theorem 4 -/

/-- Formal Theorem 4 (Appendix A.4): the induced world kernel `π_W(z, z')`, the probability that a
positive pair `(x, x') ∼ W` joins an observation of `z` to one of `z'`. -/
def inducedKernel {X Z : Type*} [Fintype X] [DecidableEq Z] (s : X → Z) (W : X → X → ℝ) (z z' : Z) : ℝ :=
  ∑ x, ∑ x', if s x = z ∧ s x' = z' then W x x' else 0

/-- Formal Theorem 4 (Appendix A.4): the conditional expectation `P` onto functions of the state
in `L²(ω)`, `(P h)(x) = E_ω[h | s = s(x)]`, as a matrix. -/
def condExpMat {X Z : Type*} [Fintype X] [DecidableEq Z] (ω : X → ℝ) (s : X → Z) :
    Matrix X X ℝ :=
  fun x x' => if s x' = s x then ω x' / stateMarg ω s (s x) else 0

/-- Appendix A.1: the inner product `⟨h, h'⟩_ω = ∑ₓ ω(x) h(x) h'(x)` of `L²(ω)`. -/
def l2Inner {X : Type*} [Fintype X] (ω : X → ℝ) (h h' : X → ℝ) : ℝ :=
  ∑ x, ω x * h x * h' x

/-- Formal Theorem 4 (Appendix A.4): `η`, the largest eigenvalue of the compression
`(I - P) T_W (I - P)` to nuisance functions (`P h = 0`), i.e. the largest value of `⟨h, T_W h⟩_ω`
over nuisance functions of unit norm; `η = -∞` (the supremum of the empty set) if every state has
one observation. -/
def nuisanceTop {X Z : Type*} [Fintype X] [DecidableEq Z] (ω : X → ℝ) (s : X → Z)
    (W : X → X → ℝ) : EReal :=
  sSup ((fun h : X → ℝ => ((l2Inner ω h ((markovOp ω W).mulVec h) : ℝ) : EReal)) ''
    {h | (condExpMat ω s).mulVec h = 0 ∧ l2Inner ω h h = 1})

/-- Formal Theorem 4 (Appendix A.4): the mixing operator `(I - P) T_W P`. -/
def mixOp {X Z : Type*} [Fintype X] [DecidableEq X] [DecidableEq Z] (ω : X → ℝ) (s : X → Z)
    (W : X → X → ℝ) : Matrix X X ℝ :=
  (1 - condExpMat ω s) * markovOp ω W * condExpMat ω s

/-- Formal Theorem 4 (Appendix A.4): the operator norm of a matrix `M` acting on `L²(ω)`. -/
def opNormL2 {X : Type*} [Fintype X] (ω : X → ℝ) (M : Matrix X X ℝ) : ℝ :=
  sSup ((fun h : X → ℝ => Real.sqrt (l2Inner ω (M.mulVec h) (M.mulVec h))) ''
    {h | l2Inner ω h h ≤ 1})

/-- Formal Theorem 4 (Appendix A.4): the Hilbert-Schmidt norm of a matrix `M` acting on `L²(ω)`,
`(∑_{x,x'} ω(x) M(x,x')² / ω(x'))^{1/2}`. -/
def hsNormL2 {X : Type*} [Fintype X] (ω : X → ℝ) (M : Matrix X X ℝ) : ℝ :=
  Real.sqrt (∑ x, ∑ x', ω x * M x x' ^ 2 / ω x')

/-- Formal Theorem 4 (Appendix A.4): `ε`, the operator norm of `(I - P) T_W P` on `L²(ω)`. -/
def mixNorm {X Z : Type*} [Fintype X] [DecidableEq X] [DecidableEq Z] (ω : X → ℝ) (s : X → Z)
    (W : X → X → ℝ) : ℝ :=
  opNormL2 ω (mixOp ω s W)

/-- Formal Theorem 4 (Appendix A.4): `ε^{HS}`, the Hilbert-Schmidt norm of `(I - P) T_W P` on
`L²(ω)`. -/
def mixHSNorm {X Z : Type*} [Fintype X] [DecidableEq X] [DecidableEq Z] (ω : X → ℝ) (s : X → Z)
    (W : X → X → ℝ) : ℝ :=
  hsNormL2 ω (mixOp ω s W)

/-- Formal Theorem 4 (Appendix A.4): `δ = μ_k - max(μ_{k+1}, η)`, with `μ_i` the eigenvalues of
the induced world kernel (`μ_{|Z|} := -∞`), as an extended real (`+∞` when `μ_{k+1} = η = -∞`). -/
def worldGap {X Z : Type*} [Fintype X] [Fintype Z] [DecidableEq Z] (ω : X → ℝ) (s : X → Z)
    (W : X → X → ℝ) (k : ℕ) : EReal :=
  (eigs (stateMarg ω s) (inducedKernel s W) k : EReal) -
    max (extEig (stateMarg ω s) (inducedKernel s W) (k + 1)) (nuisanceTop ω s W)

/-- Formal Theorem 4 (i) (Appendix A.4): `τ = (2√2 / δ) min(√k ε, √2 ε^{HS})`, read as `0` when
`δ = +∞`. -/
def tau {X Z : Type*} [Fintype X] [DecidableEq X] [Fintype Z] [DecidableEq Z] (ω : X → ℝ)
    (s : X → Z) (W : X → X → ℝ) (k : ℕ) : ℝ :=
  if worldGap ω s W k = ⊤ then 0 else
    2 * Real.sqrt 2 / (worldGap ω s W k).toReal *
      min (Real.sqrt k * mixNorm ω s W) (Real.sqrt 2 * mixHSNorm ω s W)

/-- Formal Theorem 4 (ii) (Appendix A.4): `γ` is a law of paired observations `(x₁, x₂)` of one
world state with `x_m ∼ ω_m`: `z ∼ p` and `x_m | z ∼ ω_m(· | z)`, under any coupling. -/
def IsPairedCoupling {X₁ X₂ Z : Type*} [Fintype X₁] [Fintype X₂] (ω₁ : X₁ → ℝ) (s₁ : X₁ → Z)
    (ω₂ : X₂ → ℝ) (s₂ : X₂ → Z) (γ : X₁ → X₂ → ℝ) : Prop :=
  (∀ x₁ x₂, 0 ≤ γ x₁ x₂) ∧ (∀ x₁, ∑ x₂, γ x₁ x₂ = ω₁ x₁) ∧ (∀ x₂, ∑ x₁, γ x₁ x₂ = ω₂ x₂) ∧
    ∀ x₁ x₂, γ x₁ x₂ ≠ 0 → s₁ x₁ = s₂ x₂

/-- Formal Theorem 4 (ii) (Appendix A.4): `(E_γ ‖f₁(x₁) - Q f₂(x₂)‖²)^{1/2}`. -/
def pairedRMS {X₁ X₂ : Type*} [Fintype X₁] [Fintype X₂] {k : ℕ} (γ : X₁ → X₂ → ℝ)
    (f₁ : X₁ → Fin k → ℝ) (f₂ : X₂ → Fin k → ℝ) (Q : Matrix.orthogonalGroup (Fin k) ℝ) : ℝ :=
  Real.sqrt (∑ x₁, ∑ x₂, γ x₁ x₂ * sqNorm (f₁ x₁ - rot Q (f₂ x₂)))

/-- Appendix A.4, "Special cases and scope": the law of the merged observations when the
observations are grouped by `c : X → Y`. -/
def mergeWeights {X Y : Type*} [Fintype X] [DecidableEq Y] (c : X → Y) (ω : X → ℝ) (y : Y) : ℝ :=
  ∑ x, if c x = y then ω x else 0

/-- Appendix A.4, "Special cases and scope": the positive-pair law on merged observations,
`W'(y, y') = ∑_{c(x) = y, c(x') = y'} W(x, x')`. -/
def mergeLaw {X Y : Type*} [Fintype X] [DecidableEq Y] (c : X → Y) (W : X → X → ℝ) (y y' : Y) :
    ℝ :=
  ∑ x, ∑ x', if c x = y ∧ c x' = y' then W x x' else 0

/-! ### Section 2.4: next-token prediction -/

/-- Eq. (6), Proposition 4 (Section 2.4): the anti-collapse term `A(h) = log ∑_v exp ⟨h, w_v⟩`. -/
def ntpAntiCollapse {V : Type*} [Fintype V] {k : ℕ} (w : V → Fin k → ℝ) (h : Fin k → ℝ) : ℝ :=
  Real.log (∑ v, Real.exp (h ⬝ᵥ w v))

/-- Eq. (6), Proposition 4 (Section 2.4): the next-token loss with a linear softmax head,
`-log (e^{⟨h, w_y⟩} / ∑_v e^{⟨h, w_v⟩})`. -/
def ntpLoss {V : Type*} [Fintype V] {k : ℕ} (w : V → Fin k → ℝ) (h : Fin k → ℝ) (y : V) : ℝ :=
  -Real.log (Real.exp (h ⬝ᵥ w y) / ∑ v, Real.exp (h ⬝ᵥ w v))

/-- Proposition 4 (iii) and its proof (Appendix A.5): the expected next-token loss
`∑_c P(c) ∑_v p(v | c) · (-log softmax(W h(c))_v)` over finitely many contexts. -/
def ntpRisk {C V : Type*} [Fintype C] [Fintype V] {k : ℕ} (P : C → ℝ) (cond : C → V → ℝ)
    (h : C → Fin k → ℝ) (w : V → Fin k → ℝ) : ℝ :=
  ∑ c, P c * ∑ v, cond c v * ntpLoss w (h c) v

/-! ### Appendix C: subsample intervals -/

/-- Appendix C ("Uncertainty on WIT"): the mean `(1/N) ∑ᵢ xᵢ` of a score over the full set of `N`
pairs. -/
def popMean {N : ℕ} (x : Fin N → ℝ) : ℝ := (∑ i, x i) / N

/-- Appendix C ("Uncertainty on WIT"): the mean of the score over a subset `S` of the pairs. -/
def subMean {N : ℕ} (x : Fin N → ℝ) (S : Finset (Fin N)) : ℝ := (∑ i ∈ S, x i) / S.card

/-- Appendix C ("Uncertainty on WIT"): the sample variance `s² = ∑ᵢ (xᵢ - x̄)² / (N - 1)`, so that
the standard error of the full score is `s / √N`. -/
def sampleVar {N : ℕ} (x : Fin N → ℝ) : ℝ := (∑ i, (x i - popMean x) ^ 2) / ((N : ℝ) - 1)

/-- Appendix C ("Uncertainty on WIT"): the spread of the score over uniformly random `n`-subsets
drawn without replacement around the full score,
`(E_S (x̄_S - x̄)²)^{1/2}`. -/
def subsampleSpread {N : ℕ} (x : Fin N → ℝ) (n : ℕ) : ℝ :=
  Real.sqrt ((∑ S ∈ (Finset.univ : Finset (Fin N)).powersetCard n, (subMean x S - popMean x) ^ 2) /
    (N.choose n))

end Arxiv2610_39302
Source
Balestriero and LeCun, Proving and Improving the Platonic Representation Hypothesis with JEPAs, arXiv:2610.39302v1 (2026), Sections 2.1-2.4, Appendix A.1-A.5 (PDF pp. 2-6, 20-23), Appendix C 'Uncertainty on WIT' (PDF p. 31)
Read-back

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

Throughout, Rk\mathbb{R}^kRk means vectors with coordinates indexed by 0,1,…,k−10,1,\dots,k-10,1,…,k−1; k=0k=0k=0 is allowed, in which case R0\mathbb{R}^0R0 is a single point. All finite sets may be empty unless a hypothesis rules it out. The following junk conventions apply everywhere:

  • division by zero returns 000;
  • the square root of a negative number returns 000;
  • log⁡0=0\log 0 = 0log0=0;
  • natural-number subtraction truncates at 000.

sqNorm. For a∈Rka\in\mathbb{R}^ka∈Rk, it is the number

∥a∥2=∑i=0k−1ai2.\|a\|^2=\sum_{i=0}^{k-1}a_i^2 .∥a∥2=i=0∑k−1​ai2​.

For k=0k=0k=0 it equals 000.

sqDist. For a,b∈Rka,b\in\mathbb{R}^ka,b∈Rk, it is the number ℓ(a,b)=∥a−b∥2=∑i(ai−bi)2\ell(a,b)=\|a-b\|^2=\sum_i(a_i-b_i)^2ℓ(a,b)=∥a−b∥2=∑i​(ai​−bi​)2.

rot. Let QQQ be a real orthogonal k×kk\times kk×k matrix, meaning Q⊤Q=QQ⊤=IkQ^\top Q=QQ^\top=I_kQ⊤Q=QQ⊤=Ik​. For a∈Rka\in\mathbb{R}^ka∈Rk, rot is the matrix–vector product Qa∈RkQa\in\mathbb{R}^kQa∈Rk.

IsPairLaw. Let ZZZ be a finite set, 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 holds exactly when all of the following are true:

  • p(z)>0p(z)>0p(z)>0 for every zzz;
  • ∑zp(z)=1\sum_z p(z)=1∑z​p(z)=1, which forces Z≠∅Z\neq\emptysetZ=∅;
  • π(z,z′)≥0\pi(z,z')\ge 0π(z,z′)≥0 for all z,z′z,z'z,z′;
  • π(z,z′)=π(z′,z)\pi(z,z')=\pi(z',z)π(z,z′)=π(z′,z) for all z,z′z,z'z,z′;
  • ∑z′π(z,z′)=p(z)\sum_{z'}\pi(z,z')=p(z)∑z′​π(z,z′)=p(z) for every zzz.

By symmetry the column sums also equal ppp, and the total mass of π\piπ is 111.

embLaw. Let ZZZ be finite, p:Z→Rp:Z\to\mathbb{R}p:Z→R, and h:Z→Rkh:Z\to\mathbb{R}^kh:Z→Rk. embLaw is the measure on Rk\mathbb{R}^kRk

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

where δv\delta_vδv​ is the unit point mass at vvv. Negative weights are replaced by 000. The measure is a probability measure only if the clipped weights sum to 111.

IsJEPAObjective. Fix a finite ZZZ, p:Z→Rp:Z\to\mathbb{R}p:Z→R, a function ℓ:Rk×Rk→R\ell:\mathbb{R}^k\times\mathbb{R}^k\to\mathbb{R}ℓ:Rk×Rk→R, and a function Ω\OmegaΩ from measures on Rk\mathbb{R}^kRk to R∪{−∞,+∞}\mathbb{R}\cup\{-\infty,+\infty\}R∪{−∞,+∞}. The predicate holds exactly when:

  1. ℓ(Qa,Qb)=ℓ(a,b)\ell(Qa,Qb)=\ell(a,b)ℓ(Qa,Qb)=ℓ(a,b) for every orthogonal QQQ and all a,b∈Rka,b\in\mathbb{R}^ka,b∈Rk;
  2. for every h:Z→Rkh:Z\to\mathbb{R}^kh:Z→Rk and every orthogonal QQQ, Ω(embLaw(p, Qh))=Ω(embLaw(p,h))\Omega(\text{embLaw}(p,\,Qh))=\Omega(\text{embLaw}(p,h))Ω(embLaw(p,Qh))=Ω(embLaw(p,h)), where (Qh)(z)=Q h(z)(Qh)(z)=Q\,h(z)(Qh)(z)=Qh(z) and embLaw is as above (weights max⁡(p,0)\max(p,0)max(p,0));
  3. Ω(μ)≠−∞\Omega(\mu)\neq-\inftyΩ(μ)=−∞ for every measure μ\muμ. The value +∞+\infty+∞ is allowed.

Nothing else is assumed about ℓ\ellℓ: not nonnegativity, not symmetry, not ℓ(a,a)=0\ell(a,a)=0ℓ(a,a)=0. The invariance of Ω\OmegaΩ is only required on measures of the form embLaw.

worldLoss. For Z,p,ℓ,ΩZ,p,\ell,\OmegaZ,p,ℓ,Ω as above, π:Z×Z→R\pi:Z\times Z\to\mathbb{R}π:Z×Z→R, and h:Z→Rkh:Z\to\mathbb{R}^kh:Z→Rk, it is the extended real

Lπ(h)=∑z,z′π(z,z′) ℓ(h(z),h(z′))+Ω(∑zmax⁡(p(z),0) δh(z)).L_\pi(h)=\sum_{z,z'}\pi(z,z')\,\ell(h(z),h(z'))+\Omega\big(\textstyle\sum_z\max(p(z),0)\,\delta_{h(z)}\big).Lπ​(h)=z,z′∑​π(z,z′)ℓ(h(z),h(z′))+Ω(∑z​max(p(z),0)δh(z)​).

The first term is a finite real number. The total is therefore +∞+\infty+∞ or −∞-\infty−∞ exactly when Ω\OmegaΩ is.

modalityLoss. Let XXX be any set, g:Z→Xg:Z\to Xg:Z→X, and f:X→Rkf:X\to\mathbb{R}^kf:X→Rk. It is the worldLoss above applied to the composite h=f∘gh=f\circ gh=f∘g:

∑z,z′π(z,z′) ℓ(f(g(z)),f(g(z′)))+Ω(∑zmax⁡(p(z),0) δf(g(z))).\sum_{z,z'}\pi(z,z')\,\ell(f(g(z)),f(g(z')))+\Omega\big(\textstyle\sum_z\max(p(z),0)\,\delta_{f(g(z))}\big).z,z′∑​π(z,z′)ℓ(f(g(z)),f(g(z′)))+Ω(∑z​max(p(z),0)δf(g(z))​).

UniqueUpToRotation. Let ZZZ be any set (not necessarily finite) and LLL a function from maps Z→RkZ\to\mathbb{R}^kZ→Rk to extended reals. The predicate says: whenever hhh and h′h'h′ are both global minimisers, meaning L(h)≤L(h′′)L(h)\le L(h'')L(h)≤L(h′′) and L(h′)≤L(h′′)L(h')\le L(h'')L(h′)≤L(h′′) for all h′′h''h′′, there is an orthogonal QQQ with h′(z)=Q h(z)h'(z)=Q\,h(z)h′(z)=Qh(z) for all zzz.

Edge cases:

  • It holds vacuously if LLL has no minimiser.
  • If L≡+∞L\equiv+\inftyL≡+∞, every hhh is a minimiser, so the predicate demands that any two maps be rotations of each other.

whiteningReg. For a measure μ\muμ on Rk\mathbb{R}^kRk, it is

Ωwh(μ)={0if ∫vi dμ=0 ∀i and ∫vivj dμ=1[i=j] ∀i,j,+∞otherwise.\Omega_{\rm wh}(\mu)=\begin{cases}0&\text{if }\int v_i\,d\mu=0\ \forall i\ \text{and}\ \int v_iv_j\,d\mu=\mathbb 1[i=j]\ \forall i,j,\\ +\infty&\text{otherwise.}\end{cases}Ωwh​(μ)={0+∞​if ∫vi​dμ=0 ∀i and ∫vi​vj​dμ=1[i=j] ∀i,j,otherwise.​
  • μ\muμ is not required to be a probability measure.
  • Any non-integrable integrand is assigned integral 000.
  • For k=0k=0k=0 the conditions are empty, so the value is always 000.

spectralLoss. For ZZZ finite, ppp, π\piπ, and h:Z→Rkh:Z\to\mathbb{R}^kh:Z→Rk, it is worldLoss with ℓ(a,b)=∥a−b∥2\ell(a,b)=\|a-b\|^2ℓ(a,b)=∥a−b∥2 and Ω=Ωwh\Omega=\Omega_{\rm wh}Ω=Ωwh​. Explicitly, the value is

∑z,z′π(z,z′)∥h(z)−h(z′)∥2\sum_{z,z'}\pi(z,z')\|h(z)-h(z')\|^2z,z′∑​π(z,z′)∥h(z)−h(z′)∥2

if both of the following hold, and +∞+\infty+∞ otherwise:

  • ∑zmax⁡(p(z),0) hi(z)=0\sum_z\max(p(z),0)\,h_i(z)=0∑z​max(p(z),0)hi​(z)=0 for all iii;
  • ∑zmax⁡(p(z),0) hi(z)hj(z)=1[i=j]\sum_z\max(p(z),0)\,h_i(z)h_j(z)=\mathbb 1[i=j]∑z​max(p(z),0)hi​(z)hj​(z)=1[i=j] for all i,ji,ji,j.

IsWhitened. Let XXX be finite, ω:X→R\omega:X\to\mathbb{R}ω:X→R (no sign or normalisation assumed), and f:X→Rkf:X\to\mathbb{R}^kf:X→Rk. The predicate holds exactly when:

  • ∑xω(x)fi(x)=0\sum_x\omega(x)f_i(x)=0∑x​ω(x)fi​(x)=0 for all iii;
  • ∑xω(x)fi(x)fj(x)=1[i=j]\sum_x\omega(x)f_i(x)f_j(x)=\mathbb 1[i=j]∑x​ω(x)fi​(x)fj​(x)=1[i=j] for all i,ji,ji,j.

kerMat. 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, it is the Z×ZZ\times ZZ×Z matrix

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

The entry is 000 whenever p(z)p(z′)≤0p(z)p(z')\le 0p(z)p(z′)≤0, by the square-root and division conventions.

eigs. For finite ZZZ, μi\mu_iμi​ (i∈Ni\in\mathbb{N}i∈N) is defined as follows:

  1. Take the real roots of the characteristic polynomial of KπK_\piKπ​, counted with multiplicity.
  2. Sort them in non-increasing order.
  3. μi\mu_iμi​ is the entry at position iii, counting from 000. If there are at most iii real roots, μi=0\mu_i=0μi​=0.
  • Non-real roots are simply dropped, and nothing in the definition forces μ0=1\mu_0=1μ0​=1.
  • If Z=∅Z=\emptysetZ=∅, every μi=0\mu_i=0μi​=0.

extEig. It is the extended real equal to μi\mu_iμi​ (from eigs) if i<∣Z∣i<|Z|i<∣Z∣, and −∞-\infty−∞ if i≥∣Z∣i\ge|Z|i≥∣Z∣. If fewer than ∣Z∣|Z|∣Z∣ real roots exist, some indices i<∣Z∣i<|Z|i<∣Z∣ get the junk value 000.

markovOp. It is the Z×ZZ\times ZZ×Z matrix Tπ(z,z′)=π(z,z′)/p(z)T_\pi(z,z')=\pi(z,z')/p(z)Tπ​(z,z′)=π(z,z′)/p(z). Rows with p(z)=0p(z)=0p(z)=0 are 000.

IsSpectralEmbedding. Let ZZZ be finite, ppp and π\piπ given, and Φ:Z→Rk\Phi:Z\to\mathbb{R}^kΦ:Z→Rk. The predicate says there exist vectors v0,…,vk−1∈RZv_0,\dots,v_{k-1}\in\mathbb{R}^Zv0​,…,vk−1​∈RZ such that:

  1. ∑zvi(z)vj(z)=1[i=j]\sum_z v_i(z)v_j(z)=\mathbb 1[i=j]∑z​vi​(z)vj​(z)=1[i=j], i.e. they are orthonormal for the standard dot product;
  2. ∑zp(z) vi(z)=0\sum_z\sqrt{p(z)}\,v_i(z)=0∑z​p(z)​vi​(z)=0 for each iii, where ⋅\sqrt{\cdot}⋅​ of a negative number is 000;
  3. Kπvi=μi+1viK_\pi v_i=\mu_{i+1}v_iKπ​vi​=μi+1​vi​ for each iii, with μ\muμ as in eigs. So the iii-th coordinate uses exactly the (i+1)(i+1)(i+1)-th entry of the sorted list μ0≥μ1≥⋯\mu_0\ge\mu_1\ge\cdotsμ0​≥μ1​≥⋯;
  4. Φi(z)=vi(z)/p(z)\Phi_i(z)=v_i(z)/\sqrt{p(z)}Φi​(z)=vi​(z)/p(z)​ for all z,iz,iz,i, which is 000 where p(z)≤0p(z)\le0p(z)≤0.

Edge cases:

  • If μi+1\mu_{i+1}μi+1​ is the junk value 000, condition 3 just says Kπvi=0K_\pi v_i=0Kπ​vi​=0.
  • Orthonormality forces k≤∣Z∣k\le|Z|k≤∣Z∣.
  • For k=0k=0k=0 the predicate is trivially true.

specNorm. For a real Z×ZZ\times ZZ×Z matrix AAA, it is the supremum of (∑z((Av)z)2)1/2\big(\sum_z((Av)_z)^2\big)^{1/2}(∑z​((Av)z​)2)1/2 over all vvv with ∑zvz2≤1\sum_z v_z^2\le1∑z​vz2​≤1. This is the usual operator 2-norm.

frobNorm. It is ∥A∥F=(∑z,z′A(z,z′)2)1/2\|A\|_F=\big(\sum_{z,z'}A(z,z')^2\big)^{1/2}∥A∥F​=(∑z,z′​A(z,z′)2)1/2.

l2Dist. For finite XXX, ω:X→R\omega:X\to\mathbb{R}ω:X→R, and f,g:X→Rkf,g:X\to\mathbb{R}^kf,g:X→Rk, it is

(∑xω(x) ∥f(x)−g(x)∥2)1/2.\Big(\sum_x\omega(x)\,\|f(x)-g(x)\|^2\Big)^{1/2}.(x∑​ω(x)∥f(x)−g(x)∥2)1/2.

It is 000 if the inner sum is negative, which is possible only for signed ω\omegaω.

kahanBound. Fix finite ZZZ, one ppp, two pair functions π1,π2\pi_1,\pi_2π1​,π2​, and k∈Nk\in\mathbb{N}k∈N. Write Δ=Kπ1−Kπ2\Delta=K_{\pi_1}-K_{\pi_2}Δ=Kπ1​​−Kπ2​​, where both matrices use the same ppp, and let μi\mu_iμi​ be the eigs of Kπ2K_{\pi_2}Kπ2​​.

  • If k+1<∣Z∣k+1<|Z|k+1<∣Z∣, the value is
22μk−μk+1min⁡(k ∥Δ∥2, ∥Δ∥F).\frac{2\sqrt2}{\mu_k-\mu_{k+1}}\min\big(\sqrt k\,\|\Delta\|_2,\ \|\Delta\|_F\big).μk​−μk+1​22​​min(k​∥Δ∥2​, ∥Δ∥F​).
  • If k+1≥∣Z∣k+1\ge|Z|k+1≥∣Z∣, the value is 000.

When μk=μk+1\mu_k=\mu_{k+1}μk​=μk+1​ the denominator is 000, so the value is 000. The gap could be negative only through the junk-000 padding of eigs.

stateMarg. For finite XXX, ω:X→R\omega:X\to\mathbb{R}ω:X→R, s:X→Zs:X\to Zs:X→Z, and z∈Zz\in Zz∈Z, it is m(z)=∑x: s(x)=zω(x)m(z)=\sum_{x:\,s(x)=z}\omega(x)m(z)=∑x:s(x)=z​ω(x). This equals 000 for states with no observation.

condMean. It is the vector in Rk\mathbb{R}^kRk with iii-th coordinate

∑x: s(x)=zω(x)fi(x)m(z).\frac{\sum_{x:\,s(x)=z}\omega(x)f_i(x)}{m(z)}.m(z)∑x:s(x)=z​ω(x)fi​(x)​.

The whole vector is 000 when m(z)=0m(z)=0m(z)=0.

meanVec. It is the vector with iii-th coordinate ∑xω(x)fi(x)\sum_x\omega(x)f_i(x)∑x​ω(x)fi​(x). It is not normalised by ∑ω\sum\omega∑ω.

stateCov. It is the k×kk\times kk×k matrix

Cf(i,j)=∑zm(z)(fˉi(z)−Mi)(fˉj(z)−Mj),C_f(i,j)=\sum_z m(z)\big(\bar f_i(z)-M_i\big)\big(\bar f_j(z)-M_j\big),Cf​(i,j)=z∑​m(z)(fˉ​i​(z)−Mi​)(fˉ​j​(z)−Mj​),

where fˉ(z)\bar f(z)fˉ​(z) is condMean and MMM is meanVec.

rho. It is

ρ(f)=1k∑λ,\rho(f)=\frac1k\sum\sqrt{\lambda},ρ(f)=k1​∑λ​,

where the sum runs over the real roots λ\lambdaλ of the characteristic polynomial of CfC_fCf​, with multiplicity.

  • Non-real roots are omitted.
  • λ=0\sqrt{\lambda}=0λ​=0 for negative λ\lambdaλ.
  • ρ=0\rho=0ρ=0 when k=0k=0k=0.

prodLaw. It is the function on Z×NZ\times NZ×N given by (z,ν)↦p(z) q(ν)(z,\nu)\mapsto p(z)\,q(\nu)(z,ν)↦p(z)q(ν).

goodViewLaw. It is the function on pairs given by ((z,ν),(z′,ν′))↦π(z,z′) q(ν) q(ν′)((z,\nu),(z',\nu'))\mapsto\pi(z,z')\,q(\nu)\,q(\nu')((z,ν),(z′,ν′))↦π(z,z′)q(ν)q(ν′).

IsStationaryStochastic. For a Z×ZZ\times ZZ×Z matrix AAA, it holds exactly when:

  • A(z,z′)≥0A(z,z')\ge0A(z,z′)≥0 for all z,z′z,z'z,z′;
  • ∑z′A(z,z′)=1\sum_{z'}A(z,z')=1∑z′​A(z,z′)=1 for every zzz;
  • ∑zp(z)A(z,z′)=p(z′)\sum_z p(z)A(z,z')=p(z')∑z​p(z)A(z,z′)=p(z′) for every z′z'z′.

No condition is placed on ppp.

badViewLaw. For finite ZZZ and NNN, ppp, qqq, a Z×ZZ\times ZZ×Z matrix AAA, and an N×NN\times NN×N matrix BBB, it is

W((z,ν),(z′,ν′))=∑y∈Z∑u∈Np(y)q(u) A(y,z)B(u,ν) A(y,z′)B(u,ν′).W((z,\nu),(z',\nu'))=\sum_{y\in Z}\sum_{u\in N}p(y)q(u)\,A(y,z)B(u,\nu)\,A(y,z')B(u,\nu').W((z,ν),(z′,ν′))=y∈Z∑​u∈N∑​p(y)q(u)A(y,z)B(u,ν)A(y,z′)B(u,ν′).

twoCorruptLaw. It is πA(z,z′)=∑yp(y)A(y,z)A(y,z′)\pi_A(z,z')=\sum_y p(y)A(y,z)A(y,z')πA​(z,z′)=∑y​p(y)A(y,z)A(y,z′).

corrEig. αi\alpha_iαi​ is the iii-th eigs value of the pair (p,πA)(p,\pi_A)(p,πA​). That is, it is the iii-th largest real root (with multiplicity, 000 if absent) of the characteristic polynomial of the matrix

πA(z,z′)p(z)p(z′).\frac{\pi_A(z,z')}{\sqrt{p(z)p(z')}}.p(z)p(z′)​πA​(z,z′)​.

The same construction with (q,B)(q,B)(q,B) gives βj\beta_jβj​.

badPairs. It is the finite set

{(i,j):0≤i<nZ, 0≤j<nN}∖{(0,0)}.\{(i,j):0\le i<n_Z,\ 0\le j<n_N\}\setminus\{(0,0)\}.{(i,j):0≤i<nZ​, 0≤j<nN​}∖{(0,0)}.

badEig. For (i,j)∈N2(i,j)\in\mathbb N^2(i,j)∈N2, it is αiβj\alpha_i\beta_jαi​βj​. Here α\alphaα comes from (p,A)(p,A)(p,A) and β\betaβ from (q,B)(q,B)(q,B).

xi. Take the multiset of the values αiβj\alpha_i\beta_jαi​βj​ over (i,j)∈(i,j)\in(i,j)∈ badPairs(∣Z∣,∣N∣)(|Z|,|N|)(∣Z∣,∣N∣) and sort it in non-increasing order. Then ξl\xi_lξl​ is the entry at position l−1l-1l−1, counting from 000, and ξl=0\xi_l=0ξl​=0 if that position does not exist.

  • Because 0−1=00-1=00−1=0, ξ0=ξ1\xi_0=\xi_1ξ0​=ξ1​.

nuisanceCount. rrr is the number of pairs (i,j)∈(i,j)\in(i,j)∈ badPairs(∣Z∣,∣N∣)(|Z|,|N|)(∣Z∣,∣N∣) with j≥1j\ge1j≥1 and αiβj≥ξk\alpha_i\beta_j\ge\xi_kαi​βj​≥ξk​.

  • With ties at ξk\xi_kξk​, this can count pairs beyond the first kkk.
  • For k=0k=0k=0 the threshold is ξ1\xi_1ξ1​.
  • If kkk exceeds the number of pairs, the threshold is 000.

inducedKernel. For s:X→Zs:X\to Zs:X→Z and W:X×X→RW:X\times X\to\mathbb{R}W:X×X→R, it is

πW(z,z′)=∑x: s(x)=z ∑x′: s(x′)=z′W(x,x′).\pi_W(z,z')=\sum_{x:\,s(x)=z}\ \sum_{x':\,s(x')=z'}W(x,x').πW​(z,z′)=x:s(x)=z∑​ x′:s(x′)=z′∑​W(x,x′).

condExpMat. It is the X×XX\times XX×X matrix

P(x,x′)=ω(x′)m(s(x))  if s(x′)=s(x),P(x,x′)=0  otherwise,P(x,x')=\frac{\omega(x')}{m(s(x))}\ \text{ if } s(x')=s(x),\qquad P(x,x')=0\ \text{ otherwise},P(x,x′)=m(s(x))ω(x′)​  if s(x′)=s(x),P(x,x′)=0  otherwise,

with mmm the state marginal as in stateMarg. The entry is 000 if m(s(x))=0m(s(x))=0m(s(x))=0.

l2Inner. It is ⟨h,h′⟩ω=∑xω(x)h(x)h′(x)\langle h,h'\rangle_\omega=\sum_x\omega(x)h(x)h'(x)⟨h,h′⟩ω​=∑x​ω(x)h(x)h′(x). It need not be positive definite when ω\omegaω has signs.

nuisanceTop. η\etaη is the supremum in R∪{±∞}\mathbb{R}\cup\{\pm\infty\}R∪{±∞} of

⟨h, TWh⟩ω\langle h,\ T_Wh\rangle_\omega⟨h, TW​h⟩ω​

over all h:X→Rh:X\to\mathbb{R}h:X→R with Ph=0Ph=0Ph=0 and ⟨h,h⟩ω=1\langle h,h\rangle_\omega=1⟨h,h⟩ω​=1. Here TW(x,x′)=W(x,x′)/ω(x)T_W(x,x')=W(x,x')/\omega(x)TW​(x,x′)=W(x,x′)/ω(x) (markovOp with p=ωp=\omegap=ω) and PPP is condExpMat.

  • η=−∞\eta=-\inftyη=−∞ if no such hhh exists.
  • η=+∞\eta=+\inftyη=+∞ if the values are unbounded above.

mixOp. It is the matrix product (I−P) TW P(I-P)\,T_W\,P(I−P)TW​P.

opNormL2. For an X×XX\times XX×X matrix MMM, it is the real supremum of ⟨Mh,Mh⟩ω\sqrt{\langle Mh,Mh\rangle_\omega}⟨Mh,Mh⟩ω​​ over all hhh with ⟨h,h⟩ω≤1\langle h,h\rangle_\omega\le1⟨h,h⟩ω​≤1.

  • If this set of values is unbounded, the real supremum convention returns 000. This can happen, e.g., when some ω(x)≤0\omega(x)\le0ω(x)≤0.

hsNormL2. It is

(∑x,x′ω(x) M(x,x′)2ω(x′))1/2.\Big(\sum_{x,x'}\frac{\omega(x)\,M(x,x')^2}{\omega(x')}\Big)^{1/2}.(x,x′∑​ω(x′)ω(x)M(x,x′)2​)1/2.

Terms with ω(x′)=0\omega(x')=0ω(x′)=0 contribute 000.

mixNorm. ε\varepsilonε is opNormL2 of (I−P)TWP(I-P)T_WP(I−P)TW​P.

mixHSNorm. εHS\varepsilon^{\rm HS}εHS is hsNormL2 of (I−P)TWP(I-P)T_WP(I−P)TW​P.

worldGap. The extended real

δ=μk−max⁡(μk+1ext,η).\delta=\mu_k-\max(\mu^{\rm ext}_{k+1},\eta).δ=μk​−max(μk+1ext​,η).
  • The μ\muμ's are eigenvalues of the matrix πW(z,z′)/m(z)m(z′)\pi_W(z,z')/\sqrt{m(z)m(z')}πW​(z,z′)/m(z)m(z′)​, built from πW\pi_WπW​ (inducedKernel) and mmm (stateMarg).
  • The first term is the plain eigs value: it is never −∞-\infty−∞, and it is the junk 000 if kkk is at least the number of real roots.
  • The second term uses extEig, so μk+1ext=−∞\mu^{\rm ext}_{k+1}=-\inftyμk+1ext​=−∞ when k+1≥∣Z∣k+1\ge|Z|k+1≥∣Z∣.
  • η\etaη is nuisanceTop.
  • Subtraction is in the extended reals: δ=+∞\delta=+\inftyδ=+∞ if the max is −∞-\infty−∞, and δ=−∞\delta=-\inftyδ=−∞ if η=+∞\eta=+\inftyη=+∞.

tau. It is 000 if δ=+∞\delta=+\inftyδ=+∞. Otherwise it is

22δmin⁡(k ε, 2 εHS),\frac{2\sqrt2}{\delta}\min\big(\sqrt k\,\varepsilon,\ \sqrt2\,\varepsilon^{\rm HS}\big),δ22​​min(k​ε, 2​εHS),

where δ\deltaδ is converted to a real. If δ=−∞\delta=-\inftyδ=−∞ it converts to 000, and if δ=0\delta=0δ=0, then τ=0\tau=0τ=0 by division by zero.

IsPairedCoupling. For finite X1,X2X_1,X_2X1​,X2​, ωm:Xm→R\omega_m:X_m\to\mathbb{R}ωm​:Xm​→R, sm:Xm→Zs_m:X_m\to Zsm​:Xm​→Z, and γ:X1×X2→R\gamma:X_1\times X_2\to\mathbb{R}γ:X1​×X2​→R, the predicate holds exactly when:

  • γ≥0\gamma\ge0γ≥0;
  • ∑x2γ(x1,x2)=ω1(x1)\sum_{x_2}\gamma(x_1,x_2)=\omega_1(x_1)∑x2​​γ(x1​,x2​)=ω1​(x1​) for every x1x_1x1​;
  • ∑x1γ(x1,x2)=ω2(x2)\sum_{x_1}\gamma(x_1,x_2)=\omega_2(x_2)∑x1​​γ(x1​,x2​)=ω2​(x2​) for every x2x_2x2​;
  • γ(x1,x2)≠0\gamma(x_1,x_2)\neq0γ(x1​,x2​)=0 implies s1(x1)=s2(x2)s_1(x_1)=s_2(x_2)s1​(x1​)=s2​(x2​).

No condition on ωm\omega_mωm​ itself is imposed beyond what these force.

pairedRMS. It is

(∑x1,x2γ(x1,x2) ∥f1(x1)−Qf2(x2)∥2)1/2\Big(\sum_{x_1,x_2}\gamma(x_1,x_2)\,\|f_1(x_1)-Qf_2(x_2)\|^2\Big)^{1/2}(x1​,x2​∑​γ(x1​,x2​)∥f1​(x1​)−Qf2​(x2​)∥2)1/2

for orthogonal QQQ, with value 000 if the sum is negative.

mergeWeights. For c:X→Yc:X\to Yc:X→Y, it is ω′(y)=∑x: c(x)=yω(x)\omega'(y)=\sum_{x:\,c(x)=y}\omega(x)ω′(y)=∑x:c(x)=y​ω(x).

mergeLaw. It is

W′(y,y′)=∑x: c(x)=y ∑x′: c(x′)=y′W(x,x′).W'(y,y')=\sum_{x:\,c(x)=y}\ \sum_{x':\,c(x')=y'}W(x,x').W′(y,y′)=x:c(x)=y∑​ x′:c(x′)=y′∑​W(x,x′).

ntpAntiCollapse. For finite VVV, w:V→Rkw:V\to\mathbb{R}^kw:V→Rk, and h∈Rkh\in\mathbb{R}^kh∈Rk, it is

A(h)=log⁡∑ve⟨h,wv⟩,A(h)=\log\sum_{v}e^{\langle h,w_v\rangle},A(h)=logv∑​e⟨h,wv​⟩,

with the standard dot product. It equals 000 if V=∅V=\emptysetV=∅.

ntpLoss. It is

−log⁡e⟨h,wy⟩∑ve⟨h,wv⟩.-\log\frac{e^{\langle h,w_y\rangle}}{\sum_v e^{\langle h,w_v\rangle}}.−log∑v​e⟨h,wv​⟩e⟨h,wy​⟩​.

This always equals A(h)−⟨h,wy⟩A(h)-\langle h,w_y\rangleA(h)−⟨h,wy​⟩, since the denominator is positive because y∈Vy\in Vy∈V.

ntpRisk. For finite CCC and VVV, P:C→RP:C\to\mathbb{R}P:C→R, cond:C×V→R\mathrm{cond}:C\times V\to\mathbb{R}cond:C×V→R, h:C→Rkh:C\to\mathbb{R}^kh:C→Rk, and www, it is

∑cP(c)∑vcond(c,v)⋅ntpLoss(w,h(c),v).\sum_cP(c)\sum_v\mathrm{cond}(c,v)\cdot\mathrm{ntpLoss}(w,h(c),v).c∑​P(c)v∑​cond(c,v)⋅ntpLoss(w,h(c),v).

PPP and cond\mathrm{cond}cond are not required to be probabilities.

popMean. It is xˉ=1N∑i<Nxi\bar x=\frac1N\sum_{i<N}x_ixˉ=N1​∑i<N​xi​, which is 000 when N=0N=0N=0.

subMean. For S⊆{0,…,N−1}S\subseteq\{0,\dots,N-1\}S⊆{0,…,N−1}, it is xˉS=1∣S∣∑i∈Sxi\bar x_S=\frac1{|S|}\sum_{i\in S}x_ixˉS​=∣S∣1​∑i∈S​xi​, which is 000 when S=∅S=\emptysetS=∅.

sampleVar. It is

s2=∑i(xi−xˉ)2N−1,s^2=\frac{\sum_i(x_i-\bar x)^2}{N-1},s2=N−1∑i​(xi​−xˉ)2​,

with the denominator computed as a real. It is 000 for N=1N=1N=1 (division by zero) and 000 for N=0N=0N=0 (empty sum).

subsampleSpread. It is

((Nn)−1∑S⊆{0..N−1}, ∣S∣=n(xˉS−xˉ)2)1/2.\Big(\binom Nn^{-1}\sum_{S\subseteq\{0..N-1\},\,|S|=n}(\bar x_S-\bar x)^2\Big)^{1/2}.((nN​)−1S⊆{0..N−1},∣S∣=n∑​(xˉS​−xˉ)2)1/2.
  • If n>Nn>Nn>N there are no such SSS and (Nn)=0\binom Nn=0(nN​)=0, so the value is 000.
  • If n=0n=0n=0 the only SSS is ∅\emptyset∅ with xˉ∅=0\bar x_\emptyset=0xˉ∅​=0, so the value is ∣xˉ∣|\bar x|∣xˉ∣.
Human review
  • Endorsed by Shuze Chen · Nov 25, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 25, 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