Lecture 2 - 2025 / 2 / 25
- Infinite communication
- A probability distribution over the message
Goal: Minimize average code length
Prefix-Free Codes
(1) Prefi-free is a sufficient condition
(2) Is prefix-free a necessary condition? No
A: prefix-free codes
B: uniquely decodable codes
A⊊B
C∈BminE(ℓ(C))=C∈AminE(ℓ(C))
But why? (Uniquely decodable means ∀L,S(L)<2L where Where S(L) represents the number of strings of length L. By calculating S(L), Kraft inequality must be satisfied.)
∀C∗∈B such that E(ℓ(C∗)) achieves the minimum, ∃C~∗∈A,E(ℓ(C∗))=E(ℓ(C~∗))
Kraft Inequality for Prefix-free Codes
Theorem. Assume C=(c1,⋯,cn) is prefix-free, Let ℓ1,⋯,ℓn be the length (numbers of bits) of c1,⋯,cn. Then
i=1∑n2−ℓi≤1
Minimal Average Code Length
Setting: Message M={m1,⋯,mn}, probability distribution P={p1,⋯,pn}.
Goal: Find C={c1,⋯,cn} with length ℓ1,⋯,ℓn, C is prefix-free.
ℓ1,⋯,ℓnmini=1∑npiℓis.t. i=1∑n2−ℓi≤1,ℓi≥0
Note that ℓi may not in N.
WLOG we assume that ∑i=1n2−ℓi=1. Let qi=2−ℓi, then q1,⋯,qn is PMF,
q1,⋯,qnmaxi=1∑npilog2qi
Therefore, ℓi=−log2pi.
Definition (Entropy) Given a random source X (random variable), with PMF (p1,⋯,pn). The entropy of X is
H(X):=i=1∑npilog2pi1
- Minimal code length (description length)
- Quantify information
- Uniform distribution H(X) maximum. Deterministic H(X)=0.
- H measures uncertainty of X