Lemma 1: Jensen bound for the class-specific batch-wise loss
ProvedSupConGeometry.supcon_class_batch_jensenThroughout, with , the batch size is , , and every lies on the sphere (standing assumptions of Supplementary S1).
Fix a class and a batch with . Then for every labelling the class-specific batch-wise loss satisfies
Equality holds if and only if, for every :
- (Q1) there is with for every ;
- (Q2) there is with for every .
This is Step 1 of the proof of Theorem 2: Jensen's inequality for the exponential, applied separately to the same-class and other-class terms of the softmax denominator.
Formalization Note The sum over counts multiplicity. When the complement is empty, the bound reads and (Q2) holds trivially.
import Mathlib import Definitions.Def_SupConGeometry_Basic open Finset
namespace SupConGeometry
theorem supcon_class_batch_jensen {N K h b : ℕ} (hKh : K ≤ h + 1) (hb : 3 ≤ b)
(ρ : ℝ) (hρ : 0 < ρ) (Z : Fin N → Rep h) (hZ : ∀ n, ‖Z n‖ = ρ) (Y : Fin N → Fin K)
(y : Fin K) (B : Sym (Fin N) b)
(hB : 2 ≤ Multiset.card (batchClass Y (B : Multiset (Fin N)) y)) :
((batchClass Y (B : Multiset (Fin N)) y).map (fun i =>
Real.log ((Multiset.card (batchClass Y (B : Multiset (Fin N)) y) : ℝ) - 1 +
(Multiset.card (batchClassCompl Y (B : Multiset (Fin N)) y) : ℝ) *
Real.exp (sInd Z Y B y i)))).sum ≤ scClassBatchLoss Z Y (B : Multiset (Fin N)) y ∧
(scClassBatchLoss Z Y (B : Multiset (Fin N)) y =
((batchClass Y (B : Multiset (Fin N)) y).map (fun i =>
Real.log ((Multiset.card (batchClass Y (B : Multiset (Fin N)) y) : ℝ) - 1 +
(Multiset.card (batchClassCompl Y (B : Multiset (Fin N)) y) : ℝ) *
Real.exp (sInd Z Y B y i)))).sum ↔
∀ i ∈ batchClass Y (B : Multiset (Fin N)) y,
(∃ C : ℝ, ∀ j ∈ (batchClass Y (B : Multiset (Fin N)) y).erase i,
inner ℝ (Z i) (Z j) = C) ∧
(∃ D : ℝ, ∀ j ∈ batchClassCompl Y (B : Multiset (Fin N)) y, inner ℝ (Z i) (Z j) = D)) := by sorry
end SupConGeometryRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
Let be natural numbers and a real number. Assume:
- ;
- ;
- ;
- is a family of points in (Euclidean inner product ) with for every ;
- assigns to each index a label ;
- is a fixed class;
- is a multiset of exactly indices from , with repetitions allowed and counted with multiplicity.
Because is nonempty, . The hypothesis is assumed but does not otherwise appear in the statement.
Notation. Let be the sub-multiset of consisting of the indices with , keeping their multiplicities. Let be the sub-multiset of indices with . Write and , both counted with multiplicity, so . Assume further that . For an index and a multiset , denotes with one copy of removed. If occurs several times, the remaining copies of stay in it. All sums over multisets below count multiplicity.
The per-instance quantity. For each , define
The class-specific batch loss. Since , the loss is
Here the denominator sums over the whole batch with one copy of removed.
Claim (a): inequality.
where the left sum runs over with multiplicity. Since , each logarithm's argument is at least . When we have , and each summand reduces to .
Claim (b): equality case. Equality holds in (a) if and only if the following holds for every index that occurs in (each distinct index taken once):
- There is a real number , which may depend on , with for every index occurring in . If occurs more than once in , this set includes itself, and then .
- There is a real number , which may depend on , with for every index occurring in . This condition is vacuous when is empty, i.e. when .
The claim is the conjunction of (a) and (b).
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.