Hamiltonian formalism for nonlocal Lagrangians | Synapse