In Berkeley Problems in Mathematics (collection of their previous qualifying exam problems), problem 4.1.11 asks us to prove:
"Let $X$ and $Y$ are nonempty subsets of a metric space M. Define $$d(X, Y)=\inf\{d(x,y) | x\in X, y\in Y\}.$$
Suppose $X$ contains only one point $x$ and $Y$ is closed. Prove $$d(X, Y)=d(x,y)$$ for some $y\in Y$.
Suppose $X$ is compact and $Y$ is closed. Prove $$d(X, Y)=d(x,y)$$ for some $x\in X$ and $y\in Y$."
However, at least problem 2 seems to be false according to this old thread: If $A$ is compact and $B$ is closed, show $d(A,B)$ is achieved, where the counterexample using the space $M=\{0\}\cup (1, 2)$ was used.
Despite this, the Berkeley book provides a proof of the two above statements and I'm not sure of where these proofs fail. Could someone help me spot the error in this proof that fails, especially for a situation like the counterexample given in the old thread?
The Berkeley proof:
"1. Let $X = {x}$ and $(y_n)$ be a sequence in $Y$ such that $|x - y_n| < d(X, Y) + 1/n$. As $(y_n)$ is bounded, passing to a subsequence, we may assume that it converges, to $y$, say. As $Y$ is closed, $y \in Y$ and, by the continuity of the norm, $|x - y| = d(X, Y).$
- Let $(x_n)$ be a sequence in $X$ such that $d((x_n), Y) < d(X, Y) + 1/n.$ As $X$ is compact, by the Bolzano-Weierstrass Theorem [Rud87, p. 40], [MH93, p. 153], we may assume, passing to a subsequence, that $(x_n)$ converges, to $x$, say. We then have $d(X, Y) = d({x}, Y)$ and the result follows from Part 1."
The issue seems to be that they are assuming the Bolzano-Weierstrass property in the proof of $(1)$ to conclude the bounded sequence $(y_n)$ converges; for instance, if you look at the example with $M=\{0\}\cup(1,2)$, the the sequence $(y_n)$ could be given by $y_n=1+1/(n+1)$, but you see that this won't actually converge to an element of $M$ even though the sequence is bounded.
Therefore it seems the issue can be remedied by forcing the assumption that $M$ has the Bolzano-Weierstrass property, but for metric spaces $M$ we have
$$\text{$M$ has the Bolzano-Weierstrass property}\iff\text{$M$ is sequentially compact}\iff\text{$M$ is compact},$$
so really we should just be assuming from the start that $M$ is compact (note $M$ is not compact in the example $M=\{0\}\cup(1,2)$).