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, http://math.stackexchange.com/questions/145788/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". My question is, how far can this idea be generalized? 

>**Hypothesis:** 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." Note the connectedness condition has to come into play somewhere - consider two disjoint sphere sitting in space.

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.. In the general case I'm not so sure.