README.md

Qurry

Qurry is a prototype of a quantum probabilistic programming language, done with the unitary fund.
The official project duration is one year, but the language may be usable before then (and in fact, can already be used to use all of the QUIL spec with some useful abstractions on top, like if statements, variable names, and so on).

For more information on the progress of the project, see a summary (from early October), or an in-progress paper.

If you use Qurry or are influenced by it, all I ask is that you cite the software. A bibtex citation is available at the end of this file.
Once a paper is published, please cite that (I will update it here).

First there are the simple classical-probabilistic structures bernoulli, gaussian, multinomial, and uniform.
Bernoulli simply rotates a qubit such that it will be measured as |1> with a certain probability:
For instance, (bernoulli 0.5 0) creates a fair coin from qubit 0.
These can be chained together to create more complicated bit-states, which are useful in other algorithms, like Grover's or QFT.

Similarly, the gaussian function creates a discrete multinomial state which approximates a gaussian distribution.
It uses the def function to create a block of useable qubits:

(def gaussblock 0 4) ; block of 5 qubits
(gaussian 0 1.0 gaussblock)

Note that much of the computation here is (as currently implemented) happening classically.
The gaussian cdf is not computed on the quantum computer, but instead a pre-determined discrete cdf is turned into a quantum gate which can be applied repeatedly to create multi-gaussian superpositions and so on.

Uniform does nothing special:

(def uniformblock 07) ; eight qubits
(uniform uniformblock)

Multinomial can create any discrete multinomial distribution on qubits:

This circuit will produce 111 and 000 with equal probability (but NOT using entanglement, since there is a possible intermediate state of 00).

Hacking

Each language feature is located in lib/constructs/ under a file that has the same name as the feature.
Doing this allows language features to be added dynamically.
The only requirement is that each feature-file have a function create-feature where feature is the name of the feature (i.e. create-if).
This function should take the arguments that the function does, and return valid QUIL code.

For instance, the if statement is defined as follows:
lib/constructs/if.py: