Why is there a minus in the Lagrangian?

Some time ago I pondered over the connections between Hamiltonian dynamics and reinforcement learning. When a pendulum oscillates, we usually attribute its motion to some natural law. And it just so happens that we can very nicely describe all natural laws as minima of certain functionals. But what if we look at it from a different perspective. What if nature actively decides at every moment in time how to move the pendulum? Then we can say that nature is actively trying to minimize a certain cost function. So, is nature a reinforcement learning agent?

Well, maybe that’s a bit of a stretch to say that nature is a reinforcement learning agent, but there are useful conclusions one can arrive at by making the parallels between Hamiltonian dynamics and reinforcement learning explicit. I collected my thoughts in this direction in the pdf attachment.