# The merging operation is not symmetric on its inputs in surface code as it should naturally be

My misunderstanding is probably due to a trivial thing I am not seeing.

In lattice surgery for surface code, we can perform a merging operation. This operation should be symmetric as indicated on Eq.5 in this paper, or Eq on top of page 5 of this one (and it is a natural consequences of the sequences of operation you perform on the surface).

More precisely, for a rough merge, calling the two states to be merged:

$$|\psi\rangle= \alpha |0\rangle + \beta |1 \rangle$$ $$|\phi\rangle= \alpha' |0\rangle + \beta' |1 \rangle$$

The merging operation acts on the logical space as:

$$|\psi\rangle \otimes |\phi\rangle \to \alpha |\phi \rangle + (-1)^M \beta X |\phi\rangle$$

We see that within the process, a two qubit state is mapped to a single qubit state: the merging operation does not preserve the dimensions. As far as I understand, the "net" process is somewhat equivalent to measure the $$X_1 X_2$$ observable of the two qubit state and to map the result to a single qubit state. The quantity $$M$$ is the measurement outcome of the observable $$X_1 X_2$$ on the initial two qubit state.

By construction, the merging operation is symmetric, hence, by exchanging the role of $$|\phi\rangle$$ and $$|\psi\rangle$$, we expect to have (as indicated in the papers provided):

$$\alpha |\phi \rangle + (-1)^M \beta X |\phi\rangle=\alpha' |\psi \rangle + (-1)^M \beta' X |\psi\rangle$$

However, if you do the calculation you realize that this last equality is not true. Below is a short script illustrating the issue

How to make sense of this? On one hand I agree with the paper that we should have the equality true (because we are merging two different surface into a single one: the process should be the same if we exchanged the initial two surfaces). But on the other hand the concrete calculation indicates that it is not the case (and is then in contradiction with the papers).

• Why is there no $\psi$ term in your merging-result equation, and why is the flipped state only using one Pauli instead of the product of the pair of Paulis you're measuring? Feb 7, 2022 at 18:11
• @CraigGidney thanks for the comment. I am not sure to see what you mean though. I wrote the resulting ket of a merging operation using its definition from the papers. What this code tells me is that $|\psi \rangle M |\phi\rangle - |\phi \rangle M |\psi \rangle = ((-1)^M-1) (\alpha' \beta - \alpha \beta') |1\rangle \neq 0$ (where $|\psi\rangle$ and $|\phi\rangle$ are defined in my main text, and where $M$ denotes the merging operation). Hence the merging operation is not symmetric on its input and the equalities provided in the paper are not true. But I guess I misunderstood your comment. Feb 7, 2022 at 18:14
• (of course the $M$ in $(-1)^M$ represents the measurement outcome of $X_1 X_2$, while the $M$ in $|\psi\rangle M |\phi \rangle$ and in $|\phi\rangle M |\psi \rangle$ represent the merging operation, I should have taken two different letters in my previous comment but I am unable to edit now) Feb 7, 2022 at 18:24
• I guess what I'm confused about is how why your equation is sending a four dimensional state vector to a two dimensional state vector. XX parity measurement is a two qubit operation that preserves the dimensionality of the state space. How did you get rid of the tensor product? Feb 7, 2022 at 18:35
• @CraigGidney The merging operation consists in taking two separate surfaces and to merge them into a single one. Within this process we will then have two logical qubits that will be mapped to a single logical qubit state: this is an operation that does not preserve the dimensions. Feb 7, 2022 at 18:38

I think the answer is essentially the same as what Craig Gidney was hinting at in the comments. But perhaps you'll find the more explicit version more satisfying!

This is an interesting point! And it is a little disappointing that the papers you cited gloss over it. I'll refer to the Horseman paper to give the answer. Their equation (2) says that after the merge, the state of the system is given by $$(\alpha\alpha'+ \beta\beta' )(|00\rangle + |11\rangle)+(\alpha\beta'+ \beta\alpha' )(|01\rangle + |10\rangle), \qquad M=1$$ $$(\alpha\alpha'- \beta\beta' )(|00\rangle - |11\rangle)+(\alpha\beta'- \beta\alpha' )(|01\rangle - |10\rangle), \qquad M=-1$$ They then say that after the merge, we'll have a single logical degree of freedom, spanned by $$(|00\rangle+M|11\rangle)/\sqrt{2}$$ and $$(|01\rangle+M|10\rangle)/\sqrt{2}$$. As a result, we can define the merged qubit logical states to be $$|0\rangle:=\frac{|00\rangle+M|11\rangle}{\sqrt{2}}$$ $$|1\rangle:=\frac{|01\rangle+M|10\rangle}{\sqrt{2}}$$ in which case, simple algebra gives that the state after the merge is $$\alpha|\phi\rangle+\beta X|\phi\rangle$$.

Now, you want to switch the roles of qubits $$1$$ and $$2$$ (and thus switch the roles of $$\phi$$ and $$\psi$$). This should definitely work! But to make this work, you have to:

• Swap $$\alpha\leftrightarrow\alpha'$$ and $$\beta\leftrightarrow\beta'$$.
• Swap the two qubits in the definition of $$|0\rangle$$ and $$|1\rangle$$

If you don't do the second step, you haven't really interchanged the role of the two qubits. When we defined $$|0\rangle$$ and $$|1\rangle$$, we arbitrarily chose one of our qubits to be the "first" qubit. We have to reverse this choice to get the correct answer when swapping the role of the two qubits.

Note that the definition of $$|0\rangle$$ is symmetric in the two qubits, but we should modify our definition of $$|1\rangle$$ as

$$|1\rangle_{\mathrm{new}} :=\frac{|10\rangle+M|01\rangle}{\sqrt{2}}=M|1\rangle_{\mathrm{old}}$$ which seems to be what you found in your Mathematica script.

As a punchline: You are correct that Eq. (5) of the original Horseman et al paper is not correct when it swaps the role of $$\psi$$ and $$\phi$$, because it doesn't change their definition of $$|1\rangle$$ accordingly.

• Hey. Thank you for your answer. I am back on this topic in a few days and I give you a feedback =) Feb 23, 2022 at 8:55
• Thank you for your answer. Would you agree with me if I say that in order to "land on our feet" by exchanging the role of the two surfaces, we must (i) swap the states $|\psi\rangle$ and $|\phi \rangle$ (your first bullet point), and (ii) take the "other convention" to define $X_L$. If before we had $X_L=X_L^2$ we need to change it to $X_L=X_L^1$. This last statement is equivalent to your second bullet point where you change the definition of $|1\rangle_{\text{new}} \to M |1\rangle_{\text{old}}$. Mar 1, 2022 at 14:05
• A related question. Do you agree with me that Splitting then Merging two surfaces (I assume both are of "rough" type for instance) is the same as doing an identity operation. However Merging then Splitting is irreversible (hence not equal to identity). Mar 1, 2022 at 14:55
• @StarBuck I agree with both of your points. Mar 1, 2022 at 14:57
• Thanks a lot!! (I cannot provide the bounty now I have to wait 24 hours). I will at that time. Mar 1, 2022 at 14:59