  We investigate the ghostfree scalar-tensor theory with a timelike scalar
field, with derivatives of the scalar field up to the third order and with the
Riemann tensor up to the quadratic order. We build two types of linear spaces.
One is the set of linearly independent generally covariant scalar-tensor
monomials, the other is the set of linearly independent spatially covariant
gravity monomials. We argue that these two types of linear space are isomorphic
to each other in the sense of gauge fixing/recovering procedures. We then
identify the subspaces in the spatially covariant gravity, which are spanned by
linearly independent monomials built of the extrinsic and intrinsic curvature,
the lapse function as well as their spatial derivatives, up to the fourth order
in the total number of derivatives. The vectors in these subspaces, i.e.,
spatially covariant polynomials, automatically propagate at most three degrees
of freedom. As a result, their images under the gauge recovering mappings are
automatically the subspaces of scalar-tensor theory that propagate up to three
degrees of freedom as long as the scalar field is timelike. The mappings from
the spaces of spatially covariant gravity to the spaces of scalar-tensor theory
are encoded in the projection matrices, of which we also derived the
expressions explicitly. Our formalism and results can be useful in deriving the
generally covariant higher derivative scalar-tensor theory without ghost(s).
