Fault-tolerant operations for \(\left[\kern-0.15em\left[ {n,n - 2,2} \right]\kern-0.15em\right]\) codes

For even n, the \(\left[\kern-0.15em\left[ {n,n - 2,2} \right]\kern-0.15em\right]\) error-detecting code has stabilizers X⊗n and Z⊗n, and logical operators \(\bar X_j\) = X 1 X j+1 , \(\bar Z_j\) = Z j+1 Z n for j = 1, …, n − 2. This code, its symmetries, and methods of computing fault tolerantly on the encoded qubits were studied by Gottesman.8 However, his techniques require at least 2n extra qubits. For example, to apply a CNOT gate between two logical qubits in the same code block, he teleports them each into separate code block, applies transversal CNOT gates between the blocks, and then teleports them back.

We will give a fault-tolerant implementation of encoded CNOT and Hadamard gates on arbitrary logical qubits, using only two extra qubits. Two-qubit fault-tolerant procedures for state preparation, error detection, and projective measurement were given in Chao and Reichardt.10 For n ≥ 6 (so there are at least three encoded qubits), we will give a four-qubit fault-tolerant implementation of the encoded CCZ gate, thereby completing a universal gate set.

Permutation symmetries and transversal operations

Fault tolerance for a distance-two code means that any single fault within an operation should either have no effect or lead to a detectable error. For example, of course, the 4n−2 logical Pauli operators can all be applied fault tolerantly, since the operations do not couple any qubits.

All qubit permutations preserve the two stabilizers and therefore preserve the code space. They are also fault tolerant if implemented either by relabeling the qubits or by moving them past each other (and not by using two-qubit SWAP gates15). For i, j ∈ [n − 2], i ≠ j, the qubit swap (i + 1, j + 1) swaps the logical qubits i and j. The qubit swap (1, 2) implements logical CNOTs from qubits 2 through n − 2 into 1, and the qubit swap (2, n) implements logical CNOTs in the opposite direction:

Transversal Hadamard, H⊗n, followed by the qubit swap (1, n), implements logical H⊗(n−2).

The Clifford reflection G = \({\textstyle{i \over {\sqrt 2 }}}(X + Y)\) conjugates X ↔ Y and Z → −Z. Transversal G is a valid logical operation (up to Z n to correct the X⊗n syndrome if n = 2 mod 4). It implements logical CZ gates between all encoded qubits:

The operations given so far generate a group much smaller than the full (n − 2)-qubit Clifford group. The qubit permutations generate n! different logical operations (except for n = 4, just 6 operations). With the transversal application of the six one-qubit Clifford gates, up to Paulis, this gives 6(n!) different logical operations (or 36 for n = 4). Table 1 gives the sizes of various interesting subgroups of the Clifford group, for comparison.

Table 1 Sizes of the k-qubit Clifford group and subgroups Full size table

We next give fault-tolerant implementations for a logical Hadamard gate on a single encoded qubit, and for a logical CZ gate between two encoded qubits. These generate a large subgroup of the Clifford group, the \(\left\langle {{\mathrm{CNOT}},H} \right\rangle \) column in Table 1.

CZ gate

By Claim 2, a logical CZ 1,2 gate can be implemented by Z n CZ 2,3 CZ 2,n CZ 3,n :

(1)

However, this implementation is not fault tolerant. Some failures are detectable; for example, if the CZ 2,3 gate fails as XI, then the final, detectable error is X 2 Z n . Others are not, e.g., if the CZ 2,3 gate fails as XX, then the final X 2 X 3 = \(\bar X_1\bar X_2\) error is undetectable.

The bad faults that can cause undetectable logical errors are as follows:

CZ 2,3 CZ 2,n CZ 3,n Fault Error Fault Error Fault Error ZZ Z 2 Z 3 ZZ Z 2 Z n ZZ Z 3 Z n XX X 2 X 3 XY X 2 Z 3 Y n XX X 3 X n YY Y 2 Y 3 YX Y 2 Z 3 X n YY Y 3 Y n

In particular, all these bad faults are caught by the CZ gadget of Theorem. Therefore, replacing each physical CZ gate in Eq. (1) with that gadget gives a fault-tolerant implementation of a logical CZ 1,2 gate. The circuit uses at most two ancilla qubits at a time.

In fact, one can simplify the resulting circuit by using the same |0〉 ancilla to catch X faults on multiple CZ gates. The following circuit is also fault tolerant:

The gadgets to catch Z faults can be merged, too. The following circuit is fault tolerant, and still requires at most two ancilla qubits at a time:

(2)

Perhaps further simplifications are possible.

Targeted Hadamard gate

A single encoded Hadamard gate can also be implemented fault tolerantly with two extra qubits. The black portion of the circuit below, with , implements \(\bar H_1\). The red and blue portions, analogous to Fig. 2a, b, respectively, catch problematic faults. X measurements should return + and Z measurements 0.

(3)

The circuit’s fault tolerance can be verified by enumerating all the ways in which single gates can fail.

Fig. 2 CZ gadgets to catch correlated faults. a An extra qubit can be used to catch XX, XY, YX, and YY faults after the CZ gate. b A similar circuit catches ZZ faults. c In combination, these gadgets can catch all two-qubit correlated faults (see Methods) Full size image

Four-ancilla CCZ gate

For n ≥ 6, a CCZ gate on encoded qubits 1, 2, 3 can be implemented by round-robin CCZ gates on {2, n} × {3, n} × {4, n}, by Claim 2:

(4)

This circuit uses one Z, three CZ, and four CCZ gates. To make it fault tolerant, use the gadget from Fig. 2c for each CZ gate, and replace each CCZ with the gadget of Eq. (15). Overall, this requires four ancilla qubits.

Single gate faults are either caught by the gadgets or lead to an error that could also arise from a one-qubit fault between the gates in Eq. (4). A one-qubit X or Y fault will be detectable at the end because it is copied only to linear combinations of Zs—the X component of the final error will still have weight one—and a one-qubit Z fault will be detectable because it commutes through the CZ and CCZ gates. Therefore the procedure is fault tolerant.

Fault-tolerant operations for the \(\left[\kern-0.15em\left[ {15,7,3} \right]\kern-0.15em\right]\) Hamming code

The \(\left[\kern-0.15em\left[ {15,7,3} \right]\kern-0.15em\right]\) Hamming code is a self-dual CSS, perfect distance-three code. Packing seven logical qubits into 15 physical qubits, it is considerably more efficient than more commonly used \(\left[\kern-0.15em\left[ {7,1,3} \right]\kern-0.15em\right]\) and \(\left[\kern-0.15em\left[ {9,1,3} \right]\kern-0.15em\right]\) CSS codes, although it tolerates less noise.

We first give a presentation of the code and its symmetries following Harrington and Reichardt.16 Then, we give a two-ancilla-qubit method for fault-tolerantly implementing the full Clifford group on the encoded qubits, and, to complete a universal gate set, a four-qubit fault-tolerant encoded CCZ gate.

Two-qubit fault-tolerant procedures for state preparation and error correction were given in Chao and Reichardt.10

\(\left[\kern-0.15em\left[ {15,7,3} \right]\kern-0.15em\right]\) Hamming code

The \(\left[\kern-0.15em\left[ {15,7,3} \right]\kern-0.15em\right]\) Hamming code has four X and four Z stabilizers, each given by the following parity-checks:

$$\begin{array}{*{20}{c}} 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \cr 0 & 0 & 0 & 1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \cr 0 & 1 & 1 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 \cr 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 \end{array}$$ (5)

Index the qubits left to right from 1 to 15. Observe that the columns are these numbers in binary.

As in Harrington and Reichardt,16 we define logical operators based on the following seven weight-five strings:

$$\begin{array}{*{20}{c}} 1 & 1 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \cr 1 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 \cr 1 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 \cr 1 & 1 & 0 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 \cr 1 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 \cr 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 0 & 1 & 0 \cr 1 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 1 & 1 & 0 \end{array}$$ (6)

From the first string, \(\bar X_1\) = XXIXIIIXIIIIIIX and \(\bar Z_1\) = ZZIZIIIZIIIIIIZ. The remaining strings specify the logical operators \(\bar X_2\), \(\bar Z_2\) through \(\bar X_7\), \(\bar Z_7\). (Note that combinations of operators in Eq. (6), i.e., the last three, can have weight 3, which defines the code distance.)

Transversal operations

Transversal operations are automatically fault tolerant.

Transversal Pauli operators implement logical transversal Pauli operators. Indeed, transversal X, i.e., X⊗15, preserves the code and implements transversal logical X, i.e., X⊗7, on the code space, and similarly for Y and Z.

In fact, any one-qubit Clifford operator applied transversally preserves the code space and implements the same operator transversally on the encoded qubits. For example, since the logical operators are each self-dual, applying the Hadamard gates H⊗15 implements logical H⊗7.

Of course, since the code is CSS, transversal CNOT gates between two code blocks implement transversal logical CNOT gates on the code spaces. Furthermore, Paetznick and Reichardt17 shows that on three code blocks, transversal CCZ can be used to obtain a universal gate set. Here, however, we will consider only single code blocks and Clifford operations.

Permutation symmetries

Permutations of the qubits are also fault tolerant, either by physically moving the qubits or by relabeling them.

The code’s permutation automorphism group has order 20, 160, and is isomorphic to A 8 and GL(4, 2).16,18 It is generated by the following three 15-qubit permutations:

$$\begin{array}{l}\sigma _1 = (1,2,3)(4,14,10)(5,12,9)(6,13,11)(7,15,8)\cr \sigma _2 = (1,10,5,2,12)(3,6,4,8,9)(7,14,13,11,15)\cr \sigma _3 = (1,10,15,3,8,13)(4,6)(5,12,11)(7,14,9)\end{array}$$ (7)

These permutations fix the code space, but act nontrivially within it. The permutations σ 1 and σ 2 apply the respective permutations (1, 2, 3) and (3, 4, 5, 6, 7) to the seven logical qubits. Together, these generate the alternating group A 7 of even permutations.

The logical effect of σ 3 is not a permutation. It is equivalent to the following circuit of 24 CNOT gates, in which gates with the same control wire are condensed:

(8)

Thus, the first logical qubit is fixed, while for j ∈ {2, …, 7} and P ∈ {X, Y, Z}, P j is mapped to \(\left( {\mathop {\prod}

olimits_{j = 2}^7 {\kern 1pt} P_j} \right)P_{j + 1}\), wrapping the indices cyclically. This is a six-qubit generalization of a four-qubit operator studied in Gottesman8 [Sec. 6]. (Like permutations, this operation has the property of being a valid transversal operation on any stabilizer code.)

CZ circuits based on permutation symmetries

Any permutation symmetry of the code can be turned into a CZ automorphism (Fig. 3a):

Fig. 3 a If σ is a permutation automorphism for a self-dual CSS code, then applying CZ gates along its cycles fixes the code space (Claim 1). b The logical effect for CZ gates following the permutation σ 3 Full size image

Claim 1

For a self-dual CSS code, if σ is a qubit permutation that fixes the code space, then the circuit with a CZ gate from i to σ(i), for all i ≠ σ(i), fixes the code space up to Pauli Z corrections.

Proof. Z stabilizers commute with the CZ gates, so are preserved. An X stabilizer X S = \(\mathop {\prod}

olimits_{i \in S} {\kern 1pt} X_i\) is mapped to \(\mathop {\prod}

olimits_{i \in S} \left( {X_iZ_{\sigma (i)}Z_{\sigma ^{ - 1}(i)}} \right)\) = \( \pm X_SZ_{\sigma (S) \cup \sigma ^{ - 1}(S)}\). Up to sign, this is a stabilizer, since \(Z_{\sigma (S)}Z_{\sigma ^{ - 1}(S)}\) is a stabilizer.

For example, the physical circuit in Eq. (1) comes from the cyclic permutation (2, 3, n) of the \(\left[\kern-0.15em\left[ {n,n - 2,2} \right]\kern-0.15em\right]\) code.

Applying Claim 1 to σ 3 of Eq. (7), the two CZ gates for the cycle (4, 6) cancel out, leaving the gates (CZ 1,10 CZ 10,15 …CZ 13,1 )(CZ 5,12 CZ 12,11 CZ 11,5 )…. As shown in Fig. 3b, the effect is that of logical CZ gates following the cycle (2, 3, 4, 5, 6, 7).

Notice that the logical effect necessarily consists of encoded CZ gates, because logical Z operators are unchanged and logical X operators pick up Z components. Also, the map from Claim 1 is not a homomorphism from permutations into unitary circuits (as the circuits square to identity while the permutations may not).

CZ gates {8, 9} to {10, 11} and {12, 13} to {14, 15}

The permutation (6, 7)(8, 10, 9, 11)(12, 14, 13, 15) fixes the code, and under Claim 1 corresponds to the eight CZ gates of Fig. 4a. Figure 4b gives their logical effect.

Fig. 4 The physical CZ gates in a have the logical effect of b. c The circuit can be made fault tolerant by replacing the CZ gates with the gadgets from Fig. 2, and simplifying Full size image

Using Magma,19 we compute that the group generated by this operation, the permutations σ 1 , σ 2 , σ 3 , and transversal H has the same size as the \(\left\langle {{\mathrm{CNOT}},H} \right\rangle \) group on six qubits (about 1.001 · 1020). (Adding transversal G only triples the group size.) This hints that by working in a logical basis in which one qubit has \(\bar X\) = X⊗15 and \(\bar Z\) = Z⊗15 (operators fixed by the permutations and by Fig. 4a), perhaps arbitrary combinations of CNOT and H can be applied to the other six qubits. But no, only half the \(\left\langle {{\mathrm{CNOT}},H} \right\rangle \) group can be reached.

The circuit of Fig. 4a is not clearly fault tolerant. (For example, an XX fault after the CZ 9,11 gate gives the error X 9 X 11 , which is indistinguishable from X 2 .) We can use the gadgets from Fig. 2 for each CZ gate to obtain the circuit of Fig. 4c, shown with the trailing error correction. Two ancilla qubits are needed.

We claim that this compiled circuit is fault tolerant. This means that if the input lies in the code space, the compiled circuit has at most one fault (a two-qubit Pauli fault after a gate, or a one-qubit fault on a resting qubit), and the subsequent error correction is perfect; then the final outputs lie in the code space with no logical errors. To verify fault tolerance, there are two cases to check.

First, consider the case that, with at most one fault, all the gadget measurements give the trivial output (0 for a Z measurement, + for X). Since the gadgets catch two-qubit gate faults, we need to only check possible one-qubit faults between gates. Inequivalent fault locations are marked with stars in Fig. 4c. (Faults at other locations either cause the same errors, or will be caught.) In particular, entering error correction the possible error can be 1, X 1 , Z 1 , Y 1 , …, X 15 , Z 15 , Y 15 —from the locations. Or, from locations, it can be XIZZ, YIZZ, IXZZ, IYZZ, ZZXI, ZZYI, ZZIX, ZZIY, and IZXI, IZYI, IZIX, IZIY from locations, on qubits 8, 9, 10, 11—and similarly for qubits 12 to 15. This gives 70 different errors total. All 70 have distinct syndromes, and therefore can be corrected. (This fact can be verified either by computing all the syndromes, or by observing from Eq. (5) that Z 8 Z 9 Z 10 Z 11 , Z 12 Z 13 Z 14 Z 15 , Z 1 Z 6 Z 7 , Z 1 Z 8 Z 9 , Z 1 Z 12 Z 13 , and Z 1 Z 14 Z 15 are logical operators. Thus, for example, if you observe the Z syndrome 1000, for error X 8 , and the X syndrome 0001, for error Z 1 , you can safely correct X 8 Z 10 Z 11 . Z 1 X 8 cannot occur.)

Note that the error-correction procedure needs to take into account the X and Z stabilizer syndromes together to decide what correction to apply. This can work because the \(\left[\kern-0.15em\left[ {15,7,3} \right]\kern-0.15em\right]\) code is not a perfect stabilizer code: there are 28 possible syndromes but only 1 + 15 · 3 possible trivial or weight-one errors. (It is only perfect as a CSS code, i.e., the 24 Z stabilizer syndromes are exactly enough to correct the 1 + 15 possible trivial or weight-one X errors, and similarly for Z errors.) This leaves room to correct some errors of weight more than one.

Next, consider the case that, with at most one fault in Fig. 4c, one or more of the gadget measurements gives a nontrivial output. This case is much simpler, because the measurement results localize the fault, leaving only a few possibilities for the error entering error correction. One must verify that in all cases, these possibilities are distinguished by their syndromes.

For example, if the first Z measurement returns 1 and all other measurements are trivial, the errors from single faults that can occur are, on qubits 8, 9, 10, 11:

$$\begin{array}{*{20}{r}} \hfill {IIII,} & \hfill {ZIII,} & \hfill {XIII,} & \hfill {YIII,}\cr \hfill {XIIZ,} & \hfill {YIIZ,} & \hfill {XIZZ,} & \hfill {YIZZ,}\cr \hfill {XZIX,} & \hfill {XZIY,} & \hfill {XZXZ,} & \hfill {XZYZ,}\cr \hfill {YZIX,} & \hfill {YZIY,} & \hfill {YZXZ,} & \hfill {YZYZ}\end{array}$$

These 16 possible errors all have distinct syndromes, so they are correctable.

As another example, if the last two measurements, of qubits coupled to qubit 13, are nontrivial, then the possible errors from single faults are, on qubits 12, 13, 14, 15:

$$IXII,IYII,IXIZ,IYIZ,IXIX,IXIY$$

Again, these have distinct syndromes.

Other possible measurement outcomes are similar. We have used a computer to check them all.

Round-robin CZ circuits to complete the Clifford group

The above operations do not generate the full seven-qubit logical Clifford group, and we have not been able to find a permutation for which applying Claim 1 enlarges any further the generated logical group. Instead, we turn to the round-robin construction of Claim 2.

CZ gates 4 to {5, 6, 7}, 8 to {9, 10, 11}, and 12 to {13, 14, 15}

Observe that Z {4,8,12} and Z {4,5,6,7} ~ Z {8,9,10,11} ~ Z {12,13,14,15} are logical operators, implementing respectively \(\bar Z\) {2,5,7} and \(\bar Z\) {1,2,3,4} . By a minor extension of Claim 2, applying Z {4,8,12} and nine CZ gates from 4 to each of qubits {5, 6, 7}, 8 to {9, 10, 11}, and 12 to {13, 14, 15} preserves the code space. The logical effect is

(9)

Together with permutations and transversal operations, this circuit completes the seven-qubit Clifford group, without needing the operation from Fig. 4. To make the operation fault tolerant, we will transform it in three steps.

First, consider the circuit below, in which we have wrapped the CZ gates leaving qubits 4, 8, and 12 with overlapping gadgets to catch X faults. If at most one fault occurs and one or more of the Z measurements gives 1, then the errors that can occur are distinguished by their syndromes.

(10)

For example, if the orange, first Z measurement off qubit 4 gives 1 and all others 0, then the possible errors entering error correction are, on qubits 4, 5, 6, 7:

$$\begin{array}{*{20}{r}} \hfill {IIII,} & \hfill {ZIII,} & \hfill {} & \hfill {}\cr \hfill {XIZZ,} & \hfill {XXZZ,} & \hfill {XYZZ,} & \hfill {XZZZ,}\cr \hfill {YIZZ,} & \hfill {YXZZ,} & \hfill {YYZZ,} & \hfill {YZZZ}\end{array}$$

All these errors have distinct syndromes.

The circuit in Eq. (10) is not fault tolerant, however, because with at most one fault if all the Z measurements give 0, some inequivalent errors will have the same syndrome. We can list the problematic errors. For each of the following sets, the errors within the set are all possible, but have the same syndrome:

$$\begin{array}{*{20}{c}} {\left\{ {Z_1,Z_4Z_5,Z_8Z_9,Z_{12}Z_{13}} \right\}} \cr {\left\{ {Z_2,Z_4Z_6,Z_8Z_{10},Z_{13}Z_{14}} \right\}} \cr {\left\{ {Z_3,Z_4Z_7,Z_8Z_{11},Z_{12}Z_{15}} \right\}} \cr {\left\{ {X_4,Y_4Z_5Z_6Z_7} \right\},\left\{ {Y_4,X_4Z_5Z_6Z_7} \right\}} \cr {\left\{ {X_8,Y_8Z_9Z_{10}Z_{11}} \right\},\left\{ {Y_8,X_8Z_9Z_{10}Z_{11}} \right\}} \cr {\left\{ {X_{12},Y_{12}Z_{13}Z_{14}Z_{15}} \right\},\left\{ {Y_{12},X_{12}Z_{13}Z_{14}Z_{15}} \right\}} \end{array}$$ (11)

Next, replace each of the blue CZ gates in Eq. (10) with the ZZ fault gadget from Fig. 2b. This gadget has the property that, with at most one failure, a ZZ fault can only occur if the X measurement returns −. These measurements thus distinguish the errors in the first three sets above.

Yet the new circuit is still not fault tolerant. The gadget measurements cannot distinguish the errors in each of the last six sets in Eq. (11). For example, consider an X 4 error before the circuit. It propagates to X 4 Z 5 Z 6 Z 7 . Since Z 4 Z 5 Z 6 Z 7 is a logical error, X 4 Z 5 Z 6 Z 7 is indistinguishable from a Y 4 error after the circuit, and no error-correction rules can correct for the possible logical error.

Gadgets cannot protect against single-qubit faults that occur just before or after the circuit. This circuit is qualitatively different from the one we considered in Fig. 4, and a new trick is needed to make it fault tolerant.

Consider the following circuit from Chao and Reichardt,10 ignoring for now the orange portion at the top right:

(12)

This circuit fault-tolerantly extracts the syndrome of the Z {4,5,6,7,12,13,14,15} stabilizer, in the sense that

With no gate faults, the Z measurement gives the syndrome, and the X measurement gives +.

With at most one fault, if the X measurement gives +, then the data error has weight ≤1.

With at most one fault, if the X measurement gives −, then the X component of the data error has weight ≤1. The Z component can be any of

$$\begin{array}{*{20}{c}} {Z_4,Z_{\{ 4,5\} },Z_{\{ 4,5,6\} },Z_{\{ 4,5,6,12\} },Z_{\{ 4,5,6,7,12\} }\sim Z_{\{ 13,14,15\} },} \cr {Z_{\{ 4,5,6,7,12,14\} }\sim Z_{\{ 13,15\} },Z_{\{ 4,5,6,7,12,13,14\} }\sim Z_{15},{\mathbf{1}}} \end{array}$$

and all these errors have distinct syndromes. (The order of the CNOT gates ensures this property.)

In Chao and Reichardt,10 this circuit was used in a two-ancilla-qubit fault-tolerant error-correction procedure.

The circuit in Eq. (12) is useful for us now to detect an X 4 or Y 4 error on the input to Eq. (10). However, it is not enough to measure the Z syndrome, or even to run the full error correction, before applying the circuit (10), because an X 4 or Y 4 fault could happen after the syndrome measurement completes and before Eq. (10). This problem is solved by the orange portion of Eq. (12), which is meant to continue into Eq. (10), replacing the first \(\left| 0 \right\rangle \) preparation and CNOT. It gives qubit 4 temporary protection, so that an X 4 or Y 4 fault is caught by either the syndrome measurement or the orange Z measurement, or both.

While the above arguments give intuition for the construction, they leave out the details. Let us now present the full fault-tolerant construction.

1. Start by applying Eq. (12) to extract the syndrome for Z {4,5,6,7,12,13,14,15} . If the Z or X measurement is nontrivial, then decouple the orange qubit with another CNOT, apply error correction, and finish by applying unprotected CZ gates 4 to {5, 6, 7}, 8 to {9, 10, 11}, and 12 to {13, 14, 15}. (This is safe because one fault has already been detected.) 2. Next, if the Z and X measurements were trivial, apply the top third of circuit (10), where the orange qubit wire continues from Eq. (12), to implement protected CZ gates 4 to {5, 6, 7}. If any measurements are nontrivial, then finish by applying unprotected CZ gates 8 to {9, 10, 11} and 12 to {13, 14, 15}, then error correction. We have already argued that this is fault tolerant; the extended orange “flag” is enough to catch X 4 or Y 4 faults between Eqs. (12) and (10). 3. If the measurements so far were trivial, then apply a circuit analogous to Eq. (12) to extract the Z {8,9,10,11,12,13,14,15} syndrome. (Note that this is still a stabilizer, even though the CZ gates 4 to {5, 6, 7} have changed the code.) If the Z syndrome or X measurement is nontrivial, then apply error correction—a simple error-correction procedure is to apply CZ gates 4 to {5, 6, 7} to move back to the \(\left[\kern-0.15em\left[ {15,7,3} \right]\kern-0.15em\right]\) code and correct there—before finishing with CZ gates 8 to {9, 10, 11} and 12 to {13, 14, 15}. If the Z and X measurements were trivial, then apply the middle portion of Eq. (10), where the orange qubit wire extends from qubit 8, to implement protected CZ gates 8 to {9, 10, 11}. If any measurements are nontrivial, then finish by applying unprotected CZ gates from 12 to {13, 14, 15}, and then error correction. 4. If the measurements so far were trivial, then extract the Z {8,9,10,11,12,13,14,15} syndrome using Eq. (12) except with the data qubits in order 12, 13, 14, 15, 8, 9, 10, 11 top to bottom (so that the orange flag attaches to qubit 12). If the Z or X measurement is nontrivial, then with at most one fault whatever error there is on the data can be corrected. (The easiest way is to move forward to the \(\left[\kern-0.15em\left[ {15,7,3} \right]\kern-0.15em\right]\) code using CZ gates 12 to {13, 14, 15} and correct there. Note that these CZ gates turn the weight-one errors X 12 , X 13 , X 14 , X 15 into X 12 Z {13,14,15} , Z 12 X 13 , Z 12 X 14 , Z 12 X 15 , respectively, but these can still be corrected; e.g., if in X error correction you detect X 12 , apply the correction X 12 Z {13,14,15} .) If the Z and X measurements were trivial, then apply the bottom portion of Eq. (10) to implement protected CZ gates from 12 to {13, 14, 15}, and correct the errors based on the measurement results.

Observe that this procedure requires two ancilla qubits.

Four-qubit fault-tolerant CCZ for universality

In order to realize a universal set of operations on the seven encoded qubits, we give a four-ancilla-qubit fault-tolerant implementation for an encoded CCZ gate. The idea is to start with a circuit of round-robin CCZ gates to implement the encoded CCZ non-fault-tolerantly (Claim 2), and then replace each CCZ with the gadget of Eq. (15) to catch correlated errors. Finally, we intersperse X error-correction procedures to catch X faults before they can spread, much like the pieceable fault-tolerance constructions of Yoder et al.11 except on a single code block. (A similar approach can also be used to implement encoded CZ gates.)

By Claim 2, an encoded CCZ gate can be implemented by round-robin CCZ gates on qubits {1, 4, 5} × {1, 6, 7} × {1, 8, 9} (one Z, six CZ, and 21 CCZ gates):

(13)

To make this circuit fault tolerant, first replace each CZ gate with the gadget from Fig. 2c, and replace each CCZ gate with the gadget from Eq. (15). After each gadget, apply X error correction, and at the end apply both X and Z error correction. (As in Yoder et al.,11 it might be possible to put multiple CCZ gadgets before each X error correction, but we have not tried to optimize this.) Observe that X error correction can be implemented even partially through the round-robin circuit because the code’s Z stabilizers are preserved by CCZ gates.

There are two cases to consider to demonstrate fault tolerance: either a gadget is “triggered” with a nontrivial, 1 or −, measurement outcome, or no gadgets are triggered.

1. A gadget is triggered. If a gadget is triggered, then any Pauli errors can be present on its output data qubits. It is straightforward to check mechanically that for each CZ gate in Eq. (13), all four possible X errors, II, IX, XI, and XX, have distinct Z syndromes, and so can be corrected immediately in the subsequent X error correction, before the errors can spread. By symmetry, the four possible Z errors have distinct syndromes. These errors commute through Eq. (13) and are fixed by the final Z error correction. Similar considerations hold for each CCZ gate: the possible X and Z error components have distinct syndromes, so an error’s X component can be corrected immediately and the Z component corrected at the end. 2. No gadgets are triggered. If there is a single failure in a CZ or CCZ gadget, but the gadget is not triggered, then the error leaving the gadget is a linear combination of the same Paulis that could result from a one-qubit X, Y, or Z fault before or after the gadget.

If the error has no X component, then as a weight-one Z error it commutes to the end of Eq. (13), at which point Z error correction fixes it.

If the error has X component of weight one, then the Z component can be a permutation of any of III, IIZ, IZZ, ZZZ on the three involved qubits (or of II, IZ, ZZ for a CZ gadget). As we have already argued, these Z errors have distinct X syndromes. The X error correction immediately following the gadget will catch and correct the error’s X component, keeping it from spreading. The final Z error correction, alerted to the X failure, will correct the error’s Z component.

Remarks

Space-saving techniques for fault-tolerant quantum computation should be useful both for large-scale quantum computers and for nearer-term fault-tolerance experiments. Our techniques can likely be optimized further, and adapted to experimental model systems—but it might also be useful to relax the space optimization and allow a few more qubits, especially when memory error rates are comparable to those of physical gates and thus parallelization is desirable.

The techniques can also likely be applied to other codes, especially distance-three CSS codes. The round-robin CZ and CCZ constructions apply to some non-CSS codes, such as the \(\left[\kern-0.15em\left[ {8,3,3} \right]\kern-0.15em\right]\) code, but then they are more difficult to make fault tolerant. It is an interesting open problem to devise fault-tolerant flag gadgets for unitary gates (rather than CZ or CCZ), whose universality is more efficient than that of orthogonal gates.