Is Hausdorffness necessary condition for the Stone-Weierstrass theorem? Following Rudin's argument, I cannot find where it used Hausdorffness condition.
=======
Rudin PMA p.162
Let $X$ be a compact space.
Let $\mathscr{A}$ be a subalgebra of $C(X,\mathbb{R})$.
If $\mathscr{A}$ separates points and vanishes nowhere, then $\mathscr{A}$ is dense in $C(X,\mathbb{R})$ with respect to the uniform topology.
======
The proof is divided into four steps.


*

*$\forall f\in \overline{\mathscr{A}}, |f|\in \overline{\mathscr{A}}$

*$\forall f,g\in \overline{\mathscr{A}}, \max(f,g),\min(f,g)\in \overline{\mathscr{A}}$.

*$\forall ( f\in C(X,\mathbb{R}),x\in X, \epsilon >0), \exists g\in \overline{\mathscr{A}}$ such that $g(x)=f(x)\bigwedge g(x)>f(x)-\epsilon$.

*$\forall ( f\in C(X,\mathbb{R}), \epsilon>0), \exists h\in \overline{\mathscr{A}}$ such that $||h-f||_\infty <\epsilon$.
I believe Steps 1&2 use only uniform continuity and classical Weierstrass theorem and Steps 3&4 only use compactness.
Where did I go wrong?
Where in the argument use the Hausdorff condition?
 A: Wikipedia's statement of the theorem is

Suppose $X$ is a compact Hausdorff space and $A$ is a subalgebra of $C(X,\mathbb R)$ which contains a non-zero constant function. Then $A$ is dense in $C(X,\mathbb R)$ if and only if it separates points.

(Emphasis added.)
What you've quoted from Rudin asserts only the "if" direction (separating points implies dense); for that statement, we can omit the assumption that $X$ is Hausdorff because (as noted by others here already) the assumption that $A$ separates points already implies that $X$ is Hausdorff.  (If, as suggested in comments, it is thought misleading to omit this condition — as Rudin does — I would strongly prefer merely to add a remark to the effect that the hypothesis implies Hausdorffness, not to add redundant hypotheses, which only make theorems harder to use.)
However, for the "only if" direction (dense implies separating points) the assumption that $X$ is Hausdorff cannot be dropped.  (Example: if $X$ has at least two points and the trivial topology, i.e., only $\emptyset$ and $X$ are open, then $C(X,\mathbb R)$ is a dense subalgebra of itself but doesn't separate points.)  I can't think of a use for this direction off the top of my head; I suspect it's much less important than the other direction.
A: You need Hausdorff to ensure the existence of a subalgebra which separates points. Suppose $X$ is not Hausdorff. Let $x$ and $y$ be two points which cannot be separated by open sets. Let $A$ be a subalgebra of $C(X,\mathbb{R})$ and $p\in A$ be an arbitrary element. Suppose $p(x)\neq p(y)$. Then since $\mathbb{R}$ is Hausdorff we can separate $p(x)$ and $p(y)$ by open sets $U$ and $V$. Since $p$ is continuous, the preimages $p^{-1}(U)$ and $p^{-1}(V)$ are open and contain $x$ and $y$ (resp.). Furthermore, these two preimages must be disjoint, otherwise for $z\in p^{-1}(U)\cap p^{-1}(V)$, we have $p(z)\in U\cap V$. This contradicts the hypothesis that $x$ and $y$ cannot be separated. 
A: In fact, if a topology is not Hausdorff, it makes no means. We can always assume that any topology is Hausdorff except in pure theory of topology.
