1 Introduction

The Friedmann–Lemaitre–Robertson–Walker (FLRW) metric is the most known and most studied metric in General Relativity (GR). FLRW metric is mainly used to describe the universe as a homogeneous isotropic fluid distribution [1,2,3,4,5]. For inhomogeneous cosmological solutions, see for example [6,7,8]. On the other hand, current cosmological observations indicate that our universe is undergoing an accelerating expansion phase. The origin of this accelerating expansion still remains an open question in cosmology. Several approaches for explaining the current accelerated expanding phase have been proposed in the literature such as introducing cosmological constant [9], dynamical dark energy models and modified theories of gravity [10,11,12,13]. Amongst the latter, higher order curvature corrections to Einstein’s field equations have been considered by several authors [14,15,16,17]. In the context of modified theories, some attempts for a geometric interpretation of the dark side of the universe as a perfect fluid have been done [18,19,20,21,22,23] but the picture is not complete yet. In this work, we put one step forward to prove that the perfect fluid from of the dark component of the Universe is true for any generic modified theory of gravity. A generic gravity theory derivable from a variational principle can be given by the action

$$\begin{aligned} I= & {} \int \, d^{D}\,x\, \sqrt{-g}\,\Bigg (\frac{1}{\kappa } \left( R-2\Lambda \right) \nonumber \\&+ {\mathcal {F}}(g,\,\text{ Riem },\,\nabla \text{ Riem },\, \nabla \nabla \text{ Riem }, \cdots )+ {\mathcal {L}}_{M} \Bigg ), \end{aligned}$$
(1)

where g, \(\text{ Riem }\), \(\nabla \text{ Riem }\), \(\nabla \nabla \text{ Riem }\), etc in \({\mathcal {F}}\) denote the spacetime metric, Riemann tensor and its covariant derivatives at any order, respectively, and \({\mathcal {L}}_M\) is the Lagrangian of the matter fields. The function \({\mathcal {F}}(g,\,\text{ Riem },\,\nabla \text{ Riem },\, \nabla \nabla \text{ Riem }, \cdots ) \) is the part of the Lagrange function corresponding to higher order couplings, constructed from the metric, the Riemann tensor and its covariant derivatives. The corresponding field equations are

$$\begin{aligned} \frac{1}{\kappa }\left( G_{\mu \nu } +\Lambda g_{\mu \nu } \right) + {\mathcal {E}}_{\mu \nu }=T_{\mu \nu }. \end{aligned}$$
(2)

Here \({\mathcal {E}}_{\mu \nu }\) is a symmetric divergent free tensor obtained from the variation of \({\mathcal {F}}(g,\, \text{ Riem },\,\nabla \text{ Riem },\, \nabla \nabla \text{ Riem }, \cdots )\) with respect to the spacetime metric \(g_{\mu \nu }\). Our treatment, in this work, is to consider this tensor, \({\mathcal {E}}_{\mu \nu }\), as any second rank tensor obtained from the Riemann tensor and its covariant derivatives at any order. Since the Ricci tensor \(R_{\mu \nu }\) and Ricci scalar R are obtainable from the Riemann tensor we did not consider the function \({\mathcal {F}}\) depending on explicitly on the Ricci tensor and Ricci scalar. There are some works showed recently that the tensor \({\mathcal {E}}_{\mu \nu }\) takes the perfect fluid form for the FLRW spacetimes when the function \({\mathcal {F}}\) depends only the Ricci and the Gauss–Bonnet scalars R and \({\mathcal {G}}\) respectively [18, 19], as well as the Ricci scalar R and \(\square R\) of any order [20]. In the present work, we prove that the tensor \({\mathcal {E}}_{\mu \nu }\) takes the perfect fluid form for any generic modified gravity theory in the FLRW spacetimes in arbitrary dimensions. We then apply our result to two special cases \({\mathcal {F}}(R,{\mathcal {G}})\) and Lovelock theory in any dimension D.

The organization of the paper is as follows. In Sect. 2, we give the covariant description of D-dimensional FLRW metric and derive all the corresponding geometrical quantities. In Sect. 3, we introduce the closed FLRW-tensor algebra by proving that all the geometrical quantities for FLRW spacetimes, the curvature tensor and it’s covariant derivatives at any order, are expressed in terms of the metric tensor \(g_{\mu \nu }\) and the product \(u_{\mu } u_{\nu }\) where \(u_{\mu }\) is the unit timelike tangent vector of the timelike geodesic. By using this property, i.e., the existence of a closed tensor algebra, we prove a theorem on the field equations of generic gravity theories. In Sects. 4 and 5, we use the proved theorem to write the field equations of Lovelock and \({\mathcal {F}}(R, {\mathcal {G}})\) theories, respectively. Section 6 is devoted to our concluding remarks.

2 Covariant description of the FLRW spacetimes in D-dimensions

We begin with the definition of the D-dimensional FLRW spacetimes.

Definition 1

The D-dimensional FLRW spacetime is defined with the following metric

$$\begin{aligned} g_{\mu \nu }=-u_\mu \, u_\nu +a^2\,h_{\mu \nu }, \end{aligned}$$
(3)

where \(x^{\mu }=(t, x^{i})\), \(\mu ,\,\nu =0,\ldots ,D-1\), \(a=a(t),~u_\mu =\delta ^0_\mu \), and \(h_{\mu \nu }\) reads as

$$\begin{aligned} h_{\mu \nu }=\begin{pmatrix} 0 &{} 0 &{} \ldots &{} 0 \\ 0 &{} &{} &{} \\ \vdots &{} &{} h_{ij} &{} \\ 0 &{} &{} &{} \\ \end{pmatrix}, \end{aligned}$$
(4)

where \(h_{ij}=h_{ij}(x^{a})\) with \(i,j=1,\ldots ,D-1\) is the metric of a space of constant curvature k.

One can verify

$$\begin{aligned}&u^\mu \,h_{\mu \nu }=u_\mu \, h^{\mu \nu }=0,\nonumber \\&h^{\mu }_{\alpha }= h^{\mu \alpha }\,h_{\alpha \nu }=\delta ^{\mu }_{\nu } +u^\mu \,u_\nu . \end{aligned}$$
(5)

The corresponding Christoffel symbols to the metric (3) can be obtained as

$$\begin{aligned} \Gamma ^\mu _{\alpha \beta }=\gamma ^\mu _{\alpha \beta }-a\,\dot{a}\, u^\mu \, h_{\alpha \beta }+H\,\left( 2u_\alpha \, u^\mu \, u_\beta +u_\beta \, \delta ^\mu _\alpha +u_\alpha \, \delta ^\mu _\beta \right) ,\nonumber \\ \end{aligned}$$
(6)

where the dot sign represents the derivative with respect to time t, \(H=\dot{a}/a\) is the Hubble parameter and \(\gamma ^\mu _{\alpha \beta }\) is defined as

$$\begin{aligned} \gamma ^\mu _{\alpha \beta }=\frac{1}{2}a^2\, h^{\mu \gamma }\,\left( h_{\gamma \alpha ,\beta }+h_{\gamma \beta ,\alpha } -h_{\alpha \beta ,\gamma } \right) . \end{aligned}$$
(7)

One can also prove the following properties for \(u_\alpha \) and \(h_{\alpha \beta }\)

$$\begin{aligned} u_\mu \,h^\mu _{\alpha \gamma ,\beta }&=0= u_\mu \,\gamma ^\mu _{\alpha \beta },\nonumber \\ \nabla _{\alpha }u_\beta&=-a\,\dot{a} \,h_{\alpha \beta }=-H\left( g_{\alpha \beta }+u_\alpha \, u_\beta \right) ,\nonumber \\ \nabla _{\gamma }h_{\alpha \beta }&=-H\left( 2u_\gamma \, h_{\alpha \beta }+u_\beta \, h_{\gamma \alpha } +u_\alpha \, h_{\gamma \beta } \right) \nonumber \\&\quad =-\frac{\dot{a}}{a^3}\left( 2u_\gamma \,g_{\alpha \beta }+u_\beta \, g_{\gamma \alpha } +u_\alpha \, g_{\gamma \beta } +4u_\alpha \, u_\beta \, u_\gamma \right) .\nonumber \\ \end{aligned}$$
(8)

Using the Christoffel symbols (6), one can find the components of the Riemann curvature tensor as

$$\begin{aligned} R^{\mu }_{\alpha \beta \gamma }= & {} \partial _\beta \Gamma ^\mu _{\alpha \gamma }-\partial _\gamma \Gamma ^\mu _{\beta \alpha }+\Gamma ^\mu _{\beta \rho }\Gamma ^\rho _{\alpha \gamma }-\Gamma ^\mu _{\gamma \rho }\Gamma ^\rho _{\beta \alpha }\nonumber \\= & {} r^{\mu }_{\alpha \beta \gamma }-\dot{H}\, u_\alpha \left( u_\gamma \,\delta ^\mu _\beta -u_\beta \,\delta ^\mu _\gamma \right) \nonumber \\&+\left( \dot{a}^2+a\ddot{a}\right) u^\mu \left( u_\gamma \, h_{\alpha \beta } -u_\beta \, h_{\alpha \gamma } \right) \nonumber \\&+H^2\left( u_\beta \, u_\alpha \,\delta ^\mu _\gamma -u_\gamma \, u_\alpha \,\delta ^\mu _\beta \right) \nonumber \\&-\,\dot{a}^2\left( \delta ^\mu _\beta \, h_{\alpha \gamma }+\delta ^\mu _\gamma \,h_{\alpha \beta }\right. \nonumber \\&\left. -2u^\mu \, u_\beta \, h_{\alpha \gamma }+2u^\mu \, u_\gamma \, h_{\alpha \beta }\right) , \end{aligned}$$
(9)

where the curvature tensor \(r^{\mu }_{\alpha \beta \gamma }\) is defined as

$$\begin{aligned} r^{\mu }_{\alpha \beta \gamma }=\gamma ^{\mu }_{\alpha \gamma ,\beta }-\gamma ^{\mu }_{\alpha \beta ,\gamma }+ \gamma ^{\mu }_{\beta \rho }\,\gamma ^{\rho }_{\alpha \gamma }-\gamma ^{\mu }_{\gamma \rho }\,\gamma ^{\rho }_{\alpha \beta }\, . \end{aligned}$$
(10)

On the other hand, the curvature tensor \(r^{\mu }_{\alpha \beta \gamma }\) for a Riemannian space with the constant curvature k can be written as

$$\begin{aligned} r^{\mu }_{\alpha \beta \gamma }=k\left( h^\mu _\beta \, h_{\alpha \gamma }-h^\mu _\gamma \, h_{\alpha \beta } \right) , \end{aligned}$$
(11)

where it vanishes if one of \(\mu ,\nu ,\alpha \) or \(\gamma \) is zero.

Using (3) and (11), the components of the Riemann curvature tensor (9) can be written in the following linear form in terms of the metric \(g_{\mu \nu }\) and the four vector \(u_\mu \)

$$\begin{aligned}&R_{\mu \alpha \beta \gamma }=\left( g_{\mu _\beta } g_{\alpha \gamma }-g_{\mu _\gamma } g_{\alpha \beta }\right) \rho _1\nonumber \\&\quad +\left( u_{\mu }\left( g_{\alpha \gamma } u_\beta - g_{\alpha \beta } u_\gamma \right) -u_\alpha \,\left( g_{\mu _\gamma } u_\beta - g_{\mu _\beta } u_\gamma \right) \right) \rho _2,\nonumber \\ \end{aligned}$$
(12)

where \(\rho _1\) and \(\rho _2\) are defined as

$$\begin{aligned}&\rho _1=H^2 +\frac{k}{a^2}, \end{aligned}$$
(13)
$$\begin{aligned}&\rho _2=H^2 +\frac{k}{a^2}-\frac{\ddot{a}}{a}=-{\dot{H}}+\frac{k}{a^2}. \end{aligned}$$
(14)

The contractions of the Riemann tensor (12) gives the Ricci tensor and Ricci scalar, respectively, as

$$\begin{aligned} R_{\alpha \gamma }&=g_{\alpha \gamma }\left( (D-1)\rho _1-\rho _2 \right) +u_\alpha u_\gamma (D-2)\rho _2, \nonumber \\ R&=\left( D-1 \right) \left( D\rho _1 -2\rho _2 \right) . \end{aligned}$$
(15)

One can also verify that the Weyl tensor defined as

$$\begin{aligned} C^{\mu }_{\alpha \beta \gamma }&=R^{\mu }_{\alpha \beta \gamma }+\frac{1}{D-2}\left( \delta ^\mu _\gamma R_{\alpha \beta }-\delta ^\mu _\beta R_{\alpha \gamma }+ g_{\alpha \beta }R^\mu _\gamma - g_{\alpha \gamma } R^\mu _\beta \right) \nonumber \\&\quad +\frac{1}{(D-1)(D-2)}\left( \delta ^\mu _\beta g_{\alpha \gamma }-\delta ^\mu _\gamma g_{\alpha \beta }\right) R, \end{aligned}$$
(16)

vanishes for the metric (3). Hence we have the following theorem [24,25,26,27]:

Theorem 2

FLRW spacetimes are conformally flat for all values of spatial curvature k in any dimensions.

3 FLRW-tensor algebra

For some spacetimes, such as spherically symmetric and Kerr–Schild–Kundt spacetimes, it is possible to simplify the field equations of any generic gravity theories. To achieve such a simplification we need a closed tensorial algebra. By the of use this tensorial algebra, the goal is to find the most general symmetric and second rank tensor in this tensor algebra . This is the way of finding universal metrics in general relativity [28,29,30]. In this section, we construct such a closed tensor algebra for the D-dimensional FLRW spacetimes and with the use of this tensor algebra we show that the field equations of any generic gravity theory, in D-dimensional FLRW spacetimes, have the perfect fluid form.

The geometrical tensors, Riemann and Ricci, are expressed solely by the metric tensor \(g_{\mu \nu }\) and the timelike vector \(u_{\mu }\) as

$$\begin{aligned} R_{\mu \alpha \beta \gamma }= & {} \left( g_{\mu \beta } g_{\alpha \gamma }-g_{\mu \gamma } g_{\alpha \beta }\right) \rho _1\nonumber \\&+\left( u_{\mu }\left( g_{\alpha \gamma } u_\beta - g_{\alpha \beta } u_\gamma \right) -u_\alpha \,\left( g_{\mu \gamma } u_\beta - g_{\mu \beta } u_\gamma \right) \right) \rho _2,\nonumber \\ R_{\alpha \gamma }= & {} g_{\alpha \gamma }\left( (D-1)\rho _1-\rho _2 \right) +u_\alpha u_\gamma (D-2)\rho _2, \nonumber \\ R= & {} \left( D-1 \right) \left( D\rho _1 -2\rho _2 \right) , \end{aligned}$$
(17)

where \(\rho _{1}\) and \(\rho _{2}\) are defined in (13) and (14), respectively. Not only these tensors but also tensors produced by taking the covariant derivatives of them are also represented by the metric tensor \(g_{\alpha \beta }\) and the vector \(u_{\alpha }\). As examples, the covariant derivatives of the four vector \(u_\alpha \) and the Ricci tensor \(R_{\alpha \beta }\) are given as follows

$$\begin{aligned} \nabla _{\alpha }u_\beta&=-H\left( g_{\alpha \beta }+u_\alpha \, u_\beta \right) ,\nonumber \\ \quad \nabla _{\gamma }\,R_{\alpha \beta }&=[(D-2) {\dot{\rho }}_{1}-{\dot{\rho }}_{2}]\, g_{\alpha \beta }\, u_{\gamma }\nonumber \\&\quad -(D-2) \rho _{2} {\dot{H}} (g_{\alpha \gamma } u_{\beta } +g_{\beta \gamma } u_{\alpha })\nonumber \\&\quad -2(D-2) \rho _{2} {\dot{H}} u_{\alpha } u_{\beta } u_{\gamma }, \end{aligned}$$
(18)

and consequently one can obtain

$$\begin{aligned} {\square R}_{\alpha \beta }&=-[{\ddot{P}}+(D-1) H \dot{P}-2 Q H^2]\, g_{\alpha \beta }\nonumber \\&\quad +[2 D Q H^2-{\ddot{Q}}+ 2(D-1) H \dot{Q}] u_{\alpha } u_{\beta },\nonumber \\ \square R&=-D {\ddot{P}}-D(D-1) H \dot{P}+\dot{Q}-2(D-1) H \dot{Q},\nonumber \\ \end{aligned}$$
(19)

where P and Q are defined as

$$\begin{aligned}&P=(D-1) \rho _{1}-\rho _{2},\nonumber \\&\quad Q=(D-2) \rho _{2}. \end{aligned}$$
(20)

The covariant derivative of the Riemann tensor has the similar structure. We have the similar structure for the higher order covariant derivatives of the Riemann and Ricci tensors. They are all expressed as the sum of monomials of the same rank which are products of the metric tensor \(g_{\mu \nu }\) and the vector \(u_{\mu }\).

Definition 3

A tensor M of rank k denoting the monomials of the product of metric and the vector \(u_{\mu }\) is given by

$$\begin{aligned} M_{\mu _{1} \mu _{2} \mu _{3} \mu _{4} \cdots \mu _{k}}=g_{\mu _{1} \mu _{2}} g_{\mu _{3} \mu _{4}} \cdots u_{\mu _{k-1}} u_{\mu _{k}} \end{aligned}$$
(21)

There are r number of metric tensor and \(k-r\) number of vector \(u_{\mu }\) in a monomial of rank k. Here r is any nonnegative integer.

Proposition 4

In D-dimensional FLRW spacetimes any tensor generated by the curvature tensor and its covariant derivatives at any order is the sum of the different monomials of the same rank.

All scalars and functions depend only on the time variable t. Hence, the derivative of the Ricci scalar is given by

$$\begin{aligned} \nabla _{\gamma } R= {\dot{R}} \, u_{\gamma }. \end{aligned}$$
(22)

This is valid also for any scalars obtained from the Riemann and Ricci tensors and their covariant derivatives at any order. Let \(\Theta \) be any of such a scalar then

$$\begin{aligned} \nabla _{\gamma } \Theta = {\dot{\Theta }} \, u_{\gamma }. \end{aligned}$$
(23)

Now we are ready to obtain the most general symmetric and second rank tensor from the contractions of higher order tensors. For illustration, let us consider the following example. If \(E_{\alpha _{1} \alpha _{2} \cdots \alpha _{m}}\) is a tensor of rank m obtained from the Ricci and Riemann tensors and their covariant derivatives at any order, then, by Proposition 4, it takes the following form for \(m= \text{ even } \text{ integer }\)

$$\begin{aligned} E_{\alpha _{1} \alpha _{2} \cdots \alpha _{m}}= & {} A_{1}\, g_{\alpha _{1} \alpha _{2}} \cdots g_{\alpha _{m-1} \alpha _{m}} +A_{2}\, g_{\alpha _{1} \alpha _{2}} \cdots u_{m-1} u_{\alpha _{m}} \nonumber \\&+\cdots +A_{m-1}\, g_{\alpha _{1} \alpha _{2}}\, u_{\alpha _{3}} \cdots u_{m}+A_{m}\, u_{\alpha _{1}}\, u_{\alpha _{2}} \cdots u_{\alpha _{m}},\nonumber \\ \end{aligned}$$
(24)

and for \(m=\text{ odd } \text{ integer }\) as

$$\begin{aligned} E_{\alpha _{1} \alpha _{2} \cdots \alpha _{m}}= & {} B_{1}\, g_{\alpha _{1} \alpha _{2}} \cdots g_{\alpha _{m-2} \alpha _{m-1}}\,u_{\alpha _{m}}\nonumber \\&+B_{2}\, g_{\alpha _{1} \alpha _{2}} \cdots u_{\alpha _{m-2}}\, u_{\alpha _{m-1}} u_{\alpha _{m}}+\cdots \nonumber \\&+B_{m-1}\, g_{\alpha _{1} \alpha _{2}}\, u_{\alpha _{3}} \cdots u_{m}+B_{m}\, u_{\alpha _{1}}\, u_{\alpha _{2}} \cdots u_{\alpha _{m}},\nonumber \\ \end{aligned}$$
(25)

where \(A_{k},B_{k}\) (\(k=1,2, \cdots , m\)) are functions of the time parameter t. All the tensors of rank two obtained by the contraction of such tensors are of our interests. To see the result of such a contraction, let us consider the contraction of the monomials of the metric tensor \(g_{\mu \nu }\) and the vector \(u_{\mu }\). As an example

$$\begin{aligned} g_{\alpha _{1} \alpha _{2}} \, g_{\alpha _{3} \alpha _{4}}\,u_{\alpha _{5}}\, u_{\alpha _{6}} \, u_{\alpha _{7}}, \end{aligned}$$
(26)

is a monomial of rank seven. Since \(u_{\alpha }\, u^{\alpha }=-1\) and \(g_{\mu \nu }\) is the metric tensor then any second rank tensor obtained from the contraction of such two different monomials is either \(g_{\mu \nu }\) or \(u_{\mu } u_{\nu }\). Therefore, if \(E_{\mu \alpha _{1} \alpha _{2} \cdots \alpha _{m}}\) and \(F_{\nu }\,^{\alpha _{1} \alpha _{2} \cdots \alpha _{m}}\) are two tensors obtained from the Riemann, Ricci tensors and their covariant derivatives at any order, then we have

$$\begin{aligned} E_{\mu \alpha _{1} \alpha _{2} \cdots \alpha _{m}}\,F_{\nu }\,^{\alpha _{1} \alpha _{2} \cdots \alpha _{m}}=C_{1}\, g_{\mu \nu }+C_{2} u_{\mu } u_{\nu }, \end{aligned}$$
(27)

where \(C_{1}\) and \(C_{2}\) are some scalars. In the general case the idea of obtaining a symmetric and second rank tensor from the above tensor algebra is similar. The main points are: (1) all tensors are the sum of monomials of the metric tensor and the vector \(u_{\mu }\), (2) any symmetric tensor of the second rank obtained from the products of monomials is either the metric tensor \(g_{\mu \nu }\) or \(u_{\mu }\, u_{\nu }\), and (3) due to the first two facts any symmetric second rank tensor obtained from the curvature tensor and its covariant derivatives at any order will be similar to (27). Then, we have the following theorem:

Theorem 5

Any second rank tensor obtained from the metric tensor, Riemann tensor, Ricci tensor, scalar \(\psi \) and their covariant derivatives at any order is a combination of the metric tensor \(g_{\mu \nu }\) and \(u_{\mu } u_{\nu }\) that is

$$\begin{aligned} {\mathcal {E}}_{\mu \nu }=A g_{\mu \nu }+B u_{\mu } u_{\nu }, \end{aligned}$$
(28)

where A and B are functions of a(t) and \(\psi (t)\) and their time derivatives at any order.

Some special cases of this theorem are given in [18,19,20]. In these references, this theorem was proved for the field equations of special cases \({\mathcal {F}}(R,{\mathcal {G}})\) and \({\mathcal {F}}(R,\, \square R,\,\square \square R, \cdots )\). In [20], the considered geometry is the generalized FLRW spacetime. We have the following corollary of this theorem:

Corollary 6

The field equations of any generic gravity theory takes the form

$$\begin{aligned} G_{\mu \nu }+ \Lambda g_{\mu \nu }+{\mathcal {E}}_{\mu \nu }=T_{\mu \nu }, \end{aligned}$$
(29)

where \(G_{\mu \nu }\) is the Einstein tensor, \(\Lambda \) is the cosmological constant, \(T_{\mu \nu }\) is the energy momentum tensor of perfect fluid distribution and \({\mathcal {E}}_{\mu \nu }\) comes from the higher order curvature terms. Hence the general field equations take the form

$$\begin{aligned}&\rho =\frac{1}{2}(D-1)(D-2) \rho _{1}-\Lambda +B-A,\nonumber \\&p=(D-2)\left[ -\frac{1}{2}(D-1) \rho _{1}+\rho _{2}\right] +\Lambda +A. \end{aligned}$$
(30)

Thus, regarding (30), the interpretation of A and B in \({\mathcal {E}}_{\mu \nu }\) tensor (28) is as follows. A is the effective pressure, and the combination \(B-A\) is the sum of effective pressure and effective energy density of an effective perfect fluid of the geometric origin. As the applications of the theorem in the following sections, we prove that the field equations of the Einstein-Lovelock theory and a generalized version of Einstein–Gauss–Bonnet theory \({\mathcal {F}}(R, {\mathcal {G}})\), as two examples for general higher order curvature theories, reduce to the perfect fluid form with the energy density \(\rho \) and pressure p given in (30).

4 Einstein–Lovelock theory

The action of the Lovelock theory in D-dimensions is given by [15]

$$\begin{aligned} I= & {} \int \, d^{D}\,x\, \sqrt{-g}\,\Bigg (\frac{1}{\kappa } \left( R-2\Lambda \right) +\sum _{n=2}^{N}\,\alpha _{n}\, L_{n}\Bigg ), \end{aligned}$$
(31)

where \(\alpha _{n}\)’s are constants and

$$\begin{aligned}&L_{n}=2^{-n}\, \delta ^{\mu _{1} \mu _{2} \cdots \mu _{2n}}\,_{\nu _{1} \nu _{2} \cdots \nu _{2n}} R^{\nu _{1} \nu _{2}}\,\nonumber \\&\quad _{\mu _{1} \mu _{2}} \, R^{\nu _{3} \nu _{4}}\,_{\mu _{3} \mu _{4}} \cdots R^{\nu _{2n-1} \nu _{2n}}\,_{\mu _{2n-1} \mu _{2n}}. \end{aligned}$$
(32)

The corresponding field equations take the form [15]

$$\begin{aligned} \frac{1}{\kappa }\left( G_{\mu \nu } +\Lambda g_{\mu \nu } \right) + \sum _{n=2}^{N}\alpha _{n}\,({\mathcal {H}}_{\mu \nu })_{n}=T_{\mu \nu }, \end{aligned}$$
(33)

where the tensor \(({\mathcal {H}}_{\mu \nu })_{n}\) is given by [16]

$$\begin{aligned} ({\mathcal {H}}^{\mu }\,_{\nu })_{n}=\frac{1}{2^{n+1}} \delta ^{\mu \alpha \beta \alpha _{1} \beta _{1} \cdots \alpha _{n} \beta _{n}}_{\nu \gamma \sigma \gamma _{1} \sigma _{1} \cdots \gamma _{n} \sigma _{n}}\, R_{\alpha \beta }\,^{\gamma \sigma }\, R_{\alpha _{1} \beta _{1}}\,^{\gamma _{1} \sigma _{1}}\, \cdots R_{\alpha _{n} \beta _{n}}\,^{\gamma _{n} \sigma _{n}}.\nonumber \\ \end{aligned}$$
(34)

In the case of the FLRW metric, \(({\mathcal {H}}_{\mu \nu })_{n}\) reduces to the following form

$$\begin{aligned}&({{\mathcal {H}}}_{\mu \nu })_{n}=\frac{n\,(D-2)!}{(D-2n-1)!}\,( \rho _{1})^{n-1}\,\nonumber \\&\quad \times \left[ (\rho _{2}-\frac{D-1}{2\,n} \rho _{1}) g_{\mu \nu }+\rho _{2} u_{\mu } u_{\nu } \right] , \end{aligned}$$
(35)

representing a linear combination of metric \(g_{\mu \nu }\) and \(u_\mu u_\nu \). Then, we have the following proposition.

Proposition 7

The pressure p and the energy density \(\rho \) in the context of Einstein-Lovelock theory for any n can be obtained as

$$\begin{aligned} p&=\frac{1}{\kappa }\left[ \left( D-2\right) \left( \rho _2-\frac{1}{2}(D-1)\rho _1 \right) +\Lambda \right] \nonumber \\&\quad +\sum _{n=2}^N \alpha _n\frac{n\,(D-2)!}{(D-2n-1)!}\,( \rho _{1})^{n-1}\left( \rho _{2}-\frac{D-1}{2\,n} \rho _{1}\right) , \nonumber \\ \rho&=\frac{1}{\kappa }\left[ \frac{(D-1)\left( D-2\right) }{2}\rho _1 -\Lambda \right] \nonumber \\&\quad +\sum _{n=2}^N \alpha _n\frac{\,(D-1)!}{2(D-2n-1)!}\,( \rho _{1})^{n}. \end{aligned}$$
(36)

When \(k=0\) and a barotropic equation of state \(p=w \rho \) is considered, the Hubble parameter H satisfies the following first order nonlinear ordinary differential equation

$$\begin{aligned}&\left[ \frac{(D-2)}{2\kappa }+\sum _{n=2}^N n \,\,{\bar{\alpha }}_n \,\,H^{2n-2} \right] \, \dot{H} \nonumber \\&\quad =-(w+1)\, \left( \frac{1}{\kappa }\left[ \frac{(D-1)\left( D-2\right) }{2}\,H^2 -\Lambda \right] \right. \nonumber \\&\left. \qquad +\frac{1}{2}\,\sum _{n=2}^N (D-1)\,{\bar{\alpha }}_n \, H^{2n}\right) , \end{aligned}$$
(37)

where

$$\begin{aligned} {\bar{\alpha }}_{n}=\frac{(D-2)!}{(D-2n-1)!}\alpha _n, \end{aligned}$$
(38)

are the re-scaled coupling constants of the theory. The case \(H=\text{ constant }\) solves the Eq. (37) for all D and n but the energy density \(\rho \) vanishes for this kind of solutions with a linear equation of state. For any D and n it is possible to integrate the above Eq. (37) and the solution is given in the following proposition.

Proposition 8

Let the polynomial

$$\begin{aligned} P_{N}(H^2)&=\frac{1}{\kappa }\left[ \frac{(D-1)\left( D-2\right) }{2}\,H^2 -\Lambda \right] \nonumber \\&\quad +\frac{1}{2}\,\sum _{n=2}^N (D-1)\,{\bar{\alpha }}_n \, H^{2n}, \end{aligned}$$
(39)

of \(H^2\) and of the degree N has the N roots \(k_{i}^2\) \((i-1,2,\cdots ,N)\), then the solution of the Eq. (37) is given by

$$\begin{aligned} \sum _{n=1}^{N}\, p_{n} \tanh ^{-1} \left( q_{n}\,\frac{H}{k_{n}} \right) =t-t_{0}, \end{aligned}$$
(40)

where \(p_{i}\) and \(q_{i}\) are some constants depending on the constants of the theory.

The exact solutions corresponding to \(n=2\) and as \(N \rightarrow \infty \) will be discussed in [32].

5 Generalized Einstein–Gauss–Bonnet theory

The generalization of the action of the Einstein–Gauss–Bonnet theory is given by

$$\begin{aligned} I= & {} \int \, d^Dx\, \sqrt{-g} \left( \frac{1}{\kappa }\left( R -2\Lambda \right) +\alpha {\mathcal {F}}(R, {\mathcal {G}})\right) \nonumber \\&+\int \, d^Dx\, \sqrt{-g}\,{\mathcal {L}}_M, \end{aligned}$$
(41)

where \({\mathcal {G}}\) represents the Gauss–Bonnet topological invariant, i.e \({\mathcal {G}}=R_{\alpha \beta \rho \sigma }\,R^{\alpha \beta \rho \sigma }-4R_{\alpha \beta }R^{\alpha \beta }+R^2\). The corresponding field equations read as

$$\begin{aligned} \frac{1}{\kappa }\left( G_{\alpha \beta }+\Lambda g_{\alpha \beta } \right) + \alpha {\mathcal {E}}_{\alpha \beta }=T_{\alpha \beta }, \end{aligned}$$
(42)

where the modified Einstein–Gauss–Bonnet tensor \({\mathcal {E}}_{\alpha \beta }\) is given by

$$\begin{aligned} {\mathcal {E}}_{\alpha \beta }= & {} -\frac{1}{2} {\mathcal {F}}(R, {\mathcal {G}})\, g_{\alpha \beta }\, +{\mathcal {F}}_{R}(R, {\mathcal {G}})\, R_{\alpha \beta }\nonumber \\&-\nabla _{\alpha } \nabla _{\beta } {\mathcal {F}}_{R}(R, {\mathcal {G}})+ g_{\alpha \beta }\nabla ^2 {\mathcal {F}}_{R}(R, {\mathcal {G}})\nonumber \\&+2\left( R\,R_{\alpha \beta }-2{R^\rho }_\alpha \,R_{\beta \rho }+2R_{\alpha \rho \sigma \beta }\,R^{\rho \sigma }\right. \nonumber \\&\left. +R_{\beta \mu \nu \gamma }\,{R_{\alpha }}^{\mu \nu \gamma }\right) {\mathcal {F}}_{{\mathcal {G}}}(R, {\mathcal {G}})\nonumber \\&-2R\left( \nabla _\alpha \nabla _\beta -g_{\alpha \beta }\nabla ^2\right) {\mathcal {F}}_{{\mathcal {G}}}(R, {\mathcal {G}})+4\left( {R^\mu }_\beta \nabla _\mu \nabla _\alpha \right. \nonumber \\&\left. +{R^\mu }_\alpha \nabla _\mu \nabla _\beta \right) {\mathcal {F}}_{{\mathcal {G}}}(R, {\mathcal {G}})\nonumber \\&-4\left( R_{\alpha \beta } \nabla ^2+g_{\alpha \beta }R^{\mu \nu } \nabla _\mu \nabla _\nu + R_{\alpha \rho \sigma \beta }\nabla ^\rho \nabla ^\sigma \right) {\mathcal {F}}_{{\mathcal {G}}}(R, {\mathcal {G}}),\nonumber \\ \end{aligned}$$
(43)

where \({\mathcal {F}}_{R}=\frac{\partial {\mathcal {F}}}{\partial R}\) and \({\mathcal {F}}_{{\mathcal {G}}}=\frac{\partial {\mathcal {F}}}{\partial {\mathcal {G}}}\).

One can define a second rank tensor \(H_{\alpha \beta }\) as

$$\begin{aligned} H_{\alpha \beta }&=2\Bigg [R\,R_{\alpha \beta }-2{R^\rho }_\alpha \,R_{\beta \rho } +2R_{\alpha \rho \sigma \beta }\,R^{\rho \sigma }\ \nonumber \\&\quad \quad +R_{\beta \mu \nu \gamma }\,{R_{\alpha }}^{\mu \nu \gamma }-\frac{1}{4} {\mathcal {G}}\, g_{\alpha \beta }\Bigg ], \end{aligned}$$
(44)

which vanishes in four dimensions [31]. Then, \({\mathcal {E}}_{\alpha \beta }\) can be written in terms of the \(H_{\alpha \beta }\) as

$$\begin{aligned} {\mathcal {E}}_{\alpha \beta }= & {} -\frac{1}{2} {\mathcal {F}}(R, {\mathcal {G}})\, g_{\alpha \beta }\, +{\mathcal {F}}_{R}(R, {\mathcal {G}})\, R_{\alpha \beta }\nonumber \\&-\nabla _{\alpha } \nabla _{\beta } {\mathcal {F}}_{R}(R, {\mathcal {G}})+ g_{\alpha \beta }\nabla ^2 {\mathcal {F}}_{R}(R, {\mathcal {G}})\nonumber \\&+\left( H_{\alpha \beta }+\frac{1}{2}{\mathcal {G}}g_{\alpha \beta }\right) {\mathcal {F}}_{{\mathcal {G}}}(R, {\mathcal {G}})\nonumber \\&-2R\left( \nabla _\alpha \nabla _\beta -g_{\alpha \beta }\nabla ^2\right) {\mathcal {F}}_{{\mathcal {G}}}(R, {\mathcal {G}})+4\left( {R^\mu }_\beta \nabla _\mu \nabla _\alpha \right. \nonumber \\&\left. +{R^\mu }_\alpha \nabla _\mu \nabla _\beta \right) {\mathcal {F}}_{{\mathcal {G}}}(R, {\mathcal {G}})\nonumber \\&-4\left( R_{\alpha \beta } \nabla ^2+g_{\alpha \beta }R^{\mu \nu } \nabla _\mu \nabla _\nu + R_{\alpha \rho \sigma \beta }\nabla ^\rho \nabla ^\sigma \right) {\mathcal {F}}_{{\mathcal {G}}}(R, {\mathcal {G}}).\nonumber \\ \end{aligned}$$
(45)

Hence, in four dimensions, \({\mathcal {E}}_{\alpha \beta }\) (43) reduces to the following form

$$\begin{aligned} {\mathcal {E}}_{\alpha \beta }= & {} -\frac{1}{2} {\mathcal {F}}(R, {\mathcal {G}})\, g_{\alpha \beta }\, +{\mathcal {F}}_{R}(R, {\mathcal {G}})\, R_{\alpha \beta }\nonumber \\&-\nabla _{\alpha } \nabla _{\beta } {\mathcal {F}}_{R}(R, {\mathcal {G}})+g_{\alpha \beta } \nabla ^2 {\mathcal {F}}_{R}(R, {\mathcal {G}}) \nonumber \\&+\frac{1}{2}{\mathcal {G}}{\mathcal {F}}_{{\mathcal {G}}}(R, {\mathcal {G}})-2R\left( \nabla _\alpha \nabla _\beta -g_{\alpha \beta }\nabla ^2\right) {\mathcal {F}}_{{\mathcal {G}}}(R, {\mathcal {G}})\nonumber \\&+4\left( {R^\mu }_\beta \nabla _\mu \nabla _\alpha +{R^\mu }_\alpha \nabla _\mu \nabla _\beta \right) {\mathcal {F}}_{{\mathcal {G}}}(R, {\mathcal {G}})\nonumber \\&-4\left( R_{\alpha \beta } \nabla ^2+g_{\alpha \beta }R^{\mu \nu } \nabla _\mu \nabla _\nu \right. \nonumber \\&\left. + R_{\alpha \rho \sigma \beta }\nabla ^\rho \nabla ^\sigma \right) {\mathcal {F}}_{{\mathcal {G}}}(R, {\mathcal {G}}). \end{aligned}$$
(46)

The geometric tensor \({\mathcal {E}}_{\alpha \beta }\) (46) corresponds to the tensor \(\Sigma _{\alpha \beta } -\left( R_{\alpha \beta }-\frac{1}{2}Rg_{\alpha \beta }\right) \) in equation (4) in [18]. Here one notes that for an arbitrary number of dimensions D, the correct form of the geometric fluid is given by (43), and the form (46) is true only in the specific case: \(D=4\). This implies that the results in [18] based on the obtained \(\Sigma _{\alpha \beta }\) tensor in equation (4) is correct only in four dimensions.

Defining \(\phi ={\mathcal {F}}_{\mathcal {G}}(R,{\mathcal {G}})\) and \(\psi ={\mathcal {F}}_R(R,{\mathcal {G}})\), we have

$$\begin{aligned}&\nabla _\alpha \nabla _\beta {\mathcal {F}}_{\mathcal {G}}(R,{\mathcal {G}})=-H{{\dot{\phi }}} g_{\alpha \beta }+\left( \ddot{\phi }-H{{\dot{\phi }}}\right) u_\alpha u_\beta ,\nonumber \\&\nabla _\alpha \nabla _\beta {\mathcal {F}}_R(R,{\mathcal {G}})=-H{{\dot{\psi }}} g_{\alpha \beta }+\left( \ddot{\psi }-H{{\dot{\psi }}}\right) u_\alpha u_\beta , \end{aligned}$$
(47)

where the dot sign represents the derivative with respect to the time coordinate t. Then, we can show that \({\mathcal {E}}_{\alpha \beta }\) tensor in (43) takes the perfect fluid form (28) in which A and B read as

$$\begin{aligned} A&= -\frac{1}{2}{\mathcal {F}}(R,{\mathcal {G}})+\left( (D-1)\rho _1-\rho _2\right) \psi -(D-2)H{{\dot{\psi }}}-\ddot{\psi }\nonumber \\&\quad +\left[ \frac{1}{2}{\mathcal {G}}+2\rho _1(D-2)(D-3)(D-4)\left( \rho _2-\frac{D-1}{4}\rho _1\right) \right] \phi \nonumber \\&\quad -2(D-2)(D-3)\left[ \rho _1(D-2)-2\rho _2 \right] H{{\dot{\phi }}}\nonumber \\&\quad -2(D-2)(D-3)\rho _1 \ddot{\phi },\nonumber \\&\quad B=(D-2)\rho _2\psi +H{{\dot{\psi }}}-\ddot{\psi }\nonumber \\&\quad -2(D-2)(D-3)(D-4)\rho _1\rho _2\phi \nonumber \\&\quad +2(D-2)(D-3) \left( \rho _1+2\rho _2\right) H{{\dot{\phi }}}\nonumber \\&\quad -2\left[ (D-2)(D-3)\rho _1-4(D-1)\rho _2 \right] \ddot{\phi }.\nonumber \\ \end{aligned}$$
(48)

Then for any generic \({\mathcal {F}}(R,{\mathcal {G}})\) gravity theory in D-dimensions we have the following Proposition.

Proposition 9

The field equations of the general \({\mathcal {F}}(R,{\mathcal {G}})\) gravity theory are of the perfect fluid type with the energy density \(\rho \) and pressure p given by

$$\begin{aligned} \rho&=\frac{1}{\kappa }\left[ \frac{(D-1)\left( D-2\right) }{2}\rho _1 -\Lambda \right] \nonumber \\&\quad +\frac{1}{2}\alpha {\mathcal {F}}(R,{\mathcal {G}})+ (D-1)\left( \rho _2-\rho _1\right) \alpha \psi +(D-1)\alpha H{{\dot{\psi }}}\nonumber \\&\quad -\left[ \frac{1}{2}{\mathcal {G}}+2\rho _1(D-2)(D-3)(D-4)\left( 2\rho _2-\frac{D-1}{4}\rho _1\right) \right] \alpha \phi \nonumber \\&\quad +2\rho _1(D-1)(D-2)(D-3)\alpha H{{\dot{\phi }}}+8\rho _2(D-1) \alpha \ddot{\phi }, \end{aligned}$$
(49)
$$\begin{aligned} p&=\frac{1}{\kappa }\left[ \left( D-2\right) \left( \rho _2-\frac{1}{2}(D-1)\rho _1 \right) +\Lambda \right] \nonumber \\&\quad -\frac{1}{2}\alpha {\mathcal {F}}(R,{\mathcal {G}})+\left( (D-1)\rho _1-\rho _2\right) \alpha \psi -(D-2)\alpha H{{\dot{\psi }}}-\alpha \ddot{\psi }\nonumber \\&\quad +\left[ \frac{1}{2}{\mathcal {G}}+2\rho _1(D-2)(D-3)(D-4)\left( \rho _2-\frac{D-1}{4}\rho _1\right) \right] \alpha \phi \nonumber \\&\quad -2(D-2)(D-3)\left[ \rho _1(D-2)-2\rho _2 \right] \alpha H{{\dot{\phi }}}\nonumber \\&\quad -2(D-2)(D-3)\rho _1\alpha \ddot{\phi }. \end{aligned}$$
(50)

For \(D=4\) this proposition is proved in [18]. However, as mentioned before, one notes that the proof in [18] is correct only for \(D=4\) due to the identically vanishing property of \(H_{\alpha \beta }\) in four dimensions. For cosmological applications of \({\mathcal {F}}(R, {\mathcal {G}})\) theory, see for example [33].

6 Conclusion

In this work considering the FLRW spacetimes we have shown that the contribution of any generic modified gravity theories to the field equations is of the perfect fluid type. As examples, we have studied the field equations of general \({\mathcal {F}}(R,{\mathcal {G}})\) and Lovelock theories. In a forthcoming publication we investigate exact solutions of these equations by assuming certain equations of state.