Let $(\{0,1 \}^ {\mathbb {N}},d)$ be a metric space, where $$d((a_{n})_{n\in\mathbb{N}},(b_{n})_{n\in\mathbb{N}})=\sum_{n=1}^{\infty}{\dfrac{|x_{n}-y_{n}|}{2^{n}}},\phantom{a}\forall (a_{n})_{n\in\mathbb{N}},(b_{n})_{n\in\mathbb{N}}\in\{0,1 \}^ {\mathbb {N}}.$$ Remember that the metric generated by d matches the product topology and $\{0,1\}$ s a discrete space.
Let $ f \colon \{0,1 \}^ {\mathbb {N}} \to [0,1] $ be a function given by
$$ f ((a_{i})_{i \in \mathbb {N}}) = \sum_{i = 1}^{\infty}{\dfrac{2a_{i}}{3 ^{i}}}, \phantom {a} \forall (a_{i}) _{i \in \mathbb {N}} \in \{0,1 \} ^{\mathbb {N}}. $$
f is a continuous function, where $$\mathcal{Z}=\bigcap_{n\in\mathbb{N}}{Z_{n}}$$ and $$Z_{n}=Z_{n-1}\setminus{\bigcup_{i=1}^{\dfrac{3^{n}-1}{2}}{\left(\dfrac{2i-1}{3^{n}},\dfrac{2i}{3^{n}}\right)}},\phantom{a}\forall n\geq 2.$$
Show that:
(1) f is well defined;
(2) f is injective;
(3) f is continuous;
(4) $f(\{0,1\}^{\mathbb{N}})=\mathcal{Z}.$
Attempt: Notice that
(1) Let $x=(a_{i})_{i\in\mathbb{N}}\in\{0,1\}^{\mathbb{N}}$ be. Then \begin{align*} f(x)&\leq \sum_{i=1}^{\infty}{\dfrac{2}{3^{i}}}\\ &=\dfrac{2}{3}\sum_{i=0}^{\infty}{\dfrac{1}{3^{i}}}\\ &=\dfrac{2}{3}\dfrac{1}{\left(1-\dfrac{1}{3}\right)}\\ &=\frac{2}{3}\dfrac{3}{2}\\ &=1 \end{align*}
(2) Let $x=(a_{i})_{i\in\mathbb{N}}\in\{0,1\}^{\mathbb{N}},\phantom{a}y=(b_{i})_{i\in\mathbb{N}}\in\{0,1\}^{\mathbb{N}}\in\{0,1\}^{\mathbb{N}}$ be. Let's suppose $f(x)=f(y).$ Let's see what $a_{i}=b_{i},\phantom{a}\forall i\in\mathbb{N}.$ Then \begin{align*} f(x)=f(y)&\Longleftrightarrow f(x)-f(y)=0\\ &\Longleftrightarrow \sum_{i=1}^{\infty}{\dfrac{2(a_{i}-b_{i})}{3^{i}}}=0\\ &\Longleftrightarrow \sum_{i=1}^{\infty}{\dfrac{(a_{i}-b_{i})}{3^{i}}}=0.\tag{1} \end{align*} Let $c_{i}=a_{i}-b_{i},\phantom{a}\forall i\in\mathbb{N}.$ With the above, you can prove that $c_{i}=0,\phantom{a}\forall i\in\mathbb{N}.$
(3) Let $x=(a_{i})_{i\in\mathbb{N}}\in\{0,1\}^{\mathbb{N}}$ and $\epsilon>0$ be. By archimedean property, there is $k\in\mathbb{N}$ such that $\dfrac{1}{2^{k}}<\epsilon.$ Let \begin{equation} \mathcal{C}=\bigcap_{i=1}^{k}{\pi_{i}^{-1}(\{a_{i}\})}.\tag{*} \end{equation} be. Then
(I) $\mathcal{C}$ is open, being a finite intersection of open;
(II) $x\in\mathcal{C}.$
By (I) and (II), there is $\delta>0$ such that $$\mathcal{B}_{d}(x,\delta)\subseteq{\mathcal{C}}.$$ Then $$f(\mathcal{B}_{d}(x,\delta))\subseteq{\mathcal{B}\left(f(x),\dfrac{1}{2^{k}}\right)}.$$
(4) I don't know how to prove that...
Any hints would be appreciated.