Solution (source code)

= Solution

Vary the <four-potential> with compactly supported variation. Antisymmetry of the <electromagnetic field tensor> gives $\delta(F_{\mu\nu}F^{\mu\nu})=4F^{\mu\nu}\partial_\mu\delta A_\nu$. Integration by parts therefore gives
$$
\delta S=\frac1{\mu_0c}\int[\partial_\mu F^{\mu\nu}-\lambda^2A^\nu+\mu_0J^\nu]\delta A_\nu\,d^4x.
$$
Thus \b[the Euler-Lagrange field equation is] $\boxed{\partial_\mu F^{\mu\nu}-\lambda^2A^\nu=-\mu_0J^\nu}$.

A <gauge transformation> is $A_\mu\mapsto A_\mu+\partial_\mu\chi$. Commuting derivatives leave $F_{\mu\nu}$ unchanged. At $\lambda=0$, the source term changes by $c^{-1}\int\partial_\mu\chi J^\mu$, a boundary term because the current is conserved. With suitable boundary conditions the action is gauge invariant. For $\lambda>0$, the mass term changes by terms involving $2A^\mu\partial_\mu\chi+(\partial\chi)^2$, so \b[the same arbitrary gauge transformations are not a symmetry].

Take the divergence of the field equation. Antisymmetry gives $\partial_\nu\partial_\mu F^{\mu\nu}=0$, and conservation gives $\partial_\nu J^\nu=0$. Thus $\lambda^2\partial_\nu A^\nu=0$. For $\lambda>0$ this is the <Lorenz constraint in Proca theory>, and expanding $F$ gives
$$
\boxed{(\Box-\lambda^2)A^\nu=-\mu_0J^\nu.}
$$
For $\lambda=0$ the same reduced equation holds when the <Lorenz gauge> $\partial_\mu A^\mu=0$ is imposed. More generally it is enough that the divergence be spacetime constant, but the conventional vanishing boundary conditions set that constant to zero.