Eqs. (2.141)–(2.142) — the lengths give an instantaneous code and
ProvedFuchsThesis.Coding.eq_2_141_2_142information-theoryp2o-gran-per-chapterp2o-plan-bookp2o-v1source-coding
Let messages occur with probabilities , all strictly positive. Then:
- there is a binary instantaneous code whose codeword for has length for every (2.141);
- the minimal average codeword length satisfies
Here is the base-2 logarithm, is the smallest integer , and is the Shannon information in bits. The lengths in (2.141) are those of the Shannon code; they satisfy the Kraft inequality, which is why the code exists. This is the upper half of Shannon's noiseless coding theorem for distributions without zero probabilities.
Differences from the source:
- encoding: lengths for messages with probabilities → the hypothesis for all ; reason: is undefined, so the hypothesis excludes exactly the messages for which (2.141) has no meaning; the goal theorem covers zero probabilities.
- encoding: messages → an arbitrary finite type, →
Int.ceilcast to , →Real.logb 2; reason: Lean conventions, same values.
Preamble
import Mathlib import Definitions.Def_FuchsThesis_Coding_IsInstantaneous import Definitions.Def_FuchsThesis_Coding_expLength import Definitions.Def_FuchsThesis_Coding_minLength import Definitions.Def_BBPSSW_Distill_shannonBits
Formal statement
namespace FuchsThesis.Coding
/-- Fuchs, *Distinguishability and Accessible Information in Quantum Theory*,
arXiv:quant-ph/9601020v1, eqs. (2.141)–(2.142), p.39 (PDF p.48): "there is an instantaneous code
with codeword lengths given by `l(xᵢ) = ⌈−log p(xᵢ)⌉` (2.141) … because these integers satisfy the
Kraft inequality. Therefore it must hold that
`l̄_min ≤ ∑ᵢ p(xᵢ)⌈−log p(xᵢ)⌉ ≤ ∑ᵢ p(xᵢ)(−log p(xᵢ) + 1) = H(p) + 1` (2.142)."
**Formalization Note.** Messages form an arbitrary finite type `ι`; `log` is `Real.logb 2` and
`⌈·⌉` is `Int.ceil`. The hypothesis `hpos : ∀ i, 0 < p i` excludes exactly the messages for which
`⌈−log p(xᵢ)⌉` in (2.141) is undefined (`p(xᵢ) = 0`); the theorem `theorem_2_8` itself allows
zero probabilities. The conclusion has four parts: the code of (2.141) exists, and the two
inequalities and the final equality of the chain (2.142), with `H(p)` the published
`BBPSSW.Distill.shannonBits p = −∑ᵢ pᵢ log₂ pᵢ`. -/
theorem eq_2_141_2_142 {ι : Type*} [Fintype ι] (p : ι → ℝ)
(hpos : ∀ i, 0 < p i) (hp1 : ∑ i, p i = 1) :
(∃ c : ι → List Bool, IsInstantaneous c ∧
∀ i, ((c i).length : ℤ) = ⌈-Real.logb 2 (p i)⌉) ∧
minLength p ≤ ∑ i, p i * (⌈-Real.logb 2 (p i)⌉ : ℝ) ∧
∑ i, p i * (⌈-Real.logb 2 (p i)⌉ : ℝ) ≤ ∑ i, p i * (-Real.logb 2 (p i) + 1) ∧
∑ i, p i * (-Real.logb 2 (p i) + 1) = BBPSSW.Distill.shannonBits p + 1 := by sorry
end FuchsThesis.Coding
Source
Fuchs, Distinguishability and Accessible Information in Quantum Theory, arXiv:quant-ph/9601020v1, eqs. (2.141)–(2.142), p.39 (PDF p.48)
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.