Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Content-style latent model, augmentation process, block-identifiability and SSL objectives

Definition
ContentStyle_Basic

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

data-augmentationidentifiabilitylatent-variable-modelsself-supervised-learning

Objects of Sections 3 and 4 of von Kügelgen et al. (NeurIPS 2021).

  1. Latent space. A latent is z=(c,s)z=(c,s)z=(c,s) with content c∈Rncc\in\mathbb{R}^{n_c}c∈Rnc​ and style s∈Rnss\in\mathbb{R}^{n_s}s∈Rns​. The representation space is Z=C×S\mathcal Z=\mathcal C\times\mathcal SZ=C×S, an open, simply connected subset of Rn\mathbb{R}^{n}Rn, n=nc+nsn=n_c+n_sn=nc​+ns​. Observations live in Rd\mathbb{R}^dRd.
  2. Generative process (eqs. (2)–(3), Assumptions 3.1–3.2). A model consists of a probability density pzp_zpz​ on Z\mathcal ZZ, a probability distribution pAp_ApA​ on the subsets A⊆{1,…,ns}A\subseteq\{1,\dots,n_s\}A⊆{1,…,ns​}, and for each AAA a conditional density p(s~A∣sA)p(\tilde s_A\mid s_A)p(s~A​∣sA​) on RA\mathbb{R}^{A}RA, which is a probability density in s~A\tilde s_As~A​ for every sA∈SAs_A\in\mathcal S_AsA​∈SA​ (the image of S\mathcal SS under s↦sAs\mapsto s_As↦sA​). The pair is drawn as z∼pzz\sim p_zz∼pz​, A∼pAA\sim p_AA∼pA​, s~A∼p(⋅∣sA)\tilde s_A\sim p(\cdot\mid s_A)s~A​∼p(⋅∣sA​), c~=c\tilde c=cc~=c, s~Ac=sAc\tilde s_{A^c}=s_{A^c}s~Ac​=sAc​, and the augmented latent z~\tilde zz~ stays in Z\mathcal ZZ. With a mixing map fff, the views are x=f(z)x=f(z)x=f(z) and x~=f(z~)\tilde x=f(\tilde z)x~=f(z~). Pp\mathbb P_pPp​ denotes the law of (z,z~)(z,\tilde z)(z,z~), and px,x~p_{x,\tilde x}px,x~​ the law of (x,x~)(x,\tilde x)(x,x~).
  3. Conditions of Theorem 4.2. (i) fff is smooth on Z\mathcal ZZ, injective, and its inverse is smooth on the observation space X=f(Z)\mathcal X=f(\mathcal Z)X=f(Z). A function on a subset of Rm\mathbb{R}^mRm is smooth if near each point it agrees with a C∞C^\inftyC∞ function on an open set. (ii) pzp_zpz​ is smooth on Z\mathcal ZZ and pz>0p_z>0pz​>0 almost everywhere on Z\mathcal ZZ. (iii) Every style index lll lies in some AAA with pA(A)>0p_A(A)>0pA​(A)>0 for which p(s~A∣sA)p(\tilde s_A\mid s_A)p(s~A​∣sA​) is smooth on SA×SA\mathcal S_A\times\mathcal S_ASA​×SA​, and for every sA∈SAs_A\in\mathcal S_AsA​∈SA​, p(⋅∣sA)>0p(\cdot\mid s_A)>0p(⋅∣sA​)>0 on an open set containing sAs_AsA​.
  4. Block-identifiability (Definition 4.1). An inferred content map c^\hat cc^ on observations block-identifies the content if there is a map h:Rnc→Rnch:\mathbb{R}^{n_c}\to\mathbb{R}^{n_c}h:Rnc​→Rnc​, injective on C\mathcal CC, with c^(f(c,s))=h(c)\hat c(f(c,s))=h(c)c^(f(c,s))=h(c) for all (c,s)∈Z(c,s)\in\mathcal Z(c,s)∈Z.
  5. Objectives. For a smooth bijection g:X→Zg:\mathcal X\to\mathcal Zg:X→Z, LAlign(g)=E ∥g(x)1:nc−g(x~)1:nc∥22L_{\mathrm{Align}}(g)=\mathbb E\,\|g(x)_{1:n_c}-g(\tilde x)_{1:n_c}\|_2^2LAlign​(g)=E∥g(x)1:nc​​−g(x~)1:nc​​∥22​ (eq. (4)). For g:X→(0,1)ncg:\mathcal X\to(0,1)^{n_c}g:X→(0,1)nc​, LAlignMaxEnt(g)=E ∥g(x)−g(x~)∥22−H(g(x))L_{\mathrm{AlignMaxEnt}}(g)=\mathbb E\,\|g(x)-g(\tilde x)\|_2^2-H(g(x))LAlignMaxEnt​(g)=E∥g(x)−g(x~)∥22​−H(g(x)) (eq. (5)). Here H(μ)=−∫plog⁡pH(\mu)=-\int p\log pH(μ)=−∫plogp is the differential entropy of a law μ=p dλ\mu=p\,d\lambdaμ=pdλ.

Formalization Note Latents are pairs in Rnc×Rns\mathbb{R}^{n_c}\times\mathbb{R}^{n_s}Rnc​×Rns​, and observations are points of Rd\mathbb{R}^dRd; maps are total functions, and only their values on Z\mathcal ZZ and X\mathcal XX enter the statements. Expectations under the generative process are nonnegative extended-real integrals, so they are always defined. The differential entropy takes values in [−∞,∞][-\infty,\infty][−∞,∞]. It is −∞-\infty−∞ when the law has no density or g∘fg\circ fg∘f is not measurable, which makes LAlignMaxEnt=+∞L_{\mathrm{AlignMaxEnt}}=+\inftyLAlignMaxEnt​=+∞. The inverse f−1f^{-1}f−1 is the inverse of fff on Z\mathcal ZZ (Function.invFunOn). "Invertible hhh" in Definition 4.1 is formalized as injectivity on the content space C\mathcal CC, which is the invertibility the paper's proofs establish (as a map from C\mathcal CC onto its image).

Definition code
import Mathlib

/-!
von Kügelgen, Sharma, Gresele, Brendel, Schölkopf, Besserve and Locatello,
*Self-Supervised Learning with Data Augmentations Provably Isolates Content from Style*,
NeurIPS 2021, arXiv:2106.04619v4: the latent space, the content-preserving augmentation process
(Section 3, eqs. (2)-(3), Assumptions 3.1-3.2), the regularity conditions (i)-(iii) of Theorem 4.2,
block-identifiability (Definition 4.1) and the objectives of eqs. (4)-(5) (Section 4).
-/

open MeasureTheory
open scoped ContDiff

noncomputable section

namespace ContentStyle

/-- Section 3: the latent space `ℝ^n = ℝ^{n_c} × ℝ^{n_s}`; a latent is `z = (c, s)` with content
`c = z_{1:n_c}` and style `s = z_{(n_c+1):n}`. -/
abbrev Latent (nc ns : ℕ) : Type := (Fin nc → ℝ) × (Fin ns → ℝ)

/-- Section 3: the ambient space `ℝ^d` of the observation space `𝒳 ⊆ ℝ^d`. -/
abbrev Obs (d : ℕ) : Type := Fin d → ℝ

/-- Section 3: `Z = C × S` is an open, simply connected subset of `ℝ^n`. -/
def IsLatentSpace {nc ns : ℕ} (C : Set (Fin nc → ℝ)) (S : Set (Fin ns → ℝ)) : Prop :=
  IsOpen (C ×ˢ S) ∧ SimplyConnectedSpace (C ×ˢ S : Set (Latent nc ns))

/-- Assumption 3.2: the coordinates `s_A` of a style vector on the subset `A` of style indices. -/
def restr {ns : ℕ} (A : Finset (Fin ns)) (s : Fin ns → ℝ) : A → ℝ := fun i => s i

/-- Assumption 3.2: the subspace `S_A` of changing style variables, the image of `S` under
`s ↦ s_A`. -/
def projA {ns : ℕ} (A : Finset (Fin ns)) (S : Set (Fin ns → ℝ)) : Set (A → ℝ) := restr A '' S

/-- Assumption 3.2: the augmented style `s̃` with `s̃_{A^c} = s_{A^c}` and `s̃_A = t`. -/
def merge {ns : ℕ} (A : Finset (Fin ns)) (s : Fin ns → ℝ) (t : A → ℝ) : Fin ns → ℝ :=
  fun i => if h : i ∈ A then t ⟨i, h⟩ else s i

/-- Section 3, eqs. (2)-(3): the latent part of a generative model of pairs: the density `p_z`,
the distribution `p_A` on subsets `A ⊆ {1, …, n_s}` of changing style variables, and for each `A`
the conditional density `q A s_A s̃_A = p(s̃_A | s_A)` of Assumption 3.2. -/
structure LatentModel (nc ns : ℕ) where
  /-- The latent density `p_z`. -/
  pz : Latent nc ns → ℝ
  /-- The distribution `p_A` on subsets of style indices. -/
  pA : Finset (Fin ns) → ℝ
  /-- The conditional density `p(s̃_A | s_A)`. -/
  q : (A : Finset (Fin ns)) → (A → ℝ) → (A → ℝ) → ℝ

/-- Section 3, Assumptions 3.1 and 3.2: `p_z` is a probability density on `Z = C × S`; `p_A` is a
probability distribution on the subsets of `{1, …, n_s}`; for each `A` and `s_A ∈ S_A`,
`p(· | s_A)` is a probability density on `ℝ^A`; and the augmented latent `z̃ = (c, s̃)` stays in `Z`
(the conditional `p_{z̃|z}` lives on `Z × Z`). -/
def IsAugModel {nc ns : ℕ} (C : Set (Fin nc → ℝ)) (S : Set (Fin ns → ℝ))
    (M : LatentModel nc ns) : Prop :=
  Measurable M.pz ∧ (∀ z ∈ C ×ˢ S, 0 ≤ M.pz z) ∧
    (∫⁻ z in C ×ˢ S, ENNReal.ofReal (M.pz z)) = 1 ∧
    (∀ A, 0 ≤ M.pA A) ∧ (∑ A, M.pA A) = 1 ∧
    ∀ A : Finset (Fin ns), Measurable (Function.uncurry (M.q A)) ∧
      (∀ a ∈ projA A S, ∀ t, 0 ≤ M.q A a t) ∧
      (∀ a ∈ projA A S, (∫⁻ t, ENNReal.ofReal (M.q A a t)) = 1) ∧
      (∀ s ∈ S, ∀ t, merge A s t ∉ S → M.q A (restr A s) t = 0)

/-- Eqs. (2)-(3): `E[φ(z, z̃)]` for the pair `(z, z̃)` drawn by `z ∼ p_z`, `A ∼ p_A`,
`s̃_A ∼ p(· | s_A)`, `c̃ = c`, `s̃_{A^c} = s_{A^c}` (as an extended nonnegative integral). -/
def pairLIntegral {nc ns : ℕ} (C : Set (Fin nc → ℝ)) (S : Set (Fin ns → ℝ))
    (M : LatentModel nc ns) (φ : Latent nc ns × Latent nc ns → ENNReal) : ENNReal :=
  ∑ A : Finset (Fin ns), ENNReal.ofReal (M.pA A) *
    ∫⁻ z in C ×ˢ S, ENNReal.ofReal (M.pz z) *
      ∫⁻ t : A → ℝ, ENNReal.ofReal (M.q A (restr A z.2) t) * φ (z, (z.1, merge A z.2 t))

/-- Eqs. (2)-(3): the probability that the latent pair `(z, z̃)` lies in `E`. -/
def pairProb {nc ns : ℕ} (C : Set (Fin nc → ℝ)) (S : Set (Fin ns → ℝ))
    (M : LatentModel nc ns) (E : Set (Latent nc ns × Latent nc ns)) : ENNReal :=
  pairLIntegral C S M (fun w => E.indicator (fun _ => 1) w)

/-- Eqs. (2)-(3): the probability that the observed pair `(x, x̃) = (f(z), f(z̃))` lies in `E`
(the law `p_{x,x̃}` of original and augmented views). -/
def obsPairProb {nc ns d : ℕ} (C : Set (Fin nc → ℝ)) (S : Set (Fin ns → ℝ))
    (M : LatentModel nc ns) (f : Latent nc ns → Obs d) (E : Set (Obs d × Obs d)) : ENNReal :=
  pairLIntegral C S M (fun w => E.indicator (fun _ => 1) (f w.1, f w.2))

/-- Eq. (2): the law of the latent `z ∼ p_z` on `Z`. -/
def latentLaw {nc ns : ℕ} (C : Set (Fin nc → ℝ)) (S : Set (Fin ns → ℝ))
    (M : LatentModel nc ns) : Measure (Latent nc ns) :=
  (volume.restrict (C ×ˢ S)).withDensity (fun z => ENNReal.ofReal (M.pz z))

/-- Section 3: a function on a subset `s` of a finite-dimensional space is smooth if near each
point of `s` it agrees on `s` with a `C^∞` function on an open set (for open `s` this is
`ContDiffOn ℝ ∞`; for the submanifold `𝒳 ⊆ ℝ^d` it is smoothness on `𝒳`). -/
def SmoothOnSet {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F]
    [NormedSpace ℝ F] (s : Set E) (g : E → F) : Prop :=
  ∀ x ∈ s, ∃ U : Set E, IsOpen U ∧ x ∈ U ∧
    ∃ G : E → F, ContDiffOn ℝ ∞ G U ∧ Set.EqOn g G (U ∩ s)

/-- Theorem 4.2 (i): `f : Z → 𝒳 = f(Z)` is smooth and invertible with smooth inverse
(a diffeomorphism onto `𝒳`). -/
def CondI {nc ns d : ℕ} (C : Set (Fin nc → ℝ)) (S : Set (Fin ns → ℝ))
    (f : Latent nc ns → Obs d) : Prop :=
  SmoothOnSet (C ×ˢ S) f ∧ Set.InjOn f (C ×ˢ S) ∧
    SmoothOnSet (f '' (C ×ˢ S)) (Function.invFunOn f (C ×ˢ S))

/-- Theorem 4.2 (ii): `p_z` is a smooth density on `Z` with `p_z(z) > 0` almost everywhere. -/
def CondII {nc ns : ℕ} (C : Set (Fin nc → ℝ)) (S : Set (Fin ns → ℝ))
    (M : LatentModel nc ns) : Prop :=
  ContDiffOn ℝ ∞ M.pz (C ×ˢ S) ∧ ∀ᵐ z ∂(volume.restrict (C ×ˢ S)), 0 < M.pz z

/-- Theorem 4.2 (iii): for every style index `l` there is `A ∋ l` with `p_A(A) > 0` such that
`p(s̃_A | s_A)` is smooth in `(s_A, s̃_A)` on `S_A × S_A` and, for every `s_A ∈ S_A`,
`p(· | s_A) > 0` on some open set containing `s_A`. -/
def CondIII {nc ns : ℕ} (S : Set (Fin ns → ℝ)) (M : LatentModel nc ns) : Prop :=
  ∀ l : Fin ns, ∃ A : Finset (Fin ns), l ∈ A ∧ 0 < M.pA A ∧
    ContDiffOn ℝ ∞ (Function.uncurry (M.q A)) (projA A S ×ˢ projA A S) ∧
    ∀ a ∈ projA A S, ∃ O : Set (A → ℝ), IsOpen O ∧ a ∈ O ∧ ∀ t ∈ O, 0 < M.q A a t

/-- Definition 4.1: the true content `c = f⁻¹(x)_{1:n_c}` is block-identified by the inferred
content `ĉ(x)` if `ĉ = h(c)` for an invertible `h` (here: `h` injective on the content space
`C`), i.e. `ĉ(f(c, s)) = h(c)` for all `(c, s) ∈ Z`. -/
def BlockIdentifies {nc ns d : ℕ} (C : Set (Fin nc → ℝ)) (S : Set (Fin ns → ℝ))
    (f : Latent nc ns → Obs d) (chat : Obs d → (Fin nc → ℝ)) : Prop :=
  ∃ h : (Fin nc → ℝ) → (Fin nc → ℝ), Set.InjOn h C ∧ ∀ z ∈ C ×ˢ S, chat (f z) = h z.1

/-- Squared Euclidean distance `‖a - b‖₂²`. -/
def sqDist {m : ℕ} (a b : Fin m → ℝ) : ℝ := ∑ i, (a i - b i) ^ 2

/-- Theorem 4.3: `g : 𝒳 → Z` is smooth and invertible (a smooth bijection of `𝒳 = f(Z)` onto `Z`). -/
def IsSmoothInvertible {nc ns d : ℕ} (C : Set (Fin nc → ℝ)) (S : Set (Fin ns → ℝ))
    (f : Latent nc ns → Obs d) (g : Obs d → Latent nc ns) : Prop :=
  SmoothOnSet (f '' (C ×ˢ S)) g ∧ Set.BijOn g (f '' (C ×ˢ S)) (C ×ˢ S)

/-- Eq. (4): `L_Align(g) = E_{(x, x̃)} ‖g(x)_{1:n_c} - g(x̃)_{1:n_c}‖₂²`. -/
def alignLoss {nc ns d : ℕ} (C : Set (Fin nc → ℝ)) (S : Set (Fin ns → ℝ))
    (M : LatentModel nc ns) (f : Latent nc ns → Obs d) (g : Obs d → Latent nc ns) : ENNReal :=
  pairLIntegral C S M (fun w => ENNReal.ofReal (sqDist (g (f w.1)).1 (g (f w.2)).1))

/-- Theorem 4.4: the open unit cube `(0,1)^{n_c}`. -/
def cube (m : ℕ) : Set (Fin m → ℝ) := Set.univ.pi (fun _ => Set.Ioo (0 : ℝ) 1)

open Classical in
/-- Theorem 4.4: differential entropy `H = -∫ p log p` of a law `μ` on `ℝ^m` with density
`p = dμ/dλ`, in `[-∞, ∞]`; it is `-∞` when `μ` has no density. -/
def diffEntropy {m : ℕ} (μ : Measure (Fin m → ℝ)) : EReal :=
  if μ ≪ volume then
    ((∫⁻ x, ENNReal.ofReal (Real.negMulLog (μ.rnDeriv volume x).toReal) : ENNReal) : EReal) -
      ((∫⁻ x, ENNReal.ofReal (-Real.negMulLog (μ.rnDeriv volume x).toReal) : ENNReal) : EReal)
  else ⊥

open Classical in
/-- Eq. (5): `L_AlignMaxEnt(g) = E_{(x, x̃)} ‖g(x) - g(x̃)‖₂² - H(g(x))` for `g : 𝒳 → (0,1)^{n_c}`,
where `g(x)` has the law of `g(f(z))`, `z ∼ p_z` (the entropy is `-∞`, so the loss `+∞`, when
`g ∘ f` is not a random variable). -/
def alignMaxEntLoss {nc ns d : ℕ} (C : Set (Fin nc → ℝ)) (S : Set (Fin ns → ℝ))
    (M : LatentModel nc ns) (f : Latent nc ns → Obs d) (g : Obs d → (Fin nc → ℝ)) : EReal :=
  ((pairLIntegral C S M (fun w => ENNReal.ofReal (sqDist (g (f w.1)) (g (f w.2)))) : ENNReal) :
      EReal) -
    (if AEMeasurable (fun z => g (f z)) (latentLaw C S M) then
      diffEntropy ((latentLaw C S M).map (fun z => g (f z)))
    else ⊥)

end ContentStyle
Source
von Kügelgen, Sharma, Gresele, Brendel, Schölkopf, Besserve and Locatello, Self-Supervised Learning with Data Augmentations Provably Isolates Content from Style, NeurIPS 2021, arXiv:2106.04619v4, Section 3 (eqs. (2)-(3), Assumptions 3.1-3.2, pp. 4-5) and Section 4 (Definition 4.1, p. 5; conditions (i)-(iii) of Theorem 4.2 and eq. (4), p. 6; eq. (5), p. 7)
Read-back

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

Latent. For natural numbers nc,nsn_c, n_snc​,ns​ (either may be 000), Latent(nc,ns)\mathrm{Latent}(n_c,n_s)Latent(nc​,ns​) is the set of pairs z=(c,s)z=(c,s)z=(c,s) with c∈Rncc\in\mathbb R^{n_c}c∈Rnc​ and s∈Rnss\in\mathbb R^{n_s}s∈Rns​. Coordinates of ccc are indexed by {0,…,nc−1}\{0,\dots,n_c-1\}{0,…,nc​−1} and coordinates of sss by [ns]:={0,…,ns−1}[n_s]:=\{0,\dots,n_s-1\}[ns​]:={0,…,ns​−1}. Its topology and Lebesgue measure are those of the product Rnc×Rns≅Rnc+ns\mathbb R^{n_c}\times\mathbb R^{n_s}\cong\mathbb R^{n_c+n_s}Rnc​×Rns​≅Rnc​+ns​. When nc=0n_c=0nc​=0 or ns=0n_s=0ns​=0, the corresponding factor R0\mathbb R^0R0 is a single point, and Lebesgue measure on it is the unit point mass.

Obs. For a natural number ddd, Obs(d)=Rd\mathrm{Obs}(d)=\mathbb R^dObs(d)=Rd, with coordinates indexed by {0,…,d−1}\{0,\dots,d-1\}{0,…,d−1}. When d=0d=0d=0 this is a single point.

IsLatentSpace. For sets C⊆RncC\subseteq\mathbb R^{n_c}C⊆Rnc​ and S⊆RnsS\subseteq\mathbb R^{n_s}S⊆Rns​, IsLatentSpace(C,S)\mathrm{IsLatentSpace}(C,S)IsLatentSpace(C,S) holds exactly when both of the following hold:

  • the product C×SC\times SC×S is an open subset of Rnc×Rns\mathbb R^{n_c}\times\mathbb R^{n_s}Rnc​×Rns​;
  • C×SC\times SC×S, with the subspace topology, is a simply connected space.

Simple connectedness includes path-connectedness, hence non-emptiness. So the predicate forces C≠∅C\neq\varnothingC=∅ and S≠∅S\neq\varnothingS=∅, and therefore both CCC and SSS are open. None of the other declarations below takes this predicate as a hypothesis.

restr. For a finite set of style indices A⊆[ns]A\subseteq[n_s]A⊆[ns​] and a style vector s∈Rnss\in\mathbb R^{n_s}s∈Rns​, restrA(s)=sA∈RA\mathrm{restr}_A(s)=s_A\in\mathbb R^ArestrA​(s)=sA​∈RA is the family (si)i∈A(s_i)_{i\in A}(si​)i∈A​. When A=∅A=\varnothingA=∅, RA\mathbb R^ARA is a single point and sAs_AsA​ is that point.

projA. For A⊆[ns]A\subseteq[n_s]A⊆[ns​] and S⊆RnsS\subseteq\mathbb R^{n_s}S⊆Rns​,

SA:={ sA:s∈S }⊆RA,S_A := \{\, s_A : s\in S \,\}\subseteq \mathbb R^A,SA​:={sA​:s∈S}⊆RA,

the image of SSS under restriction to the coordinates in AAA. If S=∅S=\varnothingS=∅ then SA=∅S_A=\varnothingSA​=∅. If A=∅A=\varnothingA=∅ and S≠∅S\ne\varnothingS=∅, SAS_ASA​ is the single point of R∅\mathbb R^{\varnothing}R∅.

merge. For A⊆[ns]A\subseteq[n_s]A⊆[ns​], s∈Rnss\in\mathbb R^{n_s}s∈Rns​ and t∈RAt\in\mathbb R^At∈RA, mergeA(s,t)∈Rns\mathrm{merge}_A(s,t)\in\mathbb R^{n_s}mergeA​(s,t)∈Rns​ is the vector with

mergeA(s,t)i={tii∈A,sii∉A.\mathrm{merge}_A(s,t)_i=\begin{cases} t_i & i\in A,\\ s_i & i\notin A.\end{cases}mergeA​(s,t)i​={ti​si​​i∈A,i∈/A.​

In words, the AAA-coordinates of sss are overwritten by ttt and the others are kept. For A=∅A=\varnothingA=∅ the result is sss.

LatentModel. A latent model MMM for (nc,ns)(n_c,n_s)(nc​,ns​) is a bare triple of real-valued functions with no conditions imposed:

  • pz:Rnc×Rns→Rp_z:\mathbb R^{n_c}\times\mathbb R^{n_s}\to\mathbb Rpz​:Rnc​×Rns​→R;
  • pAp_ApA​, which assigns a real number pA(A)p_A(A)pA​(A) to every subset A⊆[ns]A\subseteq[n_s]A⊆[ns​];
  • for each A⊆[ns]A\subseteq[n_s]A⊆[ns​], a function qA:RA×RA→Rq_A:\mathbb R^A\times\mathbb R^A\to\mathbb RqA​:RA×RA→R, written qA(a,t)q_A(a,t)qA​(a,t).

Negativity, non-measurability and non-normalization are all allowed at this level.

IsAugModel. Write x+=max⁡(x,0)x^+=\max(x,0)x+=max(x,0) and let λ\lambdaλ denote Lebesgue measure. For C⊆RncC\subseteq\mathbb R^{n_c}C⊆Rnc​, S⊆RnsS\subseteq\mathbb R^{n_s}S⊆Rns​ and a latent model M=(pz,pA,q)M=(p_z,p_A,q)M=(pz​,pA​,q), IsAugModel(C,S,M)\mathrm{IsAugModel}(C,S,M)IsAugModel(C,S,M) asserts all of the following.

  1. pzp_zpz​ is Borel measurable on all of Rnc×Rns\mathbb R^{n_c}\times\mathbb R^{n_s}Rnc​×Rns​.
  2. pz(z)≥0p_z(z)\ge 0pz​(z)≥0 for every z∈C×Sz\in C\times Sz∈C×S. No sign condition is imposed outside C×SC\times SC×S.
  3. ∫C×Spz(z)+ dλ(z)=1\displaystyle\int_{C\times S} p_z(z)^+\,d\lambda(z)=1∫C×S​pz​(z)+dλ(z)=1, as an integral in [0,∞][0,\infty][0,∞].
  4. pA(A)≥0p_A(A)\ge 0pA​(A)≥0 for every A⊆[ns]A\subseteq[n_s]A⊆[ns​], and ∑A⊆[ns]pA(A)=1\displaystyle\sum_{A\subseteq[n_s]}p_A(A)=1A⊆[ns​]∑​pA​(A)=1. The sum runs over all 2ns2^{n_s}2ns​ subsets, including A=∅A=\varnothingA=∅.
  5. For every A⊆[ns]A\subseteq[n_s]A⊆[ns​]:
    • (a) (a,t)↦qA(a,t)(a,t)\mapsto q_A(a,t)(a,t)↦qA​(a,t) is jointly measurable on RA×RA\mathbb R^A\times\mathbb R^ARA×RA;
    • (b) for every a∈SAa\in S_Aa∈SA​ and every t∈RAt\in\mathbb R^At∈RA, qA(a,t)≥0q_A(a,t)\ge 0qA​(a,t)≥0;
    • (c) for every a∈SAa\in S_Aa∈SA​, ∫RAqA(a,t)+ dλ(t)=1\displaystyle\int_{\mathbb R^A} q_A(a,t)^+\,d\lambda(t)=1∫RA​qA​(a,t)+dλ(t)=1, where Lebesgue measure on RA\mathbb R^ARA is the unit point mass when A=∅A=\varnothingA=∅, so then q∅(a,⋅)=1q_\varnothing(a,\cdot)=1q∅​(a,⋅)=1 at the single point;
    • (d) for every s∈Ss\in Ss∈S and every t∈RAt\in\mathbb R^At∈RA, if mergeA(s,t)∉S\mathrm{merge}_A(s,t)\notin SmergeA​(s,t)∈/S then qA(sA,t)=0q_A(s_A,t)=0qA​(sA​,t)=0.

Since qAq_AqA​ sees only sAs_AsA​, condition (d) forces qA(a,t)=0q_A(a,t)=0qA​(a,t)=0 as soon as some s∈Ss\in Ss∈S with sA=as_A=asA​=a has mergeA(s,t)∉S\mathrm{merge}_A(s,t)\notin SmergeA​(s,t)∈/S. No conditions are placed on qA(a,⋅)q_A(a,\cdot)qA​(a,⋅) for a∉SAa\notin S_Aa∈/SA​. The content set CCC enters only through conditions 2 and 3. If C×SC\times SC×S is Lebesgue-null and nc+ns>0n_c+n_s>0nc​+ns​>0, condition 3 cannot hold.

pairLIntegral. For C,S,MC,S,MC,S,M as above and any function φ\varphiφ from pairs of latents to [0,∞][0,\infty][0,∞] (no measurability required), the quantity is

pairLIntegral(φ)=∑A⊆[ns]pA(A)+∫C×Spz(z)+∫RAqA(sA,t)+  φ(z, (c,mergeA(s,t))) dλ(t) dλ(z) ∈[0,∞].\mathrm{pairLIntegral}(\varphi)=\sum_{A\subseteq[n_s]} p_A(A)^+\int_{C\times S} p_z(z)^+\int_{\mathbb R^A} q_A(s_A,t)^+\;\varphi\big(z,\ (c,\mathrm{merge}_A(s,t))\big)\,d\lambda(t)\,d\lambda(z)\ \in[0,\infty].pairLIntegral(φ)=A⊆[ns​]∑​pA​(A)+∫C×S​pz​(z)+∫RA​qA​(sA​,t)+φ(z, (c,mergeA​(s,t)))dλ(t)dλ(z) ∈[0,∞].

Here z=(c,s)z=(c,s)z=(c,s) and the integrals are lower Lebesgue integrals in [0,∞][0,\infty][0,∞]. The second argument of φ\varphiφ is the pair z~=(c,s~)\tilde z=(c,\tilde s)z~=(c,s~): the same content ccc, and a style s~\tilde ss~ that agrees with sss off AAA and equals ttt on AAA. For A=∅A=\varnothingA=∅, z~=z\tilde z=zz~=z. No hypothesis such as IsAugModel\mathrm{IsAugModel}IsAugModel is assumed, and negative parts of pA,pz,qAp_A,p_z,q_ApA​,pz​,qA​ are replaced by 000.

pairProb. For a set EEE of latent pairs, pairProb(E)=pairLIntegral(φ)\mathrm{pairProb}(E)=\mathrm{pairLIntegral}(\varphi)pairProb(E)=pairLIntegral(φ), where φ(z,z~)=1\varphi(z,\tilde z)=1φ(z,z~)=1 if (z,z~)∈E(z,\tilde z)\in E(z,z~)∈E and 000 otherwise. The value lies in [0,∞][0,\infty][0,∞]. It equals a probability only when the weights are normalized, e.g. under IsAugModel\mathrm{IsAugModel}IsAugModel. EEE need not be measurable.

obsPairProb. For a map f:Rnc×Rns→Rdf:\mathbb R^{n_c}\times\mathbb R^{n_s}\to\mathbb R^df:Rnc​×Rns​→Rd and a set E⊆Rd×RdE\subseteq\mathbb R^d\times\mathbb R^dE⊆Rd×Rd, obsPairProb(E)=pairLIntegral(φ)\mathrm{obsPairProb}(E)=\mathrm{pairLIntegral}(\varphi)obsPairProb(E)=pairLIntegral(φ), where φ(z,z~)=1\varphi(z,\tilde z)=1φ(z,z~)=1 if (f(z),f(z~))∈E(f(z),f(\tilde z))\in E(f(z),f(z~))∈E and 000 otherwise. The value lies in [0,∞][0,\infty][0,∞]. No regularity of fff or measurability of EEE is required.

latentLaw. The measure on Rnc×Rns\mathbb R^{n_c}\times\mathbb R^{n_s}Rnc​×Rns​ given by

μz(B)=∫B∩(C×S)pz(z)+ dλ(z).\mu_z(B)=\int_{B\cap (C\times S)} p_z(z)^+\,d\lambda(z).μz​(B)=∫B∩(C×S)​pz​(z)+dλ(z).

That is, Lebesgue measure restricted to C×SC\times SC×S, with density pz+p_z^+pz+​. Its total mass is ∫C×Spz+ dλ\int_{C\times S}p_z^+\,d\lambda∫C×S​pz+​dλ, which equals 111 only if that normalization is separately assumed.

SmoothOnSet. For real normed spaces E,FE,FE,F, a set s⊆Es\subseteq Es⊆E and a map g:E→Fg:E\to Fg:E→F, SmoothOnSet(s,g)\mathrm{SmoothOnSet}(s,g)SmoothOnSet(s,g) means:

for every x∈sx\in sx∈s there exist an open set U⊆EU\subseteq EU⊆E with x∈Ux\in Ux∈U and a map G:E→FG:E\to FG:E→F that is C∞C^\inftyC∞ on UUU, such that g(y)=G(y)g(y)=G(y)g(y)=G(y) for all y∈U∩sy\in U\cap sy∈U∩s.

Values of ggg off sss are irrelevant. If s=∅s=\varnothings=∅ the condition holds vacuously. Here C∞C^\inftyC∞ means infinitely differentiable (not analytic).

CondI. For C,SC,SC,S and f:Rnc×Rns→Rdf:\mathbb R^{n_c}\times\mathbb R^{n_s}\to\mathbb R^df:Rnc​×Rns​→Rd, CondI(C,S,f)\mathrm{CondI}(C,S,f)CondI(C,S,f) asserts three things:

  1. SmoothOnSet(C×S,f)\mathrm{SmoothOnSet}(C\times S,f)SmoothOnSet(C×S,f) holds.
  2. fff is injective on C×SC\times SC×S.
  3. SmoothOnSet(f(C×S), f−1)\mathrm{SmoothOnSet}\big(f(C\times S),\,f^{-1}\big)SmoothOnSet(f(C×S),f−1) holds.

In item 3, f−1:Rd→Rnc×Rnsf^{-1}:\mathbb R^d\to\mathbb R^{n_c}\times\mathbb R^{n_s}f−1:Rd→Rnc​×Rns​ is the choice-based inverse. It sends y∈f(C×S)y\in f(C\times S)y∈f(C×S) to some z∈C×Sz\in C\times Sz∈C×S with f(z)=yf(z)=yf(z)=y, which is unique by item 2. Points outside the image go to an unspecified value, which plays no role. Smoothness of the inverse is in the local-extension sense of SmoothOnSet\mathrm{SmoothOnSet}SmoothOnSet: near each point of f(C×S)f(C\times S)f(C×S) it agrees on f(C×S)f(C\times S)f(C×S) with a map that is C∞C^\inftyC∞ on an open subset of Rd\mathbb R^dRd. Nothing requires f(C×S)f(C\times S)f(C×S) to be a submanifold, and nothing requires C×SC\times SC×S to be open.

CondII. CondII(C,S,M)\mathrm{CondII}(C,S,M)CondII(C,S,M) asserts two things:

  • pzp_zpz​ is C∞C^\inftyC∞ on the set C×SC\times SC×S, in the sense of differentiability within that set;
  • pz(z)>0p_z(z)>0pz​(z)>0 for Lebesgue-almost every z∈C×Sz\in C\times Sz∈C×S.

If C×SC\times SC×S is Lebesgue-null, the second clause is vacuous.

CondIII. CondIII(S,M)\mathrm{CondIII}(S,M)CondIII(S,M) asserts that for every style index l∈[ns]l\in[n_s]l∈[ns​] there exists A⊆[ns]A\subseteq[n_s]A⊆[ns​] satisfying all of the following:

  • l∈Al\in Al∈A;
  • pA(A)>0p_A(A)>0pA​(A)>0;
  • (a,t)↦qA(a,t)(a,t)\mapsto q_A(a,t)(a,t)↦qA​(a,t) is C∞C^\inftyC∞ on the set SA×SA⊆RA×RAS_A\times S_A\subseteq\mathbb R^A\times\mathbb R^ASA​×SA​⊆RA×RA, in the within-set sense;
  • for every a∈SAa\in S_Aa∈SA​ there is an open set O⊆RAO\subseteq\mathbb R^AO⊆RA with a∈Oa\in Oa∈O such that qA(a,t)>0q_A(a,t)>0qA​(a,t)>0 for all t∈Ot\in Ot∈O.

The set OOO need not lie inside SAS_ASA​, and different lll may use different sets AAA. When ns=0n_s=0ns​=0 the condition holds vacuously.

BlockIdentifies. For C,SC,SC,S, f:Rnc×Rns→Rdf:\mathbb R^{n_c}\times\mathbb R^{n_s}\to\mathbb R^df:Rnc​×Rns​→Rd and c^:Rd→Rnc\hat c:\mathbb R^d\to\mathbb R^{n_c}c^:Rd→Rnc​, BlockIdentifies(C,S,f,c^)\mathrm{BlockIdentifies}(C,S,f,\hat c)BlockIdentifies(C,S,f,c^) means: there exists a function h:Rnc→Rnch:\mathbb R^{n_c}\to\mathbb R^{n_c}h:Rnc​→Rnc​ that is injective on CCC and satisfies

c^(f(c,s))=h(c)for all c∈C, s∈S.\hat c\big(f(c,s)\big)=h(c)\qquad\text{for all } c\in C,\ s\in S.c^(f(c,s))=h(c)for all c∈C, s∈S.

No continuity, measurability or surjectivity of hhh is required, and hhh need not have an inverse defined beyond injectivity on CCC. The condition is automatically true if C×S=∅C\times S=\varnothingC×S=∅, or if nc=0n_c=0nc​=0.

sqDist. For a,b∈Rma,b\in\mathbb R^ma,b∈Rm,

sqDist(a,b)=∑i(ai−bi)2=∥a−b∥22,\mathrm{sqDist}(a,b)=\sum_{i}(a_i-b_i)^2=\|a-b\|_2^2,sqDist(a,b)=i∑​(ai​−bi​)2=∥a−b∥22​,

which equals 000 when m=0m=0m=0.

IsSmoothInvertible. For C,SC,SC,S, f:Rnc×Rns→Rdf:\mathbb R^{n_c}\times\mathbb R^{n_s}\to\mathbb R^df:Rnc​×Rns​→Rd and g:Rd→Rnc×Rnsg:\mathbb R^d\to\mathbb R^{n_c}\times\mathbb R^{n_s}g:Rd→Rnc​×Rns​, the predicate asserts two things:

  1. SmoothOnSet(f(C×S),g)\mathrm{SmoothOnSet}\big(f(C\times S),g\big)SmoothOnSet(f(C×S),g) holds.
  2. ggg is a bijection from f(C×S)f(C\times S)f(C×S) onto C×SC\times SC×S: it maps f(C×S)f(C\times S)f(C×S) into C×SC\times SC×S, is injective there, and every point of C×SC\times SC×S is hit.

Nothing is said about ggg off f(C×S)f(C\times S)f(C×S), about smoothness of ggg's inverse, or about fff itself, which is not assumed injective here.

alignLoss. For C,S,M,fC,S,M,fC,S,M,f as above and g:Rd→Rnc×Rnsg:\mathbb R^d\to\mathbb R^{n_c}\times\mathbb R^{n_s}g:Rd→Rnc​×Rns​, write g(x)c∈Rncg(x)_c\in\mathbb R^{n_c}g(x)c​∈Rnc​ for the first (content) block of g(x)g(x)g(x). Then

LAlign(g)=pairLIntegral((z,z~)↦∥g(f(z))c−g(f(z~))c∥22)∈[0,∞].\mathcal L_{\mathrm{Align}}(g)=\mathrm{pairLIntegral}\Big((z,\tilde z)\mapsto \big\|g(f(z))_c-g(f(\tilde z))_c\big\|_2^2\Big)\in[0,\infty].LAlign​(g)=pairLIntegral((z,z~)↦​g(f(z))c​−g(f(z~))c​​22​)∈[0,∞].

That is the weighted integral, defined above, of the squared Euclidean distance between the content blocks of ggg applied to f(z)f(z)f(z) and to f(z~)f(\tilde z)f(z~). It is not assumed that ggg is smooth, invertible, or measurable.

cube. cube(m)=(0,1)m={x∈Rm:0<xi<1 for all i}\mathrm{cube}(m)=(0,1)^m=\{x\in\mathbb R^m: 0<x_i<1 \text{ for all } i\}cube(m)=(0,1)m={x∈Rm:0<xi​<1 for all i}, the open unit cube. For m=0m=0m=0 it is the single point of R0\mathbb R^0R0.

diffEntropy. For any measure μ\muμ on Rm\mathbb R^mRm (not necessarily finite or a probability), let p=dμdλp=\frac{d\mu}{d\lambda}p=dλdμ​ be its Radon–Nikodym derivative with respect to Lebesgue measure, taken as a real number, with value 000 wherever the derivative is +∞+\infty+∞. Let η(x)=−xlog⁡x\eta(x)=-x\log xη(x)=−xlogx, with η(0)=0\eta(0)=0η(0)=0. Then

H(μ)={∫Rmη(p(x))+ dλ(x)  −  ∫Rm(−η(p(x)))+ dλ(x)if μ≪λ,−∞otherwise,H(\mu)=\begin{cases}\displaystyle\int_{\mathbb R^m}\eta(p(x))^+\,d\lambda(x)\;-\;\int_{\mathbb R^m}\big(-\eta(p(x))\big)^+\,d\lambda(x) & \text{if } \mu\ll\lambda,\\[2mm] -\infty & \text{otherwise,}\end{cases}H(μ)=⎩⎨⎧​∫Rm​η(p(x))+dλ(x)−∫Rm​(−η(p(x)))+dλ(x)−∞​if μ≪λ,otherwise,​

valued in the extended reals [−∞,+∞][-\infty,+\infty][−∞,+∞]. Each integral lies in [0,∞][0,\infty][0,∞]. If both integrals are +∞+\infty+∞, the difference ∞−∞\infty-\infty∞−∞ evaluates to −∞-\infty−∞. For m=0m=0m=0, λ\lambdaλ is the unit point mass.

alignMaxEntLoss. For C,S,M,fC,S,M,fC,S,M,f and g:Rd→Rncg:\mathbb R^d\to\mathbb R^{n_c}g:Rd→Rnc​, with ggg defined on all of Rd\mathbb R^dRd and not required to take values in (0,1)nc(0,1)^{n_c}(0,1)nc​, the loss is the extended real number

LAlignMaxEnt(g)=pairLIntegral((z,z~)↦∥g(f(z))−g(f(z~))∥22)  −  H,\mathcal L_{\mathrm{AlignMaxEnt}}(g)=\mathrm{pairLIntegral}\Big((z,\tilde z)\mapsto\big\|g(f(z))-g(f(\tilde z))\big\|_2^2\Big)\;-\;\mathcal H,LAlignMaxEnt​(g)=pairLIntegral((z,z~)↦​g(f(z))−g(f(z~))​22​)−H,

where the first term lies in [0,∞][0,\infty][0,∞] and

H={H((g∘f)#μz)if g∘f is almost-everywhere measurable with respect to μz,−∞otherwise.\mathcal H=\begin{cases} H\big((g\circ f)_\#\mu_z\big) & \text{if } g\circ f \text{ is almost-everywhere measurable with respect to } \mu_z,\\ -\infty & \text{otherwise.}\end{cases}H={H((g∘f)#​μz​)−∞​if g∘f is almost-everywhere measurable with respect to μz​,otherwise.​

Here μz\mu_zμz​ is latentLaw(C,S,M)\mathrm{latentLaw}(C,S,M)latentLaw(C,S,M), and (g∘f)#μz(g\circ f)_\#\mu_z(g∘f)#​μz​ is its pushforward to Rnc\mathbb R^{n_c}Rnc​. Since μz\mu_zμz​ is normalized only if separately assumed, this pushforward need not be a probability measure.

The subtraction is in [−∞,+∞][-\infty,+\infty][−∞,+∞], so the boundary cases resolve as follows:

  • if H=−∞\mathcal H=-\inftyH=−∞, the loss is +∞+\infty+∞;
  • if the first term is +∞+\infty+∞ and H=+∞\mathcal H=+\inftyH=+∞, the loss is −∞-\infty−∞.

The cube (0,1)nc(0,1)^{n_c}(0,1)nc​ is not referenced in this definition.

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