Professional Documents
Culture Documents
Shor 1994
Shor 1994
1 log(p). (Actus ally rom [17, Theorem 328}, iminf 6(p ~ 1)/(p — 1) ® e"/loglogp.) Thus we oaly need a number of exper iments that is polynomial in logp to obtain r with high probability. In fact, we can find a setof's such that at east ‘one is relatively prime to every prime divisor of p ~ 1 by ‘repeating the experimentonly an expected constant number ‘of times. This would also give us enough information to obtain 5 Anote on precision ‘The numberof bits of precision needed in the ampli- tude of quantum mectanical computers could be a barter to practicality. The generally accepted theoretical divi: ing line between feasible and infeasible is that polynomial precision (.e., a numberof bits logarithmic inthe problem size) is feasible and that more is infeasible, This is because fon a quantum computer the phase angle would need to be obtained through some physical device, and constructing such devices with beter than polynomial precision seems unquestionably impractical. Infact, even polynomial pre- cision may prove to be impractical: however, using this 2s the theoretical dividing line results in nice theoretical Properties ‘We thus need o show that the computations inthe pre= vious section need to use only polynomial precision in the amplitudes. The very act of writing down the expression exp(2riac/(p~ 1)) seems o imply that we need exponen: til precision, as this phase angle is exponentially precise Fortunately, this isnot the case, Consider the same ma: trix A, with every texm exp(2riae/(p~ 1) replaced by exp(2xiac/{(p— 1) + m/20). Each positive case, ie, one resulting in d = ~re, wil sil occur with nearly as large probability as before: instead of adding p — | amplitudes ‘which have exactly the same phase angle, we add p ~ 1 amplitudes which have nearly the same phase angle, and thus the size ofthe sum will only be reduced by a constant factor. The algorithm will thus give a (cyd) with d = —re with constant probability (instead of probability 1. Recall that we obtain the matrix 4, by multiplying a most log p matrices A,,. Further, each entry in ayy isthe product of at most log p terms. ‘Suppose that each phase angle were off by at most ¢/logp in the Ag,’s. Then in the product, each phase angle would be off by at most, ‘which i enough to perform the computation with constant probability of succes, A similar argument shows thatthe ‘magnitude of the amplitudes inthe Ay, can be off by a polynomial fraction. Similar argumentshold forthe general, ease of discrete log and for factoring to show that we need ‘only polynomial precision forthe amplitudes in these cases aswel We sill need to show how to construct 4s, from con: stant size unitary matrices having limited precision. The arguments are much the same as above, but we wil ot give ‘them in tis paper because. infact, Bennet etal (3) have ‘shown that it is sufficient to use polynomial precision for any computation on a quantum Turing machine t obtain the answer with high probability Since precision could easily be the limiting factor for practicality of quantum computation, it might be advisable {0 investigate how much precision is actly needed for‘quantum algorithms. Although Bernstein and Vazirani (8) show thatthe numberof bits of precision needed is never ‘more than the logarithm of the number of computational eps a quantum computer takes, in some algorithms it ‘could conceivably require less. Interesting open questions are whether itis possible to do discrete logarithms or factor- ing with less than polynomial precision and whether some tradeoff between precision and time is possible. 6 Factoring ‘The algorithm for factoring is similar tothe one forthe ‘general case of discrete log, only somewhat simpler. 1 ‘resent this algorithm before the general case of discrete Jog s0 as to give te thee algorithms inthis paper in order ‘ofincreasing complexity. Readers interested in discrete log may skip tothe next section, Instead of giving a quantum computer algorithm to factor m, we will give a quantum computer algorithm for finding the order of an element z in the multiplica- tive group (mod n); that is, the least integer such that 2° = 1 (modn). There is a randomized reduction fom factoring tothe order of an element {23} “To factor an odd number n, given a method for comput. ing the order of an element, we choose a random z, find the order r= of z, and compute god(2"+/? — 1,n). This {alls to give a non-trivial divisor of n only ifr is odd or if 27+)? 3 —1 (mod n). Using this criterion, itcan be shown, that the algorithm finds a factor of m with probability at least 1 = 1/2, where kis the numberof distinct prime factors of n. This scheme will thus work as long a8 1 is ‘ot a prime power; however, factoring prime powers can bbe done efficiently with classical methods Given x and m, to find such that x" = 1 (mod n), we o the fllowing. First, we finda smooth q with 2n?2n?, thre i at most one fraction d+ with 7 < n that satises the above inequality “Thus, we can obain the fraction d/r in lowest terms by rounding c/q 0 the neatest fraction having a denominator Smaller than n. This fraction ean be fund in plyaoasal time by using continued faction expansion of /¢, which finds all he best approximations of e/g by fatons (17, Chapter X) Tf we have the fraction d/r in lowest terms, and if d happens to be relatively prime tor. this will give usr. ‘We will now count the number of sates [2 (ne n}) which enable us to computer in this way. There ae (7) possible values ford elavelyprmetor, where ¢ isu 1 function. Each of these factions dr is close 10 one fraction c/a with lo/a ~ dr < 1/2g. There are also r possible values fr 24 since r ithe orderof x Thus, there fre ro(r) states [e,2" (mod n)) which would enable us to ‘obtain 7. Since each ofthese states occurs with probability fleas 1/3r, we obtain? with probability atleast (7/3. Using the theorem that ¢(r)/r > k/loglogr for some fixed & [17, Theorem 328, this shows that we Bnd r at least ak Ioglogr fraction ofthe time, so by epeating his ‘experiment only O(loglogr) times, we are assured of a high probability of success ‘Not than the algorithm fororder, wedi not se many ofthe properties of multiplication (me). In fat if we havea permutation f mapping these {0,1,2,-...n = 1} nto self such that its th iterate, F(a). is computable jn time polynomial in log and logk the same algoithm will be able ta in the order ofan element a under fie, {be minimum r such that f(a) =a 7 Diserete log: the general case For the general case, we fits find a smooth number g such that gis closet pie, with p-< 4 < 2p (See Lemna 32). ‘Next we dothe same thing asin the easy ase thats, we choose @ and 6 uniformly (mod p ~ 1), and then compute g°z* (mod p). This leaves our machine in the tate 1 ee ST abate (mod p)). m As before, ous the Fourier transform yt send @—+€ and’ ~ d (mod g),withamplade #exp(2(ac+a)/4) ving ws the state srioa 5S exp (acta) Jessgt2-*medy) 02) Note that we now have two moduli to deal with, p— 1 and. While ths makes Keeping Wack of things more confusing, sve wl sil be able toobtin rusing a algorithm similar to the easy ease. The probability of observing a stat ey) with y = 9 (mod p) is almest as before, atm © ov(attectea)| 03 where the sum is over all (2,8) sueh that a ~ rb = e(mod p ~ 1), We now use the relation ork (o- 0 [| and substitute in the above expression to obtain the ampli tude aay Peay (ti(ore+ke+ bd ein— 1) | = as) ‘The absolute value of the square of this amplitude is the probability of observing the state [o,d, 9" (mod p)). ‘We will now analyze this expression a factor of ‘exp(2rike/q) can be taken out ofall the terms and ig noted, because it does not change the probability. Next, we split the exponent into two parts and fator out to obi aie (ee) e0 as) ee sor T = re+d-hlelp— Me on a v= (fr- [et] ee-m. om Here by {2}, we mean the residue of = (mod q) with 4/2 < {2}q < 4/2. We will show that if we get enough “good” outputs, then we still can deduce r, and that fa thermore, the chance of getting a good! outputs constant. The ideais that if HP} = red sElel—Nhys9] <5, 79)where jis the closest integer to T/g, then as varies be- tween 0 and p ~ 2, the phase ofthe fst exponential term in Eq (7.6) only varies over at most half ofthe unit citle. Further, if Helm - hel < 4/20, 7.10) then [V| is always at most 4/20, s0 the phase of the sec- ‘ond exponential term in Eq. (7.6) never is farther than exp(ri/10) from 1. By combining these two observa- tions, we will show that if both conditions hold, then the contribution tothe probability from the coresponding term is significant. Furthermore, both conditions will hold with ‘constant probability, and a reasonable sample of «'s for hich Condition (7.9) hold will allow us to deduce r. ‘We now give a lower bound on the probability of each 00d output, e., an output that satisfies Conditions (79) and (7:10), We know that as ranges from O top ~ 2, the phase of exp(2xiU/a) ranges from Oto 2riW¥ where 2. Wwe 2(rerd-gyleo- he) aD and ji sin Eq (7.8). Ths, the componentof the ampli- tude of the Sst exponential in Ea (7.6) i the direction expnil¥) zy is at east cou(2|W/2 ~ Wb/(p ~ 2)). Now, by Condi- dion 710) the phase can vary by at most ri/10 due tothe ‘second exponential exp(2iV/q). Applying this variation in the manner tat minimizes the component inthe dzec- dion (7-12), we get that the component inthis direction is at least cos(2x |W 2 = W/(p ~2)| + 7/10). Since » <9, and from Condition (7.9), |W| < 1/2, putting everything together, the probability of avin ata state [edy) that satisfies both Condition (7.9) and 7.10) is atleast 7.13) ovat least 137/¢2 ‘We wil now count the numberof pais (cd) saisying Conditions (79) and (7.10). The numberof pais (,2) such that (7.9) hold is exactly the numberof possible c's, since for every c there is exactly one d such that (7.9) holds (ound off the fractonto the nearest ntge to obtain this), “The number of c's for which (7.10) holds is approximately 4/10. Thus, thete ate 4/10 pats (c,d) saying both conditions Mulsplying by p~ 1, which is the number ‘of posible y's, gives approximately py/10 sates ed). ‘Combining this calculation with the Tower bound on the probably of cach good state gives us thatthe probability ‘of obiaining any good state isa least p/80, ora last 1/60 (since g < 29). ‘We now want to recoverr from a pair ¢,d such that wh chy t (e HE=Dhe) C1 Gm weet a) <3, a ‘where this equation was obtained from Condition (79) by dividing bya. Te fst thing to notice i thatthe mulpier (on ri a fraction with denominator p~ I, since g evenly eivides e(p~ 1)~ (p= 1)}q. Tus, we need only round ja off to the nearest multiple of 1/(p ~ 1) and divide (0d p = 1) by N= Keo Mhe aay to find candidate r. To show tha this experiment need nly be repeated a polynomial numberof mest ind the comes r requires only afew more details. The problem is again that we cannot divide by a number which snot relatively prime wp ~ 1 For the general case ofthe discrete log algorithm, we do not Know that all possible values of ate generated with reasonable litelitood we only know this about one- tenth of them. This adstona difficulty makes the next step harder than the corresponding step inthe two previous algorithms. I we knew the remainder ofr moduloal prime powersdividing p~ 1, we could ue the Chinese remainder theorem to recover rin polynomial ime, We will only be able to find this remainder for primes lager than 20, but ‘with afte extra work we wl sll beable to recover ‘What we have is that each good (od) pai generated with probability atleast 137p/q > 1/16q, and that atleast. 2 tenth ofthe possible c's ae in «good (c,d) pai. From Bq. (718) follows that hese c's are mapped from c/a t0 /{(p~ 1) by rounding othe nearest integer multiple of 1/(p~ 1). Fars, the goo cs are exatly those in which -¢/q is close to c’/(p — 1). Thus, each good c corresponds: with exacly one 2. We would ike to show that for any ‘rime powers?" dividing p-1,arandom good¢isunlikely focontainp, Ifweare wiling wo accept lage constant for te algorithm, we can just ignore the prime powers under 20; if we know + meduloall prime powers over 20, we can ary ll posible residues for primes under 20 with only a (large constant factor increase in running time, Because at least one tenth of the 's were ina good (yd) pat least one tenth of the sae good. Thus, fora pine power fa random good e is divisible by 72" with probability at most 10/p;". If we have t good c's, the probability of having a prime power over 20 that divides allof them is 16)‘where the sum is overall prime powers greater then 20 that divide p 1, This sum (over all integers > 20) converges for {= 2, and goes down by atleast a factor of 2 for each, further increase of t by 1: thus for some large constant tit is less than 1/2 Recall that each good cis obtained with probability at least 1/16q from any experiment. Since there are q/10 ‘good cs, aller 160 experiments, we ate likely to obtain a sample of good cs chosen equally likely from all good 5, Thus, we will beable to ind ast of 2s such that all prime powers p* > 20 dividing p~ 1 are relatively prime to at least one of these os. For each prime p less than 20, we thus have at most 20 possibilities for the residue modulo 7, where a; is the exponent on prime py in the prime factorization of p~ 1. We can thus ty all possibiites, For residues modulo powersof primes ess than 0: foreach possibilty we can calculate the corresponding r using the ‘Chinese remainder theorem, and then check to see whether itis the desired diserete logarithm. This algorithm does not use very many properties of 2, sowecanuse the same algorithm o find discrete logarithms over other fields such as Zr. What we need isthat we know the order of the generator, and that we can multiply and take inverses of elements in polynomial tie fone were to actually program this algorithm (which ‘must wait uni a quantum computer is built) there are many ways in which the efficiency could be inereased over the effieieney shown inthis pape. Acknowledgements | would lke to thank Jeff Lagarias for finding and fx ing a eitcal bug in the fist version of the discrete log algorithm. I would also like to thank him, Charles Ben- net, illes Brassard, Andrew Odlyzko, Dan Simon, Umesh ‘acirani, as well as other correspondents to0 numerous to list, for productive discussions, for corrections to and im= provements of early drafts ofthis pape, and for pointers to ‘he literature. References 1. P.Benioff, “Quantum mechanical Hamiltonian models fof Turing machines J. Star Phys, Vol. 29, pp. S1S— 546 1982). 2. P Benioff."Quantum mechanical Hamiltonian models of Turing machines that dissipate no energy.” Phys. Few Let Vol 8, pp. 1581-1585 (1982), 3. C.H, Bennet, "Logical reversibility of computation,” IBM J, Res, Develop. Nol. 17, pp. 325-532 (1973) 24 C,H. Bennet, E, Bernstein, G, Brassard and U. Vazi- rani, “What is feasible on a quantum computer ‘manuscript (1994). EE. Bernstein and U. Vazirani, “Quantum complexity theory” in Proc. 250k ACM Symp. on Theory of Com: uation, pp. 11-20 (1993), ‘A. Bentiaume and G. Brassard, “The quantum challenge to structural complexity theory.” in Proc 7th IEEE Conf. on Structure in Complexity Theory ‘132-137 (1992), ‘A. Berthiaume and G. Brassard, "Oracle quantum com- puting," in Proc, Workshop on Physis of Computation, ‘p. 195-199, IEEE Press (1992) D, Coppersmith, “An approximate Fourier transform useful in quantum factoring.” IBM Research Report RC 19642 1994). D. Deutsch, “Quantum theory, the Chureh—Turing Principle and the universal quantum computer.” Proc. Rox. Soc. Lond. Vol. A400, pp. 96-117 (1985), D, Deutsch, "Quantum computational networks. Roy. Soc, Lond. Vol. A425, pp. 73-90 1989). D. Deutsch and R. Jo2s8, "Rapid solution of prob- Jems by quantum computation." Proc, Roy. Soe, Lon. Vol. A439, pp. 853-558 (1992), D. P. DiVincenzo, “Two-bit gates are universal for {quantum computation,” manuscript (1994), R. Feynman, “Simulating physics with computers” In ternational Journal of Theoretical Physics, Vol. 21, No. 67, pp. 467-488 (1982). R. Feynman, “Quantum mechanical computers” Foun dations of Physics, Vol. 16, pp. 507-531 (1986). (Orig: {nally appeared in Optics News, February 1985.) L-Fortnow and M. Sipser, “Are there interactive proto cols forco-NP languages?” Inform. Proc. Lett. Vol. 28, 1p. 249-251 (1988). D. M. Gordon, “Discrete logarithms in GF(p) using ‘the number field seve," SIAM J. Discrete Math, Vol. 6 pp. 124-139,1993). (G. Hardy and E. M. Wright, An dnaroduction tothe Theory of Numbers, Fifth Edition, Oxford Unive Press, New York (1979. R. Landauer, “Is quantum mechanics useful?” Proc Roy, Soe, Lon, 10 appear (1994) AK. Lenstra and H, W. Lense In, eds, The Devel: ‘opment of the Number Feld Sieve, Lecture Notes in “Mathematics No. 1554, Springer-Verlag (1993). HW. Lensira, Ie and C. Pomerance, “A rigorous time bound for factoringimteyers, J. Amer Math. Soc. Vol. 5, pp. 483-516 (1992), S. Lloyd, “A potentially realizable quantum compute Science, Vol.261, pp. 1569-1571 (1993)2, 23 2%, 2s, 26, 2. S, Lloyd, “Envisioning a quantum supercomputer” Science, Vol. 263, p. 695 (1994) G.L. Mille, “Riemann’s hypothesis and tests for pri- smality’"J. Comp. Sei. Vl. 13, pp. 300-317 (1976) SS. Poblig and M. Hellman, “An improved algorithm for computing discrete logarithms over GF(p) and its ‘xyptographic significance" IEEE Trans. Information Theory, Vol. 24, pp. 106-110(1978). C. Pomerance, “Fast, rigorous factorization and dis crete logarithm algorithms.” in Diserete Algorithms ‘and Complexity (Proc. Japan-US Joint Seminar), pp. 119-143, Academic Press (1986). R.L. Rivest, A. Shamir, and. Adleman “A method of obtaining digital signatures and public-key cryptosys- tems" Communications ACM, Vol.21, No.2, pp. 120- 126 (1978), A. Shami, IP = PSPACE,”in Proc. 31th Ann. Symp. Foundations of Computer Science, pp. 11-15, IEEE Press (1990) 28, D. Simon, “On the power of quantum computation’ in Proc. 35th Ann. Symp. Foundations of Computer Science, IEEE Press (1994). 29, W. G. Teich, K. Obermayer, and G. Mahler, “Struc- tural basis of multstationary quantum systems Il Ef fective few-partice dynamics,” Phys. Rev. B, Vol. 37, pp- 8111-8121 (1988). 30. T. Toffol, "Reversible computing,” in Aufomata, Lan ‘guages and Programming, Seventh Colloq, Lecture [Notes in Computer Science No. 84 (J. W. De Bakker and J. van Leeuwen, eds.) pp. 632-644, Springer- ‘Verlag (1980) 31. W. G. Unruh, “Maintaining coherence in quantum ‘computers manuscript (1994), 32. A. Yao, “Quantum circuit complexity." in Proc. 34 ‘Ann. Symp. Foundations of Computer Science, p.352- 361, IEEE Press (1993).