**Preliminaries. **I have encountered Dirac's article (see link below) called "Generalized Hamiltonian dynamics" in which he shows how to pass from Lagrangian to Hamiltonian when the momenta are not independent functions of the velocities. Eventually, he arrives to the following result$^{\dagger}$

The general equation of motion [...] becomes

\[\dot{g} = [g, H'] + v_a[g, \phi_a].\]

It now involves the first-class Hamiltonian $H '$ and the first-class $\phi$’s $\phi_a$.

The coefficients $v_a$ associated with these first-class $\phi$’s are not restricted in any way by the equations of motion. Each of them thus leads to an arbitrary function of the time in the general solution of the equations of motion with given initial conditions.[...]

Different solutions of the equations of motion, obtained by different choices of the arbitrary functions of the time with given initial conditions, should be looked upon as all corresponding to the same physical state of motion, described in various way by different choices of some mathematical variables that are not of physical significance (e.g. by different choices of the gauge in electrodynamics or of the co-ordinate system in a relativistic theory).

$^\dagger$$\dot{a}$ means time-derivative and $[a, b]$ is Poisson brackets as usual.

**Question. ***Given a physical system with $n$ degrees of freedom described by such a Lagrangian \[L(q, \dot{q}, t)\]so the momenta \[p_i = \frac{\partial L}{\partial \dot{q_i}}, \, i=1, ..., n\]are not independent functions of the velocities, i.e. there are some constraints $$\phi_j(p,q) = 0,\, j = 0, ..., m$$ in the phase space of this system. Is this restriction on $p$ and $q$ necessary and/or sufficient condition for an appearance of a gauge-invariance for a system?*

According to Dirac, it seems that that restriction *is *a sufficient condition to have a gauge. But I am not sure, not speaking of a necessary condition.

Any ideas or information would be appreciated.

Link to the article: http://rspa.royalsocietypublishing.org/content/royprsa/246/1246/326.full.pdf