Lemma A.1: class collision lemma
ProvedContrastiveUnsupervised.class_collision_deviationThere is an absolute constant with the following property. Let be a probability distribution on , let be measurable and bounded, let , and let be the -way hinge or logistic loss. For i.i.d. from , let
Then
where is the covariance matrix of , .
When the negative samples come from the same class as the positive pair, the excess over is controlled by the spread of within the class.
Formalization Note " is a positive constant" is read as one constant valid for every , , , and both losses.
import Mathlib import Definitions.Def_ContrastiveUnsupervised_Basic open MeasureTheory Filter Topology universe u v
namespace ContrastiveUnsupervised
theorem class_collision_deviation :
∃ c' : ℝ, 0 < c' ∧
∀ {X : Type u} [MeasurableSpace X] {C : Type v} {d : ℕ} (D : C → Measure X),
(∀ c, IsProbabilityMeasure (D c)) →
∀ (hinge : Bool) (f : X → Rep d) (R : ℝ), IsBoundedRep f R →
∀ (t : ℕ), 1 ≤ t → ∀ c : C,
condUnsupLoss hinge D t f c (fun _ => c) Finset.univ -
stdLoss hinge (Finset.univ : Finset (Fin t)) (fun _ => (0 : ℝ)) ≤
c' * t * (Real.sqrt (specNorm (classCov D f c)) * ∫ x, ‖f x‖ ∂(D c)) := by sorry
end ContrastiveUnsupervisedRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
There is a single real constant for which the inequality below holds universally. The same must work for every choice of all the following data:
- a measurable space and an arbitrary index type of "classes". No measurable structure or countability is assumed on , and no distribution on appears anywhere in the statement.
- a dimension , where is allowed. Representations live in with the Euclidean norm and inner product.
- a family of measures on , each assumed to be a probability measure.
- a Boolean switch selecting the loss :
- hinge: , taken to be over an empty index set;
- logistic: .
- a measurable map and a real with for every . The number appears only in this hypothesis and not in the conclusion. It is forced to be whenever is nonempty.
- a natural number and a single class .
The inequality is:
In the expectation on the left, are independent samples, all drawn from the same distribution . Every negative sample therefore comes from the same class as and . All scores are kept.
The subtracted constant is evaluated at the zero vector of length . Concretely, it equals:
- for the hinge loss;
- for the logistic loss.
On the right-hand side:
- is the class mean.
- is the covariance matrix with entries
- is its spectral (operator) norm on Euclidean .
- is the integral of against .
All integrals are Bochner integrals, which by convention take the value for non-integrable integrands. Here every integrand is measurable and bounded in terms of , so all the integrals are finite genuine expectations.
When , is identically zero and both sides are . If is nonempty but is empty, the probability-measure hypothesis cannot be satisfied.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.