# Why does fault-tolerant transversal phase gate $P$ only work with doubly-even codes?

I read in this topic that to get a fault-tolerant transversal relative phase gate of $$\pi/2$$ -- $$P$$ gate in the reference --, one has to select a CSS code which satisfies doubly-even distances.

I don't really get the reason of such a restriction. Indeed, it says verbatim:

Since the phase gate commutes with the Pauli $$Z$$ operator it is clear that all $$g_z$$ stabilizers are preserved. For any $$g_x$$, we have

$$P g_x P^\dagger = i^{w(g_x)} g_x g_z$$

where $$w(g_x)$$ is the weight of stabilizer $$g_x$$, i.e. the number of non-identity factors in it. Since $$C_2^\perp$$ is doubly-even, we see that

$$P g_x P^\dagger = g_x g_z$$

and thus $$P g_x P^\dagger \in S$$.

My observation is that even if $$i^{w(g_x)} g_x g_z \notin S$$, this is still equivalent, up to a global phase $$i^{w(g_x)}$$, to $$g_x g_z \in S$$.

As consequence, $$g_x g_z$$ can still be considered a stabilizer for $$P|\varphi\rangle$$. Allowing for any (self-dual) code, not only doubly-even ones.

Is my observation correct?

• You probably mean transversal, not just fault tolerant. Commented Mar 7, 2022 at 0:42
• I usually see an operator $U$ as fault-tolerant if this is transversal and such that $UsU^{\dagger} \in S$ for some stabilizer group $S$ of reference. So yes, I implicitly referred to transversal $P$ Commented Mar 7, 2022 at 6:50
• Yes but that doesn't cover all possible fault tolerant operations, such as operations done using code deformation. Those operations won't have the same constraints as transversal ones. Commented Mar 7, 2022 at 9:59

Claim: A CSS code $$CSS(H_X,H_Z)$$ has transversal phase gate $$P$$ if and only if every $$X$$ type stabilizer generator $$g_x$$ has one of the following two properties:

(1) $$wt(g_x)$$ is congruent to 0 mod 4 (doubly even) and $$g_z \in S_Z$$ (This case applies when $$H_X=H_Z$$ and more generally for all codes where $$H_X$$ is properly contained in $$H_Z$$, for example the $$[[15,1,3]]$$ quantum reed muller code)

or

(2) $$wt(g_x)$$ is congruent to 2 mod 4 (singly even) and $$-g_z \in S_Z$$

$$H_X$$ is the classical parity check matrix corresponding to the $$X$$ type stabilizer generators (which generate the $$X$$ stabilizers $$S_X$$) and $$H_Z$$ is the classical parity check matrix corresponding to the $$Z$$ type stabilizer generators (which generate the $$Z$$ type stabilizers $$S_Z$$).

Here $$g_z:=Hg_xH$$ is just $$g_x$$ with every $$X$$ replaced by a $$Z$$ ($$H$$ with no subscript is Hadamard).

$$H_X$$ is the classical parity check matrix corresponding to the $$X$$ type stabilizer generators (which generate the $$X$$ stabilizers $$S_X$$) and $$H_Z$$ is the classical parity check matrix corresponding to the $$Z$$ type stabilizer generators (which generate the $$Z$$ type stabilizers $$S_Z$$).

Proof of Claim: Suppose $$P$$ is transversal for $$CSS(H_X,H_Z)$$. In other words $$P^{\otimes n}$$ implements a logical operation. That is equivalent to saying that $$P^{\otimes n}$$ preserves the code space. Since this a stabilizer code that is equivalent to saying that $$P^{\otimes n}$$ is in the normalizer $$N(S)$$ of the code stabilizer $$S$$. Since $$CSS(H_X,H_Z)$$ is a CSS code then there exists a choice of stabilizer generators which are all either $$X$$ type Pauli operators or $$Z$$ type Pauli operators. $$P^{\otimes n}$$ certainly normalizes all the $$Z$$ type stabilizer generators, in fact it commutes with them. Thus $$P$$ is transversal if and only if for every $$X$$ type stabilizer generator $$g_x$$ we have $$(P^{\otimes n})g_x (P^{\otimes n})^\dagger \in S$$ As noted above $$P Z P^\dagger=Z \; , \; P X P^\dagger= iXZ$$ so we have $$(P^{\otimes n})g_x (P^{\otimes n})^\dagger=i^{wt(g_x)} g_x g_z$$ where $$g_z$$ is a $$Z$$ type Pauli operator obtained from the $$X$$ type Pauli operator $$g_x$$ by switching all the $$X$$s to $$Z$$s. Now we prove the first direction of the theorem. Suppose that $$P$$ is transversal. Then $$i^{wt(g_x)} g_x g_z \in S$$ for every $$X$$ type stabilizer $$g_x$$. Since $$g_x$$ is already in the stabilizer that implies $$i^{wt(g_x)} g_z \in S$$ Since elements of the stabilizer must have $$1$$ as an eigenvalue then $$wt(g_x)$$ must be even. Thus we have that either $$-g_z \in S$$ if $$g_x$$ is singly even or $$g_z \in S$$ if $$g_x$$ is doubly even.

For the reverse implication pick an arbitrary $$X$$ type generator $$g_x$$ then either (1) $$wt(g_x)$$ is congruent to 0 mod 4 (doubly even) and $$g_z \in S_Z$$ in which case $$(P^{\otimes n})g_x (P^{\otimes n})^\dagger=i^{wt(g_x)} g_x g_z=g_x g_z \in S$$ or (2) $$wt(g_x)$$ is congruent to 2 mod 4 (singly even) and $$-g_z \in S_Z$$ So $$(P^{\otimes n})g_x (P^{\otimes n})^\dagger=i^{wt(g_x)} g_x g_z=-g_x g_z \in S$$ And of course $$(P^{\otimes n})g_z (P^{\otimes n})^\dagger= g_z \in S$$ for any $$Z$$ type stabilizer generator $$g_z$$. So we indeed have that $$P^{\otimes n} \in N(S)$$

Corollary 1: If $$H_X$$ is contained in $$H_Z$$ and $$CSS(H_X,H_Z)$$ is doubly even then $$P$$ is transversal

This covers some interesting slightly less standard cases like the transversal $$P$$ for the $$[[15,1,3]]$$ code. Even more specifically,

Corollary 2: If $$H_X = H_Z$$ and $$CSS(H_X,H_Z)$$ is doubly even then $$P$$ is transversal

This is a pretty classic fact and is often stated in connection with the Steane $$[[7,1,3]]$$ code. This fact is stated, for example, here Transversal logical gate for Stabilizer (or at least Steane code) were it is further stated that for this special class of code transversal $$P$$ must implement either logical $$P$$ or logical $$P^\dagger$$.

The case (2) that I discuss above is quite unusual and doesn't come up in any well known examples that I am aware of. But its not hard to construct an ad hoc example like this $$[[6,2,2]]$$ code with stabilizer generators $$XXXXXX$$ and $$-ZZIIIII,-IIZZII,-IIIIZZ$$ For this $$[[6,2,2]]$$ code I think $$P^{\otimes 6}$$ implements some very strange 2 qubit gate like the negative of the controlled $$Z$$ gate or something.

It might help to think about what the logical states actually look like. Up to normalisation, the logical 0 is $$|0\rangle_L=\left(\prod_x(I+g_x)\right)|00\ldots 0\rangle.$$ Now, if you want a logical phase gate $$P$$, you need $$P|0\rangle_L=|0\rangle_L$$, but what you've managed to achieve is $$P|0\rangle_L=\left(\prod_x(I+i^{w(g_x)}g_x)\right)|00\ldots 0\rangle.$$ From this, you see that the factors $$i^{w(g_x)}$$ are not global phases, but relative phases. The only way this output is $$|0\rangle_L$$ is if $$i^{w(g_x)}=1$$ for all $$x$$.