aa r X i v : . [ qu a n t - ph ] M a y Improved constructions of quantum automata
Andris Ambainis and Nikolajs Nahimovs ⋆ Department of Computer Science, University of Latvia, Raina bulv. 19, Riga,LV-1586, Latvia, [email protected], [email protected] . Abstract.
We present a simple construction of quantum automata whichachieve an exponential advantage over classical finite automata. Our au-tomata use ǫ log 2 p + O (1) states to recognize a language that requires p states classically. The construction is both substantially simpler andachieves a better constant in the front of log p than the previously knownconstruction of [2].Similarly to [2], our construction is by a probabilistic argument. Weconsider the possibility to derandomize it and present some results inthis direction. Quantum finite automata are a mathematical model for quantum com-puters with limited memory. A quantum finite automaton has a finitestate space and applies a sequence of transformations, corresponding tothe letter of the input word to this state space. At the end, the state ofthe quantum automaton is measured and the input word is accepted orrejected, depending on the outcome of the measurement.Most commonly, finite automata (including quantum finite automata)are studied in 1-way model where the transformations corresponding tothe letters of the input word are applied in the order of the letters in theword, from the left to the right. (More general 2-way models [8] allowthe order of the transformations to depend on the results of the previoustransformations.)For 1-way model (which we consider the most natural model in the quan-tum setting), the set of languages (computational problems) that can berecognized (computed) by a quantum automaton is the same for classi-cal automata . However, quantum automata can be exponentially morespace-efficient than classical automata [2]. This is one of only two resultsthat show an exponential advantage for quantum algorithms in spacecomplexity. (The other is the recent exponential separation for onlinealgorithms by Le Gall [9].)Our first result is an improved exponential separation between quantumand classical finite automata, for the same computational problem as in ⋆ Supported by University of Latvia research project Y2-ZP01-100. More precisely, this is true for sufficiently general models of quantum automata,such as one proposed in [5] or [7]. There are several results claiming that quantumautomata are weaker than classical (e.g. [8,3,4]) but this is an artifact of restrictivemodels of quantum automata being used.2]. The construction in [2] is quite inefficient. While it produces an ex-ample where classical automata require p states and quantum automatarequire C log p states, the constant C is fairly large. In this paper, weprovide a new construction with a better constant and, also, a muchsimpler analysis. (A detailed comparison between our results and [2] isgiven in section 3.1.)Second, both construction of QFAs in [2] and this paper are probabilis-tic. That is, they employ a sequence of parameters that are chosen atrandom and hardwired into the QFA. In the last section, we give two non-probabilistic constructions of QFAs for the same language. The first ofthem gives QFAs with O (log p ) states but its correctness is only shownby numerical experiments. The second construction gives QFAs with O (log ǫ p ) states but is provably correct. We consider 1-way quantum finite automata (QFA) as defined in [10].Namely, a 1-way QFA is a tuple M = ( Q, Σ, δ, q , Q acc , Q rej ) where Q isa finite set of states, Σ is an input alphabet, δ is a transition function, q ∈ Q is a starting state, Q acc and Q rej are sets of accepting andrejecting states and Q = Q acc ∪ Q rej . /c and $ are symbols that donot belong to Σ . We use /c and $ as the left and the right endmarker,respectively. The working alphabet of M is Γ = Σ ∪ { /c , $ } .A superposition of M is any element of l ( Q ) (the space of mappingsfrom Q to C with l norm). For q ∈ Q , | q i denotes the unit vector withvalue 1 at q and 0 elsewhere. All elements of l ( Q ) can be expressed aslinear combinations of vectors | q i . We will use ψ to denote elements of l ( Q ).The transition function δ maps Q × Γ × Q to C. The value δ ( q , a, q )is the amplitude of | q i in the superposition of states to which M goesfrom | q i after reading a . For a ∈ Γ , V a is a linear transformation on l ( Q ) defined by V a ( | q i ) = X q ∈ Q δ ( q , a, q ) | q i . (1)We require all V a to be unitary.The computation of a QFA starts in the superposition | q i . Then trans-formations corresponding to the left endmarker /c, the letters of the inputword x and the right endmarker $ are applied. The transformation cor-responding to a ∈ Γ is just V a . If the superposition before reading a is ψ , then the superposition after reading a is V a ( ψ ).After reading the right endmarker, the current state ψ is observed withrespect to the observable E acc ⊕ E rej where E acc = span {| q i : q ∈ Q acc } , E rej = span {| q i : q ∈ Q rej } . This observation gives x ∈ E i with theprobability equal to the square of the projection of ψ to E i . After that,the superposition collapses to this projection.f we get ψ ∈ E acc , the input is accepted. If ψ ∈ E rej , the input isrejected. Another definition of QFAs.
Independently of [10], quantum au-tomata were introduced in [8]. There is one difference between thesetwo definitions. In [8], a QFA is observed after reading each letter (afterdoing each V a ). In [10], a QFA is observed only after all letters have beenread. The definition of [8] is more general. But, in this paper, we followthe definition of [10] because it is simpler and sufficient to describe ourautomaton. We use the following theorem from linear algebra.
Theorem 1.
Let α , . . . , α m be such that | α | + . . . + | α m | = 1 . Then,1. there is a unitary transformation U such that U | q i = α | q i + . . . + α m | q m i .2. there is a unitary transformation U such that, for all i ∈ { , . . . , m } , U | q i i is equal to α i | q i plus some combination of | q i , . . . , | q m i . In the second case, we also have U ( α | q i + . . . + α m | q m i ) = | q i . Let p be a prime. We consider the language L p = { a i | i is divisibleby p } . It is easy to see that any deterministic 1-way finite automatonrecognizing L p has at least p states. However, there is a much moreefficient QFA! Namely, Ambainis and Freivalds [2] have shown that L p can be recognized by a QFA with O (log p ) states.The big-O constant in this result depends on the required probability ofcorrect answer. For x ∈ L p , the answer is always correct with probability1. For x / ∈ L p , [2] give – a QFA with 16 log p states that is correct with probability at least1/8 on inputs x / ∈ L p . – a QFA with poly ( ǫ ) log p states that is correct with probability atleast 1 − ǫ on inputs x / ∈ L p (where poly ( x ) is some polynomial in x ).In this paper, we present a simpler construction of QFAs that achievesa better big-O constant. Theorem 2.
For any ǫ > , there is a QFA with log 2 pǫ states recogniz-ing L p with probability at least − ǫ . .2 Proof of Theorem 2 Let U k , for k ∈ { , . . . , p − } , be a quantum automaton with a set ofstates Q = { q , q } , a starting state | q i , Q acc = { q } , Q rej = { q } .The transition function is defined as follows. Reading a maps | q i tocos φ | q i + sin φ | q i and | q i to − sin φ | q i + cos φ | q i where φ = πkp . (Itis easy to check that this transformation is unitary.) Reading /c and $leaves | q i and | q i unchanged. Lemma 1.
After reading a j , the state of U k is cos (cid:18) πjkp (cid:19) | q i + sin (cid:18) πjkp (cid:19) | q i . Proof.
By induction. ⊓⊔ If j is divisible by p , then πjkp is a multiple of 2 π , cos( πjkp ) = 1,sin( πjkp ) = 0, reading a j maps the starting state | q i to | q i . There-fore, we get an accepting state with probability 1. This means that allautomata U k accept words in L with probability 1.Let k , . . . , k d be a sequence of d = c log p numbers. We construct anautomaton U by combining U k , . . . , U k d . The set of states consists of2 d states q , , q , , q , , q , , . . . , q d, , q d, . The starting state is q , .The transformation for left endmarker /c is such that V /c( | q , i ) = | ψ i where | ψ i = 1 √ d ( | q , i + | q , i + . . . | q d, i ) . This transformation exists by first part of Theorem 1. The transforma-tion for a is defined by V a ( | q i, i ) = cos 2 k i πp | q i, i + sin 2 k i πp | q i, i ,V a ( | q i, i ) = − sin 2 k i πp | q i, i + cos 2 k i πp | q i, i . The transformation V $ is as follows. The states | q i, i are left unchanged.On the states | q i, i , V $ | q i, i is √ d | q , i plus some other state (part 2 ofTheorem 1, applied to | q , i , . . . , | q d, i ). In particular, V $ | ψ i = | q , i . The set of accepting states Q acc consists of one state q , . All other states q i,j belong to Q rej . Claim.
If the input word is a j and j is divisible by p , then U acceptswith probability 1. Proof.
The left endmarker maps the starting state to | ψ i . Reading j letters a maps each | q i, i to itself (see analysis of U k ). Therefore, thestate | ψ i which consists of various | q i, i is also mapped to itself. Theright endmarker maps | ψ i to | q , i which is an accepting state. ⊓⊔ laim. If the input word is a j , j not divisible by p , U accepts withprobability 1 d (cid:18) cos 2 πk jp + cos 2 πk jp + . . . + cos 2 πk d jp (cid:19) . (2) Proof.
By Lemma 1, a j maps | q i, i to cos πk i jp | q i, i + sin πk i jp | q i, i .Therefore, the state before reading the right endmarker $ is1 √ d d X i =1 (cos 2 πk i jp | q i, i + sin 2 πk i jp | q i, i ) . The right endmarker maps each | q i, i to √ d | q , i plus superposition ofother basis states. Therefore, the state after reading the right endmarker$ is 1 d d X i =1 cos 2 πk i jp | q , i plus other states | q i,j i . Since | q , i is the only accepting state, the prob-ability of accepting is the square of the coefficient of | q , i . This provesthe lemma. ⊓⊔ We use the following theorem from probability theory (variant of Azuma’stheorem[11]).
Theorem 3.
Let X , . . . , X d be independent random variables such that E [ X i ] = 0 and the value of X i is always between -1 and 1. Then, P r [ | d X i =1 X i | ≥ λ ] ≤ e − λ d . We apply this theorem as follows. Fix j ∈ { , . . . , p − } . Pick each of k , . . . , k d randomly from { , . . . , p − } . Define X i = cos πk i jp . We claimthat X i satisfy the conditions of theorem. Obviously, the value of cosfunction is between -1 and 1. The expectation of X i is E [ X i ] = 1 p p − X k =0 cos 2 πkjp since k i = k for each k ∈ { , . . . , p − } with probability 1 /p . We havecos πkjp = cos π ( kj mod p ) p because cos(2 π + x ) = cos x . Consider thenumbers 0, j , 2 j mod p , . . . , ( p − j mod p . They are all distinct. (Since p is prime, kj = k ′ j (mod p ) implies k = k ′ .) Therefore, the numbers 0, j , 2 j mod p , . . . , ( p − j mod p are just 0 , , . . . , p − X i is E [ X i ] = 1 p p − X k =0 cos 2 πkp . This is equal to 0.y equation (2), the probability of accepting a j is d ( X + . . . + X d ) .To achieve 1 d ( X + . . . + X d ) ≤ ǫ, we need | X + . . . + X d | ≤ √ ǫd . By Theorem 3, the probability that thisdoes not happen is at most 2 e − ǫd .There are p − L : a , . . . , a p − . The probabilitythat one of them gets accepted with probability more than ǫ is at most2( p − e − ǫd . If 2( p − e − ǫd < , (3)then there is at least one choice of k , . . . , k d for which U does not acceptany of a , . . . , a p − with probability more than ǫ . The equation (3) istrue if we take d = 2 log 2 pǫ . The number of states for U is 4 log 2 pǫ . ⊓⊔ In the previous section, we proved what for every ǫ > p ∈ P ,there is a QFA with 4 log 2 pǫ states recognizing L p with probability atleast 1 − ǫ . The proposed QFA construction depends on d = 2 log 2 pǫ parameters k , . . . , k d and accepts input word a j / ∈ L p with probability1 d d X i =1 cos 2 πk i jp ! . It is possible to choose k , . . . , k d values to ensure1 d d X i =1 cos 2 πk i jp ! < ǫ or, equivalently, (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) d X i =1 cos 2 πk i jp (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) < √ ǫd (4)for every a j / ∈ L p .However, our proof is by a probabilistic argument and does not give anexplicit sequence k , . . . , k d . We now present two constructions of explicitsequences. The first construction works well in numerical experimentsand gives a QFA with O (log p ) states in all the cases that we tested.The second construction uses a slightly larger number of states but hasa rigorous proof of correctness. We conjecture
Hypothesis 1 If g is a primitive root modulo p ∈ P , then sequence S g = { k i ≡ g i mod p } di =1 for all d and all j : a j / ∈ L p satisfies (4). e will call g a sequence generator . The corresponding sequence will bereferred as cyclic sequence. We have checked all p ∈ { , . . . , } , allgenerators g and all sequence lengths d < p (choosing a corresponding ǫ value) and haven’t found any counterexample to our hypothesis.We now describe numerical experiments comparing two strategies: usinga random sequence k , . . . , k d and using a cyclic sequence.We will use S rand to denote random sequence and S g to denote a cyclicsequence with generator g . We will also use ǫ rand and ǫ g to denote themaximum probability with which a corresponding automata accepts in-put word a j / ∈ L p .Table 1 shows ǫ rand and ǫ g for different p and g values. ǫ rand is calculatedas an average over 5000 randomly selected sequences. ǫ g is for one specificgenerator. ǫ in the second column shows the theoretical upper boundgiven by Theorem 2. p ǫ d g ǫ rand ǫ g Table 1. ǫ rand and ǫ g for different p and g In 99.98% - 99.99% of our experiments, random sequences achieved thebound of Theorem 2. Surprisingly, cyclic sequences substantially outper-form random ones in almost all the cases.More precisely, for randomly selected p ∈ P , ǫ > g , acyclic sequence S g gives a better result than a random sequence S rand in 98.29% of cases. A few random instances are shown in Figure 1. Foreach instance, we show the bound d √ ǫ on (4) obtained by a probabilisticargument, the maximum of f rand ( j ) (which is defined as the value of (4)for the sequence S rand ) over all j , a j / ∈ L p and the maximum of f g ( j )(defined in a similar way using S g instead of S rand ).In 1.81% of cases, we got that sup | f g ( j ) | > sup | f rand ( j ) | , where sup | f rand ( j ) | is calculated as an average over 5000 randomly selected sequences. Fig-ure 2 shows one of these cases: p = 9059, ǫ = 0 .
09 and g = 2689, com-paring the cyclic sequence with 9 different randomly chosen sequences.The cyclic sequence gives a slightly worse result than most of the ran-dom ones, but still beats the probabilistic bound on (4) by a substantialamount. ig. 1. sup | f g ( j ) | and sup | f rand ( j ) | for random p, ǫ and g Comparing different generators
Every p ∈ P might have multiplegenerators. Table 2 shows ǫ g values for p = 9059 and ǫ = 0 . d = 197, √ ǫd = 62 . g ǫ g g ǫ g g ǫ g
102 0,02533 1545 0,01858 9023 0,01807103 0,03758 1546 0,02235 9033 0,01413105 0,01999 1549 0,02896 9034 0,01485106 0,02852 1552 0,02873 9036 0,02509110 0,01685 1553 0,02624 9039 0,02311
Table 2. ǫ g values for different generators. p = 9059 Different generators have different ǫ g values. We will use g min to refer aminimal generator, i.e. one having a minimal ǫ g . Table 3 shows minimalgenerators for p values from table 1.We see that, typically, the minimal generators give a QFA with substan-tially smaller probability of error. It remains open whether one couldfind a minimal generator without an exhaustive search of all generators. Fix ǫ >
0. Let P = { r | r is prime, (log p ) ǫ / < r ≤ (log p ) ǫ } ,S = { , , . . . , (log p ) ǫ } , ig. 2. sup | f g ( j ) | and sup | f rand ( j ) | for p = 9059, ǫ = 0 .
09 and g = 2689 p ǫ d g ǫ g g min ǫ g min Table 3.
Minimal generators for different p T = { s · r − | r ∈ R, s ∈ S } , with r − being the inverse modulo p . Ajtai et al. [1] have shown Theorem 4. [1] For all k ∈ { , . . . , p − } , | X t ∈ T e tkπi/p | ≤ (log p ) − ǫ | T | . Razborov et al. [12] have shown that powers e tkπi/p satisfy even strongeruniformity conditions. We, however, only need Theorem 4.By taking the real part of the left hand side, we get (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)X t ∈ T cos (cid:18) tkπip (cid:19)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ (log p ) − ǫ | T | . Thus, taking our construction of QFAs and using elements of T as k , . . . , k d gives an explicit construction of a QFA for our language with O (log ǫ ) states.or our first, cyclic construction, the best provable result is by applyinga bound on exponential sums by Bourgain [6]. That gives a QFA with O ( p c/ log log p ) states which is weaker than both the numerical results andthe rigorous construction in this section. Acknowledgment.
We thank Igor Shparlinski for pointing out [1] and[6] to us.
References
1. M. Ajtai, H. Iwaniec, J. Komlos, J. Pintz, E. Szemeredi. Constructionof a thin set with small Fourier coefficients,
Bulletin of the LondonMathematical Society , 22:583-590, 1990.2. A. Ambainis, R. Freivalds. 1-way quantum finite automata:strengths, weaknesses and generalizations.
Proceedings of the 39thIEEE Conference on Foundations of Computer Science,
Proceedings ofSTACS’01 , Lecture Notes in Computer Science, 2010:75-86, 2001.4. A. Ambainis, A. Nayak, A. Ta-Shma, U. Vazirani. Dense quantumcoding and quantum finite automata.
Journal of the ACM , 49(4):496-511 (2002)5. A. Bertoni, C. Mereghetti, B. Palano. Quantum Computing: 1-WayQuantum Automata.
Developments in Language Theory 2003 , Lec-ture Notes in Computer Science, 2710:1-20.6. J. Bourgain. Estimates on exponential sums related to Diffie-Hellman distributions.
Geometric and Functional Analysis , 15:1-34,2005.7. M. Ciamarra. Quantum Reversibility and a New Model of QuantumAutomaton.
Proceedings of FCT’01 , 2138:376-379, 2001.8. A. Kondacs, J. Watrous, On the power of quantum finite state au-tomata.
Proceedings of the 38th IEEE Conference on Foundations ofComputer Science,
Proceedings of SPAA’06 , 67-73.10. C. Moore, J. Crutchfield. Quantum automata and quantum gram-mars.
Theoretical Computer Science , 237(1-2): 275-306 (2000). Alsoquant-ph/9707031.11. R. Motwani, P. Raghavan.
Randomized Algorithms.
Cambridge Uni-versity Press, 1994.12. A. Razborov, E. Szemeredi, A. Wigderson, Constructing small setsthat are uniform in arithmetic progressions.