# Embedding 2nd countable, zero-dimensional Hausdorff space in the Cantor space

The Cantor Space $2^{\mathbb N}$ is the space of all infinite $0$-$1$-sequences with the metric $d(x,y) = 0$ for $x=y$ or $d(x,y) = 1/k$ where $k$ is the least integer such that $x_k \ne y_k$.

Now I read the following proof: Every second-countable Hausdorff zero-dimensional space $X$ with clopen $\{ B_i \}_{i \in \mathbb N}$ could be embedded into Cantor space via the map $f : X \to 2^{\mathbb N}$ where each $f(x)$ is the characteristic function of the set $\{ i \in \mathbb N : x \in B_i \}$, i.e. $f(x)(i) = 1$ iff $x \in B_i$. Then $d(f(x), f(y))$ gives a metric for $X$.

But where do I need that $X$ is zero-dimensional. As I see it the condition secound-countable and Hausdorff are enough, the first ensures that we can asscociate to each $x \in X$ a subset of $\mathbb N$, the Hausdorff condition ensures that the map is an injection (actually I think $T_1$ would also be enough to assume here). That it is a metric is also clear. But I do not see where zero-dimensionality is used?

More to the point, if $\{ B_i : i \in \mathbb{N} \}$ were a base for the second-countable Hausdorff $X$, and $f : X \to 2^{\mathbb{N}}$ was the function as described above, then for each $i_0 \in \mathbb{N}$ consider the open set $$W_{i_0} = \{ \langle j_i \rangle_{i \in \mathbb{N}} \in 2^{\mathbb{N}} : j_{i_0} = 0 \}.$$ If $f$ were continuous, then $f^{-1} [ W_{i_0} ]$ would be an open subset of $X$, but $f^{-1} [ W_{i_0} ] = X \setminus B_{i_0}$, so $B_{i_0}$ must be clopen.
But you are correct that T$_1$ is enough, but this is because any T$_1$-space with a clopen base is actually Tychonoff (T$_{3\,1/2}$).