  This paper introduces and develops the algebraic framework of moment
polynomials, which are polynomial expressions in commuting variables and their
formal mixed moments. Their positivity and optimization over probability
measures supported on semialgebraic sets and subject to moment polynomial
constraints is investigated. A positive solution to Hilbert's 17th problem for
pseudo-moments is given. On the other hand, moment polynomials positive on
actual measures are shown to be sums of squares and formal moments of squares
up to arbitrarily small perturbation of their coefficients. When only measures
supported on a bounded semialgebraic set are considered, a stronger algebraic
certificate for moment polynomial positivity is derived. This result gives rise
to a converging hierarchy of semidefinite programs for moment polynomial
optimization. Finally, as an application, two open nonlinear Bell inequalities
from quantum physics are settled.
