Continuous functions uniformly convergent to a function, metric spaces, equivalent conditions Let $X, \ (Y, d)$ be metric spaces, $f_1, f_2, \ldots \ : X \rightarrow Y$ be continuous functions, $f: X \rightarrow Y$ an arbitrary function. Prove that the following condtions are equivalent:
1) For any compact set $K \subset X$ functions $f_n$ converge uniformly (with metric $d$) on the set $K$ to $f$.
2) Function $f$ is continuous and $\lim _{n \rightarrow \infty} x_n = x \Rightarrow \lim _{n \rightarrow \infty} f_n(x_n) = f(x)$.
I remember I've once solved a seemingly similar problem:
If $f$ is a nondecreasing function on [0,1], then there exists a sequence of continuous functions ${f_n}$ on $[0,1]$ such that for each $x \in [0,1] \ \  \lim _{n \rightarrow \infty} f_n(x) = f(x)$. 
Can I somehow use it here?
Could you help me with this problem?
Thank you.
 A: HINT for
1)$\Rightarrow$2): Use $K:=\{x_n\mid n\in\mathbb N\}\cup \{x\}$ as compact set and a typiclal $\frac\epsilon3$ proof.
A: It seems that the following is the proof.
2) $\Rightarrow $ 1). Suppose that there is a compact subset $K$ of $X$ such that the sequence $f_n|K$  does not converge uniformly to $f|K$. Therefore there are a number $\varepsilon>0$, a strictly monotone sequence $\{m_k\}$ of positive integer numbers and a sequence $\{x_{m_k}\}$ of points of $K$ such that $d(f_{m_k}(x_{m_k}),f(x_{m_k}))>\varepsilon$ for each $k$. Since $K$ is compact, the sequence $\{x_{m_k}\}$ has a subsequence $\{x_{n_k}\}$ convergent to a some point $x\in K$. For each $n$ put $x_n=x_{k(n)}$, where $k(n)=\min\{n_k:n_k\ge n\}$. Then the sequence $\{x_n\}$ coverges to the point $x$ too. Therefore the sequence $\{f(x_n)\}$ converges to the point $f(x)$. Since the function $f$ is continuous at the point $x$, there is a neighborhood $U$ of $x$ such that $d(f(y),f(x))<\varepsilon/2$ for each point $y\in U$. Since the sequence $\{f(x_n)\}$ converges to the point $f(x)$, there is a number $N$ such that $d(f(x_n),f(x))<\varepsilon/2$ for each $n>N$. Since the sequence $\{x_{n_k}\}$ converges to the point $x$, there is a number $n_k>N$ such that $x_{n_k}\in U$. Then $\varepsilon=\varepsilon/2+\varepsilon/2>$ $d(f_{n_k}(x_{n_k}),f(x))+d(f(x),f(x_{n_k}))\ge d(f_{n_k}(x_{n_k}),f(x_{n_k}))>\varepsilon,$ a contradiction.
1) $\Rightarrow $ 2). Suppose that the function $f$ is discontinuous at some point $x\in X$. Then there are a number $\varepsilon>0$ and a sequence $\{x_n\}$ of points of $X$, convergent to $x$ such that $d(f(x_n),f(x))>\varepsilon$ for each $n$. Put $K=\{x\}\cup \{x_n\}$. Since each open neighborhood of the point $x$ contains all but finitely many elements of the sequence $\{x_n\}$, we see that the set $K$ is compact. Therefore the sequence $f_n|K$ converges uniformly to $f|K$. Thus there is a number $M$ such that $d(f_m(y), f(y))<\varepsilon/3$ for each $m>M$ and $y\in K$. Put $m=M+1$. Since the function $f_m$  is continuous at the point $x$, there is a neighborhood $U$ of $x$ such that $d(f_m(y),f_m(x))<\varepsilon/3$ for each point $y\in U$. Since the sequence $\{x_n\}$ converges to $x$, there is a number $n$ such that $x_n\in U$. Then $\varepsilon=\varepsilon/3+\varepsilon/3+\varepsilon/3>$ $d(f(x_n),f_m(x_n))+d(f_m(x_n),f_m(x))+d(f_m(x),f(x))\ge d(f(x_n),f(x))>\varepsilon$, a contradiction.
Let $\{x_n\}$ be a sequence of points of $X$, convergent to a point $x\in X$ and $\varepsilon>0$ be an arbitrary number. Put $K=\{x\}\cup \{x_n\}$. Then $K$ is compact. Therefore the sequence $f_n|K$ converges uniformly to $f|K$. Thus there is a number $M$ such that $d(f_m(y), f(y))<\varepsilon/2$ for each $m>M$ and $y\in K$. Since the function $f$  is continuous at the point $x$, there is a neighborhood $U$ of $x$ such that $d(f(y),f(x))<\varepsilon/2$ for each point $y\in U$.  Since the sequence $\{x_n\}$ converges to $x$, there is a number $N\ge M$ such that $x_n\in U$ for each $n>N$. Then $d(f_n(x_n),f(x))\le d(f_n(x_n),f(x_n))+ d(f(x_n),f(x))<$ $\varepsilon/2+\varepsilon/2=\varepsilon$.
