A Small Kraft Sum Calculation

Check whether three codeword lengths can fit a binary prefix tree by adding their shares of the tree.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace lengths one, two, two
  2. Spot an impossible assignment
  3. Interpret the sum as capacity in a binary tree
  4. Distinguish proof of existence from a particular assignment

For a binary prefix code with lengths \(\ell_j\), the Kraft sum satisfies \(\sum_j 2^{-\ell_j}\le1\).

Trace lengths one, two, two

Their sum is \(1/2+1/4+1/4=1\). A length-one word covers half the possible extensions. Two length-two words can cover the remaining half. See prefix trees for decoding.

Spot an impossible assignment

Lengths one, one, and two sum to 1.25. The two one-bit words already exhaust the available first branches. The Kraft inequality article extends this reasoning.[1][2]

Interpret the sum as capacity in a binary tree

Lengths one, three and three have Kraft sum \(1/2+1/8+1/8=3/4\). At depth three, the length-one codeword occupies four of eight descendant leaves. Each length-three word occupies one additional leaf. See prefix tree decoding.

Possible assignment: 0,100,101
Depth-three slots used: 4+1+1=6
Two slots can remain available

Distinguish proof of existence from a particular assignment

A sum at most one permits some binary prefix code with those lengths. Arbitrarily chosen codewords of the same lengths can still conflict. Check actual prefixes on the proposed assignment.

References

  1. Claude E. Shannon, A Mathematical Theory of Communication ↩
  2. David J. C. MacKay, Information Theory, Inference, and Learning Algorithms ↩