The following is the question (and its solution) that I was reading in the following link The binary map is bijective. but I did not fully understand the proof of surjectivity there.
The Question:
Consider the probability space $X = \{0,1\}^{\mathbb N}$ of sequences $x = (a_1, a_2, a_3, \dots)$ where each $a_i$ is either $0$ or $1.$ Take $\sigma$ to be the smallest $\sigma$-algebra that contains all cylinder sets $$C(n,A) = \{\textbf{x}| x_n \in A, A \subset \{0,1\}\}$$ that is, those sequences whose $n^{th}$ term belongs to some subset $A$ of $\{0,1\}.$ Let $\mu$ be the measure so that, given a finite collection $A_1, \dots , A_n \subset \{0,1\},$ we have $$\mu (\{\textbf{x} \,|\, x_i \in A_i, i = 1, \dots , n \}) = \Pi_{i=1}^{n}\frac{|A_i|}{2}.$$In the first step, it was proved that the set $X_{\infty}$ has measure zero.
Consider the map $\phi: X\setminus X_{\infty} \to [0,1)$ defined by $$\phi(a_1, a_2, \dots , a_n, \dots) = \sum_{i=1}^{\infty}a_i2^{-i}$$ so $\phi$ sends each sequence $(a_1, a_2,\dots)$ to the point $x$ in $[0,1)$ with that binary decimal expansion. Check that $\phi$ is a bijection. We may assume that $\phi$ is measurable with measurable inverse.
My questions are (The original OP question):
First: To check that it is 1-1: Assume that $\phi(\textbf{x}) = \phi(\textbf{y}) $ then $$\sum_n a_n 2^{-n} = \sum_n b_n 2^{-n}$$ but then how can I conclude that $a_i = b_i$ for every $1\leq i \leq n.$
For being surjective, I think this is immediate. Right?
$X_{\infty}$ definition.
the set $X_{\infty} = \{ (a_1, a_2, a_3, \dots )\,|\,\exists N s.t. \forall n \geq N, a_n = 1 \}$
The solution to the surjectivity part:
For surjectivity, you need to give a procedure/algorithm for how to find a sequence $(a_1,a_2,\ldots)$ in $X\setminus X_\infty$ such that $\phi(a_1,a_2,\ldots) = x$. I would suggest thinking about exactly how one does this in decimal. For instance how do you find the decimal representation of a number like $\sqrt{2}$. Well, you build it decimal place by decimal place. You first note that $1<\sqrt{2}<2$, so the first digit is 1. Then you note that $0.4 < \sqrt{2} - 1 < 0.5$, so the second digit is 4. Then $0.01 < \sqrt{2} - 1.4 < 0.02$, and so on. How might this process look in binary instead of base $10$, and can you formalise it?
You need to then justify why this sequence of finite approximations converges to the correct number. That is, show that $(x-\sum_{i=1}^n a_n 2^{-n}) \to 0$ as $n \to \infty$, and therefore conclude that $x=\sum_{i=1}^\infty a_n 2^{-n}$. You also need to explain why the sequence you generate is not in $X_\infty$.
My questions are:
I do not know how to come up with the algorithm in case of the binary, any clarification will be greatly appreciated!