I would like to prove the following statement.
A nonempty subset $E$ of $\mathbb{R}$ is an interval "if and only if" $x$, $y$ $\in E$ and $x<z<y$ imply $z$ $\in$ $E$.
Proof of one direction: Let $E$ be a nonempty subset of $\mathbb{R}$. Suppose $E$ is an interval. By way of contradiction, suppose $x$, $y$ $\in$ $E$ and $x<z<y$, but $z$ $\notin$ $E$. Since $E$ is an interval and $x$, $y$ $\in$ $E$, $[x,y]$ $\subset$ $E$. Moreover, since $x<z<y$, $z$ $\in$ $[x,y]$. Thus, $z$ $\in$ $E$, which is a contradiction.
Is the above proof correct? In addition, I cannot prove the opposite direction. Could anyone help me with this?