Local behavior of an integrable function Suppose $f\in L^1(\mathbb{R})$. We know that $F(x)=\int_0^xf(s)ds$ is absolutely continuous,and $F'(x)=f$ almost everywhere. Correspondingly, $f^+=\max(f,0)$ is also integrable and $G=\int_0^xf^+dx$ is differentiable almost everywhere. My question is: If $F$ is differentiable at $x$, will $G$ also be differentiable here?
A simpler question could be: If $\lim_{h\to 0^+}\frac{1}{h}\int_0^h f(x)dx=0$, will it be true that $$
\lim_{h\to 0^+}\frac{1}{h}\int_0^h f^+(x)dx=0?
$$
 A: No.
Say $I_n=[\frac1{n+1},\frac1n)$ for $n=1,2,\dots$. Note that $|I_n|\sim1/n^2$. We're going to choose a sequence $a_n>0$ with $a_n\to\infty$, and let $f$ be the function which equals $a_n$ on the left half of $I_n$, equals $-a_n$ on the right half of $I_n$, and vanishes off $(0,1)$.
If $$\sum\frac{a_n}{n^2}<\infty$$then $f\in L^1$. If $h\in I_n$ then $$\left|\int_0^hf(t)\,dt\right|\le c\frac{a_n}{n^2};$$since $h\in I_n$ implies $h\sim1/n$ this shows that if $$\frac{a_n}{n}\to0$$then $$\lim_{h\to0}\frac1h\int_0^hf(t)\,dt=0.$$But if $h=1/n$ then $$\frac1h\int_0^hf^+(t)\,dt
\sim n\sum_{j=n}^\infty\frac{a_j}{j^2}.$$
So we just need a sequence such that... Ah. Let $a_n=n^{1/2}$. Then  $\sum a_n/n^2<\infty$ and $a_n/n\to0$, so $f\in L^1$ and $\frac1h\int_0^h f\to0$. But $$n\sum_{j=n}^\infty\frac{a_j}{j^2}\sim n^{1/2},$$so $\frac1h\int_0^hf^+$ is unbounded (and in fact tends to $\infty$ as $h\to 0^+$).
A: Let $f(x) = |x|^{-\frac{1}{2}}\sin(x^{-1})\chi_{[-1,1]}(x)$. For $0<x<1$ we have
\begin{align} F(x) = \int\limits_{0}^{x}{s^{-\frac{1}{2}}\sin(s^{-1})\text{ d}s} = \int\limits_{\infty}^{x^{-1}}{t^{\frac{1}{2}}\sin(t)(-t^{-2}\text{ d}t}) &= \int\limits_{\infty}^{x^{-1}}{t^{-\frac{3}{2}}(-\sin(t)\text{ d}t}) \\
&=(x^{-1})^{-\frac{3}{2}}\cos(x^{-1})+\int\limits_{\infty}^{x^{-1}}{\frac{3}{2}t^{-\frac{5}{2}}\cos(t)\text{ d}t} \\
&=O(x^{\frac{3}{2}})
\end{align}
where in the first line the substitution $t = s^{-1}$ was made. For $-1<x<0$ we similarly have $F(x) = O(|x|^{\frac{3}{2}})$. It follows that $F$ is differentiable at $0$, with $F'(0)=0$. On the other hand, $f(x)\ge 0$ if $n\pi\le \frac{1}{x}\le (n+1)\pi$ for $n\in\mathbb{N}$ even, and
$$\int\limits_{\frac{1}{(n+1)\pi}}^{\frac{1}{n\pi}}{s^{-\frac{1}{2}}\sin(s^{-1})\text{ d}s} = \int\limits_{n\pi}^{(n+1)\pi}{t^{-\frac{3}{2}}\sin(t)\text{ d}t}\ge ((n+1)\pi)^{-\frac{3}{2}}\int\limits_{n\pi}^{(n+1)\pi}{\sin(t)\text{ d}t} = 2((n+1)\pi)^{-\frac{3}{2}} $$
Hence,
$$ G(x) = \int\limits_{0}^{x}{f^{+}(s)\text{ d}s}\ge\sum\limits_{n\in\mathbb{N}\text{ even},n\ge x^{-1}}{\int\limits_{\frac{1}{(n+1)\pi}}^{\frac{1}{n\pi}}{s^{-\frac{1}{2}}\sin(s^{-1})\text{ d}s}}\ge \sum\limits_{n\in\mathbb{N}\text{ even},n\ge x^{-1}}{2((n+1)\pi)^{-\frac{3}{2}}}\approx Cx^{\frac{1}{2}} $$
for $0<x<1$. It follows that $G$ is not differentiable at $x=0$.
