There are two main groups of quantum programming languages:
imperative quantum programming languages and
functional quantum programming languages.
Imperative languages The most prominent representatives of the imperative languages are QCL, LanQ and Q|SI>. is an open-source embedded language designed to facilitate quantum programming, leveraging the familiar syntax and simplicity of Python. It serves as an integral component of the Ket Quantum Programming Platform, seamlessly integrating with a
Rust runtime library and a quantum simulator. Maintained by Quantuloop, the project emphasizes accessibility and versatility for researchers and developers. The following example demonstrates the implementation of a
Bell state using Ket: from ket import * a, b = quant(2) # Allocate two quantum bits H(a) # Put qubit `a` in a superposition cnot(a, b) # Entangle the two qubits in the Bell state m_a = measure(a) # Measure qubit `a`, collapsing qubit `b` as well m_b = measure(b) # Measure qubit `b` • Assert that the measurement of both qubits will always be equal assert m_a.value == m_b.value
LQP The Logic of Quantum Programs (LQP) is a dynamic quantum logic, capable of expressing important features of quantum measurements and unitary evolutions of multi-partite states, and provides logical characterizations of various forms of entanglement. The logic has been used to specify and verify the correctness of various protocols in quantum computation.
Q language Q Language is the second implemented imperative quantum programming language. Q Language was implemented as an extension of
C++ programming language. It provides classes for basic quantum operations like QHadamard, QFourier, QNot, and QSwap, which are derived from the base class Qop. New operators can be defined using C++ class mechanism. Quantum memory is represented by class Qreg. Qreg x1; // 1-qubit quantum register with initial value 0 Qreg x2(2,0); // 2-qubit quantum register with initial value 0 The computation process is executed using a provided simulator. Noisy environments can be simulated using parameters of the simulator.
Q# A language developed by
Microsoft to be used with the
Quantum Development Kit.
QCL Quantum Computation Language (QCL) is one of the first implemented quantum
programming languages. The most important feature of QCL is the support for user-defined operators and functions. Its
syntax resembles the syntax of the
C programming language and its classical
data types are similar to primitive data types in C. One can combine classical code and quantum code in the same program.
qGCL Quantum Guarded Command Language (qGCL) was defined by P. Zuliani in his PhD thesis. It is based on
Guarded Command Language created by
Edsger Dijkstra. It can be described as a language of quantum programs specification.
QMASM Quantum Macro Assembler (QMASM) is a low-level language specific to quantum annealers such as the D-Wave.
Qmod Quantum Modeling (Qmod) language is a high-level language that abstracts away the gate-level qubit operation, providing a functional approach to the implementation of quantum algorithms on quantum registers. The language is part of the Classiq platform and can be used directly with its native syntax, through a Python SDK, or with a visual editor, all methods can take advantage of the larger library of algorithms and the efficient circuit optimization.
Q|SI> Q|SI> is a platform embedded in
.Net language supporting quantum programming in a quantum extension of while-language. This platform includes a compiler of the quantum while-language and a chain of tools for the simulation of quantum computation, optimisation of quantum circuits, termination analysis of quantum programs, and verification of quantum programs.
Quantum pseudocode Quantum pseudocode proposed by E. Knill is the first formalized language for description of
quantum algorithms. It was introduced and, moreover, was tightly connected with a model of quantum machine called
Quantum Random Access Machine (QRAM).
Scaffold Scaffold is a C-like language, that compiles to QASM and OpenQASM. It is built on top of the
LLVM Compiler Infrastructure to perform optimizations on Scaffold code before generating a specified instruction set.
Silq Silq is a high-level programming language for quantum computing with a strong static type system, developed at
ETH Zürich.
Functional languages Efforts are underway to develop
functional programming languages for
quantum computing. Functional programming languages are well-suited for reasoning about programs. Examples include Selinger's QPL, and the
Haskell-like language QML by Altenkirch and Grattage. Higher-order quantum programming languages, based on
lambda calculus, have been proposed by van Tonder, Selinger and Valiron and by Arrighi and Dowek.
LIQUi|> LIQUi|> (pronounced
liquid) is a quantum simulation extension on the
F# programming language. It is currently being developed by the Quantum Architectures and Computation Group (QuArC) part of the StationQ efforts at Microsoft Research. LIQUi|> seeks to allow theorists to experiment with quantum algorithm design before physical quantum computers are available for use. It includes a programming language, optimization and scheduling algorithms, and quantum simulators. LIQUi|> can be used to translate a quantum algorithm written in the form of a high-level program into the low-level machine instructions for a quantum device.
QFC and QPL QFC and QPL are two closely related quantum programming languages defined by Peter Selinger. They differ only in their syntax: QFC uses a flow chart syntax, whereas QPL uses a textual syntax. These languages have classical control flow but can operate on quantum or classical data. Selinger gives a denotational semantics for these languages in a category of
superoperators.
QML QML is a
Haskell-like quantum programming language by Altenkirch and Grattage.
Quantum lambda calculi Quantum lambda calculi are extensions of the classical
lambda calculus introduced by
Alonzo Church and
Stephen Cole Kleene in the 1930s. The purpose of quantum lambda calculi is to extend quantum programming languages with a theory of
higher-order functions. The first attempt to define a quantum lambda calculus was made by Philip Maymin in 1996. His lambda-q calculus is powerful enough to express any quantum computation. However, this language can efficiently solve
NP-complete problems, and therefore appears to be strictly stronger than the standard quantum computational models (such as the
quantum Turing machine or the
quantum circuit model). Therefore, Maymin's lambda-q calculus is probably not implementable on a physical device. In 2003, André van Tonder defined an extension of the
lambda calculus suitable for proving correctness of quantum programs. He also provided an implementation in the
Scheme programming language. In 2004, Selinger and Valiron defined a
strongly typed lambda calculus for quantum computation with a type system based on
linear logic.
Quipper Quipper was published in 2013. It is implemented as an embedded language, using
Haskell as the host language. For this reason, quantum programs written in Quipper are written in Haskell using provided libraries. For example, the following code implements preparation of a superposition import Quipper spos :: Bool -> Circ Qubit spos b = do q ==See also==