Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Proposition 1 (as proved): minimizers of the cross-entropy maintain the dot product, h(z)⊤h(z~)=τκ z⊤z~h(z)^\top h(\tilde z)=\tau\kappa\, z^\top\tilde zh(z)⊤h(z~)=τκz⊤z~

Proved
ContrastiveInverts.ce_minimizers_preserve_dot_product

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

contrastive-learningidentifiabilityinfoncenonlinear-icavon-mises-fisher

Let N≥1N\ge1N≥1, Z=SN−1Z=\mathbb{S}^{N-1}Z=SN−1, τ>0\tau>0τ>0, κ>0\kappa>0κ>0, and let p(z~∣z)=Cp−1eκz⊤z~p(\tilde z\mid z)=C_p^{-1}e^{\kappa z^\top\tilde z}p(z~∣z)=Cp−1​eκz⊤z~. Let H\mathcal HH be a class of measurable maps hhh sending ZZZ into the sphere of radius τκ\sqrt{\tau\kappa}τκ​. Suppose the class is flexible enough to match the ground truth: some h0∈Hh_0\in\mathcal Hh0​∈H has qh0(z~∣z)=p(z~∣z)q_{h_0}(\tilde z\mid z)=p(\tilde z\mid z)qh0​​(z~∣z)=p(z~∣z) for all z,z~∈Zz,\tilde z\in Zz,z~∈Z. If h∈Hh\in\mathcal Hh∈H minimises the cross-entropy Ep(z~∣z)[−log⁡qh(z~∣z)]\mathbb{E}_{p(\tilde z\mid z)}[-\log q_h(\tilde z\mid z)]Ep(z~∣z)​[−logqh​(z~∣z)] over H\mathcal HH at every anchor z∈Zz\in Zz∈Z, then for all z,z~∈Zz,\tilde z\in Zz,z~∈Z

p(z~∣z)=qh(z~∣z)andτκ z⊤z~=h(z)⊤h(z~).p(\tilde z\mid z)=q_h(\tilde z\mid z)\qquad\text{and}\qquad \tau\kappa\,z^\top\tilde z=h(z)^\top h(\tilde z).p(z~∣z)=qh​(z~∣z)andτκz⊤z~=h(z)⊤h(z~).

Formalization Note The paper prints the second conclusion as κz⊤z~=h(z)⊤h(z~)\kappa z^\top\tilde z=h(z)^\top h(\tilde z)κz⊤z~=h(z)⊤h(z~). Its proof, which omits the factor 1/τ1/\tau1/τ in the last step, actually yields τκ z⊤z~=h(z)⊤h(z~)\tau\kappa\,z^\top\tilde z=h(z)^\top h(\tilde z)τκz⊤z~=h(z)⊤h(z~), and that is what is stated. The printed form fails for the matching map h(z)=τκ zh(z)=\sqrt{\tau\kappa}\,zh(z)=τκ​z whenever τ≠1\tau\ne1τ=1. "Minimiser of the cross-entropy" is read at each anchor zzz, as printed. Membership of h0h_0h0​ in the class encodes "sufficiently flexible such that ppp and qhq_hqh​ can match".

Preamble
import Mathlib
import Definitions.Def_ContrastiveInverts_Basic

open MeasureTheory Filter Topology
Formal statement
namespace ContrastiveInverts

theorem ce_minimizers_preserve_dot_product {N : ℕ} (hN : 0 < N) (τ κ : ℝ) (hτ : 0 < τ)
    (hκ : 0 < κ) (H : Set (Vec N → Vec N))
    (hH : ∀ h' ∈ H, (∀ z ∈ Metric.sphere (0 : Vec N) 1,
        h' z ∈ Metric.sphere (0 : Vec N) (Real.sqrt (τ * κ))) ∧
      Measurable (fun z : Sph N => h' z))
    (hflex : ∃ h₀ ∈ H, ∀ z ∈ Metric.sphere (0 : Vec N) 1, ∀ z' ∈ Metric.sphere (0 : Vec N) 1,
      sphModelCond τ h₀ z z' = vmfCond N κ z z')
    (h : Vec N → Vec N) (hh : h ∈ H)
    (hmin : ∀ z ∈ Metric.sphere (0 : Vec N) 1, ∀ h' ∈ H,
      sphCondCrossEntropy κ τ h z ≤ sphCondCrossEntropy κ τ h' z) :
    (∀ z ∈ Metric.sphere (0 : Vec N) 1, ∀ z' ∈ Metric.sphere (0 : Vec N) 1,
      vmfCond N κ z z' = sphModelCond τ h z z') ∧
    (∀ z ∈ Metric.sphere (0 : Vec N) 1, ∀ z' ∈ Metric.sphere (0 : Vec N) 1,
      τ * κ * inner ℝ z z' = inner ℝ (h z) (h z')) := by sorry

end ContrastiveInverts
Source
Zimmermann, Sharma, Schneider, Bethge and Brendel, Contrastive Learning Inverts the Data Generating Process, ICML 2021, arXiv:2102.08850v4, Section 3.1, Proposition 1, p. 4; restated with proof in Appendix A.1.2, Proposition 1, eqs. (32)-(36), p. 14
Read-back

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

Fix a natural number NNN with N≥1N \ge 1N≥1, and real numbers τ,κ\tau, \kappaτ,κ with τ>0\tau > 0τ>0 and κ>0\kappa > 0κ>0. Work in RN\mathbb{R}^NRN with the standard Euclidean inner product ⟨⋅,⋅⟩\langle \cdot,\cdot \rangle⟨⋅,⋅⟩. Let SN−1={z∈RN:∥z∥=1}S^{N-1} = \{z \in \mathbb{R}^N : \|z\| = 1\}SN−1={z∈RN:∥z∥=1} be the unit sphere.

Let σ\sigmaσ be the surface measure on SN−1S^{N-1}SN−1. Concretely, for A⊆SN−1A \subseteq S^{N-1}A⊆SN−1, σ(A)\sigma(A)σ(A) is NNN times the Lebesgue volume of the truncated cone {ra:a∈A, 0<r<1}\{ r a : a \in A,\ 0 < r < 1\}{ra:a∈A, 0<r<1}. For N=1N = 1N=1 the sphere is {−1,+1}\{-1, +1\}{−1,+1} and σ\sigmaσ gives each point mass 111.

Ground-truth conditional. For z,z′∈RNz, z' \in \mathbb{R}^Nz,z′∈RN, the von Mises–Fisher conditional is

p(z′∣z)  =  exp⁡(κ⟨z,z′⟩)Cp(z),Cp(z)=∫SN−1exp⁡(κ⟨z,w⟩) dσ(w).p(z' \mid z) \;=\; \frac{\exp(\kappa \langle z, z'\rangle)}{C_p(z)}, \qquad C_p(z) = \int_{S^{N-1}} \exp(\kappa \langle z, w\rangle)\, d\sigma(w).p(z′∣z)=Cp​(z)exp(κ⟨z,z′⟩)​,Cp​(z)=∫SN−1​exp(κ⟨z,w⟩)dσ(w).

Model conditional. For any map g:RN→RNg : \mathbb{R}^N \to \mathbb{R}^Ng:RN→RN, the model conditional is

qg(z′∣z)  =  exp⁡ ⁣(⟨g(z′),g(z)⟩/τ)Cg(z),Cg(z)=∫SN−1exp⁡ ⁣(⟨g(w),g(z)⟩/τ) dσ(w).q_g(z' \mid z) \;=\; \frac{\exp\!\big(\langle g(z'), g(z)\rangle / \tau\big)}{C_g(z)}, \qquad C_g(z) = \int_{S^{N-1}} \exp\!\big(\langle g(w), g(z)\rangle/\tau\big)\, d\sigma(w).qg​(z′∣z)=Cg​(z)exp(⟨g(z′),g(z)⟩/τ)​,Cg​(z)=∫SN−1​exp(⟨g(w),g(z)⟩/τ)dσ(w).

Cross-entropy at a fixed anchor. For z∈RNz \in \mathbb{R}^Nz∈RN, the cross-entropy is

CE(g,z)  =  ∫SN−1p(w∣z) (−log⁡qg(w∣z)) dσ(w).\mathrm{CE}(g, z) \;=\; \int_{S^{N-1}} p(w \mid z)\,\big(-\log q_g(w \mid z)\big)\, d\sigma(w).CE(g,z)=∫SN−1​p(w∣z)(−logqg​(w∣z))dσ(w).

Conventions for undefined values. These formulas use the following conventions:

  • Every integral above is set to 000 if its integrand is not integrable.
  • Division by 000 yields 000.
  • The logarithm satisfies log⁡0=0\log 0 = 0log0=0 and log⁡x=log⁡∣x∣\log x = \log|x|logx=log∣x∣ for x<0x < 0x<0.

Hypotheses. Let HHH be a set of maps RN→RN\mathbb{R}^N \to \mathbb{R}^NRN→RN. Values of these maps off SN−1S^{N-1}SN−1 are unconstrained and play no role in any of the quantities above. Assume:

  1. Range and measurability. Every h′∈Hh' \in Hh′∈H maps SN−1S^{N-1}SN−1 into the sphere of radius τκ\sqrt{\tau\kappa}τκ​ centred at 000, i.e. ∥h′(z)∥=τκ\|h'(z)\| = \sqrt{\tau\kappa}∥h′(z)∥=τκ​ for all z∈SN−1z \in S^{N-1}z∈SN−1. In addition, the restriction of h′h'h′ to SN−1S^{N-1}SN−1 is Borel-measurable.
  2. Flexibility. There exists some h0∈Hh_0 \in Hh0​∈H with
qh0(z′∣z)=p(z′∣z)for all z,z′∈SN−1.q_{h_0}(z' \mid z) = p(z' \mid z) \quad \text{for all } z, z' \in S^{N-1}.qh0​​(z′∣z)=p(z′∣z)for all z,z′∈SN−1.

For instance, the map z↦τκ zz \mapsto \sqrt{\tau\kappa}\, zz↦τκ​z satisfies this identity and condition 1. So the hypothesis is satisfiable whenever HHH contains such a map. 3. Membership. hhh is an element of HHH. 4. Pointwise minimality. hhh minimises the anchor-wise cross-entropy over HHH simultaneously at every anchor:

CE(h,z)≤CE(h′,z)for every z∈SN−1 and every h′∈H.\mathrm{CE}(h, z) \le \mathrm{CE}(h', z) \quad \text{for every } z \in S^{N-1} \text{ and every } h' \in H.CE(h,z)≤CE(h′,z)for every z∈SN−1 and every h′∈H.

This is required at every anchor point, not merely for almost every zzz or on average over zzz.

Conclusion. The theorem asserts both of the following:

  • (a) Conditionals agree. For all z,z′∈SN−1z, z' \in S^{N-1}z,z′∈SN−1,
p(z′∣z)=qh(z′∣z).p(z' \mid z) = q_h(z' \mid z).p(z′∣z)=qh​(z′∣z).
  • (b) Inner products are preserved up to scale. For all z,z′∈SN−1z, z' \in S^{N-1}z,z′∈SN−1,
τκ ⟨z,z′⟩=⟨h(z),h(z′)⟩.\tau\kappa\,\langle z, z'\rangle = \langle h(z), h(z')\rangle.τκ⟨z,z′⟩=⟨h(z),h(z′)⟩.

Both conclusions hold pointwise at every pair of points of the unit sphere, and say nothing about hhh outside SN−1S^{N-1}SN−1.

Human review
  • Endorsed by Shuze Chen · Nov 23, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 23, 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