<<

Zhi-qiang LI, Sai CHEN*, Wei ZHU, Han-wu CHEN A Common Algorithm of Construction a New Quantum for Exact Minimization of Quantum Circuits

Abstract: Sincenon-permutative quantum gates have more complex rules than permutative quantum gates, direct use of non-permutative quantum gates should be avoided in the efficient synthesis algorithm because it is very hard to synthesize. The key method is using quantum gates to create new permutative quantum gates to replace non-permutative quantum gates. In this paper, we propose an algorithm using CNOT and non-permutative quantum gates to construct new optimal gates library automatically. Our method based on the idea of exhaustion finds the all combinations of quantum logic gates with lower quantum cost no matter how many the quantum lines are.

Keywords: automatically; non-permutative quantum gates; exhaustive

1 Introduction

Cascading and combining the quantum logical gates are the basic elements of reversible quantum logic circuits, and then, a quantum is constructed by quantum reversible logic circuits. According to the characteristics of the input and the output, quantum gates can be divided into non-permutative quantum gates and permutative quantum gates. In a quantum logic circuit, if the input is logical, the output must be logical and vice versa. But when the input and output are all logical, the internal circuit allows the superposition of and that is non-permutative values. If only using quantum logic gates in a quantum logic circuit, the synthesis algorithms of the circuits are like the classic reversible logic synthesis algorithm. In addition, non-permutative quantum gates are also used, the superposition of information will make the process of synthesis more complicated and low-performance. Non-permutative quantum gates, such as NCV quantum gates library (including NOT gates [1], controll-NOT gates and controlled- square-root-of-NOT gates [2]), are used to construct new quantum permutative gates and gate libraries.

*Corresponding author: Sai CHEN, College of Information Engineering, Yangzhou University Yangzhou, China, E-mail: [email protected] Zhi-qiang LI, Wei ZHU, College of Information Engineering, Yangzhou University, Yangzhou, China Han-wu CHEN, School of Computer Science and Engineering, Southeast University,Nanjing, China 372 A Common Algorithm of Construction a New

To reduce the cost of the circuits, an excellent combination and optimization techniques is the key. The essence of constructing less cost quantum logic gates is the reversible logic synthesis [3]. With the further research of reversible circuit, many synthesis methods of reversible circuits also appeared [4-8]. The ultimate goal of quantum reversible logic synthesis algorithms is to efficiently construct optimum quantum logic circuits and automatically design reversible quantum logic circuits with less cost. However, these methods generally were designed for the entire logic circuits optimization. And the research of the foundational quantum logic gates construction is less. The optimization of quantum logic gates will directly affect the entire quantum logic circuits optimization. If the quantum logic gates can be optimized automatically, the synthesize algorithm which using this gates will have better performance and minimum cost. This will play an important role in the optimization of the entire circuits. People have done a lot of research and put forward many quantum circuits synthesis algorithms in which most of 3- synthesis algorithms based on quantum logic gates have been presented [9-13]. However, the algorithms based on non-permutative quantum gates are few. There are several synthesis algorithm based on NCV gates right now [14-17]. Although a variety of 4-qubit algorithms have been proposed, these algorithms still based on quantum logic gates. In [18], new quantum logic gates can be constructed by using NVC gate library to compose four types Peres- like gates. But this method is not universal, and can only be used when the number of lines is fewer. If the quantum lines are increased, such as the number of lines greater than five, this method cannot be realized. Therefore, in this paper we proposed a universal algorithm to generate any lines of optimal new quantum logic gates automatically. Here the optimum means that in the new quantum logic gates can be no longer broken down into several cascading quantum logic gates with equivalent quantum cost.

2 Backgroung

A quantum gate is the basic unit of quantum information processing and its cascade constitutes a . A quantum circuit is reversible. In the quantum computation, a quantum gate is corresponding to a . It is well known that the operation of each gate in an n-line reversible or quantum circuit can be represented by a square matrix of dimension 2n. The matrix of the NOT 0 1 1 0 =   I =   gate is N   false, and 0 1 false represents the identity circuit. 1 0 As shown in Figure 1 is the NOT gates, control-NOT gates and Toffoli gates [19]. They are all typical permutative quantum gates. A Common Algorithm of Construction a New Quantum Logic Gate 373

x3 x3

x2 x2 x2 x2 ⊕ x x⊕ xx x1 x1 x1 xx121 1 23 ()a ()b ()c

Figure 1. The permutative quantum gates.

The Controlled-square-root-of-NOT gates contain a controlled-V (CV) gate and a controlled-V+ (CV+) gate as shown in Figure 2. They are all typical non-permutative quantum gates.

Figure 2. Basic quantum algebra rules for CV/CV† gates.

If the input and the output are logical, the gate must be a permutative quantum gate. If the input is not logical and the output is logic, the gate must not be a permutative quantum gate andvice versa. If the input and output are all not logical, the gate cannot be sure a permutative quantum gate. For example, control-NOT gate in Figure 1 (b), 1111+−ii  1   1 + i  01 11 1+−ii 1   =   xx12⊕=  × = x2 to 1 and x1to v0 which v0 is 2211−+ii  0   1 − i  false, then 10 22 1−+ii 1 false. We can clearly see the result is not logic. If the gate is replaced by a controlled-V gate, 01+ 1 11+−ii01+ 2 × set x2 to 1 and x1to false, the result is 2211−+ii false. It is clearly also not logical.

3 The common algorithm ofr ealizing an ewquantum logic gate

In [18], new quantum logic gates were constructed by using NVC gate library to compose four types Peres-like gates. The new quantum logic gates along with the NOT gates and control-NOT gates together constituted the new quantum logic gate library (NCP4). The NCP4 gate library can construct optimal 3-qubit quantum logic circuit which the NCV gate library can also construct the equivalent. That means the function of the two methods are the same, but the construction methods are different. We can also say that the two gate libraries are equivalent when they synthesize 3-qubit logic circuits. In Figure 4, the new quantum logic gate was constructed by our hands when the quantum lines were five. This method totally spent 11 CNOT gates. The Table 374 A Common Algorithm of Construction a New Quantum Logic Gate

1 is the all kinds of inputs. We can clearly see that each line only eight U gates are to be used. So we can sure the U gates are controlled-Kth-root-of-NOT when K=8.

Table 1. All kinds of inputs in fig. 4

X3X2X1X0 U1 U2 U3 U4 U5 U6 U7 U8 U9 U10 U11 U12 U13 U14 U15 0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0001 1 0 0 0 0 0 1 0 0 1 1 1 1 1 1 0010 0 1 0 0 0 1 0 1 1 0 0 1 1 1 1 0011 1 1 0 0 0 1 1 1 1 1 1 0 0 0 0 0100 0 0 1 0 1 0 0 1 1 1 1 0 0 1 1 0101 1 0 1 0 1 0 1 1 1 0 0 1 1 0 0 0110 0 1 1 0 1 1 0 0 0 1 1 1 1 0 0 0111 1 1 1 0 1 1 1 0 0 0 0 0 0 1 1 1000 0 0 0 1 1 1 1 0 1 0 1 0 1 0 1 1001 1 0 0 1 1 1 0 0 1 1 0 1 0 1 0 1010 0 1 0 1 1 0 1 1 0 0 1 1 0 1 0 1011 1 1 0 1 1 0 0 1 0 1 0 0 1 0 1 1100 0 0 1 1 0 1 1 1 0 1 0 0 1 0 1 1101 1 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1110 0 1 1 1 0 0 1 0 1 1 0 1 0 0 1 1111 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1

x3 x3

x2 x2

x1 x1

x0 x0

z U1 U2 U3 U4 U5 U6 U7 U8 U9 U10 U11 U12 U13 U14 U15 z'

Figure 4. The new quantum logic gate with four control lines was constructed by hands.

Because the lines of the circuits are few and there are certain rules in the circuits, we can construct these circuits by our hands. But when the lines of the new quantum logic gates are increased, this method is difficult to implement. We must find a common algorithm. In [20], non-permutative quantum gates constructed new permutative quantum gates by using controlled-Kth -root-of-NOT gates. Firstly, the article absorbs the idea of Gray code, which is any two adjacent codes differ from only one binary in a set of binary numbers, to constructed new permutative quantum gates by using controlled- NOT gates and controlled-Kth-root-of-NOT gates. Then we found that these quantum A Common Algorithm of Construction a New Quantum Logic Gate 375

logic gates exists recursive inside. According this, without using the Gray code, a recursive construction was presented to directly and efficiently construct the same new quantum logic gates. In Figure 5, the new quantum logic gate was constructed by the recursive construction when the quantum lines were five. This method totally spent 14 CNOT gates.

Figure 5. The new quantum logic gate with four control lines was constructed by the recursive construction.

Thus it can be seen when the quantum lines are all five, the manual construction has 3 CNOT gates less than the recursive construction. This is because the manual method obtained x3, x2, x1 and x0 directly. In the recursive method, only x3 is obtained directly, and x2, x1 and x0 were obtained by XOR of quantum . So we can get that when we construct new quantum logic gates with n+1 quantum lines, the manual construction has n-1 CNOT gates less than the recursive construction. It can also prove that the recursive method can construct new quantum logic gate with any quantum lines, however the cost of quantum gates is not a minimum. Although quantum gates cost of the manual construction is a minimum, this method can only synthesize when the quantum lines less than six. For this reason, similar to [18], we propose a common exhaustive algorithm to find all potential new quantum logic gates. Apparently these new logic gates can efficiently synthesize optimum reversible logic circuits. For example, to construct the new quantum logic gates with n+1 quantum lines, the first step is to construct the quantum gates library with n+1 quantum lines. Here we do not consider the target above the control. Put the identical circuit into a stuck and point the stack pointer to the bottom in the following second to fourth step. Step five, when the stack is not empty, the program starts loop. The step six and seven is to assign the circuit in the stuck to c1 and set false to the flag of bok which indicate whether the circuit adds additional gates. From the eight to twenty-four, looping in the quantum gate library, under the premise of the current circuit c1cascades a gate from the library and the flag bok set to be true. Then the program determines whether the output of the new control circuit c2 appears in the front. If the front has appeared, bok will be set to false and the program will bounce this cycle. Re-cascade the next 376 A Common Algorithm of Construction a New Quantum Logic Gate

gate from quantum gate library from the step nine and Repeat the step from eleven to sixteen. If the front has not appeared, the program will do the seventeen to twenty-four n steps. That is if bok is true and the gate number of the control circuit is 21−−n false which is the minimum number of gates to construct the desired circuit, the circuit in the stuck is which we want. If the gate number of the control circuit is 21n −−n false, the program will out of the loop. In the following twenty-six to thirty step, if there is no next gate in the library, the program will remove the front gate of the current gate in the stuck and cascade the next gate of the front gate of the current gate. Then start from the fifth step again.

Algorithm A common construction for a new quantum logic gate

Input: n+1 Output: optimal novel quantum logic gates based on CNOT gates

1: Lib[n(n-1)/2][2]; 2: itop =0; 3: stack[itop] =equality comparator; 4: idx_gate =0; 5: whileitop>=0do 6:c1 =stack[itop]; 7: bok =false; 8: fori =idx_gateto n(n-1)/2-1)do , 9: c2=c1 cascade i quantum gate in Lib; 10: bok=true; 11: forj=0 toitopdo 12: ifthe function of c2== the function of stack[j]then 13: bok=false; 14: break; 15: end if 16: end for 17: ifbok is true then 18: stack[++itop] =Lib[i]; 19: ifitop==2n-n-1then 20: idx_gate=0; 21: return stack[1], stack[2],…, stack[itop]; 22: end if 23: break; 24: end if 25: end for 26: ifbok is false then 27: c3 =stack[itop--]; 28: idx_gate=the number of c3’s the next gate in Lib 29: end if 30: end while A Common Algorithm of Construction a New Quantum Logic Gate 377

4 The result andanalysisof experiments

We do experiments to compare the manual method, recursive method and the algorithm proposed in this paper. The results are shown in Table 2.

Table 2. The results of the experiment

The number of The number of CNOT The number of CNOT The number of CNOT Quantum lines in our method in recursive method in manual method

4 4 6 4 5 11 14 11 6 26 30 No solution 7 57 62 No solution 8 120 126 No solution 9 247 254 No solution

From Table 2 we can clearly see that when the quantum lines are n+1, our algorithm always has n-1 CNOT gates less than the recursive construction. And the manual method cannot be realized when the quantum lines are greater than five.

Acknowledgment: The work was supported by the National Natural Science Foundation of China under Grant 61070240 and Grant 61170321; and the Specialized Research Fund for the Doctoral Program of Higher Education under Grant 20110092110024. The authors would like to thank Portland State University Quantum Logic for having useful discussions.

References

[1] Z. Li, H. Chen, and X. Song, A Novel Hash-based Algorithm for Reversible LogicCircuits Synthesis, Journal of Computational Information Systems,2012, 8(11): 4485–4493. [2] A. Barenco, C. Bennett, R. Cleve, D. DiVinchenzo, M. Margolus,P. Shor, T. Sleator, J. Smolin, and H. Weinfurter,Elementary gates for quantum computation, Physical Review A, 1995, 52(5):3457-3467. [3] V VShende,A K Prasad,I L Markov,et al.Synthesis of reversible logic circuits[J].IEEE Trans on Circuits and Systems-I,2003,22(6):723-729. [4] SongX, YangG, PerkowskiM, WangY. Algebraic characteristics of reversible gates[J]. Theory of Computing Systems, 2006,39(2):311-319. [5] W Q Li, H W Chen,Z Q Li.Application of semi-template in reversible logic circuit[A].Proceedings of the 11th International Conference on CSCWD[C].Melbourne,Australia,2007:155-161. [6] Zhiqiang Li, Hanwu Chen, Baowen Xu, WenjieLiu,Xiaoyu Song, XilinXue, Fast algorithm for 4-qubit reversible logic circuits synthesis, IEEE World Congress on Computational Intelligence (WCCI2008), Hong Kong, 2008:2202-2207. 378 A Common Algorithm of Construction a New Quantum Logic Gate

[7] Wan S,Chen H, Cao R.A novel transformation-based algorithm for reversible logic synthesis[A]. Proceedings of Advances in Computation and Intelligence[C].2009.70-81. [8] Zhiqiang Li, Chen, Hanwu; Song, Xiaoyu, Perkowski, Marek, A Synthesis Algorithm for 4-Bit Reversible Logic Circuits with Minimum Quantum Cost, ACM Journal on in Computing Systems, 2014, 11(3):1-19. [9] Miller. D M, Wille R, Sasanian Z. Elementary quantum gate realizations for multiple-control toffoli gates [C]//Proceedings of 41st IEEE International Symposiumon Multiple-Valued Logic. Tuusula, finland: IEEE, 2011: 288-293. [10] Liu Y, Long G L, Sun Y. Analytic on e-bit and CNOT gate constructions of general n-qubit controlled gates [J]. International Journal of Quantum Information, 2008, 6(3):447-462. [11] Tsai E, Perkowski M. Synthesis of permutative quantum circuits with toffoli and TISC gates [C] //Proceeddings of IEEE 42nd International Symposium on Multiple-Valued Logic. Victoria, BC, Canada: IEEE, 2012: 50-56. [12] Sasanian Z, Miller D M. Transforming MCT circuits to NCVW circuits [C] //Workshop on Reversible Computation 2011. Gent Belgium Berlin, Heidelberg: Springer, 2011: 163-174. [13] Hung W N N, Song X, Yang G, etal. Optimal synthesis of multiple out putBoolean functions using a set of quantum gates by symbolic reach ability analysis [J]. IEEE, Transactions on CAD, 2006, 25(9):1652-1663. [14] Yang G W, Hung W N N, Song X, et al. Exact synthesis of 3-qubit quantum circuits from non-binary quantum gates using multiple-valued logic and group theory, Proceedings of the conference on Design, Automation and Test in Europe-Volume 1. IEEE Computer Society, 2005: 434-435. [15] Li Zhiqiang, Chen Hanwu, Liu Wenjie, Liu W, etal. Efficient algorithm for synthesis of optimal NVC 3-qubit reversible circuits using new quantum logic gate library [J]. Acta Electronica Sinica, 2013, 41(4):690-697. [16] Maslov D, Miller D M. Comparison of the cost metrics through investigation of the relation between optimal NCV and optimal NCT three-qubit reversible circuits [J]. IET & Digital techniques, 2007,1(2):90-104 [17] Yang G W, Song X, Perkowski M, etal.Four-level realization of 3-qubit reversible function [J]. IET Computers &Digial Techniques, 2007, 1(4):382-388. [18] Li, Zhiqiang; Song, Xiaoyu; Perkowski, Marek; Chen, Hanwu; Feng, Xiaoxia, Realization of a new permutative gate library using controlled-kth-root-of-NOT quantum gates for exact minimization of quantum circuits, International Journal of Quantum Information, 2014, 12(5):2418–2420. [19] ToffoliT. [J/OL]. Technical Memo MIT-LCS-TM-151, MIT Lab for Comp. Sci. New York: Springer, 1980. [20] Li, Zhiqiang, Feng xiaoxia, Chen Hanwu. Realization of Toffoli-like gates using controlled-kth- root-of-not quantum gates, Journal of Data Acquisition & Processing. 2014, 29(06):975-980.