Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 3.3 (consequence, p. 4): for doubly normalized KKK, Lnc=Lc+N−ML_{nc}=L_c+N-MLnc​=Lc​+N−M

Proved
ContrastiveDuality.doubly_normalized_criteria

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

contrastive-learningfrobenius-normgram-matrixself-supervised-learninguniform-sphere

Let K∈RM×N\mathcal K\in\mathbb{R}^{M\times N}K∈RM×N have all columns and all rows of unit Euclidean norm: ∥K⋅,i∥2=1\|\mathcal K_{\cdot,i}\|_2=1∥K⋅,i​∥2​=1 for every iii and ∥Kj,⋅∥2=1\|\mathcal K_{j,\cdot}\|_2=1∥Kj,⋅​∥2​=1 for every jjj. Then

Lnc=Lc+N−M.L_{nc}=L_c+N-M.Lnc​=Lc​+N−M.

Since the two hypotheses force N=MN=MN=M (see the note), the constant N−MN-MN−M is always 000, so under double normalization the two criteria are equal.

Formalization Note N−MN-MN−M is computed in the real numbers. The two hypotheses together give ∥K∥F2=N=M\|\mathcal K\|_F^2=N=M∥K∥F2​=N=M, so they can hold only when N=MN=MN=M; for example the identity matrix satisfies them.

Preamble
import Mathlib
import Definitions.Def_ContrastiveDuality_Basic

open MeasureTheory ProbabilityTheory Matrix
Formal statement
namespace ContrastiveDuality

theorem doubly_normalized_criteria {M N : ℕ} (K : Matrix (Fin M) (Fin N) ℝ)
    (hcol : ∀ i, colNorm K i = 1) (hrow : ∀ j, rowNorm K j = 1) :
    nonContrastiveCriterion K = contrastiveCriterion K + (N : ℝ) - (M : ℝ) := by sorry

end ContrastiveDuality
Source
Garrido, Chen, Bardes, Najman and LeCun, On the duality between contrastive and non-contrastive self-supervised learning, arXiv:2206.02574v3 (ICLR 2023), Section 3, paragraph after Theorem 3.3, p. 4
Read-back

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

Let M,NM, NM,N be natural numbers (either may be 000), and let K∈RM×NK \in \mathbb{R}^{M \times N}K∈RM×N be an arbitrary real matrix with rows indexed by j∈{1,…,M}j \in \{1,\dots,M\}j∈{1,…,M} and columns by i∈{1,…,N}i \in \{1,\dots,N\}i∈{1,…,N}. The rows are read as embedding dimensions and the columns as the samples of a batch.

Norms. For each column iii, the column norm is

∥K⋅,i∥2=∑j=1MKj,i2,\|K_{\cdot,i}\|_2 = \sqrt{\textstyle\sum_{j=1}^{M} K_{j,i}^2},∥K⋅,i​∥2​=∑j=1M​Kj,i2​​,

and for each row jjj, the row norm is

∥Kj,⋅∥2=∑i=1NKj,i2.\|K_{j,\cdot}\|_2 = \sqrt{\textstyle\sum_{i=1}^{N} K_{j,i}^2}.∥Kj,⋅​∥2​=∑i=1N​Kj,i2​​.

Criteria. For a square matrix AAA, diag⁡(A)\operatorname{diag}(A)diag(A) denotes the matrix with the same diagonal entries as AAA and zeros elsewhere. ∥B∥F2=∑a,bBa,b2\|B\|_F^2 = \sum_{a,b} B_{a,b}^2∥B∥F2​=∑a,b​Ba,b2​ is the squared Frobenius norm. Two quantities are defined from these.

  • The contrastive criterion is
Lc(K)=∥K⊤K−diag⁡(K⊤K)∥F2=∑i,i′=1i≠i′N(K⋅,i⋅K⋅,i′)2,L_c(K) = \big\|K^\top K - \operatorname{diag}(K^\top K)\big\|_F^2 = \sum_{\substack{i,i'=1 \\ i \ne i'}}^{N} \big(K_{\cdot,i}\cdot K_{\cdot,i'}\big)^2,Lc​(K)=​K⊤K−diag(K⊤K)​F2​=i,i′=1i=i′​∑N​(K⋅,i​⋅K⋅,i′​)2,

the sum of squared off-diagonal entries of the N×NN\times NN×N Gram matrix of the columns.

  • The non-contrastive criterion is
Lnc(K)=∥KK⊤−diag⁡(KK⊤)∥F2=∑j,j′=1j≠j′M(Kj,⋅⋅Kj′,⋅)2,L_{nc}(K) = \big\|K K^\top - \operatorname{diag}(K K^\top)\big\|_F^2 = \sum_{\substack{j,j'=1 \\ j \ne j'}}^{M} \big(K_{j,\cdot}\cdot K_{j',\cdot}\big)^2,Lnc​(K)=​KK⊤−diag(KK⊤)​F2​=j,j′=1j=j′​∑M​(Kj,⋅​⋅Kj′,⋅​)2,

the sum of squared off-diagonal entries of the M×MM\times MM×M Gram matrix of the rows.

Statement. Assume both of the following:

  1. every column of KKK has Euclidean norm exactly 111, i.e. ∥K⋅,i∥2=1\|K_{\cdot,i}\|_2 = 1∥K⋅,i​∥2​=1 for all iii;
  2. every row of KKK has Euclidean norm exactly 111, i.e. ∥Kj,⋅∥2=1\|K_{j,\cdot}\|_2 = 1∥Kj,⋅​∥2​=1 for all jjj.

Under these assumptions the theorem asserts the identity of real numbers

Lnc(K)=Lc(K)+N−M.L_{nc}(K) = L_c(K) + N - M.Lnc​(K)=Lc​(K)+N−M.

Edge cases. The two hypotheses together are restrictive.

  • Summing the squared column norms gives ∑i,jKj,i2=N\sum_{i,j} K_{j,i}^2 = N∑i,j​Kj,i2​=N. Summing the squared row norms gives the same total equal to MMM. So the hypotheses can only hold simultaneously when M=NM = NM=N. For M≠NM \ne NM=N the statement is vacuous, and whenever it applies the asserted identity amounts to Lnc(K)=Lc(K)L_{nc}(K) = L_c(K)Lnc​(K)=Lc​(K).
  • If M=0M = 0M=0 and N>0N > 0N>0, every column norm is 0=0≠1\sqrt{0} = 0 \ne 10​=0=1, so hypothesis 1 fails. Symmetrically, N=0N = 0N=0 with M>0M > 0M>0 makes hypothesis 2 fail.
  • When M=N=0M = N = 0M=N=0, both hypotheses hold vacuously, both criteria are 000, and the identity reads 0=00 = 00=0.
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