Formal Definition

In information theory and coding theory, a code is simply a rule (or mapping) that transforms each symbol (or sequence of symbols) from some source alphabet into a finite sequence of symbols over a code alphabet (often bits, $0$ and $1$).

  • Source alphabet $\Sigma$: the set of things you want to represent (e.g. letters, words, pixel values).

  • Code alphabet $S$: the set of symbols you’ll actually use to represent them (often $\lbrace 0,1 \rbrace$).

  • A Codewords Set is the sequence in $S^*$ assigned to a particular source symbol.

Formally, a code is an injective function

$$ f: \Sigma \longrightarrow S^*, $$

that assigns to each source symbol $\sigma \in \Sigma$ a unique codeword $f(\sigma)\in S^*$.

 

Informal Definition

In practice we almost always identify the code with its image, the set of codewords

$$ C = f(\Sigma) = \lbrace f(\sigma)\mid \sigma \in \Sigma \rbrace \subseteq S^* $$

So when you read $`` \text{a code } C \text{ over the alphabet } S,’’$ it means $`` \text{a set } C \text{ of strings drawn from } S^* ,’’$ and implicitly there is an underlying function $f$ whose outputs are exactly those strings.

Last updated 09 May 2025, 23:43 +0500 . history