[step:Show that $\overline{\mathcal{A}}$ is a closed subalgebra that contains $|g|$ for every $g \in \overline{\mathcal{A}}$]Since $\mathcal{A}$ is a subalgebra of $C(K; \mathbb{R})$, its uniform closure $\overline{\mathcal{A}}$ is also a subalgebra: if $g_m \to g$ and $h_m \to h$ uniformly with $g_m, h_m \in \mathcal{A}$, then $g_m + h_m \to g + h$, $\alpha g_m \to \alpha g$, and $g_m h_m \to g h$ uniformly (the last using $\|g_m h_m - gh\|_\infty \leq \|g_m\|_\infty \|h_m - h\|_\infty + \|h\|_\infty \|g_m - g\|_\infty$, where $\|g_m\|_\infty$ is bounded since convergent sequences are bounded). Moreover, $\overline{\mathcal{A}}$ inherits the separation and non-vanishing properties from $\mathcal{A}$, since $\mathcal{A} \subset \overline{\mathcal{A}}$.
We now show $g \in \overline{\mathcal{A}}$ implies $|g| \in \overline{\mathcal{A}}$. Let $M := \|g\|_\infty$. If $M = 0$, then $g = 0$ and $|g| = 0 \in \overline{\mathcal{A}}$. Assume $M > 0$. By the [Weierstrass Approximation Theorem](/theorems/480) applied to the continuous function
\begin{align*}
\varphi: [-1, 1] &\to \mathbb{R} \\
s &\mapsto |s|,
\end{align*}
for each $\varepsilon > 0$ there exists a polynomial $p_\varepsilon$ with $\|p_\varepsilon - \varphi\|_{C([-1,1])} < \varepsilon$. Define $q_\varepsilon := p_\varepsilon - p_\varepsilon(0)$, so that $q_\varepsilon(0) = 0$. Since $\varphi(0) = 0$, we have $|p_\varepsilon(0)| = |p_\varepsilon(0) - \varphi(0)| < \varepsilon$, and therefore $\|q_\varepsilon - \varphi\|_{C([-1,1])} \leq \|p_\varepsilon - \varphi\|_{C([-1,1])} + |p_\varepsilon(0)| < 2\varepsilon$. Since $q_\varepsilon(0) = 0$, the polynomial $q_\varepsilon$ has no constant term: $q_\varepsilon(s) = c_1 s + c_2 s^2 + \cdots + c_d s^d$.
Now consider the function $g/M \in \overline{\mathcal{A}}$ (since $\overline{\mathcal{A}}$ is closed under scalar multiplication), which maps $K$ into $[-1, 1]$. Since $\overline{\mathcal{A}}$ is a subalgebra, the powers $(g/M)^j \in \overline{\mathcal{A}}$ for all $j \geq 1$, and the linear combination
\begin{align*}
q_\varepsilon(g/M) = c_1 (g/M) + c_2 (g/M)^2 + \cdots + c_d (g/M)^d \in \overline{\mathcal{A}}.
\end{align*}
For every $x \in K$, we have $g(x)/M \in [-1,1]$, so
\begin{align*}
|q_\varepsilon(g(x)/M) - |g(x)/M|| = |q_\varepsilon(g(x)/M) - \varphi(g(x)/M)| < 2\varepsilon.
\end{align*}
Therefore $\|M \cdot q_\varepsilon(g/M) - |g|\|_\infty < 2M\varepsilon$. Since $M \cdot q_\varepsilon(g/M) \in \overline{\mathcal{A}}$ and $\varepsilon > 0$ is arbitrary, we conclude $|g| \in \overline{\mathcal{A}}$.[/step]