Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Corollary 5.1.1 (as proved): competitive bound via intraclass concentration

Proved
ContrastiveUnsupervised.competitive_bound_subgaussian

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

contrastive-learninggeneralization-boundslatent-classesrademacher-complexityrepresentation-learning

Let the setting of Theorem 4.5 hold with the hinge loss: a countable set of classes with τ<1\tau<1τ<1, a pointwise separable class F\mathcal FF of measurable representations with ∥f∥≤R\|f\|\le R∥f∥≤R, and an empirical minimizer f^\widehat ff​ on M≥1M\ge1M≥1 tuples. There are absolute constants KKK and c′>0c'>0c′>0 such that, for every ε>0\varepsilon>0ε>0 and 0<δ≤1/20<\delta\le1/20<δ≤1/2, with probability at least 1−δ1-\delta1−δ over the training set, the following holds for every f∈Ff\in\mathcal Ff∈F such that f(X)f(X)f(X), X∼DcX\sim\mathcal D_cX∼Dc​, is σ2\sigma^2σ2-sub-Gaussian in every direction for every class ccc and ∥f(⋅)∥≤Rf\|f(\cdot)\|\le R_f∥f(⋅)∥≤Rf​:

Lsupμ(f^)≤γ(f) Lγ(f),supμ(f)+β s(f)+η GenM+ε.L^\mu_{sup}(\widehat f)\le\gamma(f)\,L^\mu_{\gamma(f),sup}(f)+\beta\,s(f)+\eta\,Gen_M+\varepsilon.Lsupμ​(f​)≤γ(f)Lγ(f),supμ​(f)+βs(f)+ηGenM​+ε.

Here γ(f)\gamma(f)γ(f) is the margin of Lemma 5.1 for Rf,σ,εR_f,\sigma,\varepsilonRf​,σ,ε, β=c′τ1−τ\beta=c'\frac{\tau}{1-\tau}β=c′1−ττ​, η=11−τ\eta=\frac{1}{1-\tau}η=1−τ1​, and GenM=K(R RS(F)/M+R2log⁡(1/δ)/M)Gen_M=K\big(R\,\mathcal R_{\mathcal S}(\mathcal F)/M+R^2\sqrt{\log(1/\delta)/M}\big)GenM​=K(RRS​(F)/M+R2log(1/δ)/M​).

Formalization Note The paper prints η=τ1−τ\eta=\frac{\tau}{1-\tau}η=1−ττ​. Combining Lemma 5.1 with Theorem 4.5, as the paper does, gives η=11−τ\eta=\frac1{1-\tau}η=1−τ1​, and the printed value is false (REPORT.md gives a counterexample). The sub-Gaussian hypothesis on fff, which the printed corollary leaves implicit in "γ(f)\gamma(f)γ(f) as defined in Lemma 5.1", is stated explicitly. The paper's O(⋅)O(\cdot)O(⋅) is an absolute constant KKK, and "with probability at least 1−δ1-\delta1−δ" means that the outer measure of the failure set is at most δ\deltaδ. The statement is restricted to δ≤1/2\delta\le1/2δ≤1/2 because the proof (Mohri et al., Theorem 3.1, and Hoeffding) produces log⁡(4/δ)\log(4/\delta)log(4/δ) and log⁡(2/δ)\log(2/\delta)log(2/δ). These are O(log⁡(1/δ))O(\log(1/\delta))O(log(1/δ)) only for δ\deltaδ bounded away from 111; for δ≤1/2\delta\le1/2δ≤1/2 the two forms agree up to the constant. Pointwise separability of F\mathcal FF and measurability of each fff are standing conventions the paper does not state. The hypothesis τ<1\tau<1τ<1 is implicit in the paper's division by 1−τ1-\tau1−τ.

Preamble
import Mathlib
import Definitions.Def_ContrastiveUnsupervised_Basic

open MeasureTheory Filter Topology

universe u v
Formal statement
namespace ContrastiveUnsupervised

theorem competitive_bound_subgaussian :
    ∃ K c' : ℝ, 0 < c' ∧
      ∀ {X : Type u} [MeasurableSpace X] {C : Type v} [Countable C] {d : ℕ}
      (D : C → Measure X) (ρ : C → ℝ), IsLatentClassModel D ρ → collisionProb ρ < 1 →
      ∀ (R : ℝ), 0 < R →
      ∀ (F : Set (X → Rep d)), (∀ f ∈ F, IsBoundedRep f R) → IsPointwiseSeparable F →
      ∀ (M : ℕ), 1 ≤ M →
      ∀ (fhat : (Fin M → X × X × (Fin 1 → X)) → X → Rep d),
        (∀ S, fhat S ∈ F ∧ ∀ f ∈ F, empUnsupLoss true 1 (fhat S) S ≤ empUnsupLoss true 1 f S) →
      ∀ ε : ℝ, 0 < ε → ∀ δ : ℝ, 0 < δ → δ ≤ 1 / 2 →
        sampleMeasure D ρ 1 M {S | ¬ ∀ f ∈ F, ∀ (σ Rf : ℝ), 0 ≤ σ → IsSubGaussianRep D f σ →
            (∀ x, ‖f x‖ ≤ Rf) →
            avgMeanSupLoss (stdLoss true) D ρ 1 (fhat S) ≤
              subGaussianMargin Rf σ ε *
                  avgMeanSupLoss (marginHingeLoss (subGaussianMargin Rf σ ε)) D ρ 1 f +
                c' * (collisionProb ρ / (1 - collisionProb ρ)) * intraclassDeviation D ρ f +
                1 / (1 - collisionProb ρ) * genError K R 1 M (rademacherAvg F S) δ + ε} ≤
          ENNReal.ofReal δ := by sorry

end ContrastiveUnsupervised
Source
Arora, Khandeparkar, Khodak, Plevrakis and Saunshi, A Theoretical Analysis of Contrastive Unsupervised Representation Learning, arXiv:1902.09229v1 (2019), Section 5.2, Corollary 5.1.1, p. 6
Read-back

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

There exist real constants KKK and c′c'c′, with c′>0c' > 0c′>0 and no sign condition on KKK, such that the following holds. The constants are chosen once, before and independently of everything below: the spaces, the dimension, the distributions, the function class, the sample size, ε\varepsilonε and δ\deltaδ.

Setting and hypotheses. Let the following be given.

  • XXX is a measurable space (the data space).
  • CCC is a countable set (the latent classes).
  • d∈Nd \in \mathbb{N}d∈N, and representations take values in Rd\mathbb{R}^dRd with the Euclidean norm and inner product. The case d=0d = 0d=0 is allowed.
  • (Dc)c∈C(D_c)_{c \in C}(Dc​)c∈C​ is a family of probability measures on XXX.
  • ρ:C→R\rho : C \to \mathbb{R}ρ:C→R satisfies ρ(c)≥0\rho(c) \ge 0ρ(c)≥0 for all ccc and ∑cρ(c)=1\sum_c \rho(c) = 1∑c​ρ(c)=1 (as an unconditionally convergent sum). This forces C≠∅C \neq \emptysetC=∅, and hence X≠∅X \neq \emptysetX=∅.
  • The collision probability satisfies τ:=∑cρ(c)2<1\tau := \sum_c \rho(c)^2 < 1τ:=∑c​ρ(c)2<1.
  • R>0R > 0R>0 is a real number.
  • FFF is a set of functions X→RdX \to \mathbb{R}^dX→Rd, each of which is measurable and satisfies ∥f(x)∥≤R\|f(x)\| \le R∥f(x)∥≤R for all xxx.
  • FFF is pointwise separable: there is a countable F0⊆FF_0 \subseteq FF0​⊆F such that every f∈Ff \in Ff∈F is the pointwise limit of some sequence in F0F_0F0​.
  • M≥1M \ge 1M≥1 is an integer (the sample size).
  • f^\hat ff^​ assigns to every sample S=(xj,xj+,xj−)j=1M∈(X×X×X)MS = (x_j, x_j^+, x_j^-)_{j=1}^M \in (X \times X \times X)^MS=(xj​,xj+​,xj−​)j=1M​∈(X×X×X)M a function f^S\hat f_Sf^​S​ with two properties:
    • f^S∈F\hat f_S \in Ff^​S​∈F;
    • f^S\hat f_Sf^​S​ minimizes the empirical hinge contrastive loss over FFF, that is, L^un(f^S;S)≤L^un(f;S)\hat L_{\mathrm{un}}(\hat f_S; S) \le \hat L_{\mathrm{un}}(f; S)L^un​(f^​S​;S)≤L^un​(f;S) for all f∈Ff \in Ff∈F, where
L^un(f;S)=1M∑j=1Mmax⁡{0, 1−f(xj)⊤(f(xj+)−f(xj−))}.\hat L_{\mathrm{un}}(f;S) = \frac1M \sum_{j=1}^M \max\bigl\{0,\ 1 - f(x_j)^\top\bigl(f(x_j^+) - f(x_j^-)\bigr)\bigr\}.L^un​(f;S)=M1​j=1∑M​max{0, 1−f(xj​)⊤(f(xj+​)−f(xj−​))}.
  • This must hold for every sample SSS, with no measurability required of S↦f^SS \mapsto \hat f_SS↦f^​S​. Since X≠∅X \neq \emptysetX=∅, it forces F≠∅F \neq \emptysetF=∅.
  • ε>0\varepsilon > 0ε>0 and 0<δ≤120 < \delta \le \tfrac120<δ≤21​.

Conclusion. Draw SSS from (Dsim×Dneg)⊗M(D_{\mathrm{sim}} \times D_{\mathrm{neg}})^{\otimes M}(Dsim​×Dneg​)⊗M, where

Dsim=∑cρ(c) Dc⊗Dc,Dneg=∑cρ(c) Dc.D_{\mathrm{sim}} = \sum_c \rho(c)\, D_c \otimes D_c, \qquad D_{\mathrm{neg}} = \sum_c \rho(c)\, D_c.Dsim​=c∑​ρ(c)Dc​⊗Dc​,Dneg​=c∑​ρ(c)Dc​.

Each sample point is (x,x+,x−)(x, x^+, x^-)(x,x+,x−) with (x,x+)∼Dsim(x, x^+) \sim D_{\mathrm{sim}}(x,x+)∼Dsim​ and an independent x−∼Dnegx^- \sim D_{\mathrm{neg}}x−∼Dneg​.

Consider the set of samples SSS for which there exist f∈Ff \in Ff∈F and reals σ≥0\sigma \ge 0σ≥0 and RfR_fRf​ satisfying both of the following:

  • ∥f(x)∥≤Rf\|f(x)\| \le R_f∥f(x)∥≤Rf​ for all xxx;
  • fff is σ2\sigma^2σ2-sub-Gaussian in every direction for every class, meaning:
    • for every c∈Cc \in Cc∈C and every unit vector u∈Rdu \in \mathbb{R}^du∈Rd, x↦eλu⊤(f(x)−μc(f))x \mapsto e^{\lambda u^\top(f(x)-\mu_c(f))}x↦eλu⊤(f(x)−μc​(f)) is DcD_cDc​-integrable for all real λ\lambdaλ;
    • and Ex∼Dc eλu⊤(f(x)−μc(f))≤eλ2σ2/2\mathbb{E}_{x\sim D_c}\, e^{\lambda u^\top(f(x)-\mu_c(f))} \le e^{\lambda^2\sigma^2/2}Ex∼Dc​​eλu⊤(f(x)−μc​(f))≤eλ2σ2/2 for all real λ\lambdaλ.
    • This is vacuous when d=0d = 0d=0.

and yet the following inequality fails:

Lsupμ(f^S)  ≤  γ Lγ,supμ(f)  +  c′ τ1−τ s(f)  +  11−τ K ⁣(R RS(F)M+R2log⁡(1/δ)M)  +  ε.L^{\mu}_{\mathrm{sup}}(\hat f_S) \;\le\; \gamma\, L^{\mu}_{\gamma,\mathrm{sup}}(f) \;+\; c'\,\frac{\tau}{1-\tau}\, s(f) \;+\; \frac{1}{1-\tau}\, K\!\left(\frac{R\,\mathcal{R}_S(F)}{M} + R^2\sqrt{\frac{\log(1/\delta)}{M}}\right) \;+\; \varepsilon .Lsupμ​(f^​S​)≤γLγ,supμ​(f)+c′1−ττ​s(f)+1−τ1​K(MRRS​(F)​+R2Mlog(1/δ)​​)+ε.

The theorem asserts that the outer measure of this set of samples is at most δ\deltaδ. No measurability of the set is asserted. Equivalently, the inequality holds simultaneously for all admissible triples (f,σ,Rf)(f, \sigma, R_f)(f,σ,Rf​), except on a set of outer probability at most δ\deltaδ.

Meaning of the symbols.

  • Class means. μc(f)=∫f dDc∈Rd\mu_c(f) = \int f\, dD_c \in \mathbb{R}^dμc​(f)=∫fdDc​∈Rd.

  • Margin. γ=γ(Rf,σ,ε)\gamma = \gamma(R_f, \sigma, \varepsilon)γ=γ(Rf​,σ,ε) is defined by

γ=1+2Rfσ2log⁡Rf+log⁡(3/ε)(Rf≥1),γ=1+2Rfσlog⁡(3/ε)(Rf<1).\gamma = 1 + 2R_f\sigma\sqrt{2\log R_f + \log(3/\varepsilon)} \quad (R_f \ge 1), \qquad \gamma = 1 + 2R_f\sigma\sqrt{\log(3/\varepsilon)} \quad (R_f < 1).γ=1+2Rf​σ2logRf​+log(3/ε)​(Rf​≥1),γ=1+2Rf​σlog(3/ε)​(Rf​<1).
  • The square root of a negative number is taken to be 000. For example, this happens when ε>3\varepsilon > 3ε>3.

  • Since Rf≥0R_f \ge 0Rf​≥0 and σ≥0\sigma \ge 0σ≥0, we always have γ≥1\gamma \ge 1γ≥1.

  • γ\gammaγ depends on the bound RfR_fRf​ chosen for fff, not on RRR.

  • Mean-classifier supervised loss on 2-way tasks. For a loss ℓ\ellℓ on real numbers, define

Lℓμ(f)=∑c1≠c2ρ(c1)ρ(c2) Λℓ({c1,c2},f)∑c1≠c2ρ(c1)ρ(c2).L^{\mu}_{\ell}(f) = \frac{\sum_{c_1 \neq c_2} \rho(c_1)\rho(c_2)\, \Lambda_\ell(\{c_1,c_2\}, f)}{\sum_{c_1\neq c_2}\rho(c_1)\rho(c_2)}.Lℓμ​(f)=∑c1​=c2​​ρ(c1​)ρ(c2​)∑c1​=c2​​ρ(c1​)ρ(c2​)Λℓ​({c1​,c2​},f)​.
  • The sums run over ordered pairs of distinct classes. The denominator equals 1−τ1-\tau1−τ.
  • For a task T={a,b}T = \{a, b\}T={a,b},
Λℓ(T,f)=12∑c∈TEx∼Dc ℓ((μc(f)−μc′(f))⊤f(x)),\Lambda_\ell(T,f) = \tfrac12 \sum_{c \in T} \mathbb{E}_{x \sim D_c}\, \ell\bigl((\mu_c(f) - \mu_{c'}(f))^\top f(x)\bigr),Λℓ​(T,f)=21​c∈T∑​Ex∼Dc​​ℓ((μc​(f)−μc′​(f))⊤f(x)),
where $c'$ denotes the other element of $T$.
  • LsupμL^{\mu}_{\mathrm{sup}}Lsupμ​ uses the hinge loss ℓ(v)=max⁡{0,1−v}\ell(v) = \max\{0, 1 - v\}ℓ(v)=max{0,1−v}.

  • Lγ,supμL^{\mu}_{\gamma,\mathrm{sup}}Lγ,supμ​ uses the margin hinge loss ℓγ(v)=max⁡{0,1−v/γ}\ell_\gamma(v) = \max\{0, 1 - v/\gamma\}ℓγ​(v)=max{0,1−v/γ}.

  • Intraclass deviation.

s(f)=1τ∑cρ(c)2∥Σ(f,c)∥2  Ex∼Dc∥f(x)∥.s(f) = \frac{1}{\tau}\sum_c \rho(c)^2 \sqrt{\|\Sigma(f,c)\|_2}\;\mathbb{E}_{x\sim D_c}\|f(x)\|.s(f)=τ1​c∑​ρ(c)2∥Σ(f,c)∥2​​Ex∼Dc​​∥f(x)∥.
  • Σ(f,c)ij=EDc[(fi−μc(f)i)(fj−μc(f)j)]\Sigma(f,c)_{ij} = \mathbb{E}_{D_c}\bigl[(f_i - \mu_c(f)_i)(f_j - \mu_c(f)_j)\bigr]Σ(f,c)ij​=EDc​​[(fi​−μc​(f)i​)(fj​−μc​(f)j​)] is the covariance matrix of fff under DcD_cDc​.

  • ∥⋅∥2\|\cdot\|_2∥⋅∥2​ is the spectral (operator) norm.

  • Rademacher average of FFF on SSS.

RS(F)=2−3dM∑σ∈{±1}M×3×dsup⁡f∈F∑j=1M∑p=02∑t=1dσj,p,t f(zj,p)t,\mathcal{R}_S(F) = 2^{-3dM} \sum_{\sigma \in \{\pm1\}^{M\times 3\times d}} \sup_{f \in F} \sum_{j=1}^M \sum_{p=0}^{2}\sum_{t=1}^d \sigma_{j,p,t}\, f(z_{j,p})_t,RS​(F)=2−3dMσ∈{±1}M×3×d∑​f∈Fsup​j=1∑M​p=0∑2​t=1∑d​σj,p,t​f(zj,p​)t​,

where (zj,0,zj,1,zj,2)=(xj,xj+,xj−)(z_{j,0}, z_{j,1}, z_{j,2}) = (x_j, x_j^+, x_j^-)(zj,0​,zj,1​,zj,2​)=(xj​,xj+​,xj−​).

  • Generalization term. It uses the global bound RRR, not RfR_fRf​, and the constant KKK. A log⁡k\log klogk term, which equals log⁡1=0\log 1 = 0log1=0 here, has already been dropped from the display above.

Conventions and edge cases.

  • Integrals of non-integrable functions are taken to be 000, and divergent infinite sums are taken to be 000.
  • Suprema over sets that are unbounded above or empty are taken to be 000. Here FFF is bounded by RRR and nonempty.
  • Since δ≤12\delta \le \tfrac12δ≤21​, we have log⁡(1/δ)≥log⁡2>0\log(1/\delta) \ge \log 2 > 0log(1/δ)≥log2>0.
  • Because KKK may be negative or zero, the generalization term may be nonpositive.
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