Solution (source code)

= Solution

For a homogeneous scalar in conformal time, $(\partial\bar\phi)^2=-\bar\phi'^2/a^2$. The time component of the <stress-energy tensor> is $T_{00}=\bar\phi'^2/2+a^2V$, while $T_{ij}=\delta_{ij}[\bar\phi'^2/2-a^2V]$. Raising one index and applying the prescribed definitions gives
$$
\boxed{\rho=\frac{\bar\phi'^2}{2a^2}+V(\bar\phi),\qquad
P=\frac{\bar\phi'^2}{2a^2}-V(\bar\phi).}
$$
These are the scalar kinetic energy plus/minus potential energy. In proper cosmological time $dt_{\rm proper}=a\,dt$, the same kinetic term is $\dot{\bar\phi}^{\,2}/2$. Potential domination gives negative pressure, while kinetic domination gives $P\simeq\rho$.