Quick viewing(Text Mode)

Quantum Complexity Theory* 1 Introduction

Quantum Complexity Theory* 1 Introduction

Quantum complexity theory

y z

Ethan Bernstein Umesh Vazirani

September

Abstract

In this pap er we study quantum computation from a complexity theoretic viewp oint Our rst result

is the existence of an ecientuniversal quantum in Deutschs mo del of a quantum Turing

Machine This construction is substantially more complicated than the corresp onding construction

for classical Turing Machines in fact even simple primitives such as lo oping branching and comp osition

are not straightforward in the context of quantum Turing Machines We establish how these familiar

primitives can b e implemented and also intro duce some new purely quantum mechanical primitives

suchaschanging the computational basis and carrying out an arbitrary unitary transformation of

p olynomially b ounded dimension

We also consider the precision to which the transition amplitudes of a quantum Turing Machine need

to b e sp ecied We prove that O log T bits of precision suce to supp ort a T step computation This

justies the claim that that the quantum Turing Machine mo del should b e regarded as a discrete mo del

of computation and not an analog one

We give the rst formal evidence that quantum Turing Machines violate the mo dern complexity

theoretic formulation of the ChurchTuring thesis Weshow the existence of a problem relativeto

an oracle that can b e solved in p olynomial time on a quantum Turing Machine but requires sup er

p olynomial time on a b oundederror probabilistic Turing Machine and thus not in the class BPP

The class BQP of languages that are eciently decidable with small errorprobability on a quantum

P

Turing Machine satises BPP BQP P Therefore there is no p ossibility of giving a math

ematical pro of that quantum Turing Machines are more p owerful than classical probabilistic Turing

Machines in the unrelativized setting unless there is a ma jor breakthrough in complexity theory

Intro duction

Just as the theory of has its foundations in the ChurchTuring thesis computational com

plexity theory rests up on a mo dern strengthening of this thesis which asserts that any reasonable mo del

of computation can b e eciently simulated on a probabilistic Turing Machine an ecient simulation is

one whose running time is b ounded by some p olynomial in the running time of the simulated machine

Here we take reasonable to mean in principle physically realizable Some mo dels of computation though

interesting for other reasons do not meet this criterion For example it is clear that computers that op er

ate on arbitrary length words in unit time or that exactly compute with innite precision real numb ers are

A preliminary abstract of this work app eared as

y

Microsoft Corp oration One Microsoft Way Redmond WA ethanbmicrosoftcom Research supp orted by NSF

Grant CCR

z

Computer Science Division University of California Berkeley CA vaziranicsberkeleyedu Research sup

p orted by NSF Grant CCR

not realizable It has b een argued that the Turing Machine mo del actually the p olynomial time equiva

lent cellular automaton mo del is the inevitable choice once we assume that we can implement only nite

precision computational primitives Given the widespread b elief that NP BPP this would seem to put

a wide range of imp ortant computational problems the NP hard problems well b eyond the capabilityof

computers

However the Turing Machine fails to capture all physically realizable computing devices for a funda

mental reason the Turing Machine is based on a classical physics mo del of the Universe whereas current

physical theory asserts that the Universe is quantum physical Can we get inherently new kinds of discrete

computing devices based on quantum physics Early work on the computational p ossibilities of quantum

physics asked the opp osite question do es quantum mechanics insistence on unitary evolution restrict

the class of eciently computable problems They concluded that as far as deterministic computation is

concerned the only additional constraint imp osed by quantum mechanics is that the computation must b e

reversible and therefore by Bennetts work it follows that quantum computers are at least as p owerful as

classical computers The issue of the extra computational p ower of quantum mechanics over probabilistic

computers was rst raised bybyFeynman in In that pap er Feynman p ointed out a very curious

problem the natural simulation of a quantum physical system on a probabilistic Turing Machine requires

an exp onential slowdo wn Moreover it is unclear how to carry out the simulation more eciently In

view of Feynmans observation wemust reexamine the foundations of computational complexity theory

and the complexitytheoretic form of the ChurchTuring thesis and study the computational p ower of

computing devices based on quantum physics

A precise mo del of a quantum physical computer hereafter referred to as the quantum Turing Machine

was formulated by Deutsch There are twoways of thinking ab out quantum computers One way

that may app eal to computer scientists is to think of a quantum Turing Machine as a quantum physical

analogue of a probabilistic Turing Machine it has an innite tap e and a transition function and the

actions of the machine are lo cal and completely sp ecied by this transition function Unlike probabilistic

Turing Machines quantum Turing Machines allow branching with complex probability amplitudes but

imp ose the further requirement that the machines evolution b e timereversible This view is elab orated

in x Another way is to view a quantum computer as eecting a transformation in a space of complex

sup erp ositions of congurations Quantum physics requires that this transformation b e unitary A quan

tum algorithm may then b e regarded as the decomp osition of a unitary transformation into a pro duct of

unitary transformations each of whichmakes only simple lo cal changes This view is elab orated in x

Both formulations play an imp ortant role in the study of quantum computation

One imp ortant concern is whether quan tum Turing Machines are really analog devices since they

involve complex transition amplitudes It is instructive to examine the analogous question for probabilistic

Turing Machines There one mightworry that probabilistic machines are not discrete and therefore not

reasonable since they allow transition probabilities to b e real numbers However there is extensive

work showing that probabilistic computation can b e carried out in a suchaway that it is so insensitive

to the transition probabilities that they can b e allowed to vary arbitrarily in a large range In

this pap er we show in a similar sense that quantum Turing Machines are discrete devices the transition

amplitudes need only b e accurate to O log T bits of precision to supp ort T steps of computation As

Lipton p ointed out it is crucial that the numb er of bits is O log T and not O T as it was in an

early version of this pap er since k bits of precision requires pinning down the transition amplitude to one

k

part in Since the transition amplitude is some physical quantity such as the angle of a p olarizer or the

length of a pulse wemust not assume that we can sp ecify it to b etter than one part in some p olynomial

in T and therefore the precision must b e O log T

Another basic question one may ask is whether it is p ossible to dene the notion of a general purp ose

quantum computer In the classical case this question is answered armatively byshowing that there is

an ecient universal Turing Machine In this pap er we prove that there is an ecient quantum Turing

Machine When given as input the sp ecication of an arbitrary QTM M an input x to M a time b ound

T and an accuracy the universal machine pro duces a sup erp osition whose Euclidean distance from the

time T sup erp osition of M on x is at most Moreover the simulation time is b ounded by a p olynomial

in T jxj and Deutsch gaveadierent construction of a universal quantum Turing Machine

The simulation overhead in Deutschs construction is exp onential in T the issue Deutschwas interested

in was computability not computational complexity The structure of the ecient universal quantum

Turing Machine constructed in this pap er is very simple It is just a deterministic Turing Machine with

a single typ e of quantum op eration a quantum coin an op eration that p erforms a rotation on a

single bit The existence of this simple universal quantum Turing Machine has a b earing on the physical

realizability of quantum T uring Machines in general since it establishes that it is sucienttophysically

realize a simple quantum op eration on a single bit in addition to maintaining coherence and carrying out

deterministic op erations of course Adleman et al and Solovay and Yao have further claried

this p ointbyshowing that quantum coin ips with amplitudes and are sucient for universal

quantum computation

Quantum computation is necessarily time reversible since quantum physics requires unitary evolution

This makes it quite complicated to correctly implementeven simple primitives such as lo oping branching

and comp osition These are describ ed in x In addition we also require programming primitives such

as changing the computational basis which are purely quantum mechanical These are describ ed in x

Another imp ortant primitive is the ability to carry out any sp ecied unitary transformation of p olynomial

dimension to a sp ecied degree of accuracyInx we showhow to build a quantum Turing that implements

this primitive Finally all these pieces are put together in x to construct the universal quantum Turing

Machine

We can still ask whether the quantum Turing Machine is the most general mo del for a computing device

based on quantum physics One approach to arguing armatively is to consider various other reasonable

mo dels and to show that the quantum Turing Machine can eciently simulate each of them An earlier

version of this w ork left op en the question of whether standard variants of a quantum Turing Machine

such as machines with multiple tap es or with mo died tap e access are more p owerful than the basic mo del

Yao showed that these mo dels are p olynomially equivalent to the basic mo del as are quantum circuits

whichwere intro duced in The eciency of Yaos simulation has b een improved in to show that

the simulation overhead is a p olynomial with degree indep endent of the numb er of tap es Arguablythe

full computational p ower of quantum physics for discrete systems is captured by the quantum analog of

a cellular automaton It is still an op en question whether a quantum cellular automaton might b e more

powerful than a quantum Turing Machine there is also an issue ab out the correct denition of a quantum

cellular automaton The diculty has to do with decomp osing a unitary transformation that represents

manyoverlapping sites of activityinto a pro duct of simple lo cal unitary transformations This problem

has b een solved in the sp ecial case of linearly b ounded quantum cellular automata

Finally several researchers have explored the computational p ower of quantum Turing Machines Early

work by Deutsch and Jozsa showed how to exploit some inherently quantum mechanical features

of QTMs Their results in conjunction with subsequent results by Berthiaume and Brassard

established the existence of oracles under which there are computational problems that QTMs can solvein

ty whereas if we require a classical probabilistic Turing machine to pro duce p olynomial time with certain

the correct answer with certainty then it must take exp onential time on some inputs On the other hand

these computational problems are in BPP the class of problems that can b e solved in p olynomial time

by probabilistic Turing machines that are allowed to give the wrong answer with small probability Since

BPP is widely considered the class of eciently computable problems these results left op en the question

of whether quantum computers are more p owerful than classical computers

In this pap er wegive the rst formal evidence that quantum Turing Machines violate the mo dern form

of the ChurchTuring thesis byshowing that relative to an oracle there is a problem that can b e solved in

olog n

p olynomial time on a quantum Turing Machine but cannot b e solved in n time on a probabilistic

Turing Machine with any xed error probability A detailed discussion ab out the implications of

these oracle results is in the intro duction to x Simon subsequently strengthened our result in the

time parameter byproving the existence of an oracle relative to which a certain problem can b e solved

n

in p olynomial time on a quantum Turing Machine but cannot b e solved in less than steps on a

probabilistic Turing Machine Simons problem is in NP coNP and therefore do es not address the

nondeterminism issue More imp ortantly Simons pap er also intro duced an imp ortant new technique

whichwas one of the ingredients in a remarkable result proved subsequently by Shor Shor gave

p olynomial time quantum algorithms for the factoring and discrete log problems These two problems

have b een wellstudied and their presumed intractability forms the basis of much of mo dern

These results hav e injected a greater sense of urgency to the actual implementation of a quantum computer

The class BQP of languages that are eciently decidable with small errorprobability on a quantum

P

Turing Machine satises BPP BQP P This rules out the p ossibility of giving a mathematical

pro of that quantum Turing Machines are more p owerful than classical probabilistic Turing Machines in

the unrelativized setting unless there is a ma jor breakthrough in complexity theory

It is natural to ask whether quantum Turing Machines can solveevery problem in NP in p olynomial

time Bennett Bernstein Brassard and Vazirani give evidence showing the limitations of quantum

Turing Machines They show that relative to an oracle chosen uniformly at random with probability

n

the class NP cannot b e solved on a quantum Turing Machine in time o They also show that relative

to a p ermutation oracle chosen uniformly at random with probability the class NP coNP cannot

n

b e solved on a quantum Turing Machine in time o The former b ound is tight since recentwork

of Grover shows how to accept the class NP relativetoany oracle on a quantum computer in time

n

O

Several designs have b een prop osed for realizing quantum computers A numb er of authors

have argued that there are fundamental problems in building quantum computers most notably the eects

of the decoherence of quantum sup erp ositions or the entanglement of the system with the environment

Very recently there have b een a sequence of imp ortant results showing how to implement quantum error

correcting co des and also use these co des to make quantum algorithms quite robust against the eects

of decoherence and

Quantum computation touches up on the foundations of b oth computer science and quantum physics

The nature of quantum physics was claried by the EinsteinPo dolskyRosen paradox and Bells inequalities

discussed in which demonstrate the dierence b etween its statistical prop erties and those of any

classical mo del The computational dierences b etween quantum and classical physics are if anything

more striking and can b e exp ected to oer new insights into the nature of quantum physics For example

one might naively argue that it is imp ossible to exp erimentally verify the exp onentially large size of

the Hilb ert space asso ciated with a discrete quantum system since any observation leads to a collapse

of its sup erp osition However an exp eriment demonstrating the exp onential sp eedup oered by quantum

computation over classical computation would establish that something like the exp onentially large Hilb ert

space must exist Finally it is imp ortant as Feynman p ointed out to clarify the computational

overhead required to simulate a quantum mechanical system The simple form of the universal quantum

Turing Machine constructed here the fact that it has only a single nontrivial quantum op eration dened

on a single bit suggests that even very simple quantum mechanical systems are capable of universal

quantum computation and are therefore hard to simulate on classical computers

This pap er is organized as follows Section intro duces some of the mathematical machinery and

notation we will use In xweintro duce the quantum Turing Machine as a natural extension of classical

probabilistic Turing Machines We also show that quantum Turing Machines need not b e sp ecied with

an unreasonable amount of precision In x and xwe demonstrate the basic constructions which will

allow us to build up large complicated quantum Turing Machines in subsequent sections Many actions

which are quite easy for classical machines such as completing a partially sp ecied machine running one

machine after another or rep eating the op eration of a machine a given numb er of times will require non

trivial constructions for quantum Turing Machines In x weshowhow to build a single quantum Turing

Machine which can carry out any unitary transformation which is provided as input Then in x weuse

this simulation of unitary transformations to build a universal quantum computer Finallyinxwe give

our results b oth p ositive and negative on the p ower of quantum Turing Machines

Preliminaries

Let C denote the eld of complex numb ers For Cwedenoteby its complex conjugate

Let V be a vector space over C An innerpro duct over V is a complex function dened on V V

which satises

x V x x Moreover x x i x

x y z V x y z x z y z

x y V x y y x

The innerpro duct yields a norm given by kxk x x In addition to the triangle inequality

kx y kkxk ky k the norm also satises the Schwarz inequality kx y k kxkky k

An innerproduct space is a vector space V together with an innerpro duct

An innerpro duct space H over C is a Hilbert space if it is complete under the induced normwhere

H is complete if every Cauchy sequence converges ie if fx g is a sequence with x H such that

n n

lim kx x k then there is an x in H with lim kx xk

nm n m n n

Given any innerpro duct space V eachvector x V denes a linear functional x V C where

x y x y The set of such linear functionals is also an innerpro duct space and will b e referred to as

the vectordual of V and denoted V In the case that V is a Hilb ert space V is called the dual of V and

is the set of all continuous linear functionals on V and the dual space V is also a Hilb ert space

In Diracs notation a vector from an innerpro duct space V is identied using the ket notation ji

with some symb ols placed inside to distinguish that vector from all others We denote elements of the

dual space using the bra notation hjThus the dual of ji is hj and the inner pro duct of vectors j i

and ji which is the same as the result of applying functional h j to the vector ji is denoted by h ji

Let U b e a linear op erator on V In Diracs notation we denote the result of applying U to ji as

U ji U also acts as a linear op erator on the dual space V mapping each linear functional hj of the dual

space to the linear functional which applies U followed by hjWe denote the result of applying U to hj

by hjU

For any innerpro duct space V we can consider the usual vector space basis or Hamel basis fj ig

i iI

Every vector ji V can b e expressed as a nite linear combination of basis vectors In the case that

k k and h j j i for i j we refer to the basis as an orthonormal basis With resp ect to an

i i j

P

orthonormal basis we can write eachvector jiV as ji j i where h ji Similarly

i i i i

iI

P

each dual vector hjV can b e written as as hj h j where hj iThus each element

i i i i

iI

ji V can b e thought of as a column vector of the s and each element hj V can b e thoughtof

i

as a rowvector of the s Similarly each linear op erator U may b e represented b y the set of matrix

i

elements fh jU j ig arranged in a square matrix with rows and columns b oth indexed by I Then

i j ij I

the column of U with index i is the vector U j i and the row of U with index i is the dual vector

i

h jU

i

For a Hilb ert space H fj ig is a Hilbert spacebasis for H if it is a maximal set of orthonormal

i iI

vectors in HEvery vector jiH can b e expressed as the limit of a sequence of vectors each of which

can b e expressed as a nite linear combination of basis vectors

Given a linear op erator U in an inner pro duct space if there is a linear op erator U which satises

hU j i hjUi for all then U is called the adjoint or Hermitian conjugate of U If a linear

op erator in an inner pro duct space has an adjoint it is unique The adjoint of a linear op erator in a

Hilb ert space or in a nite dimensional inner pro duct space always exists It is easy to see that if the

adjoints of U and U exist then U U U U and U U U U An op erator U is called

Hermitian or selfadjoint if it is its own adjointU U The linear op erator U is called unitary if its

adjoint exists and satises U U UU I

If we represent linear op erators as square matrices indexed over an orthonormal basis then U is

represented by the conjugate transp ose of U So in Diracs notation wehave the convenient identity

hjU j i h jU ji

Recall that if the innerpro duct space V is the tensor pro duct of two innerpro duct spaces V V then

for each pair of vectors j i V j i V there is an asso ciated tensor pro duct j ij i in V In

Diracs notation we denote j ij i as j ij i

xik A linear op erator is called bounded if kU k is The norm of U is dened as kU k sup kU j

kjxik

nite We will freely use the following standard facts ab out b ounded linear op erators

If U exists then kU k kU k

kU U k kU kkU k

kU k kU k kU U kkU k kU k

Notice that a unitary op erator U must satisfy kU k We will often use the following fact which

tells us that if we approximate a series of unitary transformations with other unitary transformations the

error increases only additively

Fact If U U U U are unitary transformations on an innerpro duct spacethen

kU U U U kkU U k kU U k

This fact follows from Statements and ab ove since

kU U U U k kU U U U k kU U U U k

kU U kkU k kU kkU U k

Miscellaneous notation

If d is a direction fL Rg then d is the opp osite of d

Given two probability distributions P and P over the same domain I the total variation distance

P

between P and P is equal to jP i P ij

iI

We will refer to the cardinality ofasetS as cardS and the length of a string x as jxj

Quantum Turing Machines

Aphysicslike view of randomized computation

Before we formally dene a quantum Turing Machine QTM weintro duce the necessary terminology in

the familiar setting of probabilistic computation As a b onus we will b e able to precisely lo cate the p oint

of departure in the denition of a QTM

Quantum mechanics makes a distinction b etween a systems evolution and its measurement In the

absence of measurement the time evolution of a probabilistic TM can b e describ ed by a sequence of

probability distributions The distribution at eachstepgives the likeliho o d of each p ossible conguration

of the machine We can also think of the probabilistic TM as sp ecifying an innite dimensional sto chastic

matrix M whose rows and columns are indexed by congurations Each column of this matrix gives

the distribution resulting from the corresp onding conguration after a single step of the machine If we

represent the probability distribution at one time step byavector jv i then the distribution at the next

step is given by the pro duct M jv i Inquantum physics terminologywe call the distribution at each step a

linear sup erp osition of congurations and we call the co ecientofeach conguration its probability

its amplitude The sto chastic matrix is referred to as the time evolution op erator

Three comments are in order First not every sto chastic matrix has an asso ciated probabilistic TM

Sto chastic matrices obtained from probabilistic TM are nitely sp ecied and map each conguration by

making only lo cal changes to it Second the supp ort of the sup erp osition can b e exp onential in the run

ning time of the machine Third we need to constrain the entries allowed in the transition function of our

probabilistic TM Otherwise it is p ossible to smuggle hard to compute quantities into the transition ampli

th

tudes for instance by letting the i bit indicate whether the ith deterministic TM halts on a blank tap e

g More generallywe might allow A common restriction is to allow amplitudes only from the set f

any real numb er in the interval which can b e computed by some deterministic algorithm to within

n

any desired in time p olynomial in n Itiseasilyshown that the rst p ossibility is computationally no

more restrictive than the second

Returning to the evolution of the probabilistic TM when we observe the machine after some number

of steps we do not see the linear sup erp osition probability distribution but just a sample from it

If we observe the entire machine then we see a conguration sampled at random according to the

sup erp osition The same holds if we observe just a part of the machine In this case the sup erp osition

collapses to one that corresp onds to the probability distribution conditioned on the value observed By

the linearity of the law of alternatives the mere act of making observations at times earlier than t do es

not change the probability for each outcome in an observation at time tSoeven though the unobserved

sup erp osition mayhave supp ort that grows exp onentially with running time we need only keep trackof

a constant amount of information when simulating a probabilistic TM which is observed at eachstep

The computational p ossibilities of quantum physics arise out of the fact that observing a quantum system

changes its later b ehavior

Recall that a matrix is sto chastic if it has nonnegativerealentries that sum to in each column



The law of alternatives says exactly that the probabilityofanevent A do esnt change if werstcheck to see whether

event B has happ ened P A P AjB P B P Aj B P B

Dening a QTM

Our mo del of randomized computation is already surprisingly close to Deutschs mo del of a QTM The

ma jor change that is required is that in quantum physics the amplitudes in a systems linear sup erp osition

and the matrix elements in a systems time evolution op erator are allowed to b e complex numb ers rather

than just p ositive reals When an observation is made the probability asso ciated with each conguration is

not the congurations amplitude in the sup erp osition but rather the squared magnitude of its amplitude

So instead of always having a linear sup erp osition whose entries sum to we will nowalways have a linear

sup erp osition whose Euclidean length is This means that QTMs must b e dened so that their time

evolution preserves the Euclidean length of sup erp ositions

Making these changes to our mo del wearrive at the following denitions

For completeness let us recall the denition of a deterministic TM There are many standard variations

to the denition of deterministic TM none of which aect their computational p ower In this pap er we will

make our choices consistent with those in Deutschs pap er we consider TMs with a twoway innite

tap e and a single tap e head whichmust move left or right one square on each step We also give standard

denitions for interpreting the input output and running time of a deterministic TM Note that although

we usually restrict our discussion to TMs with tap e head movements fL Rgwe will sometimes consider

generalized TMs with tap e head movements fL N Rg where N means no head movement

Denition A deterministic T uring Machine is dened by a triplet Q where is a nite

alphabet with an identied blank symbol Q is a nite set of states with an identied initial state q and

nal state q q and the deterministic transition function is a function

f

Q Q fL Rg

The TM has a twoway innite tapeofcel ls indexedby Z and a single readwrite tapehead that moves

along the tape

A conguration or instantaneous description oftheTMisacomplete description of the the contents of

the tape the location of the tapehead and the state q Q of the nite control At any time only a nite

number of tapecel ls may contain nonblank symbols

For any conguration c of TM M the successor conguration c is dene d by applying the transition

function to the current state q and currently scannedsymbol in the obvious way We write c c to

M

denote that c fol lows from c in one step

By convention we requiretheinitial conguration of M to be satisfy the fol lowing conditions the tape

head is in cel l cal led the start cell and the machine is in state q An initial conguration has input

x if x is written on the tapeinpositions and al l other tapecel ls are blank The TM

halts on input x if it eventual ly enters the nal state q The number of steps a TM takes to halt on input

f

x is its running time on input x If a TM halts then its output is the string in consisting of those tape

contents from the leftmost nonblank symbol to the rightmost nonblank symbol or the empty string if the

eforecomputes a function from to entire tape is blank A TM which halts on al l inputs ther

Wenow give a slightly mo died version of the denition of a QTM provided byDeutsch As in

the case of probabilistic TM wemust limit the transition amplitudes to eciently computable numb ers

Adleman et al and Solovay and Yao have separately shown that further restricting QTMs to

rational amplitudes do es not reduce their computational p ower In fact they have shown that the set

of amplitudes f g are sucient to construct a universal QTM Wegive a denition of the

computation of a QTM with a particular string as input but we defer discussing what it means for a QTM

to halt or give output until x Again we will usually restrict our discussion to QTMs with tap e head

movements fL Rg but will sometimes consider generalized QTMs with tap e head movements fL N Rg

As we p ointed out in the intro duction unlike in the case of deterministic TMs these choices do makea

greater dierence in the case of QTMs This p oint is also discussed later in the pap er

Denition Cal l C the set consisting of C such that there is a deterministic algorithm that

n

computes the real and imaginary parts of to within in time polynomial in n

A quantum Turing Machine QTM M is denedbyatriplet Q where is a nite alphabet

with an identied blank symbol Q is a nite set of states with an identied initial state q and nal

state q q and the quantum transition function is a function

f

Q fLRg

Q C

The QTM has a twoway innite tapeofcel ls indexedbyZ and a single readwrite tapehead that moves

along the tape We dene congurations initial congurations and nal congurations exactly as for

deterministic TMs

Let S be the innerproduct space of nite complex linear combinations of congurations of M with the

Euclidean norm We cal l each element S a sup erp osition of M The QTM M denes a linear operator

U SScal led the time evolution op erator of M as fol lows If M starts in conguration c with current

M

P

state p and scannedsymbol Then after one step M wil l beinsuperposition of congurations c

i i

i

whereeach nonzero corresponds to a transition p qd and c is the new conguration that results

i i

from applying this transition to c Extending this map to the entirespace S through linearity gives the

linear time evolution operator U

M

Note that we dened S by giving an orthonormal basis for it namely the congurations of M In terms

of this standard basis each sup erp osition S may b e represented as a vector of complex numb ers indexed

by congurations The time evolution op erator U may b e represented by the countable dimensional

M

square matrix with columns and rows indexed by congurations where the matrix element from column

c and row c gives the amplitude with which conguration c leads to conguration c in a single step of M

For convenience we will overload notation and use the expression p qd to denote the amplitude

in p of j ijq ijdi

The next denition provides an extremely imp ortant condition that QTMs must satisfy to b e consistent

with quantum physics Wehaveintro duced this condition in the form stated b elow for exp ository purp oses

As we shall see later in x there are other equivalent formulations of this condition that are more familiar

to quantum physics

Denition We wil l say that M is wellformed if the its time evolution operator U preserves

M

Euclidean length

Wellformedness is a necessary condition for a QTM to b e consistent with quantum physics As we shall

see in the next subsection wellformedness is equivalent to unitary time evolution which is a fundamental

requirement of quantum physics

Next we dene the rules for observing the QTM M For those familiar with quantum mechanics we

should state that the denition b elow restricts the measurements to b e in the computational basis of S

This is b ecause the actual basis in which the measurement is p erformed must b e eciently computable

and therefore wemay without loss of generality p erform the rotation to that basis during the computation

itself

P

Denition When QTM M in superposition c is observedormeasured conguration c

i i i

i

is seen with probability jj Moreover the superposition of M is updatedto c

i

We may also perform a partial measurement say only on the rst cel l of the tape In this case sup

P

pose that the rst cel l may contain the values or and suppose the superposition was c

i i

i

P

c where the c are those congurations that have a in the rst cel l and c are those cong

i i i i

i

P

in the rst cel l Measuring the rst cel l results in Pr j j Moreover urations that have a

i

i

P

p

if a is observed the new superposition is given by c iethepart of the superposition

i i

i

Pr

consistent with the answer with amplitudes scaledtogiveaunitvector

Note that the wellformedness condition on a QTM simply says that the the time evolution op erator

of a QTM must satisfy the condition that in each successive sup erp osition the sum of the probabilities of

all p ossible congurations must b e

Notice that a QTM diers from a classical TM in that the user has decisions b eyond just cho osing an

input A priori it is not clear whether multiple observations might increase the p ower of QTMs This p oint

is discussed in more detail in and there it is shown that one may assume without loss of generality

that the QTM is only observed once Therefore in this pap er we shall make simplifying assumptions

ab out the measurement of the nal result of the QTM The fact that these assumptions do not result in

any loss of generality follows from the results in

In general the output of a QTM is a sample from a probability distribution We can regard two

QTMs as functionally equivalent for practical purp oses if their output distributions are suciently close

to each other A formal denition of what it means for one QTM to simulate another is also given in

As in the case of classical TMs the formal denition is quite unwieldy In the actual constructions it will

b e easy to see in what sense they are simulations Therefore we will not replicate the formal denitions

from here Wegive a more informal denition b elow

Denition We say that QTM M simulates M with slowdown f with accuracy if the fol lowing

holds let D be a distribution such that observing M on input x after T steps produces a sample from D

let D be a distribution such that observing M on input x after f T steps produces a sample from D

Then we say that M simulates M with accuracy if jD D j

We will sometimes nd it convenient to measure the accuracy of a simulation by calculating the Eu

clidean distance b etween the target sup erp osition and the sup erp osition achieved by the simulation The

following shows that the variation distance b etween the resulting distributions is at most times this

Euclidean distance

Lemma Let S such that kk k k and k k Then the total variation distance

is at most between the probability distributions resulting from measurements of and

P P

Pro of Let jii and jii Observing gives each jii with probability j j while

i i i

i i

P

observing gives each jii with probability j j Let jii Then the latter

i i i

i

probability j j can b e expressed as

i

j j j j

i i i i i i i i i

i i i

Therefore the total variation distance b etween these two distributions is at most

X X

j j j h jji hjj i kkk k j j k k j

i i i i

i i

i i

e Finally note that since wehave unit sup erp ositions wemust hav

Quantum computing as a unitary transformation

In the preceding sections weintro duced QTMs as an extension of the notion of probabilistic TMs We

stated there that a QTM is wellformed if it preserves the norm of the sup erp ositions In this section we

explore a dierent and extremely useful alternative view of QTMs in terms of prop erties of the time

evolution op erator We prove that a QTM is wellformed i its time evolution is unitary Indeed unitary

time evolution is a fundamental constraint imp osed by quantum mechanics and wechose to state the

wellformedness condition in the last section mainly for exp ository purp oses

Understanding unitary evolution from an intuitivepoint of view is quite imp ortant to comprehending

the computational p ossibilitie s of quantum mechanics Let us explore this in the setting of a quantum

mechanical system that consists of n parts each of whichcanbeinoneoftwo states lab eled ji and ji

these could b e n particles each with a spin state If this were a classical system then at any given instant

it would b e in a single conguration which could b e describ ed by n bits However in quantum physics the

system is allowed to b e in a linear sup erp osition of congurations and indeed the instantaneous state of

n

the system is describ ed by a unit vector in the dimensional vector space whose basis vectors corresp ond

n

to all the congurations Therefore to describ e the instantaneous state of the system wemust sp ecify

n

complex numb ers The implications of this are quite extraordinary even for a small system consisting

of particles nature must keep trackof complex numb ers just to rememb er its instantaneous

state Moreover it must up date these numb ers at each instanttoevolve the system in time This is an

extravagant amount of eort since is larger than the standard estimates on the numb er of particles in

the visible universe So if nature puts in suchextravagantamounts of eort to evolveeven a tiny system

at the level of quantum mechanics it would make sense that we should design our computers to take

advantage of this

However unitary evolution and the rules for measurement in quantum mechanics place signicant

constraints on how these features can b e exploited for computational purp oses One of the basic primitives

that allows these features to b e exploited while resp ecting the unitarity constraints is the discrete fourier

transform this is describ ed in more detail in x Here we consider some very simple cases One

interesting phenomenon supp orted by unitary evolution is the interference of computational paths In

a probabilistic computation the probabilityofmoving from one conguration to another is the sum of

the probabilities of each p ossible path from the former to the latter The same is true of the probability

amplitudes in quantum computation but not necessarily of the probabilities of observations Consider for

p p

example applying the transformation U twice in sequence to the same tap e cell which

p p

at rst contains the symbol If we observe the cell after the rst application of U we see either symbol

with probability If we then observe after applying U a second time the symb ols are again equally

likely However since U is the identityifwe only observe at the end we see a with probability

So even though there are two computational paths that lead from the initial to a nal symb ol they

interfere destructively cancelling each other out The two paths leading to a interfere constructively so

that even though b oth have probability when we observetwice wehave probability of reaching if

we observe only once Such a b o osting of probabilities by an exp onential factor lies at the heart of the

QTMs advantage over a probabilistic TM in solving the Fourier sampling problem

Another constraint inherent in computation using unitary transformations is reversibilityWeshowin

R

x that for anyQTM M there is a corresp onding QTM M whose time evolution op erator is the con

jugate transp ose of the time evolution op erator of M and therefore undo es the actions of M Sections

and are devoted to dening the machinery to deal with this feature of QTMs

We prove b elow in App endix A that a QTM is wellformed if and only if its time evolution op erator

is unitary This establishes that our denition which did not mention unitary evolution for exp ository

purp oses do es satisfy the fundamental constraint imp osed by quantum mechanics unitary evolution

Actually one could still ask why this is consistent with quantum mechanics since the space S of nite

linear combinations of congurations is not a Hilb ert space since it is not complete To see that this

do esnt present a problem notice that S is a dense subset of the Hilb ert space H of all not just nite

linear combinations of congurations Moreover any unitary op erator U on S has a unique extension U

to Hand U is unitary and its inverse is U The pro of is quite simple Let U and U b e the continuous

extensions of U and U to HLetx y H Then there are sequences fx g fy gS such that x x

n n n

and y y Moreover for all nUx y x U y Taking limits we get that Uxy x U y

n n n n n

as desired

As an aside we should briey mention that another resolution of this issue is achieved by following

Feynman who suggested that if we use a quantum mechanical system with Hamiltonian U U then

the resulting system has a lo cal time invariant Hamiltonian It is easy to probabilistically recover the

computation of the original system from the computation of the new one

It is interesting to note that the following theorem would not b e true if we dened QTMs using a

oneway innite tap e In that case the trivial QTM which always moves its tap e head rightwould b e

wellformed but its time evolution would not b e unitary since its start conguration could not b e reached

from any other conguration

Theorem A A QTM is wel lformed i its time evolution operator is unitary

Precision required in a QTM

One imp ortant concern is whether QTMs are really analog devices since they involve complex transition

amplitudes The issue here is how accurately these transition amplitudes must b e sp ecied to ensure that

the correctness of the computation is not compromised In an earlier version of this pap er we showed that

O

T bits of precision are sucient to correctly carry out T steps of computation to within accuracy for

Lipton pointed out that for the device to b e regarded as a discrete device wemust any constant

O

require that its transition amplitudes b e sp ecied to at most one part in T as opp osed to accurate to

O

within T bits of precision This is b ecause the transition amplitude represents some physical quantity

such as the angle of a p olarizer or the length of a pulse and wemust not assume that we can sp ecify

it to b etter than one part in some p olynomial in T and therefore the numb er of bits of precision must b e

O log T This is exactly what weproved shortly after Liptons observation and we present that pro of in

this section

The next theorem shows that b ecause of the unitary time evolution errors in the sup erp osition made

over a sequence of steps will in the worst case only add

Theorem Let U be the time evolution operator of a QTM M and TIfj i j ij i j i

T T

are superpositions of U such that

kj ij ik

i i

j i U j i

i i

T

then kj iU j ik T

T

Pro of Let j i j i j iThenwehave

i i i

T T T

j i U j i U j i U j i j i

T T

The theorem follows by the triangle inequalitysinceU is unitary and kj ik

i

Denition We say that QTMs M and M are close if they have the same state set and alphabet

and if the dierencebetween each pair of corresponding transition amplitudes has magnitude at most

Note that M and M can be close even if one or both are not wel lformed

The following theorem shows that two QTMs which are close in the ab ove sense give rise to time

evolution op erators which are close to each other even if the QTMs are not wellformed As a simple

consequence the time evolution op erator of a QTM is always b ounded even if the QTM is not well

formed

Theorem If QTMs M and M with alphabet and state set Q are close then the dierencein

their time evolutions has norm at most card card QMoreover this statement holds even if one or

both of the machines are not wel lformed

Pro of Let QTMs M and M with alphab et and state set Q be given whichareclose Let U be the

time evolution of M and let U b e the time evolution of M

P

Now consider any unit length sup erp osition of congurations ji jc iThenwe can express

j j

j

the dierence in the machines op eration on ji as follows

X X

A

U jiU ji jc i

ij i j

ij

j

iP j

isthesetof i such that conguration c can lead to c in a single step of M or M and where where P j

i j

and are the amplitudes with which c leads to c in M and M

ij i j

ij

Applying the triangle inequality and the fact that the square of the sum of n reals is at most n times

the sum of their squares wehave

P P

kU ji U jik

ij i

j iP j

ij

P P

card cardQ

ij i

iP j j

ij

Then since M and M are close wehave

P P

card cardQ

i ij

j iP j

ij

P P

j j card cardQ

i ij

j iP j

ij

P P

card cardQ j j

i

j iP j

Finally since for any conguration c there are at most card cardQ congurations that can lead

j

to c in a single step wehave

j

P P P

card cardQ j j card cardQ j j

i i

j iP j i

card cardQ

Therefore for any unit length sup erp osition ji

kU U jik card cardQ

The following corollary shows that O log T bits of precision are sucient in the transition amplitudes

to simulate T steps of a QTM to within accuracy for any constant

Corollary Let M Q be a wel lformed QTM and let M be a QTM which is

card cardQT

close to M where ThenM simulates M for time T with accuracy Moreover this statment holds

even if M is not wel lformed

Pro of Let b Without loss of generalitywe further assume

card cardQT

Consider running M and M with the same initial sup erp osition Since M is wellformed by Theo

rem A its time evolution op erator U is unitary By Theorem on page the time evolution

of U op erator of M U is within

T

Applying U can always b e expressed as applying U and then adding a p erturbation of length at most

times the length of the current sup erp osition So the length of the sup erp osition of U at time t is at

t

most Since T this length is at most e Therefore app ealing to Theorem ab ove the

dierence b etween the sup erp ositions of M and M at time T is a sup erp osition of norm at most T

Finally Lemma on page tells us that observing M at time T gives a sample from a distribution

which is within total variation distance of the distributions sampled from by observing M at time T

Inputoutput conventions for QTMs

Timing is of crucial imp ortance to the op eration of a QTM b ecause computational paths can only interfere

if they take the same numb er of time steps Equally imp ortant are the p osition of the tap e head and

alignment of the tap e contents In this subsection weintro duce several inputoutput conventions on

QTMs and deterministic TMs which will help us maintain these relationships while manipulating and

combining machines

Wewould like to think of our QTMs as nishing their computation when they reach the nal state

q However it is unclear howwe should regard a machine whichreaches a sup erp osition in whichsome

f

congurations are in state q but others are not We try to avoid such diculties bysaying that a QTM

f

halts on a particular input if it reaches a sup erp osition consisting entirely of congurations in state q

f

Denition A nal conguration of a QTM is any conguration in state q IfwhenQTMM is

f

run with input x at time T the superp osition contains only nal congurations and at any time less than

T the superposition contains no nal conguration then M halts with running time T on input xThe

superposition of M at time T is cal ledthe nal sup erp osition of M run on input xApolynomialtime

QTM is a wel lformed QTM which on every input x halts in time polynomial in the length of x

Wewould like to dene the output of a QTM which halts as the sup erp osition of the tap e contents of

the congurations in the machines nal sup erp osition However wemust b e careful to note the p osition of

the tap e head and the alignment relative to the start cell in each conguration since these details determine

whether later paths interfere Recall that the output string of a nal conguration of a TM is its tap e

contents from the leftmost nonblank symb ol to the rightmost nonblank symb ol This means that giving

an output string leaves unsp ecied the alignment of this string on the tap e and the lo cation of the tap e

head to b e identied When describing the inputoutput b ehavior of a QTM we will sometimes describ e

this additional information When we do not the additional information will b e clear from context For

example we will often build machines in which all nal congurations have the output string b eginning in

the start cell with the tap e head scanning its rst symbol

Denition A QTM is cal led wellb ehaved if it halts on al l input strings in a nal superposition

whereeach conguration has the tapehead in the same cel l If this cel l is always the start cel l we cal l the

machine stationary Similarly a deterministic TM is cal led stationary if it halts on al l inputs with its tape

head back in the start cel l

To simplify our constructions we will often build QTMs and then combine them in simple ways like

running one after the other or iterating one a varying numb er of times Todosowemust b e able to add

new transitions into the initial state q of a machine However since there may already b e transitions

into q the resulting machine may not b e reversible But we can certainly redirect the transitions out

of the nal state q of a reversible TM or a wellb ehaved QTM without aecting its b ehavior Note that

f

for a wellformed QTM if q alwa ys leads backtoq then there can b e no more transitions into q In

f

that case redirecting the transitions out of q will allow us to add new ones into q without violating

f

reversibilityWewillsay that a machine with this prop ertyisin normal form Note that a wellb ehaved

QTM in normal form always halts b efore using any transition out of q and therefore also b efore using

f

any transition into q This means that altering these transitions will not alter the relevantpartofthe

machines computation For simplicitywe arbitrarily dene normal form QTMs to step right and leave

the tap e unchanged as they go from state q to q

f

Denition A QTM or deterministic TM M Q is in normal form if

q j ijq ijRi

f

We will need to consider QTMs with the sp ecial prop erty that any particular state can b e entered while

the machines tap e head steps in only one direction Though not all QTMs are unidirectional we will

sho w that any QTM can b e eciently simulated by one that is Unidirectionality will b e a critical concept

in reversing a QTM in completing a partially describ ed QTM and in building our universal QTM We

further describ e the advantages of unidirectional machines after Theorem in x

Denition A QTM M Q is cal led unidirectional if each state can be enteredfrom only

one direction In other words if p qd and p qd areboth nonzero then d d

Finallywe will nd it convenient to use the common to ol of thinking of the tap e of a QTM or

deterministic TM as consisting of several tracks

Denition A multitrack TM with k tracks is a TM whose alphabet is of the form

k

with a sp ecial blank symbol in each so that the blank in is Wespecify the input by

i

specifying the string on each track and optional ly by specifying the alignment of the contents of the

k

is started in the superposition consisting tracks So a TM run on input x x x

i k

i

th

only of the initial conguration with the nonblank portion of the i coordinate of the tapecontaining

the string x starting in the start cel l More general ly on input x jy x jy x jy with x y the

i k k i i

i

th

nonblank p ortion of the i track is x y aligned so that the rst symbol of each y is in the start cel l Also

i i i

input x x x with x x is abbreviatedasx x x

k l k l

Programming a QTM

In this section we explore the fundamentals of building up a QTM from several simpler QTMs Im

plementing basic programming primitives such as lo oping branching and reversing a computation is

straightforward for deterministic TMs However these constructions are more dicult for QTMs b ecause

one must b e very careful to maintain reversibility In fact the same diculties arise when building re

versible deterministic TMs However building reversible TMs up out of simpler reversible TMs has never

b een necessary This is b ecause Bennett showed how to eciently simulate any deterministic TM with

one which is reversible So one can build a reversible TM by rst building the desired computation with

a nonreversible machine and then using Bennetts construction None of the constructions in this section

makeany sp ecial use of the quantum nature of QTMs and in fact all techniques used are the same as

those required to make the analogous construction for reversible TMs

We will show in this section that reversible TMs are a sp ecial case of QTMs So as Deutsch noted

Bennetts result allows any desired deterministic computation to b e carried out on a QTM However

Bennetts result is not sucienttoallow us to use deterministic computations when building up QTMs

b ecause the dierent computation paths of a QTM will only interfere prop erly provided that they take

exactly the same numb er of steps We will therefore carry out a mo died version of Bennetts construction

to show that any deterministic computation can b e carried out byareversible TM whose running time

dep ends only on the length of its input Then dierent computation paths of a QTM will take the same

numb er of steps provided that they carry out the same deterministic computation on inputs of the same

length

Reversible Turing Machines

Denition A reversible Turing Machine is a deterministic TM for which each conguration has at

most one predecessor

Note that wehave altered the denition of a reversible TM from the one used by Bennett sothat

our reversible TMs are a sp ecial case of our QTMs First wehave restricted our reversible TM to move

its head only left and right instead of also allowing it to stay still Second we insist that the transition

function b e a complete function rather than a partial function Finallywe consider only reversible TMs

with a single tap e though Bennett worked with multitap e machines

Theorem Any reversible TM is also a wel lformed QTM

Pro of The transition function of a deterministic TM maps the current state and symb ol to an up date

triple If we think of it as instead giving the unit sup erp osition with amplitude for that triple and

elsewhere then is also a quantum transition function and wehave a QTM The time evolution matrix

corresp onding to this QTM contains only the entries and Since Corollary B proven b elowin

App endix B tells us that each conguration of a reversible TM has exactly one predecessor this matrix

must b e a p ermutation matrix If the TM is reversible then there must b e at most one in eachrow

P

jc i is mapp ed by this time evolution matrix to some Therefore any sup erp osition of congurations

i i

i

P

other sup erp osition of congurations jc i So the time evolution preserves length and the QTM is

i

i i

wellformed

Previous work of Bennett shows that reversible machines can eciently simulate deterministic TMs

Of course if a deterministic TM computes a function which is not onetoone then no reversible machine

can simulate it exactly Bennett showed that a generalized reversible TM can do the next b est thing

which istotakeany input x and compute x M x where M x is the output of M on input x He also

showed that if a deterministic TM computes a function which is onetoone then there is a generalized

reversible TM that computes the same function For b oth constructions he used a multitap e TM and

also suggested how the simulation could b e carried out using only a singletap e machine Morita etal

use Bennetts ideas and some further techniques to show that any deterministic TM can b e simulated by

a generalized reversible TM with a twosymb ol alphab et

We will give a slightly dierentsimulation of a deterministic TM with a reversible machine that

preserves an imp ortant timing prop erty

First we describ e why timing is of critical imp ortance In later sections we will build QTMs with

interesting and complex interference patterns However two computational paths can only interfere if they

reach the same conguration at the same time We will often want paths to interfere which run muchof

the same computation but with dierent inputs We can only b e sure they interfere if weknow that these

computations can b e carried out in exactly the same running time We therefore want to show that any

function computable in deterministic p olynomial time can b e computed by a p olynomial time reversible

TM in suchaway that the running time of the latter is determined entirely by the length of its input

Then provided that all computation paths carry out the same deterministic algorithms on the inputs of

the same length they will all take exactly the same numb er of steps

We prove the following theorem in App endix B on page using ideas from the constructions of Bennett

and Morita etal

Theorem Synchronization Theorem If f is a function mapping strings to strings which can

becomputed in deterministic polynomial time and such that the length of f x depends only on the length

of x then thereisapolynomial time stationary normal form reversible TM which given input xproduces

output x f x and whose running time depends only on the length of x

If f is a function from strings to strings that such that both f and f can becomputed in deterministic

polynomial time and such that the length of f x depends only on the length of x then thereisapolynomial

time stationary normal form reversible TM which given input xproduces output f x and whose running

time depends only on the length of x

Programming primitives

Wenow showhow to carry out several programming primitives reversibly The Branching Reversal and

Lo oping Lemmas will b e used frequently in subsequent sections

The pro ofs of the following two lemmas are straightforward and are omitted However they will b e

quite useful as we build complicated machines since they allow us to build a series of simpler machines

while ignoring the contents of tracks not currently b eing used

Lemma Given any QTM reversible TM M Q and any set thereisaQTMreversible

TM M Q such that M behaves exactly as M while leaving its second track unchanged

Lemma Given any QTM reversible TM M Q and permutation k

k

k there is a QTM reversible TM M Q suchthattheM behaves exactly

k

as M except that its tracks arepermutedaccording to

The following two lemmas are also straightforward but stating them separately makes Lemma

below easy to prove The rst deals with swapping transitions of states in a QTM We can swap the

outgoing transitions of states p and p for transition function by dening p p p

p and p p for p p p Similarlywecanswap the incoming transitions of states q

and q by dening p q d p q d p q d p q d and p qd

p qdfor q q q

Lemma If M is a wel lformedQTMreversible TM then swapping the incoming or outgoing

transitions between a pairofstatesinM gives another wel lformedQTMreversible TM

Lemma Let M Q and M Q be two wel lformed QTMs reversible TMs with

the same alphabet and disjoint state sets Then then the union of the two machines M Q Q

and with arbitrarily chosen start state q Q Q is also a wel lformedQTMreversible TM

Using the two preceding lemmas we can insert one machine in place of a state in another When

we p erform such an insertion the computations of the t womachines might disturb each other However

sometimes this can easily b e seen not to b e the case For example in the insertion used by the Dovetailing

Lemma b elow we will insert one machine for the nal state of a wellb ehaved QTM so that the computation

of the original machine has completed b efore the inserted machine b egins In the rest of the insertions we

carry out the twomachines will op erate on dierenttracks so the only p ossible disturbance involves the

p osition of the tap e head

Lemma If M and M are normal form QTMs reversible TMs with the same alphabet and q is

a state of M then thereisanormalformQTMM which acts as M except that each time it would enter

state q it instead runs machine M

Pro of Let M and M b e as stated with initial and nal states q q q q and with q a state of

f f

M

Then we can construct the desired machine M as follows First take the union of M and M according

to Lemma on page and make the start state q if q q and q otherwise and make the nal

state q if q q and q otherwise Then swap the incoming transitions of q and q and the outgoing

f f f

transitions of q and q according to Lemma on page to get the wellformed machine M

f

Since M is in normal form the nal state of M leads back to its initial state no matter whether q is

the initial state of M the nal state of M or neither

Next we showhowtotaketwomachines and form a third bydovetailing one onto the end of the

other Notice that when wedovetail QTMs the second QTM will b e started with the nal sup erp osition of

the rst machine as its input sup erp osition If the second machine has diering running times for various

t not halt even though the two original strings in this sup erp osition then the dovetailed machine migh

machines were wellb ehaved Therefore a QTM built bydovetailing twowellb ehaved QTMs may not

itself b e wellb ehaved

Lemma Dovetailing Lemma If M and M are wel lbehaved normal form QTMs reversible

TMs with the same alphabet then there is a normal form QTM reversible TM M which carries out the

computation of M fol lowedbythecomputation of M

Pro of Let M and M be wellb ehaved normal form QTMs reversible TMs with the same alphab et

and with start states and nal states q q q q

f f

To construct M we simply insert M for the nal state of M using Lemma on page

To complete the pro of we need to show that M carries out the computation of M followed by that

of M

To see this rst recall that since M and M are in normal form the only transitions into q and q

are from q and q resp ectively This means that no transitions in M havebeenchanged except for

f f

those into or out of state q Therefore since M is wellb ehav ed and do es not prematurely enter state

f

q the machine M when started in state q will compute exactly as M until M would halt At that

f

point M will instead reach a sup erp osition with all congurations in state q Then since no transitions

in M havebeenchanged except for those into or out of q M will pro ceed exactly as if M had b een

f

started in the sup erp osition of outputs computed by M

Now we showhow to build a conditional branch around two existing QTMs or reversible TMs The

branching machine will run one of the twomachines on its rst track input dep ending on its second track

input Since a TM can have only one nal state wemust rejoin the two branches at the end We can join

reversibly if we write back out the bit that determined whichmachine was used The construction will

simply build a reversible TM that accomplishes the desired branching and rejoining and then insert the

twomachines for states in this branching machine

Lemma Branching Lemma If M and M are wel lbehaved normal form QTMs reversible

TMs with the same alphabet then there is a wel lbehaved normal form QTM reversible TM M such

that if the second track is empty M runs M on its rst track and leaves its second track empty and if

the second track has a in the start cel l and al l other cel ls blank M runs M on its rst track and

leaves the where its tapehead ends up In either case M takes exactly four time steps morethanthe

appropriate M

i

Pro of Let M and M be wellb ehaved normal form QTMs reversible TMs with the same alphab et

Then we can construct the desired QTM as follows We will showhow to build a stationary normal

form reversible TM BR whichalways takes four time steps and leaves its input unchanged always has a

with the following prop erties sup erp osition consisting of a single conguration and has two states q and q

If BR is run with a in the start cell and blanks elsewhere then BR visits q once with a blank tap e

and with its tap e head in the start cell and do esnt visit q at all and similarly if BR is run with a blank

tap e then BR visits q once with a blank tap e and with its tap e head in the start cell and do esnt visit q

at all Then if we extend M and M to have a second track with the alphab et of BR extend BR to have

a rst track with the common alphab et of M and M and insert M for state q and M for state q in

BRwe will have the desired QTM M

We complete the construction by exhibiting the reversible TM BR The machine enters state q or q

dep ending on whether the start cell contains a and steps left and enters the corresp onding q or q while

stepping back right Then it enters state q while stepping left and state q while stepping back right

f

So we let BR have alphab et f g state set fq q q q q q q g and transition function dened

f

by the following table

q q L q L

q q R

q R q

q q L

q q L

q q R

f

q q R q R

f

It can b e veried that the transition function of BR is onetoone and that it can enter each state while

moving in only one direction Therefore app ealing to Theorem B on page it can b e completed to

give a reversible TM

Finallyweshowhowtotake a unidirectional QTM or reversible TM and build its reverse Two

computational paths of a QTM will interfere only if they reach congurations that do not dier in any

way This means that wemust b e careful when building a QTM to erase any information that might dier

along paths whichwewanttointerfere We will therefore sometimes use this lemma when constructing a

QTM to allow us to completely erase an intermediate computation

Since the time evolution of a wellformed QTM is unitarywe could reverse a QTM by applying the

unitary inverse of its time evolution However this transformation is not the time evolution of a QTM

since it acts on a conguration bychanging tap e symb ols to the left and right of the tap e head However

since each state in a unidirectional QTM can b e entered while moving in only one direction we can reverse

the head movements one step ahead of the reversal of the tap e and state Then the reversal will have its

tap e head in the prop er cell each time a symbol must b e changed

have the same alphabet then we say that M reverses the compu Denition If QTMs M and M

tation of M if identifying the nal state of M with the initial state of M and the initial state of M with

the nal state of M gives the fol lowing For any input x on which M halts if c and are the initial

x x

conguration and nal superposition of M on input xthenM halts on initial superposition with nal

x

superposition consisting entirely of conguration c

x

Lemma Reversal Lemma If M is a normal form reversible TM or unidirectional QTM then

there is a normal form reversible TM or QTM M that reverses the computation of M while taking two

extra time steps

Pro of Wewillprove the lemma for normal form unidirectional QTMs but the same argumentproves

the lemma for normal form reversible TMs

Let M Q b e a normal form unidirectional QTM with initial and nal states q and q and for

f

each q Q let d b e the direction which M must move while entering state q Then we dene a bijection

q

on the set of congurations of M as follows For conguration c in state q let c b e the conguration

derived from c bymoving the tap e head one square in direction d the opp osite of direction d Since

q q

the set of sup erp ositions of the form jci give an orthonormal basis for the space of sup erp ositions of M

we can extend to act as a linear op erator on this space of sup erp ositions by dening jci jciItis

easy to see that is a unitary transformation on the space of sup erp ositions on M

Our new machine M will have the same alphab et as M and state set given by Q together with new

wing three statements suce to prove that M reverses the initial and nal states q and q The follo

f

computation of M while taking two extra time steps

If c is a nal conguration of M and c is the conguration c with state q replaced by state q then

f

a single step of M takes sup erp osition jc i to sup erp osition jci

If a single step of M takes sup erp osition j i to sup erp osition j iwhere j i has no supp ort on

a conguration in state q then a single step of M takes sup erp osition j i to sup erp osition

j i

If c is an initial conguration of M and c is the conguration c with state q replaced by state q

f

then a single step of M takes sup erp osition j ci to sup erp osition jc i

To see this let x b e an input on which M halts and let j ij i b e the sequence of sup erp ositions

n

of M on input x so that j i jc i where c is the initial sup erp osition of M on xand j i has supp ort

x x n

only on nal congurations of M Then since the time evolution op erator of M is linear Statement

tells us that if we form the initial conguration j i of M by replacing each state q in the j i with

f n

n

state q then M takes j i to j i in a single step Since M is in normal form none of j ij i

n n

n

have supp ort on any sup erp osition in state q Therefore Statement tells us that the next n steps of M

lead to sup erp ositions j ij i Finally Statement tells us that a single step of M maps

n

sup erp osition jc i to sup erp osition jc i

x

x

We dene the transition function to giveawellformed M satisfying these three statements with

the following transition rules

q j ijq ijd i

f q

f

For each q Q q and each

X

q p qd j ijpijd i

q p

p

q j ijq ijd i

q



f

ijRi q j ijq

f

The rst and third rules can easily b e seen to ensure Statements and The second rule can b e

seen to ensure Statement as follows Since M is in normal form it maps a sup erp osition j i to a

sup erp osition j i with no supp ort on any conguration in state q if and only if j i has no supp ort

on any congurations in state q Therefore the time evolution of M denes a unitary transformation

f

from the space S of sup erp ositions of congurations in states from the set Q Q q to the space of

f

sup erp ositions S of congurations in states from the set Q Q q This fact also tells us that the

second rule ab ove denes a linear transformation from space S back to space S Moreover if M takes

conguration c with a state from Q leads with amplitude to conguration c with a state from Q

then M takes conguration c to conguration c with amplitude Therefore the time evolution

of M on space S is the comp osition of and its inverse around the conjugate transp ose of the time

evolution of M Since this conjugate transp ose must also b e unitary the second rule ab ove actually gives

a unitary transformation from the space S to the space S which satises Statement ab ove

Since M is clearly in normal form we complete the pro of byshowing that M is wellformed Tosee

this just note that each of the four rules denes a unitary transformation to one of a set of four mutually

orthogonal subspaces of the spaces of sup erp ositions of M

The Synchronization Theorem will allowustotake an existing QTM and put it inside a lo op so that

the machine can b e run any sp ecied numb er of times

Building a reversible machine that lo ops indenitely is trivial However if wewant to lo op some nite

numb er of times we need to carefully construct a reversible entrance and exit As with the Branching

Lemma ab ove the construction will pro ceed by building a reversible TM that accomplishes the desired

lo oping and then inserting the QTM for a particular state in this lo oping machine However there are

several diculties First in this construction as opp osed to the branching construction the reversible TM

leaves an intermediate computation written on its tap e while the QTM runs This means that inserting a

nonstationary QTM would destroy the prop er functioning of the reversible TM Second even if we insert a

stationary QTM the second and any subsequent time the QTM is run it may b e started in sup erp osition

on inputs of dierent lengths and hence may not halt There is therefore no general statementwe are able

to makeaboutthebehavior of the machine once the insertion is carried out Instead we describ e here the

reversible lo oping TM constructed in App endix C on page and argue ab out sp ecic QTMs resulting

from this machine when they are constructed

Lemma Lo oping Lemma There is a stationary normal form reversible TM M andaconstant

c with the fol lowing properties On input any positive integer k written in binary M runs for time

c

O k log k and halts with its tape unchanged Moreover M has a special state q such that on input k M

visits state q exactly k times each time with its tapehead back in the start cel l

Changing the basis of a QTMs computation

In this section weintro duce a fundamentally quantum mechanical feature of quantum computation namely

changing the computational basis during the evolution of a QTM In particular we will nd it useful to

change to a new orthonormal basis for the transition function in the middle of the computation each

state in the new state set is a linear combination of states from the original machine

This will allowustosimulate a general QTM with one that is unidirectional It will also allowusto

prove that any partially dened quantum transition function which preserves length can b e extended to

giveawellformed QTM

We start by showing howtochange the basis of the states of a QTM Then wegive a set of conditions

for a quantum transition function that are necessary and sucient for a QTM to b e wellformed The last

of these conditions called separability will allow us to construct a basis of the states of a QTM which will

allow us to prove the Unidirection and Completion Lemmas b elow

The change of basis

If we takeawellformed QTM and cho ose a new orthonormal basis for the space of sup erp ositions of its

states then translating its transition function into this new basis will give another wellformed QTM that

evolves just as the rst under the change of basis Note that in this construction the new QTM has the

same time evolution op erator as the original machine However the states of the new machine dier from

those of the old This change of basis will allowustoprove Lemmas and b elow

Q

Lemma Given a QTM M Q andasetofvectors B from C which forms an orthonormal

Q

basis for C thereisaQTMM B which evolves exactly as M under a change of basis from Q

to B

Q

Pro of Let M Q b e a QTM and B an orthonormal basis for C

Since B is an orthonormal basis this establishes a unitary transformation from the space of sup erp o

sitions of states in Q to the space of sup erp ositions of states in B Sp ecicall y for each p Q wehavethe

mapping

X

hpjjv ijv i jpi

v B

Similarlywehave a unitary transformation from the space of sup erp ositions of congurations with states

in Q to the space of congurations with states in B In this second transformation a conguration with

state p is mapp ed to the sup erp osition of congurations where the corresp onding conguration with state

v app ears with amplitude hpjjv i

Let us see what the time evolution of M should lo ok like under this change of basis In M a conguration

in state p reading a evolves in a single time step to the sup erp osition of congurations corresp onding to

the sup erp osition p

X

p p qd j ij q ijdi

qd

With the change of basis the sup erp osition on the right hand side will instead b e

X X

hq jv i p qd j ijv ijdi

q

vd

Now since the state symb ol pair jv ij i in M corresp onds to the sup erp osition

X

hv jpijpij i

p

in M we should havein M

X X X

A

v hv jpi hq jv i p qd j ijv ijdi

p q

v d

Therefore M will b ehave exactly as M under the change of basis if we dene bysaying that for

each v B

X X

v hv jpihq jv i p qd j ijv ijdi

pq

v d

Q

Since the vectors in B are contained in C each amplitude of is contained in C

Finally note that the time evolution of M must preserve Euclidean length since it is exactly the time

evolution of the wellformed M under the change of basis

Lo cal conditions for QTM wellformedness

In our discussion of reversible TMs in App endix B we nd prop erties of a deterministic transition function

which are necessary and sucient for it to b e reversible Similarly our next theorem gives three prop erties

of a quantum transition function which together are necessary and sucient for it to b e wellformed The

rst prop erty insures that the time evolution op erator preserves length when applied to any particular

conguration Adding the second insures that the time evolution preserves the length of sup erp ositions

of congurations with their tap e head in the same cell The third prop erty which concerns restricted

up date sup erp ositions handles sup erp ositions of congurations with tap e heads in diering lo cations This

third prop erty will b e of critical use in the constructions of Lemmas and b elow

Denition We wil l also refer to the superposition of states

X

p qdjq i

q Q

resulting from restricting p to those pieces writing symbol and moving in direction d as a direction

dgoing restricted sup erp osition denotedby p j d

Theorem A QTM M Q is wel lformed i the fol lowing conditions hold

Unit length

p Q k p k

Orthogonality

p p Q p p

Separability

p p Q p j L p j R

Pro of Let U b e the time evolution of a prop osed QTM M Q Weknow M is wellformed

i U exists and U U gives the identity or equivalently i the columns of U have unit length and are

mutually orthogonal Clearly the rst condition sp ecies exactly that each column has unit length In

general congurations whose tap es dier in a cell not under either of their heads or whose tap e heads

o cells apart cannot yield the same conguration in a single are not either in the same cell or exactly tw

step Therefore such pairs of columns are guaranteed to b e orthogonal and we need only consider pairs of

congurations for which this is not the case The second condition sp ecies the orthogonality of pairs of

columns for congurations that dier only in that one is in state p reading while the other is in state

p reading

Finallywemust consider pairs of congurations with their tap e heads two cells apart Such pairs can

only interfere in a single step if they dier at most in their states and in the symb ol written in these cells

The third condition sp ecies the orthogonality of pairs of columns for congurations which are identical

except that the second has its tap e head two cells to the left is in state p instead of p has a instead

of a in the cell under its tap e head and has a instead of a two cells to the left

Now consider again unidirectional QTMs those in whicheach state can b e entered while moving in

only one direction When we considered this prop erty for deterministic TMs it meant that when lo oking

at a deterministic transition function we could ignore the direction up date and think of as giving a

bijection from the current state and tap e symb ol to the new symb ol and state Here if is a unidirectional

quantum transition function then it certainly satises the separability condition since no leftgoing and

rightgoing restricted sup erp ositions have a state in common Moreover up date triples will always share

the same direction if they share the same state Therefore a unidirectional is wellformed i ignoring the

direction up date gives a unitary transformation from sup erp ositions of curren t state and tap e symbol

to sup erp ositions of new symb ol and state

Unidirection and Completion Lemmas

The separability condition of Theorem allows us to simulate any QTM with a unidirectional QTM by

applying a change of basis The same change of basis will also allow us to complete any partially sp ecied

quantum transition function which preserves length

It is straightforward to simulate a deterministic TM with one which is unidirectional Simply split each

state q into two states q and q b oth of whicharegiven the same transitions that q had and then edit

r l

the transition function so that transitions moving rightinto q enter q and transitions moving left into q

r

enter q The resulting machine is clearly not reversible since the transition function op erates the same on

l

each pair of states q q

r l

To simplify the unidirection construction we rst showhowtointerleave a series of quantum transition

functions

Lemma Given k state sets Q Q Q Q and k transition functions each mapping from

k k

one state set to the next

Q fLRg

i

Q C

i i

S

such that each preserves length there is a wel lformedQTMM with state set Q i which alternates

i i

i

stepping according to eachofthe k transition functions

Pro of Supp ose wehave k state sets transition functions as stated ab ove Then welet M b e the QTM

S

Q i and with with the same alphab et with state set given by the union of the individual state sets

i

i

transition function according to the

i

X

p i p qdj ijq i ijdi

i

qd

Clearly the machine M alternates stepping according to It is also easy to see that the time

k

evolution of M preserves lengthIf ji is a sup erp osition of congurations with squared length in the

i

subspace with congurations with states from Q then maps to a sup erp osition with squared length

i

in the subspace with congurations with states from Q

i i

Lemma Unidirection Lemma Any QTM M is simulated with slowdown by a factor of by

a unidirectional QTM M Furthermore if M is wel lbehaved and in normal form then so is M

Pro of The key idea is that the separability condition of a wellformed QTM allows a change of basis to

a state set in whicheachstatecanbeentered from only one direction

The separability condition says that

p p Q

p j R p j L

Q

This means that we can split C into mutually orthogonal subspaces C and C such that spanC C

L R L R

Q

C and

p Q

p j d C

d

Now as shown in Lemma ab ove under a change of basis from state set Q to state set B the new

transition function is dened by

X

v v d hv jpihq jv i p qd

pq

So cho ose orthonormal bases B and B for the spaces C and C and let M B B be

L R L R L R

the QTM constructed according to Lemma whichevolves exactly as M under a change of basis from

state set Q to state set B B B Then any state in M can b e entered in only one direction Tosee

L R

P

this rst note that since p j d B and v hv jq ijq i the separability condition implies that for

d

q

v B

d

X

p qdhv jq i

q

Therefore for any v v B B

d

X

v v d hv jpihq jv i p qd

pq

X X

hv jpi hq jv i p qd

p q

Therefore any state in B can b e entered while traveling in only one direction

Unfortunately this new QTM M might not b e able to simulate M The problem is that the start

state and nal state of M might corresp ond under the change of basis isomorphism to sup erp ositions of

states in M meaning that wewould b e unable to dene the necessary start and nal states for M Tox

this problem we use ve time steps to simulate each step of M and interleave the ve transition functions

using Lemma on page pagerefinterleavinglemma

Step rightleaving the tap e and state unchanged

p j ijpijRi

Change basis from Q to B while stepping left

X

p hpjbij ijbijLi

bB

M carries out a step of the computation of M So is just the quantum transition function

from QTM M constructed ab ove

Change basis back from B to Q while stepping left

X

b hbjpij ijpijLi

pQ

Step rightleaving the tap e and state unchanged

p j ijpijRi

If we construct QTM M with state set Q f g B f g using Lemma on page and

let M have start and nal states q and q then M simulates M with slowdown by a factor of

f

Next wemust show that each of the ve transition functions ob eys the wellformedness conditions and

hence according to Lemma that the interleaved machine is wellformed

The transition function certainly ob eys the wellformedness conditions since M is a well

formed QTM Also and ob ey the three wellformedness conditions since they are deterministic and

reversible Finally the transition functions and satisfy the unit length and orthogonality conditions

since they implementachange of basis and they ob ey the separability condition since they only movein

one direction

Finallywemust show that if M is w ellb ehaved and in normal form then we can make M wellb ehaved

and in normal form

So supp ose M is wellb ehaved and in normal form Then there is a T such that at time T the

sup erp osition includes only congurations in state q with the tap e head back in the start cell and at any

f

time less than T the sup erp osition contains no conguration in state q But this means that when M

f

is run on input x the sup erp osition at time T includes only congurations in state q with the tap e

f

head back in the start cell and the sup erp osition at any time less than T contains no conguration in

state q Therefore M is also wellb ehaved

f

Then for any input x there is a T such that M enters a series of T sup erp ositions of congurations

all with states in Q fq q g and then enters a sup erp osition of congurations all in state q with the

f f

tap e head back in the start cell Therefore on input xM enters a series of T sup erp ositions of

congurations all with states in Q fq q g and then enters a sup erp osition of congurations all

f

in state q with the tap e head back in the start cell Therefore M is wellb ehaved Also swapping the

f

outgoing transitions of q and q which puts M in normal form will not change the computation

f

of M on any input x

When we construct a QTM we will often only b e concerned with a subset of its transitions Luckily

any partially dened transition function that preserves length can b e extended to giveawellformed QTM

Denition AQTMM whose quantum transition function is only dened for a subset S Q

is cal leda partial QTM If the dened entries of satisfy the threeconditions of Theorem on page

then M is cal ledawellformed partial QTM

Suppose M is a wel lformedpartial QTM with quantum transi Lemma Completion Lemma

tion function Then there is a wel lformedQTMM with the same state set and alphabet whose quantum

transition function agrees with wherever the latter is dened

Pro of We noted ab ove that a unidirectional quantum transition function is wellformed i ignoring the

direction up date it gives a unitary transformation from sup erp ositions of current state and tap e symbol

to sup erp ositions of new symb ol and state So if our partial QTM is unidirectional then we can easily ll

in the undened entries of by extending the set of up date sup erp ositions of to an orthonormal basis

for the space of sup erp ositions of new symb ol and state

For a general we can use the technique of Lemma on page to change the basis of away from

Q so that eachstatecanbeentered while moving in only one direction extend the transition function

and then rotate back to the basis Q

We can formalize this as follows

Let M Qbea wellformed partial QTM with dened on the subset S Q Denote by

S the complementofS in Q

Q

As in the pro of of the Unidirection Lemma ab ove the separability condition allows us to partition C

Q

into mutually orthogonal subspaces C and C such that spanC C C and

L R L R

p S

p j d C

d

Then wecho ose orthonormal bases B and B for C and C and consider the unitary transformation

L R L R

from sup erp ositions of congurations with states in Q to the space of congurations with states in B

B B where any conguration with state p is mapp ed to the sup erp osition of congurations where the

L R

corresp onding conguration with state v app ears with amplitude hpjv i

If we call the partial function followed by this unitary change of basis then wehave

X X

p hq jv i p qd j ijv ijdi

q

vd

Since preserves length and is followed by a unitary transformation also preserves length

But now can enter any state in B while moving in only one direction To see this rst note that

P

since p d B and v hv jq ijq i the separability condition implies that for v B

d

q

d

X

p qdhv jq i

q

Therefore for any p v S B

d

X

p vd hq jv i p q

q

Therefore any state in B can b e entered while traveling in only one direction

Then since the direction is implied by the new state we can think of as mapping the current state

and symb ol to a sup erp osition of new symb ol and state Since preserves length the set S isa setof

orthonormal vectors and we can expand this set to an orthonormal basis of the space of sup erp ositions

of new symb ol and state Adding the appropriate direction up dates and assigning these new vectors arbi

trarily to S wehave a completely dened that preserves length Therefore assigning S as S

followed by the inverse of the basis transformation gives a completion for that preserves length

An ecient QTM implementing anygiven unitary transformation

Supp ose that the tap e head of a QTM is conned to a region consisting of k contiguous tap e cells the tap e

is blank outside this region Then the time evolution of the QTM can b e describ ed byad dimensional

k

unitary transformation where d k cardQcard In this section we showconversely that there is a

QTM that given any d dimensional unitary transformation as input carries out that transformation on a

region of its tap e Tomake this claim precise wemust sayhow the d dimensional unitary transformation

is sp ecied We assume that an approximation to the unitary transformation is sp ecied bya d d complex

matrix whose entries are approximations to the entries of the actual unitary matrix corresp onding to the

desired transformation Weshow in Theorem on page that there is a QTM which on input and

p

a d dimensional transformation which is within distance of a unitary transformation carries out a

d

d

transformation whichisan approximation to the desired unitary transformation Moreover the running

time of the QTM is b ounded by a p olynomial in d and

In a single step a QTM can map a single conguration into a sup erp osition of a b ounded number of

congurations Therefore in order to carry out an approximation to an arbitrary unitary transformation

on a QTM we showhow to approximate it by a pro duct of simple unitary transformations each such

simple transformation acts as the identity in all but two dimensions We then show that there is a particular

simple unitary transformation such that anygiven simple transformation can b e expressed as a pro duct of

p ermutation matrices and p owers of this xed simple matrix Finallywe put it all together and showhow

to design a single QTM that carries out an arbitrary unitary transformation this QTM is deterministic

except for a single kind of quantum coinip

The decomp osition of an arbitrary unitary transformation into a pro duct of simple unitary transforma

tions is similar to work carried out by Deutsch Deutschs work although phrased in terms of quantum

computation networks can b e viewed as showing that a d dimensional unitary transformation can b e de

comp osed into a pro duct of transformations where each applies a particular unitary transformation to

dimensions and acts as the identity elsewhere Wemust consider here several issues of eciency not ad

dressed by Deutsch First we are concerned that the decomp osition contain a numb er of transformations

which is p olynomial in the dimension of the unitary transformation and in the desired accuracy Second

we desire that the decomp osition can itself b e eciently computed given the desired unitary transforma

tion as input For more recentwork on the ecientsimulation of a unitary transformation by a quantum

computation network see and the references therein

Measuring errors in approximated transformations

In this section we will deal with op erators linear transformations on nite dimensional Hilb ert spaces

It is often convenient to x an orthonormal basis for the Hilb ert space and describ e the op erator bya

nite matrix with resp ect to the chosen basis Let e e b e an orthonormal basis for Hilb ert space

d

d th

H C Then we can represent an op erator U on H byad d complex matrix M whose i j entry

T th

M and we will denote it by M We denote m is Ue e The i row of the matrix M is given by e

i ij j i i

th

by M the conjugate transp ose of M The j column of M is given by Me U the adjointofU is

i i j

represented by the d d matrix M M is unitary i MM M M I It follows that if M is unitary

then the rows and columns of M are orthonormal

Recall that for a b ounded linear op erator U on a Hilb ert space H the norm of U is dened as

jU j sup jUxj

kxk

If we represent U by the matrix M thenwe can dene the norm of the matrix M to b e same as the norm

of U Thus since were working in a nite dimensional space

kM k max kMvk

kv k

Fact If U is unitary then kU k kU k

Pro of x H kUxk UxUx x U Ux x x kxk Therefore kU k and similar

reasoning shows kU k

We will nd it useful to keep trackofhow far our approximations are from b eing unitaryWe will use

the following simple measure of a transformations distance from b eing unitary

Denition Abounded linear operator U is cal led close to unitary if there is a unitary operator U

such that kU U kIfwerepresent U by the matrix M thenwecan equivalently say that M is close

to unitary if there is a unitary matrix M such that kM M k

Notice that app ealing to Statement in xif U is close to unitary then kU k However

the converse is not true For example the linear transformation has norm but is away from

unitary

Next we show that if M is close to unitary then the rows of M are close to unit length and will b e

close to orthogonal

Lemma If a d dimensional complex matrix M is close to unitary then

kM k

i

i j kM M k

i j

Pro of Let M b e the unitary matrix such that kM M k LetN M M Then we know that for

each i kM k and kN k

i i

So for any iwehave M N M Therefore kM k

i i i i

Next since M is unitaryitfollows that for i j M M Therefore M N M N

i i i

j j j

Expanding this as a sum of four terms weget

N M M M N N M N

i i i i

j j j j

Since kM k and kN k the Schwarz inequality tells us that kM N k kN M k

i i

j j

and kN N k Using the triangle inequalitywe conclude that kM M k Therefore

i i

j j

k kM M

i j

We will also use the following standard fact that a matrix with small entries must have small norm

Lemma If M is a ddimensional squarecomplex matrix such that jm j for al l i j then

ij

kM k d

Pro of If eachentry of M has magnitude at most then clearly eachrow M of M must have norm at

i

p

most d So if v is a ddimensional column vector with jv j wemust have

X X

kMvk kM v k d d

i

i i

where the inequality follows from the Scwarz Inequality Therefore kM k d

Decomp osing a unitary transformation

Wenow describ e a class of exceedingly simple unitary transformations whichwe will b e able to carry out

using a single QTM These neartrivial transformations either apply a phase shift in one dimension or

apply a rotation b etween two dimensions while acting as the identity otherwise

Denition A d d unitary matrix M is neartrivial if it satises one of the fol lowing two conditions

i

M is the identity except that one of its diagonal entries is e for some ie jm

jj

i

e k jm andk lm

kk kl

M is the identity except that the submatrix in one pair of distinct dimensions j and k is the rotation by

cos sin

some angle So as a transformation M is neartrivial if there exists

sin cos

and i j such that Me cos e sin e Me sin e cos e andk i j M e e

i i j j i j k k

We callatransformation which satises the former a neartrivial phase shiftandwecal l a transformation

which satises the latter a neartrivial rotation

i

We will write a neartrivial matrix M in the following wayIfM is a phase shift of e in dimension

j then we will write down j j and if M is a rotation of angle between dimensions j and k we will

write down j k This convention guarantees that the matrix that we are sp ecifying is a neartrivial

matrix and therefore a unitary matrix even if for precision reasons we write down an approximation to

the matrix that we really wish to sp ecify This feature will substantially simplify our error analyses

Before we sho whow to use neartrivial transformations to carry out an arbitrary unitary transformation

we rst showhow to use them to map any particular vector to a desired target direction

d

Lemma There is a deterministic algorithm which on input a vector v C andabound

computes near trivial matrices U U such that

d

kU U v kv ke k

d

where e is the unit vector in the rst coordinate direction The running time of the algorithm is bounded

by a polynomial in d log and the length of the input

d

Pro of First we use d phase shifts to map v into the space IR We therefore want to apply to each

v

i

dimension i with v the phase shift SoweletP b e the neartrivial matrix which applies to

i i

kv k

i

Rev

i

dimension i the phase shift by angle where ifv and otherwise cos

i i i i

kv k

i

Rev

i

th

dep ending whether Imv is p ositive or negative Then P P v is the vector with i or cos

i d

kv k

i

co ordinate kv k

i

Next weuse d rotations to move all of the weightofthevector into dimension So we let R be

i

the neartrivial matrix which applies to dimensions i and i the rotation by angle where

i

kv k

i

q

cos

i

P

d

kv k

j

j i

if the sum in the denominator is not and otherwise Then

i

R R P P v kv ke

d d

Now instead of pro ducing these values exactlywe can in time p olynomial in d and log and

i i

the length of the input compute values and which are within of the desired values Call

i i

dkv k

P and R the neartrivial matrices corresp onding to P and R but using these approximations Then

i i

i i

since the distance b etween p oints at angle and on the unit circle in the real plane is at most j j

kR R k

i

i

Thinking of the same inequality on the unit circle in the complex plane wehave

kP P k

i

i

Finally since each matrix P P R R is unitaryFact on page gives us

i i

i i

R P P k d kR R P P R

d d

d d

and therefore

kR R P P v kv ke kd kv k

d d

Wenow showhow the ability to map a particular vector to a desired target direction allows us to

approximate an arbitrary unitary transformation

Theorem There is a deterministic algorithm running in time polynomial in d and log and the

length of the input which when given as input U where and U is a d d complex matrix which is

p

close to unitary computes ddimensional neartrivial matrices U U with n polynomial in d

n

d

d

such that kU U U k

n

Pro of First weintro duce notation to simplify the pro of Let U be a d d complex matrix Then wesay

U is k simple if its rst k rows and columns are the same as those of the ddimensional identity Notice

that the pro duct of two d dksimple matrices is also k simple

If U were dsimple wewould have U I and the desired computation would b e trivial In general

the U which our algorithm must approximate will not even b e simple So our algorithm will pro ceed

th

through d phases such that during the i phase the remaining problem is reduced to approximating a

matrix whichisi simple

ximate a k simple U with a series of neartrivial matrices with the pro duct Supp ose we start to appro

V Then to approximate U wewould still need to pro duce a series of neartrivial matrices whose pro duct

W satises W UV To reduce the problem wemust therefore compute neartrivial matrices whose

pro duct V is such that UV is close to b eing k simple We can accomplish this by using the algorithm

of Lemma ab ove

So let U b e given whichisk simple and is close to unitary and let Z be the lower right d k d k

T

submatrix of Z Weinvoke the pro cedure of Lemma on inputs Z the vector corresp onding to the

rst rowofZ and The output is a sequence of d k dimensional near trivial matrices V V

dk

T

has the prop erty that kVZ kZ ke k such that their pro duct V V V

dk

Now supp ose that we extend V and the V backtod dimensional k simple matrices and we let

i

W UV Then clearly V is unitary and V and W are k simple In fact since V is unitary and U is

close to unitary W is also close to unitary Moreover W is close to b eing k simple as desired We

st st T

k and that the entries of the k will show b elow that the k rowofW satises kW e

k

k

column of W satisfy kw k for j k

jk

So let X b e the d d k simple matrix such that

x x for j x for j x w for j l l

j j jl jl

It follows from our b ounds on the norm of the rst rowof W and on the entries of the rst column of W

p p

that kW X k d Since W is close to unitarywe can then conclude that X is d close

to unitary

Unfortunatelywe cannot compute the entries of W UV exactly Instead app ealing to Lemma

on page we compute them to within d to obtain a matrix W such that kW W k Lets use

the entries of W to dene matrix X analogous to X Using the triangle inequality it is easy to see

p p

that kW X k d and X is d close to unitaryIfwe are willing to incur an error of

p

kW X k d then we are left with the problem of approximating the k simple X by a pro duct

of neartrivial matrices Therefore wehave reduced the problem of approximating the k simple matrix

U by neartrivial matrices to the problem of approximating the k simple matrix X by neartrivial

matrices while incurring two sources of error

p

d since we are approximating X instead of W An error of kW X k

p

The new matrix X is only d close to unitary

p

d Clearly is an upp erb ound on b oth the sources of error cited ab ove Therefore Let

p p

P

d

j d

the total error in the approximation is just d d The last inequality follows since

j

p

d and therefore the sum can b e b ounded by a geometric series Therefore the total error in the

p

approximation is b ounded by since by assumption U is close to unitary for

d

d

It is easy to see that this algorithm runs in time p olynomial in d and log Our algorithm consists of

d iterations of rst calling the algorithm from Lemma on page to compute V and then computing

p

d

d

the matrix X Since the each iteration takes time p olynomial in d and log these d calls take a total

time p olynomial in d and log

st T

Finallywe show as required that the k rowofW satises kW e k and that the

k

k

st

entries of the k column of W satisfy kw k for j k To see this rst recall that

jk

T

the lower dimension V satises kVZ kZ ke k where Z is the rst rowofthelower right k k

T

k Then since submatrix of U Therefore the higher dimension V satises kVU kU ke

k k

k

T st

kU k it follows that kVU e k Therefore the k rowof W satises

k k

k

T

kW e k

k

k

st

Next we will show that this implies that the entries of the k column of W satisfy kw k

jk

for j k To see this rst notice that since V is unitary and U is delta close to unitary W is also

Now close to unitary This means that by Statement of Lemma on page W W

k

j

T

k This implies that jw j Also let us denote by let us use the condition kW e

k k k

k

W the d dimensional rowvector arrived at by dropping w from W Then the condition that W

j jk j k

T

also implies that kW k Also the fact that W is close to unitary implies that is close to e

k

k

kW k Putting all this together wehave W W w w W W

j k k k k j

j

jk

W W w w W W Therefore w w

k j k k k j k k

jk jk



Finally since wemay assume that wehave jw j Therefore jw j

jk jk

Carrying out neartrivial transformations

In this section weshowhow to construct a single QTM that can carry out at least approximatelyany

sp ecied neartrivial transformation Since a neartrivial transformation can apply an arbitrary rotation

either b etween two dimensions or in the phase of a single dimension wemust rst showhow a xed

rotation can b e used to eciently approximate an arbitrary rotation Note that a single copy of this xed

rotation gives the only nonclassical amplitudes those other than in the transition function of the

universal QTM constructed b elow See Adleman et al and Solovay and Yao for the constructions

of universal QTMs whose amplitudes are restricted to a small set of rationals

P

i

Lemma Let R

i

Then there is a deterministic algorithm taking time polynomial in log and the length of the input

which on input with and produces integer output k boundedbya polynomial in

such that

jk R j mod

Pro of First we describ e a pro cedure for computing suchak

Next approximate Start by calculating napower of such that as a fraction with

n

n n

denominator In other words nd an integer m such that

m

n n

n

Then we can let k m b ecause

X

i

n n

mo d m Rmo d m

i

X

i

n

A

mo d m

ilog n

X

m i

n

A

m mo d

n

ilog n

and since

X

i

n nn

m m

ilog n

nn

n

wehave

m m

n n

jm R j mo d m R mo d

n n

n n

n

At this p oint it should b e clear that a single QTM can carry out any sequence of neartrivial trans

formations to any desired accuracy We formalize this notion b elow byshowing that there is a QTM

that accepts as input the descriptions of a sequence of neartrivial transformations and an error b ound

and applies an approximation of the pro duct of these transformations on anygiven sup erp osition The

formalization is quite tedious and the reader is encouraged to skip the rest of the subsection if the ab ove

statement is convincing

Below wegive a formal denition of what it means for a QTM to carry out a transformation

Denition Let be the alphabet of the rst track of QTM M Let V bethecomplex vector

spaceofsuperpositions of k length strings over Let U bea linear transformation on V and let x

U

be a string that encodes U perhaps approximately We say that x causes M to carry out the k cel l

U

transformation U with accuracy in time T if for every ji Voninputjijx iji M halts in exactly T

U

steps with its tapehead back in the start cel l and with nal superposition U jijxiwhere U is a unitary

transformation on V such that kU U kMoreover for a family A of transformations we say that M

carries out these transformations in polynomial time if T is boundedbya polynomial in and the length

of the input

In the case that A contains transformations that are not unitary we say that M carries out the set of

transformations A with closeness factor c if for any and any U A which is cclose to unitary

there is a unitary transformation U with kU U k such that jx iji causes M to carry out the

U

transformation U in time which is polynomial in and the length of its input

Recall that a neartrivial transformation written as x y calls for a rotation b etween dimensions x

i

and y of angle if x y and a phase shift of e to dimension x otherwise So wewant to build a

stationary normal form QTM that takes as input w x y and transforms w according to the near

trivial transformation describ ed by x y with accuracy We also need this QTMs running time to

dep end only on the length of w but not its value If this is the case then the machine will also halt on an

initial sup erp osition of the form jijx y iji where ji is a sup erp osition of equallength strings w

with rst track alphabet f g that carries Lemma There is a stationary normal form QTM M

out the set of neartrivial transformations on its rst trackinpolynomial time

Pro of Using the enco ding x y for neartrivial transformations describ ed ab ovein x we will show

how to construct QTMs M and M with rst track alphab et f g such that M carries out the set of

neartrivial rotations on its rst track in p olynomial time and M carries out the set of neartrivial phase

shifts on its rst track in p olynomial time Using the Branching Lemma page pagerefbranchinglemma

on these twomachines we can construct a QTM that b ehaves correctly provided there is an extra track

containing a when x y and wehave a phase shift to p erform and containing a when x y and we

have a rotation to p erform We can then construct the desired QTM M bydovetailing b efore and after

with machines that compute and erase this extra bit based on x y The Synchronization Theorem lets us

construct two such stationary normal form QTMs whose running times dep end only on the lengths of x

and y Therefore this additional computation will not disturb the synchronization of the computation

Next we showhow to construct the QTM M to carry out neartrivial rotations

It is easy to construct a QTM which on input b applies a rotation by angle between ji and ji while

leaving b alone if b But Lemma ab ove tells us that wecanachieveany rotation by applying

the single rotation R at most a p olynomial numb er of times Therefore the following ve step pro cess will

allow us to apply a neartrivial rotation Wemust b e careful that when we apply the rotation the two

computational paths with b f g dier only in b since otherwise they will not interfere

Calculate k such that k Rmo d

Transform w x y into b x y z where b if w x b ifw y and w x and b otherwise

and where z w if b and z is the empty string otherwise

Run the rotation applying machine k times on the rst bit of z

Reverse Step transforming xyw with w x y into w x y transforming xy into x x y and

transforming xy with x y into y x y

Reverse Step erasing k

h of these ve steps and then dovetailing We build the desired QTM M by constructing a QTM for eac

them together

First notice that the length of the desired output of Steps and can b e computed just from the

length of the input Therefore using Lemmas from page and the Synchronization Theorem from

page we can build p olynomial time stationary normal form QTMs for Steps and which run in

time which dep ends on the lengths of w x y but not their particular values

To complete the construction wemust build a machine for the rotation with these same prop erties

The stationary normal form QTM R with alphab et f g state set fq q q g and transition function

f

dened by

q jijq ijLi cos Rjijq ijLi sin Rjijq ijLi

sinRjijq ijLi cosRjijq ijLi

q jijq ijRi

f

q jijq ijRi jijq ijRi jijq ijRi

f

runs for constant time and applies rotation R between start cell contents ji and ji while leaving other

inputs unchanged Inserting R for the sp ecial state in the reversible TM from the Lo oping Lemma we

can construct a normal form QTM which applies rotation k R between inputs jki and jki while leaving

input jw ki unchanged Since the machine we lo op on is stationary and takes constant time regardless

of its input the resulting lo oping machine is stationary and takes time dep ending only on k

Finally with appropriate use of Lemmas on page and on page we can dovetail these

ve stationary normal form QTMs to achieve a stationary normal form QTM M that implements the

desired computation Since the phase application machine run in time which is indep endentofw x and

y and the other four run in time which dep ends only on the length of w xand y the running time of M

dep ends on the length of w xandy but not on their particular values Therefore it halts with the prop er

output not only if run on an input with a single string w but also if run on an initial sup erp osition with

dierent strings w but with the same neartrivial transformation and

The QTM M to carry out neartrivial phase shifts is the same as M except that we replace the

transition function of the simple QTM which applies a phase shift rotation by angle R as follows giving a

iR

stationary QTM which applies phase shift e if b is a and phase shift otherwise

iR

q jijq ijLi e jijq ijLi jijq ijLi

q jijq ijRi

f

jijq ijRi jijq ijRi jijq ijRi q

f

The pro of that this gives the desired M is identical to the pro of for M and is omitted

Carrying out a unitary transformation on a QTM

Now that we can approximate a unitary transformation by a pro duct of neartrivial transformations and

wehave a QTM to carry out the latter we can build a QTM to apply an approximation of a given unitary

transformation

Theorem Unitary Transformation Theorem There is a stationary normal form QTM M

with rst track alphabet f g that carries out the set of al l transformations on its rst track in poly

p

nomial time with required closeness factor for transformations of dimension d

d

d

k

p

Pro of Given an and a transformation U of dimension d whichis close to unitarywe

d

d

can carry out U to within on the rst k cells of the rst track using the following steps

and a list of neartrivial U U such that kU U U k Calculate and write on clean tracks

n n

n

k

and such that n is p olynomial in

Apply the list of transformations U U each to within

n

n

Erase U U and

n

n

We can construct a QTM to accomplish these steps as follows First using Lemma on page

and the Synchronization Theorem on page we can build p olynomial time stationary normal form

QTMs for Steps and which run in time which dep ends only on U and Finallywe can build a

k

stationary normal form QTM to accomplish Step in time which is p olynomial in and as follows

Wehave a stationary normal form QTM constructed in Lemma on page to apply any sp ecied

neartrivial transformation to within a given b ound Wedovetail this with a machine constructed using

the Synchronization Theorem on page that rotates U around to the end of the list of transformations

Since the resulting QTM is stationary and takes time which dep ends only on and the U we can insert

i

it for the sp ecial state in the machine of the Lo oping Lemma to give the desired QTM for Step

With appropriate use of Lemmas on page and on page dovetailing the QTMs for

these three steps gives the desired M Since the running times of the three QTMs are indep endentofthe

contents of the rst track so is the running time of M Finally notice that when we run M we apply to

the rst k cells of the rst track we apply a unitary transformation U with

kU U k kU U U k kU U U k n

n n

n

as desired

Constructing a universal QTM

A universal QTM must inevitably decomp ose one step of the simulated machine using many simple steps

Astepofthesimulated QTM is a mapping from the computational basis to a new orthonormal basis A

single step of the universal QTM can only map some of the computational basis vectors to their desired

destinations In general this partial transformation will not b e unitary b ecause the destination vectors will

not b e orthogonal to the computational bases whichhavenotyet b een op erated on The key construction

that enables us to achieve a unitary decomp osition is the Unidirection Lemma Applying this lemma we

get a QTM whose mapping of the computational basis has the following prop ertythere is a decomp osition

of the space into subspaces of constant dimension such that each subspace gets mapp ed onto another

More sp ecicallywesaw in the previous section that we can construct a QTM that carries out to a

close approximation any sp ecied unitary transformation On the other hand wehave also noted that

the transition function of a unidirectional QTM sp ecies a unitary transformation from sup erp ositions of

current state and tap e symb ol to sup erp ositions of new symb ol and state This means a unidirectional

QTM can b e simulated by rep eatedly applying this xeddimensional unitary transformation followed by

the reversible deterministic transformation that moves the simulated tap e head according to the new state

So our universal machine will rst convert its input to a unidirectional QTM using the construction of the

Unidirection Lemma and then simulate this new QTM by rep eatedly applying this unitary transformation

and reversible deterministic transformation

Since we wish to construct a single machine that can simulate every QTM wemust build it in such

away that every QTM can b e provided as input Much of the denition of a QTM is easily enco ded

We can write down the size of the alphab et with the rst symb ol assumed to b e the blank symb ol

and we can write down the size of the state set Q with the rst state assumed to b e the start state To

complete the sp ecication we need to describ e the transition function by giving the card cardQ

amplitudes of the form i i i i d If we had restricted the denition of a QTM to include only

machines with rational transition amplitudes then we could write down each amplitude explicitly as the

ratio of twointegers However wehave instead restricted the denition of a QTM to include only those

machines with amplitudes in C which means that for each amplitude there is a deterministic algorithm

n

which computes the amplitudes real and imaginary parts to within in time p olynomial in nWe will

therefore sp ecify by giving a deterministic algorithm that computes each transition amplitude to within

n

in time p olynomial in n

Since the universal QTM we will construct returns its tap e head to the start cell after simulating each

step of the desired machine it will incur a slowdown which is at least linear in T We conjecture that

with more care a universal QTM can b e constructed whose slowdown is only p olylogarithmic in T

Theorem There is a normal form QTM M such that for any wel lformedQTMM any and

M can simulate M with accuracy for T steps with slowdown polynomial in T and any T

Pro of As describ ed ab ove our approach will b e rst to use the construction of the Unidirection Lemma to

build a unidirectional QTM M whichsimulates M with slowdown by a factor of and then to simulate M

We will rst describ e the simulation of M and then return to describ e the easily computable prepro cessing

that needs to b e carried out

So supp ose M Q is a unidirectional QTM that wewishtosimulate on our universal QTM

We start by reviewing the standard technique of representing the conguration of a target TM on the

tap e of a universal TM We will use one track of the tap e of our universal QTM to simulate the current

conguration of M Since the alphab et and state set of M could haveany xed size we will use a series of

log cardQ cells of our tap e referred to as a sup ercell to simulate each cell of M Each sup ercell

holds a pair of integers p where card represents the contents of the corresp onding cell of M

and p cardQ represents the state of M if its tap e head is scanning the corresp onding cell and p

otherwise Since the tap e head of M can only move distance T away from the start cell in time T we only

need sup ercells for the T cells at the center of M s tap e and we place markers to denote the ends

Nowweknowthatifwe ignore the up date direction then gives a unitary transformation U of

dimension d cardQ from sup erp ositions of current state and tap e symb ol to sup erp ositions of

new state and symbol So we can prop erly up date the sup erp osition on the simulation tracks if we rst

apply U to the current state and symbol of M and then move the new state sp ecication left or rightone

sup ercell according to the direction in which that state of M can b e entered

We will therefore build a QTM ST EP that carries out one step of the simulation as follows In addition

to the simulation track this machine will is provided as input a desired accuracy a sp ecication of U

cardQ

p

which is guaranteed to b e close to the unitary and a string s f g whichgives the

d

d

direction in which eachstateofM can b e entered The machine ST EP op erates as follows

Transfer the current state and symbol p to emptywork space near the start cell leaving a sp ecial

marker in their place

Apply U to p to within transforming p into a sup erp osition of new state and symbol q

Reverse Step transferring q back to the marked empty sup ercell and emptying the work space

th

Transfer the state sp ecication q one sup ercell to the right or left dep ending whether the q bit of

s isaor

Using the Synchronization Theorem on page we can construct stationary normal form QTMs for

Steps and whichtake time whichispolynomialinT and for a xed M dep ends only on T Step

can b e carried out in time p olynomial in card cardQ and with the unitary transformation applying

QTM constructed in the Unitary Transformation Theorem With appropriate use of Lemmas on

page and on page dovetailing these four normal form QTMs gives us the desired normal form

QTM ST EP

Since each of the four QTMs takes time which dep ends for a xed M only on T and so do es ST EP

Therefore if we insert ST EP for the sp ecial state in the reversible TM constructed in the Lo oping Lemma

and provide additional input T the resulting QTM ST EP will halt after time p olynomial in T and

after simulating T steps of M with accuracy T

Finallywe construct the desired universal QTM M bydovetailing ST EP after a QTM which carries

out the necessary prepro cessing In general the universal machine must simulate QTMs which are not

unidirectional So the prepro cessing for desired QTM M desired input x and desired simulation accuracy

consists of rst carrying out the construction of Unidirection Lemma to build a unidirectional QTM M

which simulates M with slowdown by a factor of The following inputs are then computed for ST EP

The prop er T sup ercell representation of the initial conguration of M with input x

p

The ddimensional transformation U for M with eachentry written to accuracy

d

T d

The string of directions s for M

The desired number of simulation steps T and the desired accuracy T

It can b e veried that each of these inputs to M can b e computed in deterministic time whichis

p olynomial in T and the length of the input If the transformation U is computed to the sp ecied

p

of the desired unitary accuracy the transformation actually provided to ST EP will b e within

d

T d

U and so will b e close to unitary as required for the op eration of ST EP So each time ST EP

p

d

T d

applies runs with accuracy T it will have applied a unitary transformation which is within T

of U Therefore after T runs of ST EP wewillhave applied a unitary transformation which is within

of the T step transformation of M This means that observing the simulation trackofM after

it has completed will give a sample from a distribution which is within total variation distance of the

distribution sampled from by observing M on input x at time T

The computational p ower of QTMs

In this section we explore the computational p ower of QTMs from a complexity theoretic p oint of view It

is natural to dene quantum analogues of classical complexity classes In classical complexity theory

BPP is regarded as the class of all languages that are eciently computable on a classical computer

The quantum analog of BP P BQP b oundederror quantum p olynomial time should similarly b e

regarded as the class of all languages that are eciently computable on a QTM

Accepting languages with QTMs

Denition Let M be a stationary normal form multitrack QTM M whose last track has alphabet

f g IfwerunM with string x on the rst track and the empty string elsewhere wait until M halts

and then observe the last track of the start cel l we wil l seea with some probability p We wil l say that

M accepts x with probability p and rejects x with probability p

Consider any language L

We say that QTM M exactly accepts the L if M accepts every string x L with probability and

rejects every string x L with probability

We dene the class EQP exact or errorfree quantum p olynomial time as the set of languages which

are exactly acceptedbysomepolynomial time QTM Moregeneral ly we dene the class EQTime T n



Note that the transition function of M is again sp ecied with a deterministic algorithm which dep ends on the algorithm

for the transition function of M



This can b e accomplished by p erforming a measurementtocheck whether the machine is in the nal state q Making

f

this partial measurementdoesnothaveany other eect on the computation of the QTM

as the set of languages which are exactly accepted by some QTM whose running time on any input of length

n is boundedby T n

A QTM accepts the language L with probability p if M accepts with probability at least

p every string x L and rejects with probability at least p every string x L We dene

the class BQP b oundederror quantum p olynomial time as the set of languages which areacceptedwith

probability by some polynomial time QTM Moregeneral ly we dene the class BQTime T n as the

set of languages which areaccepted with probability by some QTM whose running time on any input

of length n is boundedby T n

The limitation of considering only stationary normal form QTMs in these denitions is easily seen not

to limit the computational p ower by app ealing to the stationary normal form universal QTM constructed

in Theorem on page

Upp er and lower b ounds on the p ower of QTMs

Clearly EQP BQP Since reversible TMs are a sp ecial case of QTMs Bennetts results imply that

P EQP and BPP BQP We include these two simple pro ofs for completeness

Theorem P EQP

Pro of Let L b e a language in P Then there is some p olynomial time deterministic algorithm that

on input x pro duces output if x L and otherwise App ealing to the Synchronization Theorem on

page pagerefdetsynchronized there is therefore a stationary normal form QTM running in p olynomial

time which on input x pro duces output xif x Land x otherwise This is an EQP machine accepting

L

Theorem BPP BQP

Pro of Let L b e a language in BPP Then there must b e a p olynomial pn and a p olynomial time

deterministic TM M with output which satisfy the following For anystringx of length nifwe call

pn pn

S the set of bits computed by M on the inputs x y with y f g then the prop ortion of s in

x

S is at least when x L and at most otherwise We can use a QTM to decide whether a string

x

x in the language L by rst breaking into a sup erp osition split equally among all jxijy i and then running

this deterministic algorithm

pn

First wedovetail a stationary normal form QTM whichtakes input x to output x with a

stationary normal form QTM constructed as in Theorem b elow which applies a Fourier transform to

the contents of its second track This gives us a stationary normal form QTM which on input x pro duces

P

jxijy iDovetailing this with a synchronized normal form version of the sup erp osition

pn

pn

y fg

M built according to the Synchronization Theorem on page pagerefdetsynchronized gives a p olynomial

time QTM which on input x pro duces a nal sup erp osition

X

jxijy ijM x y i

pn

pn

y fg

Since the prop ortion of s in S is at least ifx L and at most otherwise observing the bit on

x

the third track will give the prop er classication for string x with probability at least Therefore this

is a BQP machine accepting the language L

Clearly BQP is in exp onential time The next result gives the rst nontrivial upp er b ound on BQP

Theorem BQP PSPACE

Pro of Let M Qbea BQP machine with running time pn

According to Theorem on page anyQTMM whichis

close

card cardQpn

to M will simulate M for pn steps with accuracy If we simulate M with accuracy then the

success probability will still b e at least Therefore we need only work with the QTM M where each

transition amplitude from M is computed to its rst log card cardQpn bits

Now the amplitude of any particular conguration at time T is the sum of the amplitudes of each

p ossible computational path of M of length T from the start conguration to the desired conguration

The amplitude of eachsuch path can b e computed exactly in p olynomial time So if we maintain a stack

of at most pnintermediate congurations we can carry out a depthrst search of the computational tree

to calculate the amplitude of any particular conguration using only p olynomial space but exp onential

time

Finallywe can determine whether a string x of length n is accepted by M by computing the sum of

squared magnitudes at time pn of all congurations that M can reach that haveainthestart cell and

comparing this sum to Clearly the only reachable accepting congurations of M are those with a

in the start cell and blanks in all but the pn cells within distance pn of the start cell So using only

p olynomial space we can step through all of these congurations computing a running sum of the their

squared magnitudes

P

Following Valiants suggestion the upp er b ound can b e further improved to P This pro of

can b e simplied by using a theorem from whichshows howany BQP machine can b e turned into a

clean version M that on input x pro duces a nal sup erp osition with almost all of its weightonx M x

where M xisaifM accepts x and a otherwise This means we need only estimate the amplitude of

this one conguration in the nal sup erp osition of M

Now the amplitude of a single conguration can b e broken down not only into the sum of the amplitudes

of all of the computational paths that reach it but also into the sum of p ositive real contributions the

sum of negative real contributions the sum of p ositive imaginary contributions and the sum of negative

imaginary contributions We will show that each of these four pieces can b e computed using a P machine

Recall that P is the set of functions f mapping strings to integers for which there exists a p olynomial

pn and a language LP such that for any string x the value f x is the numb er of strings y of length

pjxj for which xy is contained in L

Theorem If the language L is contained in the class BQTime T n with T n n with T n

timeconstructible then for any thereisaQTMM which accepts L with probability and has

the fol lowing property When run on input x of length n M runs for time boundedbycT nwhere c is

es a nal superposition in which jxijLxi with Lx if x L and apolynomial in log andproduc

otherwise has squared magnitude at least

P

Theorem BQP P

Pro of Let M Qbea BQP machine with observation time pn App ealing to Theorem

ab ove we can without loss of generality that M is a clean BQP machine ie on any input x at time

pjxj the squared magnitude of the nal conguration with output x M xisatleast

Nowasabove we will app eal to Theorem on page which tells us that if wework with the

QTM M where each amplitude of M is computed to its rst b log card cardQpn bits and

we run M on input x then the squared magnitude at time pjxj of the nal conguration with output

x M x will b e at least

We will carry out the pro of by showing how to use an oracle for the class P to eciently compute

the amplitude of the nal conguration xofM at time T Since with error magnitude less than

the true amplitude has magnitude at most the squared magnitude of this approximated amplitude must

b e within of the squared magnitude of the true amplitude To see this just note that if is the true

amplitude and k k then

kk k k k k kkk k

Since the success probabilityofM is at least comparing the squared magnitude of this approximated

amplitude to lets us correctly classify the string x

We will now showhow to approximate the amplitude describ ed ab ove First notice that the amplitude

of a conguration at time T is the sum of the amplitudes of each computational path of length T from the

start conguration to the desired conguration The amplitude of any particular path is the pro duct of the

amplitudes in the transition function of M used in each step along the path Since each amplitude consists

T

of a real part and an imaginary part we can think of this pro duct as consisting of the sum of terms

each of which is either purely real or purely imaginary So the amplitude of the desired conguration at

T

time T is the sum of these terms over each path We will break this sum into four pieces the sum of

the p ositive real terms the sum of the negative real terms the sum of the p ositive imaginary terms and

the sum of the negative imaginary terms and we will compute each to within error magnitude less than

with the aid of a P algorithm Taking the dierence of the rst two and the last two will then give

us the amplitude of the desired conguration to with error of magnitude at most as desired

We can compute the sum of the p ositiverealcontributions for all paths as follows Supp ose for some

xed constant c which is p olynomial in T we are given the following three inputs all of length p olynomial

T

in T a sp ecication of a T step computational path p of M a sp ecication t of one of the terms

cT

and an integer w between and Then it is easy to see that we could decide in deterministic time

p olynomial in T whether p is really a path from the start conguration of M on x to the desired nal

th

conguration whether the term t is real and p ositive and whether the term t term of the amplitude for

cT

path p is greater than w Ifwexapathp and term t satisfying these constraints then the number

cT cT th

of w for which this algorithm accepts divided by is within of the value of the t for path p

So if we x only a path p satisfying these constraints then the number of t w for which the algorithm

cT cT

accepts divided by is within of the sum of the p ositive real terms for path p Therefore

cT cT

the number of p t w for which the algorithm accepts divided by is within N of the sum of

all of the p ositive real terms of all of the T step paths of M from the start conguration to the desired

conguration Since there are at most cardcardQ p ossible successors for any conguration in a legal

cardcardQlogT

log

cT

path of M cho osing c gives N as desired Similar

T T

P

reasoning gives P algorithms for approximating each of the remaining three sums of terms

Oracle QTMs

In this subsection and the next we will assume without loss of generality that the TM alphab et for each

trackis f g Initially all tracks are blank except that the input trackcontains the actual input

surrounded by blanks We will use to denote f g

In the classical setting an oracle may b e describ ed informally as a device for evaluating some Bo olean

function f on arbitrary arguments at unit cost p er evaluation This allows to formulate

questions suchasiff were eciently computable by a TM which other functions or languages could

b e eciently computed by TMs In this section we dene oracle QTMs so that the equivalent question

can b e asked in the quantum setting

An oracle QTM has a sp ecial query track on which the machine will place its questions for the oracle

Oracle QTMs havetwo distinguished internal states a prequery state q and a p ostquery state q

q a

A query is executed whenever the machine enters the prequery state with a single nonempty blo ckof

nonblank cells on the query track Assume that the nonblank region on the query tap e is in state jx bi

when the prequery state is entered where x b and denotes concatenation Let f be the

Bo olean function computed by the oracle The result of the oracle call is that the state of the query tap e

b ecomes jx b f xi where denotes the exclusiveor addition mo dulo after which the machines

internal control passes to the p ostquery state Except for the query tap e and internal control other parts

of the oracle QTM do not change during the query If the target bit jbi was supplied in initial state ji

then its nal state will b e jf xi just as in a classical oracle machine Conversely if the target bit is

already in state jf xi calling the oracle will reset it to ji a pro cess known as uncomputing whichis

essential for prop er interference to take place

The p ower of quantum computers comes from their ability to follow a coherent sup erp osition of com

putation paths Similarly oracle QTMs derive great p ower from the ability to p erform sup erp ositions of

queries For example an oracle for Bo olean function f might b e called when the query tap e is in state

P

j i jx iwhere are complex co ecients corresp onding to an arbitrary sup erp osition of

x x

x

queries with a constant ji in the target bit In this case after the query the query string will b e left in

P

the entangled state jx f xi

x

x

That the ab ove denition of oracle QTMs yields unitary evolutions is selfevidentifwe restrict ourselves

to machines that are wellformed in other resp ects in particular evolving unitarily as they enter the pre

query state and leave the p ostquery state

O

Let us dene BQTime T n as the sets of languages accepted with probability at least bysome

O

oracle QTM M whose running time is b ounded by T n This b ound on the running time applies to

O

each individual input not just on the average Notice that whether or not M is a BQP machine might

O O

might not b e one dep end up on the oracle O thus M mightbeaBQP machine while M

Wehave carefully dened oracle QTMs so that the same technique used to reverse a QTM in the

Reversal Lemma can also b e used to reverse an oracle QTM

If M is a normal form unidirectional oracle QTM then there is a normal form oracle Lemma

O O

QTM M such that for any oracle O M reverses the computation of M while taking two extratime

steps

Pro of Let M Q b e a normal form unidirectional oracle QTM with initial and nal states q

and q and with query states q q and q We construct M from M exactly as in the pro of of the

f q f a

Since a QTM must b e careful to avoid leaving around intermediate computations on its tap e requiring that the query

track contain only the query string adds no further diculty to the construction of oracle QTMs

Reversal Lemma We further give M the same query states q q as M but with roles reversed Since M

q a

is in normal form and q q wemust have q q Recall that the transition function of M is dened

q f a

so that for q q

X

q p qd j ijpijd i

q p

p

Therefore since state q always leads to state q in M stateq always leads to state q in M Therefore

q a a q

M is an oracle QTM

Next note that since the tap e head p osition is irrelevant for the functioning of the oracle the op eration

O O

of the oracle in M reverses the op eration of the oracle in M Finally the same argument used in the

O O

Reversal Lemma can b e used again here to prove that M is wellformed and that M reverses the

O

computation of M while taking two extra time steps

The ab ove denition of a quantum oracle for an arbitrary Bo olean function will suce for the purp oses

of the present pap er but the abilityofquantum computers to p erform general unitary transformations

suggests a broader denition whichmaybeusefulinothercontexts For example oracles that p erform

more general nonBo olean unitary op erations have b een considered in computational learning theory

and used to obtain large separations b etween quantum and classical relativized complexity classes

See for a discussion of more general denitions of oracle quantum computing

Fourier Sampling and the p ower of QTMs

In this section wegive evidence that QTMs are more p owerful than b oundederror probabilistic TMs We

dene the recursiveFourier sampling problem which on input the program for a b o olean function takes on

value or Weshow that the recursiveFourier sampling problem is in BQP On the other hand we

prove that if the b o olean function is sp ecied by an oracle then the recursiveFourier sampling problem

olog n

is not in BQTime n This result provided the rst evidence that QTMs are more p owerful than

classical probabilistic TMs with b ounded error probability

One could ask what the relevance of these oracle results is in view of the nonrelativizing results on

probabilistically chec kable pro ofs Moreover Arora et al make the case that the fact that the P

versus NP question relativizes do es not imply that the question cannot b e resolved by currenttechniques

in complexity theory On the other hand in our oracle results and also in the subsequent results of

the key prop erty of oracles that is exploited is their backb ox nature and for the reasons sketched b elow

these results did indeed provide strong evidence that BQP BPP of course the later results of

gaveeven stronger evidence This is b ecause if one assumes that P NP and the existence of oneway

functions b oth these hyp otheses are unproven but widely b elieved by complexity theorists it is also

reasonable to assume that in general it is imp ossible to eciently gure out the function computed by

a program by just lo oking at its text ie without explicitly running it on various inputs Such a program

would have to b e treated as a blackb ox Of course such assumptions cannot b e made if the question at

hand is whether P NP

n

C There is a Fourier Sampling Consider the vector space of complex valued functions f Z

natural inner pro duct on this space given by

X

f xg f g x

n

xZ



n

The standard orthonormal basis for the vector space is the set of delta functions Z Cgiven by

y

y and x for x y Expressing a function in this basis is equivalent to sp ecifying its values

y y

n

at each p oint in the domain The characters of the group Z yield a dierent orthonormal basis consisting

P

sx

n

n

of the parity basis functions Z Cgiven by x where s x s x Given any

s s i i

n

i

P

n n

function f Z Cwemay write it in the new parity basis as f f s where f Z C is

s

s

given by f s f The function f is called the discrete Fourier transform or Hadamard transform

s

of f Here the latter name refers to the fact that the linear transformation that maps a function f to its

Fourier transform f is the Hadamard matrix H Clearly this transformation is unitary since it is just

n

eecting a change of basis from one orthonormal basis the delta function basis to another the parity

P P

sj function basis It follows that jf xj jf

x s

n

Moreover the discrete Fourier transform on Z can b e written as the Kronecker pro duct of the trans

p p

form on eachofn copies of Z the transform in that case is given by the matrix This

p p

fact can b e used to write a simple and ecient QTM that eects the discrete Fourier transformation in the

following sense supp ose the QTM has tap e alphab et f g and the initially only n tap e cells contain

P

nonblank symb ols Then we can express the initial sup erp osition as f xjxi where f xisthe

n

xfg

amplitude of the conguration with x in the nonblank cells Then there is a QTM that eects the Fourier

transformation by applying the ab ove transform on eachofthe n bits in the n nonblank cells This takes

P

f sjsi Theorem b elow Notice that this O n steps and results in the nal conguration

n

sfg

n

fourier transformation is taking place over a vector space of dimension On the other hand the result

of the fourier transform f resides in the amplitudes of the quantum sup erp osition and is thus not

directly accessible Wecanhowever p erform a measurement on the n nonblank tap e cells to obtain

P such that P sjf sj We shall refer to this op eration a sample from the probability distribution

as Fourier sampling As we shall see this is a very p owerful op eration The reason is that eachvalue

f s dep ends up on all the exp onentially manyvalues of f and it do es not seem p ossible to anticipate

whichvalues of s will have large probability constructiveinterference without actually carrying out an

exp onential search

n n

Given a b o olean function g Z f gwemay dene a function f Z C of norm by letting

n

f x g x Following Deutsch and Josza if g is a p olynomial time there

P

is a QTM that pro duces the sup erp osition g xjxi in time p olynomial in n Combining this

n

xfg

with the Fourier sampling op eration ab ove we get a p olynomial time QTM that samples from a certain

distribution related to the given p olynomial time computable function g Theorem b elow We shall

call this comp osite op eration Fourier sampling with resp ect to g

Theorem There is a normal form QTM which when run on an initial superposition of nbit strings

ji halts in time n with its tapehead back in the start cel l and produces nal superposition H ji

n

Pro of We can construct the desired machine using the alphab et f g and the set of states fq q q q q g

a b c f

The machine will op erate as follows when started with a string of length n as input In state q the ma

hine steps right along the input string chine steps right and left and enters state q In state q the mac

b b

until it reaches the at the end and enters state q stepping back left to the strings last symb ol During

c

p p

to the bit in each cell In state this rightward scan the machine applies the transformation

p p

q the machine steps left until it reaches the to the left of the start cell at which p oint steps backright

c

and halts The following gives the quantum transition function of the desired machine

q jijq ijRi jijq ijRi

a a

q jijq ijLi

a b

p p p p

jijq ijRi jijq ijRi jijq ijRi jijq ijRi jijq ijLi q

b b b b c b

q jijq ijLi jijq ijLi jijq ijLi

c f c c

jijq ijRi jijq ijRi jijq ijRi q

f

It is can b e easily veried that the Completion Lemma can b e used to extend this machine to a wellformed

QTM and that this machine has the desired b ehavior describ ed ab ove

n

Theorem For every polynomial time computable function g f g f gthereisapolyno

n

mial time stationary QTM where observing the nal superposition on input gives each nbit string s

n

with probability jf sj where f x g x

Pro of We build a QTM to carry out the following steps

P

n

Apply a F ourier transform to to pro duce jii

n

n

ifg

P

Compute f to pro duce jiijf ii

n

n

ifg

P

f ijiijf ii Apply a phaseapplying machine to pro duce

n

n

ifg

P

Apply the reverse of the machine in Step to pro duce f ijii

n

n

ifg

P

f sjsi as desired Apply another Fourier transform to pro duce

n

n

ifg

Wehave already constructed ab ove the Fourier transform machine for Steps and Since f can b e

computed in deterministic p olynomial time the Synchronization Theorem on page lets us construct

p olynomial time QTMs for Steps and whichtake input jii to output jiijf ii and vice versa with

running time indep endent of the particular value of i

Finallywe can apply phase according to f i in Step by extending to two tracks the stationary

normal form QTM with alphab et f g dened by

q jijq ijRi jijq ijRi jijq ijRi

q jijq ijLi jijq ijLi jijq ijLi

f f f

jijq ijRi jijq ijRi jijq ijRi q

f

Dovetailing these ve stationary normal form QTMs gives the desired machine

Remarkably this p erforms Fourier sampling with resp ect to f while calling the

algorithm for f only twice To see more clearly why this is remarkable consider the sp ecial case of

the sampling problem where the function f is one of the unnormalized parity functions Supp ose f

ik n

corresp onds to the parity function ie f i where i k f g Then the result of fourier

k

sampling with resp ect to f is always k Let us call this promise problem the parity problem on input

a program that computes f where f is an unnormalized parity function determine k Notice that the

QTM for fourier sampling extracts n bits of information the value of k using just twoinvo cations of the

subroutine for computing b o olean function f It is not hard to showthatifwe f is sp ecied by an oracle

then in a probabilistic setting extracting n bits of information must require at least n invo cations of the

b o olean function Wenowshowhow to amplify this this advantage of quantum computers over probabilistic

computers by dening a recursiveversion of the parity problem the recursiveFourier sampling problem

To ready this problem for recursion we rst need to turn the parity problem into a problem with range

f g This is easily done by adding a second function g and requiring the answer g k rather than k

itself

n

Now we will make the problem recursive For each problem instance of size nwe will replace the

n

values of f with indep endent recursive subproblems of size n and so on stopping the recursion with

function calls at the b ottom Since a QTM needs only two calls to f to solve the parity problem it will

b e able to solve an instance of the recursive problem of size n recursively in time T n where

T n pol y n T n T n pol y n

However since a PTM needs n calls to f to solve the parity problem the straightforward recursive solution

to the recursive problem on a PTM will require time T n where

log n

T n nT n T n n

To allow ustoprove a separation b etween quantum and classical machines we will replace the functions

with an oracle For any legal oracle O any oracle satisfying some sp ecial constraints to b e describ ed

below we will dene the language R We will show that there is a QTM whichgiven access to any legal

O

oracle O accepts R in time O n log n with success probability but that there is a legal oracle O such

O

olog n O

that R is not contained in BPTime n

O

Our language will consist of strings from f g with length a p ower of We will call all such strings

candidates The decision whether a candidate x is contained in the language will dep end on a recursive

n

tree If candidate x has length n then it will have children in the tree and in general a no de at

l

level l counting from the b ottom with leaves at level for convenience will have children So

n

the ro ot of the tree for a candidate x of length n is identied by the string xits children are each

n

identied by a string xx where x f g and in general a descendent in the tree at level l is

l

identied by a string of the form xx x x with jxj n jx j njx j Notice that

m m

any string of this form for some n apower of and l

in log n denes a no de in some tree So we will consider oracles O which map queries over the

alphab et f g to answers f g and we will use eachsuch oracle O to dene a function V that

O

gives eachnodeavalue f g The language R will contain exactly those candidates x for which

O

V x

O

We will dene V for leaves level no des based directly on the oracle O Soifx is a leaf then we

O

let V x O x

O

We will dene V for all other no des by lo oking at the answer of O to a particular query whichis

O

chosen dep ending on the values of V for its children Consider no de x at level l We will insist that

O

l

the oracle O b e such that there is some k f g such that the children of x all havevalues determined

x

by their paritywithk

x

l

y k

x

V xy y f g

O

and we will then give V x the value O xk We will say that the oracle O is legal if this pro cess allows

O x

us to successfully dene V for all no des whose level is Any query of the form xk with x anodeat

O

l

level l and k f g or of the form x with x a leaf is called a query at node x A query whichis

lo cated in the same recursive tree as no de x but not in the subtree ro oted at x is called outside of x

Notice that for any candidate x the values of V at no des in the tree ro oted at x and the decision whether

O

x is in R all dep end only on the answers of queries lo cated at no des in the tree ro oted at x

O

O

Theorem Thereisanoracle QTM M such that for every legal oracle O M runs in polynomial

time and accepts the language R with probability

O

Pro of Wehave built the language R so that it can b e accepted eciently using a recursive quantum

O

algorithm Toavoid working through the details required to implement a recursive algorithm reversibly

we will instead implement the algorithm with a machine that writes down an iteration that unwraps the

desired recursion Then the Lo oping Lemma will let us build a QTM to carry out this iteration

First consider the recursive algorithm to compute V for a no de xIfx is a leaf then the value V x

O O

can b e found by querying the string x If x is a no de at level l then calculate V as follows

O

l

Split into an equal sup erp osition of the children of x

Recursively compute V for these children in sup erp osition

O

Apply phase to eachchild given bythatchilds value V

O

Reverse the computation of Step to erase the value V

O

Apply the Fourier transform converting the sup erp osition of children of x into a sup erp osition con

sisting entirely of the single string k

x

Query xk to nd the value V for x

x O

Reverse Steps to erase k leaving only x and V x

x O

Notice that the numb er of steps required in the iteration ob eys the recursion discussed ab ove and hence

is p olynomial in the length of xSowe can use the Synchronization Theorem on page to construct a

p olynomial time QTM which for any particular x writes a list of the steps whichmust b e carried out

Therefore we complete the pro of by constructing a p olynomial time QTM to carry out any such a list of

step

Since our algorithm requires us to recursively run b oth the algorithm and its reverse we need to see

how to handle each step and its reverse Before westartwe will ll out the no de x to a description

of a leaf by adding strings of s Then Steps and at level l just require applying the Fourier

l

transform QTM to the bit string at level l in the current no de description Since the Fourier transform

is its own reverse the same machine also reverses Steps and Step is handled by the phaseapplying

machine already constructed ab oveaspartoftheFourier sampling QTM in Theorem Again the

transformation in Step is its own reverse so the same machine can b e used to reverse Step Step

and its reverse can b e handled byareversible TM which copies the relevant part of the currentnode

description queries the oracle and then returns the no de description from the query tap e Notice that

each of these machines takes time which dep ends only on the length of its input

Since wehave stationary normal form QTMs to handle eachstepatlevel l and its reverse in time

l

b ounded by a p olynomial in we can use the Branching Lemma to construct a stationary normal form

QTM to carry out any sp ecied step of the computation Dovetailing with a machine which rotates the

rst step in the list to the end and inserting the resulting machine into the reversible TM of the Lo oping

Lemma gives the desired QTM

log n

Computing the function V takes time n even for a probabilistic computer allowed a b ounded

O

probability of error We can see this with the following intuition First consider asking some set of

queries of a legal O that determine the value of V for a no de x describ ed by the string x x at

O m

level l There are twoways that the asked queries might x the value at x The rst is that the queries

outside of the subtree ro oted at x might b e enough to x V for x If this happ ens wesay that V x

O O

is xedbyconstraint An example of this is that if weasked all of the queries in the subtrees ro oted at

all of the siblings of x then wehave xed V for all of the siblings thereby xing the string k such that

O

y k

V x x y equals

O m

The only other way that the value of the no de x mightbexedisthefollowing If the queries x the

value of V for some of the children of x then this will restrict the p ossible values for the string k such

O x

y k

x

that V xy always equals and such that V x O xk If the query xk for each p ossible

O O x x

k has b een asked and all have the same answers then this xes the value V at x If the query xk for

x O x

the correct k has b een asked then wecall x a hit

x

Now notice that xing the values of a set of children of a level l no de x restricts the value of k to a set

x

l

c

of p ossibiliti es where c is the maximum size of a linearly indep endent subset of the children whose

log n

values are xed This can b e used to prove that it takes n n n

However this intuition is not yet enough since we are interested in arguing against a probabilistic TM

log n

rather than a deterministic TM So we will argue not just that it takes n queries to x the value

log n

of a candidate of length n but that if fewer than n queries are xed then cho osing a random legal

oracle consistent with those queries gives to a candidate of length n the value with probability extremely

close to This will give the desired result To see this call the set of queries actually asked and the

answers given to those queries a run of the probabilistic TM We will haveshown that if wetakeany run

log n

on a candidate of length n with fewer than n queries then the probability that a random legal oracle

agreeing with the run assigns to x the v alue is extremely close to This means that a probabilistic

olog n

TM whose running time is n will fail with probability to accept R for a random legal oracle O

O

Denition A run of size k is denedasapair S f where S is a set of k query strings and f is map

from S to f g such that thereisatleast one legal oracle agreeing with f

Let r be a run let y bea node at level l and let O bea legal oracle at and below y which agrees

with r Then O determines the string k for which V y O y k Ify k is a query in r then we say

y O y y

O makes y a hit for r Suppressing the dependency on r in the notation we dene P y as the probability

that y is a hit for r when we choose a legal oracle at and below y uniformly at random from the set of al l

such oracle at and below y which agree with r Similarly for x an ancestor of y we dene P y as the

x

probability that y is a hit when a legal oracle is chosen at and below x uniformly at random from the set of

al l oracle at and below x which agree with r

Lemma P y P y

x

Pro of Let S b e the set of legal oracles at and b elow y which agree with r We can write S as the disjoint

union of S and S where the former is the set of those oracles in S that make y a hit for r Further

h n

splitting according to the value V y we can write S as the disjoint union of four sets S S S S

O h h n n

cardS

h

It is easy to see that since the oracles in S do Using this notation wehave P y

n

cardS cardS

n

h

not make y a hit for r cardS cardS cardS

n n n

Next consider the set T of all legal oracles dened at and b elow x but outside y which agree with

r Each oracle O T determines by constraint the value V y but leaves the string k completely

O y

undetermined If we again write T as the disjoint union of T and T according to the constrained value

V y we notice that the set of legal oracles at and b elow x is exactly T S T S So wehave

O

cardT cardS cardT cardS

h h

P y

x

cardT cardS cardT cardS

cardT cardS cardT cardS

h h

cardT cardS cardT cardS cardT cardS

h h n

Without loss of generality let cardT cardT Then since nn cwith c n increases with n

wehave

cardT cardS

h

P y

x

cardT cardS cardT cardS

h n

cardT cardS

h

cardT cardS cardT cardS

h n

cardS

h

P y

cardS cardS

h n

log n

For a p ositiveinteger nwe dene n nn Notice that n n

Theorem Suppose r is a run y is a node at level l with q queries from r at or below y and x

l

is an ancestor of y Then P y q n where n

x

Pro of We prove the theorem by induction on l

So x a run r and a no de y at level with q queries from r at or b elo w y Ifq y can never b e a

hit So certainly the probability that y is a hit is at most q as desired

Next we p erform the inductive step So assume the theorem holds true for any r and y at level less

than l with l Then x a run r and a no de y at level l with q queries from r at or b elow y Let

q

l

n Wewillshow that P y and then the theorem will follow from Lemma So for the

n

remainder of the pro of all probabilities are taken over the choice of a legal oracle at and b elow y uniformly

at random from the set of all those legal oracles at and b elow y which agree with r

Now supp ose that q of the q queries are actually at y Clearlyifwe condition on there b eing no

hits among the children of y then k will b e chosen uniformly among all nbit strings and hence the

y

n n

probability y is a hit would b e q Ifwe instead condition on there b eing exactly c hits among the

nc

children of y then the probability that y is a hit mustbeatmostq Therefore the probability y is

n

a hit is b ounded ab oveby the sum of q and the probability that at least nofthechildren of y are

hits

y Applying the inductivehyp othesis with y and z taking the roles of x Now consider anychild z of

and y we know that if r has q queries at and b elow z then P z q n Therefore the expected

z y z

numb er of hits among the children of y is at most q q n This means that the probability that

at least n of the children of y are hits is at most

q q q q

nn n

Therefore

q q q q

P y

n

n n

n

since n for n

olog n

Corollary For any T n which is n relative to a random legal oracle O withprobability

R is not containedin BPTime T n

O

olog n

Pro of Fix T n whichisn

We will show that for any probabilistic TM M whenwe pick a random legal oracle O with probability

O olog n

M either fails to run in time cn or it fails to accept R with error probability b ounded by

O

Then since there are a countable numb er of probabilistic TMs and the intersection of a countable number

of probabilityevents still has probabilitywe conclude that with probabilityR is not contained in

O

olog n

BPTime n

O

We prove the corollary byshowing that for large enough n the probability that M runs in time

n

greater than T n or has error greater than on input is at least for every way of xing the

n

oracle answers for trees other than the tree ro oted at The probabilityistaken over the random choices

n

of the oracle for the tree ro oted at

n

Fix arbitrarily a legal b ehavior for O on all trees other than the one ro oted at Then consider

n O n

picking a legal b ehavior for O for the tree ro oted at uniformly at random and run M on input We

O n

can classify runs of M on input based on the run r that lists the queries the machines asks and the

answers it receives If wetake all probabilities over b oth the randomness in M and the choice of oracle O

O n

then the probabilit y M correctly classies in time T nis

X

Prr Prcor r ect j r

r

where Prr is the probabilityofrunr wherePrcorrect j r is the probabilitytheanswer is correct given

run r and where r ranges over all runs with at most T n queries Theorem tells us that if we

n

n queries then the probability is a hit is less than condition on any run r with fewer than

n

This means that the probability the algorithm correctly classies conditioned on any particular run r

with fewer than n queries is at most Therefore for n large enough that T n is less than

O n

n the probability M correctly classies in time T n is at most So for suciently large n

O

either fails to run in time T n or has success when wecho ose O then with probability at least M

n

probability less than on input

A A QTM is wellformed i its time evolution is unitary

First we note that the time evolution op erator of a QTM always exists Note that this is true even if the

QTM is not wellformed

Lemma A If M is a QTM with time evolution operator U thenU has an adjoint operator U in the

innerproduct space of superpositions of the machine M

Pro of Let M b e a QTM with time evolution op erator U Then the adjointofU is the op erator U is

the op erator whose matrix elementinany pair of dimensions i j is the complex conjugate of the matrix

elementofU in dimensions j i The op erator U dened in this fashion still maps all sup erp ositions to

other sup erp ositions nite linear combinations of congurations since any particular conguration of

M can b e reached with nonzero weight from only a nite numb er of other congurations It is also easy

to see that for any sup erp ositions

hU j i hjUi

as desired

We include the pro ofs of the following standard facts for completeness We will use them in the pro of

of the theorem b elow

Fact A If U is a linear operator on an innerproduct space V and U exists then U preserves norm

i U U I

Pro of For any x V the square of the norm of Ux is UxUx x U Ux It clearly follows that if

U U I then U preserves norm For the converse let B U U I Since U preserves norm for every

x V x U Uxx x Therefore for every x V x B x It follows that B and therefore

U U I

This further implies the following useful fact

Fact A Suppose U is an linear operator in an innerproduct space V and U exists Then

x V kUxk kxk x y V UxUy x y

Pro of Since kUxk kxk UxUx x x one direction follows by substituting x y For the other

direction if U preserves norm then by fact A U U I Therefore UxUy x U Uy x y

We need to establish one one additional fact ab out norm preserving op erators b efore we can prove our

theorem

Fact A Let V bea countable innerproduct space and let fjiig be an orthonormal basis for V

iI

If U is a norm preserving linear operator on V and U exists then i I kU jiikMoreover if

i I kU jiik then U is unitary

Pro of Since U preserves norm kUU jiik kU jiik But the pro jection of UU jii on jii has norm

jhijUU jiij kU jiik Therefore kU jiik kU jiik and therefore kU jiik

Moreover if kU jiik then since U is norm preserving kUU jiik On the other hand the

pro jection of UU jii on jii has norm kU jiik It follows that for j i the pro jection of UU jii on

jj i must have norm Thus jhj jUU jiij Itfollows that UU I

If V is nite dimensional then U U I implies UU I and therefore an op erator is norm preserving

if and only if it is unitaryHowever if H is innite dimensional then U U I do es not imply UU

I Nevertheless the time evolution op erators of QTMs have a sp ecial structure and in fact these two

conditions are equivalent for the time evolution op erator of a QTM

Theorem A A QTM is wel lformed i its time evolution operator is unitary

Pro of Let U b e the norm preserving time evolution op erator of a wellformed QTM M Q

Consider the standard orthonormal basis for the sup erp ositions of M given by the set of vectors jciwhere

c ranges over all congurations of M as always jci is the sup erp osition with amplitude for conguration

c and elsewhere Wemay express the action of U with resp ect to this standard basis byacountable

th

dimensional matrix whose c c entry u hc jU jci This matrix has some sp ecial prop erties First each

cc

row and column of the matrix has only a nite numb er of nonzero entries Secondly there are only nitely

many dierenttyp es of rows where tworows are of the same typ e if their entries are just p ermutations

of each other We shall show that eachro w of the matrix has norm and therefore by the Fact A

ab ove U is unitaryTodosowewillidentify a set of n columns of the matrix for arbitrarily large n

and restrict attention to the nite matrix consisting of all the chosen rows and all columns with nonzero

entries in these rows Let this matrix b e the m n matrix B By construction B satises two prop erties

it is almost square mn for arbitrarily small There is a constant a such that each distinct

rowtyp e of the innite matrix o ccurs at least ma times among the rows of B

Now the sum of the squared norms of the rows of B is equal to the sum of the squared norms of

the columns The latter quantity is just n since the columns of the innite matrix are orthonormal by

Fact A ab ove If we assume that some row of the innite matrix has norm for then we can

cho ose n suciently large and suciently small so that the sum of the squared norms of the rows is at

most m ama m m a n n n a n This gives the required contradiction and

therefore all rows of the innite matrix have norm and therefore by the Fact A ab ove U is unitary

To construct the nite matrix B let k and x some contiguous set of k cells on the tap e Consider

the set of all congurations S such that the tap e head is lo cated within these k cells and such that the

tap e is blank outside of these k cells It is easy to see that the numb er of such congurations n

k

k card cardQ The columns indexed by congurations in S are used to dene the nite matrix B

referred to ab ove The nonzero entries in these columns are restricted to rows indexed by congurations

in S together with rows indexed by congurations where the tap e head is in the cell immediately to the

left or rightofthe k sp ecial cells and such that the tap e is blank outside of these k cells The

k

numb er of these additional congurations over and ab ove S is at most card cardQ Therefore

m n k card For any wecancho ose k large enough such that m n

Recall that a row of the innite matrix corresp onding to the op erator U is indexed by congurations

Wesay that a conguration c is of typ e q if c is in state q Q and the three adjacent tap e cells

centered ab out the tap e head contain the three symb ols The entries of a row indexed by

c must b e a p ermutation of the entries of a row indexed byany conguration c of the same typ e as c

This is b ecause a transition of the QTM M dep ends only on the state of M and the symb ol under the tap e

head and since the tap e head moves to an adjacent cell during a transition Moreover any conguration

d that yields conguration c with nonzero amplitude as a result of a single step must have tap e contents

identical to those of c in all but these three cells It follows that there are only a nite numb er of such

congurations d and the row indexed by c can hav e only a nite numb er of nonzero entries A similar

argument shows that each column has only a nite numb er of nonzero entries

Now for given q consider the rows of the nite matrix B indexed by congurations of

typ e q and such that the tap e head is lo cated at one of the k nonb order cells Then

Consider for example the space of nite complex linear combinations of p ositiveintegers and the linear op erator which

maps jii to ji i

k

jT j k card Eachrowof B indexed by a conguration c T has the prop erty that if d is any

conguration that yields c with nonzero amplitude in a single step then d S Therefore the row indexed

by c in the nite matrix B has the same nonzero entries as the row indexed by c in the innite matrix

Therefore it makes sense to say that row c of B is of the same typ e as row c of the innite matrix Finally

the rows of eachtyp e constitute a fraction at least jT jm of all rows of B Substituting the b ounds from

k 

k card

ab ove we get that this fraction is at least Since k this is at least

k

a

k card cardQk card

for constant a card cardQ card This establishes all the prop erties of the matrix B

used in the pro of ab ove

B Reversible TMs are as p owerful as deterministicTMs

In this app endix weprove the Synchronization Theorem of x

We b egin with a few simple facts ab out reversible TMs We give necessary and sucient conditions

for a deterministic TM to b e reversible and weshow that just as for QTMs a partially dened reversible

TM can always b e completed to giveawellformed reversible TM Wealsogive as an aside an easy pro of

that reversible TMs can eciently simulate reversible generalized TMs

Theorem B ATMorgeneralizedTM M is reversible i the fol lowing two conditions both hold

Each state of M can beentered while moving in only one direction In other words if p

qd and p qd then d d

The transition function is onetoone when direction is ignored

Pro of First weshow that these two conditions imply reversibility

Supp ose M Q is a TM or generalized TM satisfying these two conditions Then the following

pro cedure lets us takeany conguration of M and compute its predecessor if it has one First since each

state can b e entered while moving in only one direction the state of the conguration tells us in whichcell

the tap e head must have b een in the previous conguration Lo oking at this cell we can see what tap e

symbol was written in the last step Then since is onetoone weknow the up date rule if any that was

used on the previous step allowing us to reconstruct the previous conguration

Next we show that the rst prop ertyisnecessaryforreversibility So for example consider a TM

or generalized TM M Qsuch that p qLand p qR Then we can

easily construct two congurations which lead to the same next conguration Let c be an y conguration

where the machine is in state p reading a and where the symbol two cells to the left of the tap e head

is a and let c b e identical to c except that the and are changed to and the machine



is in state p and the tap e head is two cells further left Therefore M is not reversible Since similar

arguments apply for each pair of distinct directions the rst condition in the theorem must b e necessary

for reversibility

Finallywe show that the second condition is also necessary for reversibility Supp ose that M Q

is a TM or generalized TM with p p Then any pair of congurations which dier only in

the state and symb ol under the tap e head where one has p and the other p lead to the same

next conguration and again M is not reversible

Corollary B If M is a reversible TM then every conguration of M has exactly one predecessor

Pro of Let M Qbea reversible TM By the denition of reversibility each conguration of M

has at most one predecessor

So let c b e a conguration of M in state q Theorem B tells us that M can enter state q while

moving its tap e head in only one direction d Since Theorem B tells us that ignoring direction is

q

onetoone taking the inverse of on the state q and the symb ol in direction d tells us how to transform

q

c into its predecessor

Corollary B If isapartial function from Q to Q fL Rg satisfying the two conditions

of Theorem B then can beextended to a total function that stil l satises Theorem B

Pro of Supp ose is a partial function from Q to Q fL R g that satises the prop erties of

Theorem B Then for each q Q let d b e the one direction if any in which q can b e entered and

q

let d b e arbitrarily L otherwise Then we can ll in undened values of with as yet unused triples of

q

the form q d so as to maintain the conditions of Theorem B Since there are card cardQ

q

such triples there will b e exactly enough to fully dene

Theorem B If M is a generalizedreversible TM then thereisareversible TM M that simulates

M with slowdown at most

Pro of The idea is to replace any transition that has the tap e head stand still with two transitions The

rst up dates the tap e and moves to the right rememb ering which state it should enter The second steps

back to the left and enters the desired state

So if M Q is a generalized reversible TM then we let M b e identical to M except that for

each state q with a transition of the form p q N we add a new state q and we also add a new

q qL for each Finallywe replace each transition p q N with transition rule

the transition p q R Clearly M simulates M with slowdown by a factor of at most

To complete the pro of weneedtoshow that M is also reversible

So consider a conguration c of M We need to show that c has at most one predecessor If c is in

state q Q and M enters q moving left or right then the transitions into q in M are identical to those

in M and therefore since M is reversible c has at most one predecessor in M Similarlyifc is in one of

the new states q then the transitions into q in M are exactly the same as those into q in M except that

the tap e head moves right instead of staying still So again the reversibilityofM implies that c has at

most one predecessor Finally supp ose c is in state q Q where M enters q while standing still Then

Theorem B tells us that all transitions in M that enter q have direction N Therefore all of them have

b een removed and the only transitions entering q in M are the new ones of the form q qL

Again this means that c can have only one predecessor

We will prove the Synchronization Theorem in the following way Using ideas from the constructions

of Bennett and Morita etal wewillshow that given any deterministic TM M there is a reversible

multitrackTMwhich on input x pro duces output x M x and whose running time dep ends only on the

sequence of head movements of M on input x Then since any deterministic computation can b e simulated

eciently by an oblivious machine whose head movements dep end only on the length of its input we

will b e able to construct the desired synchronized reversible TM

The idea of Bennetts simulation is to run the target machine keeping a history to maintain reversibility

Then the output can b e copied and the simulation run backwards so that the history is exactly erased

while the input is recovered Since the target tap e head moves back and forth while the history steadily

grows Bennett uses a multitap e TM for the simulation

The idea of Morita etals simulation is to use a simulation tap e with several tracks some of whichare

used to simulate the tap e of the desired machine and some of which are used to keep the history Provided

that the machine can movereversibly b etween the current head p osition of the target machine and the end

of the history it can carry out Bennetts simulation with a quadratic slowdown Morita etal work with

TMs with oneway innite tap es so that the simulating machine can movebetween the simulation and the

history bymoving left to the end of the tap e and then searching backtowards the right In our simulation

we write down history for every step the target machine takes rather than just the nonreversible steps

This means that the end of the history will always b e further right than the simulation allowing us to work

with twoway innite tap es Also we use reversible TMs that can only mo ve their head in the directions

fL Rg rather than the generalized reversible TMs used by Bennett and Morita etal

Denition B A deterministic TM is oblivious if its running time and the position of its tapehead

at eachtimestepdepend only on the length of its input

In carrying out our single tap e Bennett constructions we will nd it useful to rst build simple reversible

TMs to copy a string from one track to another and to exchange the strings on two tracks We will copy

strings delimited by blanks in the single tap e Bennett construction but will copy strings with other

delimiters in a later section

Lemma B For any alphabet there is a normal form reversible TM M with alphabet with

the fol lowing property When run on input x yM runs for maxjxj jy j steps returns the tapehead

to the start cel l and outputs y x

Pro of We let M have alphab et state set fq q q q q g and transition function dened by

f

other

q q L q L

q q R

q q L q R

q q R q L

f

q q R q R

f

Since each state in M can b e entered in only one direction and its transition function is onetoone

M is reversible Also it can b e veried that M p erforms the desired computation in the stated number of

steps

Lemma B For any alphabet there is a normal form reversible TM M with alphabet with

the fol lowing property When run on input x M outputs x x and when run on input x x it outputs xIn

either case M runs for jxj steps and leaves the tapehead back in the start cel l

Pro of We let M have alphab et state set fq q q q q g and transition function dened bythe

f

following where each transition is duplicated for each nonblank

q q L q L q L

q R q

q q L q R q R

q R q L q L q

f

q q R q R q R

f

Since each state in M can b e entered in only one direction and its transition function is onetoone

M can b e extended to a reversible TM Also it can b e veried that M p erforms the desired computation

in the stated numb er of steps

Theorem B Let M be an oblivious deterministic TM which on any input x produces output M x

with no embedded blanks with its tapehead back in the start cel l and with M x beginning in the start

cel l Then thereisareversible TM M which on input x produces output x M x and on input x M x

produces output xInboth cases M halts with its tapehead back in the start cel l and takes time which

depends only on the lengths of x and M x and which is bounded by a quadratic polynomial in the running

time of M on input x

Pro of Let M Q b e an oblivious deterministic TM as stated in the theorem and let q q be the

f

initial and nal states of M

The simulation will run in three stages

M will simulate M maintaining a history to make the simulation reversible

M will copy its rst track as shown in Lemma B

M runs the reverse of the simulation of M erasing the history while restoring the input

We will construct a normal form reversible TM for each of the three stages and then dovetail them

together

Each of our machines will b e a fourtrack TM with the same alphab et The rst track with alphab et

will b e used to simulate the tap e of M The second track with alphab et f g will b e used

to store a single lo cating the tap e head of M The third track with alphab et f g Q

will b e used to write down a list of the transitions taken by M starting with the marker This will

help us nd the start cell when weenter and leave the copying phase The fourth track with alphab et

will b e used to write the output of M

In describing the rst machine we will give a partial list of transitions ob eying the conditions of

Theorem B and then app eal to Corollary B Our machines will usually only b e reading and

writing one track at a time So for convenience we will list a transition with one or more o ccurrences of

the symb ols of the form v and v to stand for all p ossible transitions with v replaced by a symb ol from

i i

i

replaced byasymbolfrom other than the appropriate other than the sp ecial marker and with v

i i

i

and

The rst phase of the simulation will b e handled by the machine M with state set given by the union

of sets Q Q Q Q and fq q g Its start state will b e q and the nal state q

a b a f

The transitions of M are dened as follows First we mark the p osition of the tap e head of M in the

start cell mark the start of the history in cell and enter state q

q v v v v q R

a b

q v v v v q R

b

Then for eachpairp with p q and with transition p q din M we include transitions

f

to go from state p to state q up dating the simulated tap e of M while adding p to the end of the history

W e rst carry out the up date of the simulated tap e rememb ering the transition taken and then moveto

the end of the history to dep osit the information on the transition If we are in the middle of the history

we reach the end of the history bywalking rightuntil we hit a blank However if we are to the left of the

history then wemust rst walk rightover blanks until wereach the start of the history

p v v v v q p d

q p v v v v q p R

q p v v v v v v q p R

q p v v v v q p R

q p v v v v q p R

v v v v q p R q p

q p v v v v v v q p R

q p v v v p v q R

hine reaches state q it is standing on the rst blank after the end of the history So When the mac

for each state q Qwe include transitions to move from the end of the history back left to the head

p osition of M Weenter our walk left state q while writing a on the history tap e So to maintain

reversibilitywemust enter a second leftwalking state q to lo ok for the tap e head marker past the left

end of the history When we reach the tap e head p osition we step left and rightentering state q

q v v v v q L

q L q v v v v v v

q v v v v q L

q v v v v v v q L

q v v v v q L

q v v v v q L

q v v v v q L

q v v v v v v v v q R

Finallywe put M in normal form by including the transition

q q R

f a

for each in the simulation alphab et

It can b e veried that each state can b e entered in only one direction using the ab ove transitions and

relying on the fact that M is in normal form and we dont simulate its transitions from q backto q it

f

can also b e veried that the partial transition function describ ed is onetoone Therefore Corollary B

says that we can extend these transitions to give a reversible TM M Notice also that the op eration of

M is indep endent of the contents of the fourth track and that it leaves these contents unaltered

For the second and third machines we simply use the copying machine constructed in Lemma B

ab ove and the reverse of M constructed using Lemma on page Since M op erated indep endently

of the fourth track so will its reversal Therefore dovetailing these three TMs gives a reversible TM M

whichoninputx pro duces output x M x with its tap e head back in the start cell and on input

x M x pro duces output x

Notice that the time required by M to simulate a step of M is b ounded by a p olynomial in the running

time of M and dep ends only on the current head p osition of M the direction M moves in the step and

how many steps have already b een carried out Therefore the running time of the rst phase of M de

p ends only on the series of head movements of M In fact since M is oblivious this running time dep ends

only the length of x The same is true of the third phase of M since the reversal of M takes exactly two

extra time steps Finally the running time of the copying machine dep ends only on the length of M x

Therefore the running time of M on input x dep ends only on the lengths of x and M x and is b ounded

by a quadratic p olynomial in the running time of M on x

Theorem B Let M be an oblivious deterministic TM which on any input x produces output M x

with no embedded blanks with its tapehead back in the start cel l with M x beginning in the start cel l

and such that the length of M x depends only on the length of xLet M be an oblivious deterministic

TM with the same alphabet as M which on any input M x produces output x with its tapehead back in

the start cel l and with x beginning in the start cel l Then thereisareversible TM M which on input x

produces output M x Moreover M on input x halts with its tapehead back in the start cel l and takes

time which depends only on the length of x and which is boundedbyapolynomial in the running time of

M on input x and the running time of M on M x

Pro of Let M and M b e as stated in the theorem with the common alphab et

Then the idea to construct the desired M is rst to run M to compute x M x then to run an

exchange routine to pro duce M x x and nally to run M to erase the string x where each of the three

phases starts and ends with the tap e head in the start cell Using the construction in Theorem B we

build normal form reversible TMs to accomplish the rst and third phases in times which dep end only on

the lengths of x and M x and b ounded by a p olynomial in the running times of M on input x and M

on input M x In Lemma B on page wehave already constructed a reversible TM that p erforms

hange in time dep ending only on the lengths of the two strings Dovetailing these three machines the exc

gives the desired M

Since any function computable in deterministic p olynomial time can b e computed in p olynomial time

by an oblivious generalized deterministic TM Theorems B and B together with Theorem

give us the following

Theorem Synchronization Theorem If f is a function mapping strings to strings which

can becomputed in deterministic polynomial time and such that the length of f x depends only on the

length of x then thereisapolynomial time stationary normal form QTM which given input xproduces

output x f x and whose running time depends only on the length of x

If f is a function from strings to strings that such that both f and f can becomputed in deterministic

polynomial time and such that the length of f x depends only on the length of x then thereisapolynomial

time stationary normal form QTM which given input xproduces output f x and whose running time

depends only on the length of x

C Areversible lo oping TM

We prove here the Lo oping Lemma from x

Lemma Lo oping Lemma There is a stationary normal form reversible TM M and a

constant c with the fol lowing properties On input any positive integer k written in binary M runs for

c

time O k log k and halts with its tape unchanged Moreover M has a special state q such that on input

k M visits state q exactly k times each time with its tapehead back in the start cel l

Pro of As mentioned ab ovein x the diculty is to construct a lo op with a reversible entrance and exit

We accomplish this as follows Using the Synchronization Theorem we can build threetrack stationary

normal form reversible TM M Q running in time p olynomial in log k that on input b x k where

b f g outputs b x k where b is the opp osite of b if x ork but not b oth and b b

otherwise Calling the initial and nal states of this machine q q we construct a reversible M that

f

lo ops on machine M as follows We will give M new initial and nal states q q and ensure that it has

a z

the following three prop erties

Started in state q with a on the rst track M steps left and backright changing the to a

a

and entering state q

When in state q withaonthersttrack M steps left and backrightinto state q

f

When in state q with a on the rst track M steps left and backright changing the to a and

f

halts

So on input kM will step left and rightinto state q c hanging the tap e contents to k Then

machine M will run for the rst time changing k to k and halting in state q Whenever M is

f

in state q with a on the rst track it reenters q to run M again So machine M will run k more

f

times until it nally pro duces k k At that p oint M changes the tap e contents to k k and halts So

on input k M visits state q exactly k times each time with its tap e head back in the start cell This

f

means we can construct the desired M by identifying q as q and dovetailing M b efore and after with

f

reversible TMs constructed using the Synchronization Theorem to transform k to k and k k back

to k

We complete the pro of by constructing a normal form reversible M that satises the three prop erties

ab ove We give M the same alphab et as M and additional states q q q q The transition function

a b y z

for M is the same as that of M for states in Q q and otherwise dep ends only on the rst trackleaving

f

the others unchanged and is given by the following table

q q L

a b

q R q

b

q L q L q

b y f

q q R

y z

q q R q R q R

z a a a

It is easy to see that M is is normal form and satises the three prop erties stated ab ove Moreover since

M is reversible and ob eys the two conditions of Theorem B it can b e veried that the transition

function of M also ob eys the two conditions of Theorem B Therefore according to Theorem B

the transition function of M can b e completed giving a reversible TM

Acknowledgements

This pap er has greatly b enetted from the careful reading and many useful comments of Richard Jozsa

and Bob SolovayWe wish to thank them as well as Gilles Brassard Charles Bennett Noam Nisan and

Dan Simon

References

Adleman L DeMarrais J and Huang M Quantum computability manuscript

Arora S Impagliazzo R Vazirani U On the Role of the CookLevin Theorem in Complexity

Theorymanuscript

Arora S Lund C Motwani R Sudan M and SzegedyM Proof verication and intractabil

ity of approximation problems Pro ceedings of the rd Annual IEEE Symp osium on Foundations of

Computer Science

Babai L and Moran S ArthurMerlin games arandomizedproof system and a hierarchy of

complexity classes Journal of Computer and System Sciences

Barenco A Bennett C Cleve R DiVincenzo D Margolus N Shor P

Sleator T Smolin J and Weinfurter H Elementary gates for quantum computation

manuscript

Benioff P Quantum Hamiltonian models of Turing machines Journal of Statistical Physics

pp

Bennett C H Logical reversibility of computation IBM J Res Develop pp

Bennett C H Timespacetradeos for reversible computation SIAM J Comput

pp

Bennett C H Bernstein E Brassard G and Vazirani U Strengths and weaknesses of

quantum computing SIAM J Comput to app ear

Bernstein E Quantum complexity theory PhD dissertation UC Berkeley to app ear

Bernstein E and Vazirani U Quantum complexity theory Pro ceedings of the th Annual

ACM Symp osium on Theory of Computing pp

Berthiaume A and Brassard G The quantum chal lenge to structural complexity theory Pro

ceedings of th IEEE Conference on Structure in Complexity Theory pt

Berthiaume A and Brassard G Oracle quantum computing Journal of Mo dern Optics

pp

Berthiaume A Deutsch D and Jozsa R The stabilisation of quantum computation Pro

ceedings of the Workshop on Physics and Computation p

Bshouty N and Jackson J Le arning DNF over uniform distribution using a quantum example

oracle Pro ceedings of th Annual ACM Conference on Computational Learning Theory pp

Calderbank AR and Shor P Good quantum error correcting codes existPhys Rev A to

app ear

Chirac and Zoller Quantum computation using trappedcold ionsmanuscript

Chuang I LaFlamme R Shor P and Zurek W Quantum computers factoring and

decoherence manuscript

CohenTannoudji C Diu B LaLoe F Quantum mechanics pp

Deutsch D Quantum theory the ChurchTuring principle and the universal quantum computer

Pro c R So c Lond A pp

Deutsch D Quantum computational networks Pro c R So c Lond A pp

Deutsch D and Jozsa R Rapid solution of problems by quantum computation Pro c R So c

Lond A pp

DiVincenzo D Twobit gates are universal for quantum computationPhys Rev A

pp

Durr C Santha M Thanh Adecision procedure for wel lformed linear quantum cel lular au

tomataRACworkshop Berkeley

Feynman R Simulating physics with computersInternational Journal of Theoretical Physics

pp

Feynman R Quantum mechanical computersFoundations of Physics pp Orig

inally app eared in Optics News February

Fredkin E and Toffoli T Conservative LogicInternat J Theoret Phys p

Grover L Searching for a need le in a haystack a fast quantum mechanical algorithm manuscript

Landauer R Is quantum mechanics useful Pro c R So c Lond to app ear

Lipton RPersonal communication

Lloyd S Apotential ly realizable quantum computer Science pp

Machta J Phase information in quantum oracle computingPhysics Department Universityof

Massachusetts at Amherst manuscript

Morita K Shirasaki A and Gono Y Atape symbol reversible Turing Machine IEEE

Transactions of the IEICE E pp

von Neumann J Various Techniques UsedinConnection with Random Digits Notes byGE

Forsythe National Bureau of Standards Applied Math Series pp Reprinted in von

Neumanns Collected Works Pergamon Press pp

Palma G Suominen K and Ekert A Quantum computers and dissipation manuscript

A Shamir IPPSPACE Pro ceedings of the nd ACM Symp osium on the Theory of Computing

pp

Shor P Algorithms for quantum computation Discrete log and factoring Pro ceedings of the th

Annual IEEE Symp osium on Foundations of Computer Science

Shor P Faulttolerant quantum computation Pro ceedings of the th Annual IEEE Symp osium on

the Foundations of Computer Science

Simon D On the power of quantum computation Pro ceedings of the th Annual IEEE Symp osium

on Foundations of Computer Science

Solovay R and Yao Amanuscript

Toffoli T Bicontinuous extensions of invertible combinatorial functions Mathematical Systems

Theory pp

Unruh W Maintaining coherenceinquantumcomputersPhys Rev A p

Valiant LPersonal communication

Vazirani U and Vazirani V Random polynomial time is equal to semirandom polynomial time

Pro ceedings of the th Annual IEEE Symp osium on Foundations of Computer Science

Watrous J On one dimensional quantum cel lular automata Pro ceedings of the th Annual IEEE

Symp osium on Foundations of Computer Science

Yao A Quantum circuit complexity Pro ceedings of the th Annual IEEE Symp osium on Founda

tions of Computer Science pp

Zuckerman D Weak Random Sources PhD dissertation UC Berkeley