Mid-point convex measurable subset of $\mathbb{R}$ with positive Lebesgue measure is an interval The question is right as the title:

Let $E$ be a measurable subset of $\mathbb{R}$ w.r.t. Lebesgue measure, and has positive measure. For any $x,y\in E$, $\frac{x+y}{2}\in E$. Prove that $E$ is an interval(like $[a,b],[a,b),(a,b)$ etc., possibly infinity endpoint).

The hint is to find some function on it, and I tried looking at its characteristic function, but I have no clue.
 A: Since you already know that $E$ contains an interval, it will suffice to prove the following.
Lemma. If a subset $E$ of $\mathbb R$ is "midpoint-convex" and has nonempty interior, then $E$ is an interval.
Proof. Let $I$ be a maximal interval contained in $E$, and assume for a contradiction that $E\ne I$. Then there is a point $a\in E$ such that $a\lt\inf I$ or $a\gt\sup I$; without loss of generality we assume that $a\lt c=\inf I$. Choose $d\in I$ so that $c\lt d$; then $(c,d)\subseteq E$.
By repeated application of midpoint-convexity, we can find points in $E\cap(a,c)$ which are arbitrarily close to $c$. Choose a point $e\in E\cap(a,c)$ which is closer to $c$ than $c$ is to $d$.
Since $e\in E$ and $(c,d)\subseteq E$, it follows by midpoint-convexity that $\left(\frac{e+c}2,\frac{e+d}2\right)\subseteq E$. Since $\frac{a+c}2\lt c\lt\frac{a+d}2$, it follows that the set
$$J=\left(\frac{e+c}2,\frac{e+d}2\right)\cup I$$
is an interval. Since $I\subsetneqq J\subseteq E$, this contradicts the maximality of $I$.
A: I am assuming that you have proved that $E$ contains an interval.
Start by using induction to prove that for every $x$ and $y$ in $E$ $$\left(1-\frac k{2^n}\right)x + \frac{k}{2^n} y\in E, \quad \forall n\in \mathbb N, 0\le k\le 2^{n}.$$ Let $z$ be an element of $E$ such $\left]z-\epsilon,z+\epsilon\right[\subset E$. You can prove easily (by induction) that for every $x\in E$ $$\left]\left(1-\frac k{2^n}\right)z + \frac{k}{2^n} z-\epsilon, \left(1-\frac k{2^n}\right)z + \frac{k}{2^n}x +\epsilon\right[\subset E, \quad \forall n\in \mathbb N, 0\le k < 2^{n}.$$
Finally let $n\in\mathbb N$ such that $\frac1{2^n} \le \epsilon$ so \begin{align}
[z,x] \subset \bigcup_{k=0}^{2^{n}-1}\left]\left(1-\frac k{2^n}\right)z + \frac{k}{2^n} z-\epsilon, \left(1-\frac k{2^n}\right)z + \frac{k}{2^n}x +\epsilon\right[\subset E
\end{align}
Can you continue from here?
