# General reason behind why $X_L$ and $Z_L$ can be processed on software for error correction

I am reading surface code theory with this paper. It is explained there that the $$X_L$$ and $$Z_L$$ (logical $$X$$ and $$Z$$ operator) can be pushed at the end of the circuit and they actually do not have to be implemented on the hardware.

The purpose of my question is to verify if I understood the general property allowing it to be true.

I assume to simplify the discussion that the circuit is only composed of Clifford operations. The reason why we can "push to the end" the Pauli is that as the circuit will only be composed of Clifford operations, for any gate $$G$$ in this circuit, for any pauli operator $$P$$, we will have

$$GP=P' G$$

where $$P'$$ is another Pauli operator.

For this reason, we can pre-compute the commutation of our Pauli being $$X$$ or $$Z$$ for all the other Clifford gate in the circuit and use consecutive commutation relation to push them toward the end of the circuit. There we can simplify the resulting circuit (using things such as $$X^2=I$$ for instance).

Also, this trick works for Pauli operator but it doesn't work for other Clifford operations which would be harder to push "toward the end" (because I don't have in general an easy property telling me how two Clifford operations are commuting: a succession of commutation for Clifford could make the calculation hard to follow classically).

Is my understanding a good overall philosophy behind this trick?

The second reason is the simple predictable effect that a Pauli operator immediately preceding a computational basis measurement has on the measurement outcome. Specifically, $$X$$ and $$Y$$ operators flip the measurement outcome while $$I$$ and $$Z$$ leave the outcome unchanged. This allows us to replace any such operator with a classical post-measurement correction.
• No. You can propagate a Hadamard. However, you won't get a Pauli correction before the measurement. The propagation part works for all gates in the sense that if $G$ is any gate and $P$ is any gate then $GP=P'G$ for some gate $P'$. Moreover, $P'=GPG^\dagger$, so if $G$ and $P$ are Clifford then $P'$ is Clifford, too (since Cliffords form a group). In particular, propagating a Hadamard through a Clifford circuit is possible and yields a Clifford correction. Unfortunately, we can't absorb Clifford corrections into the classical post-processing of the measurement outcomes. Jan 12 at 17:56
• Note that there are schemes where you might be OK with a Clifford correction $C$. Even though you can't absorb it into the measurement, you can actively apply $C^\dagger$ to fix the correction up before measurement. See for example this paper. Jan 12 at 17:58