Exact solutions of polynomial programs through quadratic convex reformulations: theory and applications