# General definition for smooth and rough boundaries in surface code

So far, when I was learning surface code the patches on which my qubits were had a "rectangular" shape and they involved stabilizers having either $$3$$ or $$4$$ "legs". I was then able to easily identify the smooth or rough boundaries given the definition provided for instance in this paper.

A smooth boundary is a boundary where the data qubits belong are "inside" an $$X$$-stabilizer that has 3 terms, and the $$Z$$-stabilizer has $$4$$ terms.

A rough boundary is a boundary where the data qubits belong are "inside" an $$X$$-stabilizer that has 4 terms, and the $$Z$$-stabilizer has $$3$$ terms.

For instance on the surface represented below (a $$Z$$ stabilizer is at the centre of the plaquette, an $$X$$ stabilizer is at the node, data qubits are at the middle of the edges), the top/bottom boundaries are smooth and the left/right are rough.

My confusion starts when I switch to another way to represent surface code (I am much less familiar with it and I get easily confused) ( * ). I consider the way to represent patches as described in this paper. In the appendix, we have the following graph that provides the color-convention to define $$X$$ and $$Z$$ stabilizers. The stabilizer qubits are at the middle of the associated colored surface. The data qubits are at the node of the lattice.

Here, we cannot apply the previous definition as now some stabilizers have only two "legs". In this case I am a bit confused to know how the smooth/rough notions are defined (and in all papers I have read they seem to assume it is a known definition).

Is it defined from the construction of the logical $$X$$ and $$Z$$ operator on the boundaries? Ie, a smooth boundary is defined by a boundary where I can define my $$X$$ operator. A rough boundary is defined by a boundary where I can define my $$Z$$ operator. Is there a paper where there is a simple definition provided?

( * ) Technically speaking this is just a rotation of angle $$\pi/4$$ of the first representation where we additionally remove some qubits, see for instance this post to see the connection between the representations.

If I understood correctly Craig's slides, the $$X$$ and $$Z$$ boundaries would correspond as the red and purple data qubits shown below. We can also notice that some qubits will belong to both an $$X$$ and $$Z$$ boundary.

What confuses me is that in this paper, he doesn't do the same identification (see the image at the very bottom).

Does that mean that there are simply different definitions going on in the literature and I shouldn't pay too much attention to the terminology?

A more simple explanation would be that I basically misunderstood the answer =)

• youtu.be/fAcRsdAvhjc at 2:40-ish Daniel Litinski starts explaining X and Z logical boundaries as rough and and smooth - made me think of this question. Hope it helps. Commented Oct 17, 2022 at 13:26
• The paper may simply have a typo where Daniel accidentally drew different boundaries. The boundary diagram doesn't agree with the stabilizer configuration diagram. Commented Oct 26, 2022 at 16:05
• @CraigGidney Great! Good to know that there is a typo as it really confused me! Commented Oct 26, 2022 at 18:33
• @BalintPato thanks for the link! Commented Oct 27, 2022 at 13:08

• Thanks! Ok so from your definition a data qubit will belong to a $Z$ boundary if any pre-existing $Z$ excitation on the $X$-stabilizer this data qubit belongs to can be cancelled out without creating another new excitation, by applying a $Z$ excitation on this data qubit. From your definition I made the identifications of the boundaries associated to the zigzag pattern (see my edits). Could you tell me if you agree with it and if so, would you agree that there are different definitions going in the community? Maybe I simply misunderstood your explanation! Commented Oct 26, 2022 at 9:41
• and 3) Your definition of $Z$ boundaries seem to imply that the logical $Z$ can be defined as applying a $Z$ on each of the data qubits connecting these boundaries. Would you agree and is it always the case? My feeling is that we could have an equivalent definition of $Z$ boundaries by first defining the logical $Z$ on a boundary of the surface, and then identifying the two edges where it starts and stop. It would define the $Z$ boundary. Commented Oct 26, 2022 at 18:30