I saw a thread regarding functions and I have a related question.
Is it possible to have a function where the domain and the codomain are binary numbers?
For a decimal number $x\in \{0, 1, \dots, 2^n-1\}$ we have the binary respresentation \begin{align} x &= x_02^0 + x_12^1 + x_22^2 +\ldots+ x_{n-1}2^{n-1} \\ &= x_0 x_1 \cdots x_{n-1} \end{align} where $x_0,\ldots,x_{n-1}\in\{0,1\}$. We also have a second binary number \begin{align} y &= y_02^0 + y_12^1 + y_22^2 +\ldots+ y_{n-1}2^{n-1} \\ &= y_0 y_1 \cdots y_{n-1} \end{align} where $y_0,\ldots,y_{n-1}\in\{0,1\}$.
Question 1:
Can we now have a function with the domain $\{x\}$ and the codomain $\{y\}$? I.e. $$ f:\{x\} \rightarrow \{y\} \tag 1 $$
Question 2:
Is the function notation in $(1)$ equivalent to the following: $$ f:\{x_02^0 + x_12^1 + x_22^2 +\ldots+ x_{n-1}2^{n-1}\} \rightarrow \{y_02^0 + y_12^1 + y_22^2 +\ldots+ y_{n-1}2^{n-1}\} \tag 2 $$ $$ f:\{x_0x_1\cdots x_{n-1}\} \rightarrow \{y_0y_1\cdots y_{n-1}\} \tag 3 $$ If so, which notation is most correct/common?
The function is the same, you are just representing domain and codomain in two different ways.
$$f:\{0\} \rightarrow \{1\} = f:\{(0)_{10}\} \rightarrow \{(1)_{10}\}=f:\{(00)_{2}\} \rightarrow \{(01)_{2}\}$$
$\textbf{Answer 1:}$ yes.
$\textbf{Answer 2:}$ they are both correct, the usage depends on the context.