How to construct a function whose set of discontinuities is not closed? Any ideas/hints on how to construct a non-decreasing function on $[0,1]$ whose set of discontinuities is not closed?
The motivation is that I noticed that most "regular" functions have closed (discrete) sets of discontinuities, so I was wondering whether it is possible to construct a function whose set of discontinuities is not closed.
I did have an idea to construct a function whose set of discontinuities is a sequence whose limit point is a point of continuity, but I failed to implement this idea. 
 A: In general, the points of continuity make a $G_\delta$ set (a countable intersection of open sets), so the points of discontinuity are an $F_\sigma$ set (a countable union of closed sets). So, unless we are really lucky, there ought to be some function that has a $F_\sigma$ but not closed set of discontinuities. The simplest kind of non-closed $F_\sigma$ set consists of a convergent sequence that does not include its limit point, such as $(1/n)$. 
To make a function that is discontinuous only on points of the form $1/n$, take an atomic measure $\mu$ with weight $2^{−n}$ at $1/n$ and no weight elsewhere, and let $f(x)=\int_{-\infty}^x 1\,d\mu$. This will be discontinuous at each $1/n$ because of the point mass. The only other point where $f$ could conceivably be discontinuous is $x=0$, but it is not hard to show it's continuous there, because $\sum 2^{-n}$ converges. 
This cumulative distribution method is guaranteed to make an increasing $f$ because the cumulative distribution of any measure is increasing.   It also has the benefit that we don't need to specify the function by cases, or explicitly write any intervals in the definition of $f$, because the integral takes care of everything. 
The converse question is: is every $F_\sigma$ set of reals the set of points of discontinuity of some function? That is, is every $G_\delta$ set of reals the set of points of continuity of a function? The answer is yes, as shown by Young in 1903; see this MathOverflow post for more information.   
Young's result will not hold for monotonic functions, however, because the set of points of discontinuity of a monotonic function is countable, so even a simple uncountable closed set like the Cantor set cannot be the set of points of discontinuity of a monotone function.  However, Rudin, Principles of Mathematical Analysis, 3rd ed., Remark 4.31 shows that every countable set of real numbers is the set of points of discontinuity of a monotone function, using the same cumulative distribution method.  
A: HINT: Can you find a function that is continuous at $0$ but discontinuous at $1/n$ for $n\in\Bbb N$? 
A: Let $(a_n)_{n\in \Bbb N}$ and $(b_n)_{n\in \Bbb N}$ be strictly increasing sequences of members of $[0,1]$ with $a_1=b_1=0$ and with $1=\lim_{n\to \infty}a_n=\lim_{n\to \infty}b_n.$
For $n\in \Bbb N$  let $g_n: [a_n,a_{n+1}] \to \Bbb R$ be linear with $g_n(a_n)=b_{2n-1}$ and $g_n(a_{n+1})=b_{2n}.$ Now let $f(x)=g_n(x)$ when  $a_n\leq x<a_{n+1}.$
Note that the point $(a_{n+1}, g(a_{n+1}))=(a_{n+1},b_{2n})$ does $not$ belong to the graph of $f.$
And let $f(1)=1.$ The set $D$ of points of discontinuity of $f$ is $\{a_n:n\geq 2\},$ and $\{1\}=\overline D\;\backslash D.$  
It may help to draw a sketch of $f$.
