grandes-ecoles 2023 Q5
View
Let $X$ be a non-empty finite set and $c : X \rightarrow \{0,1\}^+$ an injective application. We say that $c$ is a binary code on $X$. We further assume that $c$ is a prefix code, that is, for all $x \neq y$ in $X$, $c(x)$ is not a prefix of $c(y)$. We define $\bar{c} : X \rightarrow \{0,1\}^*$ such that for all $x \in X$, $c(x) = c(x)_1 \cdot \bar{c}(x)$ where $c(x)_1$ is the first element of the word $c(x)$.
(a) Verify that for all $x \neq y \in X$, if $c(x)_1 = c(y)_1$ then $\bar{c}(x) \neq \bar{c}(y)$ and $\bar{c}(x)$ is not a prefix of $\bar{c}(y)$.
(b) For $a \in \{0,1\}$ we denote $X_a = \{x \in X \mid c(x)_1 = a\}$. Show that if $X_a$ contains at least two elements, then the restriction of $\bar{c}$ to $X_a$ is a prefix code on $X_a$.
(c) Deduce that $\sum_{x \in X} 2^{-|c(x)|} \leq 1$. (Hint: One may decompose the sum into a sum over $X_0$ and $X_1$ and reason by induction on $L(c) = \max\{|c(x)| \mid x \in X\}$)