Does local convexity imply global convexity?
We suppose that $X$ is a locally convex vector space. Before showing that the conjecture is true (under some conditions), we show a helpful lemma.
Lemma. If a subset $C$ of $X$ has the property that it's boundary can be covered by an open cover $\{U_\alpha\}_{\alpha\in A}$ with the property that each $U_\alpha\cap C$ is convex, then the triangle $$ \Delta(x,y,z):=\{(1-t)((1-s)x+sy)+tz:s,t\in[0,1)\} $$ is contained in $C$ whenever the lines $\ell_{x,y}:=\{(1-s)x+sy:s\in[0,1]\}$ and $\ell_{x,z}:=\{(1-t)x+tz:t\in[0,1]\}$ are contained in $C$.
Proof. Suppose that $\Delta(x,y,z)$ is not contained in $C$. In the following, the boundary and interior are considered relative to the triangle $\Delta(x,y,z)$.
Among $s\in[0,1)$ with the property that the line $$ \{(1-t)((1-s)x+sy)+tz:t\in[0,1)\}\cap \partial(C\cap\Delta(x,y,z))\neq\varnothing $$ there is a minimum $s_0$. Then there is also a minimum $t_0$ among the $t\in[0,1)$ with the property that $$ u:=(1-t)((1-s_0)x+s_0y)+tz:t\in\partial(C\cap\Delta(x,y,z)) $$ Since $u$ is on the boundary of $C$, there exists an $\alpha\in A$ with the property that $u\in U_\alpha$. Then $U_\alpha\cap C\cap\Delta(x,y,z)$ is convex. But note that the set $$ \ell_{x,y}\cup\ell_{x,z}\cup\Delta(x,(1-s_0)x+s_0y,z), $$ where the latter triangle has a similar definition as $\Delta(x,y,z)$, is contained in $C$. The convexity of $U_\alpha\cap C\cap\Delta(x,y,z)$ then implies that there is a $\varepsilon>0$ such that the point $$ (1-(t_0-\varepsilon))((1-s_0)x+s_0y)+(t_0-\varepsilon)z $$ is on the boundary of $C\cap\Delta(x,y,z)$ unless $t_0=0$. The minimality of $t_0$ then gives us that $t_0=0$. A similar argument shows that $s_0=0$ and it follows once again from the convexity of the boundary of $C$ that $x,y,z$ are on a line. But then $\Delta(x,y,z)$ is (contained in) this line. QED.
We have the following corollary (in the open case, an easy adjustment of the above proof has to be given).
Corollary. If $X$ is either open or closed, the triangle $$ \overline{\Delta(x,y,z)}=\{(1-t)((1-s)x+sy)+tz:s,t\in[0,1]\} $$ is contained in $C$.
Now we are ready to answer positive to the conjecture in the case that $C$ is open or closed.
Proposition. Suppose that $X$ is a locally convex vector space and suppose that $C$ is a closed [open] subset of $X$. If there exists a cover $\{U_\alpha\}_{\alpha\in A}$ of $\partial C$ with the property that $U_\alpha\cap C$ is convex for each $\alpha\in A$, then $C$ is convex.
Proof. Suppose $C$ is a subset of a locally convex vector space $X$ and that $\{U_\alpha\}_{\alpha\in A}$ is a cover of the boundary of $C$ with the property that $U_\alpha\cap C$ is convex for each $\alpha\in A$.
First, let $B$ be a maximal among the subsets of $A$ with the property that the convex hull of $\bigcup_{\alpha\in B}U_\alpha$ is contained in $C$. For example, such a maximal $B$ can be found with Zorn's lemma, using the poset $$ P:=\big\{B\subseteq A:\mathrm{Hull}\big(\textstyle\bigcup_{\alpha\in B}U_\alpha\cap C\big)\subseteq C\big\} $$ ordered with inclusion. Here, $\mathrm{Hull}$ denotes the operation of taking the convex hull.
Now let $C^\prime$ be a maximal convex subset of $C$ which contains $U_\alpha$ for each $\alpha\in B$. Here's an outline of the rest of the proof.
- First we will show that if for $\alpha\in A$ there is a $\beta\in B$ such that $U_\alpha\cap U_\beta\cap C\neq\varnothing$, then $\alpha$ is in $B$.
- Then we will show that no boundary points of $C^\prime$ are interior points of $C$. (Here we will use the assumption that $X$ is locally convex.)
With these two observations the proof is easily finished. Since boundary points of $C^\prime$ are boundary points of $C$, it follows that $C^\prime$ is closed in $C$. The set $$ U:=\textstyle\bigcup_{\alpha\in B} U_\alpha\cup\mathrm{int}\,C^\prime $$ is an open set with the property that $x\in C^\prime$ whenever $x\in U\cap C$, therefore $C^\prime$ is also open in $C$. The connectedness of $C$ together with the non-emptiness of $C^\prime$ (whenever $C$ is non-empty) now implies that $C^\prime= C$.
Proof of 1. Suppose that $x\in U_\alpha\cap U_\beta\cap C$. Note that for any $y\in U_\alpha$, for any $\gamma\in B$ and for any $z\in U_\gamma$, the line $$ \ell_{y,z}:=\{(1-t)y+tz:t\in[0,1]\} $$ is contained in $C$, which is a consequence of the corollary because the we have $\ell_{x,y}\subseteq U_\alpha\cap C\subseteq C$ and $\ell_{x,z}\subseteq C^\prime\subseteq C$. By the maximality of $B$, it follows that $\alpha\in B$.
Proof of 2. Suppose that $x^\prime$ is in $\partial C^\prime\cap\mathrm{int}\,C$. Let $V$ be a convex open neighborhood of $x^\prime$ which is contained in $C$, let $y$ be a point of $V\setminus \bar{C^\prime}$ and let $x$ be a point of $V\cap C^\prime$. It follows by the corollary that for every $z\in C^\prime$ the line $\ell_{y,z}$ is contained in $C$, since the lines $\ell_{x,y}$ and $\ell_{x,z}$ are. Therefore, $C^\prime$ can be extended to include $y$, which contradicts the maximality of $C^\prime$. Thus we may conclude that no boundary points of $C^\prime$ are interior points of $C$. QED.
There is a classical result known as the Tietze-Nakajima Theorem which more or less answers this question (at least in finite dimensional vector spaces).
Theorem If $X$ is a closed, connected and locally convex subset of $\mathbb{R}^n$ then $X$ is convex.
Here locally convex means exactly what you proposed in your post: for every $x\in X$ there is a ball $B_{\varepsilon}(x)$ centered at $x$ such that $B_{\varepsilon}(x)\cap X $ is convex in the usual sense. As you've noted, the definition is only important for points that are not in the interior of the set.
The proof is given an extremely nice exposition in Section 2 of the paper Revisiting Tietze-Nakajima: Local and Global Convexity of Maps (which also contains a nice generalization of your conjecture, as the title suggests). I recommend reading about it there (if you are still interested): http://www.utm.utoronto.ca/~karshony/papers/convexity-corrected2.pdf
The original papers are:
H. Tietze. “Uber Konvexheit im kleinen und im großen und ¨uber gewisse ¨ den Punkter einer Menge zugeordete Dimensionszahlen." Math. Z. 28 (1928) 697–707.
S. Nakajima, “Uber konvexe Kurven and Flaschen”, Tohoku Mathematical ¨ Journal, vol. 29 (1928), 227–230.
Edit: I've decided to add a sketch of the proof here:
- Observe that if the set $X$ is also compact then it is uniformly locally convex (the balls can all be chosen with the same radius).
- Define the distance $d_X(x,y)$ between two points $x,y\in X$ to be the infimum of the lengths of paths from $x$ to $y$ in $X$.
- For any two points $x_0,x_1\in X$ there exists a midpoint $x_{1/2}$, half the distance between $x_0$ and $x_1$ (this uses closedness of the set).
- Now take any two points $x_0,x_1\in X$ and iteratively find midpoints until you have a sequence $x_0, x_{1/2^j},\ldots ,x_{1-1/2^j},x_1$ of points so that the distance between each in $X$ is $d_X(x_0,x_1)/2^j$.
- If we intersect $X$ with a large closed ball $\overline{B}$ that contains all these points (give it radius $2d_X(x_0,x_1)$, for example), then by uniform local convexity of $Y = X\cap \overline{B}$, there is some fixed $\varepsilon$ such that $B_{\varepsilon}(y)\cap Y$ is convex, for all $y\in Y$.
- Let $j$ be large enough that $$x_{k/2^j-1/2^j},x_{k/2^j+1/2^j}\in B_{\varepsilon}(x_{k/2^j})$$ for all $k$. By local convexity, this says every three consecutive points in the sequence are contained in a line segment in $X$. So the line segment $[x_0,x_1]$ is contained in $X$.
Edit: An infinite dimensional local to global convexity result is proven in P. Birtea, J-P. Ortega, and T. S. Ratiu, “Openness and convexity for momentum maps”, Trans. Amer. Math. Soc. 361 (2009), no. 2, 603–630
I'm really afraid of giving a negative answer to this claim, after seeing above huge proofs by users (and their up-voted scores ) !
Maybe I am not right, but just in $R^2$ take open upper half space union two distinct points on $X-$axis. This set satisfies the conditions of your conjecture but it is not convex!