Minimum Synthesis Cost of CNOT Circuits
Abstract
Optimizing the size and depth of CNOT circuits is an active area of research in quantum computing and is particularly relevant for circuits synthesized from the Clifford + T universal gate set. Although many techniques exist for finding short syntheses, it is difficult to assess how close to optimal these syntheses are without an exponential brute-force search. We use a novel method of categorizing CNOT gates in a synthesis to obtain a strict lower bound computable in time on the minimum number of gates needed to synthesize a given CNOT circuit, where denotes the matrix multiplication constant and is the number of qubits involved. Applying our framework, we prove that gate syntheses of the -cycle circuit are optimal and provide insight into their structure. We also generalize this result to permutation circuits.
For linear reversible circuits with qubits, our lower bound is optimal for 100%, 67.7%, and 23.1% of circuits and is accurate to within one CNOT gate in 100%, 99.5%, and 83.0% of circuits respectively. We also introduce an algorithm that efficiently determines whether certain circuits can be synthesized with fewer than CNOT gates.
1 Introduction
Minimizing the number of CNOT gates necessary to synthesize a given quantum circuit is a well-studied task in quantum computing. The authors of [1, 2] have developed algorithms to optimize the number of CNOT gates in quantum circuits, and [3, 4, 5, 6, 7, 8] give asymptotics on the minimum number of CNOT gates required in circuit synthesis. The approaches presented in these papers have been used to minimize both the size and depth of a circuit, in some cases accounting for the qubit connectivity of the quantum computer and the ancilla count. In general, these methods have approached asymptotic optimality [9, 10, 4, 11].
Minimizing the number of CNOT operations is important because CNOT operations and single qubit gates form a universal set for quantum computing. Both the speed and error rate of quantum algorithms such as Shor’s algorithm and Grover’s search improve with decreases in CNOT gate count [12, 13].
1.1 Main Results
Although a large volume of active research has been dedicated to optimizing CNOT circuits, we know little about how to obtain firm lower bounds on the minimum number of CNOT gates required to synthesize a given circuit besides resorting to brute-force search. Consequently, an exponential search time is required to verify the optimality of a CNOT circuit decomposition. In this paper, we focus on quantum computers without topological constraints or quantum reconfigurability. Our main result utilizes a novel categorization of the CNOT gates in a CNOT decomposition into link, middle, and cut gates to find strict lower bounds in time on the minimum number of CNOT gates necessary to synthesize a given circuit, where denotes the matrix multiplication constant [14] and is the number of qubits involved. We apply this method to all -qubit circuits. In these cases, our lower bound is exact in and of circuits, and off from the minimum by at most one in , and of circuits respectively.
Notably, [15, 16, 17, 4] provided constructions which use CNOT gates to synthesize an -cycle circuit, but did not disprove the existence of syntheses with fewer CNOT gates. By applying our lower bound, we prove that gates is optimal, eliminating the need for further CNOT count optimization of -cycle circuits in future research. More generally, we show the minimum number of CNOT gates needed to synthesize permutation circuits is , where is the number of disjoint cycles in the permutation. We remark that our framework not only yields a certificate of optimality, but also shows that the gates in any gate synthesis of an -cycle circuit can have its CNOT gates partitioned into three sets of size , each of which forms a spanning tree over the qubits, all without needing to resort to brute-force search.
Finally, Jiang et al. [10] proved that determining the minimum CNOT count of an arbitrary CNOT circuit with topological constraints is NP-hard. Finding the computational complexity of the same problem without topological constraints is an ongoing area of research [11, 18, 19]. We introduce the linkability problem, a subclass of this problem, with the goal of efficiently determining whether certain circuits can be synthesized with fewer than CNOT gates. Combining our framework with a graph-theoretic approach, we give an algorithm for this problem.
1.2 Organization of the Paper
In Section 2, we introduce conventions and definitions used throughout the paper. In Section 3, we introduce the categorization of CNOT gates into link, middle, and cut gates, as well as derive a lower bound on the number of link and cut gates necessary to synthesize a circuit. In Section 4, we prove results regarding the effects of middle gates on a circuit and derive a lower bound on the number of middle gates necessary to synthesize a circuit. In Section 5, we combine all of these results alongside a few additional observations to yield our lower bound and apply the bound to -cycle and permutation circuits to determine their minimum CNOT gate count. In Section 6, we introduce and prove our polynomial-time algorithm for the linkability problem. In Section 7, we assess the performance of our lower bound in the cases. In Section 8, we summarize our main results and raise future directions.
2 Preliminaries and Notations
We use the notation . We use to denote the value in the th row and th column of a matrix . We use to denote the identity permutation and to denote the -transposition. We denote the identity matrix by . For a given set and permutation , we let denote the image of under . We let denote the indicator function, where if and otherwise. We say that an matrix is a reversible binary matrix if . We define to be the number of all-zero rows in and to be the number of disjoint pairs of duplicate, not all-zero, rows in .
2.1 CNOT Synthesis of Circuits
In this paper, we lower bound the minimum number of CNOT gates required to synthesize a given linear reversible circuit, which can be represented as an reversible binary matrix. Rigorously, we define the problem as follows, borrowing notation from [10].
Definition 2.1.
A CNOT gate or CNOT operation takes as input two binary values and representing the control and target of the CNOT gate, respectively, and replaces the pair with . The effect of a CNOT gate with control and target on a set of qubits can be represented as multiplying by matrix with , all diagonal entries equal to , and all other entries equal to . We denote this CNOT gate, which adds the th row of a matrix to the th row, as .
Definition 2.2.
For any reversible binary matrix , we define its size to be one less than the length of the shortest sequence of reversible binary matrices with and such that can be obtained from through a single CNOT operation for all .111We note that our usage of the term “size” differs from its conventional definition, where it typically refers to the number of CNOT gates in a given CNOT synthesis. In this paper, when we refer to the “size” of a circuit, we mean the minimum number of CNOT gates required in any synthesis of the circuit. We call any such minimal sequence a CNOT synthesis of . Furthermore, this sequence gives a decomposition of as a product of CNOT gate matrices, which we call a CNOT decomposition of . An example is shown in Figure I.
The authors of [10, 20] also minimized the number of parallel CNOT operations required to synthesize a given circuit, as fully disjoint CNOT operations can be performed simultaneously on a quantum computer to save time.
Definition 2.3.
A parallel CNOT gate or parallel CNOT operation is a composition of arbitrarily many CNOT gates such that no qubit is operated on by more than one such gate. Rigorously, let and be distinct numbers in . A parallel CNOT gate can be represented by the matrix with for , all diagonal entries equal to , and all other entries equal to .
An example of a parallel CNOT decomposition is given in Figure II.
Definition 2.4.
For any reversible binary matrix , we define its depth to be one less than the length of the shortest sequence of reversible binary matrices with and such that can be obtained from through a single parallel CNOT operation for all .222See above.
2.2 Circuit-derived Graphs
We further introduce two graphs fundamental to the lower bound introduced in this paper.
Definition 2.5.
Given an reversible binary matrix , we define its vertex-connectivity graph to be , where and if and only if and at least one of or is equal to one. We define to be the number of connected components of this graph.
Definition 2.6.
Given an reversible binary matrix , we define its edge-connectivity graph to be , where . For each row and column of , we connect and with an edge in if and only if . We define to be the number of connected components of this graph.
Examples of the vertex and edge-connectivity graphs of a matrix are shown in Figure III.
Definition 2.7.
We call a graph on vertices a star graph if one vertex of has degree and all other vertices have degree . We call a path graph if we can label its vertices as such that if and only if . With slight abuse of notation, we say that a set of CNOT gates is a star or path if the graph formed by adding an edge between the control and target of each CNOT gate is a star or path graph respectively.
2.3 Influence Graphs
Finally, we introduce two definitions used in our algorithm for the linkability problem.
Definition 2.8.
For a reversible binary matrix , we define its influence graph to be the directed graph such that and if and only if and . In each such case, we say that influences . An example is given in Figure IV.
Definition 2.9.
For a directed graph , we define a transitive reduction of to be another directed graph with the same vertices and a minimal set of directed edges such there is a directed path from vertex to vertex in if and only if there is a directed path from to in .
3 Link, Middle, and Cut CNOT Gates
The key insight of our algorithm is that each gate of a CNOT decomposition can be placed into one of three categories (or none), and finding lower bounds on the number of CNOT gates in each category allows us to obtain a lower bound on the total number of CNOT gates. In this section, we introduce these categories and prove lower bounds on the number of CNOT gates in two of the three categories.
Definition 3.1.
We define a river of an reversible binary matrix to be a permutation such that for all . We denote the set of all rivers of as . For any river , we denote the unique permutation matrix whose only nonzero entries lie on this river as .
Definition 3.2.
Let be reversible binary matrices such that can be obtained from through one CNOT operation. We call this CNOT operation a
-
•
Link gate if ,
-
•
Middle gate if ,
-
•
Cut gate if .
We now prove an important result on the effects of link and cut gates on and .
Proposition 3.3.
Let be a reversible binary matrix. If are connected in , then are connected in .
Proof.
As are connected in , there exists a path of such that and . Thus, are connected in for all since . Thus is connected to in as desired. ∎
Lemma 3.4.
Let be reversible binary matrices such that can be obtained from through one CNOT operation. Then, and . Furthermore, if , then .
Proof.
Consider a CNOT operation on a matrix adding row to row for which . If and were in the same connected component in , then any new edges in will also be between vertices in , contradicting . If and were in distinct connected components and of , then the only edges that will be different in will be those between vertices of and . This will cause and to become a single connected component in , and leave all other connected components unchanged. Thus, if then .
Similarly, consider the case when . If , are in the same connected component of then no edges between connected components are added, while if they are in separate connected components and , then the only new edges are edges connecting a vertex in to a vertex in , leaving all other connected components unchanged. Thus, if then .
Now, notice that applying on returns the original matrix . In symmetric fashion, and .
Finally, if , then there must exist that lie in different connected components of such that . The CNOT gate adds some row with to row . Note that lie in the same connected component of . After adding row to row , we know lie in the same connected component of and is connected in . Notably, and are in different connected components of by Proposition 3.3, and thus the number of edge-connected components in is one less than in , as desired. ∎
We now use the tools developed in the proof of Lemma 3.4 to prove that these three categories of CNOT gates are mutually exclusive, allowing us to sum lower bounds on each category to bound the size of the entire circuit.
Lemma 3.5.
Let be reversible binary matrices such that can be obtained from through one CNOT operation. Then the CNOT operation is either exclusively a link, middle, or cut gate, or none of these.
Proof.
By Lemma 3.4, if the CNOT operation is a link gate then , so a link gate cannot be a cut gate.
As discussed in the proof of Lemma 3.4, link gates operate on rows that are in separate connected components of . Let the control row of the CNOT gate lie in connected component of . Without loss of generality, let and define . Then, where A is an matrix and B is an matrix. Any satisfies . When we add a row from A to a row in B, the upper-right box of zeros does not change. Thus, for any , we have , so . Therefore the set of rivers is unchanged as no river passes through the newly created bottom left entries, so a link gate cannot be a middle gate.
Finally, we show that cuts and middles are also disjoint. In this case, we can assume up to permutation of the rows and columns that where are not necessarily square. However, if are not square, then is not reversible, giving contradiction. Suppose the CNOT gate adds a row of A to a row of B. Let the set of columns of in A be denoted as , and let the set of rows of in A be denoted as . Thus if , then . Furthermore, for any , we have so . Thus the set of rivers in and are equal. This finishes the final case. ∎
Finally, we extend Lemma 3.4 to yield a simple but powerful lower bound on the number of link and cut gates in a given circuit.
Lemma 3.6.
Any CNOT decomposition of matrix must contain at least link gates and at least cut gates.
Proof.
Consider any CNOT synthesis of . Note that . The number of vertex-connected components must decrease over the sequence, so Lemma 3.4 implies that at least link gates are required.
From Lemma 3.4, link gates decrease the number of edge connected components by exactly one, while cut gates increase them by exactly one. Since there are initial components and link gates, we need at least cut gates in order to end up at edge-connected components in the final matrix. ∎
4 Lower Bounds on Middle Gates
In this section, we develop an time algorithm that computes a lower bound on the number of middle gates necessary to synthesize a given circuit. To begin, we prove several lemmas that clarify the effects of middle gates on the rivers of a matrix.
Given a set of middle CNOT gates, each river can only “interact” with other rivers in the same equivalence class. These equivalence classes are determined by the set of middle CNOT gates. When it is clear that the rivers of the cannot be obtained from I through these interactions, the given set of middle CNOT gates is insufficient to synthesize . In the following subsections, we make this idea rigorous.
4.1 Equivalence Classes of Rivers
We now show that a singular middle CNOT gate only allows “interactions” between certain pairs of rivers, each of which differs by a fixed transposition determined by the control and target of the CNOT gate.
Lemma 4.1.
Let be reversible binary matrices such that can be obtained from by adding row to row . Consider pairing each permutation to . Then .
Proof.
We begin with casework on the values of and , with examples in Figure V. If they are both , then as desired. If exactly one of them is , it can be checked that as desired. We now consider the case when . In this case, if it is not true that for all then as desired. Otherwise, observe that if and only if and if and only if . Thus, , completing the final case. ∎
Lemma 4.1 demonstrates that when there is only one CNOT gate involved, the parity of the number of rivers in sets of the form cannot change. We extend this idea to the case of multiple CNOT gates by allowing multiple transpositions.
Definition 4.2.
Let be a fixed set of transpositions. We say that if and only if can be obtained from through a sequence of transpositions in . It is easy to see that is an equivalence relation on as the reflexive, transitive, and symmetric properties hold. We let denote the set of equivalence classes under .
Theorem 4.3.
Let be reversible binary matrices such that can be obtained from by adding row to row . Then, for any with and for any equivalence class , we have .
Proof.
Since , we can partition all the rivers in into pairs without including elements outside of . By Lemma 4.1,
∎
In preparation for a proof in the next subsection, we introduce the labeling of an equivalence class.
Definition 4.4.
Let and . Let . We define the labeling of as . Additionally, when the context for is clear, we let denote the labeling of the equivalence class of .
In order to show that no two equivalence classes share a labeling, we prove the following lemma.
Lemma 4.5.
Suppose that there is a tree whose vertices are . We begin by choosing a set of initial values , and assigning for each vertex . We are allowed to perform operations which exchange the values of and for adjacent vertices . Then for any permutation , there is a sequence of operations resulting in for all .
Proof.
Without loss of generality, we assume that for . Consider the following algorithm: pick a leaf node . We want to ensure that . We view as a rooted tree with as its root node and perform operations swapping up the tree until (see Figure VI). Now, we can remove from . We repeat this process until we have assigned to every . ∎
Theorem 4.6.
Let . The function is injective.
Proof.
Let a labeling be , and suppose for some equivalence class . By definition, denotes the minimum such that over all . Let be a fixed element of . If , then . Define for each . Let be a graph such that and if and only if .
For each transposition , both lie in the same set . Conversely, if then there exists a composition of transpositions in mapping to then to . Thus each nonempty set is a connected component of .
As a result, any must satisfy for all . In particular, the subgraph of induced by is connected and has a spanning tree, so by Lemma 4.5, all permutations in satisfying this set of conditions must also lie in . Hence is uniquely determined by and , since the sets are determined by as the connected components of and the sets are determined by . ∎
Repeated applications of Theorem 4.3 show that if contains the transpositions corresponding to each middle CNOT gate in a CNOT decomposition, then the parity of is preserved throughout the entire CNOT decomposition. Although this condition is powerful, there are many possible equivalence classes based on the choice of CNOT gates, making it impractical to check the condition. In order to make the lower bound on middle gates computable in polynomial time, we should eliminate both the dependence on and .
4.2 The Algorithm
We introduce a consequence of Theorem 4.3 which more directly allows us to find a lower bound on the number of middle gates without depending on the equivalence classes in Theorem 4.3.
Theorem 4.7.
Let be a CNOT synthesis of matrix . Let . Let a graph such that and if and only if there is some middle gate involved in the CNOT synthesis adding between rows . Then for any connected component of , let . Then, .
Proof.
First, define . For every equivalence class , by Theorem 4.3, we have since non-middle gates in the sequence do not affect the set of rivers.
Let be obtained by either removing or adding to depending on whether . Let denote the number of rivers such that the th term of is equal to . Since each individual labeling must appear an even number of times in , is even for all .
Now, for each permutation , note that the th entry of , which we denote , represents the position of in which appears. Furthermore, the th entry of , which we denote , represents the minimum position of over all permutations in the equivalence class of . From the proof of Theorem 4.6, is the minimum vertex in the connected component of in .
Thus each counts exactly the number of rivers such that lies in the connected component of in . Notably, whenever is not the smallest vertex in its connected component.
Let us further define to be the number of rivers such that . Then
where is the connected component of in .
Now, since every is even, for any connected component of , we must have that is even. Notice that in the matrix , the entry denotes exactly the parity of the number of rivers such that , so . Hence, the sum of the rows of whose indices are in is exactly . The result follows.
∎
Although Theorem 4.7 gives a condition for the connected components of that can be used to lower bound the number of middle CNOT gates, the time needed to compute is as it would be necessary to loop through every river of . We now introduce a shortcut that decreases this time to .
Lemma 4.8.
Let be an reversible binary matrix. Then .
Proof.
It is well known that where is the cofactor matrix of . Thus, the cofactor matrix of can be computed as when is a reversible binary matrix. We say a river passes through the -entry of if . Notice that rivers can only pass through nonzero entries, and the parity of the number of rivers passing through any such entry is equal to the -cofactor. Therefore the parity of the number of rivers in passing through any given square is given by the matrix . Finally, we add to balance the equation. ∎
Combining Theorem 4.7 and Lemma 4.8 gives us an algorithm shedding light on the connected components formed by the middle CNOT gates. This yields a straightforward lower bound on the number of middle gates.
Theorem 4.9 ( algorithm).
Given matrix and a CNOT synthesis of , let . Let a graph such that and if and only if there is some middle gate involved in the CNOT synthesis adding between rows . Then contains at most connected components.
Proof.
By Theorem 4.7, the sum of the rows of corresponding to each connected component is zero. There are at most rows contained in connected components of size and at most rows contained in connected components of size . Let be the number of size connected components and let be the number of size connected components. Then there must be at most connected components in . Since and ,
∎
We remark that we can find and in time by sorting the rows of .
Corollary 4.10.
The number of middle gates in any CNOT decomposition of matrix is at least . Furthermore, can be computed in time.
5 The LMC Bound
We now combine the lower bounds found in Sections 3, 4 alongside other minor optimizations. We begin by proving that certain matrix operations preserve the value of .
Theorem 5.1.
For any reversible binary matrix and any permutation matrix , we have .
Proof.
Consider a CNOT decomposition . Taking the inverse of , we obtain a CNOT decomposition . By symmetry, . Taking the transpose of , we obtain a CNOT decomposition . By symmetry, . Finally, conjugating by , we obtain a CNOT decomposition where is a CNOT gate. By symmetry, , completing the proof. ∎
Next, we show the number of zeroes on the main diagonal of gives a second lower bound on the total number of non-link gates in any CNOT decomposition of .
Theorem 5.2.
Let be a CNOT synthesis of matrix . If has zeroes on its main diagonal, then there must be at least CNOT operations involved in the synthesis which are not link gates.
Proof.
In the identity, there are no zeroes on the main diagonal. Since any CNOT operation changes only one row, we can add at most one zero at a time to the main diagonal. Thus it suffices to show that link gates don’t affect the main diagonal.
In the proof of Lemma 3.4, we showed that for any link gate adding row to row , we must have in different connected components of . This implies that , so the element on the main diagonal will not change. Since link gates cannot change the diagonal, we need at least other CNOT operations in order to synthesize , as desired. ∎
Finally, we obtain the following lower bound on the size of CNOT circuits.
Theorem 5.3 (LMC Bound).
For an reversible binary matrix , compute ,
, and . Then
Proof.
By Lemma 3.5, the sets of link, middle, and cut gates are disjoint. From Lemma 3.6, the number of link gates is at least and the number of cut gates is at least . From Corollary 4.10, the number of middle gates is at least . By Theorem 5.2, at least non-link gates are required. Combining these results shows that . Since by Theorem 5.1, the result follows from taking the maximum of these lower bounds. ∎
5.1 Cycle and Permutation Matrices
We now apply Theorem 5.3 to obtain exact values on the size of all -cycle and permutation matrices, as well as the exact depth of -cycle matrices for .
Theorem 5.4.
For any -cycle , . Furthermore, let be a CNOT synthesis of . Then the sets of link, middle, and cut gates involved in the CNOT synthesis each have size and form a spanning tree on the set of qubits.
Proof.
Applying Theorem 5.3, we note that and . Applying Theorem 4.7 and Lemma 4.8, we have . In particular, the only vector such that is , so the graph , where and if and only if there is a middle gate adding between rows , must be connected. Thus and . Figure VII gives various constructions of alongside the spanning tree structures of the link, middle, and cut gates respectively. We add three original constructions which do not use the swapping method in addition to those given in [17, 15, 21].
Pseudocode | L, M, C ordering | Link | Middle | Cut |
---|---|---|---|---|
for to do
CNOT(, )
CNOT(, )
CNOT(, )
end for
|
Star | Star | Star | |
for to do
CNOT(, )
CNOT(, )
CNOT(, )
end for
|
Path | Path | Path | |
for to do
CNOT(, )
end for
for to do
CNOT(, )
end for
for to do
CNOT(, )
end for
|
Star | Path | Star | |
for to do
CNOT(, )
CNOT(, )
end for
CNOT(, )
for to do
CNOT(, )
end for
|
Star | Star | Path | |
for to do
CNOT(, )
end for
for to do
CNOT(, )
CNOT(, )
end for
|
Star | Path | Path |
Therefore . Now, consider a CNOT synthesis of . There must be exactly link, middle, and cut gates respectively. Because is connected, the set of middle gates forms a spanning tree on the set of qubits. Now assume for the sake of contradiction that the set of link gates does not form a spanning tree on the set of qubits. Then there is a partition such that there is never a CNOT operation between a row in and a row in , as the first such gate would be a link gate. However, this implies that is separable, giving contradiction.
Finally, assume for the sake of contradiction that the set of cut gates does not form a spanning tree over the qubits. Then there exists a partition such that there is no cut gate between any and . There must be a link gate adding a row to a row , as the link gates form a spanning tree. This means that at some point, are connected by this link gate. However, if there is no cut gate between and , then there will always exist a row of and a row of that are connected in after this point, giving contradiction, as no two rows are connected in . ∎
Moore and Nilsson [21] showed that the depth of any permutation circuit was at most by giving a construction using parallel CNOT gates. We demonstrate that this number is optimal for large -cycle circuits.
Corollary 5.5.
Let . Then , and when is an -cycle.
Proof.
Note that any parallel CNOT operation can be decomposed into at most CNOT gates. Thus, we have
for any reversible binary matrix . Hence, for , any -cycle satisfies . Finally, the construction given in [21] shows that for any choice of . ∎
Theorem 5.6.
For any , we have , where is the number of disjoint cycles in .
Proof.
Using the construction from Theorem 5.4 on each disjoint cycle of , we achieve a synthesis of in CNOT gates, showing that .
Now for the sake of contradiction assume that there exists some with minimal that satisfies . Theorem 5.4 implies that . Now, choose qubits in disjoint cycles of . Appending in that order to the end of the circuit synthesizing has the effect of swapping rows . However, as illustrated in Figure VIII, this synthesizes another permutation matrix such that has one fewer disjoint cycle than and additionally . This either contradicts the minimality of or Theorem 5.4, finishing. ∎
6 Linkability
In this section, we introduce the linkability problem, a subclass of the global minimization problem proposed in [10]. Specifically, we determine whether it is possible to synthesize an arbitrary circuit with in at most gates in time. We begin by introducing a few notions used in the algorithm.
Lemma 6.1.
Consider a CNOT decomposition of matrix . If every CNOT gate is a link gate, then the influence graph forms a directed acyclic graph.
Proof.
Assume that there is a directed cycle in . Let indices be taken modulo . The permutation
satisfies . However, this means while link gates do not affect the set of rivers by Lemma 3.5, giving contradiction. ∎
We recall the following result in graph theory, which gives us the time complexity for computing the transitive reduction of an arbitrary graph.
Theorem 6.2 (Aho et al. [22] and Furman [23]).
The transitive reduction of a directed graph with vertices can be computed in time.
Now, we present the algorithm for the linkability problem in its entirety.
Theorem 6.3.
Given an reversible binary matrix such that , it is possible to determine whether in time.
Proof.
-
Step 1:
We begin by assuming that satisfies . Then by Theorem 5.3, . By assumption, there exists a CNOT synthesis of . It is clear that all the CNOT gates must be link gates since . We compute the influence graph , which takes time.
-
Step 2:
Let be the transitive reduction of . We claim that for each , one of the CNOT operations used in the synthesis of must add row to row . We prove this as follows. If , there must not have been a directed path from to of length in . Assume that no CNOT operation adds row to row . Then, there exists a sequence with and such that there is a CNOT gate adding row to for all . However, this implies each as link gates cannot remove nonzero entries. This is a directed path of length from to , giving contradiction and completing the proof.
Hence both maintains connectivity and has at most edges, so it must be a spanning tree. The exact set of CNOT gates can thus be read off of .
-
Step 3:
Now, we determine the order in which these CNOT operations took place. For any 3 vertices in where , it is easy to see that if and only if happens before , as and no other directed path from to exists in .
-
Step 4:
From the previous step, we know the relative ordering of all adjacent CNOT gates. Any ordering of the CNOT gates respecting these relative orders synthesizes the same matrix. Thus, we can pick any such full ordering and perform the CNOT operations step by step on I to yield a matrix . This entire process requires time. If , we have just found a construction to obtain in exactly CNOT gates. Otherwise, if , this is a contradiction on the original assumption that , finishing.
The overall time complexity of this algorithm is , as desired. ∎
7 Results
For , the size of all linear reversible CNOT circuits can be easily found using a BFS algorithm over the set of all -qubit circuits. In Table 1, we provide various metrics on how well the lower bound on size from Theorem 5.3 matches the exact size for -qubit circuits. In Figure IX, we provide heatmaps for the confusion matrix between the lower bound and the exact size. The raw data used can be found in Appendix A.
Metric | |||
---|---|---|---|
0 | 0.581 | 1.137 | |
0 | 0.328 | 0.941 | |
1 | 0.811 | 0.649 | |
1 | 0.901 | 0.806 |



Although our lower bound performs well at various metrics for , Jiang et al. show in [10] that as grows larger, the average size of an arbitrary binary reversible circuit grows to while our lower bound can be at most . This means that although our lower bound still holds for large , it cannot be used as a size-approximation algorithm for large without further improvements.
8 Conclusion and Future Directions
In this paper, we introduce a categorization of the gates of CNOT decompositions into link, middle, and cut gates. Under this framework, we derive lower bounds on the number of CNOT gates in each category and combine them to obtain a lower bound on the total number of CNOT gates needed to synthesize a given circuit that avoids brute-force search and can be obtained in time. We apply our framework to the problem of synthesizing the -cycle matrix to show that known constructions with CNOT gates are optimal, and further show the size of any permutation matrix is , where is the number of disjoint cycles in the permutation.
We introduce an time algorithm determining whether a given circuit with can be synthesized in fewer than CNOT operations, resolving a subclass of the minimum circuit size problem. We hope the methods and ideas developed in this paper will aid the search for further polynomial-time lower bounds on the size of CNOT circuits, as well as demonstrate the optimality or near-optimality of known CNOT decompositions.
To end, we present several interesting future directions on both the minimum circuit size problem as well as for improving our lower bound in Theorem 5.3.
Problem 8.1.
In [3], an information theoretic bound is used to show that the maximum size of a circuit on qubits is at least . However, in the cases , the maximum size of an -qubit circuit is always , attained by the -cycle circuit. This is plausible for all , as we have . At what point does the asymptotic bound overtake the pattern?
Problem 8.2.
In the case, a single circuit, alongside those equivalent to it through Theorem 5.1, lies far off the main diagonal in the table in Appendix A. It turns out that (see Figure X), rendering the bound ineffective. Can we improve the algorithm to account for this “ glitch” and obtain a more powerful lower bound on the number of middle CNOT gates?
-
12345 45231
-
12435 45312
-
13245 52341
-
15342 52431
-
15432 53241
-
42315 53412
-
43215
Problem 8.3.
In addition to permutations, are there other classes of circuits for which the bound in Theorem 5.3 is optimal?
Problem 8.4.
Is it possible to extend our methods to circuits with ancillae, topological constraints, or one-qubit gates such as gates and Hadamard gates?
9 Acknowledgements
We thank Yunseo Choi and Kevin Cong for their valuable feedback.
References
- [1] A. Barenco, C. H. Bennett, R. Cleve, D. P. DiVincenzo, N. Margolus, P. Shor, T. Sleator, J. A. Smolin, and H. Weinfurter, “Elementary gates for quantum computation,” Phys. Rev. A, vol. 52, no. 5, p. 3457, 1995.
- [2] D. P. DiVincenzo, “Two-bit gates are universal for quantum computation,” Phys. Rev. A, vol. 51, no. 2, p. 1015, 1995.
- [3] K. N. Patel, I. L. Markov, and J. P. Hayes, “Efficient synthesis of linear reversible circuits,” arXiv preprint quant-ph/0302002, 2003.
- [4] F. Vatan and C. Williams, “Optimal quantum circuits for general two-qubit gates,” Phys. Rev. A—Atomic, Molecular, and Optical Physics, vol. 69, no. 3, p. 032315, 2004.
- [5] V. V. Shende, I. L. Markov, and S. S. Bullock, “Smaller two-qubit circuits for quantum communication and computation,” in proceedings design, automation and test in europe conference and exhibition, vol. 2, pp. 980–985, IEEE, 2004.
- [6] V. V. Shende, S. S. Bullock, and I. L. Markov, “Synthesis of quantum logic circuits,” in proceedings of the 2005 Asia and South Pacific Design Automation Conference, pp. 272–275, 2005.
- [7] J. J. Vartiainen, M. Möttönen, and M. M. Salomaa, “Efficient decomposition of quantum gates,” Phys. Rev. Letters, vol. 92, no. 17, p. 177902, 2004.
- [8] E. Knill, “Approximation by quantum circuits,” arXiv preprint quant-ph/9508006, 1995.
- [9] B. Nash, V. Gheorghiu, and M. Mosca, “Quantum circuit optimizations for nisq architectures,” Quantum Science and Technology, vol. 5, no. 2, p. 025010, 2020.
- [10] J. Jiang, X. Sun, S.-H. Teng, B. Wu, K. Wu, and J. Zhang, “Optimal space-depth trade-off of cnot circuits in quantum logic synthesis,” in Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 213–229, SIAM, 2020.
- [11] Y. Kang and H. Ma, “Cnot-optimal circuit synthesis,” 2023.
- [12] X. Liu, H. Yang, and L. Yang, “Minimizing cnot-count in quantum circuit of the extended shor’s algorithm for ecdlp,” Cybersecurity, vol. 6, no. 1, p. 48, 2023.
- [13] K.-A. Brickman, P. Haljan, P. Lee, M. Acton, L. Deslauriers, and C. Monroe, “Implementation of grover’s quantum search algorithm in a scalable system,” Phys. Rev. A—Atomic, Molecular, and Optical Physics, vol. 72, no. 5, p. 050306, 2005.
- [14] R. Duan, H. Wu, and R. Zhou, “Faster matrix multiplication via asymmetric hashing,” in 2023 IEEE 64th Annual Symposium on Foundations of Computer Science (FOCS), pp. 2129–2138, IEEE, 2023.
- [15] J. Liu, Y. Ren, Y. Cao, H. Sun, and L. Chen, “Realization of permutation groups by quantum circuit,” arXiv preprint arXiv:2406.01350, 2024.
- [16] M. Planat and R. Ul Haq, “The magic of universal quantum computing with permutations,” Advances in Mathematical Physics, vol. 2017, no. 1, p. 5287862, 2017.
- [17] M. Bataille, “Quantum circuits of cnot gates: optimization and entanglement,” Quantum Info. Processing, vol. 21, no. 7, p. 269, 2022.
- [18] C. D. Murray and R. R. Williams, “On the (non) np-hardness of computing circuit complexity,” Theory of Computing, vol. 13, no. 1, pp. 1–22, 2017.
- [19] M. Amy, P. Azimzadeh, and M. Mosca, “On the controlled-not complexity of controlled-not–phase circuits,” Quantum Science and Technology, vol. 4, no. 1, p. 015002, 2018.
- [20] D. Maslov and B. Zindorf, “Depth optimization of cz, cnot, and clifford circuits,” IEEE Trans. on Quantum Engineering, vol. 3, pp. 1–8, 2022.
- [21] C. Moore and M. Nilsson, “Parallel quantum computation and quantum codes,” SIAM Journal on Computing, vol. 31, no. 3, pp. 799–815, 2001.
- [22] A. V. Aho, M. R. Garey, and J. D. Ullman, “The transitive reduction of a directed graph,” SIAM Journal on Computing, vol. 1, no. 2, pp. 131–137, 1972.
- [23] M. Furman, “Application of a method of rapid multiplication of matrices to the problem of finding the transitive closure of a graph,” in Doklady Akademii Nauk, vol. 194, pp. 524–524, Russian Academy of Sciences, 1970.
Appendix A Performance of Theorem 5.3 for Circuits with or Qubits
In this appendix, the lower bound given in Theorem 5.3 is plotted against the exact size of the circuit in the and -qubit cases, with the entry in row and column denoting the number of linear reversible circuits with lower bound and size . For , equality holds.
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | |
---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | |||||||||
1 | 12 | |||||||||
2 | 96 | |||||||||
3 | 542 | 138 | ||||||||
4 | 1920 | 756 | 12 | |||||||
5 | 4560 | 2589 | 84 | |||||||
6 | 4929 | 2464 | ||||||||
7 | 1510 | 469 | ||||||||
8 | 72 | |||||||||
9 | 6 |
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | ||||||||||||
1 | 20 | ||||||||||||
2 | 260 | ||||||||||||
3 | 2570 | 690 | |||||||||||
4 | 18990 | 20540 | 3640 | 12 | |||||||||
5 | 97320 | 176505 | 37880 | 1320 | |||||||||
6 | 360325 | 917960 | 322750 | 11580 | |||||||||
7 | 813870 | 2448985 | 925340 | 15840 | |||||||||
8 | 798120 | 2072000 | 365540 | ||||||||||
9 | 216378 | 350120 | 13340 | ||||||||||
10 | 5040 | 1920 | |||||||||||
11 | 480 | ||||||||||||
12 | 24 |