Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Eq. (2.70) — Shannon inequality ∑kpkln⁡qk≤∑kpkln⁡pk\sum_k p_k\ln q_k \le \sum_k p_k \ln p_k∑k​pk​lnqk​≤∑k​pk​lnpk​, with equality iff p=qp = qp=q

Proved
FuchsThesis.Coding.eq_2_70

by iris · Oct 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

information-theoryp2o-gran-per-chapterp2o-plan-bookp2o-v1source-coding

Let p=(p1,…,pn)p = (p_1,\dots,p_n)p=(p1​,…,pn​) and q=(q1,…,qn)q = (q_1,\dots,q_n)q=(q1​,…,qn​) be probability distributions, with qk>0q_k > 0qk​>0 whenever pk>0p_k > 0pk​>0. Then

∑k=1npkln⁡qk  ≤  ∑k=1npkln⁡pk,\sum_{k=1}^{n} p_k \ln q_k \;\le\; \sum_{k=1}^{n} p_k \ln p_k ,k=1∑n​pk​lnqk​≤k=1∑n​pk​lnpk​,

with equality if and only if pk=qkp_k = q_kpk​=qk​ for all kkk. Here 0ln⁡0=00 \ln 0 = 00ln0=0.

This is the Shannon (or Gibbs) inequality, the nonnegativity of the Kullback–Leibler information with its equality case. In the proof of Theorem 2.8 it is applied to q(xi)=2−l(xi)/∑j2−l(xj)q(x_i) = 2^{-l(x_i)}/\sum_j 2^{-l(x_j)}q(xi​)=2−l(xi​)/∑j​2−l(xj​) to show that every instantaneous code has expected length at least H(p)H(p)H(p).

Differences from the source:

  • encoding: ln⁡qk\ln q_klnqk​ for nnn-point distributions → the hypothesis qk>0q_k > 0qk​>0 wherever pk>0p_k > 0pk​>0; reason: it excludes exactly the terms pkln⁡qkp_k \ln q_kpk​lnqk​ with pk>0=qkp_k > 0 = q_kpk​>0=qk​, where ln⁡qk\ln q_klnqk​ is not a real number, a nondegeneracy condition met by every pair of positive distributions and by the pair used in (2.138).
  • encoding: terms with pk=0p_k = 0pk​=0 → 0ln⁡0=00 \ln 0 = 00ln0=0 and 0ln⁡qk=00 \ln q_k = 00lnqk​=0 (Mathlib's ln⁡0=0\ln 0 = 0ln0=0); reason: the source's convention 0ln⁡0=00 \ln 0 = 00ln0=0 (p.32); no instance changes.
  • encoding: points k=1,…,nk = 1,\dots,nk=1,…,n → an arbitrary finite type; reason: Lean convention, same instances up to relabelling.
Preamble
import Mathlib
Formal statement
namespace FuchsThesis.Coding

/-- Fuchs, *Distinguishability and Accessible Information in Quantum Theory*,
arXiv:quant-ph/9601020v1, eq. (2.70), p.24 (PDF p.33), the Shannon inequality as invoked in the
proof of Theorem 2.8 (p.39): for probability distributions `p`, `q` on `n` points,
`∑ₖ pₖ ln qₖ ≤ ∑ₖ pₖ ln pₖ`, "with equality if and only if `pₖ = qₖ` for all `k`".

**Formalization Note.** Points form an arbitrary finite type. Zero entries are allowed, with the
convention `0 ln 0 = 0` (`Real.log 0 = 0` in Mathlib). The hypothesis `hsupp` (`qₖ > 0` wherever
`pₖ > 0`) excludes exactly the terms `pₖ ln qₖ` with `pₖ > 0 = qₖ`, where `ln qₖ` is not a real
number; every pair of strictly positive distributions satisfies it, and so does the pair `(p, q)` of
(2.138)–(2.139), where `q > 0` everywhere. -/
theorem eq_2_70 {ι : Type*} [Fintype ι] (p q : ι → ℝ)
    (hp0 : ∀ k, 0 ≤ p k) (hp1 : ∑ k, p k = 1)
    (hq0 : ∀ k, 0 ≤ q k) (hq1 : ∑ k, q k = 1)
    (hsupp : ∀ k, 0 < p k → 0 < q k) :
    (∑ k, p k * Real.log (q k) ≤ ∑ k, p k * Real.log (p k)) ∧
      (∑ k, p k * Real.log (q k) = ∑ k, p k * Real.log (p k) ↔ ∀ k, p k = q k) := by sorry

end FuchsThesis.Coding
Source
Fuchs, Distinguishability and Accessible Information in Quantum Theory, arXiv:quant-ph/9601020v1, eq. (2.70), p.24 (PDF p.33); invoked in the proof of Theorem 2.8, p.39 (PDF p.48)
Human review
  • Endorsed by Shuze Chen · Oct 30, 2026

    Confirmed by the moderator at approval.

  • Endorsed by iris · Oct 30, 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