[step:Choose a countable uniformly dense family of continuous test functions]
Let $d: X \times X \to [0,\infty)$ denote the metric on $X$. For $a \in X$ and $r > 0$, let $B(a,r) := \{x \in X : d(x,a) < r\}$ denote the open ball in the [metric space](/page/Metric%20Space) $(X,d)$. For a subset $E \subset X$, define the distance-to-set function $\operatorname{dist}(\cdot,E): X \to [0,\infty]$ by
\begin{align*}
\operatorname{dist}(x,E) := \inf_{y \in E} d(x,y).
\end{align*}
Let $C(X)$ denote the real [vector space](/page/Vector%20Space) of continuous functions $f: X \to \mathbb{R}$ equipped with the uniform norm
\begin{align*}
\|f\|_{\infty} := \sup_{x \in X} |f(x)|.
\end{align*}
Since $(X,d)$ is compact and metric, $C(X)$ is separable in the uniform norm. Fix a countable [dense subset](/page/Dense%20Subset)
\begin{align*}
\mathcal{D} := \{f_j : X \to \mathbb{R} \mid j \in \mathbb{N}\} \subset C(X).
\end{align*}
To justify the separability assertion, for each $m \in \mathbb{N}$ choose a finite set $F_m = \{a_{m,1},\dots,a_{m,k_m}\} \subset X$ such that the open balls $B(a_{m,i},1/(4m))$ cover $X$. For each $m$ and $i$, define the [continuous function](/page/Continuous%20Function) $\psi_{m,i}: X \to [0,\infty)$ by
\begin{align*}
\psi_{m,i}(x) := \operatorname{dist}\bigl(x, X \setminus B(a_{m,i},1/(2m))\bigr).
\end{align*}
The function $\Psi_m: X \to (0,\infty)$ given by
\begin{align*}
\Psi_m(x) := \sum_{i=1}^{k_m} \psi_{m,i}(x)
\end{align*}
is strictly positive because the smaller balls $B(a_{m,i},1/(4m))$ cover $X$. Hence the functions $\varphi_{m,i}: X \to [0,1]$ defined by
\begin{align*}
\varphi_{m,i}(x) := \frac{\psi_{m,i}(x)}{\Psi_m(x)}
\end{align*}
are continuous and satisfy
\begin{align*}
\sum_{i=1}^{k_m} \varphi_{m,i}(x) = 1
\end{align*}
for every $x \in X$. The collection of all rational linear combinations
\begin{align*}
\sum_{i=1}^{k_m} q_i \varphi_{m,i}
\end{align*}
with $m \in \mathbb{N}$ and $q_i \in \mathbb{Q}$ is countable.
Let $f: X \to \mathbb{R}$ be continuous and let $\varepsilon > 0$. Since $X$ is compact, $f$ is uniformly continuous. Choose $m \in \mathbb{N}$ so large that $d(x,y) < 1/m$ implies $|f(x)-f(y)| < \varepsilon/2$. Choose rational numbers $q_i \in \mathbb{Q}$ satisfying $|q_i - f(a_{m,i})| < \varepsilon/2$ for $1 \leq i \leq k_m$, and define $g: X \to \mathbb{R}$ by
\begin{align*}
g(x) := \sum_{i=1}^{k_m} q_i\varphi_{m,i}(x).
\end{align*}
If $\varphi_{m,i}(x) \neq 0$, then $x \in B(a_{m,i},1/(2m))$, so $d(x,a_{m,i}) < 1/m$ and therefore $|f(x)-f(a_{m,i})| < \varepsilon/2$. Using the partition-of-unity identity,
\begin{align*}
|f(x)-g(x)| \leq \sum_{i=1}^{k_m} \varphi_{m,i}(x)|f(x)-q_i| < \varepsilon
\end{align*}
for every $x \in X$. Thus the countable family of these rational linear combinations is dense in $C(X)$, and we may enumerate a dense subset as $\mathcal{D} = \{f_j\}_{j \in \mathbb{N}}$.
[/step]