Mid-point convexity does not imply convexity [duplicate]

A function $f: X \rightarrow \mathbb{R}$ is said to be mid-point convex if for all $x, y \in X$, we have $$f(\frac{x + y}{2}) \leq \frac{f(x) + f(y)}{2}.$$ Can you please give an example of a function which is mid-point convex but not convex?

marked as duplicate by Martin Sleziak, Yagna Patel, Daniel W. Farlow, SchrodingersCat, ServaesDec 8 '15 at 17:56

That is a theorem on convex analysis but it is stated for continuous function. For making counterexample you can remove the continuity from the condition such as $f(x)=x^2$ for $x\in \mathbb{Q}$ and $0$ otherwise. I think that, it is a counter example.
• In fact, it is known that any counterexample cannot be measurable and that existence of such function cannot be shown in ZF. (See the linked questions.) Your example does not work. Just consider $x=2+\sqrt2$ and $y=-\sqrt2$. (Or any other two irrational numbers such that their average is a non-zero rational number.) – Martin Sleziak Dec 8 '15 at 15:16
• If a Midpoint Convex function F, strictly monotonic, increasing on a real interval $[0,1]\to[0,1]$, with $F(0)=0$ and $F(1)=1$ , $F(0.5)=0.5$ will it be measurable and convex, aside from the possible counter-examples. Generally strict quasi-convexity is sufficient under mild constraints – William Balthes May 5 '17 at 15:56