Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Multi-view data, density ratio, contrastive losses, landmark and direct embeddings

Definition
MultiViewRedundancy_Basic

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

conditional-expectationcontrastive-learningdensity-ratiomulti-view-learningrepresentation-learning

Objects of Sections 2–5 of Tosh, Krishnamurthy and Hsu (2021).

  1. Multi-view distribution. The views take values in measurable spaces X\mathcal XX and Z\mathcal ZZ (with Z\mathcal ZZ standard Borel where conditional laws are needed), and the label in R\mathbb RR. A law ρ\rhoρ of (X,Z,Y)(X,Z,Y)(X,Z,Y) is a probability measure on X×Z×R\mathcal X\times\mathcal Z\times\mathbb RX×Z×R. Its view marginal pX,Zp_{X,Z}pX,Z​ has marginals pXp_XpX​ and pZp_ZpZ​.
  2. Regression functions (Section 2.4). E[Y∣X=x]\mathbb E[Y\mid X=x]E[Y∣X=x], E[Y∣Z=z]\mathbb E[Y\mid Z=z]E[Y∣Z=z] and E[Y∣X=x,Z=z]\mathbb E[Y\mid X=x,Z=z]E[Y∣X=x,Z=z] are the means of the conditional laws of YYY (disintegrations of ρ\rhoρ). The predictor through the other view is μ(x)=E[E[Y∣Z]∣X=x]\mu(x)=\mathbb E[\mathbb E[Y\mid Z]\mid X=x]μ(x)=E[E[Y∣Z]∣X=x], the mean of z↦E[Y∣Z=z]z\mapsto\mathbb E[Y\mid Z=z]z↦E[Y∣Z=z] under the conditional law of ZZZ given X=xX=xX=x. The redundancy quantities are εX=E[(E[Y∣X]−E[Y∣X,Z])2]\varepsilon_X=\mathbb E[(\mathbb E[Y\mid X]-\mathbb E[Y\mid X,Z])^2]εX​=E[(E[Y∣X]−E[Y∣X,Z])2] and εZ=E[(E[Y∣Z]−E[Y∣X,Z])2]\varepsilon_Z=\mathbb E[(\mathbb E[Y\mid Z]-\mathbb E[Y\mid X,Z])^2]εZ​=E[(E[Y∣Z]−E[Y∣X,Z])2], and εμ=εX+2εXεZ+εZ\varepsilon_\mu=\varepsilon_X+2\sqrt{\varepsilon_X\varepsilon_Z}+\varepsilon_Zεμ​=εX​+2εX​εZ​​+εZ​.
  3. Density ratio (Section 2.3). g⋆(x,z)=pX,Z(x,z)pX(x)pZ(z)g^\star(x,z)=\dfrac{p_{X,Z}(x,z)}{p_X(x)p_Z(z)}g⋆(x,z)=pX​(x)pZ​(z)pX,Z​(x,z)​, the Radon–Nikodym derivative of pX,Zp_{X,Z}pX,Z​ with respect to pX⊗pZp_X\otimes p_ZpX​⊗pZ​.
  4. Contrastive distribution and losses (Sections 2.2, 2.3, 4). (Xc,Zc,Yc)∼Dcontrast(X_c,Z_c,Y_c)\sim D_{\mathrm{contrast}}(Xc​,Zc​,Yc​)∼Dcontrast​ is (X,Z,1)(X,Z,1)(X,Z,1) with (X,Z)∼pX,Z(X,Z)\sim p_{X,Z}(X,Z)∼pX,Z​ with probability 1/21/21/2, and (X,Z~,−1)(X,\tilde Z,-1)(X,Z~,−1) with (X,Z~)∼pX⊗pZ(X,\tilde Z)\sim p_X\otimes p_Z(X,Z~)∼pX​⊗pZ​ otherwise. The losses are Llm(f)=E[log⁡(1+e−Ycf(Xc,Zc))]L_{\mathrm{lm}}(f)=\mathbb E[\log(1+e^{-Y_cf(X_c,Z_c)})]Llm​(f)=E[log(1+e−Yc​f(Xc​,Zc​))] (eq. 1) and Ldirect(f)=E[log⁡(1+f(Xc,Zc)−Yc)]L_{\mathrm{direct}}(f)=\mathbb E[\log(1+f(X_c,Z_c)^{-Y_c})]Ldirect​(f)=E[log(1+f(Xc​,Zc​)−Yc​)] for f>0f>0f>0 (eq. 2). The excess losses are εopt,lm=Llm(f)−Llm(log⁡∘g⋆)\varepsilon_{\mathrm{opt,lm}}=L_{\mathrm{lm}}(f)-L_{\mathrm{lm}}(\log\circ g^\star)εopt,lm​=Llm​(f)−Llm​(log∘g⋆) and εopt,direct=Ldirect(η⊤ψ)−Ldirect(g⋆)\varepsilon_{\mathrm{opt,direct}}=L_{\mathrm{direct}}(\eta^\top\psi)-L_{\mathrm{direct}}(g^\star)εopt,direct​=Ldirect​(η⊤ψ)−Ldirect​(g⋆).
  5. Landmark embedding (Section 3). For landmarks z1,…,zm∈Zz_1,\dots,z_m\in\mathcal Zz1​,…,zm​∈Z and a bivariate ggg, φ(x)=(g(x,z1),…,g(x,zm))\varphi(x)=(g(x,z_1),\dots,g(x,z_m))φ(x)=(g(x,z1​),…,g(x,zm​)); φ⋆\varphi^\starφ⋆ uses g=g⋆g=g^\starg=g⋆. The landmark variance is var⁡(E[Y1∣Z1] g⋆(X,Z1))\operatorname{var}(\mathbb E[Y_1\mid Z_1]\,g^\star(X,Z_1))var(E[Y1​∣Z1​]g⋆(X,Z1​)) with (X,Z1)∼pX⊗pZ(X,Z_1)\sim p_X\otimes p_Z(X,Z1​)∼pX​⊗pZ​, valued in [0,∞][0,\infty][0,∞], and εlm=2var⁡(⋯ )/n\varepsilon_{\mathrm{lm}}=2\operatorname{var}(\cdots)/nεlm​=2var(⋯)/n for a block size nnn.
  6. Direct embeddings (Section 4). For η:X→Rm\eta:\mathcal X\to\mathbb R^mη:X→Rm, ψ:Z→Rm\psi:\mathcal Z\to\mathbb R^mψ:Z→Rm: εdirect(η,ψ)=E[(η(X)⊤ψ(Z~)−g⋆(X,Z~))2]\varepsilon_{\mathrm{direct}}(\eta,\psi)=\mathbb E[(\eta(X)^\top\psi(\tilde Z)-g^\star(X,\tilde Z))^2]εdirect​(η,ψ)=E[(η(X)⊤ψ(Z~)−g⋆(X,Z~))2] with (X,Z~)∼pX⊗pZ(X,\tilde Z)\sim p_X\otimes p_Z(X,Z~)∼pX​⊗pZ​, valued in [0,∞][0,\infty][0,∞].
  7. Risk (eq. 3). R(φ)=inf⁡w∈RmE[(w⊤φ(X)−μ(X))2]R(\varphi)=\inf_{w\in\mathbb R^m}\mathbb E[(w^\top\varphi(X)-\mu(X))^2]R(φ)=infw∈Rm​E[(w⊤φ(X)−μ(X))2], valued in [0,∞][0,\infty][0,∞].
  8. Hidden variables (Section 4.2). H∼pHH\sim p_HH∼pH​ renders XXX and ZZZ conditionally independent with conditional laws pX∣H(⋅∣h)p_{X\mid H}(\cdot\mid h)pX∣H​(⋅∣h), pZ∣H(⋅∣h)p_{Z\mid H}(\cdot\mid h)pZ∣H​(⋅∣h) if pX,Z=∫pX∣H(⋅∣h)⊗pZ∣H(⋅∣h) dpH(h)p_{X,Z}=\int p_{X\mid H}(\cdot\mid h)\otimes p_{Z\mid H}(\cdot\mid h)\,dp_H(h)pX,Z​=∫pX∣H​(⋅∣h)⊗pZ∣H​(⋅∣h)dpH​(h). The hidden-variable variance is var⁡(pX∣H(X∣Hˉ) pZ∣H(Z~∣Hˉ)pX(X) pZ(Z~))\operatorname{var}\Big(\frac{p_{X\mid H}(X\mid\bar H)\,p_{Z\mid H}(\tilde Z\mid\bar H)}{p_X(X)\,p_Z(\tilde Z)}\Big)var(pX​(X)pZ​(Z~)pX∣H​(X∣Hˉ)pZ∣H​(Z~∣Hˉ)​) with (X,Z~,Hˉ)∼pX⊗pZ⊗pH(X,\tilde Z,\bar H)\sim p_X\otimes p_Z\otimes p_H(X,Z~,Hˉ)∼pX​⊗pZ​⊗pH​, valued in [0,∞][0,\infty][0,∞].
  9. Gaussian model (Section 3.3). H∼N(0,σ2)H\sim N(0,\sigma^2)H∼N(0,σ2), X∣H∼N(H,1)X\mid H\sim N(H,1)X∣H∼N(H,1), Z∣H∼N(H,1)Z\mid H\sim N(H,1)Z∣H∼N(H,1), X⊥Z∣HX\perp Z\mid HX⊥Z∣H; the law of (X,Z)(X,Z)(X,Z) is that of (H+E1,H+E2)(H+E_1,H+E_2)(H+E1​,H+E2​) with H,E1,E2H,E_1,E_2H,E1​,E2​ independent and Ei∼N(0,1)E_i\sim N(0,1)Ei​∼N(0,1).

Formalization Note The paper assumes that all variables have probability mass functions or densities. The formalization works with general laws: densities and density ratios become Radon–Nikodym derivatives, and conditional means become means of disintegration kernels, which agree with the paper's formulas in both cases. Quantities that may be infinite in the paper (variances, εdirect\varepsilon_{\mathrm{direct}}εdirect​, risks) take values in [0,∞][0,\infty][0,∞]. Llm(log⁡∘g⋆)L_{\mathrm{lm}}(\log\circ g^\star)Llm​(log∘g⋆) is written in its equal odds form Ldirect(g⋆)L_{\mathrm{direct}}(g^\star)Ldirect​(g⋆), which stays correct where g⋆=0g^\star=0g⋆=0. The block size nnn of εlm\varepsilon_{\mathrm{lm}}εlm​ is a parameter; each statement says which nnn it uses.

Definition code
import Mathlib

/-!
Tosh, Krishnamurthy and Hsu, *Contrastive learning, multi-view redundancy, and linear models*,
arXiv:2008.10150v2 (2021): the multi-view distribution and its regression functions (Section 2.1,
2.4), the density ratio and the contrastive losses (Sections 2.2, 2.3, 4, eq. (1), eq. (2)), the
landmark embedding (Section 3), direct embeddings and hidden variables (Section 4), the risk
(eq. (3)) and the Gaussian model (Section 3.3).

A law `ρ` of the triple `(X, Z, Y)` is a measure on `X × Z × ℝ`; a law `ν` of the pair of views
`(X, Z)` is a measure on `X × Z`. Conditional means are means of the disintegration kernels
(`Measure.condKernel`); density ratios are Radon–Nikodym derivatives, which covers both the
probability-mass-function and the density case of Section 2.1.
-/

open MeasureTheory ProbabilityTheory
open scoped ENNReal NNReal

noncomputable section

namespace MultiViewRedundancy

variable {X Z : Type*} [MeasurableSpace X] [MeasurableSpace Z]

/-- Section 2.1: the joint law `p_{X,Z}` of the two views, for a law `ρ` of `(X, Z, Y)`.
Its marginals `(lawXZ ρ).fst` and `(lawXZ ρ).snd` are `p_X` and `p_Z`. -/
abbrev lawXZ (ρ : Measure (X × Z × ℝ)) : Measure (X × Z) :=
  ρ.map (fun t => (t.1, t.2.1))

/-- Section 2.3: the density ratio `g⋆(x, z) = p_{X,Z}(x, z) / (p_X(x) p_Z(z))`, the
Radon–Nikodym derivative of `p_{X,Z}` with respect to `p_X ⊗ p_Z`. -/
def densityRatio (ν : Measure (X × Z)) (x : X) (z : Z) : ℝ :=
  (ν.rnDeriv (ν.fst.prod ν.snd) (x, z)).toReal

/-- Section 2.4: the regression function `E[Y | X = x]`, the mean of the conditional law of `Y`
given `X = x`. -/
def regX (ρ : Measure (X × Z × ℝ)) [IsFiniteMeasure ρ] (x : X) : ℝ :=
  ∫ y, y ∂((ρ.map (fun t => (t.1, t.2.2))).condKernel x)

/-- Section 2.4: the regression function `E[Y | Z = z]`. -/
def regZ (ρ : Measure (X × Z × ℝ)) [IsFiniteMeasure ρ] (z : Z) : ℝ :=
  ∫ y, y ∂((ρ.map (fun t => (t.2.1, t.2.2))).condKernel z)

/-- Section 2.4: the regression function `E[Y | (X, Z) = (x, z)]`. -/
def regXZ (ρ : Measure (X × Z × ℝ)) [IsFiniteMeasure ρ] (x : X) (z : Z) : ℝ :=
  ∫ y, y ∂((ρ.map (fun t => ((t.1, t.2.1), t.2.2))).condKernel (x, z))

/-- Section 2.4: `μ(x) = E[E[Y | Z] | X = x]`, the mean of `z ↦ E[Y | Z = z]` under the
conditional law of `Z` given `X = x`. -/
def muFn [StandardBorelSpace Z] [Nonempty Z] (ρ : Measure (X × Z × ℝ)) [IsFiniteMeasure ρ]
    (x : X) : ℝ :=
  ∫ z, regZ ρ z ∂((lawXZ ρ).condKernel x)

/-- Section 2.4: `ε_X = E[(E[Y | X] - E[Y | X, Z])²]`. -/
def epsX (ρ : Measure (X × Z × ℝ)) [IsFiniteMeasure ρ] : ℝ :=
  ∫ t, (regX ρ t.1 - regXZ ρ t.1 t.2.1) ^ 2 ∂ρ

/-- Section 2.4: `ε_Z = E[(E[Y | Z] - E[Y | X, Z])²]`. -/
def epsZ (ρ : Measure (X × Z × ℝ)) [IsFiniteMeasure ρ] : ℝ :=
  ∫ t, (regZ ρ t.2.1 - regXZ ρ t.1 t.2.1) ^ 2 ∂ρ

/-- Lemma 1: `ε_μ := ε_X + 2 √(ε_X ε_Z) + ε_Z`. -/
def epsMu (ρ : Measure (X × Z × ℝ)) [IsFiniteMeasure ρ] : ℝ :=
  epsX ρ + 2 * Real.sqrt (epsX ρ * epsZ ρ) + epsZ ρ

/-- Section 3: the landmark embedding `x ↦ (g(x, Z₁), …, g(x, Z_m))` of a bivariate function `g`
with landmarks `zs = (Z₁, …, Z_m)`; `φ⋆` is the case `g = g⋆`. -/
def landmarkEmbedding {m : ℕ} (g : X → Z → ℝ) (zs : Fin m → Z) (x : X) : Fin m → ℝ :=
  fun i => g x (zs i)

/-- Lemma 2: `var(E[Y₁ | Z₁] g⋆(X, Z₁))` with `(X, Z₁) ∼ p_X ⊗ p_Z`, as an element of `[0, ∞]`. -/
def landmarkVar (ρ : Measure (X × Z × ℝ)) [IsFiniteMeasure ρ] : ℝ≥0∞ :=
  evariance (fun p : X × Z => regZ ρ p.2 * densityRatio (lawXZ ρ) p.1 p.2)
    ((lawXZ ρ).fst.prod (lawXZ ρ).snd)

/-- Lemma 2: `ε_lm := 2 var(E[Y₁ | Z₁] g⋆(X, Z₁)) / n` for the block size `n`; the paper takes
`n = ⌊m / log₂(1/δ)⌋`. -/
def epsLm (ρ : Measure (X × Z × ℝ)) [IsFiniteMeasure ρ] (n : ℕ) : ℝ :=
  2 * (landmarkVar ρ).toReal / n

/-- Eq. (3): the risk `R(φ) = inf_{w ∈ ℝ^m} E[(wᵀφ(X) - μ(X))²]` of an embedding `φ : X → ℝ^m`,
as an element of `[0, ∞]`. -/
def risk [StandardBorelSpace Z] [Nonempty Z] (ρ : Measure (X × Z × ℝ)) [IsFiniteMeasure ρ]
    {m : ℕ} (φ : X → Fin m → ℝ) : ℝ≥0∞ :=
  ⨅ w : Fin m → ℝ, ∫⁻ x, ENNReal.ofReal ((∑ i, w i * φ x i - muFn ρ x) ^ 2) ∂(lawXZ ρ).fst

/-- Section 2.2: the contrastive distribution `D_contrast` of `(X_c, Z_c, Y_c)`: with probability
`1/2` a pair `(X, Z) ∼ p_{X,Z}` with `Y_c = 1`, otherwise `(X, Z̃) ∼ p_X ⊗ p_Z` with `Y_c = -1`. -/
def contrastDist (ν : Measure (X × Z)) : Measure (X × Z × ℝ) :=
  (2⁻¹ : ℝ≥0∞) • ν.map (fun p => (p.1, p.2, (1 : ℝ))) +
    (2⁻¹ : ℝ≥0∞) • (ν.fst.prod ν.snd).map (fun p => (p.1, p.2, (-1 : ℝ)))

/-- Eq. (1): the logistic contrastive loss `L_lm(f) = E[log(1 + exp(-Y_c f(X_c, Z_c)))]`. -/
def lossLm (ν : Measure (X × Z)) (f : X → Z → ℝ) : ℝ :=
  ∫ t, Real.log (1 + Real.exp (-(t.2.2 * f t.1 t.2.1))) ∂(contrastDist ν)

/-- Eq. (2): the direct contrastive loss `L_direct(f) = E[log(1 + 1 / f(X_c, Z_c)^{Y_c})]`, for
`f > 0`. -/
def lossDirect (ν : Measure (X × Z)) (f : X → Z → ℝ) : ℝ :=
  ∫ t, Real.log (1 + 1 / f t.1 t.2.1 ^ t.2.2) ∂(contrastDist ν)

/-- Section 4: the bivariate function `(x, z) ↦ η(x)ᵀψ(z)` of a pair of embeddings. -/
def innerEmb {m : ℕ} (η : X → Fin m → ℝ) (ψ : Z → Fin m → ℝ) (x : X) (z : Z) : ℝ :=
  ∑ i, η x i * ψ z i

/-- Lemma 6: `ε_direct(η, ψ) = E[(η(X)ᵀψ(Z̃) - g⋆(X, Z̃))²]` with `(X, Z̃) ∼ p_X ⊗ p_Z`, as an
element of `[0, ∞]`. -/
def epsDirect (ν : Measure (X × Z)) {m : ℕ} (η : X → Fin m → ℝ) (ψ : Z → Fin m → ℝ) : ℝ≥0∞ :=
  ∫⁻ p, ENNReal.ofReal ((innerEmb η ψ p.1 p.2 - densityRatio ν p.1 p.2) ^ 2) ∂(ν.fst.prod ν.snd)

/-- Theorem 10: the excess landmark loss `ε_opt,lm = L_lm(f) - L_lm(log ∘ g⋆)`. The term
`L_lm(log ∘ g⋆)` is written in odds form as `L_direct(g⋆)`, which equals it and keeps the
correct value `0` of the loss at points where `g⋆ = 0`. -/
def epsOptLm (ν : Measure (X × Z)) (f : X → Z → ℝ) : ℝ :=
  lossLm ν f - lossDirect ν (densityRatio ν)

/-- Theorem 11: the excess direct loss `ε_opt,direct = L_direct((x, z) ↦ η(x)ᵀψ(z)) - L_direct(g⋆)`. -/
def epsOptDirect (ν : Measure (X × Z)) {m : ℕ} (η : X → Fin m → ℝ) (ψ : Z → Fin m → ℝ) : ℝ :=
  lossDirect ν (innerEmb η ψ) - lossDirect ν (densityRatio ν)

section Hidden

variable {H : Type*} [MeasurableSpace H]

/-- Section 4: `H ∼ ρH` renders `X` and `Z` conditionally independent, with conditional laws
`κX h` of `X` and `κZ h` of `Z` given `H = h`: `p_{X,Z} = ∫ p_{X|H}(· | h) ⊗ p_{Z|H}(· | h) dp_H(h)`. -/
def IsHiddenVariable (ν : Measure (X × Z)) (ρH : Measure H) (κX : Kernel H X) (κZ : Kernel H Z)
    [IsSFiniteKernel κX] [IsSFiniteKernel κZ] : Prop :=
  ν = ρH.bind (κX ×ₖ κZ)

/-- Lemma 7: the variance of `p_{X|H}(X | H̄) p_{Z|H}(Z̃ | H̄) / (p_X(X) p_Z(Z̃))` with
`(X, Z̃, H̄) ∼ p_X ⊗ p_Z ⊗ p_H`, as an element of `[0, ∞]`; each ratio `p_{X|H}(x | h) / p_X(x)` is
the Radon–Nikodym derivative of `κX h` with respect to `p_X`. -/
def hiddenVar [MeasurableSpace.CountableOrCountablyGenerated H X]
    [MeasurableSpace.CountableOrCountablyGenerated H Z] (ν : Measure (X × Z)) (ρH : Measure H)
    (κX : Kernel H X) (κZ : Kernel H Z) : ℝ≥0∞ :=
  evariance
    (fun t : X × Z × H =>
      (Kernel.rnDeriv κX (Kernel.const H ν.fst) t.2.2 t.1).toReal *
        (Kernel.rnDeriv κZ (Kernel.const H ν.snd) t.2.2 t.2.1).toReal)
    (ν.fst.prod (ν.snd.prod ρH))

end Hidden

/-- Section 3.3: the Gaussian model `H ∼ N(0, σ²)`, `X | H ∼ N(H, 1)`, `Z | H ∼ N(H, 1)`,
`X ⊥ Z | H`, with `v = σ²`: the law of `(H + E₁, H + E₂)` for independent `H ∼ N(0, σ²)`,
`E₁, E₂ ∼ N(0, 1)`. -/
def gaussianModel (v : ℝ≥0) : Measure (ℝ × ℝ) :=
  ((gaussianReal 0 v).prod ((gaussianReal 0 1).prod (gaussianReal 0 1))).map
    (fun t => (t.1 + t.2.1, t.1 + t.2.2))

end MultiViewRedundancy
Source
Tosh, Krishnamurthy and Hsu, Contrastive learning, multi-view redundancy, and linear models, arXiv:2008.10150v2 (2021), Sections 2.1-2.4 (pp. 6-7), 3 and 3.3 (pp. 7-9), 4 (pp. 10-11), 5 and eq. (3) (p. 12)
Read-back

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

Setting (applies to every declaration below). XXX and ZZZ are arbitrary measurable spaces with no further assumptions unless a declaration states otherwise. ρ\rhoρ always denotes a measure on X×Z×RX \times Z \times \mathbb{R}X×Z×R, with points written (x,z,y)(x, z, y)(x,z,y). ν\nuν always denotes a measure on X×ZX \times ZX×Z.

None of these measures is required to be a probability measure. Some declarations require ρ\rhoρ to be finite, and this is stated where it applies.

Integration conventions:

  • "∫⋯\int \cdots∫⋯" is the Bochner integral, which returns 000 whenever the integrand is not integrable.
  • "∫−⋯\int^{-}\cdots∫−⋯" is the lower Lebesgue integral of a [0,∞][0,\infty][0,∞]-valued function, which always has a value.

Arithmetic conventions:

  • a0=0\tfrac{a}{0} = 00a​=0.
  • log⁡t\log tlogt means log⁡∣t∣\log|t|log∣t∣, with log⁡0=0\log 0 = 0log0=0.
  • Converting ∞∈[0,∞]\infty \in [0,\infty]∞∈[0,∞] to a real number gives 000.

lawXZ. For a measure ρ\rhoρ on X×Z×RX \times Z \times \mathbb{R}X×Z×R, ρXZ\rho_{XZ}ρXZ​ is the pushforward of ρ\rhoρ under the projection (x,z,y)↦(x,z)(x, z, y) \mapsto (x, z)(x,z,y)↦(x,z). It has the same total mass as ρ\rhoρ.

Its two marginals are written as follows:

  • ρX\rho_XρX​ is the pushforward of ρXZ\rho_{XZ}ρXZ​ to XXX.
  • ρZ\rho_ZρZ​ is the pushforward of ρXZ\rho_{XZ}ρXZ​ to ZZZ.

densityRatio. For a measure ν\nuν on X×ZX \times ZX×Z, let νX\nu_XνX​ and νZ\nu_ZνZ​ be its marginals on XXX and ZZZ. For x∈Xx \in Xx∈X and z∈Zz \in Zz∈Z,

gν⋆(x,z)=dνd(νX⊗νZ)(x,z),g^\star_\nu(x, z) = \frac{d\nu}{d(\nu_X \otimes \nu_Z)}(x, z),gν⋆​(x,z)=d(νX​⊗νZ​)dν​(x,z),

converted to a real number. The derivative is the library's fixed version of the Radon–Nikodym derivative of ν\nuν with respect to the product of its marginals. Several caveats apply:

  • No absolute continuity assumed. If ν\nuν is not absolutely continuous with respect to νX⊗νZ\nu_X \otimes \nu_ZνX​⊗νZ​, this is the derivative of the absolutely continuous part only.
  • Non-decomposable case. If no Lebesgue decomposition exists, the derivative is 000 everywhere.
  • Infinite values. Points where the derivative equals ∞\infty∞ give the value 000.
  • Pointwise values are a fixed choice. The derivative is determined only almost everywhere, so the value at a particular point is a fixed but arbitrary choice.
  • No normalisation. If ν=cP\nu = cPν=cP for a probability measure PPP, then νX⊗νZ=c2PX⊗PZ\nu_X \otimes \nu_Z = c^2 P_X \otimes P_ZνX​⊗νZ​=c2PX​⊗PZ​, so gν⋆=c−1gP⋆g^\star_\nu = c^{-1} g^\star_Pgν⋆​=c−1gP⋆​ almost everywhere.

regX. Let ρ\rhoρ be a finite measure on X×Z×RX \times Z \times \mathbb{R}X×Z×R. Let ρXY\rho_{XY}ρXY​ be its pushforward under (x,z,y)↦(x,y)(x, z, y) \mapsto (x, y)(x,z,y)↦(x,y), and let κXY\kappa^{XY}κXY be the library's chosen conditional kernel of ρXY\rho_{XY}ρXY​. This is a Markov kernel from XXX to R\mathbb{R}R satisfying ρXY=(ρXY)X⊗κXY\rho_{XY} = (\rho_{XY})_X \otimes \kappa^{XY}ρXY​=(ρXY​)X​⊗κXY; it is determined only for (ρXY)X(\rho_{XY})_X(ρXY​)X​-almost every xxx. For x∈Xx \in Xx∈X,

rX(x)=∫Ry dκxXY(y).r_X(x) = \int_{\mathbb{R}} y \, d\kappa^{XY}_x(y).rX​(x)=∫R​ydκxXY​(y).

The value is 000 if yyy is not integrable under κxXY\kappa^{XY}_xκxXY​.


regZ. Let ρ\rhoρ be a finite measure on X×Z×RX \times Z \times \mathbb{R}X×Z×R. Let κZY\kappa^{ZY}κZY be the library's chosen conditional kernel, a Markov kernel from ZZZ to R\mathbb{R}R, of the pushforward of ρ\rhoρ under (x,z,y)↦(z,y)(x, z, y) \mapsto (z, y)(x,z,y)↦(z,y). It is determined only for almost every zzz with respect to the ZZZ-marginal. For z∈Zz \in Zz∈Z,

rZ(z)=∫Ry dκzZY(y).r_Z(z) = \int_{\mathbb{R}} y \, d\kappa^{ZY}_z(y).rZ​(z)=∫R​ydκzZY​(y).

The value is 000 if yyy is not integrable under κzZY\kappa^{ZY}_zκzZY​.


regXZ. Let ρ\rhoρ be a finite measure on X×Z×RX \times Z \times \mathbb{R}X×Z×R. Let κ(XZ)Y\kappa^{(XZ)Y}κ(XZ)Y be the library's chosen conditional kernel, a Markov kernel from X×ZX \times ZX×Z to R\mathbb{R}R, of the pushforward of ρ\rhoρ under (x,z,y)↦((x,z),y)(x, z, y) \mapsto ((x, z), y)(x,z,y)↦((x,z),y). It is determined only for ρXZ\rho_{XZ}ρXZ​-almost every (x,z)(x, z)(x,z). For x∈Xx \in Xx∈X and z∈Zz \in Zz∈Z,

rXZ(x,z)=∫Ry dκ(x,z)(XZ)Y(y).r_{XZ}(x, z) = \int_{\mathbb{R}} y \, d\kappa^{(XZ)Y}_{(x,z)}(y).rXZ​(x,z)=∫R​ydκ(x,z)(XZ)Y​(y).

The value is 000 if yyy is not integrable under κ(x,z)(XZ)Y\kappa^{(XZ)Y}_{(x,z)}κ(x,z)(XZ)Y​.


muFn. Assume ZZZ is a nonempty standard Borel space and ρ\rhoρ is a finite measure on X×Z×RX \times Z \times \mathbb{R}X×Z×R. Let κXZ\kappa^{XZ}κXZ be the library's chosen conditional kernel, a Markov kernel from XXX to ZZZ, of ρXZ\rho_{XZ}ρXZ​, the pushforward of ρ\rhoρ to X×ZX \times ZX×Z. It is determined only for ρX\rho_XρX​-almost every xxx. For x∈Xx \in Xx∈X,

μρ(x)=∫ZrZ(z) dκxXZ(z).\mu_\rho(x) = \int_Z r_Z(z) \, d\kappa^{XZ}_x(z).μρ​(x)=∫Z​rZ​(z)dκxXZ​(z).

Here rZ(z)r_Z(z)rZ​(z) is the mean of the chosen conditional law of yyy given zzz, as in regZ. The value is 000 if rZr_ZrZ​ is not integrable under κxXZ\kappa^{XZ}_xκxXZ​.


epsX. For a finite measure ρ\rhoρ on X×Z×RX \times Z \times \mathbb{R}X×Z×R,

εX(ρ)=∫X×Z×R(rX(x)−rXZ(x,z))2 dρ(x,z,y).\varepsilon_X(\rho) = \int_{X \times Z \times \mathbb{R}} \big(r_X(x) - r_{XZ}(x, z)\big)^2 \, d\rho(x, z, y).εX​(ρ)=∫X×Z×R​(rX​(x)−rXZ​(x,z))2dρ(x,z,y).

The ingredients are:

  • rX(x)r_X(x)rX​(x) is the mean of the chosen conditional law of yyy given xxx.
  • rXZ(x,z)r_{XZ}(x,z)rXZ​(x,z) is the mean of the chosen conditional law of yyy given (x,z)(x,z)(x,z).

These conditional means are taken from the library's chosen disintegration kernels, with 000 wherever yyy is not integrable. The integral is taken against ρ\rhoρ itself, not a normalised version. It is 000 if the integrand is not integrable, and it is always ≥0\ge 0≥0.


epsZ. For a finite measure ρ\rhoρ on X×Z×RX \times Z \times \mathbb{R}X×Z×R,

εZ(ρ)=∫X×Z×R(rZ(z)−rXZ(x,z))2 dρ(x,z,y).\varepsilon_Z(\rho) = \int_{X \times Z \times \mathbb{R}} \big(r_Z(z) - r_{XZ}(x, z)\big)^2 \, d\rho(x, z, y).εZ​(ρ)=∫X×Z×R​(rZ​(z)−rXZ​(x,z))2dρ(x,z,y).

The ingredients are:

  • rZ(z)r_Z(z)rZ​(z) is the mean of the chosen conditional law of yyy given zzz.
  • rXZ(x,z)r_{XZ}(x,z)rXZ​(x,z) is the mean of the chosen conditional law of yyy given (x,z)(x,z)(x,z).

Both come from the library's chosen disintegration kernels, with 000 wherever yyy is not integrable. The integral is taken against unnormalised ρ\rhoρ, is 000 if the integrand is not integrable, and is always ≥0\ge 0≥0.


epsMu. For a finite measure ρ\rhoρ on X×Z×RX \times Z \times \mathbb{R}X×Z×R,

εμ(ρ)=εX(ρ)+2εX(ρ) εZ(ρ)+εZ(ρ).\varepsilon_\mu(\rho) = \varepsilon_X(\rho) + 2\sqrt{\varepsilon_X(\rho)\,\varepsilon_Z(\rho)} + \varepsilon_Z(\rho).εμ​(ρ)=εX​(ρ)+2εX​(ρ)εZ​(ρ)​+εZ​(ρ).

Here εX\varepsilon_XεX​ and εZ\varepsilon_ZεZ​ are defined as follows (Bochner integrals, 000 if not integrable):

  • εX(ρ)=∫(rX(x)−rXZ(x,z))2 dρ\varepsilon_X(\rho) = \int (r_X(x) - r_{XZ}(x,z))^2 \, d\rhoεX​(ρ)=∫(rX​(x)−rXZ​(x,z))2dρ.
  • εZ(ρ)=∫(rZ(z)−rXZ(x,z))2 dρ\varepsilon_Z(\rho) = \int (r_Z(z) - r_{XZ}(x,z))^2 \, d\rhoεZ​(ρ)=∫(rZ​(z)−rXZ​(x,z))2dρ.

The functions rXr_XrX​, rZr_ZrZ​, rXZr_{XZ}rXZ​ are the means of the library-chosen conditional laws of yyy given xxx, given zzz, and given (x,z)(x,z)(x,z), respectively.


landmarkEmbedding. Given:

  • a natural number mmm,
  • a function g:X×Z→Rg : X \times Z \to \mathbb{R}g:X×Z→R,
  • points z1,…,zm∈Zz_1, \dots, z_m \in Zz1​,…,zm​∈Z,

the map φ:X→Rm\varphi : X \to \mathbb{R}^mφ:X→Rm is

φ(x)=(g(x,z1),…,g(x,zm)).\varphi(x) = \big(g(x, z_1), \dots, g(x, z_m)\big).φ(x)=(g(x,z1​),…,g(x,zm​)).

When m=0m = 0m=0, φ(x)\varphi(x)φ(x) is the empty vector.


landmarkVar. Let ρ\rhoρ be a finite measure on X×Z×RX \times Z \times \mathbb{R}X×Z×R, with ρXZ\rho_{XZ}ρXZ​ its pushforward to X×ZX \times ZX×Z and ρX\rho_XρX​, ρZ\rho_ZρZ​ the marginals. Define F(x,z)=rZ(z) g⋆(x,z)F(x, z) = r_Z(z)\, g^\star(x, z)F(x,z)=rZ​(z)g⋆(x,z), where:

  • rZ(z)r_Z(z)rZ​(z) is the mean of the library-chosen conditional law of yyy given zzz (and 000 if yyy is not integrable).
  • g⋆(x,z)g^\star(x, z)g⋆(x,z) is the real-valued Radon–Nikodym derivative dρXZd(ρX⊗ρZ)(x,z)\frac{d\rho_{XZ}}{d(\rho_X \otimes \rho_Z)}(x, z)d(ρX​⊗ρZ​)dρXZ​​(x,z), with the caveats of densityRatio: absolutely continuous part only, ∞↦0\infty \mapsto 0∞↦0, fixed representative.

The value, in [0,∞][0, \infty][0,∞], is

V(ρ)=∫−∣F(x,z)−mF∣2 d(ρX⊗ρZ)(x,z),mF=∫F d(ρX⊗ρZ).V(\rho) = \int^{-} \big|F(x, z) - m_F\big|^2 \, d(\rho_X \otimes \rho_Z)(x, z), \qquad m_F = \int F \, d(\rho_X \otimes \rho_Z).V(ρ)=∫−​F(x,z)−mF​​2d(ρX​⊗ρZ​)(x,z),mF​=∫Fd(ρX​⊗ρZ​).

The mean mFm_FmF​ is 000 if FFF is not integrable. The product measure ρX⊗ρZ\rho_X \otimes \rho_ZρX​⊗ρZ​ is not normalised; it has total mass equal to the square of ρ\rhoρ's mass.


epsLm. For a finite measure ρ\rhoρ on X×Z×RX \times Z \times \mathbb{R}X×Z×R and a natural number nnn,

εlm(ρ,n)=2 V(ρ)n.\varepsilon_{\mathrm{lm}}(\rho, n) = \frac{2\, V(\rho)}{n}.εlm​(ρ,n)=n2V(ρ)​.

V(ρ)∈[0,∞]V(\rho) \in [0,\infty]V(ρ)∈[0,∞] is the quantity of landmarkVar, namely

∫−∣F−mF∣2 d(ρX⊗ρZ),F(x,z)=rZ(z) g⋆(x,z).\int^{-} |F - m_F|^2 \, d(\rho_X \otimes \rho_Z), \qquad F(x,z) = r_Z(z)\, g^\star(x,z).∫−∣F−mF​∣2d(ρX​⊗ρZ​),F(x,z)=rZ​(z)g⋆(x,z).

V(ρ)V(\rho)V(ρ) is converted to a real number, so V(ρ)=∞V(\rho) = \inftyV(ρ)=∞ yields 000. When n=0n = 0n=0 the value is 000 (division by zero).


risk. Assume ZZZ is a nonempty standard Borel space, ρ\rhoρ is a finite measure on X×Z×RX \times Z \times \mathbb{R}X×Z×R, m∈Nm \in \mathbb{N}m∈N, and φ:X→Rm\varphi : X \to \mathbb{R}^mφ:X→Rm is an arbitrary function (no measurability assumed). The value, in [0,∞][0,\infty][0,∞], is

Rρ(φ)=inf⁡w∈Rm∫X−(∑i=1mwi φi(x)−μρ(x))2 dρX(x).R_\rho(\varphi) = \inf_{w \in \mathbb{R}^m} \int^{-}_X \Big(\sum_{i=1}^m w_i\, \varphi_i(x) - \mu_\rho(x)\Big)^2 \, d\rho_X(x).Rρ​(φ)=w∈Rminf​∫X−​(i=1∑m​wi​φi​(x)−μρ​(x))2dρX​(x).

The ingredients are:

  • ρX\rho_XρX​ is the (unnormalised) XXX-marginal of ρ\rhoρ.
  • μρ\mu_\rhoμρ​ is the function of muFn: μρ(x)=∫rZ dκxXZ\mu_\rho(x) = \int r_Z \, d\kappa^{XZ}_xμρ​(x)=∫rZ​dκxXZ​, using the library-chosen conditional kernels.

When m=0m = 0m=0, the sum is empty and Rρ(φ)=∫−μρ2 dρXR_\rho(\varphi) = \int^{-} \mu_\rho^2 \, d\rho_XRρ​(φ)=∫−μρ2​dρX​.


contrastDist. For a measure ν\nuν on X×ZX \times ZX×Z with marginals νX\nu_XνX​ and νZ\nu_ZνZ​, DνD_\nuDν​ is the measure on X×Z×RX \times Z \times \mathbb{R}X×Z×R defined by

Dν=12 (ν pushed forward by (x,z)↦(x,z,1))  +  12 (νX⊗νZ pushed forward by (x,z)↦(x,z,−1)).D_\nu = \tfrac12\, (\nu \text{ pushed forward by } (x,z) \mapsto (x, z, 1)) \;+\; \tfrac12\, (\nu_X \otimes \nu_Z \text{ pushed forward by } (x,z) \mapsto (x, z, -1)).Dν​=21​(ν pushed forward by (x,z)↦(x,z,1))+21​(νX​⊗νZ​ pushed forward by (x,z)↦(x,z,−1)).

It is a probability measure when ν\nuν is one. In general, if ν\nuν has total mass ccc, then DνD_\nuDν​ has total mass (c+c2)/2(c + c^2)/2(c+c2)/2.


lossLm. For a measure ν\nuν on X×ZX \times ZX×Z and an arbitrary f:X×Z→Rf : X \times Z \to \mathbb{R}f:X×Z→R,

Llm(ν,f)=∫log⁡ ⁣(1+e−y f(x,z)) dDν(x,z,y).L_{\mathrm{lm}}(\nu, f) = \int \log\!\big(1 + e^{-y\, f(x, z)}\big) \, dD_\nu(x, z, y).Llm​(ν,f)=∫log(1+e−yf(x,z))dDν​(x,z,y).

DνD_\nuDν​ is the measure of contrastDist, namely 12(ν tagged y=1)+12(νX⊗νZ tagged y=−1)\tfrac12(\nu \text{ tagged } y{=}1) + \tfrac12(\nu_X \otimes \nu_Z \text{ tagged } y{=}-1)21​(ν tagged y=1)+21​(νX​⊗νZ​ tagged y=−1). When the integrand is integrable with respect to both parts, this equals

12∫log⁡(1+e−f) dν+12∫log⁡(1+ef) d(νX⊗νZ).\tfrac12 \int \log(1 + e^{-f}) \, d\nu + \tfrac12 \int \log(1 + e^{f}) \, d(\nu_X \otimes \nu_Z).21​∫log(1+e−f)dν+21​∫log(1+ef)d(νX​⊗νZ​).

The value is 000 if the integrand is not integrable with respect to DνD_\nuDν​.


lossDirect. For a measure ν\nuν on X×ZX \times ZX×Z and an arbitrary f:X×Z→Rf : X \times Z \to \mathbb{R}f:X×Z→R (no positivity assumed),

Ldirect(ν,f)=∫log⁡ ⁣(1+1f(x,z) y) dDν(x,z,y).L_{\mathrm{direct}}(\nu, f) = \int \log\!\Big(1 + \frac{1}{f(x,z)^{\,y}}\Big) \, dD_\nu(x, z, y).Ldirect​(ν,f)=∫log(1+f(x,z)y1​)dDν​(x,z,y).

Here DνD_\nuDν​ is the measure of contrastDist, and fyf^yfy is the real power.

Only y=±1y = \pm 1y=±1 occur, and the real power satisfies f1=ff^1 = ff1=f and f−1=1/ff^{-1} = 1/ff−1=1/f. Combined with the conventions 1/0=01/0 = 01/0=0, log⁡t=log⁡∣t∣\log t = \log|t|logt=log∣t∣ and log⁡0=0\log 0 = 0log0=0, the integrand is:

  • log⁡(1+1/f(x,z))\log(1 + 1/f(x,z))log(1+1/f(x,z)) on the ν\nuν-part (y=1y = 1y=1);
  • log⁡(1+f(x,z))\log(1 + f(x,z))log(1+f(x,z)) on the νX⊗νZ\nu_X \otimes \nu_ZνX​⊗νZ​-part (y=−1y = -1y=−1).

At points where f=0f = 0f=0, both expressions equal 000. When integrable, the value equals

12∫log⁡(1+1/f) dν+12∫log⁡(1+f) d(νX⊗νZ).\tfrac12\int \log(1 + 1/f)\,d\nu + \tfrac12\int \log(1+f)\,d(\nu_X\otimes\nu_Z).21​∫log(1+1/f)dν+21​∫log(1+f)d(νX​⊗νZ​).

It is 000 if the integrand is not integrable with respect to DνD_\nuDν​.


innerEmb. For m∈Nm \in \mathbb{N}m∈N, η:X→Rm\eta : X \to \mathbb{R}^mη:X→Rm and ψ:Z→Rm\psi : Z \to \mathbb{R}^mψ:Z→Rm,

⟨η,ψ⟩(x,z)=∑i=1mηi(x) ψi(z).\langle \eta, \psi\rangle(x, z) = \sum_{i=1}^m \eta_i(x)\, \psi_i(z).⟨η,ψ⟩(x,z)=i=1∑m​ηi​(x)ψi​(z).

This is identically 000 when m=0m = 0m=0.


epsDirect. For a measure ν\nuν on X×ZX \times ZX×Z, m∈Nm \in \mathbb{N}m∈N, η:X→Rm\eta : X \to \mathbb{R}^mη:X→Rm and ψ:Z→Rm\psi : Z \to \mathbb{R}^mψ:Z→Rm, the value, in [0,∞][0,\infty][0,∞], is

εdirect(ν,η,ψ)=∫−(∑i=1mηi(x)ψi(z)−gν⋆(x,z))2 d(νX⊗νZ)(x,z).\varepsilon_{\mathrm{direct}}(\nu, \eta, \psi) = \int^{-} \Big(\sum_{i=1}^m \eta_i(x)\psi_i(z) - g^\star_\nu(x, z)\Big)^2 \, d(\nu_X \otimes \nu_Z)(x, z).εdirect​(ν,η,ψ)=∫−(i=1∑m​ηi​(x)ψi​(z)−gν⋆​(x,z))2d(νX​⊗νZ​)(x,z).

gν⋆g^\star_\nugν⋆​ is the real-valued Radon–Nikodym derivative dνd(νX⊗νZ)\frac{d\nu}{d(\nu_X \otimes \nu_Z)}d(νX​⊗νZ​)dν​, with the caveats of densityRatio: absolutely continuous part only, ∞↦0\infty \mapsto 0∞↦0, fixed representative, no normalisation.


epsOptLm. For a measure ν\nuν on X×ZX \times ZX×Z and an arbitrary f:X×Z→Rf : X \times Z \to \mathbb{R}f:X×Z→R,

εopt,lm(ν,f)=Llm(ν,f)−Ldirect(ν,gν⋆).\varepsilon_{\mathrm{opt,lm}}(\nu, f) = L_{\mathrm{lm}}(\nu, f) - L_{\mathrm{direct}}(\nu, g^\star_\nu).εopt,lm​(ν,f)=Llm​(ν,f)−Ldirect​(ν,gν⋆​).

The three ingredients are:

  • Llm(ν,f)=∫log⁡(1+e−yf(x,z)) dDνL_{\mathrm{lm}}(\nu, f) = \int \log(1 + e^{-y f(x,z)})\, dD_\nuLlm​(ν,f)=∫log(1+e−yf(x,z))dDν​.
  • gν⋆g^\star_\nugν⋆​ is the real-valued Radon–Nikodym derivative dνd(νX⊗νZ)\frac{d\nu}{d(\nu_X\otimes\nu_Z)}d(νX​⊗νZ​)dν​, as in densityRatio.
  • Ldirect(ν,gν⋆)L_{\mathrm{direct}}(\nu, g^\star_\nu)Ldirect​(ν,gν⋆​), when integrable, equals
12∫log⁡(1+1/gν⋆) dν+12∫log⁡(1+gν⋆) d(νX⊗νZ),\tfrac12\int \log(1 + 1/g^\star_\nu)\, d\nu + \tfrac12 \int \log(1 + g^\star_\nu)\, d(\nu_X\otimes\nu_Z),21​∫log(1+1/gν⋆​)dν+21​∫log(1+gν⋆​)d(νX​⊗νZ​),

with 1/0=01/0 = 01/0=0, so points where gν⋆=0g^\star_\nu = 0gν⋆​=0 contribute 000.

Each loss is separately 000 if its integrand is not integrable with respect to DνD_\nuDν​, the measure of contrastDist.


epsOptDirect. For a measure ν\nuν on X×ZX \times ZX×Z, m∈Nm \in \mathbb{N}m∈N, η:X→Rm\eta : X \to \mathbb{R}^mη:X→Rm and ψ:Z→Rm\psi : Z \to \mathbb{R}^mψ:Z→Rm,

εopt,direct(ν,η,ψ)=Ldirect(ν,(x,z)↦∑iηi(x)ψi(z))−Ldirect(ν,gν⋆).\varepsilon_{\mathrm{opt,direct}}(\nu, \eta, \psi) = L_{\mathrm{direct}}\big(\nu, (x,z) \mapsto \textstyle\sum_i \eta_i(x)\psi_i(z)\big) - L_{\mathrm{direct}}(\nu, g^\star_\nu).εopt,direct​(ν,η,ψ)=Ldirect​(ν,(x,z)↦∑i​ηi​(x)ψi​(z))−Ldirect​(ν,gν⋆​).

Here Ldirect(ν,f)L_{\mathrm{direct}}(\nu, f)Ldirect​(ν,f) is defined by

Ldirect(ν,f)=∫log⁡(1+1/f y) dDν.L_{\mathrm{direct}}(\nu, f) = \int \log(1 + 1/f^{\,y})\, dD_\nu.Ldirect​(ν,f)=∫log(1+1/fy)dDν​.

It reduces to 12∫log⁡(1+1/f) dν+12∫log⁡(1+f) d(νX⊗νZ)\tfrac12\int\log(1+1/f)\,d\nu + \tfrac12\int\log(1+f)\,d(\nu_X\otimes\nu_Z)21​∫log(1+1/f)dν+21​∫log(1+f)d(νX​⊗νZ​) when integrable, and to 000 otherwise. The conventions 1/0=01/0=01/0=0 and log⁡t=log⁡∣t∣\log t = \log|t|logt=log∣t∣ apply. The inner product ∑iηiψi\sum_i \eta_i\psi_i∑i​ηi​ψi​ is not required to be positive. gν⋆g^\star_\nugν⋆​ is the real-valued Radon–Nikodym derivative of ν\nuν with respect to νX⊗νZ\nu_X \otimes \nu_ZνX​⊗νZ​.


IsHiddenVariable. Let:

  • HHH be a measurable space,
  • ν\nuν be a measure on X×ZX \times ZX×Z,
  • ρH\rho_HρH​ be any measure on HHH (not required to be a probability measure),
  • κX\kappa^XκX be an s-finite kernel from HHH to XXX,
  • κZ\kappa^ZκZ be an s-finite kernel from HHH to ZZZ.

These kernels need not be Markov. The proposition asserts the equality of measures

ν=∫HκhX⊗κhZ  dρH(h).\nu = \int_H \kappa^X_h \otimes \kappa^Z_h \; d\rho_H(h).ν=∫H​κhX​⊗κhZ​dρH​(h).

Equivalently, ν(A)=∫H(κhX⊗κhZ)(A) dρH(h)\nu(A) = \int_H (\kappa^X_h \otimes \kappa^Z_h)(A)\, d\rho_H(h)ν(A)=∫H​(κhX​⊗κhZ​)(A)dρH​(h) for every measurable A⊆X×ZA \subseteq X \times ZA⊆X×Z.


hiddenVar. Let HHH be a measurable space such that each of the pairs (H,X)(H, X)(H,X) and (H,Z)(H, Z)(H,Z) satisfies the library's condition "HHH is countable or the target space is countably generated". Let ν\nuν be a measure on X×ZX \times ZX×Z, ρH\rho_HρH​ a measure on HHH, and κX\kappa^XκX, κZ\kappa^ZκZ kernels from HHH to XXX and to ZZZ.

No relation among ν\nuν, ρH\rho_HρH​, κX\kappa^XκX, κZ\kappa^ZκZ is assumed; in particular IsHiddenVariable is not assumed. Define

G(x,z,h)=dκhXdνX(x)⋅dκhZdνZ(z),G(x, z, h) = \frac{d\kappa^X_h}{d\nu_X}(x)\cdot\frac{d\kappa^Z_h}{d\nu_Z}(z),G(x,z,h)=dνX​dκhX​​(x)⋅dνZ​dκhZ​​(z),

where each factor is the library's jointly measurable kernel Radon–Nikodym derivative of κX\kappa^XκX (resp. κZ\kappa^ZκZ) with respect to the constant kernel νX\nu_XνX​ (resp. νZ\nu_ZνZ​). For each hhh, this agrees almost everywhere with the Radon–Nikodym derivative of the absolutely continuous part. Each factor is converted to a real number, with ∞↦0\infty \mapsto 0∞↦0. The value, in [0,∞][0,\infty][0,∞], is

∫−∣G−mG∣2 d(νX⊗(νZ⊗ρH)),mG=∫G d(νX⊗νZ⊗ρH).\int^{-} |G - m_G|^2 \, d\big(\nu_X \otimes (\nu_Z \otimes \rho_H)\big), \qquad m_G = \int G \, d\big(\nu_X \otimes \nu_Z \otimes \rho_H\big).∫−∣G−mG​∣2d(νX​⊗(νZ​⊗ρH​)),mG​=∫Gd(νX​⊗νZ​⊗ρH​).

The mean mGm_GmG​ is 000 if GGG is not integrable. The product measure is not normalised.


gaussianModel. For a real number v≥0v \ge 0v≥0, this is the law on R2\mathbb{R}^2R2 of (H+E1, H+E2)(H + E_1,\ H + E_2)(H+E1​, H+E2​), where HHH, E1E_1E1​, E2E_2E2​ are independent with

H∼N(0,v),E1,E2∼N(0,1).H \sim \mathcal{N}(0, v), \qquad E_1, E_2 \sim \mathcal{N}(0, 1).H∼N(0,v),E1​,E2​∼N(0,1).

Formally, it is the pushforward of N(0,v)⊗N(0,1)⊗N(0,1)\mathcal{N}(0,v) \otimes \mathcal{N}(0,1) \otimes \mathcal{N}(0,1)N(0,v)⊗N(0,1)⊗N(0,1) under (h,e1,e2)↦(h+e1,h+e2)(h, e_1, e_2) \mapsto (h + e_1, h + e_2)(h,e1​,e2​)↦(h+e1​,h+e2​). It is a probability measure. When v=0v = 0v=0, N(0,0)\mathcal{N}(0, 0)N(0,0) is the point mass at 000, so the law is N(0,1)⊗N(0,1)\mathcal{N}(0,1) \otimes \mathcal{N}(0,1)N(0,1)⊗N(0,1).

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