InformationTheory.Shannon.MaxEntropy.Constrained
Constrained maximum entropy (Cover–Thomas) #
For a pmf P : α → ℝ on a finite alphabet, the distribution maximizing Shannon entropy
H(P) = ∑ x, negMulLog (P x) subject to moment constraints ∑ x, P x · f i x = c i
is the Boltzmann–Gibbs exponential family
gibbsPmf f λ x := exp (∑ i, λ i · f i x) / Z(λ)
where Z(λ) = ∑ y, exp (∑ i, λ i · f i y) is the partition function.
The Lagrange parameter λ is passed in as a hypothesis rather than solved for.
Main definitions #
gibbsZ— partition functionZ(λ) := ∑ y, exp ⟨λ, f y⟩.gibbsPmf— Boltzmann–Gibbs pmfx ↦ exp ⟨λ, f x⟩ / Z(λ).
Main statements #
gibbsPmf_mem_stdSimplex—gibbsPmf f λ ∈ stdSimplex ℝ α.entropy_le_gibbs_of_constraints— under moment constraints,H(P) ≤ H(gibbsPmf f λ).entropy_eq_gibbs_iff_of_constraints— equality holds iffP = gibbsPmf f λ.
Implementation notes #
KKT / Lagrange duality is not available in Mathlib
(Mathlib/Analysis/Calculus/LagrangeMultipliers.lean notes the absence). The proof
avoids this via the Gibbs + Csiszár klDivPmf algebraic-identity route:
0 ≤ klDivPmf P (gibbsPmf f λ) = −H(P) − ⟨λ, c⟩ + log Z(λ)
0 = klDivPmf (gibbsPmf f λ) (gibbsPmf f λ) = −H(gibbsPmf f λ) − ⟨λ, c⟩ + log Z(λ)
This avoids any need for ψ(λ) convexity or Lagrange-multiplier existence theory.
We use CsiszarProjection.klDivPmf rather than Mathlib.MeasureTheory.Measure.Tilted
because the Csiszár API (klDivPmf_nonneg, klDivPmf_self_eq_zero) is closed in the pmf
world, and Real.exp / log arithmetic suffices without rnDeriv or =ᵐ arguments.
References #
- T. M. Cover and J. A. Thomas, Elements of Information Theory (2nd ed.), Wiley, 2006.
Gibbs pmf: definition and basic properties #
InformationTheory.Shannon.MaxEntropyConstrained.gibbsZ
sourcePartition function Z(λ) := ∑ y, exp (∑ i, λ i · f i y). Independent def so
that Real.log Z(λ) can be reused throughout the core identity.
Equations
- InformationTheory.Shannon.MaxEntropyConstrained.gibbsZ f lam = ∑ y : α, Real.exp (∑ i : Fin k, lam i * f i y)
Instances For
Used by
InformationTheory.Shannon.MaxEntropyConstrained.gibbsPmf
sourceBoltzmann–Gibbs exponential family pmf, parametrized by Lagrange parameter
lam : Fin k → ℝ and feature maps f : Fin k → α → ℝ:
gibbsPmf f λ x := exp (∑ i, λ i · f i x) / Z(λ).
The denominator Z(λ) (gibbsZ f lam) is the partition function.
Equations
- InformationTheory.Shannon.MaxEntropyConstrained.gibbsPmf f lam x = Real.exp (∑ i : Fin k, lam i * f i x) / InformationTheory.Shannon.MaxEntropyConstrained.gibbsZ f lam
Instances For
Used by
InformationTheory.Shannon.MaxEntropyConstrained.gibbsZ_pos
sourceThe partition function Z(λ) is strictly positive (each summand is exp _ > 0
and there is at least one term by [Nonempty α]).
Used by
InformationTheory.Shannon.MaxEntropyConstrained.gibbsPmf_pos
sourceEach component of gibbsPmf f λ is strictly positive.
Used by
InformationTheory.Shannon.MaxEntropyConstrained.gibbsPmf_nonneg
sourcegibbsPmf f λ is non-negative pointwise (corollary of positivity).
Used by
InformationTheory.Shannon.MaxEntropyConstrained.gibbsPmf_sum_eq_one
sourceThe mass of gibbsPmf f λ sums to 1.
Used by
InformationTheory.Shannon.MaxEntropyConstrained.gibbsPmf_mem_stdSimplex
sourcegibbsPmf f λ ∈ stdSimplex ℝ α.
Used by
InformationTheory.Shannon.MaxEntropyConstrained.log_gibbsPmf
sourceClosed form for log (gibbsPmf f λ x): the numerator's exponent minus log Z(λ).
Used by
Core identity and main upper bound #
InformationTheory.Shannon.MaxEntropyConstrained.klDivPmf_gibbsPmf_eq
sourceFor any Q ∈ stdSimplex on α, the KL divergence from Q to gibbsPmf f λ
decomposes into negative entropy, the constraint inner product ⟨λ, 𝔼_Q[f]⟩, and
log Z(λ):
klDivPmf Q (gibbsPmf f λ) = -H(Q) - ⟨λ, 𝔼_Q[f]⟩ + log Z(λ).
Used by
InformationTheory.Shannon.MaxEntropyConstrained.entropy_le_gibbs_of_constraints
sourceMaximum entropy theorem (upper bound, pmf form): under moment constraints
∑ x, P x · f i x = c i for all i, and assuming the same constraints hold for the
Boltzmann–Gibbs ansatz gibbsPmf f λ for some fixed Lagrange parameter
lam : Fin k → ℝ, the entropy of P is bounded by the entropy of the gibbs
distribution:
H(P) ≤ H(gibbsPmf f λ).
The Lagrange parameter lam is passed in as a hypothesis (with the matching
constraint witness h_gibbs_constraints), so the result does not need ψ(λ) convexity
or any Lagrange-multiplier existence theory.
Used by
Uniqueness #
InformationTheory.Shannon.MaxEntropyConstrained.klDivPmf_eq_zero_iff_pmf
sourceFor a full-support reference pmf Q, klDivPmf P Q = 0 ↔ P = Q.
Used by
InformationTheory.Shannon.MaxEntropyConstrained.entropy_eq_gibbs_iff_of_constraints
sourceMaximum entropy theorem (uniqueness, pmf form): H(P) = H(gibbsPmf f λ) if and
only if P = gibbsPmf f λ pointwise.
Used by
Special cases #
Zero feature map reduces to uniform pmf #
InformationTheory.Shannon.MaxEntropyConstrained.gibbsZ_zero
sourcegibbsZ of the zero feature map is just Fintype.card α (each exp 0 = 1 summed
N times).
Used by
InformationTheory.Shannon.MaxEntropyConstrained.gibbsPmf_zero_eq_uniform
sourceWith the zero feature map, gibbsPmf is the uniform pmf x ↦ 1 / Fintype.card α.
Used by
InformationTheory.Shannon.MaxEntropyConstrained.entropy_uniform_pmf
sourceEntropy of the uniform pmf x ↦ 1 / N is log N.
Used by
InformationTheory.Shannon.MaxEntropyConstrained.entropy_gibbsPmf_zero_eq_log_card
sourceWith the zero feature map, the Gibbs entropy equals log (Fintype.card α).
Used by
Bernoulli case #
InformationTheory.Shannon.MaxEntropyConstrained.boolFeature
sourceThe two-point feature map: indicator of true.
Equations
Instances For
Used by
InformationTheory.Shannon.MaxEntropyConstrained.gibbsPmf_bool_sum_eq_one
sourceFor any λ : Fin 1 → ℝ,
gibbsPmf boolFeature λ true + gibbsPmf boolFeature λ false = 1.
Used by
InformationTheory.Shannon.MaxEntropyConstrained.gibbsPmf_bool_true_eq_of_mean
sourceFor any λ and any μ ∈ (0,1), if the mean constraint
gibbsPmf boolFeature λ · 1 + gibbsPmf boolFeature λ · 0 = μ holds, then
gibbsPmf boolFeature λ true = μ.
Used by
InformationTheory.Shannon.MaxEntropyConstrained.gibbsPmf_bool_false_eq_of_mean
sourceUnder the same mean constraint, gibbsPmf boolFeature λ false = 1 - μ.
Used by
InformationTheory.Shannon.MaxEntropyConstrained.entropy_gibbsPmf_bool_eq_binEntropy
sourceUnder mean constraint μ, the Gibbs
entropy on Bool is exactly the binary entropy Real.binEntropy μ (= textbook
-μ log μ - (1-μ) log (1-μ), Ex. 12.1).
Used by
Discretized exponential (geometric ratio form) #
InformationTheory.Shannon.MaxEntropyConstrained.linearFeature
sourceThe discrete "linear" feature map on Fin (N+1): f 0 x := (x.val : ℝ).
Equations
Instances For
Used by
InformationTheory.Shannon.MaxEntropyConstrained.gibbsPmf_linearFeature_eq_geometric
sourceGeometric ratio form — setting q := exp (λ 0),
the Gibbs distribution with the linear feature is the geometric ratio
x ↦ q^x.val / ∑ y, q^y.val on Fin (N+1). Lagrange parameter λ is left as an
ansatz; choosing λ 0 = log q then yields the geometric distribution with ratio q.