Let $f$ be a real-valued Lebesgue measurable function on $\mathbb{R}$. Prove that there exist Borel measurable functions $g$ and $h$ such that $g(x)=h(x)$ almost everywhere and $g(x)\le f(x) \le h(x)$ for every $x \in \mathbb R$. I know that $f$ is measurable since there exists a sequence of simple function that converges to $f$. I have no further idea how to tackle this problem.


It seems that this is in fact not possible: there exists a measurable function $f:\mathbb R\to\mathbb R$ for which one cannot find any Borel function $h:\mathbb R\to\mathbb R$ such that $f\leq h$ everywhere.

Here is a (hopefully correct) example. Since my previous answer was wrong, I would be glad to know if this one is OK...

Take a perfect set $K\subseteq\mathbb R$ with Lebesgue measure $0$. The family of all perfect subsets of $K$ has the cardinality of the continuum; so (using the axiom of choice), one can enumerate the perfect subsets of $K$ as $(L_\alpha)_{\alpha<\mathfrak c}$. Then, one can define by transfinite induction a family $(C_\alpha)_{\alpha<\mathfrak c}$ of countable (infinite) sets such that $C_\alpha\subseteq L_\alpha$ and $C_\alpha\bigcap \left(\bigcup_{\beta<\alpha} C_\beta\right)=\emptyset$ for all $\alpha<\mathfrak c$. Indeed, if the $C_\beta$ have been found for all $\beta<\alpha$, then the set $Z_\alpha:=\bigcup_{\beta<\alpha} C_\beta$ has cardinality less than $\mathfrak c$, so $L_\alpha\setminus Z_\alpha$ is infinite because $L_\alpha$ has cardinality $\mathfrak c$, and hence $L_\alpha\setminus Z_\alpha$ contains a countable infinite set $C_\alpha$.

Now, enumerate each $C_\alpha$ as $C_\alpha=\{ x_{\alpha,n};\; n\in\mathbb N\}$, and define a function $f:\mathbb R\to\mathbb R$ as follows : $f(x_{\alpha,n}):=n$ for all $\alpha,n$, and $f(x)\equiv0$ outside $\bigcup_{\alpha<\mathfrak c} C_\alpha$. This is a measurable function because $f(x)\equiv 0$ outside $K$ (and hence almost everywhere). On the other hand, the function $f$ has the following property : it is not bouded above on any perfect subset of $K$.

Assume that one can find a Borel function $h:\mathbb R\to\mathbb R$ such that $f\leq h$. Since $h$ is real-valued, we have $K=\bigcup_{n\in\mathbb N} B_n$, where $B_n:=\{ x\in K;\; h(x)\leq n\}$. Since $K$ is uncountable, at least one of the sets $B_n$ must be uncountable; and since $B_n$ is a Borel set (because $h$ is Borel), it must contain some perfect set $L$ (by a well known theorem). Then $h$ is bounded above on $L$, a contradiction since $h\geq f$ and $f$ is not bounded above on $L$.