Example of a function such that $\varphi\left(\frac{x+y}{2}\right)\leq \frac{\varphi(x)+\varphi(y)}{2}$ but $\varphi$ is not convex

Solution 1:

I'm not sure there is a constructive example, but here is a construction using the Axiom of Choice:

$\mathbb{R}$ is a vector space over $\mathbb{Q}$. Choose (using AC) a basis $\{r_i\}_{i\in I}$ for $\mathbb{R}$, and consider the linear transformation $h$ that swaps the coefficients for two particular basis vectors $r_1$ and $r_2$. Then $h$, being a linear transformation, preserves addition and multiplication by $1/2$ (since $1/2 \in \mathbb Q$), but is everywhere discontinuous. In fact the range of $h$ on any open interval is dense in $\mathbb R$. (Prove this!)

Now consider $\phi(x) = h(x)^2$. Since $x^2$ is convex and $h$ preserves addition and halving, $\phi$ must satisfy the inequality. On the other hand, $\phi$ cannot be convex since the image of any open interval is dense in $\mathbb R_+$.

Solution 2:

Any midpoint-convex function on $\mathbb R$ that is not convex must not be Lebesgue measurable. According to a result of Solovay, there are models of Zermelo-Fraenkel set theory without Axiom of Choice in which there are no non-measurable functions ${\mathbb R} \to {\mathbb R}$. Thus there is no way to explicitly construct your counterexample.