Solution (source code)

= Solution

Lebesgue <measurability> of $g$ means that $g^{-1}(U)$ is a <Lebesgue measurable> subset of $\mathbb R$ for every open subset $U\subseteq\mathbb R$. Equivalently one can check all sets $\{x:g(x)>t\}$ with real $t$.

There are two conventions for a <step function> on the whole real line. Under the bounded-support integration convention it is a finite <linear combination> of indicators of bounded intervals; under the unrestricted piecewise-constant convention nonzero constant tails are allowed. The conclusions below state both conventions explicitly, since only the first assertion depends on this choice.