Show $f: [0,1] \rightarrow [0, \infty)$ is Lebesgue measurable. 
Let $X = [0,1]$. Let $f: X \rightarrow [0, \infty)$. Define $G(f) = \{ (x,y)\in X \times [0, \infty] : y \leq f(x) \}$. Show that $f$ is $m$-measurable iff $G(f)$ is $m^2$-measurable and that $$m^2(G(f))= \int f \,\mathrm{d}m.$$

I already proved the direction by defining $g(x,y)= f(x)-y$, showing $g$ is $m-$measurable and using Tonelli's Theorem, but I'm not sure how to do the backwards direction.
Any help is appreciated!
Thanks!
 A: 
Let $X = [0,1]$. Let $f: X \rightarrow [0, \infty)$. Define $G(f) = \{ (x,y)\in X \times [0, \infty] : y \leq f(x) \}$. Show that $f$ is $m$-measurable iff $G(f)$ is $m^2$-measurable and that $$m^2(G(f))= \int f \,\mathrm{d}m.$$

Proof:  $(\Rightarrow)$ Suppose $F$ is $m$-measurable (where $m$ is the Lebesgue measure). Then $g : X \times [0, \infty) \rightarrow \Bbb R$ defined by $g(x,y)= f(x)-y$ is a mesasurable function. So $ G(f) = g^{-1}([0, \infty))$  is a $m^2$ measurable set.
$(\Leftarrow)$ Suppose that $G(f)$ is $m^2$-measurable. Then,
for all $b \in [0, \infty)$, and all $n \in \Bbb N$, $n>0$, the function $h_{b,n}:  X \times [0, \infty) \rightarrow  X \times [0, \infty)$ defined by $h_{b,n}(x,y) = \left (x, \frac{1}{n}y+b \right)$ is Lebesgue-Lebesgue-measurable (because $h_{b,n}$ is an invertible affine transformation in $\Bbb R^2$, restricted to $ X \times [0, \infty)$).
So,
\begin{align*} h_{b,n}^{-1}(G(f)) & = \left \{ (x,y) \in X \times  [0, \infty) : \left (x, \frac{1}{n}y+b \right)\in G(f)\right \} = \\
& =\left \{ (x,y) \in X \times  [0, \infty) : f(x) \geqslant  \frac{1}{n}y+b \right \}
\end{align*}
is $m^2$-measurable.
So
\begin{align*} 
h_{b,n}^{-1}(G(f)) \cap (X \times (0,\infty))  & =\left \{ (x,y) \in X \times  [0, \infty) : f(x) \geqslant  \frac{1}{n}y+b ,\: y>0\right \}
\end{align*}
is $m^2$-measurable.
So, for all $b \in [0, \infty)$,
\begin{align*} \bigcup_{n=1}^\infty \left (h_{b,n}^{-1}(G(f)) \cap (X \times (0,\infty)) \right ) & = \bigcup_{n=1}^\infty \left \{ (x,y) \in X \times  [0, \infty) : f(x) \geqslant  \frac{1}{n}y+b ,\: y>0\right \} =\\ 
& = \{(x,y)  \in X \times  [0, \infty): f(x)>b , \: y > 0 \} = \\
& = f^{-1}((b, \infty))\times (0, \infty)
\end{align*}
is $m^2$-measurable. So $f^{-1}((b, \infty))\times (0, \infty)$ is a $m^2$-measurable rectangle and $m((0, \infty)) >0$. So $f^{-1}((b, \infty))$ is $m$-measurable. So $f$ is $m$-measurable.
Finally if one of the two conditions hold (and so both holds) we have that $\chi_{G(f)}$ is a measurable non-negative function, and applying Tonelli's Theorem, we have
$$ m^2(G(f)) = \int \chi_{G(f)} dm^2 =\iint \chi_{G(f)}(x,y) \mathrm{d}m(y) \mathrm{d}m(x) = \int f(x) \,\mathrm{d}m(x) =  \int f \,\mathrm{d}m$$
A: We have the following fact.
Proposition. Let $(X,\mathcal{F})$ and $(Y,\mathcal{G})$ be measurable
spaces. Let $(X\times Y,\mathcal{F}\otimes\mathcal{G})$ be the usual
product. For any subset $G\subseteq X\times H$, $x\in X$, $y\in Y$,
define sections $G^{x}=\{y\mid(x,y)\in G\}$ and $G_{y}=\{x\mid(x,y)\in G\}$.
If $G\in\mathcal{F}\otimes\mathcal{G}$ and $x\in X$, $y\in Y$,
then $G^{x}\in\mathcal{G}$ and $G_{y}\in\mathcal{F}$.
Proof: Let $x\in X$ and $y\in Y$ be fixed. Define $\theta^{x}:Y\rightarrow X\times Y$
and $\theta_{y}:X\rightarrow X\times Y$ by $\theta^{x}(b)=(x,b)$
and $\theta_{y}(a)=(a,y)$. We go to show that $\theta^{x}$ is $\mathcal{G}/\mathcal{F}\otimes\mathcal{G}$-measurable
while $\theta_{y}$ is $\mathcal{F}/\mathcal{F}\otimes\mathcal{G}$-measurable.
Let $\pi_{X}:X\times Y\rightarrow X$ and $\pi_{Y}:X\times Y\rightarrow Y$
be canonical projections, i.e., $\pi_{X}(a,b)=a$ and $\pi_{Y}(a,b)=b$.
Recall that product $\sigma$-algebra $\mathcal{F}\otimes\mathcal{G}$
has the universal property: For any measurable space $(Z,\mathcal{H})$
and map $g:Z\rightarrow\mathcal{F}\otimes\mathcal{G}$, $g$ is measurable
iff $\pi_{X}\circ g$ and $\pi_{Y}\circ g$ are measurable. Now, observe
that $\pi_{X}\circ\theta^{x}:Y\rightarrow X$ is the constant map
$t\mapsto x$ while $\pi_{Y}\circ\theta^{x}:Y\rightarrow Y$ is the
identity function $t\mapsto t$, and both of them are clearly measurable.
Therefore, $\theta^{x}$ is $\mathcal{G}/\mathcal{F}\otimes\mathcal{G}$-measurable.
Similarly $\theta_{y}$ is $\mathcal{F}/\mathcal{F}\otimes\mathcal{G}$-measurable.
Observe that $G^{x}=(\theta^{x})^{-1}(G)$ and hence $G^{x}\in\mathcal{G}$.
Similarly, $G_{y}=(\theta_{y})^{-1}(G)$ and hence $G_{y}\in\mathcal{F}$.

For your question. Suppose that $G(f)\in\mathcal{B}([0,1]\times[0,\infty))=\mathcal{B}([0,1])\otimes\mathcal{B}([0,\infty))$
(this is true because the usual topology on $\mathbb{R}$ is second
countable). Let $y\in[0,\infty)$ be arbitrary. By the above proposition,
$G(f)_{y}\in\mathcal{B}([0,1])$. However, $G(f)_{y}=\{x\in[0,1]\mid y\leq f(x)\}=f^{-1}([y,\infty)).$
This shows that $f$ is Borel.
