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.