Optimization of Reversible Circuits Using Toffoli Decompositions with Negative Controls
Total Page:16
File Type:pdf, Size:1020Kb
S S symmetry Article Optimization of Reversible Circuits Using Toffoli Decompositions with Negative Controls Mariam Gado 1,2,* and Ahmed Younes 1,2,3 1 Department of Mathematics and Computer Science, Faculty of Science, Alexandria University, Alexandria 21568, Egypt; [email protected] 2 Academy of Scientific Research and Technology(ASRT), Cairo 11516, Egypt 3 School of Computer Science, University of Birmingham, Birmingham B15 2TT, UK * Correspondence: [email protected]; Tel.: +203-39-21595; Fax: +203-39-11794 Abstract: The synthesis and optimization of quantum circuits are essential for the construction of quantum computers. This paper proposes two methods to reduce the quantum cost of 3-bit reversible circuits. The first method utilizes basic building blocks of gate pairs using different Toffoli decompositions. These gate pairs are used to reconstruct the quantum circuits where further optimization rules will be applied to synthesize the optimized circuit. The second method suggests using a new universal library, which provides better quantum cost when compared with previous work in both cost015 and cost115 metrics; this proposed new universal library “Negative NCT” uses gates that operate on the target qubit only when the control qubit’s state is zero. A combination of the proposed basic building blocks of pairs of gates and the proposed Negative NCT library is used in this work for synthesis and optimization, where the Negative NCT library showed better quantum cost after optimization compared with the NCT library despite having the same circuit size. The reversible circuits over three bits form a permutation group of size 40,320 (23!), which Citation: Gado, M.; Younes, A. is a subset of the symmetric group, where the NCT library is considered as the generators of the Optimization of Reversible Circuits permutation group. Using Toffoli Decompositions with Negative Controls. Symmetry 2021, 13, Keywords: reversible circuit optimization; NCT library; negative quantum library; quantum cost; 1025. https://doi.org/10.3390/ reversible circuit; Toffoli decomposition sym13061025 Academic Editor: Basil Papadopoulos and Sergei D. Odintsov 1. Introduction One of the problems in classical computers is heat dissipation and energy loss. Received: 2 May 2021 The amount of energy dissipated for any lost bit of information is calculated by R. Lan- Accepted: 1 June 2021 dauer’s principle, which is KTln2, where K is the Boltzmann’s constant (1.3807 10 23 JK 1) Published: 7 June 2021 × − − and T is the temperature of the system. Reversible computing has one of many features, Publisher’s Note: MDPI stays neutral where no heat dissipation is produced by the system [1]; hence, no information is destroyed. with regard to jurisdictional claims in This feature has many applications [2], such as low-power CMOS [3], nanotechnology [4], published maps and institutional affil- DNA-based logic circuit with self error recovery capability employing massive paral- iations. lelism [5] and many more [6]. Quantum computing is reversible by nature [7]. Recently, using group theory in study- ing the reversible logic synthesis problem has gained attention [8,9]. Group theory is also used to find a relationship between the decomposition of a reversible circuit and a quantum circuit in [10]. A relationship between the reversible logic synthesis problem and Young Copyright: © 2021 by the authors. Licensee MDPI, Basel, Switzerland. subgroups is introduced in [11]. A reversible gate is the basic building block of a reversible This article is an open access article circuit [3]. Quantum gates are reversible gates/functions, which are considered as a special distributed under the terms and case of symmetry groups of finite spaces (Young subgroups) [10]. Many methods have conditions of the Creative Commons been proposed to optimize the quantum cost of circuits [12,13]. The quantum cost of the Attribution (CC BY) license (https:// NCT library is reduced in [14]; a further reduction of the quantum cost of the NCT library creativecommons.org/licenses/by/ is made in [15]. The algorithms in [16,17] use an ancillary qubit to achieve less quantum 4.0/). cost. Universal reversible gate libraries are proposed in [18–20], which use GAP-based Symmetry 2021, 13, 1025. https://doi.org/10.3390/sym13061025 https://www.mdpi.com/journal/symmetry Symmetry 2021, 13, 1025 2 of 23 algorithms to synthesize reversible circuits using different types of gates with various gate costs. Different Toffoli decompositions are proposed in [21] to reduce the quantum cost of reversible circuits. Toffoli gates have control qubits, which can be positive or negative. The positive control is applied if the system is in the excited state, whereas the negative control is applied if the system is in the ground state. The importance of the ground state over the excited state in systems for better stability is discussed in [22], which shows that systems tend to be more stable in the ground state compared with the excited state, so using negative controls is more stable and has less quantum cost for the system compared with using positive controls [23–26]. The paper has two aims: the first aim of this paper is to propose an algorithm that optimizes the quantum cost of 3-bit reversible circuits based on a modified version of the NCT library; the second aim is to propose a new gate library by modifying the NCT library to replace positive control with negative control, which shows less quantum cost compared with the NCT library. This paper is organized as follows: Section2 gives a brief introduction to elementary quantum gates used to build quantum circuits, permutation group, definitions and ter- minologies used in this paper. Section3 introduces the proposed library and proposed synthesis algorithm. Section4 shows the experimental results. The paper concludes in Section5. 2. Background This section gives a brief introduction on the basics of reversible circuit, Negative NCT library gates and permutation group. 2.1. Reversible Boolean Function A Boolean function f with n inputs and n outputs f : Xn Xn is considered to be ! reversible if and only if each input vector x Xn is mapped to a unique output vector 2 y Xn where X = 0, 1 . For n inputs there are 2n! different reversible Boolean functions, 2 f g for n = 3 there is 23! = 40,320 3-input/output reversible Boolean functions. Given a finite set A = 1, 2, ... , 2n , a is permutation and a bijection function that f g maps an input to an output from A such that a : A A, it can be represented as a ! permutation as follows in (1). 1 2 3 2n a = ··· (1) a(1) a(2) a(3) a(2n) ··· The top row is ordered so that it can be eliminated, so a can be written as in (2). a = a(1) a(2) a(3) a(2n) (2) ··· The permutation can also be represented as a product of disjoint cycles. For example, 1 2 3 4 5 6 7 8 can be written as (1, 4, 3)(6, 8). 4 2 1 3 5 8 7 6 2.2. Reversible Quantum Logic Quantum computers use qubit as the basic unit of information, which is represented by a state vector. The vector: y = a 0 + b 1 represents a single qubit where a and b j i j i j i are complex numbers that satisfy the condition a 2 + b 2 = 1. The measurement of y j j j j j i determines the state of the system. Four states of the system are used in this paper; the first state is the standard state 0 where b is 0, the second state is the standard state 1 where j i (1+i) 0 +(1 i) 1 j i a is 0, the third state is + where + = j i − j i and the fourth state is where j i j i p2 j−i (1 i) 0 +(1+i) 1 = − j i j i . j−i p2 Symmetry 2021, 13, 1025 3 of 23 2.3. Reversible Gates A reversible gate is a reversible Boolean function in which each input vector has a unique output vector. 2.3.1. One-Qubit Gates This section introduces the one qubit reversible gates that are used in this paper. NOT gate (N): A reversible gate that maps 0 to 1 and vice versa, also maps + to j i j i j i and vice versa. The superscript of N gate is 3 when N gate is applied on a three-qubit j−i reversible circuit (N3) and the subscript of N gate refers to a specific qubit that NOT gate 3 is applied on. For example, N2 applies a NOT gate on the second qubit in a three-qubit reversible circuit. Table1 shows the effect of a NOT gate on one qubit. There are three possible gates of a NOT gate for three-qubit reversible circuits as shown in Figure1a with the following permutations in (3): N3 : (x , x , x ) (x 1, x , x ) 1 1 2 3 ! 1 ⊕ 2 3 = (1, 5)(2, 6)(3, 7)(4, 8), 3 N : (x1, x2, x3) (x1, x2 1, x3) 2 ! ⊕ (3) = (1, 3)(2, 4)(5, 7)(6, 8), N3 : (x , x , x ) (x , x , x 1) 3 1 2 3 ! 1 2 3 ⊕ = (1, 2)(3, 4)(5, 6)(7, 8). Square-root of NOT gate (v): A reversible gate that maps 0 to + , 1 to , + j i j i j i j−i j i to 1 , and to 0 . j i j−i j i Square-root of NOT gate (v†): A reversible gate that maps 0 to , 1 to + , + j i j−i j i j i j i to 0 and to 1 .