Set of points of continuity are $G_{\delta}$ Let $f: \mathbb{R} \rightarrow \mathbb{R}$ be a function.  Show that the points at which $f$ is continuous is a $G_{\delta}$ set.
$$A_n = \{ x \in \mathbb{R} | x \in B(x,r) \text{ open }, f(x'')-f(x')<\frac{1}{n}, \forall x',x'' \in B(x)\}$$
I saw that this proof was already on here, but I wanted to confirm and flesh out more details.
"$\Rightarrow$" If f is continuous at $x$, then $f(x'')-f(x')<\frac{1}{n}$ for $x'',x' \in B(x, r_{n})$.  That is, there is a ball of radius $r$ where $r$ depends on $n$.  Then $x \in A_n$ and thus $x \in \cap A_n$.
"$\Leftarrow$" If $x \in \cap A_n$, then there is an $\epsilon > 0$ and a $\delta > 0$ such that $x' , x'' \in B(x, \delta_n)$ for all $n$ and $$|f(x'')-f(x')|<\epsilon.$$ Take $\epsilon = \frac{1}{n}$.

Here's a slightly different approach.
Let $G$ be the set of points where $f$ is continuous, $A_{n,x} = (x-\frac{1}{n}, x+ \frac{1}{n})$ is an open set where $f$ is continuous, and $A_n = \bigcup_{x \in G} A_{n,x}$.
Since $A_n$ is union of open sets which is open, $\bigcap_{n \in \mathbb{N}} A_n $ is a $G_\delta$ set. We want to show $\bigcap_{n \in \mathbb{N}} A_n = G$.
$\forall n \in \mathbb{N}, A_{n+1, x} \subset A_{n,x} \\ \Rightarrow  \bigcup_{x \in G}A_{n+1,x} \subset \bigcup_{x \in G}A_{n,x} \\ \Rightarrow A_{n+1} \subset A_n \\ \Rightarrow \{A_n\} \text{ is a decreasing sequence of nested sets}$
Furthermore, $\bigcap_{n \in \mathbb{N}} A_n = \{x\} $. (i.e. intersection is non-empty by Nested Set Theorem / Cantor Theorem). Therefore,
$\begin{align}\bigcap_{n \in \mathbb{N}} A_n &= \lim_{n \to \infty} A_n \\ &= \lim_{n \to \infty} \bigcup_{x \in G} A_{n,x} \\ &= \bigcup_{x \in G} (\lim_{n \to \infty} A_{n,x} ) \\ &= \bigcup_{x \in G} \{x\} \\ &= G\end{align}$
So $G$ is the intersection of open sets and is a $G_\delta$ set. Can someone see why interchanging the limit and union is legal?
