I'm trying to prove the following know result:
Theorem Let $I = (a,b)$ be an interval, and let $\phi \colon I \to \mathbb{R} $ be a continuos function. Then, $\phi$ is convex in $I$ if and only if $$(*) \quad \phi(x) \leq \dfrac{1}{2\delta}\int_{x-\delta}^{x+\delta}\phi(t)dt,$$ for all $a < x-\delta < x < x+\delta < b$.
It is "easy" to prove, via Jensen's inequality, that if $\phi$ is convex then it satisfies $(*)$. However, I'm stuck proving the converse.
I've read that it can be deduced from the following result:
Lemma In the upper setting, $\phi$ is convex in $I$ if and only if for any given $\alpha \in \mathbb{R}$ and any interval $J = [c,d] \subset I$ the function $\phi+\alpha x$ attains its maximum in any of the limit points of $J$, that is, $c$ or $d$.
Any advice on how to finish the proof?
Thanks in advance.