From an exercise list:
Prove that if a sequence of continuous functions $f_n:X\rightarrow \mathbb{R}$ is such that $x_n\in X$, $\lim x_n = x \in X \Rightarrow \lim f_n(x_n) = f(x)$, then $f_n\rightarrow f$ uniformly on every compact subset of $X$.
This question is very similar to this and also this one. But in this case, it is not in the hypothesis that $f$ is continuous.
Is it possible to prove that $f$ is continuous only using the hypothesis of my problem? Or this result is not valid and there is actually a conterexample for this exercise. For me, the result does not seem valid if $f$ is not continuous.
The following is selfcontained; it does not refer to earlier questions and answers on MSE.
Lemma. Let $X$ be a compact metric space, and let $(g_n)_{n\geq1}$ be a sequence of functions $g_n:\>X\to{\mathbb R}$ satisfying $\lim_{n\to \infty}g_n(x_n)=0$ whenever the sequence $(x_n)_{n\geq1}$ is convergent to some $x\in X$. Then the $g_n$ converge to $0$ uniformly in $X$.
Proof. If not, there is an $\epsilon_0>0$, such that for each $n\geq1$ you can find a point $x_n\in X$ with $|g(x_n)|\geq\epsilon_0$. Since $X$ is compact there is a point $\xi\in X$ and a subsequence $y_k:=x_{n_k}$ $(k\geq1)$ such that $\lim_{k\to\infty} y_k=\xi$. As $|f(y_k)|\geq \epsilon_0$ for all $k$ this violates the central assumption of the Lemma.
Assume now that we are given a sequence of continuous functions $f_n:\>X\to{\mathbb R}$ and a function $f:\>X\to{\mathbb R}$, such that $\lim_{n\to \infty}f_n(x_n)=f(x)$ whenever the sequence $(x_n)_{n\geq1}$ is convergent to some $x\in X$. The auxiliary functions $g_n:=f_n-f$ then satisfy the assumptions of the Lemma. We therefore can conclude that the $f_n$ converge uniformly to $f$, which then in turn implies that $f$ is continuous.