Inf and sup for Lebesgue integrable functions Let $D \subset \mathbb{R}$ be a measurable set of finite measure. Suppose that $f : D \to \mathbb{R}$ is a bounded function. Prove that
$$\sup\left\{\int_D \varphi \mid \varphi \leq f \text{ and } \varphi \text{ simple}\right\} = \inf\left\{\int_D \psi \mid f \leq \psi \text{ and } \psi \text{ simple}\right\}$$
iff $f$ is measurable.
I was wondering if I could get a hint.

Suppose the inf and the sup are equal.  Then for any $\epsilon > 0$ there exist simple functions $\varphi \le f \le \psi$ with the property that $\displaystyle \int_D \psi < \int_D \varphi + \epsilon$. Use this fact to construct sequences $\varphi_n$ and $\psi_n$ of simple functions with the property that $\varphi_n \le f \le \psi_n$ and $\displaystyle \int_D \psi_n - \varphi_n < 4^{-n}$.  Let $m^*$ denote Lebesgue outer measure and $m$ Lebesgue measure.  Then
$$
m^*(\{f - \varphi_n > 2^{-n}\}) \le m^*(\{\psi_n - \varphi_n > 2^{-n}\}) = m(\{\psi_n - \varphi_n > 2^{-n}\})
$$
because $f \le \psi_n$.  Chebyshev's inequality gives you
$$
m(\{\psi_n - \varphi_n > 2^{-n}\}) \le 2^n \int_D \psi_n - \varphi_n < 2^{-n}.
$$
Write $E_n = \{f - \varphi_n > 2^{-n}\}$. Then $m^*(E_n) < 2^{-n}$, and by subadditivity $m^*(\cup_{n \ge N} E_n) \le 2^{1-N}$. The monotonicity of $m^*$ implies
$$
m^* \left( \bigcap_{N \ge 1} \bigcup_{n \ge N} E_n \right) = 0.
$$
On edit: can you use this fact to show $f$ is measurable?
