How badly can Dini's theorem fail if the p.w. limit isn't continuous?

Dini's theorem is commonly seen in real analysis courses (possibly with the requirement that $X$ be a compact metric space if topological spaces are still off in the future), but suppose one wanted to give an example of how much it can fail without the requirement that the pointwise limit of the sequence of functions is continuous. The problem therefore is:

Exhibit a sequence of continuous functions $f_n: [0,1] \to [0,1]$ pointwise monotonically decreasing to a function $f: [0,1] \to [0,1]$ such that the set of points where $f$ is discontinuous has measure $1$.

This could for example be used to demonstrate how poorly behaved the Riemann integral is with respect to pointwise limits since the sequence $(f_n)$ is pretty much as nice as you can possibly get without being uniformly convergent and $f$ is obviously Lebesgue integrable, but it "maximally fails" to satisfy Lebesgue's criterion for Riemann integrability. Additionally, it would demonstrate the existence of comeagre Lebesgue null sets because the set of points where $f$ is continuous is comeagre by the Baire-Osgood theorem (does anyone have a good free online reference for this? (EDIT: I wrote one myself)).

PS: I know of an example myself (and I'll obviously be posting it later if noone posts one); I'm asking in order to have a reference to point to.

• I can do $1-\varepsilon$ for each $\varepsilon>0$, but I don't know how to get $1$. Let $K\subset [0,1]$ be a fat Cantor set with measure $1-\varepsilon$, let $g(x)=$the distance from $x$ to $K$, and let $f_n(x)=(1-g(x))^n$. Then $(f_n)$ decreases to the characteristic function of $K$, which is discontinuous precisely on $K$. – Jonas Meyer Jan 26 '12 at 1:26
• This MathOverflow answer of Andrey Rekalo gives a reference for the fact that the set of points where f is continuous is comeagre. See page 32 of Oxtoby (if Google lets you). Incidentally, this seems to be a rather difficult way of demonstrating comeagre null sets. – Jonas Meyer Jan 26 '12 at 1:49

For each $k\in \mathbb N$, let $C_k$ be a closed subset of $[0,1]$ with empty interior and measure greater than $1-\frac{1}{k}$, e.g. a fat Cantor set. Let $g_k(x)=$the distance from $x$ to $C_k$. Let $f_n(x)=\sum\limits_{k=1}^\infty2^{-k}(1-g_k(x))^n$. Each summand is continuous and the convergence of the series is uniform, so each $f_n$ is continuous. The sequence $(f_n)$ decreases to a limit $f$ which is $0$ on the complement of $\bigcup\limits_{k=1}^\infty C_k$, and positive on $\bigcup\limits_{k=1}^\infty C_k$. Since the complement of $\bigcup\limits_{k=1}^\infty C_k$ is dense by Baire's theorem, this implies that $f$ is discontinuous at each point in $\bigcup\limits_{k=1}^\infty C_k$. Since $C_m\subset \bigcup\limits_{k=1}^\infty C_k$ for each $m$, $\bigcup\limits_{k=1}^\infty C_k$ has measure $1$.
Let $D = \{x_1,x_2,\dotsc\}$ be a countable dense subset of $(0,1)$ and let \begin{align*} U_i &= \bigcup_{j=1}^\infty (x_j-2^{-i-j},x_j+2^{-i-j}) \cap (0,1) \text{ and} \\ K_i &= [0,1] \setminus U_i. \end{align*} Hence each $K_i$ is compact and nowhere dense in $[0,1]$ with $m(K_i) \geq 1-2^{-i}$.
The sets $\{x_i\}$ and $K_i$ are disjoint closed subsets of the $T_6$ space $[0,1]$ (admittedly this is a bit of a nuclear flyswatter), so for each $i \in \mathbb N$ there is a continuous $f_i: [0,1] \to [0,1]$ such that $f_i$ is $0$ exactly at $x_i$ and $f_i$ is $1$ exactly on $K_1 \cup \dotsb \cup K_i$.
Define $g_i = f_1f_2\dotsb f_i$. Then the sequence $(g_i)$ is pointwise monotonically decreasing, so it converges to a function $g: [0,1] \to [0,1]$.
If $x \in K = \bigcup_{i=1}^\infty K_i$, then it is in some $K_i$, and then we have for all $j \geq i$ that $f_j(x) = 1$. We further have that $x \notin D$, so $(g_n(x)) = (\prod_{i=1}^nf_i(x))$ is eventually constant and all the factors are positive. Hence $g(x) > 0$, and since $g|_D = 0$ and $D$ is dense, $g$ must be discontinuous at $x$. Since $x$ was arbitrary we conclude that $g$ is discontinuous on $K$ - a comeagre set of measure $1$.