TITLE: If $S\subset\mathbb R$ is a $G_\delta$, is there a function $\mathbb R\to\mathbb R$ continuous exactly on $S$?
QUESTION [7 upvotes]: Let $S\subset\mathbb R$ be a $G_\delta$ set.  A variation on the construction of the Thomae function (which is discontinuous on the rationals and continuous elsewhere) shows that there is a function $\mathbb R\to\mathbb R$ that is continuous exactly on $S$.  
I'm trying to find a published reference for this result. Note: the wikipedia page on Thomae's function mentions an equivalent result, phrased in terms of $F_\sigma$'s, without giving a reference.
So it's clear the result is well-known; but I'd like a reference in an article or book (even as an exercise) rather than just the wikipedia page.

REPLY [10 votes]: The result you are looking for can be found in most advanced references in topology or analysis. Since I am away from my office at the time of this writing, I will provide you with a source readily available on the internet: Theorem 7.2 (p.30) in Oxtoby's Measure and Category.
Note that Theorem 7.2 shows that any $F_{\sigma}$ set is precisely the set of discontinuities of some real valued function on $\Bbb{R}$; the result you want the reference for is equivalent to Theorem 7.2 thanks to De Morgan Laws.  This theorem, I suspect, is due to Lebesgue, but at the moment I do not have a reference at hand to corroborate my suspicion.
Addendum: According to this source (see history of Theorem 2') the above result was first proved by William H. Young in 1903, and perhaps independently by Lebesgue in 1904.