Kraft’s inequality
Getting round to re-reading Information and Coding Theory- in physical form after the disappointment of the Kindle edition.
Maybe it’s because I’m six months older and wiser, but this time more determined to grasp more of the maths in the book, so came to a basic precept of coding theory – Kraft’s inequality – which states:
There is an instantaneous -ary code
with word lengths
if and only if :
Let’s examine a proof of this: I found the proof in the book a bit difficult to follow, so this is why this follows the ideas in the book but in a little more detail.
So, we can imagine the space of the code words as a triangle (as shown):
The triangle contains the complete range of available code words and the small triangle
shows that picking a non-leaf code word denies us the ability to use leaves that are dominated by the non-leaf code word (in an instantaneous code).
So, if we total levels and picked a word at level
the we would lose access to
leaves.
Now, we know that (as the sum is less than or equal to 1).
But was can also state that because the sum contains the fraction – think of a 32 leaf binary code triangle where we had picked a code word from the third level, then we would have:
We thus see we can keep picking code words on this basis and we will always have an instantaneous code. But we also know that an instantaneous code is a prefix code and thus for a prefix code this inequality applies:
Diving both sides by we get:
Related articles
- Large Deviations 1 – Motivation and Cramer’s Theorem (eventuallyalmosteverywhere.wordpress.com)

2 comments