Finite alphabet logic

87 Views Asked by At

I am reading some logic books right now and I have problems understanding this problem:

A "code" is an injective map $\phi:A^*\rightarrow \mathbb N$ where $A^*$ is the set of finite sequences with elements of $A$.

Now, can I write take the decimal notion as a coding from finite sequences from decimal numbers, i.e is the the map $\phi:A^*\rightarrow\mathbb N$ a code, with $A=\{1,2,3,4,5,6,7,8,9\}$ and $\phi(s_1,..,s_l)=\sum_{i<l}(s_i 10^{l-i})$ ?

My second question is, given a finite set $A=\{a_0,a_1,...,a_{m-1}\}$, how does the coding look like?

1

There are 1 best solutions below

4
On BEST ANSWER

In the first case, sure, you do have an injective map, so it is a code. To prove that it is injective, note that if $\phi(s_1,..,s_l) = \sum_{i<l}(s_i 10^{l-i})$, then dividing $\phi(s_1,..,s_l)$ by $10$ you get $s_l$ as a remainder, and $\sum_{i<l-1}(s_i 10^{l-i})$ as the quotient, so repeating the procedure you can determine all $s_i$ starting from $\phi(s_1,..,s_l)$, i.e., $\phi$ is injective.

In the second case, there are many different ways to do it. One is the following.

Choose $k$ so that $10^{k-1} < m \le 10^k$, and choose an arbitrary injective map $\psi : A \to B$, where $B = \{x \in \Bbb{N} : 0 \le x < 10^k\}$. For instance list the elements of $A$, and assign to each element its position in the list, starting from zero.

Then take $$ \phi(s_0, \dots, s_l) = \sum_{i = 0}^{l} \psi(s_i) 10^{ki}. $$