Lean, informalized

Nielsen & Chuang · Chapter 12, Quantum information theory · p. 542

Exercise 12.5 - A lossless code built on the typical sequences, with expected length per letter at most any rate above the entropy

Compression without error at any rate above the entropy.

Hover over a blue or green term in the text, or a node in the graph, to find it in the other. Select it to read its declaration both in Lean and in words.

The Exercise

A source emits letters x1,x2,…x_1, x_2, \dots from a finite alphabet 𝒳\mathcal{X}, independently, each equal to the letter aa with probability p(a)p(a), so that a block x=(x1,…,xn)x = (x_1, \dots, x_n) of nn letters has probability p(x1)⋯p(xn)p(x_1) \cdots p(x_n). Each block is to be written as a string of bits without error: two different blocks never receive the same string, though the strings may differ in length. The code numbers the typical blocks apart from the others and spends one bit to say which list a block is in. The exercise is to show that for any rate RR above the entropy of the source in bits per letter, the tolerance that defines typicality can be chosen, and the blocks taken long enough, so that the expected length of the string is at most nRnR bits.

The Entropy and the Code

The Shannon entropy of a distribution pp on a finite alphabet 𝒳\mathcal{X} is the real number H(p)=−∑a∈𝒳p(a)log⁡p(a),H(p) = -\sum_{a \in \mathcal{X}} p(a) \log p(a),(1)✦ with the natural logarithm, so that H(p)H(p) is measured in nats and H(p)/log⁡2H(p)/\log 2 is the entropy in bits.

Fix a block length nn and a tolerance ε\varepsilon, and let T(n,ε)T(n,\varepsilon) be the set of blocks xx of length nn with −1nlog⁡(p(x1)⋯p(xn))-\frac{1}{n}\log\big(p(x_1)\cdots p(x_n)\big) within ε\varepsilon of H(p)H(p), the blocks typical with tolerance ε\varepsilon.

The typical sequence code Cn,εC_{n,\varepsilon} sends a block x∈𝒳nx \in \mathcal{X}^n to the string of bits Cn,ε(x)={0bT(x),x∈T(n,ε),1b(x),x∉T(n,ε),C_{n,\varepsilon}(x) = \begin{cases} 0\, b_T(x), & x \in T(n,\varepsilon),\\ 1\, b(x), & x \notin T(n,\varepsilon), \end{cases}(2)✦ where bT(x)b_T(x) is a string of fixed length ℓT\ell_T that numbers xx among the typical blocks, with |T(n,ε)|≤2ℓT|T(n,\varepsilon)| \le 2^{\ell_T}, and b(x)b(x) is a string of fixed length ℓ\ell that numbers xx among all blocks, with |𝒳|n≤2ℓ|\mathcal{X}|^n \le 2^{\ell}. The length of the codeword, 1+ℓT1 + \ell_T bits for a typical block and 1+ℓ1 + \ell bits for any other, is written |Cn,ε(x)||C_{n,\varepsilon}(x)|.

The Claim

Theorem 1. Let pp be a probability distribution on a finite alphabet 𝒳\mathcal{X} and RR a rate above its entropy in bits, H(p)<Rlog⁡2H(p) < R \log 2. Then there are a tolerance ε>0\varepsilon > 0 and a block length N≥1N \ge 1 such that for every n≥Nn \ge N the code Cn,εC_{n,\varepsilon} gives distinct blocks distinct codewords and its expected length obeys ∑x∈𝒳np(x1)⋯p(xn)|Cn,ε(x)|≤nR.\sum_{x \in \mathcal{X}^n} p(x_1) \cdots p(x_n)\, |C_{n,\varepsilon}(x)| \le nR.(3)✦

What Is Checked

The claim is stated over the Shannon entropy (1), against which the rate is measured, and over the code Cn,εC_{n,\varepsilon} of (2).