Solution (source code)

= Solution

If one comma codeword were a prefix of another, its terminal comma would occur inside the longer codeword, contrary to the definition. Thus every comma code is prefix-free. Directly, the disjoint cylinder sets of infinite strings beginning with the respective comma-terminated words have measures $q^{-l_i}$, so their total measure gives Kraft's inequality.

Kraft's inequality does not imply unique decipherability. Over the binary alphabet,
$$
C=\{0,01,10\}
$$
has Kraft sum $1/2+1/4+1/4=1$, but
$$
010=0\,|\,10=01\,|\,0.
$$
\b[Thus it is not <prefix code>[uniquely decipherable].]