Phase-flip protection by Hadamard conjugation (source code)

= Phase-flip protection by Hadamard conjugation

Insert <Hadamard gates> on every data qubit immediately after encoding by a <bit-flip repetition code> and immediately before its bit-flip detection and recovery. The intervening physical error is thereby conjugated by $H^{\otimes n}$, and $HZH=X$ turns a single <Pauli Z gate> error into a single bit flip for the original correction circuit. The encoded logical codewords are now $|+\rangle^{\otimes n}$ and $|-\rangle^{\otimes n}$. The syndrome ancillas and the final inverse encoding stay unchanged. This protects against phase flips in the new basis; it does not simultaneously correct arbitrary bit flips in the physical basis.