Flawed proof that the closure of a set is closed? So I'm reading baby Rudin's third edition and on page 35, he shows a proof that the closure of a set is closed. (I'm not questioning the result, but it seems to me the proof has a mistake and I'm curious if others agree with my statement)
Let $X$ be a metric space with the usual topology and $E \subset X$. Now $E'$ is the set of all limit points of $E$. So we want to prove that $C = E' \cup E$ is closed.
So here is the provided proof:
If $p \in X$ and $p \notin C$ then $p$ is neither a point of $E$ nor a limit point of $E$. Hence $p$ has a neighborhood which does not intersect $E$. The complement of $C$ is therefore open. Hence $C$ is closed.
The problem I have with the above proof is this: What if every neighborhood of $p$ contains a point of $E'$ but not $E$? I see no statement in the proof which would exclude this possibility. Then the complement of $C$ is not open and so $C$ is not closed. In other words, the proof seems to be based on the assumption that $(E^c)^c=C$ which is not necessarily true.
Again, to clarify, I'm not claiming the above is possible. I'm just trying to understand if my objection to the proof (not the theorem) is correct.
 A: The situation that you envision cannot occur. Suppose that $U$ is an open nbhd of $p$ that contains a point $x\in E'$. Then $U$ is an open nbhd of $x$. And $x$ is a limit point of $E$, so every open nbhd of $x$ contains points of $E$, and in particular $U\cap E\ne\varnothing$.
Rudin’s statement that if $p\notin C$, then $p$ has a nbhd that does not intersect $E$ is therefore correct; you just have to fill in a couple of details to verify its correctness.
A: Rudin is reported to have written "Hence $p$ has a neighborhood which does not intersect $E$."
What appears to be needed is that $p$ has a neighborhood that does not intersect $E\cap E'$.
It seems to me Rudin ought to have said that.
The contemplated possibility is that some neighborhood of $p$ intersects $E'$ although it does not intersect $E$.
If some point $x\in E'$ is in an open neighborhood $G$ of $p$, then one can show that some point of $E$ is in $G$, as follows.  Since $G$ is open and $x\in G$, some open ball $B$ centered at $x$ is a subset of $G$.  That open ball must intersect $E$ since $x\in E'$ (so all open balls centered at $x$ intersect $E$).  Every point in the intersection of $B$ with $E$ is a member of $G$ since $B\subseteq G$.
