Time derivative of a 4-derivative of a scalar field

Let us consider Lagrangian

$$\mathcal{L} = \frac{1}{2} \partial_\mu \phi \partial^\mu \phi - \frac{1}{2} m^2 \phi^2$$

with $$\phi$$ being a scalar field, and Minkowski signature $$(+,-,-,-)$$. My question is concerning the calculation of the energy density, which is given by

$$\mathcal{E} = \frac{\partial \mathcal{L}}{\partial(\partial_t \phi)} \partial_t\phi - \mathcal{L}.$$

How is the derivative of the time derivative applied on the 4-derivative of the Lagrangian?

• The Lagrangian is a function of $\phi$ and its derivatives. The derivative in the energy density is the derivative of the Lagrangian with respect to time derivative of $\phi$. Jun 5 '20 at 18:46

$$\partial_\mu \phi \partial^\mu \phi = \dot \phi^2 - (\nabla \phi)^2$$ The Lagrangian density can therefore be written $$\mathcal L = \frac{1}{2}\dot \phi^2 - \frac{1}{2}(\nabla\phi)^2 - \frac{1}{2}m^2\phi^2$$ at which point taking the derivative with respect to $$\dot \phi$$ should be straightforward.