I'm having trouble with proving this theorem: A metric space is separable iff it is homeomorphic to a totally bounded metric space. There is a link on Wikipedia to book by S. Willard, but it is stated there as a fact leaving it to the reader as an exercise to prove it. Any help would be appreciated.
Metric Spaces – Separable iff Homeomorphic to Totally Bounded
metric-spaces
Related Solutions
In principle, the problem was already pointed out in the comments - let me just clarify this a little more:
The term "totally bounded" refers, as stated, to the metric space $(X,d)$, i.e. it is a property of the metric space and not of a single sequence in the metric space. Now the statement reads that if a metric space is totally bounded, then every sequence contains a Cauchy-subsequence and conversely, if every (not only one!) sequence contains a Cauchy subsequence, then the space (not the sequence) is totally bounded. Intuitively, totally bounded means that you cannot diverge with your sequences. Either you converge (within the topological closure), or you somehow oscillate (meaning that eventually every point of your sequence is close to some point in the space and the set of these points is bounded). But this behaviour cannot be decided upon looking at a single sequence.
For your example (you have not really specified the metric space), if you take the subsequence $\{x_{i_j}\}_j$ where $i_j=p_j^{k_j}$ with $p_j$ the j-th prime number and $k_j$ sufficiently large, such that $|x_{i_j}-p_j|<\varepsilon$ for some prechosen $\varepsilon>0$, which is certainly a subsequence of your sequence and hence a sequence of the metric space, then this sequence does not contain a Cauchy-subsequence - therefore your space cannot be totally bounded.
As I noted in the comments:
Most authors use the term countable to mean finite or countably infinite. As you indicate, Rudin uses the term countable to mean countably infinite. Based on that, it appears the exercise accidentally slips back to the more common usage (else a finite metric space would be a counterexample).
But to answer your followup question . . .
Yes, if $X$ is infinite, then the set $A$ will also be infinite.
Suppose instead that $A$ is finite.
Choose $y\in X{\,\setminus\,}A$.
Since $A$ is dense, there is an infinite sequence of elements of $A$ which approach $y$.
But then since $A$ is finite, some element of the sequence has minimum distance to $y$, contradicting convergence.
Best Answer
First, you’re right that a totally bounded metric space is automatically separable, so that there’s no need to go through the completion: the union of finite $2^{-n}$-nets for $n\in\omega$ is a countable dense subset.
Now assume that $\langle X,d\rangle$ is a separable metric space. Without loss of generality assume that $d(x,y)\le 1$ for all $x,y\in X$, and let $D=\{x_n:n\in\omega\}$ be a dense subset of $X$. Define the map
$$f:X\to[0,1]^\omega:x\mapsto\big\langle d(x,x_n):n\in\omega\big\rangle\;.$$
Now show that $f$ is an embedding of $X$ into the compact metrizable space $[0,1]^\omega$, the Hilbert cube; being compact, the Hilbert cube is totally bounded in any compatible metric, and total boundedness is hereditary, so $f[X]$ is totally bounded in any metric inherited from $[0,1]^\omega$.