I started to make a demonstration of Cantor's diagonal argument on Mathematica, by reading here, I've noticed that I'd need to do a list of tuples with binary digits, and I tried to do it on Mathematica with the following command:
TableForm[Tuples[{0, 1}, 4]]
Which yields:
$$\begin{array}{cccc} 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 1 & 1 \\ 0 & 1 & 0 & 0 \\ 0 & 1 & 0 & 1 \\ 0 & 1 & 1 & 0 \\ 0 & 1 & 1 & 1 \\ 1 & 0 & 0 & 0 \\ 1 & 0 & 0 & 1 \\ 1 & 0 & 1 & 0 \\ 1 & 0 & 1 & 1 \\ 1 & 1 & 0 & 0 \\ 1 & 1 & 0 & 1 \\ 1 & 1 & 1 & 0 \\ 1 & 1 & 1 & 1 \\ \end{array}\tag{1}$$
And then I tried to apply the diagonal argument:
$$$$\begin{array}{cccc} & \color{red}{0} & 0 & 0 & 0 \\ & 0 & \color{red}{0} & 0 & 1 \\ & 0 & 0 & \color{red}{1} & 0 \\ \rightarrow& 0 & 0 & 1 & \color{red}{1} \end{array}$$ $$
And found a number that is already on the list, that number is already in the fourth row of the list. I looked at the wikipedia page again and noticed that the list of sequences of binary digits have a pattern that is completely different of the pattern I constructed:
$$\begin{array}{ccccccc} 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 0 & 1 & 0 & 1 & 0 & 1 & 0 \\ 1 & 0 & 1 & 0 & 1 & 0 & 1 \\ 1 & 1 & 0 & 1 & 0 & 1 & 1 \\ 0 & 0 & 1 & 1 & 0 & 1 & 1 \\ 1 & 0 & 0 & 0 & 1 & 0 & 0 \\ \end{array}\tag{2}$$
And that in this pattern, the afirmation about the diagonal sequence not being in the set of sequences is true. I got curious about the following:
- What is this pattern? I mean, what is the formula to make it? I've read one book that had the following construction:
$$\begin{array}{ccccccc} \mathbb{N} & 1 & 2 & 3 & 4 & 5 & \cdots \\ \text{Is prime} & 0 & 1 & 1 & 0 & 1 & \cdots \\ \text{Is odd} & 1 & 0 & 1 & 0 & 1 & \cdots \\ \text{Is even} & 0 & 1 & 0 & 1 & 0 & \cdots \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \ddots \\ \end{array}\tag{3}$$
And the diagonal proposition works here too, but I noticed that this new pattern is different from the previous one - But I can notice that they have something in common because the the diagonal argument works in both of them.
What property do the lists $(2)$ and $(3)$ share that enables them to have the diagonal argument applied on them succesfully?
Why choose the set of sequences that have this property instead of the one I proveded in $(1)$? - The question may be silly, but in the book I read about (and even in the wikipedia link I provided), it says:
$$\text{"In his 1891 article, Cantor considered the set T of all infinite sequences of binary digits"}$$
And I guess the sequence I provided is also a list of all infinite sequences of binary digits, I'd just need to change the $4$ in TableForm[Tuples[{0, 1}, 4]].