  We propose a step-by-step manual for the construction of alternative theories
of gravity, perturbatively as well as nonperturbatively. The construction is
guided by no more than two fundamental principles that we impose on the
gravitational dynamics: invariance under spacetime diffeomorphisms and causal
compatibility with given matter dynamics, provided that spacetime is
additionally endowed with matter fields. The developed framework then guides
the computation of the most general, alternative theory of gravity that is
consistent with the two fundamental requirements. Utilizing this framework we
recover the cosmological sector of general relativity solely from assuming that
spacetime is a spatially homogeneous and isotropic metric manifold. On top of
that, we explicitly test the perturbative framework by deriving the most
general third-order expansion of a metric theory of gravity that is causally
compatible with a Klein-Gordon scalar field. Thereby we recover the
perturbative expansion of general relativity. To demonstrate how new physics
emerges from our approach, we finally construct the most comprehensive
third-order expansion of a theory of gravity that supports general (not
necessarily Maxwellian) linear electrodynamics.
