Let $Y := [0, 1]^\mathbb N$. We define a metric $d'$ on $Y$ by
$$
d'(\xi, \eta) := \sum_{i=1}^\infty 2^{-i} | \xi_i - \eta_i| \quad \forall \xi, \eta \in Y.
$$
The topology induced by $d'$ coincides with the product topology of $Y$. By Tychonoff theorem, $(Y, d')$ is compact. Let $D := \{a_1, a_2,\ldots\}$ be a dense subset of $X$. We define
$$
\alpha_i(x) := \min \{ d(x,a_i), 1\} \quad \forall i \ge 1, x \in X.
$$
Then $\alpha_i:X \to \mathbb R$ is continuous bounded for all $i$. We define $T:X \to Y$ by
$$
T(x) := (\alpha_i(x))_{i\ge 1} \quad \forall x \in X.
$$
Fix $x, y\in X$ such that $T(x)=T(y)$. Then
$$
\min \{ d(x,a_i), 1\} = \min \{ d(y,a_i), 1\} \quad \forall i.
$$
There is a subsequence $\lambda \in \mathbb N^\mathbb N$ such that $a_{\lambda(i)} \xrightarrow{i \to \infty} x$. WLOG, we assume $d(x, a_{\lambda(i)}) <1$ for all $i$. It follows that $d(x, a_{\lambda(i)}) = d(y, a_{\lambda(i)})$ for all $i$. Hence $a_{\lambda(i)} \xrightarrow{i \to \infty} y$. Hence $x=y$ and thus $T$ is injective.
Let $x, x_1,x_2,\ldots \in X$ such that $x_n \to x$. Then $d(x_n, a_i) \xrightarrow{n \to \infty} d(x,a_i)$ and thus $\alpha_i(x_n) \xrightarrow{n \to \infty} \alpha_i(x)$ for all $i$. Product topology is the topology of pointwise convergence, so $T(x_n) \to T(x)$.
Let $x, x_1,x_2,\ldots \in X$ such that $T(x_n) \to T(x)$. Then $\alpha_i(x_n) \xrightarrow{n \to \infty} \alpha_i(x)$ for all $i$. Let $I:=\{i \ge 1 \mid \alpha_i(x) <1\}$. There is a subsequence $\lambda \in I^\mathbb N$ such that
- $\alpha_{\lambda(i)} (x) \xrightarrow{i \to \infty} 0$, and
- $d(x_n, a_{\lambda(i)}) \xrightarrow{n \to \infty} d(x, a_{\lambda(i)})$ for all $i$.
Hence $a_{\lambda(i)} \xrightarrow{i \to \infty} x$. Finally,
$$
\begin{align}
\lim_n d(x_n, x) &\le \lim_n d(x_n, a_{\lambda(i)}) + \lim_n d(a_{\lambda(i)}, x) \\
&=2 d(a_{\lambda(i)}, x) \quad \forall i.
\end{align}
$$
The proof is complete by
$$
\lim_n d(x_n, x) \le 2\lim_i d(a_{\lambda(i)}, x)=0.
$$
So I think the statement is wrong. Either change "onto" in "into", either change "compact metric space" in "subset of a compact metric space".
– xghtfghhgyhhn Apr 26 '22 at 11:55