It has been shown countless times on this forum that a local minimizer of a convex function is also a global minimizer.
However, I'm wondering if this can be an iif. Basically, can we say the sufficient condition: if all local minimizers of function are also global minimizers then f is convex. I have a feeling this is not true (e.g. sin(x), all local minimizers are also global) but I'm not sure if my intuition is right.
Also, how to formalize that is is false?
Your intuition is right, and your $\sin x$ example is good enough as a case that contradicts the claim. To formally prove, you need to show that
If you want a 'simpler' example, you could use $$\int x(x-1)(x+1)dx = \frac{x^4}{4} - \frac{x^2}{2} + c$$