A caracterization of convexity in $\mathbb R^n$ 
Let $C$ be a closed subset of $\mathbb R^n$ such that $$\forall x,y \in C, (x,y)\cap C \neq \emptyset$$ where $(x,y)=\{(1-t)x+ty, t\in (0,1)\}$
Prove that C is convex

A quick drawing shows that a concave set cannot satisfy this property (take $2$ points on the boundary such that the line segment between them doesn't intersect $C$).
In order to prove that $C$ is convex, I considered two points $x$,$y$, an arbitrary $\lambda\in (0,1)$ and I attempted to prove that $(1-\lambda)x+\lambda y\in C$. Since $C$ is closed it is enough to build a sequence $t_n$ such that $\forall n, (1-t_n)x+t_n y\in C $ and $t_n \to \lambda $. To achieve this, a natural path is to use some sort of dichotomy: there's some $t_1$ such that $(1-t_1)x+t_1y \in C$. If $t_1 \geq \lambda$, apply the property again with points $x$ and $(1-t_1)x+t_1y$, otherwise apply the property with points $y$ and $(1-t_1)x+t_1y$. How can I prove that $t_n \to \lambda$ ?
 A: Let $x,y\in C$, and let $\lambda\in(0,1)$. Define the sets
$$A=\bigl\{t\in[0,\lambda]\;\bigm\vert\;tx+(1-t)y\in C\bigr\}$$
and
$$B=\bigl\{t\in[\lambda,1]\;\bigm\vert\;tx+(1-t)y\in C\bigr\}$$
Since $C$ is closed, it is easily seen that $A$ and $B$ are closed too (and of course $A$ and $B$ are not empty since $0\in A$ and $1\in B$).
Since $A$ and $B$ are non empty, closed, and bounded, their respective $\min$ and $\max$ exist; denote them by $\alpha$ and $\beta$:
$$\alpha=\max A,\qquad\text{and}\qquad\beta=\min B.$$
We now proceed by contradiction: assume that $\alpha\neq\lambda$ and $\beta\neq\lambda$. Define:
$$x_\alpha=\alpha x+(1-\alpha)y\qquad\text{and}\qquad y_\beta=\beta x+(1-\beta)y.$$
By definition of $A$, $B$, $\alpha$ and $\beta$, we know that
$$x_\alpha,y_\beta\in C,$$
hence there exists $t\in(0,1)$ such that
$$tx_\alpha+(1-t)y_\beta\in C,$$
i.e.,
$$\bigl(t\alpha+(1-t)\beta\bigr)x+\bigl(1-t\alpha-(1-t)\beta\bigr)y\in C.$$
Now, since $\alpha<\beta$ and $t\in(0,1)$, we have
$$\alpha<t\alpha+(1-t)\beta<\beta,$$
but since
$$t\alpha+(1-t)\beta\in A\cup B,$$
we must have either:


*

*$t\alpha+(1-t)\beta\in A$ but this is impossible since $\alpha=\max A$ or

*$t\alpha+(1-t)\beta\in B$ but this is impossible since $\beta=\min A$.


Hence, our assumption $\alpha\neq\lambda$ and $\beta\neq\lambda$ is wrong, hence either $\alpha=\lambda$ or $\beta=\lambda$, hence $\lambda\in A\cup B$, and we conclude that $\lambda x+(1-\lambda)y\in C$.
A: I doubt you can, your $t_n$ may converge to any $t<\lambda$. You have to make an extremal choice in my opinion. In your construction, instead of choosing some $t_n$, choose the largest $t<\lambda$ (smallest $s>\lambda$) with this property. This is a $\sup$ or $\inf$, but since $C$ is assumed to be closed, it's easy to see that the $\sup (\inf)$ is attained. If then neither $t=\lambda$ nor $s=\lambda$ (nor $t=1$ or $s=0$) repeat with $s$ and $t$ to arrive at a contradiction to the choise as largest resp. smallest such number.
