Popcorn function I need to construct a function whose set of points of discontinuities is a given
F-sigma set.
At the Follow-Up section of Wikipedia's article on the popcorn function, they give an example of such a function.
I just don't see why would we need closedness of the sets in the proof.
Could somebody briefly explain the proof?
Thanks

For the record, $A=\bigcup_{n=1}^\infty F_n\subseteq\mathbb{R}$ where each $F_n$ is closed and
$$f_A(x)=
\begin{cases}
1/n, & \text{if } x \text{ is rational and } n \text{ is minimal so that }x\in F_n \\
-1/n, & \text{if } x \text{ is irrational and } n \text{ is minimal so that }x\in F_n \\
0, & \text{if } x\notin A.
\end{cases} $$
The closedness of $F_n$'s is needed for $f_A$ to be continuous in $\mathbb{R}\setminus A$. Let's look more closely at this.
Continuity at each point of $\mathbb{R}\setminus A$: Pick $x\in\mathbb{R}\setminus A$. Then $f(x)=0$. Let $\epsilon>0$ and pick $n\in\{1,2,\ldots\}$ so that $1/n<\epsilon$. Because each of the sets $F_1,\ldots,F_n$ are closed, we can choose $\delta>0$ so that $(x-\delta,x+\delta)$ does not intersect any of the sets $F_1,\ldots,F_n$. But then
$$|f(y)-f(x)|=|f(y)|<1/n<\epsilon\quad\text{for all } y\in(x-\delta,x+\delta).$$
Hence $f_A$ is continuous at $x$.
For completeness:
Discontinuity at each point of $A$: Pick $x\in A$. For simplicity assume that $x$ is rational (the other case is very similar). Then $f(x)=1/n$ for some $n\in\{1,2,\ldots\}$. Let $\delta>0$. Now there is an irrational number $y$ in $(x-\delta,x+\delta)$. If $y\in\mathbb{R}\setminus A$, then $f(y)=0$; if $y\in A$, then $f(y)<0$. In any case $f(y)\leq 0$, hence $|f(y)-f(x)|\geq 1/n$. This means $f_A$ is discontinuous at $x$.
