Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 1 (as proved): cross-entropy lower bound and its equality case for W≠0W\neq0W=0

Proved
SupConGeometry.ce_loss_lower_bound

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

cross-entropyneural-collapseregular-simplexrepresentation-geometrysupervised-contrastive-loss

Let h,N,K∈Nh,N,K\in\mathbb Nh,N,K∈N with 2≤K≤h+12\le K\le h+12≤K≤h+1 and N≥1N\ge1N≥1, let ρ>0\rho>0ρ>0, and let z1,…,zN∈Rhz_1,\dots,z_N\in\mathbb R^hz1​,…,zN​∈Rh with ∥zn∥≤ρ\|z_n\|\le\rho∥zn​∥≤ρ, with balanced labels Y∈[K]NY\in[K]^NY∈[K]N. Let W∈RK×hW\in\mathbb R^{K\times h}W∈RK×h have rows wyw_ywy​. Then

LCE(Z,W;Y) ≥ log⁡(1+(K−1)exp⁡(−ρKK−1∥W∥F)).\mathcal L_{CE}(Z,W;Y)\ \ge\ \log\Big(1+(K-1)\exp\Big(-\rho\frac{\sqrt K}{K-1}\|W\|_F\Big)\Big).LCE​(Z,W;Y) ≥ log(1+(K−1)exp(−ρK−1K​​∥W∥F​)).

If moreover W≠0W\neq0W=0, equality holds if and only if there are ζ1,…,ζK∈Rh\zeta_1,\dots,\zeta_K\in\mathbb R^hζ1​,…,ζK​∈Rh such that

  1. (C1) zn=ζynz_n=\zeta_{y_n}zn​=ζyn​​ for all nnn;
  2. (C2) {ζy}y\{\zeta_y\}_y{ζy​}y​ form a ρ\rhoρ-sphere-inscribed regular simplex;
  3. (C3) there is ρW>0\rho_W>0ρW​>0 with wy=ρWρζyw_y=\frac{\rho_W}{\rho}\zeta_ywy​=ρρW​​ζy​ for all yyy.

Formalization Note The paper states the equality characterisation for every WWW. It fails at W=0W=0W=0: then LCE=log⁡K\mathcal L_{CE}=\log KLCE​=logK equals the bound for every ZZZ, while (C3) is impossible. The proof's case "wyn=0w_{y_n}=0wyn​​=0 gives ζyn=0\zeta_{y_n}=0ζyn​​=0" contradicts (S2). The statement is what the proof establishes: the bound for all WWW and the characterisation for W≠0W\neq0W=0. N≥1N\ge1N≥1 and K≥2K\ge2K≥2 are implicit in the factors 1/N1/N1/N and 1/(K−1)1/(K-1)1/(K−1).

Preamble
import Mathlib
import Definitions.Def_SupConGeometry_Basic

open Finset
Formal statement
namespace SupConGeometry

theorem ce_loss_lower_bound {N K h : ℕ} (hK : 2 ≤ K) (hKh : K ≤ h + 1) (hN : 0 < N)
    (ρ : ℝ) (hρ : 0 < ρ) (Z : Fin N → Rep h) (hZ : ∀ n, ‖Z n‖ ≤ ρ) (W : Fin K → Rep h)
    (Y : Fin N → Fin K) (hY : IsBalanced Y) :
    Real.log (1 + ((K : ℝ) - 1) *
        Real.exp (-(ρ * (Real.sqrt K / ((K : ℝ) - 1)) * frobNorm W))) ≤ ceLoss Z W Y ∧
    (W ≠ 0 →
      (ceLoss Z W Y = Real.log (1 + ((K : ℝ) - 1) *
          Real.exp (-(ρ * (Real.sqrt K / ((K : ℝ) - 1)) * frobNorm W))) ↔
        ∃ ζ : Fin K → Rep h, (∀ n, Z n = ζ (Y n)) ∧ IsSphereInscribedRegularSimplex ζ ρ ∧
          ∃ ρW : ℝ, 0 < ρW ∧ ∀ y, W y = (ρW / ρ) • ζ y)) := by sorry

end SupConGeometry
Source
Graf, Hofer, Niethammer and Kwitt, Dissecting Supervised Contrastive Learning, ICML 2021, arXiv:2102.08817v4, Section 3.1, Theorem 1, p. 4; proof in Supplementary S2, pp. 30-33; standing assumption K ≤ h+1 of Supplementary S2, p. 28
Read-back

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

Setting. Fix natural numbers N,K,hN, K, hN,K,h and work in Rh\mathbb{R}^hRh with the standard Euclidean inner product ⟨⋅,⋅⟩\langle\cdot,\cdot\rangle⟨⋅,⋅⟩ and norm ∥⋅∥\|\cdot\|∥⋅∥. Assume

  • K≥2K \ge 2K≥2, the number of classes;
  • K≤h+1K \le h + 1K≤h+1, so in particular h≥1h \ge 1h≥1;
  • N>0N > 0N>0, the number of points.

The data are:

  • a real number ρ>0\rho > 0ρ>0;
  • an arbitrary family of points Z=(z1,…,zN)Z = (z_1, \dots, z_N)Z=(z1​,…,zN​) in Rh\mathbb{R}^hRh with ∥zn∥≤ρ\|z_n\| \le \rho∥zn​∥≤ρ for every nnn. This is an inequality, so points strictly inside the ball are allowed.
  • an arbitrary family W=(w1,…,wK)W = (w_1, \dots, w_K)W=(w1​,…,wK​) of vectors in Rh\mathbb{R}^hRh, thought of as the rows of a K×hK \times hK×h weight matrix. It is unconstrained and may be zero.
  • a labelling Y=(y1,…,yN)Y = (y_1, \dots, y_N)Y=(y1​,…,yN​) with each yn∈{1,…,K}y_n \in \{1, \dots, K\}yn​∈{1,…,K}.

The labelling is assumed balanced: for every class yyy,

K⋅#{n∈{1,…,N}:yn=y}=N.K \cdot \#\{n \in \{1,\dots,N\} : y_n = y\} = N.K⋅#{n∈{1,…,N}:yn​=y}=N.

So KKK divides NNN, and every class has exactly N/K≥1N/K \ge 1N/K≥1 members.

Quantities used.

  • The cross-entropy loss is
LCE(Z,W;Y)=1N∑n=1N−log⁡ ⁣(exp⁡⟨zn,wyn⟩∑l=1Kexp⁡⟨zn,wl⟩).L_{CE}(Z, W; Y) = \frac{1}{N} \sum_{n=1}^{N} -\log\!\left( \frac{\exp\langle z_n, w_{y_n}\rangle}{\sum_{l=1}^{K} \exp\langle z_n, w_l\rangle} \right).LCE​(Z,W;Y)=N1​n=1∑N​−log(∑l=1K​exp⟨zn​,wl​⟩exp⟨zn​,wyn​​⟩​).
  • The Frobenius norm of WWW is
∥W∥F=(∑y=1K∥wy∥2)1/2.\|W\|_F = \Big(\sum_{y=1}^K \|w_y\|^2\Big)^{1/2}.∥W∥F​=(y=1∑K​∥wy​∥2)1/2.
  • The bound quantity is
Λ(W)=log⁡ ⁣(1+(K−1)exp⁡ ⁣(−ρ KK−1 ∥W∥F)).\Lambda(W) = \log\!\left(1 + (K-1)\exp\!\Big(-\rho\,\frac{\sqrt{K}}{K-1}\,\|W\|_F\Big)\right).Λ(W)=log(1+(K−1)exp(−ρK−1K​​∥W∥F​)).

Since K≥2K \ge 2K≥2, no division by zero occurs anywhere in these expressions.

Claim. Under these hypotheses, two statements hold.

  1. Lower bound. For all such Z,W,YZ, W, YZ,W,Y:
Λ(W)≤LCE(Z,W;Y).\Lambda(W) \le L_{CE}(Z, W; Y).Λ(W)≤LCE​(Z,W;Y).

When W=0W = 0W=0 this reads log⁡K≤LCE\log K \le L_{CE}logK≤LCE​.

  1. Equality characterization, only when W≠0W \neq 0W=0. Here W≠0W \ne 0W=0 means that not every wyw_ywy​ is the zero vector. For such WWW, equality LCE(Z,W;Y)=Λ(W)L_{CE}(Z, W; Y) = \Lambda(W)LCE​(Z,W;Y)=Λ(W) holds if and only if there exist vectors ζ1,…,ζK∈Rh\zeta_1, \dots, \zeta_K \in \mathbb{R}^hζ1​,…,ζK​∈Rh satisfying all of the following:

    • zn=ζynz_n = \zeta_{y_n}zn​=ζyn​​ for every nnn, so all points with the same label coincide;
    • ∑y=1Kζy=0\sum_{y=1}^K \zeta_y = 0∑y=1K​ζy​=0;
    • ∥ζy∥=ρ\|\zeta_y\| = \rho∥ζy​∥=ρ for every yyy;
    • there is a real number ddd such that ⟨ζy,ζy′⟩=d\langle \zeta_y, \zeta_{y'}\rangle = d⟨ζy​,ζy′​⟩=d for all y<y′y < y'y<y′. No value of ddd is prescribed; it is only required to be common to all pairs.
    • there is a real number ρW>0\rho_W > 0ρW​>0 with wy=ρWρ ζyw_y = \frac{\rho_W}{\rho}\,\zeta_ywy​=ρρW​​ζy​ for every yyy. No relation between ρW\rho_WρW​ and ∥W∥F\|W\|_F∥W∥F​ is stated explicitly.

    For W=0W = 0W=0 the statement says nothing about when equality holds.

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