Local gauge transformation in Fock space of charged particles I'm currently fiddling around with gauge-phase-transformations in Fock space.
Especially, I'm trying to write a local gauge-phase-transformation as
an operator in a basis-independent way.
Here is what I have so far.
Consider a system of indistinguishable particles (each with a charge $q$).
Total charge
Let's take the total charge operator $\hat{Q}$. It can be defined
by its action on the $n$-particle states (using Fock states in the position basis):
$$\begin{align}
&\hat{Q}\ |\rangle &=\ & 0 \\
&\hat{Q}\ |\vec{x}_1\rangle &=\ & q\ |\vec{x}_1\rangle \\
&\hat{Q}\ |\vec{x}_1\vec{x}_2\rangle &=\ & 2q\ |\vec{x}_1\vec{x}_2\rangle \\
&...
\end{align} \tag{1}$$
The operator $\hat{Q}$ can be written in a basis-independent way:
$$\hat{Q} = q\hat{N} = q\int d^3x\ \hat{\psi}^\dagger(\vec{x})\hat{\psi}(\vec{x}) \tag{2}$$
where $\hat{N}$ is the total number operator, and
$\hat{\psi}^\dagger(\vec{x})$ and $\hat{\psi}(\vec{x})$ are the canonical
creation and annihilation operators at position $\vec{x}$.
It is easy to check that this operator (2) satifies the definition (1).
Global gauge transformation
Now let's consider a global gauge-phase-transformation $\hat{U}(f)$
with a global constant $f$. $\hat{U}(f)$ can be defined by its action
on the $n$-particle states:
$$\begin{align}
&\hat{U}(f)\ |\rangle &=\ & |\rangle \\
&\hat{U}(f)\ |\vec{x}_1\rangle &=\ & e^{iqf}\ |\vec{x}_1\rangle \\
&\hat{U}(f)\ |\vec{x}_1\vec{x}_2\rangle &=\ & e^{2iqf}\ |\vec{x}_1\vec{x}_2\rangle \\
&...
\end{align} \tag{3}$$
It is easy to guess that $\hat{U}(f)$ can be written
in a basis-independent way:
$$\hat{U}(f) = e^{i\hat{Q}f} \tag{4}$$
And indeed, by using $\hat{Q}$ from above
it can be verified that (4) satisfies the definition (3).
So far no problem.
Local gauge transformation
And now for the local gauge-phase-transformation $\hat{U}(f)$
with a position-dependent function $f(\vec{x})$.
Again $\hat{U}(f)$ can be defined by its action on the $n$-particle states
(by generalizing the definition (3)):
$$\begin{align}
&\hat{U}(f)\ |\rangle &=\ & |\rangle \\
&\hat{U}(f)\ |\vec{x}_1\rangle
  &=\ & e^{iqf(\vec{x}_1)}\ |\vec{x}_1\rangle \\
&\hat{U}(f)\ |\vec{x}_1\vec{x}_2\rangle
  &=\ & e^{iqf(\vec{x}_1)}\ e^{iqf(\vec{x}_2)}\ |\vec{x}_1\vec{x}_2\rangle \\
...
\end{align} \tag{5}$$
I was not able to write $\hat{U}(f)$ in a basis-independent way
so that it will satisfy the definition (5).

*

*$\hat{U}(f) = \int d^3x\ e^{i\hat{Q}f(\vec{x})}$
is obviously wrong, because $\hat{U}$ has the dimension of a volume,
instead of being dimensionless.

*$\hat{U}(f) = e^{i\int d^3x\ \hat{Q}f(\vec{x})}$
is also wrong, because the exponent has the dimension of a volume,
instead of being dimensionless.

*$\hat{U}(f) = \int d^3x\ \hat{\psi}^\dagger(\vec{x})
  e^{i\hat{Q}f(\vec{x})} \hat{\psi}(\vec{x})$
is wrong, because when acting on the vacuum state
the result is $\hat{U}|\rangle=0$ instead of $\hat{U}|\rangle=|\rangle$.

Any ideas? Is it even possible?
 A: I'm quite sure the answer is
$$\hat{U}(f) = e^{iq\int d^3x\ f(\vec{x})\hat{\psi}^\dagger(\vec{x})\hat{\psi}(\vec{x})}$$
But I wasn't able to prove it. So it is only a conjecture.
For the special case of $f(\vec{x})=f=\text{const}$, the above reduces to
$$\begin{align}
\hat{U}(f) &= e^{iq\int d^3x\ f\ \hat{\psi}^\dagger(\vec{x})\hat{\psi}(\vec{x})} \\
 &= e^{iqf\int d^3x\ \hat{\psi}^\dagger(\vec{x})\hat{\psi}(\vec{x})} \\
 &= e^{iqf\hat{N}} \\
 &= e^{i\hat{Q}f}
\end{align}$$
which is just the global gauge transformation from equation (4) in the question.

@ChiralAnomaly in his comment has already sketched an elegant proof using operator algebra.
Here is another proof on a more elementary level.
Let's use the abbreviation
$$\hat{Q}(f)=\int d^3x f(\vec{x})\hat{\psi}^\dagger(\vec{x})\hat{\psi}(\vec{x}).$$
By applying $\hat{Q}(f)$ to an $n$-particle state we get
$$\begin{align}
 & \hat{Q}(f) |\vec{x}_1 ... \vec{x}_n\rangle \\
=& \int d^3x f(\vec{x})\hat{\psi}^\dagger(\vec{x})\hat{\psi}(\vec{x}) |\vec{x}_1 ... \vec{x}_n\rangle \\
=& \int d^3x f(\vec{x})\sum_{k=1}^n \delta(\vec{x}-\vec{x}_k) |\vec{x}_1 ... \vec{x}_n\rangle \\
=& \sum_{k=1}^n f(\vec{x}_k) |\vec{x}_1 ... \vec{x}_n\rangle
\end{align}$$
By applying $\hat{Q}(f)$ again and again we get (for $j=1,2,3,...$)
$$\left(\hat{Q}(f)\right)^j |\vec{x}_1 ... \vec{x}_n\rangle
= \left(\sum_{k=1}^n f(\vec{x}_k)\right)^j |\vec{x}_1 ... \vec{x}_n\rangle$$
By applying $\sum_{j=0}^\infty \frac{1}{j!}(iq)^j$ to both sides of this equation
we get the Taylor-series of the exponential function.
$$e^{iq\hat{Q}(f)} |\vec{x}_1 ... \vec{x}_n\rangle
= e^{iq\sum_{k=1}^n f(\vec{x}_k)} |\vec{x}_1 ... \vec{x}_n\rangle$$
Now it is easy to prove equation (5) of the question:
$$\begin{align}
 & \hat{U}(f) |\vec{x}_1 ... \vec{x}_n\rangle \\
=&\ e^{iq\hat{Q}(f)} |\vec{x}_1 ... \vec{x}_n\rangle \\
=&\ e^{iq\sum_{k=1}^n f(\vec{x}_k)} |\vec{x}_1 ... \vec{x}_n\rangle \\
=&\ \prod_{k=1}^n e^{iqf(\vec{x}_k)} |\vec{x}_1 ... \vec{x}_n\rangle
\end{align}$$
