TITLE: Weakly convex functions are convex
QUESTION [5 upvotes]: Let us consider a continuous function $f \colon \mathbb{R} \to \mathbb{R}$. Let us call $f$ weakly convex if
$$
\int_{-\infty}^{+\infty}f(x)[\varphi(x+h)+\varphi(x-h)-2\varphi(x)]dx\geq 0 \tag{1}
$$
for all $h \in \mathbb{R}$ and all $\varphi \in C_0^\infty(\mathbb{R})$ with $\varphi \geq 0$.
I was told that $f$ is weakly convex if, and only if, $f$ is convex; although I can imagine that (1) is essentially the statement $f'' \geq 0$ in a weak sense, I cannot find a complete proof.
Is this well-known? Is there any reference?

REPLY [6 votes]: By a change of variables (translation-invariance of Lebesgue measure) the given inequality can be equivalently rewritten as 
$$
\int [f(x+h)+f(x-h)-2f(x)]\varphi(x)\,dx \geq 0 \qquad \text{for all }0 \leq \varphi \in C^{\infty}_0(\mathbb{R})\text{ and all }h \gt 0.
$$
If $f$ were not midpoint convex then there would be $x \in \mathbb{R}$ and $h \gt 0$ such that $f(x+h) + f(x-h) - 2f(x) \lt 0$. By continuity of $f$ this must hold in some small neighborhood $U$ of $x$, so taking any nonzero $\varphi \geq 0$ supported in $U$ would yield a contradiction to the assumed inequality.
Thus, $f$ is midpoint convex and hence convex because $f$ is continuous.

Edit: The converse direction should be clear: it follows from $f(x+h) + f(x-h) - 2f(x) \geq 0$ for convex $f$ and all $h \gt 0$ so that the integrand in the first paragraph is non-negative.
Finally, the argument above works without essential change for continuous $f \colon \mathbb{R}^n \to \mathbb{R}$.