While working on an error detection algorithm, I stumbled upon the problem of simplifying the following implementation

enter image description here

Here, the $S$ gate is defined by

$$S=\left( \begin{array}{cc} \frac{\sqrt{3}}{2} & -\frac{1}{2} e^{\frac{i \pi }{3}} \\ \frac{1}{2} e^{\frac{i \pi }{3}} & \frac{1}{2} \sqrt{3} e^{\frac{2 i \pi }{3}} \\ \end{array} \right)$$

The issue with this implementation is that I am basically de-encoding the state (the $C_{not}$s and $S^\dagger$s in the beginning), performing the required logical gates (the $C_{not}$s and $X$ gate in the middle), and then re-encoding the state afterwords (the $C_{not}$s and $S$s at the end). Instead of this de-encoding re-encoding procedure, I would like to find some implementation that is equivalent to the above set of gates that uses less $C_{not}$s and single-qubit gates overall. I would greatly appreciate if anyone knew of an efficient way to implement this type of gate or some papers I could research in order to further my understanding of said gate.

EDIT: In response to @ryanhill1: It is an error detection algorithm that I am developing. The basic idea is to use two qubits (and therefore expanding the hilbert space) to represent a single qubit through the encoding

$$|0\rangle_L=-\frac{1}{4} \sqrt{3} e^{\frac{i \pi }{3}}|00\rangle+\frac{3}{4} e^{\frac{2 i \pi }{3}}|01\rangle-\frac{\sqrt{3}}{4}|10\rangle-\frac{1}{4} e^{\frac{2 i \pi }{3}}|11\rangle$$

$$|1\rangle_L=-\frac{1}{4} \sqrt{3} e^{\frac{i \pi }{3}}|00\rangle-\frac{1}{4} e^{\frac{2 i \pi }{3}}|01\rangle-\frac{\sqrt{3}}{4}|10\rangle+\frac{3}{4} e^{\frac{2 i \pi }{3}}|11\rangle$$

This encoding is actually achieved using a pair of $S$ gates and a single $C_{not}$ gate. Hence the issue I have: I want to make a gate that acts on $|0\rangle_L$ and $|1\rangle_L$ like a $C_{not}$ acts on $|0\rangle$ and $|1\rangle$ without de-encoding and the re-encoding the entire state.

  • 1
    $\begingroup$ What gates do you have at your disposal? $\endgroup$ Feb 13, 2021 at 22:25
  • $\begingroup$ @Adam_Zalcman $C_{not}$s and general single qubit gates (over three continous variable angles) . Or the base gates available in qiskit for those who use IBMs system. $\endgroup$
    – QC_QAOA
    Feb 14, 2021 at 4:29
  • $\begingroup$ Which error detection algorithm is this circuit part of? Knowing the circuits function would help $\endgroup$
    – ryanhill1
    Feb 16, 2021 at 15:50

1 Answer 1


As I now understand the question, it is more a question of "can logical controlled-not be implemented without decoding the states first?" which is a thoroughly different question to simply "can this circuit be simplified?". In fact, what that question really means is that, throughout the whole circuit, a single-qubit error should never be able to create a logical error in the code.

I don't believe that this can be done for this specific code. Usually, one has to build the facility into the code by design. This is one of the key things that the stabilizer formalism helps you with.

Let me try to explain my thinking a bit (not that this is a rigorous proof of impossibility). First, we need to know the logical-$X$ for the code. This is reasonably straightforward: if we group terms $$ |0\rangle_L=-\frac{\sqrt{3}}{4}(e^{i\pi/3}|0\rangle+|1\rangle)|0\rangle+\frac{e^{i2\pi/3}}{4}(3|0\rangle-|1\rangle)|1\rangle $$ and $$ |1\rangle_L=-\frac{\sqrt{3}}{4}(e^{i\pi/3}|0\rangle+|1\rangle)|0\rangle+\frac{e^{i2\pi/3}}{4}(3|1\rangle-|0\rangle)|1\rangle. $$ To convert between the two, we need a controlled-not controlled off the second qubit targeting the first.

Thus, to make logical controlled-not, you need to apply (physical) controlled-not on the second pair of qubits controlled off the state of the first pair of qubits. This already suggests that you need something of the complexity of at least Toffoli, so in terms of simple gate counts, it seems unlikely that your circuit could be bettered.

But how might we implement that control? The most obvious is to decode the qubit first and control off that. That's what we're trying to avoid. The next most natural idea is a little trick: find local unitaries $U$ and $V$ such that \begin{align*} U\otimes V|0\rangle_L&=\alpha|00\rangle+\beta|11\rangle \\ U\otimes V|1\rangle_L&=\gamma|01\rangle+\delta|10\rangle \end{align*} I haven't verified whether such a transformation exists, but chances are fair because we choose $U,V$ to find the Schmidt decomposition of $|0\rangle_L$, guaranteeing the first line. Then, of course, $U\otimes V|1\rangle_L$ must be orthogonal to $U\otimes V|0\rangle_L$ so you're only worrying if it contains a component $\beta|00\rangle-\alpha|00\rangle$. So, let's assume such a transformation exists (if it doesn't, then I think you have very little hope). If so, then once we've applied $U\otimes V$ to the first pair of qubits, the parity of the two qubits tells us the logical state. Hence, we'd be able to implement the logical controlled-not using a pair of Toffolis: enter image description here This looks not too bad. However, even in this case, given that your logical states have the same Schmidt coefficients, that rather suggests that $\{\alpha,\beta\}=\{\gamma,\delta\}$ (perhaps up to some phases). But if that's the case, then applying Pauli $X$ on just one of the qubits will inter-convert the logical states, i.e. you've got the same error susceptibility that you're trying to avoid. I think there's very little hope of avoiding this for a two-qubit code.

  • $\begingroup$ Thank you for the in depth answer +100 $\endgroup$
    – QC_QAOA
    Feb 20, 2021 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.