# How to bring Quantum Programming to everyone?

How to bring Quantum Programming to everyone?

Xavier Pillet                                                                                                                            June 25, 2021

When I was a teenager, I believed that we could compute everything thanks to computers. But soon, as an undergraduate, I quickly found their limits. We call them “NP- Complete” cases in software engineer words. Something as simple as finding the best way to deliver packets to hundreds of cities or arrange the packets of different sizes in a truck is untrackable for current computers. This leads, for instance, to tons of waste in time, energy, and profit for supply chains.

But the hope was renewed last year, thanks to IBM and Google’s POC and commitment to quantum computers. They will get it to work. It’s possible; they understood how. It seems magic: a weird computer able to manipulate petabytes encoded only in few atoms. How could this be possible? No one knows, but we know that it does work. Einstein himself could not believe it until he proposed the experiment that proved it. Here is the trick: benefit from the strange quantum behavior of matter to enhance our computers and, thanks to this, optimize the routes and loads of the traveling salesmen.

Quantum Computers (QC) promises to be ways faster than our current computers. It seems appealing; you would like to start to master this next revolution, you start some tutorials, and then you realized that you have to face complex-valued matrices, qubits, and probability distributions… The entry cost for a classical programmer is high.

Fortunately enough, a guy named Toffoli already thought about this and came up with a theory named Reversible Computation. The idea is straightforward: mapping every classical (binary) to quantum (qubit) operation.

Wait, I heard it is impossible to perform every classical computation based on a quantum computer but only specific ones ?! Yes, it is true… under some hypotheses, like using only pure quantum operations, which will never be the case since initializing and measuring a qubit are both non-quantum operations. This is what used Toffoli to bypass the so-called “non-cloning theorem” and achieve a complete mapping between classical and quantum logic: adding ancillae and allowing qubit initialization and measurement to complete the truth table.

Then in principle, it is possible to compile and run any classical software on a Quantum Computer. But, wait a minute. The advantage of using Quantum Computing is speed, and by using Toffoli’s computation, the number of elementary operations is conserved from

the classical program. Ok, then, at this step, this general quantum compiler works but is useless. Can this be solved thanks to an optimization step? It might, but it is not sure because optimizing a quantum program is an “NP” problem; in other words, there is no general solution at the theoretical level, even if good solutions can be found in practice. So we have to try in practice.

The best strategy to compress a quantum circuit is often to use the so-called ZX-calculus, a graph representation that allows modifications helpful to reduce the size of the circuit.

 Qubit 0 IO) G) 0– Qubit 1 11) (n ©— 1-Qubit (01 basis) l ‘l/J) =a IO)+ /311) s.t. lal2+1/312 = 1 () 1-Bra (01 basis) (‘!/JI= J’!/J}î =a* (OJ + (3* (li s.t. JaJ2 + J,812 = 1 (a*    /3* ) + I+) =    IO)+       I l) Jz G) 0– – 1-) =    JO) –      J l) ( 1) ©— Magic state (01 basis) Jz  I O)+ J l) ()a) @- Magic state (+- basis) I +) +       1-) ia/2 ( cos a/2 ) e        -isin a/2 @- Magic bra (01 basis) (OJ + e a (li (1   e–ia) –@ Magic bra (+- basis) (+J + e a (-1 e-ia/2 (cos a/2    -i sin a/2) –@ 100) = IO) JO) = IO) 0 I O) ( ) ® G) ‘1x      ‘ = O x    O \                                        i ‘l 0 0 \0 0–   0– JOl) ‘O’ 1 0   \0 ) 0–   ©— Bell state l N–GHZ state …l.. jü) ®N + …l.. j l)®N V2               V2 c( N-GHZ measurement (Ol ®N +     (lj®N

Qubit name                             Dirac                                           Matrix                                zx

Using both tricks, Reversible Computing and ZX optimization can lead to a general way to benefit from quantum computing, starting only with a classical program written in Python or Java and run it on an IBM quantum computer, for instance. All of this without understanding a clue about matrix multiplication. Wonderful, isn’t it?

We are implementing this at ColibrITD, the startup that will provide the best framework as the surfboard to ride the upcoming quantum computing revolution wave.