Kraft's Inequality - Proof For Prefix Codes

Proof For Prefix Codes

Suppose that . Let be the full -ary tree of depth . Every word of length over an -ary alphabet corresponds to a node in this tree at depth . The th word in the prefix code corresponds to a node ; let be the set of all leaf nodes in the subtree of rooted at . Clearly

Since the code is a prefix code,

.


Thus, given that the total number of nodes at depth is ,

from which the result follows.

Conversely, given any ordered sequence of natural numbers,

satisfying the Kraft inequality, one can construct a prefix code with codeword lengths equal to by pruning subtrees from a full -ary tree of depth . First choose any node from the full tree at depth and remove all of its descendents. This removes fraction of the nodes from the full tree from being considered for the rest of the remaining codewords. The next iteration removes fraction of the full tree for total of . After iterations,

fraction of the full tree nodes are removed from consideration for any remaining codewords. But, by the assumption, this sum is less than 1 for all . Thus prefix code with lengths can be constructed for all source symbols.

Read more about this topic:  Kraft's Inequality

Famous quotes containing the words proof and/or codes:

    If some books are deemed most baneful and their sale forbid, how, then, with deadlier facts, not dreams of doting men? Those whom books will hurt will not be proof against events. Events, not books, should be forbid.
    Herman Melville (1819–1891)

    We must trust infinitely to the beneficent necessity which shines through all laws. Human nature expresses itself in them as characteristically as in statues, or songs, or railroads, and an abstract of the codes of nations would be an abstract of the common conscience.
    Ralph Waldo Emerson (1803–1882)