Synthesis of CNOT-Dihedral circuits with optimal number of two qubit gates

In this note we present explicit canonical forms for all the elements in the twoqubit CNOT-Dihedral group, with minimal numbers of controlled-S (CS) and controlled-X (CX) gates, using the generating set of quantum gates [X,T,CX,CS]. We provide an algorithm to successively construct the n-qubit CNOT-Dihedral group, asserting an optimal number of controlled-X (CX) gates. These results are needed to estimate gate errors via nonClifford randomized benchmarking and may have further applications to circuit optimization over fault-tolerant gate sets.


Introduction
Randomized Benchmarking (RB) [23][24][25] is a well-known algorithm that provides an efficient and reliable experimental estimation of an average error-rate for a set of quantum gate operations, by running sequences of random gates from the Clifford group that should return the qubits to the initial state. RB techniques are scalable to many qubits since the Clifford group can be efficiently simulated (in polynomial time) using a classical computer [1,10,20,27]. RB can also be used to characterize specific interleaved gate errors [26], coherence errors [28,31] and leakage errors [32]. RB methods were generalized to certain single qubit non-Clifford gates, like the T -gate [12]. In [14] the authors presented a scalable RB procedure to benchmark important non-Clifford gates, such as the controlled-S gate and controlled-controlled-Z gate, which belong to a certain group called the CNOT-Dihedral group.
Certain CNOT-Dihedral groups have two key Shelly Garion: shelly@il.ibm.com Andrew W. Cross: awcross@us.ibm.com characteristics in common with the Clifford group. First, these groups have elements with concise representations that can be efficiently manipulated [4,14]. Second, these groups are the set of transversal (fault-tolerant) gates for certain quantum error-correcting codes [6,7,9,19,22,34]. Since the Clifford gates together with the T gate form a universal set of gates, there are many papers aiming to optimize the number of T gates [11,18,21,29,30]. Additional methods aim to minimize the count of controlled-X (CX) gates in universal circuits [33], and in particular, in controlled-X-phase circuits [3,15]. In addition, as the Clifford gate together with the controlled-S (CS) gate also forms a universal set of gates, an algorithm has recently been introduced to construct a circuit with an optimal number of CS gates given a two-qubit Clifford+CS operator [17]. Another example is the controlledcontrolled-Z gate, which is equivalent to the Toffoli gate (up to single qubit gates), that can be decomposed into 6 CX gates and single qubit gates, but requires only 5 two-qubit gates in its decomposition if the CS and CS −1 gates are also available [5].
It is therefore important to efficiently present the elements in the CNOT-Dihedral group using a minimal number of physical basic gates, in particular, two-qubit gates like the controlled-X (CX) and controlled-S (CS) gates.
Recall that X is the Pauli gate defined as Fix an integer m and define T (m) = 1 0 0 e 2πi/m By abuse of notation we will denote T = T (m), although the T gate is usually defined as T (8) = 1 0 0 e 2πi/8 . The single-qubit Dihedral group is generated by the X and T = T (m) gates (up to a global phase) and contains 2m elements, (1) More generally, the CNOT-Dihedral group on n qubits G = G(m) is generated by the gates X, T = T (m) and controlled-X (CX), up to a global phase (see [14] for details), where the controlled-X (CX) gate is defined as When m is not a power of 2, the group G = G(m) has double exponential order as a function of the number of qubits n. In the special case when m is a power of two, the group is only exponentially large and we can represent its elements efficiently (see [14]). Elements of G(m) belong to level log 2 m of the Clifford hierarchy when m is a power of two [19,22] and this is related to the fact that they are the transversal gates of certain m-dimensional quantum codes [7].
Again, by abuse of notation we denote S = The controlled-S (CS) gate belongs to G and can be written as where T i T j means the tensor product T i ⊗ T j . In the case where m = 8, the CS gate is less expensive to physically implement than one CX gate 1 which makes it an alternative to CX for improving circuit decompositions.
We focus on the case where n = 2. The following two Theorems provide canonical forms for all the elements in the two-qubit CNOT-Dihedral group, such that the numbers of CS and CX gates are optimal. This is analogous to the description in [13] of the elements in the two-qubit Clifford group. Theorem 1. Consider the CS-Dihedral subgroup on two qubits, namely the two-qubit group generated by the gates X, T = T (m) and CS (controlled-S), where S = T 2 , and denote d = gcd(m, 2). Then this group has 4m 3 d = m d (2m) 2 elements of the following form: Theorem 2. Let G be the two-qubit CNOT-Dihedral group generated by the gates X, T = T (m), CX and CS, where S = T 2 , and denote d = gcd(m, 2). Then this group has 24 · m 3 /d elements, divided into the following four classes.
1. The first class is the CS-Dihedral subgroup described in Theorem 1 and has 4m 3 d elements, that can be written with no CX gates.
2. The second class, called the CX-like class, consists of 8m 3 d = 2 · m d · (2m) 2 elements, and contains all the elements of the following form, which require exactly one CX gate.
The third class, called the Double-CX-like class, consists of 8m 3 d = 2 · m d · (2m) 2 elements, and contains all the elements of the following form, which require exactly two CX gates.
Up to single-qubit rotations, the gate is equivalent to controlled-√ X gate, so it can be implemented by evolving for half the duration of a controlled-X gate [16].

The fourth class, called the Triple-CX-like
class, consists of 4m 3 d = m d · (2m) 2 elements, and contains all the elements of the following form, which require exactly three CX gates.
The following Theorem provides an algorithm to successively construct the n-qubit CNOT-Dihedral group. It is analogous to [8] that discusses the generation of the n-qubit Clifford group. Case (1) of this Theorem shows that one can successively construct the CNOT-Dihedral group asserting an optimal number of CX gates, with a bound on the space to search these group elements (see Remark 4). Moreover, one can also use the "meet in the middle" algorithm of [2] to synthesize gate sequences for the non-Clifford RB.

Let F (r) be the subset of operators imple-
mentable by a circuit with r CX gates (and any number of X and T gates). Suppose U is in F (r + 1), then In particular,

Let H(r) be the subset of operators implementable by a circuit with r CS or CS † gates (and any number of X and T gates). Sup
In particular,

Remark 4.
We note that the bounds in Theorem 3 are sharp and cannot generally be improved, since there is an equality in certain cases.
Indeed, assume that n = 2. If H(r) is the subset of operators implementable by a circuit with r CS gates, then H(1) = 2 · H(0) (see Theorem 1). If F (r) is the subset of operators implementable by a circuit with r CX gates, then Theorem 2). Corollary 5. In order to generate all the elements in the n-qubit CNOT-Dihedral group G = G(m) having at most r CX gates, the algorithm generates at most 2 Useful identities and the proof of Theorem 3 Consider quantum circuits on a fixed number of qubits n that are products of controlled-X gates CX, bit-flip gates X, and single-qubit phase gates T = T (m) satisfying T |u := e iπu/m |u . When these gates are applied to each qubit or pairs of qubits, they generate a group G = G(m) of unitary operators that is an example of a CNOT-dihedral group. An element U ∈ G acts on the standard basis as where p(x) = p(x 1 , . . . , x n ) is a polynomial called the phase polynomial and f (x) is an affine reversible function. Since x j ∈ F 2 , so x 2 j = x j , the phase polynomial is where x α = j∈α x j . Furthermore, the coefficients can be chosen such that p ∅ = 0 and p α ∈ (−2) |α|−1 Z 2m otherwise (see [14]). Recall the following useful identities in the Dihedral group defined in (1) generated by the T = T (m) and X gates (up to a global phase), We state here some useful identities in the CNOT-Dihedral group defined in (2) regarding the controlled-S (CS) gate. According to the definition of the CS gate in (3), We deduce that Similarly, We note that according to their definition, the CS and CS † gates (as well as their powers) are symmetrical, namely, T (and all its powers) commutes with the control and target of the CS gate, namely, In addition, we have the following relations between the CS and X gates, We shall moreover use the following identities of the CX gate. T (and all its powers) commutes with the control of CX, and X (and all its powers) commutes with the target of CX, namely, In addition, we have the following relation between the control of CX and the X gate, Recall that the Z gate is defined as Z = 1 0 0 −1 . Then we have the following useful relation between the CX gate and the Z gate, Finally, the product CX i,j · CX j,i , which is in the iSWAP-like class of Clifford gates (see [13])), satisfies the following relation, Based on the above identities we can now prove Theorem 3.

Proof of Theorem 3. 1) There exists a product of single qubit gates
for some k, k , l, l and U ∈ F (r). Since T l i commutes with the control of CX i,j by (13), we can absorb T l i in U . Since X k j commutes with the target of CX i,j by (13), we can also absorb X k j in U . Hence, for some k, l and U ∈ F (r). If k = 1 then according to (14), X i I j · CX i,j = CX i,j · X i X j , so we can replace U by where U ∈ F (r). We can therefore assume that k = 0. If m is even and l ≥ m/2 then T m/2 = Z, so we can rewrite U as for some l < m/2. According to (15), where U ∈ F (r). We can therefore assume that l < m/2 as needed.
2) Similarly to (1) we can assume that for some k, k , l, l , e = ±1 and U ∈ H(r). Since T commutes with both control and target of CS by (11), we can absorb T l i T l j in U and so Now, by (10) we may assume that i < j, and by (12) we can absorb X k i X k j in U and assume that U = CS e i,j · U for some i < j and e = ±1 as needed.

The canonical forms and proofs of Theorems 1 and 2
From now on we will now assume that G is the CNOT-Dihedral group on two qubits {0, 1}, and describe canonical forms of the elements in G. This is analogous to the description in [13] of the elements in the Clifford group on two qubits.
Proof of Theorem 1. The proof follows by induction on the number r of CS and CS † gates. Since CS is of order m/d then necessarily r < m−d 2d . Let r = 0, then any U ∈ H(0) can be written as where k, k ∈ {0, 1}, l, l ∈ {0, . . . , m − 1}, since such an element belongs to the direct product of the two single-qubit Dihedral groups. Let r = 1, then according to Case (2) of Theorem 3, any U ∈ H(1) can be written as where e ∈ {1, −1}, k, k ∈ {0, 1}, l, l ∈ {0, . . . , m − 1}. Now assume that the Theorem holds for H(r). According to Case (2) of Theorem 3 and the induction assumption, any element U ∈ H(r + 1) can be written as where U ∈ T, X , e = ±1 and e = ±r, as needed.
Note that all the elements obtained in this process are distinct, since an equality CS e 0,1 · U = CS e 0,1 · U for some e, e ∈ {0, . . . , m/d − 1} and U, U ∈ T, X , implies that CS e−e 0,1 ∈ T, X , so necessarily e = e and U = U . Lemma 6. Let G be the CNOT-Dihedral group on two qubits. Then any element in G which has exactly one CS gate and one CX gate can be rewritten as an element with no CS gates and exactly one CX gate.
Proof. According to Theorem 3 we may assume w.l.o.g. that such an element U can be written as a product Since T commutes with the control and target of CS by (11), we may absorb T 1 into U , and so U can be rewritten as for some U , U by (8). Therefore, U = U ·CX 0,1 · U for some U , U , as needed.

Lemma 7.
Let G be the CNOT-Dihedral group on two qubits. Then any element in G which has exactly one CX gate and no CS gates can be written either as: Proof. The proof follows from Case (1) of Theorem 3. Note that all the elements obtained in this process are indeed distinct.
Then we are done by Theorem 1.
Similar argument as in the proof of Lemma 7 shows that all the elements obtained in this process are indeed distinct.

Lemma 9.
Let G be the CNOT-Dihedral group on two qubits. Then any element in G which has exactly three CX gates and no CS gates can be written as: Proof. According to Case (1) of Theorem 3 and Lemma 8 we may assume w.l.o.g. that such an element U can be written as U = I i T l j · CX i,j · I 0 T l 1 · CX 1,0 · CX 0,1 · U where U ∈ T, X , i, j ∈ {0, 1}, l, l ∈ {0, ..., m/d − 1}.
The same argument as in the proof of Lemma 8 shows that all the elements obtained in this process are indeed distinct.
Proof of Theorem 2. According to Corollary 1 in [14], the CNOT-Dihedral group G = G(m) on two qubits has exactly 24 · m 3 /d elements.
By Lemma 6, there are no elements with both CX and CS gates. The cases where there are only CS gates were handled in Theorem 1. The remaining cases where there are only CX gates were proved in Lemmas 7, 8 and 9.