Stone-Weierstrass theorem

Statement
Let $$X$$ be a compact Hausdorff space and $$C(X,\R)$$ denote the algebra of continuous functions from $$X$$ to $$\R$$. Endow $$C(X,\R)$$ with the topology of uniform convergence.

Suppose $$A$$ is a subalgebra of $$C(X,\R)$$ such that:


 * $$A$$ is unital, in the sense that $$A$$ contains the constant function $$1$$
 * $$A$$ separates points, in the sense that if $$x \ne y \in X$$, then there exists $$f \in A$$ such that $$f(x) \ne f(y)$$

Then $$A$$ is a dense subalgebra of $$C(X,\R)$$. In particular, if we assume $$A$$ is closed in $$C(X,\R)$$, we obtain that $$A = C(X,\R)$$.

Proof
The result is an application of the Weierstrass approximation theorem, and some clever arguments.