Let f,g be bounded measurable functions on a set E of finite measure. Show that:
If f=a.e.g then ∫f=∫g on E
I have this proof from Cupta book, but I can't understand how this step done, depends on what?

Let f,g be bounded measurable functions on a set E of finite measure. Show that:
If f=a.e.g then ∫f=∫g on E
I have this proof from Cupta book, but I can't understand how this step done, depends on what?

Let's prove this: Suppose $f \geq 0$ on a measurable set $E.$ Then $\int_E f \geq 0.$
Choose a simple function $u$ supported on $E$ so $u \leq f$ and $u \geq 0.$ Then
$$ \int_E u = \sum u_j m(E_j) $$
where $m$ is Lebesgue measure, $u_j \geq 0$, and the $E_j$ is a partition of $E$. Then the above is nonnegative. It follows that the supremum over all simple functions $u$ that approximate $f$ from below is nonnegative, and hence $\int_E f \geq 0.$
The result that $f \leq g$ a.e. on $E$ implies $\int_E f \leq \int_E g$ follows by replacing $f$ with $g-f$ in the above.