Equivalent metric generated by a compact subset of $C(X)$ where $X$ is a compact metric space. I need help with the following problem:
Let $(X,\rho)$ be a compact metric space. Prove that if $K$ is a compact subset of $C(X)=C(X,\mathbb{R})$ (i.e. continuous  functions with real values) whose linear span is dense in $C(X)$, then the pseudometric  $d(x,y)= \sup _{f \in K} \lvert f(x) - f(y)\rvert$ on $X$ is actually a metric. Moreover, show that $d$ and $\rho$ generate the same topology.
The existence of $K$ was proved in another thread here: Dense subset of $C(X)$.
Thanks.
 A: Let $ a,b,c \in X $.


*

*If $ a = b $, then $ f(a) = f(b) $ for all $ f \in K $. Therefore, $ d(a,b) = 0 $.

*If $ d(a,b) = 0 $, then $ f(a) = f(b) $ for all $ f \in K $. It follows that $ g(a) = g(b) $ for all $ g \in \text{Span}(K) $. Consider the continuous ‘distance’ function $ \phi_{a}: X \to \mathbb{R}_{\geq 0} $ defined by
$$
\forall x \in X: \quad {\phi_{a}}(x) \stackrel{\text{def}}{=} \rho(a,x).
$$
As $ \text{Span}(K) $ is assumed to be a dense subset of $ C(X,\mathbb{R}) $, there exists a sequence $ (g_{n})_{n \in \mathbb{N}} $ in $ \text{Span}(K) $ converging uniformly to $ \phi_{a} $. Hence, $ (g_{n})_{n \in \mathbb{N}} $ also converges pointwise to $ \phi_{a} $. We thus have
\begin{align}
0 &= {\phi_{a}}(a) \quad (\text{As $ \rho(a,a) = 0 $.}) \\
  &= \lim_{n \to \infty} {g_{n}}(a) \\
  &= \lim_{n \to \infty} {g_{n}}(b) \quad (\forall g \in \text{Span}(K): ~~ g(a) = g(b).) \\
  &= {\phi_{a}}(b).
\end{align}
We see now that $ \rho(a,b) = 0 $. However, this holds if and only if $ a = b $, as $ \rho $ is a metric. Therefore,
$$
a = b \iff d(a,b) = 0.
$$

*It remains to show that $ d $ satisfies the Triangle Inequality. For all $ f \in K $, we have
$$
|f(a) - f(c)| \leq |f(a) - f(b)| + |f(b) - f(c)|.
$$
Hence,
\begin{align}
\sup_{f \in K} |f(a) - f(c)|
&\leq \sup_{f \in K} (|f(a) - f(b)| + |f(b) - f(c)|) \\
&\leq \sup_{f \in K} |f(a) - f(b)| + \sup_{f \in K} |f(b) - f(c)|,
\end{align}
which yields $ d(a,c) \leq d(a,b) + d(b,c) $.
Conclusion: $ d $ is a metric on $ X $.

Finally, we will prove that $ \rho $ and $ d $ generate the same topology on $ X $. For all $ a \in X $ and $ r \in \mathbb{R}_{> 0} $, define
\begin{align}
   {\mathbb{B}_{d}}(a;r) &\stackrel{\text{def}}{=} \{ x \in X ~|~ d(a,x) < r \}, \\
{\mathbb{B}_{\rho}}(a;r) &\stackrel{\text{def}}{=} \{ x \in X ~|~ \rho(a,x) < r \}.
\end{align}


*

*Let $ x_{0} \in {\mathbb{B}_{d}}(a;r) $. The compactness of $ K $ implies the equicontinuity of $ K $. As $ \dfrac{1}{2} [r - d(a,x_{0})] $ is a positive number, we can thus find a $ \delta > 0 $ such that for all $ x \in X $ satisfying $ \rho(x_{0},x) < \delta $, the inequality $ |f(x_{0}) - f(x)| < \dfrac{1}{2} [r - d(a,x_{0})] $ holds for all $ f \in K $. Hence,
\begin{align}
x_{0} &\in       {\mathbb{B}_{\rho}}(x_{0};\delta) \\
      &\subseteq {\mathbb{B}_{d}} \left( x_{0};\frac{1}{2} [r - d(a,x_{0})] \right) \\
      &\subseteq {\mathbb{B}_{d}}(a;r).
\end{align}

*Let $ x_{0} \in {\mathbb{B}_{\rho}}(a;r) $. Consider the ‘distance’ function $ \phi_{x_{0}}: X \to \mathbb{R}_{\geq 0} $ defined by
$$
\forall x \in X: \quad {\phi_{x_{0}}}(x) \stackrel{\text{def}}{=} \rho(x_{0},x).
$$
Fix $ \epsilon := \dfrac{1}{2} [r - \rho(a,x_{0})] $, which is a positive number. By the denseness of $ \text{Span}(K) $ in $ C(X,\mathbb{R}) $, we can find $ \lambda_{1},\ldots,\lambda_{n} \in \mathbb{R} \setminus \{ 0 \} $ and $ f_{1},\ldots,f_{n} \in K $ such that
$$
\left\| \phi_{x_{0}} - \sum_{i=1}^{n} \lambda_{i} f_{i} \right\|_{\infty} < \frac{\epsilon}{3}.
$$
Let $ \delta := \dfrac{\epsilon}{3n \cdot \max(|\lambda_{1}|,\ldots,|\lambda_{n}|)} $. Then
\begin{align}
\forall x \in {\mathbb{B}_{d}}(x_{0};\delta): \quad
      \left| \sum_{i=1}^{n} \lambda_{i} {f_{i}}(x_{0}) - \sum_{i=1}^{n} \lambda_{i} {f_{i}}(x) \right|
&\leq \sum_{i=1}^{n} |\lambda_{i}||{f_{i}}(x_{0}) - {f_{i}}(x)| \\
&<    \sum_{i=1}^{n} \frac{\epsilon}{3n} \\
&=    \frac{\epsilon}{3}.
\end{align}
Hence, for all $ x \in {\mathbb{B}_{d}}(x_{0};\delta) $, we have
\begin{align}
     &\left| {\phi_{x_{0}}}(x) \right| \\
=    &\left| {\phi_{x_{0}}}(x_{0}) - {\phi_{x_{0}}}(x) \right| \quad (\text{As $ \rho(x_{0},x_{0}) = 0 $.}) \\
\leq &\left| {\phi_{x_{0}}}(x_{0}) - \sum_{i=1}^{n} \lambda_{i} {f_{i}}(x_{0}) \right| + \left| \sum_{i=1}^{n} \lambda_{i} {f_{i}}(x_{0}) - \sum_{i=1}^{n} \lambda_{i} {f_{i}}(x) \right| + \left| \sum_{i=1}^{n} \lambda_{i} {f_{i}}(x) - {\phi_{x_{0}}}(x) \right| \\
=    &\left| {\phi_{x_{0}}}(x_{0}) - \sum_{i=1}^{n} \lambda_{i} {f_{i}}(x_{0}) \right| + \left| \sum_{i=1}^{n} \lambda_{i} {f_{i}}(x_{0}) - \sum_{i=1}^{n} \lambda_{i} {f_{i}}(x) \right| + \left| {\phi_{x_{0}}}(x) - \sum_{i=1}^{n} \lambda_{i} {f_{i}}(x) \right| \\
\leq &\left\| \phi_{x_{0}} - \sum_{i=1}^{n} \lambda_{i} f_{i} \right\|_{\infty} + \left| \sum_{i=1}^{n} \lambda_{i} {f_{i}}(x_{0}) - \sum_{i=1}^{n} \lambda_{i} {f_{i}}(x) \right| + \left\| \phi_{x_{0}} - \sum_{i=1}^{n} \lambda_{i} f_{i} \right\|_{\infty} \\
<    &\frac{\epsilon}{3} + \frac{\epsilon}{3} + \frac{\epsilon}{3} \\
=    &\epsilon \\
:=   &\frac{1}{2} [r - \rho(a,x_{0})].
\end{align}
Therefore,
\begin{align}
x_{0} &\in       {\mathbb{B}_{d}}(x_{0};\delta) \\
      &\subseteq {\mathbb{B}_{\rho}} \left( x_{0};\frac{1}{2} [r - \rho(a,x_{0})] \right) \\
      &\subseteq {\mathbb{B}_{\rho}}(a;r).
\end{align}
Conclusion: The foregoing argument shows that open $ d $-balls are a union of open $ \rho $-balls and vice-versa. Therefore, $ \rho $ and $ d $ generate the same topology.
