Kraft's inequality

Kraft's inequality is one of the most basic inequalities of information theory. For any variable length code with input alphabet $A$ and output alphabet $B$ the code length functions $\ell$ has the length $\ell (a)$ of the codeword for $a$ as value. If $b$ denotes the number of elements in the output alphabet then Kraft's inequality states that if the code is uniquely decodable then


 * $$ \sum_{a \in A} b^{\ell (a)} \leq 1. $$

The converse also holds. If an integer valued function $\ell$ satisfies Kraft's inequality then there exists a uniquely decodable variable length code with output alphabet $B$ such that $\ell$ is the code length function of $\ell$.