Question:
Under what circumstances does local convexity imply global convexity?
Motivation:
Classically, a twice differentiable function $f:\mathbb{R} \rightarrow \mathbb{R}$ is convex if and only if the second derivative is nonnegative everywhere. In this recent question, Derivative of Convex Functional, it's shown that the same result holds for twice Frechet differentiable functionals on Banach spaces, $f:X\rightarrow \mathbb{R}$.
In both these cases, we have a result saying something to the effect of: "local convexity implies global convexity". How far can this idea be generalized?
The following hypothesis, which may or may not be true, expresses the idea in the most general context I can think of.
Conjecture: Let $C$ be a connected subset of a topological vector space, and let $\{ U_\alpha \}_{\alpha \in A}$ be an open cover of the boundary $\partial C$. If $U_\alpha \cap C$ is convex for all $\alpha \in A$, then $C$ is convex.
Informally, "Inspect the boundary of a connected set with a (variable-size) magnifying glass. If, everywhere you look, it looks convex, then the set is globally convex."
Example: $C$ is a square in $\mathbb{R}^2$, and $U_\alpha=B_i$ are balls covering all 4 edges and corners.
Non-example: $C$ is two disjoint disks in $\mathbb{R}^2$.
From this we see that there is a topological element to the question - if the connectedness condition is relaxed, it's easy to come up with counterexamples.
Notes:
I've linked the key terms to the wiki pages. Is this good style on M.SE? Most people who could answer the question would already know the definition. On the other hand, when I'm answering a question that's not immediately obvious, a lot of times I'll open up the wiki page and look around even if I already know the definition.
A special case I've been considering is where the space is Banach, and the set's boundary is path connected and compact. In this case I think it's true but the proof is elusive so far..
In the comments Chris Eagle suggests reducing it to a 2D problem. I'm not sure exactly how this works and if it will generalize to spaces other than $\mathbb{R}^n$.
In the comments Cardinal notes that it is trivally false in the discrete topology - the boundary of any set can be covered by open points.Joriki points out that this isn't a problem since all nontrivial sets of interest are not connected in the discrete topology.George Lowther notes that the conjecture is false in $\mathbb{R}^2$ unless a further constraint is added that the set is either closed or open. The open unit square unioned with it's vertices is locally convex, but does not contain it's edges so is not globally convex.