Considering a constrained nonlinear programming (NLP) problem

$\displaystyle min \quad f({\bf x}) \quad {\bf x}\in \mathbb{R}^{n} $

$\displaystyle s.t. \quad g_{i}({\bf x})\leq 0 \quad i=1,2,...,N $

$\displaystyle \quad\quad\quad\quad h_{j}({\bf x})=0 \quad j=1,2,...,M $

Where $\displaystyle g_{i}({\bf x})$ and $\displaystyle h_{j}({\bf x})$ is twice continuously differentiable. The feasible region $\displaystyle S=\{{\bf x}|g_{i}({\bf x}),h_{j}({\bf x}),\forall i,j\}$. It is known that if $\displaystyle g_{i}({\bf x})$ is convex and $\displaystyle h_{j}({\bf x})$ is affinely linear for $\displaystyle {\bf x}\in \mathbb{R}^{n}$, $\displaystyle S$ is a convex set. However, in my problem, $\displaystyle g_{i}({\bf x})$ and $\displaystyle h_{j}({\bf x})$ is indefinite for $\displaystyle {\bf x}\in \mathbb{R}^{n}$. So I would like to ask if there is any theory may answer the following two questions:

(1)For any twice continuously differentiable but indefinite function $\displaystyle g_{i}({\bf x})$, on what condition, $\displaystyle g_{i}({\bf x})$ is convex in a neighborhood of a point $\displaystyle {\bf x_{0}}\in\mathbb{R}^{n}$ ? (A guess is that Hessian of $\displaystyle g_{i}$ at $\displaystyle {\bf x_{0}}$ is positive semidefinite. Is that the case?)

Just like the image above. The function is indefinite for all $\displaystyle x$, but is locally convex in the neighborhood of $\displaystyle x_{0}$, which is $\displaystyle (x_{1},x_{2})$.

(2)On what condition, a neighborhood in $\displaystyle S$ of a feasible point $\displaystyle {\bf x_{0}}\in S$ is a convex set? (I suppose a sufficient condition is that every $\displaystyle g_{i}({\bf x})$ and $\displaystyle h_{j}({\bf x})$ is convex in a neighborhood of $\displaystyle {\bf x_{0}}$. But is that necessary?)

Just like the image above. The set $\displaystyle S$ is not convex, but is locally convex in the neighborhood of $\displaystyle {\bf x_{0}}$ (the red triangle set).