It is common for books on physics to contain something along these lines: "We have $X$ parameters and $Y$ conditions, hence, the number of free parameters is $X-Y$" or "we have $X$ components of a field, and the local gauge invariance group is $Y$-dimensional, so we can fix arbitrary $Y$ parameters". For instance, cosider the Polyakov string action
$$S = -\frac{T}{2} \int_{\Sigma} d^{2}\sigma \sqrt{-g} g^{\alpha \beta} \partial_{\alpha}X^{\mu} \partial_{\beta} X_{\mu} $$
where $\Sigma$ is the 2D spacetime world-sheet covered by the string, $g^{\alpha \beta}$ is the intrinsic metric on the world-sheet (which is a dynamic variable), $g:=\det g_{\alpha \beta}$, $X^{\mu}(\sigma^{0}, \sigma^{1})$ are 4-dimensional spacetime coordinates of a point of the world-sheet.
This action possess local reparametrization invariance
$$\sigma^{\alpha} \to f^{\alpha}(\sigma)$$
for arbitrary smooth functions $f^{\alpha}$ (such that the resulting map is a local diffeomorphism).
It also posesses local Weyl invariance
$$g_{\alpha \beta}(\sigma) \to e^{\phi(\sigma)}g_{\alpha \beta}(\sigma)$$
where $\phi(\sigma)$ is an arbitrary smooth function, as well as a global Poincaré symmetry. The argument in every string theory book then goes as follows: reparametrization invariance gives us two free parameters at each point, the generators of the local diffeomorphism. Weyl invariance gives one free parameter at each point, the value of the exponent at each point. The metric $g_{\alpha \beta}$, being (in local coordinates) a $2\times 2$ symmetric matrix, has 3 parameters that depend on the exponent of Weyl symmetry and on local reparametrization. Therefore, we can gauge the metric completely (up to the signature).
Such arguments are very common (basically this happens every time a gauge symmetry or a constraint is involved). Is there some strict theorem that allows one to do that?