We discuss the criteria that must be satisfied by a well-posed variational
principle. We clarify the role of Gibbons-Hawking-York type boundary terms in
the actions of higher derivative models of gravity, such as F(R) gravity, and
argue that the correct boundary terms are the naive ones obtained though the
correspondence with scalar-tensor theory, despite the fact that variations of
normal derivatives of the metric must be fixed on the boundary. We show in the
case of F(R) gravity that these boundary terms reproduce the correct ADM energy
in the hamiltonian formalism, and the correct entropy for black holes in the
semi-classical approximation.Comment: 54 pages, 2 figures. Several typos corrected, references added.
Version appearing in PR