Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 1 (proof, first step): the population logistic-regression optimum is the log-density ratio

Proved
NonlinearICAAux.logistic_optimum_is_log_ratio

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

contrastive-learningexponential-familyidentifiabilitynonlinear-ica

Assume the nonlinear ICA model with auxiliary variables (eqs. (1), (4)), and let x~=(x,u)\tilde{\mathbf x}=(\mathbf x,\mathbf u)x~=(x,u) and x~∗=(x,u∗)\tilde{\mathbf x}^*=(\mathbf x,\mathbf u^*)x~∗=(x,u∗), with u∗\mathbf u^*u∗ an independent copy of u\mathbf uu, be the two classes of eq. (5). For a measurable regression function r(x,u)r(\mathbf x,\mathbf u)r(x,u) let

J(r)=Ex~log⁡(1+e−r(x,u))+Ex~∗log⁡(1+er(x,u∗))∈[0,∞]J(r)=\mathbb E_{\tilde{\mathbf x}}\log\big(1+e^{-r(\mathbf x,\mathbf u)}\big)+\mathbb E_{\tilde{\mathbf x}^*}\log\big(1+e^{r(\mathbf x,\mathbf u^*)}\big)\in[0,\infty]J(r)=Ex~​log(1+e−r(x,u))+Ex~∗​log(1+er(x,u∗))∈[0,∞]

be the population logistic loss with equal class weights. Then the log-density ratio r∗(x,u)=log⁡p(x∣u)−log⁡p(x)r^*(\mathbf x,\mathbf u)=\log p(\mathbf x\mid\mathbf u)-\log p(\mathbf x)r∗(x,u)=logp(x∣u)−logp(x) is measurable and minimises JJJ over all measurable rrr, and every measurable minimiser of JJJ equals r∗r^*r∗ almost everywhere with respect to Lebesgue measure times the law of u\mathbf uu.

This is the "well-known theory" invoked in the first line of the proof of Theorem 1: logistic regression with infinite data and unrestricted function class converges to the difference of the log-densities of the two classes.

Formalization Note The paper cites this fact (Gutmann and Hyvärinen, 2012) without proof. The two expectations are integrals against the densities p(x∣u)p(\mathbf x\mid\mathbf u)p(x∣u) and p(x)p(\mathbf x)p(x) with respect to Lebesgue measure times the law of u\mathbf uu.

Preamble
import Mathlib
import Definitions.Def_NonlinearICAAux_Basic

open MeasureTheory
open scoped ENNReal
Formal statement
namespace NonlinearICAAux

theorem logistic_optimum_is_log_ratio {n m : ℕ} (μ : Measure (Fin m → ℝ)) [IsProbabilityMeasure μ]
    (q : Fin n → ℝ → (Fin m → ℝ) → ℝ) (f : (Fin n → ℝ) ≃ (Fin n → ℝ))
    (hM : IsAuxICAModel μ q f) :
    Measurable (fun p : (Fin n → ℝ) × (Fin m → ℝ) => logRatio μ q f p.1 p.2) ∧
    (∀ r : (Fin n → ℝ) × (Fin m → ℝ) → ℝ, Measurable r →
      logisticLoss μ q f (fun p => logRatio μ q f p.1 p.2) ≤ logisticLoss μ q f r) ∧
    (∀ r : (Fin n → ℝ) × (Fin m → ℝ) → ℝ, Measurable r →
      (∀ r' : (Fin n → ℝ) × (Fin m → ℝ) → ℝ, Measurable r' →
        logisticLoss μ q f r ≤ logisticLoss μ q f r') →
      r =ᵐ[(volume : Measure (Fin n → ℝ)).prod μ] fun p => logRatio μ q f p.1 p.2) := by sorry

end NonlinearICAAux
Source
Hyvärinen, Sasaki and Turner, Nonlinear ICA Using Auxiliary Variables and Generalized Contrastive Learning, arXiv:1805.08651v3 (AISTATS 2019), Section 3.2, eqs. (5)-(6), p. 3; Supplementary A, first display before eq. (17), p. 11
Read-back

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

Fix natural numbers nnn and mmm, with Rn\mathbb{R}^nRn and Rm\mathbb{R}^mRm the spaces of real nnn- and mmm-tuples. The statement has these data:

  • a probability measure μ\muμ on Rm\mathbb{R}^mRm (Borel), the law of the auxiliary variable uuu;
  • functions q1,…,qn:R×Rm→Rq_1,\dots,q_n : \mathbb{R}\times\mathbb{R}^m \to \mathbb{R}q1​,…,qn​:R×Rm→R, written qi(t,u)q_i(t,u)qi​(t,u);
  • a bijection f:Rn→Rnf : \mathbb{R}^n \to \mathbb{R}^nf:Rn→Rn with inverse g=f−1g = f^{-1}g=f−1.

Hypothesis. The triple (μ,q,f)(\mu, q, f)(μ,q,f) is assumed to satisfy all of the following:

  1. Both fff and ggg are C2C^2C2 maps on all of Rn\mathbb{R}^nRn.
  2. Each (t,u)↦qi(t,u)(t,u)\mapsto q_i(t,u)(t,u)↦qi​(t,u) is Borel measurable on R×Rm\mathbb{R}\times\mathbb{R}^mR×Rm.
  3. For every u∈Rmu\in\mathbb{R}^mu∈Rm, the function
s↦exp⁡(∑i=1nqi(si,u))s \mapsto \exp\Big(\sum_{i=1}^n q_i(s_i,u)\Big)s↦exp(i=1∑n​qi​(si​,u))

is Lebesgue-integrable on Rn\mathbb{R}^nRn, and its Lebesgue integral equals 111. 4. For every s∈Rns\in\mathbb{R}^ns∈Rn, the function u↦exp⁡(∑iqi(si,u))u\mapsto \exp\big(\sum_i q_i(s_i,u)\big)u↦exp(∑i​qi​(si​,u)) is μ\muμ-integrable.

Derived quantities. For x∈Rnx\in\mathbb{R}^nx∈Rn and u∈Rmu\in\mathbb{R}^mu∈Rm, let J(x)=∣det⁡Dg(x)∣J(x) = \lvert\det Dg(x)\rvertJ(x)=∣detDg(x)∣ be the absolute Jacobian determinant of ggg at xxx. Define:

p(x∣u)=exp⁡(∑i=1nqi(g(x)i,u)) J(x),p(x\mid u) = \exp\Big(\sum_{i=1}^n q_i\big(g(x)_i,u\big)\Big)\, J(x),p(x∣u)=exp(i=1∑n​qi​(g(x)i​,u))J(x), p(x)=(∫Rmexp⁡(∑i=1nqi(g(x)i,u′)) dμ(u′)) J(x),p(x) = \Big(\int_{\mathbb{R}^m} \exp\Big(\sum_{i=1}^n q_i\big(g(x)_i,u'\big)\Big)\, d\mu(u')\Big)\, J(x),p(x)=(∫Rm​exp(i=1∑n​qi​(g(x)i​,u′))dμ(u′))J(x), ℓ(x,u)=log⁡p(x∣u)−log⁡p(x).\ell(x,u) = \log p(x\mid u) - \log p(x).ℓ(x,u)=logp(x∣u)−logp(x).

The logarithm follows the total-function convention log⁡0=0\log 0 = 0log0=0 (and log⁡t=log⁡∣t∣\log t = \log\lvert t\rvertlogt=log∣t∣ for t<0t<0t<0). So at any xxx with J(x)=0J(x)=0J(x)=0, the value is ℓ(x,u)=0\ell(x,u)=0ℓ(x,u)=0.

For any function r:Rn×Rm→Rr:\mathbb{R}^n\times\mathbb{R}^m\to\mathbb{R}r:Rn×Rm→R, define the extended-valued loss L(r)∈[0,∞]\mathcal{L}(r)\in[0,\infty]L(r)∈[0,∞] by

L(r)=∫Rn×Rm[log⁡(1+e−r(x,u)) p(x∣u)+log⁡(1+er(x,u)) p(x)] d(λn⊗μ)(x,u).\mathcal{L}(r) = \int_{\mathbb{R}^n\times\mathbb{R}^m} \Big[\log\big(1+e^{-r(x,u)}\big)\, p(x\mid u) + \log\big(1+e^{r(x,u)}\big)\, p(x)\Big]\, d(\lambda^n\otimes\mu)(x,u).L(r)=∫Rn×Rm​[log(1+e−r(x,u))p(x∣u)+log(1+er(x,u))p(x)]d(λn⊗μ)(x,u).

Here λn\lambda^nλn is Lebesgue measure on Rn\mathbb{R}^nRn. The integral is a lower (nonnegative) Lebesgue integral: each of the two summands is replaced by 000 wherever it would be negative, and the value +∞+\infty+∞ is allowed.

Conclusion. The theorem asserts the conjunction of three statements:

  1. The function (x,u)↦ℓ(x,u)(x,u)\mapsto \ell(x,u)(x,u)↦ℓ(x,u) is Borel measurable on Rn×Rm\mathbb{R}^n\times\mathbb{R}^mRn×Rm.
  2. For every Borel-measurable r:Rn×Rm→Rr:\mathbb{R}^n\times\mathbb{R}^m\to\mathbb{R}r:Rn×Rm→R,
L(ℓ)≤L(r)\mathcal{L}(\ell)\le \mathcal{L}(r)L(ℓ)≤L(r)

as an inequality in [0,∞][0,\infty][0,∞]. 3. For every Borel-measurable rrr that minimises L\mathcal{L}L among Borel-measurable functions (that is, L(r)≤L(r′)\mathcal{L}(r)\le\mathcal{L}(r')L(r)≤L(r′) for every measurable r′r'r′), we have r=ℓr=\ellr=ℓ almost everywhere with respect to λn⊗μ\lambda^n\otimes\muλn⊗μ.

Edge cases.

  • No finiteness of L(ℓ)\mathcal{L}(\ell)L(ℓ) is asserted. If L(ℓ)=+∞\mathcal{L}(\ell)=+\inftyL(ℓ)=+∞, then statement 2 forces L(r)=+∞\mathcal{L}(r)=+\inftyL(r)=+∞ for every measurable rrr. In that case statement 3 claims that every measurable rrr agrees with ℓ\ellℓ almost everywhere.
  • If n=0n=0n=0, then R0\mathbb{R}^0R0 is a single point carrying unit mass, the empty sum is 000, and J≡1J\equiv 1J≡1.
  • If m=0m=0m=0, then μ\muμ is the unit mass at the single point of R0\mathbb{R}^0R0. Then p(x∣u)=p(x)p(x\mid u)=p(x)p(x∣u)=p(x), so ℓ≡0\ell\equiv 0ℓ≡0 wherever p(x)≠0p(x)\neq 0p(x)=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