TITLE: "Converse" to composition of measurable functions is measurable
QUESTION [6 upvotes]: Here is a restatement of a problem in a textbook I encountered. I'm
well beyond the age of doing homework and this is purely for
self-study.

Exercise: Let $f : (X,\Sigma_1) \to (Y, \Sigma_2)$ and
      $h:(X,\Sigma_1) \to (\mathbb R, \mathcal B)$ be
      measurable maps where in the latter case $\mathcal B$ denotes the
      Borel $\sigma$-algebra over $\mathbb R$. Let $\Sigma_f =
    \sigma(f)$. Show that $h$ is $\Sigma_f$-measurable if and only if there exists $g : (Y,\Sigma_2) \to
    (\mathbb R, \mathcal B)$ such that $h(x) = g(f(x))$ for all $x \in
    X$.

One direction of the proof is easy. Suppose such a $g$ exists. Then,
for all $B \in \mathcal B$, $h^{-1}(B) = f^{-1}( g^{-1}(B) )$ and so
$h^{-1} \in \Sigma_f$.
There seem to be some holes in the opposite direction which I can't
quite fill.
For all $z \in \mathbb R$, I defined
$$
A_z = \{x: h(x) = z\}. 
$$
Then $A_z \in \Sigma_1$ since the singletons $\{z\}$ are
Borel-measurable. Also, for $z \neq z'$, it is true that $A_z \cap
A_{z'} = \emptyset$. Now, if $h$ is $\Sigma_f$-measurable, then $A_z =
f^{-1}(B_z)$ for some $B_z \in \Sigma_2$. But then, for $z \neq z'$,
we have that $B_z \cap B_{z'} = \emptyset$ as well, so the $\{B_z\}_{z
\in \mathbb R}$ sets partitions $Y$ modulo the portion not in the image
of $f$.
Now, set $g(y) = z$ on $B_z$ and set $g(y) = 0$ on $y \in N_0 := Y
\setminus \cup_{z \in \mathbb R} B_z$. It seems reasonable to claim that $N_0$ is a measurable set by considering that $N_0 = Y \setminus \cup_n
C_n$ where $f^{-1}(C_n) = h^{-1}((-\infty,n))$ and $C_n \in \Sigma_2$
by assumption.
But, this only seems to show that we can construct a well-defined
$g$. It doesn't seem to prove that it is measurable! To get
measurability we need to show something in addition to this, like $\{y: g(y) \leq z\} \in
\Sigma_2$ for all $z \in \mathbb R$.
For $z < 0$ it seems we should be able to get a correspondence between
$\{y: g(y) \leq z\}$ and $C_z$ where $C_z \in \Sigma_2$ satisfies $f^{-1}(C_z) = h^{-1}((-\infty,z))$. For $z \geq 0$, I think it would be
something like $\{y : g(y) \leq z\} = C_z \cup N_0$, I think.
I can't quite seem to make the argument go through.
Questions:

Is this on the right track? If so, how do we finish it off? (It seems a little "too constructive" for a typical measure-theoretic argument.)
Is there some other more clever or direct argument? If so, what is it?

REPLY [5 votes]: This proof goes by what probabilists and other practitioners of measure theory sometimes call the "standard mantra": first indicator functions, then simple functions (those with finite range), then nonnegative measurable functions, then all measurable functions.

As a preliminary step, show that $\Sigma_f = \{ f^{-1}(B) : B \in \Sigma_2\}$.  ($\supset$ is obvious.  For $\subset$, show that the right side (call it $\Sigma'$) is a $\sigma$-algebra and $f$ is $(X, \Sigma'),(Y,\Sigma_2)$ measurable.)
Now suppose $h = 1_A$ for some $A \in \Sigma_f$.  Find a $g$ such that $h = g \circ f$.  (Use the previous step).
Suppose next that $h = \sum_{i=1}^n c_i 1_{A_i}$ is a simple function.  Again, find a $g$.  (It's not hard to guess what it is, given the previous step.)
If $h$ is a nonnegative $\Sigma_f$-measurable function, then recall that $h = \sup_n h_n$ for some sequence $h_n$ of $\Sigma_f$-measurable simple functions.  (This is about the only "constructive" way to describe measurable functions.)  Again, find a $g$.
Finally, if $h$ is any $\Sigma_f$-measurable function, write $h = h^+ - h^-$ and use the previous step.