A question about real convex functions This is a follow-up of a popular exercise found in Rudin's Real and Complex analysis.
It is known that if a continuous function $f:\left]a,b\right[\to \bf R$ satisfies the inequality $f((x+y)/2)\le 1/2(f(x)+f(y))$ for every $a<x<y<b$, then $f$ is convex on $\left]a,b\right[$.
In general, if one does not assume $f$ continuous, the conclusion is incorrect, e.g. because one can prove (assuming the axiom of choice) the existence of pathological functions $f:\bf R\to R$ that are $\bf Q$-linear but not $\bf R$-linear.
My question: does the conclusion still hold if one only assumes that $f$ is measurable?
Another question for the sake of curiosity: does there exist a function $f$ satisfying the above inequality, that are neither continuous nor additive?
 A: Since second question was addressed in comments I will answer only the first one.
I will prove that $f$ is continuous on $(a, b)$ from which by exercise from Rudin everything follows.
Consider sets $L_n = \{x\in (a, b) : f(x) < n\}$. They are measurable and their union is the whole $(a, b)$ so for some $n$ we have $|L_n| > 0$. Note that by midpoint-convexity we have $\frac{1}{2}(L_n + L_n) \subset L_n$. By the classical result $\frac{1}{2}(L_n + L_n)$ contains some interval. Thus, $f < n$ on some $I \subset (a, b)$. For simplicity let us assume that $n = 0$ (this can be done by considering $g = f -n$). Now for some time we will only work on $I$ and not on the whole $(a, b)$. 
Let $x\in I$. Let us prove that $f$ is continuous in $x$. Let $n$ be some natural number. It is easy to prove by induction that $\frac{1}{2^n}f(w) + \frac{2^n - 1}{2^n}f(z) \ge f(\frac{1}{2^n}w + \frac{2^n - 1}{2^n}z)$ for all $w, z\in I$. If we assume that $z = x$ and $\frac{1}{2^n}w + \frac{2^n - 1}{2^n}z = y$ so close to $x$ that $w$ is also in $I$ then we have 
$$ \frac{2^n - 1}{2^n} f(x) > \frac{1}{2^n}f(w) + \frac{2^n - 1}{2^n}f(z) \ge f(y).$$
On the other hand if we put $z = y$ and $\frac{1}{2^n}w + \frac{2^n - 1}{2^n}z = y$ (again we assume that $y$ is so close to $x$ that $w\in I$) we get $\frac{2^n - 1}{2^n}f(y) > f(x)$. From these two facts we get that $f$ is continuous in $x$ by letting $n$ go to infinity. Since $x$ is arbitrary we have that $f$ is continuous on $I$.
Let $(c, d)$ be the biggest interval containing $I$ on which $f$ is continuous and assume that $(c, d) \subsetneq (a, b)$, for example $d < b$. Let $[r, s]\subset (c, d)$ be any interval (so that $f$ is bounded on $[r, s]$ by some constant $M$). It is easy to see that we can get any point $w \in [s, \frac{b+d}{2}]$ as linear combination of some point from $[r, s]$ and $\frac{b+d}{2}$ with weights which are dyadic rationals. From this it is easy to see that $f(w) \le \max(M, f(\frac{d+b}{2}))$. So $f$ is bounded on $[r, s]$ and on $[s, \frac{b+d}{2}]$ and so it is bounded on $[r, \frac{b+d}{2}]$. repeating argument from the beginning of this post we get that $f$ is continuous on $(r, \frac{b+d}{2})$ and this contradicts maximality of $(c, d)$. Thus $f$ is continuous on $(a, b)$ and we are done.
