# The Quipper System

This is the Quipper System, an embedded functional programming language for quantum computation. You can browse the source code and documentation from here.

- User-level documentation:
- The module Quipper is the public interface of the Quipper language. It contains all the functionality that should be accessed by user-level code.
- Developer documentation:
- The modules under
`Quipper.Internal.*`

contain the Quipper implementation. You can browse these to find out how Quipper works, what its internal data structures are, etc. - Quipper.Algorithms:
- These modules contain implementations of seven quantum algorithms. Please click on the "Main" module of each algorithm to access its documentation.

**BF:**The Boolean Formula algorithm. See Quipper.Algorithms.BF.Main.**BWT:**The Binary Welded Tree algorithm. See Quipper.Algorithms.BWT.Main.**CL:**The Class Number algorithm. See Quipper.Algorithms.CL.Main.**GSE:**The Ground State Estimation algorithm. See Quipper.Algorithms.GSE.Main.**QLS:**The Quantum Linear Systems algorithm. See Quipper.Algorithms.QLS.Main.**TF:**The Triangle Finding algorithm. See Quipper.Algorithms.TF.Main.**USV:**The Unique Shortest Vector algorithm. See Quipper.Algorithms.USV.Main.

- Quipper.Libraries:
- These modules contain Quipper libraries, i.e., Quipper code that can be shared by several algorithms, but is not part of the Quipper programming language proper.

**Arith:**Basic arithmetic functions on quantum integers. This includes the operations of addition, subtraction, multiplication, sign, absolute value, increment and decrement, comparison, division with remainder, and Euclid's algorithm. Currently, this is used by the Class Number and Triangle Finding algorithms.**ClassicalOptim:**Functions for optimizing classical circuits. This is intended to reduce the size of automatically-generated circuits, such as those that are built using Quipper's`build_circuit`

keyword.**Decompose:**A library for decomposing circuits into particular gate sets.**DynamicLiftings:**Functions for performing dynamic liftings based on different mechanisms. For example, dynamic liftings can be based on simulated measurement outcomes, or just done at random.**FPReal:**Quantum implementation of fixed-precision real numbers. Includes addition, subtraction, multiplication, comparison, and logarithm. Currently, this is used by the Class Number algorithm.**GateDecompositions:**This library special decompositions of particular gates into particular gate bases. It also contains functions for decomposing multiple controls.**QFT:**An implementation of the Quantum Fourier transform. Since the Quantum Fourier transform is a component of phase estimation, this is used by several algorithms, including Ground State Estimation, Class Number, and Boolean Formula.**QFTAdd:**An implementation of Draper's ancilla-free addition circuit using the Quantum Fourier transform.**Qram:**Efficient implementation of random access of a quantum array by a quantum index.**QuipperASCIIParser:**A library for parsing Quipper's ASCII output and turning it back into a circuit. This library can be used as the basis for stand-alone tools that read and write circuits.**Qureg:**A library that provides quantum registers.**Simulation:**A library for simulating certain classes of circuits, for testing and debugging. Efficient simulation of classical circuits and stabilizer circuits; inefficient simulation of quantum circuits.**Synthesis:**A library integrating various exact and approximate synthesis algorithms into Quipper.**Unboxing:**Functions for “unboxing” hierarchical circuits, replacing calls to named subroutines by inlined copies of the subroutines themselves.

- Quipper.Utils:
- These modules contain general-purpose Haskell libraries, providing basic functionality that does not depend on Quipper, but that may be used by Quipper or other programs.

**Auxiliary:**Provides various general-purpose auxiliary functions.**CommandLine:**This is a library to help with the processing of command line options. Since each algorithm has its own "main" function, it is useful to factor out some common functionality.**PortableSignals:**An attempt to provide a portable way to handle Ctrl-C.**RandomSource:**Provides a container class to hold sources of randomness.**Sampling:**Code to help with generating test cases. Currently the Binary Welded Tree and Triangle Finding implementations have the ability to run automated test suites.**Stabilizers:**Implementation of the Stabilizer formalism, for efficient simulation of Clifford group circuits.**Template:**A library for lifting functions to a monad.**Tuple:**Auxiliary code for dealing with n-tuples.**Typeable:**Defines missing instances from Haskell's module Data.Typeable.

- Quipper.Programs:
- These modules contain additional programs.

**QCLParser:**This program can read a circuit exported by Ömer's quantum programming language QCL, and import it as a Quipper circuit. This directory also includes an implementation of the Binary Welded Tree algorithm in QCL, in the file bwt.qcl.**Tools:**A collection of stand-alone tools. This is partly intended as a demo of how to write more such tools.

- Quipper.Demos:
- This contains various small tests and demos of the Quipper language.

- Quipper
- Algorithms
- BF
- BWT
- CL
- GSE
- QLS
- TF
- USV

- Quipper.Internal
- Libraries
- Quipper.Libraries.Arith
- Quipper.Libraries.ClassicalOptim
- Quipper.Libraries.ClassicalOptim.AlgExp
- Quipper.Libraries.ClassicalOptim.Circuit
- Quipper.Libraries.ClassicalOptim.QuickCheck
- Quipper.Libraries.ClassicalOptim.QuickCheckAlgExp
- Quipper.Libraries.ClassicalOptim.QuickCheckArith
- Quipper.Libraries.ClassicalOptim.QuipperInterface
- Quipper.Libraries.ClassicalOptim.Simplification

- Quipper.Libraries.Decompose
- Quipper.Libraries.DynamicLiftings
- Quipper.Libraries.FPReal
- Quipper.Libraries.GateDecompositions
- Quipper.Libraries.QFT
- Quipper.Libraries.QFTAdd
- Quipper.Libraries.Qram
- Quipper.Libraries.QuantumIf
- Quipper.Libraries.QuipperASCIIParser
- Quipper.Libraries.Qureg
- Quipper.Libraries.Simulation
- Quipper.Libraries.Synthesis
- Quipper.Libraries.Unboxing

- Programs
- QCLParser

- Utils

- Algorithms