If for each $x,y \in A$ , $\frac{x}{2} + \frac{y}{2} \in A$ and $A$ is closed set then $A$ is convex. If for each $x,y \in A$ ,   $\frac{x}{2} + \frac{y}{2} \in A$ and $A$ is closed set then $A$ is convex. How to prove? 
For a example of non convex set which is not closed and holds the condition is the set of rational numbers of $[0,1]$ segment.
 A: Proof sketch: You want to show that $\lambda x +(1-\lambda)y\in A$ for all $x,y\in A$ and $0\le \lambda \le 1$. The condition gives that to you for $\lambda = 1/2$. By repeatedly applying the case $\lambda = 1/2$ you get that the convexity condition holds for certain diadic $\lambda$. From that you get the general convexity condition by continuity (which is where you will utilize the fact that $A$ is closed). 
A: First, prove by induction that for all positive $n$, 
$$\frac{a}{2^n}x + \left(1-\frac{a}{2^n}\right)y\in A, \qquad a \in \mathbb{Z},  0\leq a \leq 2^n $$
Now consider the function $f:[0,1]\to \mathbb{R^n}$, $f(\alpha)=\alpha x + (1-\alpha)y$. Clearly $f$ is continuous, so the inverse image of the complement of $A$ is open. Suppose for contradiction that it is nonempty; then it contains some open interval $(c,d)\subset [0,1]$. There exists a dyadic rational in that interval (for instance, truncate the binary decimal of $d$ after the first digit where it differs from that of $c$), a contradiction by the above lemma.
