# How to verify that a certain gate was applied to a quantum code

Suppose I have a quantum error correcting code $$|\psi \rangle = \alpha | 0 \rangle + \beta | 1 \rangle$$, say the $$[[7,1,3]]$$ Steane code for concreteness.

Suppose there is a black box that either implements logical phase $$\overline{S}$$ or logical phase conjugate $$\overline{S}^\dagger$$ so that we are either in the state $$\overline{S} | \psi \rangle$$ or the state $$\overline{S}^\dagger |\psi \rangle$$.

Is there any way to reliably (and not destructively) verify which gate was actually applied to the code?

• I believe a special case of this is to ask the same question for a qubit. In which case it doesn’t seem possible to do non destructively Commented Jun 9 at 18:28

Let's define $$|\tilde\psi\rangle=S^\dagger|\psi\rangle$$. Then you're asking the simply question of whether we can distinguish between $$|\tilde\psi\rangle$$ and $$S^2|\tilde\psi\rangle=Z|\tilde\psi\rangle$$. So if $$|\tilde\psi\rangle=|+\rangle$$, we'd have to distinguish between the + and - states, which one can do with an $$X$$ measurement. So, now we just have to work it backwards: fix $$|\psi\rangle=S^\dagger|+\rangle$$, pass it into the oracle, and measure in the $$X$$ basis.