2

I'm not an expert in Functional Programming (FP). In fact, I just started learning it.

So, here is the real question: Since, FP is derived from Mathematics and not from von. Neumann machine, can this programming style/paradigm be used to program Quantum Computers? This is more from an application programmer's perspective since low-level machine instructions may be completely different.

Learner
  • 533
  • 5
  • 18
  • Your question is equivalent to, "Can a Quantum Computer be Turning Complete?". The answer is that, a Quantum Computer is actually equivalent to MANY MANY Turing Complete computers. Therein lies its power. – Aron Aug 16 '15 at 18:08
  • 1
    @Aron From the perspective of Turing completeness (what it can compute in principle), a QC is *precisely* equivalent to *one* TM (for that matter, adding many tapes or read/write heads doesn't change the power of TMs either). Computational *complexity* (how efficiently it can compute) is a different matter, but it's far more complicated than "a QC tries out exponentially many possibilities in parallel" --- [that is *false*](http://www.scottaaronson.com/blog/). As far as anyone knows, BQP does not contain NP and especially not EXP or other similar classes. –  Aug 16 '15 at 18:27
  • 1
    @delnan I was giving the dumbed down pop science explanation. More correctly, a QM is a TM with many tapes, and on completion you pick one tape randomly and you read from it, destroying all the other tapes. The "random" method to choose the tape can be biased to the tape you actually want. – Aron Aug 16 '15 at 18:32
  • 1
    @Aron "Pop sci" is no excuse to plant wrong ideas in people's brains. Anyway, your revised explanation still rubs me the wrong way: It talks of TMs and tapes (pretty CS-y details), but it goes into *zero* detail about how the random choice can be biased. –  Aug 16 '15 at 19:02

1 Answers1

5

No. Functional programs still perform classical computation. The functional style as we currently define it has nothing resembling superposition, quantum mechanical gates, or interference. While it is possible to transport the general idea of higher-order and first-class functions into the realm of quantum computation (and people are researching that right now), just as there are quantum Turing machines, as far as I can tell the results are as different from classical functional programming as quantum algorithms are from classical algorithms. For example, in QML if ... then ... else ... is removed in favor of a similar conditional where the condition is a qbit and the result is a superposition of the then and else values.

Now, of course quantum computers are Turing-complete and could, in theory, execute any classical algorithm. But why on earth would you do that? We already have classical computers, and they are (and will always be) much more efficient at executing classical computations. The only reason to program a quantum computer is to make it run an algorithm that exploits in a nontrivial way the weirdness of quantum effects. To even express that, one needs a very different language regardless of the level of abstraction at which you work.

  • I think the question is about whether the properties we associate with functional programming, such as referential transparency or lazyness or treating functions as values, translate well to quantum computer. For example, no-cloning could cause implementation problems for referential transparency and a superposition-of-functions value might be hard to use. You seem to have answered something different. – Craig Gidney Aug 16 '15 at 21:00
  • @Strilanc I get the impression that OP hopes they could program in their favorite functional programming language and harness quantum computing magic without having to learn anything new. I answered that. The aspects that you mention seem extremely hard to answer to me, since research on that issue has only just started. In any case, *I* cannot comment on it. –  Aug 16 '15 at 21:04