arXiv:quant-ph/0102104v1 21 Feb 2001 ffcieyecoe narvril computation reversible a in enclosed effectively hs eut ml htteeaen ffcso h opeiyhiera complexity the on compute effects to required no space are and there that imply results These pc eurdt compute to required space eas t nu ( input its because anrslsaetefloig .Eeyirvril computation irreversible Every 1. ext following: analyzed the been are has results computing reversible main glance of a theory classical The computing: Reversible 1 F xedteaoecasclrslst h unu ae efis r first we case, quantum the computing. to reversible results classical classical above the extend rvril pc qa reesbesae.T netgt wheth investigate To space). irreversible equal space (reversible iatmnod cez iih,Uiestad aoi“Fe Napoli Universit`a di Fisiche, Scienze di Dipartimento fti uoao sa es qa ota fcasclautom classical section. of last that the to com in equal The drawn least are at proposed. is sec is automaton last this automaton the of reversible In and computing. quantum computin classical quantum fully than that space suggested of also is demanding ca it space case; t of quantum that consumption the c showed the is decrease the it to reviews section framework section second classical first the In The phy computing. reversible follows. versible a as quan is organized a computation is of quantum paper construction efficient the time towards a step cause 21(1982)], fundamental Phys., a is Theoret. Develo J. This Res. [Internat. J. Toffoli [IBM and Fredkin Bennet by developed principally puting, hsatcei natmtt eeaietecascltheor classical the generalize to attempt an is article This e oe fqatmautomaton quantum of model new a x, )i nqeydtrie yisotu ( output its by determined uniquely is 0) unu eesblt and reversibility Quantum F asm iaCiamarra Pica Massimo E-mail: r ierydpneto hs eurdt compute to required those on dependent linearly are f r hs eurdt opt t eesberealization reversible its compute to required those are [email protected] Abstract 1 F ( : x, 0) → eioI” aoi Italy. Napoli, II”, derico ntb eeaie to generalized be nnot edsgsue nthe in used designs he f t.Sm conclusion Some ata. oteqatmcase. quantum the to ( asclter fre- of theory lassical . 717) n by and 17(1973)] p., inanwmdlof model new a tion f ( frvril com- reversible of y x sgnrlymore generally is g ( u optrbe- computer tum ia rcs.The process. sical vstteiesbehind ideas the evisit ) x uainlpower putational x , niey(2 ].The 3]). ([2, ensively ) f x , cywe h time the when rchy .2 h ieand time The 2. ). ri tpsil to possible it is er : ). x → F f sreversible is ( x a be can ) f . 1.1 Reversible gates In order to transform an irreversible gate into a reversible one, not only the gate com- putation result is to be codified in the gate output, but also some other information necessary to reverse the computation (garbage). To store the garbage more output lines are needed and, since a reversible gate has the same numbers of input and output lines, even more input lines are required (source). Note that, since reversibility implies that the output of a reversible gate depends on the state of the source, its state has to be properly set to compute a given boolean function by a reversible gate. Figure 1 here below outlines the logical structure of a reversible gate.

source

output input

garbage

Figure 1: Logical structure of a reversible gate

Example: Reversible AND gate. The AND gate is a two-input one-output gate, whereas its reversible realization is a three-input three-output gate. The adjunctive input line (s) constitutes the source and the two adjunctive output lines (g1 and g2) are the garbage. The transition function of the reversible AND gate is reported in Table 1.

Table 1: Reversible AND gate

s i1 i2 AND g1 g2 0 0 0 0 00 0 0 1 0 01 0 1 0 0 10 0 1 1 1 11

Table 1 could be completed by adding the three possible inputs with s = 1. In this case, however, reversibility implies that the gate does not realize the AND function. As

2 already remarked, to use a reversible gate the value of the source lines must be prepared appropriately.

1.2 Reversible combinatorial circuits To build up a reversible combinatorial circuit (i.e. a circuit without loop) from an irreversible one, every gate can be replaced by its reversible realization (that is, every boolean function is computable by a reversible circuit). However, although the final circuit works, it often has too many source and garbage lines. In fact [3]: Note that, in general, (in a combinatorial circuit) the number of gates in- creases exponentially with the number of input lines. This is so because almost all Boolean functions are “random”, i.e., cannot be realized by a cir- cuit simpler than one containing an exhaustive look-up table. Thus, in the “wasteful” approach the amount of garbage grows exponentially with the size of the argument. This explains why a reversible realization of a combinatorial circuit seems less effi- cient than the combinatorial circuit itself with regard to space consumption. Actually, in classical case there is a way to recycle the garbage that implies a linear relation be- tween the space required to compute a boolean function by a reversible or irreversible computation. This process, outlined in Figure 2, rests on two considerations: 1. An inverse circuit exists for every reversible circuit, and 2. A copy circuit: (x, 0) → (x, x) does exist.

source 0 garbage source 0

input x FFf(x) f(x) -1 input x

Copy source 0 f(x)

Figure 2: Reversible combinatorial circuit with garbage recycle

To be honest, the above process is really useful only when applied in a nested fashion.

1.3 Reversible sequential circuits If the output lines of a combinatorial circuit are used as input lines, one ends up with a sequential circuit (finite automaton), as outlined in Figure 3. A sequential circuit

3 constantly works in (discrete) interaction with the environment, that changes the state of the input lines. Its evolution is a three-step loop starting from a given internal state: 1. The environment sets the value of the input lines. 2. The combinatorial circuit (i.e. the transition function) is computed. 3. Some output lines are used as input lines (they codify the new internal state). By substituting the combinatorial part of a sequential circuit for its reversible real- ization one does not end up with a reversible sequential circuit. In fact, every time the combinatorial circuit (transition function) is computed, the garbage is modified and the information necessary to reverse the computation is lost. Therefore, in order to build up a reversible sequential circuit, every time the transition function is computed the produced garbage has to be registered. In the following section we present a scheme of sequential circuits, or finite automata, that is able to register the output and the garbage appropriately.

1.4 Reversible Turing machines Bennet [2] has proposed an effective procedure that transforms every irreversible one- tape Turing machine into a reversible three-tape Turing machine. The computation of this machine, that recycles the garbage with the same trick used by reversible combina- torial circuits (Fig. 2), proceeds as follows:

1. Initially the three tapes contain input-source-source. The reversible function is computed.

2. The tapes contain garbage-result-source. The 2nd tape result is copied on the 3rd tape.

3. The tapes contain garbage-result-result. The inverse reversible function is com- puted.

4. The tapes contain input-source-result.

2 Space consumption of

2.1 Space consumption of reversible computing In the classical framework we seldom care about space consumption. In fact, since P − T ime ⊆ P − Space = NP − Space ⊆ Exp − T ime, we first have to trouble about time consumption. This relation stems from the fact that if a computation needs some space, then it needs also some time to use it. Therefore every consumption of space requires a consumption of time, whereas the consumption of time does not implies a consumption of space.

4 In the case of reversible computing, not only every consumption of space requires a consumption of time, but also every consumption of time requires a consumption of space. In fact every unit of time, that corresponds to the execution of an elementary step, as a (reversible) gate or a transition of a (reversible) Turing machine, requires its own source. Time and space seem to be strictly tied. Let T and S be the time and space required by an irreversible Turing machine to end its computation, supposing that the machine halts, and let T ′ and S′ be the time and space that its reversible realization does need. Then exists such c > 1 that T ′ ≃ c + cT and S′ ≃ c + c(S + T ) [2]. From a computational complexity point of view this suggests that reversible and irreversible computation differ. In fact S′ = O(S + T ): if an irreversible computation is space efficient but time inefficient, then its reversible simulation is both time and space inefficient. However, as we saw in the previous section, Bennet has proposed a way to reduce the amount of space the reversible simulation requires. His scheme has been improved overtime [5], and today we know that reversible and irreversible computation have the same complexity, i.e. T ′ ≃ O(T ) and S′ ≃≃ S2). The consumption of space of a reversible computation does not depend on the consumption of time of the irreversible one. This result is appreciated because, although the need of space S′ ≃ c + c(T + S) does not generally imply that the reversible computation is space inefficient, nevertheless it can be an unacceptable amount of space for many practically computations [5].

2.2 The quantum case The design proposed to recycle the garbage relies on the possibility of retracing the computation, once duplicated the result. In the quantum framework this design does not work because of the no cloning theorem: it is not possible to make a copy of the state of a quantum system. This is especially true for a quantum computation that is more efficient than a classical one, for it uses superposition states. On the contrary, if a quantum computation is simply a small version of a classical reversible computation, then this problem does not arise. It could be possible to let quantum computation be less hungry of space by relax- ing reversibility. A quantum computation could proceed by applying alternatively a reversible evolution operator and an irreversible reuse of garbage. This way reversibility is lost because the garbage is erased, but this is not warring because we do not want to compute backward. With this scheme a quantum system for information processing would act in a way similar to that of the current model of quantum automata [6, 1] (we will review it later on). The problem of this design of garbage recycles stems from entanglement. Because the output of a time efficient quantum computation is entangled with the garbage, as in Shor’s factoring algorithm, the latter cannot be recycled without messing the computation.

5 From these considerations we conclude that a quantum system that computes a function f consumes more space than a classical system (reversible or not) that computes the same function. Moreover, these considerations suggest that a quantum computation is necessarily reversible, i.e., it must be possible to retrace the input starting from the output (before the final measurement), not only because of the unitarity of the evolution operator, but also because output and garbage are generally entangled.

3 Quantum automata

Since a quantum computational system is a generalization of a classical one, it follows that its computational power should be greater or equal than that of the classical system. However, the computational power of quantum automata has been shown to be smaller than that of classical automata. We argue that this paradox origins from the fact that the currently accepted definition of quantum automaton neglects the concept of quan- tum reversibility. Here below, we revisit the role that reversibility plays into quantum automata and propose a new model of quantum finite automaton whose computational power is at least able to recognize regular languages.

3.1 The currently accepted definition of quantum automata The currently accepted definition of quantum finite automaton has been proposed by Moore and Crutchfield [6] and Ambanis and Freivalds [1]. A quantum finite automaton [6] Q consists of:

- A H,

- An initial state vector |siniti ∈ H with hsinit|siniti = 1,

- A subspace Haccept ⊆ H and an operator Paccept that projects into it,

- An input alphabet A, and

- A unitary transition matrix Ua for each symbols a ∈ A.

Using the shorthand Uw = Uw1 Uw2 ...Uwk the language accepted by Q is the function Q 2 ∗ f (w)= |PacceptUw|siniti| from words in A to in [0, 1]. The input alphabet consists of classical elements, whereas the internal states are represented by quantum systems (by vectors of a Hilbert space): this automaton is not fully quantum. Moreover, it is neither reversible. In fact from the final state Uw|siniti one cannot trace back the computation because w is unknown. To trace back the computation one will need some information that is not encoded in the final state. As to the computational power of this kind of quantum automaton, first A. Kondacs and

6 J. Watrous [4] have showed that there is a that cannot be accepted by a quantum finite automaton. Then, A. Brodosky and N. Pippenger have demonstrated that there is a whole class of regular languages that cannot be accepted by quantum finite automata.

3.2 (Quantum) Definite events To build up a fully reversible model of quantum automaton we begin setting up a re- 1 versible quantum system that recognizes definite events . If LQ is the language accepted by the finite automaton Q, whose reversible transition function is f, then the definite n n n event LQ is: LQ = {x|x ∈LQ and |x| = n}. LQ is recognized by the reversible combina- th torial circuit of Figure 4, where q is the initial state, and xi and si are the i input and his associated source respectively. This circuit is set up by connecting many combina- torial circuits that compute the transition function, each with its own input and source. 1 2 Of the three output lines of these circuits, the first two (gi and gi ) contain the garbage, while the third encodes the new internal state. Reversibility is preserved by recording the value of the output and garbage each time the transition function is computed. We have assumed that every gate has three input lines. In general you can suppose that every line represents a group of lines, so as the internal states set and the input symbols set may contain more that two elements. Since the transition function is invertible this circuit could be thought as a . In the classical case it is possible to recycle the garbage either with the typical scheme, i.e., coping of the result and computing backward, or erasing the garbage and using it as new source. These solutions, as we saw in the previous section, are not generally useful in the quantum case.

3.3 A new model: an informal presentation To realize a quantum finite automaton we extend the previous construction to the case of inputs of arbitrary finite length. We do not want different systems, even if constructed 1 2 n uniformly, to accept LQ, LQ,..., LQ. We want one system that accepts all of them simultaneously. The solution consists in storing the input in a quantum tape, that is a collection of equal quantum systems. Because of the presence of the source, actually we introduce two quantum tapes: the input and the source-garbage tape. This is exactly what Bennet did in his model of reversible Turing machine. However we know that the length of our tapes must be equal to that of the input sequence, while in the Turing machine case the determination of the maximums tape length is an undecidable problem. 1A definite event is a subset of a regular event whose elements have fixed length.

7 Our automaton has a read/write head and an internal . The head reads one cell on the input tape and a corresponding cell on the source-garbage tape. Then, according to the internal state and to the reversible transition function, it changes the internal state and the states of the cells it read (these cells become garbage). Then, it moves to the right and read the next cell, and the loop restart. Our automaton acts like a reversible two-tape Turing machine whose head is ever moving to the right. It repeats its loop n times, where n is the length of the input string.

3.4 A new model: formal definition A quantum finite automaton Q consists of:

- A Hilbert space Hin. This is the space of the internal states.

- An initial vector |s0i ∈ Hin with hs0|s0i = 1.

- A subspace Haccept ⊆ Hin and an operator Paccept that projects into it.

- A quantum tape I composed by a sequence of quantum systems whose states are described in the Hilbert space I.

- A quantum tape SG composed by a sequence of quantum systems whose states are described in the Hilbert space SG.

- A unitary evolution operator U : Hin ⊗ I ⊗ SG → Hin ⊗ I ⊗ SG.

The input alphabet is composed by an orthonormal basis of I, a quantum system whose dimension depend on the automaton we are constructing. If we are generalizing to the quantum case a classical reversible automaton Q, then the dimension of I depends on the number of input symbols of this automaton. The dimension of SG is related to the way the unitary evolution operator U acts. In particular, if we want generalize to the quantum case the reversible automaton Q, constructed from the irreversible automaton Qirr following Bennet’s procedure, then the dimension of SG is equal to the number of elements on which the transition function of Qirr is defined (i.e., to the number of quadruples of Qirr). In fact, to construct the reversible version of Qirr, following Bennet [2] we have to introduce a new ‘garbage- symbol’ for each transition of Qirr. th The state of the k ‘cell’ of I is described by a vector belonging to the space Ik = I, th while the state of the k ‘cell’ of SG is described by a vector belonging to SGk = SG. If the input string is |wi = |w1i|w2i ... |wni, with |wki ∈ Ik, then the tape SG contains |01i|02i ... |0ni, with |0ki ∈ SGk. In order to understand how the automaton works, we first suppose that the states of the internal state, both I and SG tapes, are continuously factorizing. In this case, if

8 Pin projects into Hin, the internal state |si evolves as in Table 2. The input string |wi 2 is accepted with Paccept|s(n)i . In this case the automaton is similar to a

t |s(t)i 1 |s(1)i = |s0i 2 |s(2)i = PinU|s(1)i⊗|w1i⊗|01i 3 |s(3)i = PinU|s(2)i⊗|w2i⊗|02i . . . . n |s(n)i = PinU|s(n − 1)i ⊗ wn−1i⊗|0n−1i

Table 2: Evolution of the quantum automaton internal state (particular case). classical reversible one2. Indeed, we can schematize our automaton as in Figure 5. When the automaton is not anymore restricted the states of the quantum register and those of the quantum tapes are not generally factorizing. Although the mathematical description of the system evolution is a little trickier, the automaton works in the same way. In this case it turns useful to define:

U = I1 ⊗ I2 ⊗ ... ⊗ I −1 ⊗ I +1 ⊗ ... ⊗ I ⊗ U , ei i i n i where Ik is the identity of Ik ⊗ SGk, Ui the unitary operator U when applied to Hin ⊗ Ii ⊗ SGi, and

n |0i = |01i⊗|02i ⊗ ... ⊗|0ni, |0ki ∈ SGk.

With this notation |wi = |w1i|w2i ... |wni is accepted with probability

n 2 P (|wi)= PacceptUnUn−1 ... U1|s0i⊗|wi⊗|0i . e e e

It is worth noting that, although when you apply Uk you formally act on the space n e Ni=0 Ii ⊗ SGi ⊗ Hin, actually: 1. A local operation is performed, and 2. The states of I and SG with i>k do not modify. Therefore, when U with k < i is applied, you i i ek do not have to dispose the ‘cells’ described by Ii or SGi. This further implies that at the beginning of the computation the tapes length are not to be specified and that more ‘cells’ can be added as the computation moves on. This is exactly what happens in the classical case. 2Note that in the literature a classical automaton with a reversible evolution and an irreversible reuse of garbage as new source (see Fig. 2) is frequently said ‘reversible’ (as in [7]). This is the definition of ‘reversible’ automaton that has been generalized to the quantum case [1, 6]. We refer to another definition of reversible classical automaton: a reversible Turing machine [2] whose head moves only to the right.

9 3.5 Computational power From [2] we can deduce that every classical automaton can be effectively transformed into a classical reversible automaton. This reversible automaton acts on two tapes, and moves only to the right. In fact, If we apply Bennet’s procedure [2] to a Turing machine whose head move only to the right, we end up to a reversible two-tape Turing machine that moves only to the right (as already remarked in the quantum case we do not use the third tape). Since our model of quantum automaton can clearly simulate this classical reversible automaton, it follows that it has at least the same computational power of classical automata.

4 Conclusion and future developments

In this paper we have revisited the classical theory of reversible computing and studied its generalization to the quantum case. We have showed that it is not possible to generalize to the quantum case the design that made classical reversible computation space efficient (because of the ‘no cloning theorem’), and pointed out that, because of the entanglement, it is not possible to reuse the garbage without messing the computation. Moreover we clarified that the quantum computing reversibility, namely the possibility of tracing back the computation from the final result, due to the unitarity of the quantum evolution, is not eliminable because of the presence of non-local correlation. These consideration had led us to propose a new model of fully quantum and re- versible automaton that has at least the same computational power of classical automata. This automaton is, however, ‘angry’ of space. This is a relevant result since the compu- tational power of the currently accepted model of quantum finite automata is thought to be smaller than that of classical finite automata. The main difference between the quan- tum automata here proposed and the currently accepted model of quantum automata concerns reversibility. In future the computational power of the proposed model of quantum finite automa- ton should be investigated. Particularly, I am interested in the role of the garbage. Dose the computational power of the proposed model vary by allowing or preventing interference between the final state and the garbage. In other words: is the garbage useful, or is it simply a by-product of quantum computing?

4.1 Acknowledgments This work is for the most part based on my degree thesis. I particularly tank my super- visor, Prof. Giuseppe Trautteur, and my co-supervisor, Prof. Vincenzo R. Marigliano, both at the Dipartimento di Scienze Fisiche dell’Universit`adi Napoli “Federico II”.

10 Universit`adi Napoli “Federico II”, Dipartimento di Scienze Fisiche. Internal report n◦ DSF09/2001.

References

[1] A. Ambanis and R. Freivalds. 1-way quantum finite automata: strengths, weaknesses and generalizations. In Proc. 39th FOCS, pages 332–341, 1998.

[2] C.H. Bennet. Logical reversibility of computation. IBM J. Res. Dev., 17:525–532, 1973.

[3] E. Fredkin and T. Toffoli. Conservative logic. Int. J. Theor. Phys., 21:219–253, 1982.

[4] A. Kondacs and J. Watrous. On the power of quantum finite state automata. pages 66–75, 1997.

[5] M. Li, J. Tromp, and P. Vit´anyi. Reversible simulation of irreversible computation by pebble games. http://xxx.lanl.gov/ps/quant-ph/970309, 1997.

[6] C. Moore and J.P. Crutchfield. Quantum automata and quantum grammars. Santa-Fe Institute Working Paper; http://xxx.lanl.gov/ps/quant-ph/970703, 1997.

[7] T. Toffoli. Reversible computing. In Automata, languages and programming. Springer- Verlag, 1980.

11 delay

{ } source garbage input garbage

Figure 3: Sequential circuit built on a reversible combinatorial circuit.

1 q g1 f 2 x1 g1 1 s1 g2 f 2 x2 g2 1 s2 g3 f 2 ... g3 ...... f xn ...

sn qend

Figure 4: Reversible combinatorial circuit that accepts definite events.

12 |s1i |s2i |sii |sni

|a1i |a2i |aii |wn−1i |wni

|b1i |b2i |bii |0n−1i |0ni

Figure 5: Quantum finite automata (particular case).

13