Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Proposition 3: asymptotics of Lδ-contr\mathcal{L}_{\delta\text{-contr}}Lδ-contr​ as the number of negatives grows

Proved
ContrastiveInverts.delta_infonce_asymptotics

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

contrastive-learningidentifiabilityinfoncenonlinear-icavon-mises-fisher

Let ZZZ and Z′Z'Z′ be convex bodies in RN\mathbb{R}^NRN, N≤KN\le KN≤K, λ>0\lambda>0λ>0 and τ>0\tau>0τ>0. Let δ\deltaδ be a metric induced by a norm, or a semi-metric j∘δ′j\circ\delta'j∘δ′ of such a metric. Let positive pairs be drawn as z∼p(z)=∣Z∣−1z\sim p(z)=|Z|^{-1}z∼p(z)=∣Z∣−1, z~∼p(z~∣z)=Cp(z)−1e−λδ(z~,z)\tilde z\sim p(\tilde z\mid z)=C_p(z)^{-1}e^{-\lambda\delta(\tilde z,z)}z~∼p(z~∣z)=Cp​(z)−1e−λδ(z~,z). Let ggg map ZZZ injectively into X⊆RK\mathcal X\subseteq\mathbb{R}^KX⊆RK, let the encoder fff map X\mathcal XX into Z′Z'Z′, and let h=f∘gh=f\circ gh=f∘g be measurable on ZZZ. Then

lim⁡M→∞(Lδ-contr(f;τ,M)−log⁡M)=Lδ-align(f;τ)+Lδ-unif(f;τ),\lim_{M\to\infty}\Big(\mathcal{L}_{\delta\text{-contr}}(f;\tau,M)-\log M\Big)=\mathcal{L}_{\delta\text{-align}}(f;\tau)+\mathcal{L}_{\delta\text{-unif}}(f;\tau),M→∞lim​(Lδ-contr​(f;τ,M)−logM)=Lδ-align​(f;τ)+Lδ-unif​(f;τ),

where Lδ-align(f;τ)=1τEz∼p(z), z~∼p(z~∣z) δ(h(z~),h(z))\mathcal{L}_{\delta\text{-align}}(f;\tau)=\frac1\tau\mathbb{E}_{z\sim p(z),\,\tilde z\sim p(\tilde z\mid z)}\,\delta(h(\tilde z),h(z))Lδ-align​(f;τ)=τ1​Ez∼p(z),z~∼p(z~∣z)​δ(h(z~),h(z)) and Lδ-unif(f;τ)=Ez∼p(z)log⁡Ez~∼p(z~)e−δ(h(z~),h(z))/τ\mathcal{L}_{\delta\text{-unif}}(f;\tau)=\mathbb{E}_{z\sim p(z)}\log\mathbb{E}_{\tilde z\sim p(\tilde z)}e^{-\delta(h(\tilde z),h(z))/\tau}Lδ-unif​(f;τ)=Ez∼p(z)​logEz~∼p(z~)​e−δ(h(z~),h(z))/τ, with p(z~)p(\tilde z)p(z~) the uniform marginal.

This is the convex-body analogue of the alignment–uniformity decomposition of Wang and Isola (2020).

Formalization Note The standing assumptions of Appendix A.2.1 are included: ZZZ and Z′Z'Z′ are convex bodies, ggg is injective on ZZZ, K≥NK\ge NK≥N, λ>0\lambda>0λ>0. Following eq. (5), δ\deltaδ is induced by a norm, which makes it continuous.

Preamble
import Mathlib
import Definitions.Def_ContrastiveInverts_Basic

open MeasureTheory Filter Topology
Formal statement
namespace ContrastiveInverts

theorem delta_infonce_asymptotics {N K : ℕ} (hNK : N ≤ K) (Z Z' : Set (Vec N))
    (hZ : IsConvexBody Z) (hZ' : IsConvexBody Z') (lam τ : ℝ) (hlam : 0 < lam) (hτ : 0 < τ)
    (δ : Vec N → Vec N → ℝ) (hδ : IsNormSemimetric δ)
    (X : Set (Vec K)) (g : Vec N → Vec K) (hgX : ∀ z ∈ Z, g z ∈ X) (hg_inj : Set.InjOn g Z)
    (f : Vec K → Vec N) (hf : ∀ x ∈ X, f x ∈ Z')
    (hmeas : AEMeasurable (f ∘ g) (volume.restrict Z)) :
    Tendsto (fun M : ℕ => deltaInfoNCE lam δ τ δ Z (f ∘ g) M - Real.log M) atTop
      (𝓝 (deltaAlign lam δ τ δ Z (f ∘ g) + deltaUnif τ δ Z (f ∘ g))) := by sorry

end ContrastiveInverts
Source
Zimmermann, Sharma, Schneider, Bethge and Brendel, Contrastive Learning Inverts the Data Generating Process, ICML 2021, arXiv:2102.08850v4, Appendix A.2.2, Proposition 3, p. 15 (proof pp. 15-16); Definition 1, eq. (6), p. 5; standing assumptions of Appendix A.2.1, p. 15
Read-back

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

Fix natural numbers N≤KN \le KN≤K. Write RN\mathbb{R}^NRN and RK\mathbb{R}^KRK for the Euclidean spaces, and Leb\mathrm{Leb}Leb for Lebesgue measure on RN\mathbb{R}^NRN. The statement takes the following data and hypotheses:

  • Two convex bodies Z,Z′⊆RNZ, Z' \subseteq \mathbb{R}^NZ,Z′⊆RN. Each is convex, compact and has nonempty interior. Nothing relates ZZZ and Z′Z'Z′ to each other. When N=0N = 0N=0, R0\mathbb{R}^0R0 is a single point and Z=Z′=R0Z = Z' = \mathbb{R}^0Z=Z′=R0 is allowed.
  • Real parameters λ>0\lambda > 0λ>0 and τ>0\tau > 0τ>0, with no relation between them.
  • A function δ:RN×RN→R\delta : \mathbb{R}^N \times \mathbb{R}^N \to \mathbb{R}δ:RN×RN→R. There must exist ν:RN→R\nu : \mathbb{R}^N \to \mathbb{R}ν:RN→R and j:R→Rj : \mathbb{R} \to \mathbb{R}j:R→R such that
δ(a,b)=j(ν(a−b))for all a,b.\delta(a,b) = j\big(\nu(a-b)\big) \quad \text{for all } a, b.δ(a,b)=j(ν(a−b))for all a,b.
  • ν\nuν satisfies:

    • ν(x)=0  ⟺  x=0\nu(x) = 0 \iff x = 0ν(x)=0⟺x=0;
    • ν(cx)=∣c∣ ν(x)\nu(cx) = |c|\,\nu(x)ν(cx)=∣c∣ν(x);
    • ν(x+y)≤ν(x)+ν(y)\nu(x+y) \le \nu(x) + \nu(y)ν(x+y)≤ν(x)+ν(y).

    So ν\nuν is a norm on RN\mathbb{R}^NRN, not necessarily Euclidean.

  • jjj maps [0,∞)[0,\infty)[0,∞) bijectively onto [0,∞)[0,\infty)[0,∞), is continuous on [0,∞)[0,\infty)[0,∞), and has j(0)=0j(0) = 0j(0)=0. Its values off [0,∞)[0,\infty)[0,∞) are unconstrained.

  • A set and two maps. A set X⊆RKX \subseteq \mathbb{R}^KX⊆RK; a map g:RN→RKg : \mathbb{R}^N \to \mathbb{R}^Kg:RN→RK with g(Z)⊆Xg(Z) \subseteq Xg(Z)⊆X and ggg injective on ZZZ; and a map f:RK→RNf : \mathbb{R}^K \to \mathbb{R}^Nf:RK→RN with f(X)⊆Z′f(X) \subseteq Z'f(X)⊆Z′.

    • No continuity is assumed for fff or ggg.
    • No injectivity is assumed for fff.
    • The only regularity assumed is that h:=f∘gh := f \circ gh:=f∘g is almost-everywhere measurable with respect to Leb\mathrm{Leb}Leb restricted to ZZZ.
    • The hypotheses force h(Z)⊆Z′h(Z) \subseteq Z'h(Z)⊆Z′.

Distributions. Let UZ=Leb(Z)−1 Leb∣ZU_Z = \mathrm{Leb}(Z)^{-1}\,\mathrm{Leb}|_ZUZ​=Leb(Z)−1Leb∣Z​ be the uniform probability measure on ZZZ. The ground-truth conditional uses the same δ\deltaδ and the rate λ\lambdaλ:

p(z′∣z)=e−λ δ(z′,z)Cp(z),Cp(z)=∫Ze−λ δ(z,w) dw.p(z' \mid z) = \frac{e^{-\lambda\,\delta(z',z)}}{C_p(z)}, \qquad C_p(z) = \int_Z e^{-\lambda\,\delta(z,w)}\,dw.p(z′∣z)=Cp​(z)e−λδ(z′,z)​,Cp​(z)=∫Z​e−λδ(z,w)dw.

Here a division by 000 would give 000. The positive-pair law PposP_{\mathrm{pos}}Ppos​ on RN×RN\mathbb{R}^N \times \mathbb{R}^NRN×RN is UZ⊗Leb∣ZU_Z \otimes \mathrm{Leb}|_ZUZ​⊗Leb∣Z​ with density (z,z~)↦max⁡(p(z~∣z),0)(z,\tilde z) \mapsto \max\big(p(\tilde z \mid z), 0\big)(z,z~)↦max(p(z~∣z),0).

InfoNCE objective. For each M∈NM \in \mathbb{N}M∈N:

LM=∫−log⁡e−δ(h(z),h(z~))/τe−δ(h(z),h(z~))/τ+∑i=1Me−δ(h(z),h(zi−))/τ  d(Ppos⊗UZ⊗M)((z,z~),(z1−,…,zM−)).L_M = \int -\log\frac{e^{-\delta(h(z),h(\tilde z))/\tau}}{e^{-\delta(h(z),h(\tilde z))/\tau} + \sum_{i=1}^{M} e^{-\delta(h(z),h(z_i^-))/\tau}}\; d\big(P_{\mathrm{pos}} \otimes U_Z^{\otimes M}\big)\big((z,\tilde z),(z_1^-,\dots,z_M^-)\big).LM​=∫−loge−δ(h(z),h(z~))/τ+∑i=1M​e−δ(h(z),h(zi−​))/τe−δ(h(z),h(z~))/τ​d(Ppos​⊗UZ⊗M​)((z,z~),(z1−​,…,zM−​)).

Alignment and uniformity terms.

A=1τ∫δ(h(z~),h(z)) dPpos(z,z~),\mathcal{A} = \frac{1}{\tau}\int \delta\big(h(\tilde z), h(z)\big)\, dP_{\mathrm{pos}}(z,\tilde z),A=τ1​∫δ(h(z~),h(z))dPpos​(z,z~), U=∫log⁡(∫e−δ(h(w),h(z))/τ dUZ(w)) dUZ(z).\mathcal{U} = \int \log\Big(\int e^{-\delta(h(w),h(z))/\tau}\, dU_Z(w)\Big)\, dU_Z(z).U=∫log(∫e−δ(h(w),h(z))/τdUZ​(w))dUZ​(z).

Conventions. All integrals are Bochner integrals, which are defined to be 000 when the integrand is not integrable. The logarithm satisfies log⁡0=0\log 0 = 0log0=0 and log⁡x=log⁡∣x∣\log x = \log|x|logx=log∣x∣, and log⁡0=0\log 0 = 0log0=0 also applies to the log⁡M\log MlogM term at M=0M = 0M=0.

Conclusion. As M→∞M \to \inftyM→∞ through the natural numbers,

LM−log⁡M  ⟶  A+U.L_M - \log M \;\longrightarrow\; \mathcal{A} + \mathcal{U}.LM​−logM⟶A+U.

The same δ\deltaδ appears in all three places: the data-generating conditional (with rate λ\lambdaλ), the contrastive objective, and both limit terms (with temperature τ\tauτ). The sets XXX and Z′Z'Z′ and the dimension KKK enter only through the stated range and injectivity conditions on ggg and fff.

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