  Using the background field method and the Batalin-Vilkovisky formalism, we
prove a key theorem on the cohomology of perturbatively local functionals of
arbitrary ghost numbers, in renormalizable and nonrenormalizable quantum field
theories whose gauge symmetries are general covariance, local Lorentz symmetry,
non-Abelian Yang-Mills symmetries and Abelian gauge symmetries. Interpolating
between the background field approach and the usual, nonbackground approach by
means of a canonical transformation, we take advantage of the properties of
both approaches and prove that a closed functional is the sum of an exact
functional plus a functional that depends only on the physical fields and
possibly the ghosts. The assumptions of the theorem are the mathematical
versions of general properties that characterize the counterterms and the local
contributions to the potential anomalies. This makes the outcome a theorem on
the cohomology of renormalization, rather than the whole local cohomology. The
result supersedes numerous involved arguments that are available in the
literature.
