  The Lovelock Lagrangian is for even dimension D obtained from Weil
polynomials on the Lie algebra of the Lorentz group SO(1,D-1). The procedure
for generating it is related to the Weil homomorphism that converts Lie algebra
invariants into cohomology classes.
