Does the "continuous locus" of a function have any nice properties? Suppose f:R→R is a function. Let S={x∈R|f is continuous at x}. Does S have any nice properties?
Here are some observations about what S could be:


*

*S can be any closed set. For a closed set S, let g be a continuous function whose vanishing locus is S (for example, you could take g(x) to be the distance of x from S if S is non-empty). Then define f(x)=g(x) if x∈Q and f(x)=0 otherwise. Then the continuous locus of f is exactly S.

*S can be an open interval. For an open interval S, define f(x)=0 if x∈S or x∈Q and f(x)=1 otherwise. Then the continuous locus of f is exactly S.

*S can be the complement of any countable set. Let T={t1,t2,t3,...} be a countable set, and let ∑ai be some absolutely convergent series all of whose terms is non-zero (like ai=1/2i). Define
f(x) = ∑i such that ti < x a_i.
Then the continuous locus of f is exactly the complement of T.


Here are some questions I'd like to know the answers to:


*

*Can S be any open set?

*Can S be non-measurable? (if f(x)=0 if x∈S and f(x)=1 otherwise, what will the continuous locus be?)

 A: It's a standard result that the continuous locus is always G-delta.  For each r>0, let U(r) be the set of points x such that some neighborhood of x maps into some ball of radius r.  Then each U(r) is open, and the continuous locus is their intersection.  Conversely, given a G-delta set, I'm pretty sure it's not hard to construct a function with that continuous locus, though I don't remember how off the top of my head.
A: Yes, here's a quick proof that any given $G_\delta$ (in $\mathbb{R}$) can be realized as the set of continuity points of some real-valued function.
Let $G$ be a given $G_\delta$ set in $\mathbb{R}$, meaning $G = \cap_{i=1}^\infty G_i$, each $G_i$ an open set. Define a function $f:\mathbb{R} \to \mathbb{R}$ as follows: $f(x)=0$ if $x$ is in $G$. If x is not in $G$, there is some $k$ such that $x$ is not in $G_k$; let $k$ be minimal with that property. Define $f(x)=1/k$ if $x$ is rational and $f(x)=-1/k$ if $x$ is irrational. 
If I'm not very much mistaken, $G$ is precisely the set of continuity points of this $f$. I'm happy to leave this as an exercise for now :-) Let me know if you're not sure how to do it, or - worse - if I'm just wrong about the construction.
A: I hope nobody would mind if I try to do the exercise.
Clearly $f$ is continuous on $G$.
Suppose $f$ is continuous on $x$ and $f\left(x\right)=1/k$. Take $\epsilon=1/k$. Let $U$ be any neighborhood of $x$. $U\cap G_1\cap .. \cap G_{k-1}$ contains an irrational number $y$. Hence $\left|f\left(x\right)-f\left(y\right)\right|=2/k>\epsilon$.
(If $f\left(x\right)=-1/k$, take $y$ to be a rational number.)
