An elementary proof of the fact that any countable metric space $(X,d),$ without isolated points is homeomorphic to $\mathbb Q$ uses a construction that I thought I was familiar with, but I'm having trouble understanding a part of the proof. The setup is this:
$(1).\ S$ is the (countable) set of all infinite sequences $s$ of natural numbers that are eventually zero, topologized in a way not important for my question.
$(2).\ $ If $U$ is open in $X$, then for every $k\in \mathbb N$ there exists a sequence $S_k(U ) := \{B_i : i \in \mathbb N\}$ of pairwise disjoint clopen balls contained in $U$, each of radius $\le 2^{-k}$, whose union is $U.$ We can arrange it so $B_0$ contains $x_{n(U)}$ where $n(U ) := \min\{i<ω: x_i ∈ U\},$ each $B_i$ is centered at the point $x_{n(U_i)},$ where $U_i :=U\setminus \bigcup _{j<i}B_j$ and $B_i\subsetneq U\setminus \bigcup_{j<i}B_j.$
$(3).\ $ There is a collection of clopen balls $\{B_s:s\in ^{<\omega}\mathbb N\}$ constructed as follows: set $B_{\emptyset}=X$ and suppose we are given a particular $s\in ^{<\omega}\mathbb N$ where $s$ is a sequence of length $k.$ We define the balls corresponding to the sequence $s\text^i$ of length $k+1$ whose last term is $i$ by taking $\{B_{sˆi} : i\in N\} := S_k(B_s).$ So, for example, $B_{sˆ0}$ is a ball properly contained in $B_s$ centered at an $x_i$ where $i$ is the least index of the points of $X$ in $B_s.$ And $B_{sˆ1}$ is a ball properly contained in $B_s\setminus B_{sˆ0}$ and centered at the point $x_i$ where $i$ is the least index of the points of $B_s\setminus B_{sˆ0}.$
I drew pictures and checked all the claims in the paper as regards $(2).$ and $(3).$, to understand these ideas. As I mentioned, I had seen similar constructions before. So, so far so good.
Now, it is not hard to show that for every $x\in X$ and $k\in \mathbb N,$ there exists a unique sequence $s$ of length $k$ such that $x\in B_s.$
Thus, to every $x\in X$ there corresponds a unique sequence $s_x$ of points from $\mathbb N.$ That is, $x\in \bigcap_k B_{s\upharpoonright k}.$
Then, the function $h$ that sends $x$ to $s_x$ is a homeomorphism. My question has to do with the claim that $h[X] \subseteq S.$
"To see that $h$ is onto $S$, first notice that $h[X] ⊂ S$. Indeed, for every $x_j ∈ X$ we have $h(x_j )\upharpoonright k = 0$ for every $k>n$, where $n$ is such that $d(x_i,x_j ) > 2^{−n}.$"
If $h(x_j )\upharpoonright k = 0$ this means that the first $k$ terms of $s_{x_j}$ are zero. Why is this so?
I can see that the claim is true by arguing as follows:
$(4).\ $ Suppose $x_j\in X$ and we have chosen an $s$ such that $x_j\in B_s.$ If $j$ is the least integer with the property that $x_j\in B_s$ then $x_j$ is the center of the ball $B_{s\text^0}\subseteq B_s$ and so $s$ tacks on a zero at the next position. And since if $j$ is least with the property in $B_s$, it is also least with the property in any of the balls into which $B_s$ is partitioned to produce $\{B_{s\text^i}\}_{i\in \mathbb N}.$ This means that the rest of the terms of the sequence associated to $x_j$ are zero.
$(5).\ $ On the other hand, if $j$ is not least with the property, then consider the integers that come before: $i<j.$ There is an integer $k$ such that $d(x_i,x_j)>2^{-k}$, which implies that $x_i$ and $x_j$ are eventually in different balls, say $B_s$ and $B_{s'}$ where $s$ and $s'$ are sequences of length $k.$ But, since the number of integers less than $j$ is finite, eventually, $x_j$ will be the center of some ball $B_{s\text^0}\subseteq B_s.$ So we are in the situation of $(4).$
Can you correct, simplify or if wrong, steer me in the right direction?