# 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. 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. Oct 26, 2022 at 16:05
• @CraigGidney Great! Good to know that there is a typo as it really confused me! Oct 26, 2022 at 18:33
• @BalintPato thanks for the link! Oct 27, 2022 at 13:08

I don't know if there's a paper that explains this well, but I've been working on slides to do it: https://docs.google.com/presentation/d/1IjZ-0W9Y22wNG5036WFnnkF5Az1Zt8jTHFTC1-e7Em4/edit?usp=sharing .

This probably isn't a complete classification, but the 5 things you run into in the surface code are the bulk, the two boundary types, domain walls, and twists: You can determine whether or not a boundary is present by checking if it's possibly to locally change the parity of the number of excitations of one type: • 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! Oct 26, 2022 at 9:41
• @MarcoFellous-Asiani Your edit is identifying locations where a single data error can introduce an odd number of excitations. That's a sufficient condition to identify X and Z boundaries, and in most situations it is also a necessary condition. You missed a corner circle in the top right. Oct 26, 2022 at 16:01
• Thanks. I unfortunately have other questions. 1) When you you say that my condition is sufficient but not necessary in general you mean that we could find examples in which "Z boundaries absorb Z excitations" would not imply that the sentence following "Thanks!" in my previous comment? Is there such an example in your slide? I don't find a counter example. 2) Would you say that the definition "Z boundaries absorb Z excitations" is uniformously spread in the community? Oct 26, 2022 at 18:30
• 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. Oct 26, 2022 at 18:30
• @MarcoFellous-Asiani For (1) it's just that the ground truth is excitation absorption, and any situation where that's possible is a boundary, even if it's not via a data error. It could be via a measurement error, for example. For (2) no I don't think it's well understood in the community, I think most people just know a few specific cases instead of the underlying logic. For (3) no that's not the case. For example, the toric code has no boundaries but it still has observables. Oct 26, 2022 at 18:37