[proofplan]
The proof first handles the empty-domain case, where the uniform bound is vacuous. When $K$ is nonempty, compactness and continuity imply that the continuous envelope $g$ is bounded above on $K$. The pointwise domination $|f_n(x)| \le g(x)$ then transfers this single bound from $g$ to every function $f_n$, which is precisely uniform boundedness.
[/proofplan]
[step:Dispose of the empty compact set]
If $K = \varnothing$, take $M := 0$. There are no pairs $(n,x) \in \mathbb N \times K$, so
\begin{align*}
|f_n(x)| \le M
\end{align*}
holds for every $n \in \mathbb N$ and every $x \in K$ by vacuity. Hence $(f_n)_{n=1}^{\infty}$ is uniformly bounded on $K$ in this case.
[/step]
[step:Use compactness to bound the continuous envelope]
Assume now that $K \neq \varnothing$. We prove directly that $g$ is bounded above on $K$.
For each $y \in K$, continuity of $g: K \to [0,\infty)$ at $y$ gives a relatively [open set](/page/Open%20Set) $U_y \subset K$ such that $y \in U_y$ and
\begin{align*}
g(x) < g(y) + 1
\end{align*}
for every $x \in U_y$. The family $(U_y)_{y \in K}$ is an [open cover](/page/Open%20Cover) of $K$ in the [subspace topology](/page/Subspace%20Topology). Since $K$ is compact, there exist points $y_1,\dots,y_m \in K$ such that
\begin{align*}
K \subset \bigcup_{j=1}^{m} U_{y_j}.
\end{align*}
Define
\begin{align*}
B := 1 + \max\{g(y_1),\dots,g(y_m)\}.
\end{align*}
The number $B$ is finite because each $g(y_j)$ is a real number. If $x \in K$, choose $j \in \{1,\dots,m\}$ with $x \in U_{y_j}$. Then
\begin{align*}
g(x) < g(y_j) + 1 \le B.
\end{align*}
Thus $g(x) \le B$ for every $x \in K$.
[guided]
We need one constant that bounds $g(x)$ for all $x \in K$. Rather than assuming that $g$ attains a maximum, we extract a bound directly from compactness.
Fix $y \in K$. Since $g: K \to [0,\infty)$ is continuous at $y$, the inverse image under $g$ of the open interval $(-\infty,g(y)+1)$ is open in $K$ and contains $y$. Therefore there is a relatively open set $U_y \subset K$ such that $y \in U_y$ and
\begin{align*}
g(x) < g(y) + 1
\end{align*}
for every $x \in U_y$.
The sets $U_y$ cover $K$, because each point $y \in K$ belongs to its own neighbourhood $U_y$. Compactness of $K$ means that this open cover has a [finite subcover](/page/Finite%20Subcover), so there are points $y_1,\dots,y_m \in K$ satisfying
\begin{align*}
K \subset \bigcup_{j=1}^{m} U_{y_j}.
\end{align*}
Now define the finite constant
\begin{align*}
B := 1 + \max\{g(y_1),\dots,g(y_m)\}.
\end{align*}
This number is finite because it is built from finitely many real values of the function $g$.
Let $x \in K$ be arbitrary. Since the finitely many sets $U_{y_j}$ cover $K$, there exists $j \in \{1,\dots,m\}$ such that $x \in U_{y_j}$. By the defining property of $U_{y_j}$,
\begin{align*}
g(x) < g(y_j) + 1.
\end{align*}
By the definition of $B$,
\begin{align*}
g(y_j) + 1 \le B.
\end{align*}
Combining the two inequalities gives
\begin{align*}
g(x) < B.
\end{align*}
In particular, $g(x) \le B$ for every $x \in K$. Thus the continuous envelope is bounded above on the compact set $K$.
[/guided]
[/step]
[step:Transfer the envelope bound to the whole sequence]
Define
\begin{align*}
M := \max\{B,0\}.
\end{align*}
Then $M \ge 0$ and, since $g: K \to [0,\infty)$, the estimate from the previous step gives
\begin{align*}
0 \le g(x) \le M
\end{align*}
for every $x \in K$. For every $n \in \mathbb N$ and every $x \in K$, the assumed pointwise domination gives
\begin{align*}
|f_n(x)| \le g(x) \le M.
\end{align*}
Hence there exists a constant $M \ge 0$ such that $|f_n(x)| \le M$ for all $n \in \mathbb N$ and all $x \in K$. Therefore $(f_n)_{n=1}^{\infty}$ is uniformly bounded on $K$.
[/step]