# Four-qubit error correction code

$$\newcommand{\ket}{\left|#1\right>}$$ Consider the following 4-qubit code which allows you to detect a bitflip and/or a phaseflip. The logical 0 and 1 are encoded as:

\begin{align*} \ket{0}_{encoded} &= \frac{1}{2}(\ket{00}+\ket{11})\otimes(\ket{00}+\ket{11})\\ \ket{1}_{encoded} &= \frac{1}{2}(\ket{00}-\ket{11})\otimes(\ket{00}-\ket{11})\\ \end{align*}

I would like to find a procedure (in the form of a circuit or pseudo-code) that detects a bit flip error on of the 4 qubits $$\alpha\ket{0}+\beta\ket{1}$$. It doesn't have to know which one that flipped, just that either one of them flipped or nothing happened. I need to find a similar procedure but for phase flips errors.

I have seen quantum error correction codes that detects and corrects bit flip or phase flip. It was done using ancilla qubits that are entangled with the qubits of interested using CNOT gates, and measuring the ancilla qubits then uniquely determines which qubit had flipped, if any. I also know that you can convert that circuit to a phase correction circuit by applying Hadamard gates in parallel, turning bit flips into phase flips. Can something similar using ancilla qubits be done to just detect the bit flip in a simpler way?