  We lay down the foundations of the theory of Poisson vertex algebras aimed at
its applications to integrability of Hamiltonian partial differential
equations. Such an equation is called integrable if it can be included in an
infinite hierarchy of compatible Hamiltonian equations, which admit an infinite
sequence of linearly independent integrals of motion in involution. The
construction of a hierarchy and its integrals of motion is achieved by making
use of the so called Lenard scheme. We find simple conditions which guarantee
that the scheme produces an infinite sequence of closed 1-forms \omega_j, j in
Z_+, of the variational complex \Omega. If these forms are exact, i.e. \omega_j
are variational derivatives of some local functionals \int h_j, then the latter
are integrals of motion in involution of the hierarchy formed by the
corresponding Hamiltonian vector fields. We show that the complex \Omega is
exact, provided that the algebra of functions V is "normal"; in particular, for
arbitrary V, any closed form in \Omega becomes exact if we add to V a finite
number of antiderivatives. We demonstrate on the examples of KdV, HD and CNW
hierarchies how the Lenard scheme works. We also discover a new integrable
hierarchy, which we call the CNW hierarchy of HD type. Developing the ideas of
Dorfman, we extend the Lenard scheme to arbitrary Dirac structures, and
demonstrate its applicability on the examples of the NLS, pKdV and KN
hierarchies.
