Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 12.2 — Maxent duality (goal)

Proved
FoundationsML.MaxEnt.maxent_duality

by mikedeng1 · Sep 20, 2026 · Mathlib 0df444a (Lean v4.33.1)

convex-optimizationdualitymachine-learningmaximum-entropy

Statement (Theorem 12.2, Maxent duality, p. 300, PDF p. 317). Problems (12.7) or (12.8) are equivalent to the optimization problem sup⁡w∈RNG(w)\sup_{w\in\mathbb R^N}G(w)supw∈RN​G(w):

sup⁡w∈RNG(w)=min⁡pF(p).\sup_{w\in\mathbb R^N}G(w) = \min_p F(p).w∈RNsup​G(w)=pmin​F(p).

Furthermore, let p∗=arg⁡min⁡pF(p)p^*=\arg\min_pF(p)p∗=argminp​F(p) and d∗=sup⁡w∈RNG(w)d^*=\sup_{w\in\mathbb R^N}G(w)d∗=supw∈RN​G(w); then, for any ϵ>0\epsilon>0ϵ>0 and any www such that ∣G(w)−d∗∣<ϵ|G(w)-d^*|<\epsilon∣G(w)−d∗∣<ϵ, D(p∗∥pw)≤ϵD(p^*\|p_w)\le\epsilonD(p∗∥pw​)≤ϵ.

This is the chapter's capstone: it shows that the Maxent principle's primal optimization (an entropy-maximization / relative-entropy-minimization problem over distributions) is exactly dual to a regularized maximum-likelihood problem over the family of Gibbs distributions — explaining why the (seemingly unrelated) Maxent principle always produces a Gibbs-form solution, and giving an ϵ\epsilonϵ-solution-of-the-dual ⇒\Rightarrow⇒ ϵ\epsilonϵ-close-primal-distribution guarantee that makes solving the (often easier, unconstrained, finite-dimensional) dual problem a valid way to solve the primal.

Formalization Note. This is the sharpest trivialization risk of the whole series: the equality is not an unconditional convex-duality fact, and both clauses (the sup=min equality and the D(p*‖p_w)≤ε approximation guarantee) are drafted as a conjunction, per BRIEF.md's explicit warning that the second clause is easy to drop by accident. hlam : 0 < λ is a genuine load-bearing hypothesis (the book's own proof uses λ>0 to place u₀ in the interior of C, invoking the qualification condition of the book's own Theorem B.39/Fenchel duality theorem) — not a free convexity assumption, and dropping it would misstate the theorem. F's EReal codomain and the explicit IsLeast hypothesis for p* are used exactly as MaxEntPrimalObjective and the dual-objective supremum are defined.


Retired 2026-10-27: a Lean-vs-paper fidelity audit found this statement weaker than, or narrower than, the cited result. A corrected statement will be resubmitted.

Preamble
import Mathlib
import Definitions.Def_FoundationsML_MaxEnt_MaxEntPrimalObjective
import Definitions.Def_FoundationsML_MaxEnt_MaxEntDualObjective
import Definitions.Def_FoundationsML_MaxEnt_RelativeEntropy
import Definitions.Def_FoundationsML_MaxEnt_GibbsDistribution
Formal statement
namespace FoundationsML.MaxEnt

/-- Theorem 12.2 (Maxent duality; Mohri, Rostamizadeh & Talwalkar, *Foundations of Machine
Learning*, 2nd ed., MIT Press 2018, p. 300, PDF p. 317 — this mission's goal). Problems (12.7)
or (12.8) are equivalent to the optimization problem `sup_{w∈ℝ^N} G(w)`:
`sup_{w∈ℝ^N} G(w) = min_p F(p)`. Furthermore, let `p* = argmin_p F(p)` and
`d* = sup_{w∈ℝ^N} G(w)`; then, for any `ε > 0` and any `w` such that `|G(w) − d*| < ε`,
`D(p* ‖ p_w) ≤ ε`.

**Formalization Note.** The equality is stated in `EReal` (matching `MaxEntPrimalObjective`'s
own `EReal` codomain, since `F` can take the value `+∞`); `sup_w G(w)` is a real (`ℝ`) real
supremum (`⨆`, a Mathlib `iSup` over a conditionally complete lattice, matching the standing
well-definedness convention already used for suprema throughout this series, e.g. chunk
`05-svm`'s `EmpiricalRademacherComplexity`), coerced into `EReal` for the comparison; `min_p
F(p)` is `sInf (Set.range (MaxEntPrimalObjective …))`, `EReal`'s own infimum (a complete
lattice). The hypothesis `hlam : 0 < λ` matches the book's own use of `λ > 0` in its proof (to
place `u₀` in the interior of `C`, invoking the qualification condition of Theorem B.39) — not
a free choice, dropping it would prove a materially different (and, per `BRIEF.md`'s named
trivialization trap, potentially false) statement than the book's own conditional duality
claim. `p*` is quantified by an explicit `IsLeast` hypothesis (the standard Lean idiom for "let
`p*` be a/the minimizer") rather than assumed to exist unconditionally. -/
theorem maxent_duality {X : Type*} [Fintype X] {N : ℕ}
    (p0 : X → ℝ) (hp0 : ∀ x, 0 < p0 x) (Φ : X → Fin N → ℝ) (r : ℝ) (hr : 0 ≤ r)
    (hΦ : ∀ x j, |Φ x j| ≤ r)
    (m : ℕ) (hm : 0 < m) (S : Fin m → X) (lam : ℝ) (hlam : 0 < lam) :
    (↑(⨆ w : Fin N → ℝ, MaxEntDualObjective p0 Φ S lam w) : EReal) =
        sInf (Set.range (MaxEntPrimalObjective p0 Φ S lam)) ∧
      ∀ p_star : X → ℝ,
        IsLeast (Set.range (MaxEntPrimalObjective p0 Φ S lam)) (MaxEntPrimalObjective p0 Φ S lam p_star) →
        ∀ ε : ℝ, 0 < ε → ∀ w : Fin N → ℝ,
          |MaxEntDualObjective p0 Φ S lam w -
              ⨆ w' : Fin N → ℝ, MaxEntDualObjective p0 Φ S lam w'| < ε →
            RelativeEntropy p_star (GibbsDistribution p0 Φ w) ≤ ε := by sorry

end FoundationsML.MaxEnt
Source
Mohri, Rostamizadeh & Talwalkar, Foundations of Machine Learning, 2nd ed., MIT Press 2018, p. 300, Theorem 12.2 (PDF p. 317)
Human review
  • Endorsed by Shuze Chen · Sep 28, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Sep 28, 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