Proving a measurable function is constant almost everywhere If $f:\mathbb R\to\mathbb R$ is measurable and bounded and
$$
\lim_{r\to0}\int_0^1\frac{|f(x+r)-f(x)|}rdx=0
$$
then $f$ is constant for a.e. $x\in[0,1]$.
I'm not sure how to go about proving that something's constant almost everywhere. One thing I tried was assuming $f(x)=\lim\frac1{|B(x,r)|}\int_{B(x,r)}f(y)dy$ (which is true almost everywhere by the Lebesgue differentiation theorem) and then proving that $f$ is a constant everywhere but this didn't work out.
 A: Since $f$ is bounded and measurable,
$$F(x) = \int_0^x f(t) \,dt$$ 
is differentiable and $F'(x) = f(x)$ almost everywhere.
We have 
$$\begin{align}F(x+r) &= \int_0^{x+r}f(t) \, dt \\ &=  \int_{0}^{r}f(t) \, dt +\int_r^{x+r} f(t) \, dt \\ &= \int_{0}^{r}f(t) \, dt + \int_{0}^{x}f(t+r) \, dt \end{align}$$
and 
$$\tag{*}\frac{F(x+r) - F(x)}{r} = \frac{1}{r} \int_0^r f(t) \, dt + \frac{1}{r} \int_0^x[f(t+r) - f(t)] \, dt.$$
Note that
$$\left| \frac{1}{r} \int_0^x[f(t+r) - f(t)] \, dt\right| \leqslant  \int_0^x\frac{|f(t+r) - f(t)|}{r} \, dt \leqslant \int_0^1\frac{|f(t+r) - f(t)|}{r} \, dt $$
Hence, for every $x$,
$$\lim_{r \to 0} \frac{1}{r} \int_0^x[f(t+r) - f(t)] \, dt = 0$$
Since for almost every $x$,
$$F'(x) = \lim_{r \to 0} \frac{F(x+r) - F(x)}{r}$$
it follows that the limit of the first integral on the RHS of (*) must exist, and for almost every $x$,
$$f(x) = F'(x) = \lim_{r \to 0} \frac{1}{r} \int_0^r f(t) \, dt$$
Therefore, $F$ is almost everywhere a linear function and $f$ is almost everywhere constant.
