# Lattice surgery on small Surface Code (d=2, 7 qubits)

I'm currently trying to understand lattice surgeries. As an exercise I'm currently implementing the lattice surgery operations described in Entangling logical qubits with lattice surgery, by Alexander Erhard et al. on a 7 qubits surface code (distance = 2). The same code described in the article. The operations I'm trying to implement in Qiskit are the following : I'm struggling with the CNOT gate and I feel like I'm missing something obvious. I searched around a lot and found ZX-calculus and a lot of other interesting leads but I cannot understand why my code isn't working...

From my basic understanding a logical CNOT gate can be done using a smooth merge of the target and a temporary logical qubits. Which is done by measuring Z1Z3 of the temporary and Z2Z4 of the target into an ancilla qubit. (target above temporary). I did that using CNOT gates and Hadamard gates : Then I measured X1X2X3X4 of the control using 4 CNOT into another ancilla to perform a smooth split. Finally, I performed a rough merge on the temporary and target by measuring X3 (Temporary) and X1 (Target) into a third ancilla and X4 (Temporary) and X2 (Target) into a fourth ancilla using 2 CNOT each time. I then tried splitting, or not. Either way, my Target logical qubits doesn't end up in $$|1\rangle_L$$...

I'm using $$|0\rangle_L = \frac{1}{\sqrt{2}}(|1010\rangle + |0101\rangle)$$ and $$|1\rangle_L = \frac{1}{\sqrt{2}}(|1001\rangle + |0110\rangle)$$ (same as the article. And initializing the control to $$|1\rangle_L$$ and the temporary to $$|+\rangle_L = (|0101\rangle + |1010\rangle + |1001\rangle + |0110\rangle)$$. The target is initialized to $$|0\rangle_L$$.

Is my understanding correct ? Is my way of doing thing also correct?

I'm really sorry if I'm missing something obvious but I don't understand why at the end of this sequence, the target qubit isn't set to $$|1\rangle_L$$ ? If I'm lacking basic knowledge on Lattice surgeries, could you please provide me some resources I could look at please?