If $f:[a,b]\to\mathbb{R}$ continuous at all but countably infinitely many points, $g:[0,1]\to[a,b]$ continuous, can $f\circ g$ be a.e. discontinuous? Let $f:[a,b]\to\mathbb{R}$ be continuous except at $\{x_1,x_2,\cdots,x_n,\cdots\}$, $g:[0,1]\to[a,b]$ be a continuous function. My question is: can the points of discontinuity of $f\circ g$ have full measure?
The set of points of discontinuity of $f\circ g$ is included in $\bigcup^\infty_{n=1} \partial g^{-1}(x_n)$, where $\{\partial g^{-1}(x_n)\}_{n\ge 1}$ is a countably infinite collection of disjoint closed sets with empty interior. I'm well aware that a subset of $[0,1]$ with full measure can be written as a countable union of closed sets with empty interior (there are many simple constructions), but I don't know if there is a subset of $[0,1]$ with full measure that is a countable union of disjoint closed sets with empty interior. Also, even there is a subset $E$ of $[0,1]$ with full measure such that $E = \bigcup^\infty_{n=1} C_n$, where $\{C_n\}$ are disjoint closed sets with empty interior, can we find $\{x_1,x_2,\cdots,x_n,\cdots\}$ and define a continuous function $g$ such that $g^{-1}(x_n) = C_n$?
Edit: Note that $f\circ g$ cannot be a.e. discontinuous if $f$ has only finitely many points of discontinuity, since $\bigcup^{N}_{n=1} \partial g^{-1}(x_n)$ would be closed and, by Baire category theorem, have empty interior, so it cannot have full measure. On the other hand, the set of points of discontinuity of $f\circ g$ can have measure arbitrarily close to 1, even if $f$ is just discontinuous at one point.
 A: Here is an example:
We use an auxiliary continuous function $\chi: [0, 1] \to [0,1]$ such that $\chi(0) = \chi(1) = 0$, $\chi(1/2) = 1$, and $\chi^{-1}(\mathbb{Q})$ has full measure.
To construct $g: [0,1] \to [0,1]$, take a map $t: \mathbb{Z}_+ \to \mathbb{Q} \cap [0,1]$ such that each rational in $[0,1]$ appears in the image infinitely many times. Consider
$$g = \sum_{n = 1}^{\infty} c_n\chi_{I_n}$$
where $\chi_{I_n}$ is a scaling of $\chi$ function such that its support is $I_n =[t_n - \ell_n, t_n + \ell_n]$, and $c_n \in \mathbb{Q}^+$ with $c_n \leq 2^{-n}$ and $\ell_n \leq 2^{-n}q_n^{-3}$, $q_n$ being the denominator of $t_n$. Then by uniform convergence, $g$ is continuous. Furthermore, $g$ has the following property:

*

*By choosing $c_n$ appropriately, $g(\mathbb{Q})$ can be disjoint from $\mathbb{Q}$. To achieve this, for each $q \in \mathbb{Q} \cap [0,1]$, let $n \in S_q$ be the set of $n$ such that $I_n$ is centered at $q$. $q$ lies in the intervals $\{I_n\}_{n \in S_q}$ plus finitely many other intervals $\{J_m\}$. Thus, it suffice to take the $c_n$ for $n \in S_q$ such that
$$\sum_{n \in S_q} c_n$$
is outside the $\mathbb{Q}$-span of $\{1, \chi_{J_m}(q)\}_m$.


*$g^{-1}(\mathbb{Q})$ has measure $1$, as each number in its complement must either appear in infinitely many $I_n$, or is in $\chi_{I_n}^{-1}(\mathbb{R} \backslash \mathbb{Q})$  for some $n$, both of which have measure zero.
Now let $f(p/q) = 1/q$ for any $p/q \in \mathbb{Q}$, and let $f \equiv 0$ outside $\mathbb{Q}$. Then $f$ is continuous except on $\mathbb{Q}$, but $f \circ g$ is discontinuous on $g^{-1}(\mathbb{Q})$.
Note: $\chi$ itself can be constructed similar to the cantor set. Given a tenary representation $0.a_1a_2\cdots$ of a number in $[0,1]$, let $i$ be the first such that $a_i = 1$, then let
$$\eta(a) = \sum_{j = 1}^{i - 1} 2^{-j - 1}a_j + 2^{-i}.$$
Then $\eta(0) = 0, \eta(1) = 1$, and $\eta^{-1}(\mathbb{Q})$ is full measure. Glue two copies of $\eta$ together to get $\chi$.
