Uniform convergence of a sequence of continuous functions on a compact set I know that the following claim is not true: if a sequence of continuous functions converging pointwise to a continuous function then the convergence is uniform. A counterexample is given here: Does pointwise convergence of continuous functions on a compact set to a continuous limit imply uniform convergence on that set?
Somehow I have "proved" the claim, so I know I have made a mistake somewhere.
My attempt
Let $S$ be a compact set. Let $f_n : S \rightarrow \mathbb R$ be a sequence of continuous functions converging pointwise to $f: S \rightarrow \mathbb R$ which is also continuous.
$f_n$ and $f$ are defined on a compact set and so are also uniformly continuous.
Since $S$ is compact, we can cover $S$ with a finite number of open balls, $S_i$ of size $\delta > 0$. So, the uniform deviation can be decomposed as:
$$\sup_{x \in S} |f_n(x) - f(x)| = \max_i \sup_{x \in S_i} |f_n(x) - f(x)| = 
\max_i \sup_{x \in S_i} |f_n(x) - f_n(x_i) +f_n(x_i) - f(x_i) + f(x_i) - f(x)|$$
where $x_i \in S_i$ are the centers of the balls $S_i$. Then, applying the triangle inequality:
$$\leq
\max_i \sup_{x \in S_i} \underbrace{|f_n(x) - f_n(x_i)|}_{(A)}  + \underbrace{|f(x_i) - f(x)|}_{(B)} + |f_n(x_i) - f(x_i)|$$
Since $f$ and $f_n$ are both uniformly continuous, the first and second term can be made arbitrarily small uniformly over $x$ as $\delta \rightarrow 0$. The last term also goes to $0$ since it is independent of $x$ and the $\max$ is taken over a finite set.
What I think my mistake was
I think I am using the uniform continuity hypothesis incorrectly. I guess what I am applying here is actually equicontinuity of the collection $\{f_n\}$. Am I correct that this is the error in the proof? Is that the only mistake?
EDIT:
I'm not sure that I'm implicitly using an equicontinuity hypothesis here. More explicitly, I $(A)$ and $(B)$ above do not necessarily go to $0$ since it's not clear how the $\max$ over the open cover $\{S_i\}$ behaves as $\delta \rightarrow 0$.
Consider the "spike" function suggested in the linked post above which is $0$ everywhere except for a continuous peak of height $1$ at $1/n$ with width $1/n$. While this function is uniformly continuous and converges pointwise to the uniformly continuous function $0$ on $[0, 1]$, the convergence is not uniform. Moreover, the quantity $(A)$ above is always $1$, showing that the "proof" in the question here is not correct.
 A: First, I would like to point out that the equicontinuity is crucial in this fact. Indeed, we have the following theorem:
Theorem Let $S$ be a compact set. Let $f_n\colon S\to \Bbb R$ be a sequence of continuous functions converging pointwise to $f\colon S\to \Bbb R$ which is also continuous. Then $f_n\to f$ uniformly if and only if $\mathcal F:=\{f_n:n\in\Bbb N\}$ is (uniformly) equicontinuous.
To find a problem you have to be more specific in the proof. It's important what do you fix first and which value depends on which other value.
Nevertheless, the problem is that you implicitly assumed equicontinuity. To show this let's be more precise in your proof. First we'll take $\varepsilon$, we'll find sets $S_i$ and there'll be no problem with $\max$ as $\delta\to 0$ (as you suggested) since these sets will be fixed.
Proof
Assume the family $\mathcal F$ is equicontinuous (then of course $\mathcal F\cup\{f\}$ also is).
Take any $\varepsilon>0$. We can cover the domain with a finite balls $S_i=B(x_i,r_i)$, $1\leq i\leq k$ such that if $x,y\in S_i$ and $n\in\Bbb N$ then $|f_n(x)-f_n(y)|<\varepsilon$ and $|f(x)-f(y)|<\varepsilon$. Then $(A),(B)\leq \varepsilon$, where $(A)$ and $(B)$ are defined in the question.
For any $i$ we have $f_n(x_i)\to f(x_i)$ (since $f_n\to f$ pointwise). Therefore there exist $N_i\in\Bbb N$ such that $|f_n(x_i)-f(x_i)|<\varepsilon$ for $n\geq N_i$. Taking $N:=\max\{N_1,N_2,\ldots,N_k\}$ we get $|f_n(x_i)-f(x_i)|<\varepsilon$ for $n\geq N$.
Taking everything into account we have
$$\sup_{x \in S} |f_n(x) - f(x)| \leq  \varepsilon+\varepsilon+\varepsilon=3\varepsilon\text{ for }n\geq N$$  which shows that $f_n\to f$ uniformly.

Now assume that $f_n\to f$ uniformly. Take any $\varepsilon>0$. Let $\delta>0$ be such that $|f(x)-f(y)|<\varepsilon$ if $d(x,y)<\delta$. Let $N$ is large enough that for $n\geq N$ and  any $x\in S$ we have $|f_n(x)-f(x)|<\varepsilon$.
Now, take any $n\geq N$ and $x,y\in S$ such that $d(x,y)<\delta$. Then
$$|f_n(x)-f_n(y)|\leq |f_n(x)-f(x)|+|f(x)-f(y)|+|f(y)-f_n(y)|<3\varepsilon.$$
This shows that the family $\mathcal F_N:=\{f_n:n\geq N\}$ is uniformly equicontinuous. Therefore $\mathcal F$ is also equicontinuous, since $\mathcal F\setminus \mathcal F_N$ is finite.
