Proving that the closure of a connected set in a metric space is connected.
This was a proof that was done in class and I'm sure that it is wrong
Proof: Let $(X, d)$ be a metric space. Suppose that $Y \subseteq X$ is connected. We show that $\overline{Y}$ is also connected.
Suppose that $(\overline{Y}, d)$ was disconnected, then there exist open sets $U, V$ of $\overline{Y}$ such that $U \cup V = \overline{Y}$ and $U \cap V = \emptyset$ and $U \neq \emptyset$ and $V \neq \emptyset$.
Since $Y \subseteq \bar{Y}$ we thus have $U \cap Y$ and $V \cap Y$ to be clopen in $Y$ and $(U \cap Y) \cup (V \cap Y) = Y$. Assume that $U \cap Y \neq \emptyset$ then if $V \cap Y \neq \emptyset$ we have a contradiction.
So if $U \cap Y \neq \emptyset$ then we must have $V \cap Y = \emptyset$ and $U \cap Y = Y$. Since $V \cap Y =\emptyset$ we must have that $V$ contains only limit points of $Y$.
But then for any $x \in V$ we have $B(x, r) \cap U \neq \emptyset$ for any $r > 0$. So any ball $B(x, r)$ contains points outside of $V$ contradicting the fact that $V$ is open in $(\bar{Y}, d)$. $\square$
I'm a bit confused by the last two lines. $V$ being open in $\bar{Y}$ means $V = \bar{Y} \cap A$ for some open $A$ in $(X, d)$, I don't see why any open ball $B(x, r)$ containing points outside of $V$ would contradict the fact that $V$ is open in $(\bar{Y}, d)$ (It sure would contradict the fact that $V$ is open in $(X, d)$ though)
For example take $(\mathbb{R}, d)$ with the usual metric, and consider $\bar{Y} = [0, 1]$, and the open set $V = [0, \frac{1}{2})$ in $\bar{Y}$ then $B(0, r) = (-r, r)$ contains points outside of $V$ so by the above logic $V$ cannot be open in $\bar{Y}$ (which is wrong because $V$ is certainly open in $\bar{Y}$)
Am I correct in saying that there is an error in this proof?