Solution (source code)

= Solution

Under $\Psi\mapsto\Psi+\delta\Psi$, the transition amplitude changes to first order by an insertion
$$
i\int d^4x\,\langle f|\{\widehat Q,\delta\Psi(x)\}|i\rangle.
$$
If
$$
\widehat Q|i\rangle=0,
\qquad
\widehat Q|f\rangle=0,
$$
with the corresponding condition on the bra, the two terms vanish after moving $\widehat Q$ to the external states. The amplitude is then independent of the gauge-fixing choice.

Conversely, invariance for arbitrary changes of the gauge-fixing fermion requires physical external states to be <BRST cohomology>[BRST closed]. States differing by a BRST-exact state have identical matrix elements against closed states, so the physical state space is the cohomology
$$
\ker\widehat Q/\operatorname{im}\widehat Q.
$$