# Local monotonicity and differentiability a.e.

I am wondering whether the statement below is true (I cannot find a proof or a counterexample). It roughly says "If a continuous function decreases over an interval, it has to decrease at some point in this interval" and decrease at a point is defined as below.

Let $f:[0,1]\rightarrow\Re$ be a continuous function that is differentiable almost everywhere. Assume $f(0)>f(1)$. Then there exists a point $x_0$ and a $\epsilon>0$ such that either

(i) $f(x)\geq f(x_0)$ for all $x\in(x_0−\epsilon,x_0)$ and $f(x)<f(x_0)$ for all $x\in(x_0,x_0+\epsilon)$ or

(ii) $f(x)>f(x_0)$ for all $x\in(x_0−\epsilon,x_0)$ and $f(x)\leq$ $f(x_0)$ for all $x\in(x_0,x_0+\epsilon)$.

So far, I understand that the statement would be wrong if the "differentiable almost everywhere" assumption was not satisfied: Then the Weierstrass function would be a counterexample. If $f$ was differentiable everywhere, the statement would obviously be true. The almost everywhere differentiable case seems unclear to me. Any ideas how the statement above could be proven or whether there is a counterexample? Thanks for your thoughts!

Counterexample: Let $g: [0,1]\to\mathbb{R}$ be the Weierstrass function and $h: [0,1]\to[0,1]$ the Cantor staircase function. The composition $g\circ h$ is differentiable almost everywhere, with the derivative zero on the complement of the Cantor set $C$ (for the same reason as for $h$ itself: the function is constant on each complement of $C$).
The properties (i) and (ii) fail on the complement of $C$, since they require a strict inequality on one of the sides. They also fail at every point $x_0\in C$, because a neighborhood of $x_0$ is mapped by $h$ onto a neighborhood of $h(x_0)$, and $g$ does not have any kind of monotonicity there.