Complete and Totally Bounded Metric Space is Sequentially Compact/Lemma

Lemma
Let $\struct { A, d}$ be a totally bounded metric space.

Let $\sequence {x_n}_{n \mathop \in \N}$ be a sequence in $A$.

There exists a mapping
 * $\ds f : \Z_{>0} \times X^\N \to \set { \sequence {m _k} _{k\in\N} \subseteq \N : m_0 < m_1 < \cdots } $

such that:
 * For all $N\in\Z_{>0}$ and $\sequence {x _n}_{n\in\N}\in X^\N$:
 * $\ds \forall k,l\in\N : \map d {x_{m_k},x_{m_l}} < \dfrac 1 N$
 * where:
 * $\sequence {m_n} _{n \in \N} := \map f {N, \sequence {x _n}_{n\in\N}}$

Proof
Let:
 * $\ds X^\ast := \bigcup _{k\in\Z_{>0}} X^k$

be the set of all finite words.

Since $\struct {A, d}$ is totally bounded, for each $N\in\Z_{>0}$ there are $\map k N \in \Z _{>0}$ and:
 * $\SS_N := \tuple {c_1 ^{\paren N},\ldots, c_{\map k N} ^{\paren N}}\in X^\ast$

such that:
 * $\ds X \subseteq \bigcup _{i=1} ^{\map k N} \map {B _{1/\paren {2N}}}{c _i ^{\paren N}}$

By the axiom of countable choice, there exists a sequence $\sequence {\SS_N}_{N\in\Z_{>0}}$ of such sets.

In the following, we define $f$ using this $\sequence {\SS_N}_{N\in\Z_{>0}}$.

Given $N\in\Z_{>0}$ and $\sequence {x_n}_{n \mathop \in \N}$, observe:
 * $\ds \N = \bigcup _{i=1} ^{\map k N} \set {n \in \N : \map d {x_n, c_i ^{\paren N}} < \dfrac 1 {2N}}$

As $\size \N = \infty$:
 * $ i_N := \min \set { i \in \closedint 1 {\map k N} : \size {\set {n \in \N : \map d {x_n, c_i ^{\paren N}} < \dfrac 1 {2N} } } = \infty }$

exists.

Therefore let:
 * $\map f {N, \sequence {x _n}_{n\in\N}} := \sequence {m_n} _{n \in \N}$

where $m_0 < m_1 < \cdots$ are defined as:
 * $\ds \set {m_0, m_1, \ldots} = \set {n \in \N : \map d {x_n, c_{i_N} ^{\paren N}} < \dfrac 1 {2N} }$

Indeed, by :
 * $\ds \forall k,l\in\N:$
 * $\map d {x_{m_k},x_{m_l}} \le \map d {x_{m_k},c_{i_N} ^{\paren N}} + \map d {c_{i_N} ^{\paren N},x_{m_l}} < \dfrac 1 {2N} + \dfrac 1 {2N} = \dfrac 1 N$