Question regarding Weierstrass theorem generalized to Stone-Weierstrass

Weierstrass theorem.

Lef $$f$$ be a defined and continuous function in $$[a,b]$$. Given $$\epsilon>0,$$ there exists a polynomial $$P$$ such that $$\vert f(x)-P(x)\vert<\epsilon,$$ for all $$x\in[a,b].$$

Stone-Weierstrass theorem.

Let $$X$$ be a topological compact space. If $$F$$ is an algebra of $$C(X)$$ that separate points and contains the constant functions then $$F$$ is dense with respect to the uniform convergence in $$C(X).$$

How is that an algebra $$F$$ of $$C(X)$$ that separate points and contains the constant functions is the generalization of $$P(x)$$ ?

Can someone shed some light on this?

The set of polynomials defined on $$[a,b]$$ is an algebra of $$C([a,b])$$ that separate points (for all $$x,y\in[a,b]$$ such that $$x\neq y$$, there exists a polynomial $$P$$ such that $$P(x)\neq P(y)$$) and contains the constant functions.
• The Weierstraß theorem states that there exists a sequence of polynomials which converges uniformly on $[a,b]$ to $f$. Indeed, you can rewrite your statement in this way: $\exists$ polynomial $P$ such that $\sup_{x\in[a,b]}\vert f(x)-P(x)\vert\le\varepsilon$. – Will Mar 17 at 8:54
For $$x_0, y_0 \in [a,b]$$ such that $$x_0 \ne y_0$$ we consider the polynomial $$p(t) = t-x_0$$. Then $$p(x_0) = 0$$ but $$p(y_0) = y_0 - x_0 \ne 0$$.
Hence polynomials on $$[a,b]$$ separate the points of $$[a,b]$$.