  Lovelock terms are polynomial scalar densities in the Riemann curvature
tensor that have the remarkable property that their Euler-Lagrange derivatives
contain derivatives of the metric of order not higher than two (while generic
polynomial scalar densities lead to Euler-Lagrange derivatives with derivatives
of the metric of order four). A characteristic feature of Lovelock terms is
that their first nonvanishing term in the expansion of the metric around flat
space is a total derivative. In this paper, we investigate generalized Lovelock
terms defined as polynomial scalar densities in the Riemann curvature tensor
and its covariant derivatives (of arbitrarily high but finite order) such that
their first nonvanishing term in the expansion of the metric around flat space
is a total derivative. This is done by reformulating the problem as a BRST
cohomological one and by using cohomological tools. We determine all the
generalized Lovelock terms. We find, in fact, that the class of nontrivial
generalized Lovelock terms contains only the usual ones. Allowing covariant
derivatives of the Riemann tensor does not lead to new structure. Our work
provides a novel algebraic understanding of the Lovelock terms in the context
of BRST cohomology.
