# Is composition of measurable functions measurable?

We know that if $f: E \to \mathbb{R}$ is a Lebesgue-measurable function and $g: \mathbb{R} \to \mathbb{R}$ is a continuous function, then $g \circ f$ is Lebesgue-measurable. Can one replace the continuous function $g$ by a Lebesgue-measurable function without affecting the validity of the previous result?

Let $f\colon [0,1]\to [0,1]$ be the Cantor–Lebesgue function. This is a monotonic and continuous function, and the image $f(C)$ of the Cantor set $C$ is all of $[0,1]$. Define $g(x) = x + f(x)$. Then $g\colon [0,1] \to [0,2]$ is a strictly monotonic and continuous map, so its inverse $h = g^{-1}$ is continuous, too.
Observe that $g(C)$ measure one in $[0,2]$: this is because $f$ is constant on every interval in the complement of $C$, so $g$ maps such an interval to an interval of the same length. It follows that there is a non-Lebesgue measurable subset $A$ of $g(C)$ (Vitali’s theorem: a subset of $\mathbb{R}$ is a Lebesgue null set if and only if all its subsets are Lebesgue measurable).
Put $B = g^{-1}(A) \subset C$. Then $B$ is a Lebesgue measurable set as a subset of the Lebesgue null set $C$, so the characteristic function $1_B$ of $B$ is Lebesgue measurable.
The function $k = 1_B \circ h$ is the composition of the Lebesgue measurable function $1_B$ and and the continuous function $h$, but $k$ is not Lebesgue measurable, since $k^{-1}(1) = (1_B \circ h)^{-1}(1) = h^{-1}(B) = g(B) = A$.