For a binary prefix code with length function , the Kraft inequality is
For the direct half of the code-distribution correspondence, let be the length function of a binary prefix code and put
Then is a probability mass function and
Thus every prefix code determines a distribution whose ideal description lengths do not exceed the codeword lengths.
Conversely, given a probability mass function , set
for . Then , so the Kraft inequality is satisfied. Its converse supplies a binary prefix code with these lengths, and
If real lengths are allowed, the ideal choice satisfies Kraft with equality.
Write , , and
On the support of , define the probability mass function
For any real length function satisfying the Kraft inequality, put and . The Gibbs inequality gives
Equality holds for the ideal weighted lengths
Thus the smallest average weighted description length is
When has full support, the displayed attains this minimum. If some strings have zero probability, the same value is the infimum over finite lengths and is attained by the extended-real ideal assignment there; finite codewords of arbitrarily large length approach it.

Articles by others on the same topic (0)

There are currently no matching articles.