InformationTheory

InformationTheory.Shannon.MaxEntropy.ConstrainedKKT

source

Constrained Maximum Entropy — Lagrange / KKT perspective #

The Boltzmann–Gibbs main theorems (entropy_le_gibbs_of_constraints, entropy_eq_gibbs_iff_of_constraints), stated in the gibbsPmf f λ notation, are recast here in the KKT / exponential-family language:

expFamilyDist λ f x := exp (⟨λ, f x⟩ - ψ(λ)) logPartitionψ λ f := log (∑ y, exp ⟨λ, f y⟩)

with ψ(λ) = logPartitionψ the log-partition function. The two presentations are equal pointwise (expFamilyDist_eq_gibbsPmf), so every property of gibbsPmf transports to expFamilyDist. The KKT first-order condition (∇ψ(λ) = 𝔼[f] in the unconstrained Lagrangian) appears as the moment-matching hypothesis which we pass through (Mathlib lacks the convex-duality theorems needed to solve for λ; it does have everything we need to use a given solution).

Main definitions #

Main statements #

Approach #

We define logPartitionψ and expFamilyDist via the existing gibbsZ and gibbsPmf (a single Real.exp_sub step bridges the two presentations). All theorems are then proved by direct reduction to their gibbsPmf analogues in MaxEntropy/Constrained.lean. The KKT first-order condition is encoded as the constraint-witness hypothesis ∀ i, ∑ x, expFamilyDist λ f x · f i x = c i (equivalent to ∇ψ(λ) = 𝔼_{p*}[f] at the saddle point, but stated in the ansatz-pass-through form to avoid the convex-duality theorems Mathlib does not provide).

References #

  • T. M. Cover and J. A. Thomas, Elements of Information Theory (2nd ed.), Wiley, 2006.

Section 1 — Log-partition function and exponential-family pmf #

noncomputable def

InformationTheory.Shannon.MaxEntropyConstrainedKKT.logPartitionψ

source
{α : Type u_1} [Fintype α] {k : } (f : Fin kα) (lam : Fin k) :

Log-partition function ψ(λ) := log (∑ y, exp ⟨λ, f y⟩).

In the Lagrangian for constrained maximum entropy, ψ(λ) is the Legendre dual of H and its gradient ∇ψ(λ) = 𝔼_{p_λ^*}[f] encodes the KKT first-order condition (moment matching).

Equations
Instances For
    Used by
      noncomputable def

      InformationTheory.Shannon.MaxEntropyConstrainedKKT.expFamilyDist

      source
      {α : Type u_1} [Fintype α] {k : } (f : Fin kα) (lam : Fin k) :
      α

      Exponential family pmf, Lagrangian / KKT-canonical form:

      expFamilyDist λ f x := exp (⟨λ, f x⟩ - ψ(λ))

      where ⟨λ, f x⟩ = ∑ i, λ i · f i x. This is the saddle-point optimizer of the Lagrangian L(p, λ) = H(p) + ∑ i, λ i (𝔼_p[f i] - c i). By expFamilyDist_eq_gibbsPmf it agrees pointwise with gibbsPmf f λ, so all positivity / pmf properties transfer.

      Equations
      Instances For
        Used by
          theorem

          InformationTheory.Shannon.MaxEntropyConstrainedKKT.expFamilyDist_eq_gibbsPmf

          source
          {α : Type u_1} [Fintype α] {k : } [Nonempty α] (f : Fin kα) (lam : Fin k) :

          Bridge: the KKT-canonical form expFamilyDist agrees pointwise with the Boltzmann–Gibbs form gibbsPmf:

          exp (⟨λ, f x⟩ - ψ(λ)) = exp ⟨λ, f x⟩ / Z(λ).

          Proof: Real.exp_sub + Real.exp_log on Z(λ) > 0.

          Used by

            Section 2 — Basic positivity / pmf properties transported from gibbsPmf #

            theorem

            InformationTheory.Shannon.MaxEntropyConstrainedKKT.expFamilyDist_pos

            source
            {α : Type u_1} [Fintype α] {k : } [Nonempty α] (f : Fin kα) (lam : Fin k) (x : α) :
            0 < expFamilyDist f lam x

            expFamilyDist is pointwise strictly positive.

            Used by
              theorem

              InformationTheory.Shannon.MaxEntropyConstrainedKKT.expFamilyDist_mem_stdSimplex

              source
              {α : Type u_1} [Fintype α] {k : } [Nonempty α] (f : Fin kα) (lam : Fin k) :

              expFamilyDist λ f ∈ stdSimplex ℝ α.

              Used by

                Section 3 — KKT solution packaging #

                structure

                InformationTheory.Shannon.MaxEntropyConstrainedKKT.KKTSolution

                source
                {α : Type u_1} [Fintype α] {k : } (f : Fin kα) (c : Fin k) :

                KKT solution for the constrained maximum-entropy problem with feature maps f : Fin k → α → ℝ and moment targets c : Fin k → ℝ.

                A KKTSolution f c packages a Lagrange multiplier vector lam : Fin k → ℝ with a proof that the exponential-family ansatz expFamilyDist f lam satisfies the moment-matching first-order condition 𝔼_{p*}[f i] = c i for all i.

                This is precisely the KKT condition for the Lagrangian L(p, λ) = H(p) + ∑ i, λ i (𝔼_p[f i] - c i): stationarity in p picks out the exponential family, and feasibility in λ is the moment match.

                • lam : Fin k

                  Lagrange multiplier (one per feature / constraint).

                • moment_match(i : Fin k) : x : α, expFamilyDist f self.lam x * f i x = c i

                  KKT moment-matching condition — ∇ψ(λ) = c, equivalently 𝔼_{p*}[f i] = c i for all i.

                Instances For
                  Used by
                    theorem

                    InformationTheory.Shannon.MaxEntropyConstrainedKKT.KKTSolution.gibbs_moment_match

                    source
                    {α : Type u_1} [Fintype α] {k : } [Nonempty α] {f : Fin kα} {c : Fin k} (S : KKTSolution f c) (i : Fin k) :
                    x : α, MaxEntropyConstrained.gibbsPmf f S.lam x * f i x = c i

                    KKT-solution moment matching restated in the gibbsPmf language.

                    Used by

                      Section 4 — Legendre identity: self-entropy of the exponential family #

                      theorem

                      InformationTheory.Shannon.MaxEntropyConstrainedKKT.entropy_expFamilyDist_eq_legendre

                      source
                      {α : Type u_1} [Fintype α] {k : } [Nonempty α] (f : Fin kα) (c : Fin k) (S : KKTSolution f c) :
                      x : α, (expFamilyDist f S.lam x).negMulLog = logPartitionψ f S.lam - i : Fin k, S.lam i * c i

                      Legendre / saddle-point identity for the exponential family. With KKT solution (λ, moment_match) for constraints c, the entropy of the exponential-family optimum has the closed form

                      H(p*) = ψ(λ) - ⟨λ, c⟩.

                      This is the KKT duality: at the saddle point of the Lagrangian, the primal value equals the dual value ψ(λ) - ⟨λ, c⟩.

                      Used by

                        Section 5 — Main theorem: exponential family maximizes constrained entropy #

                        theorem

                        InformationTheory.Shannon.MaxEntropyConstrainedKKT.expFamily_maximizes_entropy

                        source
                        {α : Type u_1} [Fintype α] {k : } [Nonempty α] (f : Fin kα) (c : Fin k) (P : α) (hP : P stdSimplex α) (hP_constraints : ∀ (i : Fin k), x : α, P x * f i x = c i) (lam : Fin k) (h_KKT : ∀ (i : Fin k), x : α, expFamilyDist f lam x * f i x = c i) :
                        x : α, (P x).negMulLog x : α, (expFamilyDist f lam x).negMulLog

                        Maximum entropy theorem (upper bound, KKT form): under moment constraints 𝔼_P[f i] = c i for all i, the entropy of P is bounded above by the entropy of the exponential-family solution expFamilyDist f λ, provided the latter also satisfies the same moments (KKT first-order condition).

                        Used by
                          theorem

                          InformationTheory.Shannon.MaxEntropyConstrainedKKT.expFamily_maximizes_entropy_of_KKT

                          source
                          {α : Type u_1} [Fintype α] {k : } [Nonempty α] (f : Fin kα) (c : Fin k) (P : α) (hP : P stdSimplex α) (hP_constraints : ∀ (i : Fin k), x : α, P x * f i x = c i) (S : KKTSolution f c) :
                          x : α, (P x).negMulLog x : α, (expFamilyDist f S.lam x).negMulLog

                          Maximum entropy theorem (upper bound, KKTSolution form): a constraint-feasible P cannot exceed the entropy of the exponential-family solution attached to a KKT witness.

                          See also expFamily_maximizes_entropy.

                          Used by

                            Section 6 — Uniqueness of the exponential-family maximizer #

                            theorem

                            InformationTheory.Shannon.MaxEntropyConstrainedKKT.expFamily_unique

                            source
                            {α : Type u_1} [Fintype α] {k : } [Nonempty α] (f : Fin kα) (c : Fin k) (P : α) (hP : P stdSimplex α) (hP_constraints : ∀ (i : Fin k), x : α, P x * f i x = c i) (lam : Fin k) (h_KKT : ∀ (i : Fin k), x : α, expFamilyDist f lam x * f i x = c i) :
                            x : α, (P x).negMulLog = x : α, (expFamilyDist f lam x).negMulLog P = expFamilyDist f lam

                            Maximum entropy theorem (uniqueness, KKT form): for constraint-feasible P and a KKT-witnessed exponential-family solution, entropy equality H(P) = H(expFamilyDist f λ) holds if and only if P = expFamilyDist f λ pointwise.

                            Used by
                              theorem

                              InformationTheory.Shannon.MaxEntropyConstrainedKKT.expFamily_unique_of_KKT

                              source
                              {α : Type u_1} [Fintype α] {k : } [Nonempty α] (f : Fin kα) (c : Fin k) (P : α) (hP : P stdSimplex α) (hP_constraints : ∀ (i : Fin k), x : α, P x * f i x = c i) (S : KKTSolution f c) :
                              x : α, (P x).negMulLog = x : α, (expFamilyDist f S.lam x).negMulLog P = expFamilyDist f S.lam

                              Maximum entropy theorem (uniqueness, KKTSolution form): entropy equality holds if and only if P = expFamilyDist f λ pointwise.

                              See also expFamily_unique.

                              Used by

                                Section 7 — Variational form (free-energy / Legendre dual upper bound) #

                                theorem

                                InformationTheory.Shannon.MaxEntropyConstrainedKKT.entropy_le_logPartition_sub_inner

                                source
                                {α : Type u_1} [Fintype α] {k : } [Nonempty α] (f : Fin kα) (c : Fin k) (P : α) (hP : P stdSimplex α) (hP_constraints : ∀ (i : Fin k), x : α, P x * f i x = c i) (lam : Fin k) (h_KKT : ∀ (i : Fin k), x : α, expFamilyDist f lam x * f i x = c i) :
                                x : α, (P x).negMulLog logPartitionψ f lam - i : Fin k, lam i * c i

                                Variational upper bound (Legendre / free-energy form) — any constraint-feasible P satisfies the dual bound

                                H(P) ≤ ψ(λ) - ⟨λ, c⟩

                                for every λ whose exponential-family solution satisfies the same moments. This is the variational characterization of logPartitionψ as the Legendre transform of -H restricted to the feasibility set.

                                Used by
                                  theorem

                                  InformationTheory.Shannon.MaxEntropyConstrainedKKT.entropy_le_logPartition_sub_inner_of_KKT

                                  source
                                  {α : Type u_1} [Fintype α] {k : } [Nonempty α] (f : Fin kα) (c : Fin k) (P : α) (hP : P stdSimplex α) (hP_constraints : ∀ (i : Fin k), x : α, P x * f i x = c i) (S : KKTSolution f c) :
                                  x : α, (P x).negMulLog logPartitionψ f S.lam - i : Fin k, S.lam i * c i

                                  KKT-packaged variational form.

                                  Used by

                                    Section 8 — KKT first-order moment-matching reformulation #

                                    theorem

                                    InformationTheory.Shannon.MaxEntropyConstrainedKKT.KKT_moment_match_iff_gibbs_moment_match

                                    source
                                    {α : Type u_1} [Fintype α] {k : } [Nonempty α] (f : Fin kα) (c lam : Fin k) :
                                    (∀ (i : Fin k), x : α, expFamilyDist f lam x * f i x = c i) ∀ (i : Fin k), x : α, MaxEntropyConstrained.gibbsPmf f lam x * f i x = c i

                                    KKT first-order condition equivalence — the moment-matching hypothesis 𝔼_{p*}[f] = c (the gradient-of-ψ condition ∇ψ(λ) = c) is equivalent to the gibbs ansatz satisfying the same constraint as P. This is the formal content of "KKT stationarity in λ".

                                    Used by

                                      Section 9 — Stationarity expansion: log-pmf is affine in features #

                                      Section 10 — Tier 3 stretch: zero-multiplier reduction = uniform #

                                      theorem

                                      InformationTheory.Shannon.MaxEntropyConstrainedKKT.expFamilyDist_lam_zero_eq

                                      source
                                      {α : Type u_1} [Fintype α] {k : } [Nonempty α] (f : Fin kα) :
                                      (expFamilyDist f fun (x : Fin k) => 0) = fun (x : α) => 1 / (Fintype.card α)

                                      KKT zero-multiplier reduction: expFamilyDist f 0 = expFamilyDist g 0 for any features f, g (both equal to the uniform pmf). This is the unconstrained-Lagrangian degenerate case λ = 0.

                                      Used by