quantum computing, monads, and FP in general

Bill Halchin bhalchin@hotmail.com
Sat, 05 Oct 2002 01:06:18 +0000


<html><div style='background-color:'><DIV>
<P>Hello,</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp; One very thing to keep in mind about quantum computing is that all computations are reversible because the evolution over time of a quantum system is represented by unitary operators (in a Hilbert space) on elements in the particular HS. In QC, the spaces are finite dimensional where elements are quibits and the operators are represented by matrices. "classical" programming is anything but reversible. My .02 for what it us worth.</P>
<P>Regards, Bill Halchin</P>
<P><BR><BR>&nbsp;</P></DIV>
<DIV></DIV>
<DIV></DIV>&gt;From: Hal Daume III <HDAUME@ISI.EDU>
<DIV></DIV>&gt;To: Haskell Mailing List <HASKELL@HASKELL.ORG>
<DIV></DIV>&gt;CC: Rob Pierry <RPIERRY@AZTECHSOLUTIONS.COM>,Ryan Barrett <RBARRETT@STANFORD.EDU>
<DIV></DIV>&gt;Subject: quantum computing, monads, and FP in general 
<DIV></DIV>&gt;Date: Fri, 4 Oct 2002 16:46:44 -0700 (PDT) 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Hi All, 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;I realize most people are currently at PLI and that this might not be the 
<DIV></DIV>&gt;most appropriate place to bring up such questions. Nevertheless, there 
<DIV></DIV>&gt;are smarter and more knowledgable people on this mailing list than most 
<DIV></DIV>&gt;other places I know of, so here it goes. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Does anyone know if anyone has tried to model quantum computing in a 
<DIV></DIV>&gt;monadic sense. What I mean is this: 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Let's say we had a quantum computer. This basically gives us a bunch of 
<DIV></DIV>&gt;complex numbers on which we can perform calculations. Sort of an extreme 
<DIV></DIV>&gt;SIMD situation, though the type of operations we can perform are only 
<DIV></DIV>&gt;unitary matrix multiplications. Let's forget this for now. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;There are two primary characteristics of quantum computations: 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 1) once you observe the result, you lose everything else and 
<DIV></DIV>&gt; can't say "well, let's go back" 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 2) observing the result is probabilistic. that is, each possible 
<DIV></DIV>&gt; solution has an associated probability (it's squared amplitude) 
<DIV></DIV>&gt; and the probability of getting a solution back is equal to 
<DIV></DIV>&gt; this. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;This strikes me as a very monad-like setup. We can have a monad P, where 
<DIV></DIV>&gt;a value of type 'P a' is a distribution over all elements of type a with 
<DIV></DIV>&gt;associated probabilities. That is, 'P Bool' is a probability space with 
<DIV></DIV>&gt;two elements, True and False, each with an associated probability. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;We need a bind operation. This is essentially associated with the sorts 
<DIV></DIV>&gt;of unitary matrix multiplications we can perform. So, we can write 
<DIV></DIV>&gt;something like 'a `bind` f' where a is a distribution over as and f is a 
<DIV></DIV>&gt;function which takes some a to a distribution over bs. Then, the 
<DIV></DIV>&gt;probability associated in the new distribution with a value x of type b is 
<DIV></DIV>&gt;simply the sum over all possible way of getting to it. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;So, for instance, suppose we had a flat distribution of type P Bool; call 
<DIV></DIV>&gt;it 'flat'. We then had a function of type 'Bool -&gt; P Bool' which took a 
<DIV></DIV>&gt;boolean and with 50% probability returned it as is and with 50% 
<DIV></DIV>&gt;probability flipped its value. Call this function 'maybeFlip'. Now, 
<DIV></DIV>&gt;'flat `bind` maybeFlip' produces a new probability distribution equal to 
<DIV></DIV>&gt;'flat' (basically because there's a 50% probability of flat spitting out 
<DIV></DIV>&gt;True, which gets to be True with 50% probability and False with 50% 
<DIV></DIV>&gt;probability; similar reasoning if flat spits out False gives an overall 
<DIV></DIV>&gt;probability for True of 50% and False of 50%). 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;When we deal with actual complex numbers and can have negatives, things 
<DIV></DIV>&gt;become more interesting, but the reasoning remains essentially the same. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;The 'return' funciton would simply return its argument with probability 1 
<DIV></DIV>&gt;and everything else with probability 0 (read probability = amplitude). 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Though I haven't formally verified it, I'm almost positive this obeys the 
<DIV></DIV>&gt;monad laws (the only non-trivial verification is on the distributivity 
<DIV></DIV>&gt;law, but I think it will work out). 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;The only work I've seen regarding programming quantum computers is the 
<DIV></DIV>&gt;'Quantum Programming' paper from Sanders and Zuliani at MPC (I think) and 
<DIV></DIV>&gt;they took an imperate approach, essentially augmenting Dijkstra's GCL 
<DIV></DIV>&gt;programming language to pGCL by giving it probabilism. Perhaps it's just 
<DIV></DIV>&gt;my personal bias, but functional programming seems to be a more natural 
<DIV></DIV>&gt;fit. I also like the thin connection between lazy evaluation and the 
<DIV></DIV>&gt;important role observation has in quantum computing. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Obviously I don't know much about monads and I know even less about 
<DIV></DIV>&gt;quantum computing. Does anyone know if anyone has taken the approach 
<DIV></DIV>&gt;outlined above or anything similar or can point out that I'm just way off 
<DIV></DIV>&gt;track.... 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Thanks! 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; - Hal 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;-- 
<DIV></DIV>&gt;Hal Daume III 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; "Computer science is no more about computers | hdaume@isi.edu 
<DIV></DIV>&gt; than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;_______________________________________________ 
<DIV></DIV>&gt;Haskell mailing list 
<DIV></DIV>&gt;Haskell@haskell.org 
<DIV></DIV>&gt;http://www.haskell.org/mailman/listinfo/haskell 
<DIV></DIV></div><br clear=all><hr>Chat with friends online, try MSN Messenger: <a href='http://g.msn.com/1HM1ENUS/c144??PS=47575'>Click Here</a><br></html>