Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Action-conditioned co-occurrence model, JEPA and spectral JEPA risks, planning regret and finite-sample objects

Definition
JEPAGeneralization_Basic

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

jepamatrix-factorizationrademacher-complexityspectral-graph-theoryworld-models

Objects of Section 3 and Appendix A.1 of Cui, Zhang, Wen, Cheng and Wang (2026).

  1. Observations, actions, embeddings. The observation space is a finite set X\mathcal XX and A\mathcal AA is a set of actions. An encoder is a map f:X→Rkf:\mathcal X\to\mathbb R^kf:X→Rk and a predictor is a map g:Rk×A→Rkg:\mathbb R^k\times\mathcal A\to\mathbb R^kg:Rk×A→Rk. We write u⊤v=∑iuiviu^\top v=\sum_i u_iv_iu⊤v=∑i​ui​vi​ and ∥v∥2=∑ivi2\|v\|^2=\sum_i v_i^2∥v∥2=∑i​vi2​.
  2. Co-occurrence model (Section 3.1). For each action aaa, w(x,x+,a)=P(x,x+∣a)≥0w(x,x^+,a)=\mathrm P(x,x^+\mid a)\ge0w(x,x+,a)=P(x,x+∣a)≥0 is the joint law of a current observation x∼PXx\sim\mathrm P_Xx∼PX​ and the next observation x+∼P(⋅∣x,a)x^+\sim\mathrm P(\cdot\mid x,a)x+∼P(⋅∣x,a). Hence ∑x+w(x,x+,a)=w(x)=PX(x)\sum_{x^+}w(x,x^+,a)=w(x)=\mathrm P_X(x)∑x+​w(x,x+,a)=w(x)=PX​(x) for every aaa, with ∑xw(x)=1\sum_xw(x)=1∑x​w(x)=1. The second marginal is w(x+∣a)=∑xw(x,x+,a)w(x^+\mid a)=\sum_xw(x,x^+,a)w(x+∣a)=∑x​w(x,x+,a) and the transition probability is P(x+∣x,a)=w(x,x+,a)/w(x)\mathrm P(x^+\mid x,a)=w(x,x^+,a)/w(x)P(x+∣x,a)=w(x,x+,a)/w(x). Both marginals are required to be positive.
  3. Co-occurrence matrices. M(a)=(w(x,x+,a))x,x+M(a)=(w(x,x^+,a))_{x,x^+}M(a)=(w(x,x+,a))x,x+​, and Mˉ(a)=D−1/2M(a)D+(a)−1/2\bar M(a)=D^{-1/2}M(a)D_+(a)^{-1/2}Mˉ(a)=D−1/2M(a)D+​(a)−1/2 with D=diag(w(x))D=\mathrm{diag}(w(x))D=diag(w(x)) and D+(a)=diag(w(x+∣a))D_+(a)=\mathrm{diag}(w(x^+\mid a))D+​(a)=diag(w(x+∣a)), that is Mˉ(a)x,x+=w(x,x+,a)/w(x)w(x+∣a)\bar M(a)_{x,x^+}=w(x,x^+,a)/\sqrt{w(x)w(x^+\mid a)}Mˉ(a)x,x+​=w(x,x+,a)/w(x)w(x+∣a)​. Its singular values are σ1(a)≥σ2(a)≥⋯≥σ∣X∣(a)≥0\sigma_1(a)\ge\sigma_2(a)\ge\dots\ge\sigma_{|\mathcal X|}(a)\ge0σ1​(a)≥σ2​(a)≥⋯≥σ∣X∣​(a)≥0, the square roots of the eigenvalues of Mˉ(a)⊤Mˉ(a)\bar M(a)^\top\bar M(a)Mˉ(a)⊤Mˉ(a), counted with multiplicity.
  4. Risks (eq. 3 and Theorem 3.1). The JEPA risk is
RJEPA(f,g,a)=∑x,x+w(x,x+,a) ∥g(f(x),a)−f(x+)∥2+∑x,x′w(x) w(x′∣a) [g(f(x),a)⊤f(x′)]2.\mathcal R_{\mathrm{JEPA}}(f,g,a)=\sum_{x,x^+}w(x,x^+,a)\,\|g(f(x),a)-f(x^+)\|^2+\sum_{x,x'}w(x)\,w(x'\mid a)\,\big[g(f(x),a)^\top f(x')\big]^2.RJEPA​(f,g,a)=x,x+∑​w(x,x+,a)∥g(f(x),a)−f(x+)∥2+x,x′∑​w(x)w(x′∣a)[g(f(x),a)⊤f(x′)]2.

With F=[w(x∣a) f(x)]x∈XF=[\sqrt{w(x\mid a)}\,f(x)]_{x\in\mathcal X}F=[w(x∣a)​f(x)]x∈X​ and G(F,a)=[w(x) g(f(x),a)]x∈XG(F,a)=[\sqrt{w(x)}\,g(f(x),a)]_{x\in\mathcal X}G(F,a)=[w(x)​g(f(x),a)]x∈X​ (two k×∣X∣k\times|\mathcal X|k×∣X∣ matrices), the spectral JEPA risk is RS-JEPA(f,g,a)=∥Mˉ(a)−G(F,a)⊤F∥F2\mathcal R_{\mathrm{S\text{-}JEPA}}(f,g,a)=\|\bar M(a)-G(F,a)^\top F\|_F^2RS-JEPA​(f,g,a)=∥Mˉ(a)−G(F,a)⊤F∥F2​. The pair (f,g)(f,g)(f,g) is normalized at aaa if ∥f(x)∥=∥g(f(x),a)∥=1\|f(x)\|=\|g(f(x),a)\|=1∥f(x)∥=∥g(f(x),a)∥=1 for all xxx. The spectral loss is E[(g(f(z),a)⊤f(z′))2−2g(f(z),a)⊤f(z+)]\mathbb E\big[(g(f(z),a)^\top f(z'))^2-2g(f(z),a)^\top f(z^+)\big]E[(g(f(z),a)⊤f(z′))2−2g(f(z),a)⊤f(z+)] with z∼PXz\sim\mathrm P_Xz∼PX​, z+∼P(⋅∣z,a)z^+\sim\mathrm P(\cdot\mid z,a)z+∼P(⋅∣z,a) and an independent z′∼w(⋅∣a)z'\sim w(\cdot\mid a)z′∼w(⋅∣a). 5. Single-step planning (Sections 3.2–3.3, T=1T=1T=1). The planning loss is Lplan(a;f,g,x0,xg)=∥g(f(x0),a)−f(xg)∥2\mathcal L_{\mathrm{plan}}(a;f,g,x_0,x_g)=\|g(f(x_0),a)-f(x_g)\|^2Lplan​(a;f,g,x0​,xg​)=∥g(f(x0​),a)−f(xg​)∥2, the value is V(a)=w(x0,xg,a)/w(x0)V(a)=w(x_0,x_g,a)/w(x_0)V(a)=w(x0​,xg​,a)/w(x0​) and the regret is r(a)=max⁡a′V(a′)−V(a)r(a)=\max_{a'}V(a')-V(a)r(a)=maxa′​V(a′)−V(a). For a law ρ\rhoρ of (x0,xg)(x_0,x_g)(x0​,xg​) and an action rule a~(x0,xg)\tilde a(x_0,x_g)a~(x0​,xg​), E(a~)=E(x0,xg)∼ρ r(a~(x0,xg))\mathcal E(\tilde a)=\mathbb E_{(x_0,x_g)\sim\rho}\,r(\tilde a(x_0,x_g))E(a~)=E(x0​,xg​)∼ρ​r(a~(x0​,xg​)) and c0=E(x0,xg)∼ρmax⁡aw(xg∣a)/w(x0)c_0=\mathbb E_{(x_0,x_g)\sim\rho}\sqrt{\max_aw(x_g\mid a)/w(x_0)}c0​=E(x0​,xg​)∼ρ​maxa​w(xg​∣a)/w(x0​)​. 6. Finite-sample objects (Appendix A.1). For a dataset x1,…,xnx_1,\dots,x_nx1​,…,xn​ (probability ∏iPX(xi)\prod_i\mathrm P_X(x_i)∏i​PX​(xi​)), R^n\hat{\mathcal R}_nR^n​ is the empirical JEPA risk of Definition A.1, with the uniform law on the dataset and the uniform law on ordered pairs (xi,xj)(x_i,x_j)(xi​,xj​), i≠ji\ne ji=j. For n=2mn=2mn=2m, Definition A.3 draws a uniform permutation π\piπ and sets zi=xπ(2i−1)z_i=x_{\pi(2i-1)}zi​=xπ(2i−1)​, zi+∼P(⋅∣zi,a)z_i^+\sim\mathrm P(\cdot\mid z_i,a)zi+​∼P(⋅∣zi​,a) and zi′∼P(⋅∣xπ(2i),a)z_i'\sim\mathrm P(\cdot\mid x_{\pi(2i)},a)zi′​∼P(⋅∣xπ(2i)​,a). The tuple risk is R^S=1m∑i≤m[(g(f(zi),a)⊤f(zi′))2−2g(f(zi),a)⊤f(zi+)]\hat{\mathcal R}_S=\frac1m\sum_{i\le m}\big[(g(f(z_i),a)^\top f(z_i'))^2-2g(f(z_i),a)^\top f(z_i^+)\big]R^S​=m1​∑i≤m​[(g(f(zi​),a)⊤f(zi′​))2−2g(f(zi​),a)⊤f(zi+​)]. Unconditionally the mmm tuples are i.i.d. with law w(z,z+,a) w(z′∣a)w(z,z^+,a)\,w(z'\mid a)w(z,z+,a)w(z′∣a). 7. Rademacher complexities (Theorem 4.4). For a class Φ\PhiΦ of real functions on X\mathcal XX, the worst-case Rademacher complexity is max⁡z1,…,zmEσsup⁡φ∈Φ1m∑iσiφ(zi)\max_{z_1,\dots,z_m}\mathbb E_\sigma\sup_{\varphi\in\Phi}\frac1m\sum_i\sigma_i\varphi(z_i)maxz1​,…,zm​​Eσ​supφ∈Φ​m1​∑i​σi​φ(zi​), with σi\sigma_iσi​ i.i.d. uniform signs. Rm(F)\mathfrak R_m(\mathcal F)Rm​(F) is its maximum over coordinates ℓ\ellℓ of the classes {fℓ:f∈F}\{f_\ell:f\in\mathcal F\}{fℓ​:f∈F}, and Rm(G∘F)\mathfrak R_m(\mathcal G\circ\mathcal F)Rm​(G∘F) is its maximum over coordinates ℓ\ellℓ of the classes {x↦g(f(x),a)ℓ:f∈F,g∈G}\{x\mapsto g(f(x),a)_\ell:f\in\mathcal F,g\in\mathcal G\}{x↦g(f(x),a)ℓ​:f∈F,g∈G}.

Formalization Note The singular values are the square roots of the roots of the characteristic polynomial of Mˉ(a)⊤Mˉ(a)\bar M(a)^\top\bar M(a)Mˉ(a)⊤Mˉ(a), sorted in decreasing order and zero-indexed, so the Lean singVal i is σi+1\sigma_{i+1}σi+1​. All expectations over finite sets are written as exact finite sums. The paper does not specify the law of (x0,xg)(x_0,x_g)(x0​,xg​), so it is a parameter ρ\rhoρ. Suprema over a class use Lean's real supremum; every class used is nonempty and bounded.

Definition code
import Mathlib

/-!
Cui, Zhang, Wen, Cheng and Wang, *A Generalization Theory for JEPA-Based World Models*,
arXiv:2606.27014v2 (2026): the action-conditioned co-occurrence model, the JEPA and spectral
JEPA risks, single-step planning and regret, the singular values of the normalized co-occurrence
matrix, and the finite-sample objects (sampled tuples, empirical risks, Rademacher complexities)
of Section 3 and Appendix A.1.

The observation space is a finite type `X` (the paper indexes the co-occurrence matrix by
observations and writes all expectations as finite sums), latent embeddings are vectors
`Fin k → ℝ`, an encoder is `f : X → Fin k → ℝ` and a predictor is
`g : (Fin k → ℝ) → A → Fin k → ℝ`.
-/

noncomputable section

namespace JEPAGeneralization

variable {X A : Type*} [Fintype X] {k : ℕ}

/-- Euclidean inner product `uᵀv` of two latent vectors in `ℝ^k`. -/
def dot (u v : Fin k → ℝ) : ℝ := ∑ i, u i * v i

/-- Squared Euclidean norm `‖v‖²` of a latent vector in `ℝ^k`. -/
def sqNorm (v : Fin k → ℝ) : ℝ := ∑ i, v i ^ 2

/-- Section 3.1, p. 4: `w(x, x⁺, a) = P(x, x⁺ | a) ≥ 0` is the joint law of a current and a next
observation given the action `a`, with `x ∼ P_X` for every action, so that the first marginal
`w(x) = ∑_{x⁺} w(x, x⁺, a)` equals `P_X(x)` and does not depend on `a`. The normalization
`D^{-1/2} M(a) D_+(a)^{-1/2}` requires the marginals `w(x)` and `w(x⁺ | a)` to be positive;
this is written in. -/
def IsCoOccurrence (pX : X → ℝ) (w : X → X → A → ℝ) : Prop :=
  (∀ x x' a, 0 ≤ w x x' a) ∧ (∑ x, pX x = 1) ∧ (∀ x, 0 < pX x) ∧
    (∀ x a, ∑ x', w x x' a = pX x) ∧ (∀ x' a, 0 < ∑ x, w x x' a)

/-- Section 3.1, p. 4: the second marginal `w(x⁺ | a) = ∑_x w(x, x⁺, a) = P_{X|a}(x⁺)`. -/
def nextMarg (w : X → X → A → ℝ) (a : A) (x' : X) : ℝ := ∑ x, w x x' a

/-- Section 3.1–3.3: the transition probability `P(x⁺ | x, a) = w(x, x⁺, a) / w(x)`. -/
def transProb (pX : X → ℝ) (w : X → X → A → ℝ) (a : A) (x x' : X) : ℝ := w x x' a / pX x

/-- Section 3.1, eq. (5), p. 4: the conditional co-occurrence matrix
`M(a) = (w(x, x⁺, a))_{x, x⁺}`. -/
def coOccMat (w : X → X → A → ℝ) (a : A) : Matrix X X ℝ := fun x x' => w x x' a

/-- Section 3.1, p. 4: the normalized co-occurrence matrix `M̄(a) = D^{-1/2} M(a) D_+(a)^{-1/2}`
with `D = diag(w(x))` and `D_+(a) = diag(w(x⁺ | a))`, written entrywise as
`w(x, x⁺, a) / √(w(x) w(x⁺ | a))`. -/
def normCoOcc (pX : X → ℝ) (w : X → X → A → ℝ) (a : A) : Matrix X X ℝ :=
  fun x x' => coOccMat w a x x' / Real.sqrt (pX x * nextMarg w a x')

/-- Section 3.1, eq. (3), p. 3: the population JEPA risk
`R_JEPA(f, g, a) = E_{x∼P_X} E_{x⁺∼P(·|x,a)} ‖g(f(x), a) − f(x⁺)‖²
  + E_{x∼P_X, x'∼P_{X|a}} [g(f(x), a)ᵀ f(x')]²`, written as finite sums. -/
def jepaRisk (pX : X → ℝ) (w : X → X → A → ℝ) (f : X → Fin k → ℝ)
    (g : (Fin k → ℝ) → A → Fin k → ℝ) (a : A) : ℝ :=
  (∑ x, ∑ x', w x x' a * sqNorm (g (f x) a - f x')) +
    ∑ x, ∑ x', pX x * nextMarg w a x' * dot (g (f x) a) (f x') ^ 2

/-- Theorem 3.1, p. 4: the `k × |X|` matrix `F = [√(w(x | a)) f(x)]_{x ∈ X}`. -/
def encMat (w : X → X → A → ℝ) (f : X → Fin k → ℝ) (a : A) : Matrix (Fin k) X ℝ :=
  fun i x => Real.sqrt (nextMarg w a x) * f x i

/-- Theorem 3.1, p. 4: the `k × |X|` matrix `G(F, a) = [√(w(x)) g(f(x), a)]_{x ∈ X}`. -/
def predMat (pX : X → ℝ) (f : X → Fin k → ℝ) (g : (Fin k → ℝ) → A → Fin k → ℝ) (a : A) :
    Matrix (Fin k) X ℝ :=
  fun i x => Real.sqrt (pX x) * g (f x) a i

/-- The squared Frobenius norm `‖B‖_F² = ∑_{x, x'} B_{x x'}²` of a real `X × X` matrix. -/
def frobSq (B : Matrix X X ℝ) : ℝ := ∑ x, ∑ x', B x x' ^ 2

/-- Section 3.1, p. 4 (after Theorem 3.1): the spectral JEPA (matrix factorization) risk
`R_{S-JEPA}(f, g, a) = ‖M̄(a) − G(F, a)ᵀ F‖_F²`. -/
def sJepaRisk (pX : X → ℝ) (w : X → X → A → ℝ) (f : X → Fin k → ℝ)
    (g : (Fin k → ℝ) → A → Fin k → ℝ) (a : A) : ℝ :=
  frobSq (normCoOcc pX w a - (predMat pX f g a).transpose * encMat w f a)

/-- Theorem 3.1, p. 4: the embeddings `f(x)` and `g(f(x), a)` are normalized,
`‖f(x)‖ = ‖g(f(x), a)‖ = 1` for every observation `x`. -/
def IsNormalized (f : X → Fin k → ℝ) (g : (Fin k → ℝ) → A → Fin k → ℝ) (a : A) : Prop :=
  ∀ x, sqNorm (f x) = 1 ∧ sqNorm (g (f x) a) = 1

/-- The squared singular values `σ₁(a)² ≥ σ₂(a)² ≥ …` of `M̄(a)` with multiplicity: the
eigenvalues of `M̄(a)ᵀ M̄(a)`, i.e. the roots of its characteristic polynomial, sorted in
decreasing order (a list of length `|X|`). -/
def sqSingVals [DecidableEq X] (pX : X → ℝ) (w : X → X → A → ℝ) (a : A) : List ℝ :=
  ((normCoOcc pX w a).transpose * normCoOcc pX w a).charpoly.roots.sort (· ≥ ·)

/-- Theorem 4.3, p. 6: the singular values of `M̄(a)` in decreasing order, zero-indexed:
`singVal pX w a i = σ_{i+1}(a)` for `i < |X|` (and `0` for `i ≥ |X|`, never used). -/
def singVal [DecidableEq X] (pX : X → ℝ) (w : X → X → A → ℝ) (a : A) (i : ℕ) : ℝ :=
  Real.sqrt ((sqSingVals pX w a).getD i 0)

/-- Section 3.2, eq. (8), p. 4, for `T = 1`: the planning loss
`L_plan(a; f, g, x₀, x_g) = ‖g(f(x₀), a) − f(x_g)‖²`. -/
def planLoss1 (f : X → Fin k → ℝ) (g : (Fin k → ℝ) → A → Fin k → ℝ) (a : A) (x0 xg : X) : ℝ :=
  sqNorm (g (f x0) a - f xg)

/-- Section 3.3, eq. (10), p. 5, for `T = 1`: the value
`V(a) = P(x̂₁ = x_g | x₀, a) = w(x₀, x_g, a) / w(x₀)` of action `a` from `x₀` to the goal `x_g`. -/
def value1 (pX : X → ℝ) (w : X → X → A → ℝ) (a : A) (x0 xg : X) : ℝ := w x0 xg a / pX x0

/-- Section 3.3, eq. (11), p. 5, for `T = 1`: the pointwise regret
`r(a; x₀, x_g) = V(a**) − V(a)` with `V(a**) = max_{a'} V(a')`. -/
def regret1 (pX : X → ℝ) (w : X → X → A → ℝ) (a : A) (x0 xg : X) : ℝ :=
  (⨆ a' : A, value1 pX w a' x0 xg) - value1 pX w a x0 xg

/-- A probability law `ρ` of the pair `(x₀, x_g)` of initial and goal observations, with respect
to which `E_{x₀, x_g}` is taken in Section 3.3 (the paper does not specify it). -/
def IsPairDist (ρ : X → X → ℝ) : Prop :=
  (∀ x0 xg, 0 ≤ ρ x0 xg) ∧ ∑ x0, ∑ xg, ρ x0 xg = 1

/-- Section 3.3, eq. (12), p. 5, for `T = 1`: the expected planning regret
`E(ã) = E_{x₀, x_g} r(ã(x₀, x_g); x₀, x_g)` of an action rule `ã`, which may depend on
`(x₀, x_g)`. -/
def expRegret1 (pX : X → ℝ) (w : X → X → A → ℝ) (ρ : X → X → ℝ) (act : X → X → A) : ℝ :=
  ∑ x0, ∑ xg, ρ x0 xg * regret1 pX w (act x0 xg) x0 xg

/-- Theorem 4.1, p. 5: the constant `c₀ = E_{x₀, x_g} √(max_a w(x_g | a) / w(x₀))`. -/
def cZero (pX : X → ℝ) (w : X → X → A → ℝ) (ρ : X → X → ℝ) : ℝ :=
  ∑ x0, ∑ xg, ρ x0 xg * Real.sqrt ((⨆ a : A, nextMarg w a xg) / pX x0)

/-- Proof of Theorem 4.4, p. 15: the population spectral loss
`E[(g(f(z), a)ᵀ f(z'))² − 2 g(f(z), a)ᵀ f(z⁺)]` with `z ∼ P_X`, `z⁺ ∼ P(·|z, a)` and
`z' ∼ P_{X|a}` independent of `(z, z⁺)`; the quantity `R(f, g, a)` of Lemma A.2. -/
def spectralLoss (pX : X → ℝ) (w : X → X → A → ℝ) (f : X → Fin k → ℝ)
    (g : (Fin k → ℝ) → A → Fin k → ℝ) (a : A) : ℝ :=
  (∑ x, ∑ x', pX x * nextMarg w a x' * dot (g (f x) a) (f x') ^ 2) -
    2 * ∑ x, ∑ x', w x x' a * dot (g (f x) a) (f x')

/-- Definition A.1, eq. (26), p. 12: the empirical JEPA risk of a dataset `x₁, …, xₙ`,
`R̂ₙ(f, g, a) = −2 E_{x∼P̂_X, x⁺∼P(·|x,a)} [g(f(x), a)ᵀ f(x⁺)]
  + E_{(x, x⁻)∼P̂_{x,x⁻}, x'∼P(·|x⁻,a)} [g(f(x), a)ᵀ f(x')]²`, where `P̂_X` is uniform on the
dataset and `P̂_{x,x⁻}` is uniform on the ordered pairs `(xᵢ, xⱼ)`, `i ≠ j`. The expectations over
`x⁺` and `x'` are exact sums against the transition probabilities. -/
def empRiskN (pX : X → ℝ) (w : X → X → A → ℝ) (f : X → Fin k → ℝ)
    (g : (Fin k → ℝ) → A → Fin k → ℝ) (a : A) {n : ℕ} (D : Fin n → X) : ℝ :=
  -2 * ((1 / (n : ℝ)) * ∑ i, ∑ x', transProb pX w a (D i) x' * dot (g (f (D i)) a) (f x')) +
    (1 / ((n : ℝ) * ((n : ℝ) - 1))) * ∑ i, ∑ j,
      (if i = j then 0 else
        ∑ x', transProb pX w a (D j) x' * dot (g (f (D i)) a) (f x') ^ 2)

/-- Definition A.1, p. 12: the probability `∏ᵢ P_X(xᵢ)` of a dataset `x₁, …, xₙ` drawn i.i.d.
from `P_X`. -/
def datasetProb (pX : X → ℝ) {n : ℕ} (D : Fin n → X) : ℝ := ∏ i, pX (D i)

/-- Definition A.3, eq. (29), p. 12: the tuple loss
`(g(f(z), a)ᵀ f(z'))² − 2 g(f(z), a)ᵀ f(z⁺)` of a tuple `t = (z, z⁺, z')`. -/
def tupleLoss (f : X → Fin k → ℝ) (g : (Fin k → ℝ) → A → Fin k → ℝ) (a : A)
    (t : X × X × X) : ℝ :=
  dot (g (f t.1) a) (f t.2.2) ^ 2 - 2 * dot (g (f t.1) a) (f t.2.1)

/-- Definition A.3, eq. (29), p. 12: the tuple risk
`R̂_S(f, g, a) = (1/m) ∑_{i=1}^m [(g(f(zᵢ), a)ᵀ f(zᵢ'))² − 2 g(f(zᵢ), a)ᵀ f(zᵢ⁺)]` of
`S = ((zᵢ, zᵢ⁺, zᵢ'))_{i ≤ m}`, `m = n/2`. -/
def empRiskS (f : X → Fin k → ℝ) (g : (Fin k → ℝ) → A → Fin k → ℝ) (a : A) {m : ℕ}
    (S : Fin m → X × X × X) : ℝ :=
  (1 / (m : ℝ)) * ∑ i, tupleLoss f g a (S i)

/-- Definition A.3, eq. (28), p. 12: the indices `(π(2i−1), π(2i))` (zero-indexed:
`(π(2i), π(2i+1))`) of the `i`-th pair of the permuted dataset, `i < m`, `n = 2m`. -/
def pairIdx {m : ℕ} (π : Equiv.Perm (Fin (2 * m))) (i : Fin m) : Fin (2 * m) × Fin (2 * m) :=
  (π ⟨2 * i.val, by have := i.isLt; omega⟩, π ⟨2 * i.val + 1, by have := i.isLt; omega⟩)

/-- Lemma A.4, eq. (30), p. 12: `E_S R̂_S(f, g, a)` given the dataset `x₁, …, x_{2m}`, for the
sampling of Definition A.3: a uniform permutation `π` of the indices, `zᵢ = x_{π(2i−1)}`,
`zᵢ⁺ ∼ P(·|zᵢ, a)` and `zᵢ' ∼ P(·|x_{π(2i)}, a)`, all draws independent given `π`. -/
def expEmpRiskS (pX : X → ℝ) (w : X → X → A → ℝ) (f : X → Fin k → ℝ)
    (g : (Fin k → ℝ) → A → Fin k → ℝ) (a : A) {m : ℕ} (D : Fin (2 * m) → X) : ℝ :=
  (1 / ((Nat.factorial (2 * m) : ℕ) : ℝ)) * ∑ π : Equiv.Perm (Fin (2 * m)),
    ∑ zp : Fin m → X, ∑ zq : Fin m → X,
      (∏ i, transProb pX w a (D (pairIdx π i).1) (zp i) *
          transProb pX w a (D (pairIdx π i).2) (zq i)) *
        empRiskS f g a (fun i => (D (pairIdx π i).1, zp i, zq i))

/-- Definition A.3, p. 12: the law of one sampled tuple `(z, z⁺, z')`:
`P(z, z⁺, z') = w(z, z⁺, a) · w(z' | a)`, since `z ∼ P_X`, `z⁺ ∼ P(·|z, a)` and
`z' ∼ P(·|x, a)` for an independent `x ∼ P_X`. -/
def tupleProb (w : X → X → A → ℝ) (a : A) (t : X × X × X) : ℝ :=
  w t.1 t.2.1 a * nextMarg w a t.2.2

open Classical in
/-- Definition A.3 and Theorem 4.4, p. 6: the probability of an event `E` about the sample
`S = ((zᵢ, zᵢ⁺, zᵢ'))_{i ≤ m}` of `m = n/2` tuples. The tuples of Definition A.3 come from disjoint
pairs of an i.i.d. dataset, so they are i.i.d. with law `tupleProb w a`. -/
def sampleProb (w : X → X → A → ℝ) (a : A) (m : ℕ) (E : (Fin m → X × X × X) → Prop) : ℝ :=
  ∑ S : Fin m → X × X × X, if E S then ∏ i, tupleProb w a (S i) else 0

/-- Theorem 4.4, p. 6: the empirical Rademacher average
`E_σ [sup_{φ ∈ H} (1/m) ∑_{i=1}^m σᵢ φ(zᵢ)]` of a class `H` of real functions at the points
`z₁, …, z_m`, with `σᵢ` i.i.d. uniform signs (`true ↦ +1`, `false ↦ −1`). -/
def empRad (m : ℕ) (H : Set (X → ℝ)) (z : Fin m → X) : ℝ :=
  (1 / 2 ^ m : ℝ) * ∑ σ : Fin m → Bool,
    ⨆ φ : H, (1 / (m : ℝ)) * ∑ i, (if σ i then (1 : ℝ) else -1) * φ.1 (z i)

/-- Theorem 4.4, p. 6: the worst-case Rademacher complexity `max_{z₁, …, z_m} E_σ […]` of a class
of real functions on `X`. -/
def worstRad (m : ℕ) (H : Set (X → ℝ)) : ℝ := ⨆ z : Fin m → X, empRad m H z

/-- The class `{x ↦ f(x)_ℓ : f ∈ 𝓕}` of `ℓ`-th coordinates of the encoders. -/
def encCoord (F : Set (X → Fin k → ℝ)) (l : Fin k) : Set (X → ℝ) :=
  {φ | ∃ f ∈ F, φ = fun x => f x l}

/-- Proof of Theorem 4.4, p. 15: the class `𝓗_{a,ℓ} = {x ↦ g(f(x), a)_ℓ : f ∈ 𝓕, g ∈ 𝓖}` of
`ℓ`-th coordinates of the composed predictions `h = g ∘ f ∘ a`. -/
def predCoord (F : Set (X → Fin k → ℝ)) (G : Set ((Fin k → ℝ) → A → Fin k → ℝ)) (a : A)
    (l : Fin k) : Set (X → ℝ) :=
  {φ | ∃ f ∈ F, ∃ g ∈ G, φ = fun x => g (f x) a l}

/-- Theorem 4.4, p. 6: `𝔑_m(𝓕) = max_ℓ max_{z₁, …, z_m} E_σ [sup_{f ∈ 𝓕} (1/m) ∑ᵢ σᵢ f_ℓ(zᵢ)]`. -/
def radEnc (m : ℕ) (F : Set (X → Fin k → ℝ)) : ℝ := ⨆ l : Fin k, worstRad m (encCoord F l)

/-- Proof of Theorem 4.4, pp. 15–16: the Rademacher complexity of the composed class
`𝓖 ∘ 𝓕` used in the proof, `max_ℓ max_{z₁, …, z_m} E_σ [sup_{f ∈ 𝓕, g ∈ 𝓖} (1/m) ∑ᵢ σᵢ g(f(zᵢ), a)_ℓ]`
(the coordinatewise complexity of `𝓗_a`, as `𝔑_m(𝓕)` is for `𝓕`). -/
def radPred (m : ℕ) (F : Set (X → Fin k → ℝ)) (G : Set ((Fin k → ℝ) → A → Fin k → ℝ)) (a : A) :
    ℝ :=
  ⨆ l : Fin k, worstRad m (predCoord F G a l)

end JEPAGeneralization
Source
Cui, Zhang, Wen, Cheng and Wang, A Generalization Theory for JEPA-Based World Models, arXiv:2606.27014v2 (2026), Sections 3.1-3.4 (eqs. (3), (5)-(6), (8), (10)-(12)), Section 4 (Theorems 4.1, 4.3, 4.4) and Appendix A.1 (Definitions A.1, A.3)
Read-back

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

Common setting and conventions. Throughout, XXX is a finite set of observations (possibly empty) and AAA is an arbitrary set of actions (possibly empty or infinite, with no finiteness assumed). k≥0k \ge 0k≥0 is a natural number, possibly k=0k = 0k=0, and latent vectors are elements of Rk\mathbb{R}^kRk. An encoder is any function f:X→Rkf : X \to \mathbb{R}^kf:X→Rk. A predictor is any function g:Rk×A→Rkg : \mathbb{R}^k \times A \to \mathbb{R}^kg:Rk×A→Rk; only its values g(f(x),a)g(f(x), a)g(f(x),a) on the image of fff ever enter below. The functions pX:X→Rp_X : X \to \mathbb{R}pX​:X→R, w:X×X×A→Rw : X \times X \times A \to \mathbb{R}w:X×X×A→R and ρ:X×X→R\rho : X \times X \to \mathbb{R}ρ:X×X→R are arbitrary real-valued functions in every definition unless a hypothesis is stated. The following conventions hold everywhere:

  • Division by 000 yields 000.
  • The square root of a negative number is 000.
  • A supremum sup⁡i∈Ici\sup_{i \in I} c_isupi∈I​ci​ of reals is the least upper bound of {ci}\{c_i\}{ci​} when that set is nonempty and bounded above. Otherwise (empty index set, or unbounded above) it is defined to be 000.
  • A supremum over an infinite index set need not be attained.

dot. For u,v∈Rku, v \in \mathbb{R}^ku,v∈Rk,

⟨u,v⟩=∑i=1kuivi,\langle u, v\rangle = \sum_{i=1}^{k} u_i v_i ,⟨u,v⟩=i=1∑k​ui​vi​,

which is 000 when k=0k = 0k=0.

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

∥v∥2=∑i=1kvi2,\|v\|^2 = \sum_{i=1}^k v_i^2 ,∥v∥2=i=1∑k​vi2​,

which is 000 when k=0k = 0k=0.

IsCoOccurrence. The pair (pX,w)(p_X, w)(pX​,w) is called a co-occurrence model when all five of the following hold:

  1. w(x,x′,a)≥0w(x, x', a) \ge 0w(x,x′,a)≥0 for all x,x′∈Xx, x' \in Xx,x′∈X and a∈Aa \in Aa∈A;
  2. ∑x∈XpX(x)=1\sum_{x \in X} p_X(x) = 1∑x∈X​pX​(x)=1, which in particular forces X≠∅X \neq \varnothingX=∅;
  3. pX(x)>0p_X(x) > 0pX​(x)>0 for every x∈Xx \in Xx∈X;
  4. for every x∈Xx \in Xx∈X and every a∈Aa \in Aa∈A, ∑x′∈Xw(x,x′,a)=pX(x)\sum_{x' \in X} w(x, x', a) = p_X(x)∑x′∈X​w(x,x′,a)=pX​(x);
  5. for every x′∈Xx' \in Xx′∈X and every a∈Aa \in Aa∈A, ∑x∈Xw(x,x′,a)>0\sum_{x \in X} w(x, x', a) > 0∑x∈X​w(x,x′,a)>0.

No other condition is imposed. Conditions 2 and 4 together imply ∑x,x′w(x,x′,a)=1\sum_{x, x'} w(x, x', a) = 1∑x,x′​w(x,x′,a)=1 for each aaa. If AAA is empty, conditions 1, 4 and 5 are vacuous.

nextMarg. The second marginal is

w+(x′∣a)=∑x∈Xw(x,x′,a).w_+(x' \mid a) = \sum_{x \in X} w(x, x', a).w+​(x′∣a)=x∈X∑​w(x,x′,a).

No hypothesis on www is assumed.

transProb. The transition quantity is

P(x′∣x,a)=w(x,x′,a)pX(x),P(x' \mid x, a) = \frac{w(x, x', a)}{p_X(x)} ,P(x′∣x,a)=pX​(x)w(x,x′,a)​,

which equals 000 whenever pX(x)=0p_X(x) = 0pX​(x)=0.

coOccMat. M(a)M(a)M(a) is the X×XX \times XX×X real matrix with entries M(a)x,x′=w(x,x′,a)M(a)_{x, x'} = w(x, x', a)M(a)x,x′​=w(x,x′,a).

normCoOcc. Mˉ(a)\bar M(a)Mˉ(a) is the X×XX \times XX×X matrix with entries

Mˉ(a)x,x′=w(x,x′,a)pX(x) w+(x′∣a).\bar M(a)_{x, x'} = \frac{w(x, x', a)}{\sqrt{p_X(x)\, w_+(x' \mid a)}} .Mˉ(a)x,x′​=pX​(x)w+​(x′∣a)​w(x,x′,a)​.

The square root is taken of the product. The entry is 000 if that product is ≤0\le 0≤0, by the square-root and division conventions.

jepaRisk. For an encoder fff, a predictor ggg and an action aaa,

RJEPA(f,g,a)=∑x,x′∈Xw(x,x′,a) ∥g(f(x),a)−f(x′)∥2  +  ∑x,x′∈XpX(x) w+(x′∣a) ⟨g(f(x),a),f(x′)⟩2.R_{\mathrm{JEPA}}(f, g, a) = \sum_{x, x' \in X} w(x, x', a)\, \big\|g(f(x), a) - f(x')\big\|^2 \;+\; \sum_{x, x' \in X} p_X(x)\, w_+(x' \mid a)\, \big\langle g(f(x), a), f(x')\big\rangle^2 .RJEPA​(f,g,a)=x,x′∈X∑​w(x,x′,a)​g(f(x),a)−f(x′)​2+x,x′∈X∑​pX​(x)w+​(x′∣a)⟨g(f(x),a),f(x′)⟩2.

The first sum is weighted by www itself, not by pX⋅P(⋅∣x,a)p_X \cdot P(\cdot \mid x, a)pX​⋅P(⋅∣x,a). No hypothesis on pX,w,f,gp_X, w, f, gpX​,w,f,g is assumed.

encMat. FFF is the k×Xk \times Xk×X matrix with entries

Fi,x=w+(x∣a)  f(x)i,F_{i, x} = \sqrt{w_+(x \mid a)}\; f(x)_i ,Fi,x​=w+​(x∣a)​f(x)i​,

so column xxx is w+(x∣a) f(x)\sqrt{w_+(x \mid a)}\, f(x)w+​(x∣a)​f(x). The weight is the action-dependent second marginal.

predMat. G(F,a)G(F, a)G(F,a) is the k×Xk \times Xk×X matrix with entries

Gi,x=pX(x)  g(f(x),a)i,G_{i, x} = \sqrt{p_X(x)}\; g(f(x), a)_i ,Gi,x​=pX​(x)​g(f(x),a)i​,

so column xxx is pX(x) g(f(x),a)\sqrt{p_X(x)}\, g(f(x), a)pX​(x)​g(f(x),a).

frobSq. For an X×XX \times XX×X real matrix BBB,

∥B∥F2=∑x,x′Bxx′2.\|B\|_F^2 = \sum_{x, x'} B_{x x'}^2 .∥B∥F2​=x,x′∑​Bxx′2​.

sJepaRisk. The spectral risk is

RS-JEPA(f,g,a)=∥Mˉ(a)−G(F,a)⊤F∥F2,R_{\mathrm{S\text{-}JEPA}}(f, g, a) = \big\|\bar M(a) - G(F, a)^{\top} F\big\|_F^2 ,RS-JEPA​(f,g,a)=​Mˉ(a)−G(F,a)⊤F​F2​,

where the (x,x′)(x, x')(x,x′) entry of G⊤FG^\top FG⊤F is

pX(x) w+(x′∣a) ⟨g(f(x),a),f(x′)⟩.\sqrt{p_X(x)}\,\sqrt{w_+(x' \mid a)}\,\langle g(f(x), a), f(x')\rangle .pX​(x)​w+​(x′∣a)​⟨g(f(x),a),f(x′)⟩.

No hypothesis is assumed.

IsNormalized. The condition IsNormalized(f,g,a)\mathrm{IsNormalized}(f, g, a)IsNormalized(f,g,a) means that for every x∈Xx \in Xx∈X both

∥f(x)∥2=1and∥g(f(x),a)∥2=1.\|f(x)\|^2 = 1 \quad\text{and}\quad \|g(f(x), a)\|^2 = 1 .∥f(x)∥2=1and∥g(f(x),a)∥2=1.

This is a condition at the single action aaa only. When k=0k = 0k=0 it can hold only if XXX is empty.

sqSingVals. This definition assumes decidable equality on XXX. It is the list of real roots of the characteristic polynomial of Mˉ(a)⊤Mˉ(a)\bar M(a)^\top \bar M(a)Mˉ(a)⊤Mˉ(a), counted with multiplicity and sorted in non-increasing order. Since Mˉ(a)⊤Mˉ(a)\bar M(a)^\top \bar M(a)Mˉ(a)⊤Mˉ(a) is a real symmetric positive-semidefinite ∣X∣×∣X∣|X| \times |X|∣X∣×∣X∣ matrix, these are its eigenvalues σ1(a)2≥σ2(a)2≥…\sigma_1(a)^2 \ge \sigma_2(a)^2 \ge \dotsσ1​(a)2≥σ2​(a)2≥…, a list of ∣X∣|X|∣X∣ nonnegative numbers.

singVal. For a natural-number index i≥0i \ge 0i≥0, singVal(a,i)\mathrm{singVal}(a, i)singVal(a,i) is the square root of the (i+1)(i+1)(i+1)-th entry of that list. The indexing is zero-based, so index 000 gives the largest value σ1(a)\sigma_1(a)σ1​(a). For i≥∣X∣i \ge |X|i≥∣X∣ the value is 0=0\sqrt{0} = 00​=0.

planLoss1. For an action aaa, an initial observation x0x_0x0​ and a goal xgx_gxg​,

Lplan(a;x0,xg)=∥g(f(x0),a)−f(xg)∥2.L_{\mathrm{plan}}(a; x_0, x_g) = \big\|g(f(x_0), a) - f(x_g)\big\|^2 .Lplan​(a;x0​,xg​)=​g(f(x0​),a)−f(xg​)​2.

value1. The value of an action is

V(a;x0,xg)=w(x0,xg,a)pX(x0),V(a; x_0, x_g) = \frac{w(x_0, x_g, a)}{p_X(x_0)} ,V(a;x0​,xg​)=pX​(x0​)w(x0​,xg​,a)​,

which is 000 if pX(x0)=0p_X(x_0) = 0pX​(x0​)=0.

regret1. The regret is

r(a;x0,xg)=(sup⁡a′∈AV(a′;x0,xg))−V(a;x0,xg).r(a; x_0, x_g) = \Big(\sup_{a' \in A} V(a'; x_0, x_g)\Big) - V(a; x_0, x_g) .r(a;x0​,xg​)=(a′∈Asup​V(a′;x0​,xg​))−V(a;x0​,xg​).

The supremum follows the convention above. It is 000 if AAA is empty or if the values are unbounded above. It need not be attained when AAA is infinite. No hypothesis on www or pXp_XpX​ is assumed.

IsPairDist. ρ\rhoρ is a pair distribution when

ρ(x0,xg)≥0 for all x0,xgand∑x0,xgρ(x0,xg)=1.\rho(x_0, x_g) \ge 0 \text{ for all } x_0, x_g \quad\text{and}\quad \sum_{x_0, x_g} \rho(x_0, x_g) = 1 .ρ(x0​,xg​)≥0 for all x0​,xg​andx0​,xg​∑​ρ(x0​,xg​)=1.

expRegret1. For an action rule a~:X×X→A\tilde a : X \times X \to Aa~:X×X→A, which is an arbitrary function,

E(a~)=∑x0,xg∈Xρ(x0,xg)  r(a~(x0,xg);x0,xg).\mathcal{E}(\tilde a) = \sum_{x_0, x_g \in X} \rho(x_0, x_g)\; r\big(\tilde a(x_0, x_g); x_0, x_g\big) .E(a~)=x0​,xg​∈X∑​ρ(x0​,xg​)r(a~(x0​,xg​);x0​,xg​).

No condition on ρ\rhoρ is part of this definition.

cZero. The constant is

c0=∑x0,xg∈Xρ(x0,xg) sup⁡a∈Aw+(xg∣a)pX(x0).c_0 = \sum_{x_0, x_g \in X} \rho(x_0, x_g)\, \sqrt{\frac{\sup_{a \in A} w_+(x_g \mid a)}{p_X(x_0)}} .c0​=x0​,xg​∈X∑​ρ(x0​,xg​)pX​(x0​)supa∈A​w+​(xg​∣a)​​.

Note the mixed indices: the second marginal is taken at the goal xgx_gxg​, while the denominator is pXp_XpX​ at the initial observation x0x_0x0​. The supremum convention applies, so the supremum is 000 if AAA is empty or the values are unbounded. Division by zero and the square root of a negative number give 000.

spectralLoss. The spectral loss is

R(f,g,a)=∑x,x′pX(x) w+(x′∣a) ⟨g(f(x),a),f(x′)⟩2  −  2∑x,x′w(x,x′,a) ⟨g(f(x),a),f(x′)⟩.R(f, g, a) = \sum_{x, x'} p_X(x)\, w_+(x' \mid a)\, \langle g(f(x), a), f(x')\rangle^2 \;-\; 2 \sum_{x, x'} w(x, x', a)\, \langle g(f(x), a), f(x')\rangle .R(f,g,a)=x,x′∑​pX​(x)w+​(x′∣a)⟨g(f(x),a),f(x′)⟩2−2x,x′∑​w(x,x′,a)⟨g(f(x),a),f(x′)⟩.

empRiskN. For any n≥0n \ge 0n≥0 and any dataset D=(x1,…,xn)∈XnD = (x_1, \dots, x_n) \in X^nD=(x1​,…,xn​)∈Xn,

R^n(f,g,a)=−2⋅1n∑i=1n∑x′∈XP(x′∣xi,a) ⟨g(f(xi),a),f(x′)⟩  +  1n(n−1)∑i,j=1i≠jn∑x′∈XP(x′∣xj,a) ⟨g(f(xi),a),f(x′)⟩2.\hat R_n(f, g, a) = -2 \cdot \frac{1}{n} \sum_{i=1}^n \sum_{x' \in X} P(x' \mid x_i, a)\, \langle g(f(x_i), a), f(x')\rangle \;+\; \frac{1}{n(n-1)} \sum_{\substack{i, j = 1 \\ i \neq j}}^{n} \sum_{x' \in X} P(x' \mid x_j, a)\, \langle g(f(x_i), a), f(x')\rangle^2 .R^n​(f,g,a)=−2⋅n1​i=1∑n​x′∈X∑​P(x′∣xi​,a)⟨g(f(xi​),a),f(x′)⟩+n(n−1)1​i,j=1i=j​∑n​x′∈X∑​P(x′∣xj​,a)⟨g(f(xi​),a),f(x′)⟩2.

Here P(⋅∣⋅,a)P(\cdot \mid \cdot, a)P(⋅∣⋅,a) is the transition quantity above, with its division-by-zero convention, and nnn and n−1n - 1n−1 are real numbers. Edge cases:

  • For n=0n = 0n=0 both terms are empty, so the value is 000.
  • For n=1n = 1n=1 the second coefficient is 1/0=01/0 = 01/0=0 and its sum is empty.

datasetProb. For D∈XnD \in X^nD∈Xn,

∏i=1npX(xi),\prod_{i=1}^n p_X(x_i) ,i=1∏n​pX​(xi​),

which equals 111 for n=0n = 0n=0.

tupleLoss. For a triple t=(z,z+,z′)∈X3t = (z, z^+, z') \in X^3t=(z,z+,z′)∈X3,

ℓ(t)=⟨g(f(z),a),f(z′)⟩2−2 ⟨g(f(z),a),f(z+)⟩.\ell(t) = \langle g(f(z), a), f(z')\rangle^2 - 2\, \langle g(f(z), a), f(z^+)\rangle .ℓ(t)=⟨g(f(z),a),f(z′)⟩2−2⟨g(f(z),a),f(z+)⟩.

The squared term uses the third component z′z'z′. The linear term uses the second component z+z^+z+.

empRiskS. For m≥0m \ge 0m≥0 and S=(t1,…,tm)∈(X3)mS = (t_1, \dots, t_m) \in (X^3)^mS=(t1​,…,tm​)∈(X3)m,

R^S(f,g,a)=1m∑i=1mℓ(ti),\hat R_S(f, g, a) = \frac{1}{m} \sum_{i=1}^m \ell(t_i) ,R^S​(f,g,a)=m1​i=1∑m​ℓ(ti​),

which is 000 when m=0m = 0m=0.

pairIdx. For a permutation π\piπ of {0,…,2m−1}\{0, \dots, 2m-1\}{0,…,2m−1} and 0≤i<m0 \le i < m0≤i<m, the iii-th index pair is

(π(2i), π(2i+1)).\big(\pi(2i),\, \pi(2i+1)\big) .(π(2i),π(2i+1)).

expEmpRiskS. For m≥0m \ge 0m≥0 and a dataset D=(x0,…,x2m−1)∈X2mD = (x_0, \dots, x_{2m-1}) \in X^{2m}D=(x0​,…,x2m−1​)∈X2m (zero-indexed),

1(2m)!∑π  ∑z+∈Xm  ∑z′∈Xm(∏i=0m−1P(zi+∣xπ(2i),a) P(zi′∣xπ(2i+1),a))  R^S((xπ(2i), zi+, zi′)i=0m−1).\frac{1}{(2m)!} \sum_{\pi} \;\sum_{z^+ \in X^m} \;\sum_{z' \in X^m} \Big( \prod_{i=0}^{m-1} P\big(z^+_i \mid x_{\pi(2i)}, a\big)\, P\big(z'_i \mid x_{\pi(2i+1)}, a\big) \Big)\; \hat R_S\Big( \big( x_{\pi(2i)},\, z^+_i,\, z'_i \big)_{i=0}^{m-1} \Big) .(2m)!1​π∑​z+∈Xm∑​z′∈Xm∑​(i=0∏m−1​P(zi+​∣xπ(2i)​,a)P(zi′​∣xπ(2i+1)​,a))R^S​((xπ(2i)​,zi+​,zi′​)i=0m−1​).

The outer sum runs over all (2m)!(2m)!(2m)! permutations π\piπ of {0,…,2m−1}\{0, \dots, 2m-1\}{0,…,2m−1}, and PPP is the transition quantity above. No hypothesis makes the weights a probability distribution. For m=0m = 0m=0 the value is 000.

tupleProb. For t=(z,z+,z′)t = (z, z^+, z')t=(z,z+,z′),

w(z,z+,a)⋅w+(z′∣a).w(z, z^+, a) \cdot w_+(z' \mid a) .w(z,z+,a)⋅w+​(z′∣a).

sampleProb. For m≥0m \ge 0m≥0 and any property EEE of samples S∈(X3)mS \in (X^3)^mS∈(X3)m,

Pr⁡(E)=∑S∈(X3)m,  E(S) holds  ∏i=1mw(zi,zi+,a) w+(zi′∣a).\Pr(E) = \sum_{S \in (X^3)^m,\; E(S) \text{ holds}} \;\prod_{i=1}^m w(z_i, z_i^+, a)\, w_+(z'_i \mid a) .Pr(E)=S∈(X3)m,E(S) holds∑​i=1∏m​w(zi​,zi+​,a)w+​(zi′​∣a).

This is the product law of mmm independent triples, each with weight given by tupleProb. It depends only on www and aaa, and no normalization is assumed. For m=0m = 0m=0 it is 111 if EEE holds of the empty sample and 000 otherwise.

empRad. For m≥0m \ge 0m≥0, a set HHH of functions X→RX \to \mathbb{R}X→R and points z=(z1,…,zm)∈Xmz = (z_1, \dots, z_m) \in X^mz=(z1​,…,zm​)∈Xm,

R^(H;z)=12m∑σ∈{±1}m  sup⁡φ∈H1m∑i=1mσi φ(zi).\hat{\mathfrak{R}}(H; z) = \frac{1}{2^m} \sum_{\sigma \in \{\pm 1\}^m} \;\sup_{\varphi \in H} \frac{1}{m} \sum_{i=1}^m \sigma_i\, \varphi(z_i) .R^(H;z)=2m1​σ∈{±1}m∑​φ∈Hsup​m1​i=1∑m​σi​φ(zi​).

The supremum follows the convention above, so it is 000 if HHH is empty or the values are unbounded above. For m=0m = 0m=0 the value is 000.

worstRad. The worst-case complexity is

Rm(H)=sup⁡z∈XmR^(H;z).\mathfrak{R}_m(H) = \sup_{z \in X^m} \hat{\mathfrak{R}}(H; z) .Rm​(H)=z∈Xmsup​R^(H;z).

This is a maximum over a finite set, and it equals 000 if XXX is empty and m≥1m \ge 1m≥1.

encCoord. For a set F\mathcal{F}F of encoders and a coordinate ℓ∈{1,…,k}\ell \in \{1, \dots, k\}ℓ∈{1,…,k},

Fℓ={ x↦f(x)ℓ:f∈F }.\mathcal{F}_\ell = \{\, x \mapsto f(x)_\ell : f \in \mathcal{F} \,\} .Fℓ​={x↦f(x)ℓ​:f∈F}.

predCoord. For sets F\mathcal{F}F of encoders and G\mathcal{G}G of predictors, an action aaa and a coordinate ℓ\ellℓ,

Ha,ℓ={ x↦g(f(x),a)ℓ:f∈F, g∈G }.\mathcal{H}_{a, \ell} = \{\, x \mapsto g(f(x), a)_\ell : f \in \mathcal{F},\ g \in \mathcal{G} \,\} .Ha,ℓ​={x↦g(f(x),a)ℓ​:f∈F, g∈G}.

radEnc. The encoder complexity is

Nm(F)=max⁡1≤ℓ≤kRm(Fℓ),\mathfrak{N}_m(\mathcal{F}) = \max_{1 \le \ell \le k} \mathfrak{R}_m(\mathcal{F}_\ell) ,Nm​(F)=1≤ℓ≤kmax​Rm​(Fℓ​),

which is 000 when k=0k = 0k=0.

radPred. The predictor complexity is

max⁡1≤ℓ≤kRm(Ha,ℓ),\max_{1 \le \ell \le k} \mathfrak{R}_m(\mathcal{H}_{a, \ell}) ,1≤ℓ≤kmax​Rm​(Ha,ℓ​),

for the single fixed action aaa, and it is 000 when k=0k = 0k=0.

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

    Confirmed by the moderator at approval.

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