A Blog Entry on Bayesian Computation by an Applied Mathematician
$$
$$
For the sake of simplicity, we focus on the case of \(f:\mathbb{R}\to\mathbb{R}\).
This article is concerned with the continuity set of \(f\), defined as \[
\mathrm{Cont}(f):=\left\{x\in\mathbb{R}\mid f\text{ is continuous at }x\right\}.
\]
Most continuous functions are treated on open sets. We might be easily tricked to think that \(\mathrm{Cont}(f)\) should be open.
Is this conjecture true? As a starting point, proving that \(\mathrm{Cont}(f)\) is a countable intersection of open sets is not difficult.
\(\mathrm{Cont}(f)\) is \(G_\delta\)
We denote an open ball of radius \(\delta\) centered at \(x\) by \(U_\delta(x)\).
\(\mathrm{Cont}(f)\) is a \(G_\delta\) set, meaning that it is a countable intersection of open sets. Specifically, \[
\mathrm{Cont}(f)=\bigcap_{n=1}^\infty\left\{x\in\mathbb{R}\,\middle|\,\exists_{\delta>0}\;\forall_{y,z\in U_\delta(x)}\;\lvert f(y)-f(z)\rvert<\frac{1}{n}\right\}.
\]
It is straightforward to check that each \(\left\{x\in\mathbb{R}\,\middle|\,\exists_{\delta>0}\;\forall_{y,z\in U_\delta(x)}\;\lvert f(y)-f(z)\rvert<\frac{1}{n}\right\}\) is open.
The easy part is the \(\supset\) direction, since for every \(\epsilon>0\), there exists a \(N>0\) satisfying \(\frac{1}{N}<\epsilon\).
\(\subset\) direction is also straightforward, following from the definition of continuity and triangle inequality.
\(G_\delta\) sets are continuity sets
A fun fact is that every \(G_\delta\) set is the continuity set \(\mathrm{Cont}(f)\) of some function \(f\), proved in, for example, a almost one-page article (Kim, 1999).
Let \(X\) be a nonempty metric space without isolated points. Then every \(G_\delta\) subset \(G\subset X\) is the continuity set of some function \(f:X\to\mathbb{R}\).
This construction can be understood as a generalization of the example given later in Section 3.
Given that \(G\) is a \(G_\delta\) set, the complement \(G^\complement\) is a countable union of closed sets: \[
G^\complement=\bigcup_{n=1}^\infty F_n,\qquad F_n\overset{\textrm{closed}}{\subset}X.
\]
Using \(\{F_n\}\), we construct a function \(g:X\to\mathbb{R}\) as follows: \[
g(x):=\sum_{n=1}^\infty\frac{1}{2^n}1_{F_n}(x).
\] Observe that \(g=0\;\mathrm{on}\;G\). Building upon this, we define \(f:X\to\mathbb{R}\) by \[
f(x):=g(x)\left(1_A(x)-\frac{1}{2}\right)
\] where \(A\subset X\) be a set that both \(A\) and \(A^\complement\) are dense in \(X\).
This set \(A\) corresponds \(\mathbb{Q}\) in the example given later in Section 3.
Example of \(f:\mathbb{R}\to\mathbb{R}\) with closed \(\mathrm{Cont}(f)\)
In perfectly regular spaces, every closed set is a \(G_\delta\) set (Tong, 1952).
So there should be an example on \(\mathbb{R}\) that \(\mathrm{Cont}(f)\) is closed.
The function \(f\) defined as follows has \(\mathrm{Cont}(f)=(-\infty,0]\): \[
f(x):=\begin{cases}
0,&x\le0,\\
\frac{1}{n},&x\in(0,\infty)\cap\mathbb{Q},\\
-\frac{1}{n},&x\in(0,\infty)\setminus\mathbb{Q}.
\end{cases}
\]