# What are the transversal gates of Shor's $[\![9,1,3]\!]$ code?

What are the transversal gates of Shor's $$[\![9,1,3]\!]$$ code?

Since this is a stabilizer code we have transversal Pauli gates. Indeed, transversal $$X^{\otimes 9}$$ implements logical $$\overline Z$$ and transversal $$Z^{\otimes 9}$$ implements logical $$\overline X$$. And since it is a CSS code then transversal $$CNOT$$ implements logical $$CNOT$$. See for example this question.

Are there any others?

I am primarily interested in other single qubit gates that are transversal for a single block of the code. But I would also be very curious to see any two qubit gates which are transversal for two blocks of the code (and higher for three blocks of the code etc...).

Side note: It is interesting to note that if one would rather have transversal $$X^{\otimes 9}$$ implement logical $$\overline X$$ and $$Z^{\otimes 9}$$ implement logical $$\overline Z$$ then one can take the image of $$[\![9,1,3]\!]$$ code under $$H^{\otimes 9 }$$. For this new code, obtained by just swapping all the $$X$$s and $$Z$$s in the stabilizer, the logical states are just the old logical states but with every $$|0>$$ made into a $$|+>$$ and every $$|1>$$ made into a $$|->$$.

LONG DIGRESSION ABOUT TRANSVERSAILITY, A RESPONSE TO A COMMENT, NOT PART OF THE QUESTION :

There are a lot of of definitions of transversal gate floating around. But there are only two definitions that tend to be of interest to more mathematically inclined people. The first is a very strict equivariance condition where we say $$G^{\otimes n}$$ is transversal on an $$[\![n,1,d]\!]$$ code if it implements logical $$G$$. The second, more widely used but often equivalent to the first in many examples of interest thus leading to a lot of confusion, is that a transversal gate is any gate of the form $$\otimes_{i=1}^n G_i$$ which implements any logical gate. For a stabilize code with stabilizer $$S$$ that is equivalent to saying that $$\otimes_{i=1}^n G_i$$ is in the normalizer of $$S$$. In other words, the transversal gates are the normalizer of $$S$$ in the group which is called $$\mathcal{T}:=\otimes_{i=1}^n U_2$$ " the group of unitary product operators" in the original paper of Eastin and Knill. Here $$U_2$$ is the $$2 \times 2$$ unitary group. Eastin-Knill call this normalizer $$\mathcal{G}:=N_{\mathcal{T}}(S)$$ "the group of logical product operators" again using notation and terminology of original Eastin-Knill. (here note that I have already specialized to stabilizer codes so I can write things in terms of $$S$$ and normalizers of $$S$$ etc... whereas Eastin-Knill work with generic codes so they cannot). Since elements of the normalizer which only differ by an element of the stabilizer have the same logical effect the note groups of transversal logical operators "logical product operators" is less redundantly thought of as $$N_{\mathcal{T}}(S)/S$$ here it is worth noting that the normalizer also includes all the global phase operators which we should really also mod out by since they do nothing.

Another annoying thing people do is say things like "transversal X" to mean $$X^{\otimes n}$$ without first establishing if this unitary product operator actually preserves the code space. For example I do that annoying thing several times in the second paragraph of my question above.

Anyway this is all to say that "transversal" at its broadest means "any physical gate which implements a logical gate and is naturally fault-tolerant". But that is very squishy definition. To most mathematically inclined people "transversal" means "any physical gate which implements a logical gate and is a unitary product operator (i.e. an element of $$\mathcal{T}$$). This is the sense in which I asked the question and in which Adam Zalcman answered. At its strictest, "transversal" means "a logical gate $$G$$ which can be implemented by acting one copy of $$G$$ on each physical qubit".

This very strict definition $$G \to G^{\otimes n}$$ is nice mathematically because it is just an equivariance condition for the encoding map. Also this is how we often see transversal gate come up in practice. Let $$CSS(C_1,C_2)$$ be as CSS code. For example transversal $$CNOT$$ on two blocks of any $$[\![n,1,d]\!]$$ CSS code satisfies this strict equivariance condition. The same is true for a Hadamard gate on an $$[\![n,1,d]\!]$$ CSS code with $$C_1=C_2$$ (this is sometimes call a self-dual CSS code although perhaps better to call this weakly self-dual). Since many of us get our intuition from $$X,Z,H,CNOT$$ on $$[\![7,1,3]\!]$$ code, it is understandable to be confused about these two definitions of transversality.

Some well known example where they differ is transversal Paulis for Shor code and another good example is that transversal $$T$$ gate on $$[\![15,1,3]\!]$$ implements logical $$T^\dagger$$ and transversal phase $$P$$ gate on $$[\![7,1,3]\!]$$ implements logical $$P^\dagger$$.

Also note that most of what I've said here is for $$[\![n,1,d]\!]$$ codes and thus transversality for single qubit gates. For transversal $$2$$ qubit gates like $$CNOT$$ on the Steane code one can think of 2 block as a $$[\![14,2,3]\!]$$ code with $$CNOT^{\otimes 7}$$ implementing logical $$CNOT$$.

• No transversal $H$ or $CZ$ gates are possible. Also the code is not doubly even, so no $P$ gate either. There could be more "exotic" gates that would work but I didn't try to look. Jul 1, 2022 at 17:26

## Superpositions are too entangled

The logical computational basis of Shor's $$9$$-qubit code is

\begin{align} |0\rangle_L&=\frac{(|000\rangle+|111\rangle)(|000\rangle+|111\rangle)(|000\rangle+|111\rangle)}{\sqrt{8}}\\ |1\rangle_L&=\frac{(|000\rangle-|111\rangle)(|000\rangle-|111\rangle)(|000\rangle-|111\rangle)}{\sqrt{8}}. \end{align}\tag1

The first three qubits in $$|0\rangle_L$$ and $$|1\rangle_L$$ are not entangled with the rest. However, in any logical superposition state $$\alpha|0\rangle_L+\beta|1\rangle_L$$ the first three qubits are entangled with the rest. Since entanglement cannot be created by transversal gates, we conclude that transversal gates cannot create superpositions of $$|0\rangle_L$$ and $$|1\rangle_L$$. Consequently, the single-qubit unitary effected on the code subspace by a transversal gate takes one of two forms

$$\overline A\equiv\begin{bmatrix}1&0\\0&e^{i\theta}\end{bmatrix}\quad \overline B\equiv\begin{bmatrix}0&1\\e^{i\theta}&0\end{bmatrix}\tag2$$

where $$\equiv$$ denotes equality up to global phase. Note that this encompasses all logical Pauli operators, $$\overline I$$, $$\overline X$$, $$\overline Y$$ and $$\overline Z$$, as expected.

## Concatenated code

We can view Shor's $$9$$-qubit code as the concatenation of distance-$$3$$ bit-flip repetition code $$|0\rangle_K=|000\rangle$$, $$|1\rangle_K=|111\rangle$$ and distance-$$3$$ phase-flip repetition code $$|0\rangle_L=|{+\!+\!+}\rangle_K$$, $$|1\rangle_L=|{-\!-\!-}\rangle_K$$, so that $$(1)$$ may be rewritten as \begin{align} |0\rangle_L&=|{+\!+\!+}\rangle_K = \frac{((|000\rangle+|111\rangle)(|000\rangle+|111\rangle)(|000\rangle+|111\rangle)}{\sqrt{8}}\\ |1\rangle_L&=|{-\!-\!-}\rangle_K = \frac{((|000\rangle-|111\rangle)(|000\rangle-|111\rangle)(|000\rangle-|111\rangle)}{\sqrt{8}}. \end{align}\tag3

## Transversal gates in repetition codes

Now, consider the transversal gates of the bit-flip repetition code. Clearly, any gate that permutes the computational basis states, such as Toffoli, CNOT and Pauli $$X$$, can be applied transversally. Also, any diagonal gate that multiplies each computational basis state by a scalar phase factor can also be achieved by transversally applying the physical diagonal gate that multiplies each computational basis state by a scalar phase factor (for example, with a third of the phase angle). Thus, all "phased permutation gates" are transversal in the bit-flip repetition code. Note that these are exactly the gates that do not create superpositions in the computational basis.

Conversely, any gate that creates a superposition in the computational basis introduces states other than $$|000\rangle$$ and $$|111\rangle$$ and hence takes some logical states out of the code subspace. We conclude that the set of transversal gates in the bit-flip repetition code consists of all phased permutation gates. In particular, the group of single-qubit transversal gates is generated by $$Z$$ rotations $$R_Z(\theta)$$ and the Pauli $$X$$ gate.

By symmetry, the set of gates transversal in the phase-flip repetition code consists of all gates that do not create superpositions in the $$|+\rangle$$, $$|-\rangle$$ basis. In particular, the group of single-qubit transversal gates is generated by $$X$$ rotations $$R_X(\theta)$$ and the Pauli $$Z$$ gate.

## Transversal gates in Shor's $$9$$-qubit code

Finally, the gates transversal in Shor's $$9$$-qubit code are precisely the gates that are transversal in the phase-flip repetition code and whose components on each of the three qubit sub-block are transversal in the bit-flip repetition code. These are the gates that do not create superpositions in the computational basis or in the $$|+\rangle$$, $$|-\rangle$$ basis, such as CNOT. In particular, the group of single-qubit transversal gates is the Pauli group.

• Why is $\bar U=U_1 U_2 U_3,U_4 U_5 U_6,U_7 U_8 U_9$? shouldn't the same gate be applied to every qubit? so $U_1=U_2=U_3,\cdots$; Jul 3, 2022 at 15:03
• @unknown There are a lot of of definitions of transversal gate floating around. But there are only two definitions that tend to be of interest to more mathematically inclined people. The first is a very strict equivariance condition where we say $G^{\otimes n}$ is transversal on an $[[n,1,d]]$ code if it implements logical $G$. The second, more widely used but often equivalent to the first in many examples of interest thus leading to a lot of confusion, is that a transversal gate is any gate of the form $\otimes_{i=1}^n G_i$ which implements any logical gate. I'll edit to add details Jul 3, 2022 at 18:29
• it makes a huge difference in the search space $8$ vs $8^9$. Jul 3, 2022 at 18:59
• @unknown Even-distance surface code would be one example. Another can be constructed from the above answer by replacing three groups of three qubits with four groups of four qubits. Jul 4, 2022 at 3:44
• Oh wow the new version is so much shorter! Oct 19, 2022 at 18:35

The code is not symmetric in $$X$$ and $$Z$$ type stabilizers $$|S_X|=6$$ and $$|S_Z|=2$$; so $$H_L=H^{\otimes 9}$$ doesn't preserve the codespace and you can't have a transversal $$H_L$$.

$$U=H P$$ is transversal where $$P=((1,0),(0,\imath))$$;

$$U^\dagger Z U=\imath Z X$$; $$U^\dagger X U=Z$$;

$$U X U^\dagger=\imath X Z$$; $$U Z U^\dagger=X$$;

$$U^{\otimes 9} : Z_L \to X_L, X_L \to \imath^9 X_L Z_L$$ which is $$U_L^\dagger$$.

Correction to answer : even though $$U=HP$$ has the right action on the logicals, it doesn't preserve the codespace so it's not transversal.

• First of all thank you for your excellent answer to some of my other questions for example:quantumcomputing.stackexchange.com/questions/26701/… and quantumcomputing.stackexchange.com/questions/27134/…. You are an intelligent and generous person. Second of all, your claim that $HP$ is transversal is wrong. Here is my reasoning: Conjugation by $HP$ does not preserve that code space because it does not preserve the stabilizer. Jul 3, 2022 at 1:17
• Indeed acting by conjugation on, for example, $ZZIIIIIII$ yields $XXIIIIIII$ which is clearly not in the stabilizer since it does not commute with $IZZIIIIII$. Your argument about preserving logical Paulis $X_L$ and $Z_L$ is not valid because there are many representatives of the logical Paulis ( the logical Pauli group for stabilizer code with stabilizer $S$ is given by $N(S)/S$). Some choices of logical Pauli are transformed under conjugation as you say, such as $XXXXXXXXX$ and $ZZZZZZZZZ$, but other logical operators like $ZIIZIIZII$, which is a logical $X_L$ Jul 3, 2022 at 1:33
• you're right...I totally missed that even though it's obvious...(and you're being very generous...I'm just learning like everyone else) Jul 3, 2022 at 1:35
• transform to something which is not even in the stabilizer. And no problem this kind of stuff happens to everyone! Jul 3, 2022 at 1:36