Suppose the Lagrangian was given as:
$$L = \frac{1}{2}\int_{-\infty}^{\infty} \underbrace{\left(\dot{A(}z)^2-A(z)^2\right)+\left(\dot{Q(}z)^2\delta(z)-Q(z)^2\delta(z)\right)+2\dot{Q(}z)\cdot A(z) \delta(z)}_{= \mathcal{L}} \,\,\,dz\tag{1}$$
where Q is localized at $0$. The above are basically two harmonic oscillators that are coupled to each other in the last term. Now, if I wanted to Legendre-transform this in order to get the Hamiltonian, I wouldn't know what to do with the Dirac-delta function.
The conjugate momentum for A(z) is fairly straight forward:
$$P_A = \frac{\partial \mathcal{L}}{\partial \dot{A\,}(z)} = \dot{A\,}(z)\tag{2}$$
but how should I deal with the other conjugate momentum $P_Q$? Would it be
$$P_Q = \frac{\partial \mathcal{L}}{\partial \dot{Q\,}(z)} = \dot{Q\,}(z)\delta(z)+A(z)\delta(z)\tag{3}$$
or
$$P_Q = \frac{\partial \mathcal{L}}{\partial (\dot{Q\,}(z)\delta(z))} = \dot{Q\,}(z)+A(z).\tag{4}$$
I run into problems using the former, but the latter does not seem correct.