Weighted metric for local uniform convergence (source code)

= Weighted metric for local uniform convergence
{title2=$\sigma(f,g)=\sum_n w_n\phi(\|f-g\|_{K_n})$}

Let $X$ have nested compact sets $K_n$ covering it, with $K_n\subseteq\operatorname{int}K_{n+1}$. Then every point has a neighborhood in some $K_n$, and every <compact subset> is contained in one $K_n$. For continuous scalar <functions>, take positive weights with $\sum_n w_n<\infty$ and define
$$
\sigma(f,g)=\sum_{n=1}^\infty w_n\frac{\|f-g\|_{K_n}}{1+\|f-g\|_{K_n}}.
$$
The <bounded metric transform> makes the sum finite and gives its <triangle inequality>; the covering property gives definiteness. On $\mathbb R$, one may use $K_n=[-n,n]$ and $w_n=2^{-n}$.

If $\sigma(f_j,f)\to0$, each fixed compact <supremum norm> tends to zero, since its summand is bounded by the whole metric. Conversely, control finitely many compact <supremum norms> and then the summable weight tail. This proves that $\sigma$ realizes <locally uniform convergence> under the stated exhaustion conditions.

Merely writing a space as a union of compact sets is insufficient. Enumerate the points of the compact space $\{0\}\cup\{1/n:n\geq1\}$ and take finite initial subsets as $K_n$. The resulting metric detects pointwise control on those finite sets, not uniform control on the entire compact space. The neighborhood and compact-containment conditions explain the difference.