Im sure this question has been asked here a lot, but I'd like to hear if the way I understood Cantor's diagonal proof is correct.
We know that $ \left(0,1\right)\sim\mathbb{R} $. So its enough to prove that $ (0,1) $ is uncountable.
Now, assume by contradiction that $ (0,1) $ is countable. It implies that exists injection $ f:\left(0,1\right)\to\mathbb{N} $, and by Cantor-Berenstein theorem it follows that exists a bijection
$ g:\mathbb{N}\to(0,1) $.
(Now we need to make and assumption that I do not fully understand, so explanations would be appreaciated. ) We assume that if $2$ real numbers has the same representaion as a decimal expansion that ends with $999999\dots$ and decimal expansion that ends with $00000\dots$ we'll take the expansion that ends with $0000\dots$
Now, from the last arguments we can count the interval $ (0,1) $ and write their decimal expansion:
$ g\left(0\right)=0.x_{0,0}x_{0,1}x_{0,2}.... $
$ g\left(1\right)=0.x_{1,0}x_{1,1}x_{1,2....} $
$ \vdots $
We'll show that $ f $ is not surjective. We'll define a sequence of numbers that would be the numbers in the decimal expansion of real number $ d $ such that $ d\notin Im(f) $.
define
$ y_{i}=\begin{cases} 2 & x_{i,i}=1\\ 1 & x_{i,i}\neq1 \end{cases} $
and define $ d=0.y_{0}y_{1}y_{2}\dots $.
Now assume by contradiction that exists $ i\in \mathbb{N} $ such that $ f(i)=d $. So the $ i_{th} $ digit in the decimal expansions of $ d $ and $ g(i) $ should be equal, but that's a contradiction.
Thus, $ g $ is not surjective.
I think this proof works, but Im not sure why would we need the assumption that we are taking the decimal expansion that ends with 00000 rather than the one that ends with 999999.
Thanks in advance.
For this step:
If it is possible that the same number may have two different representations, then it is not the case that f(i)=d implies that the digits of f(i) and d are the same. In order to make this step work, you need to have a unique representation for each number. Either 0000... or 9999... will do.