Quantum error detection on a quantum circuit