Quantum programming

{{Short description|Computer programming for quantum computers}}

{{Primary sources|date=August 2024}}

{{Use mdy dates|date=February 2023}}

{{Use American English|date=February 2023}}

Quantum programming refers to the process of designing and implementing algorithms that operate on quantum systems, typically using quantum circuits composed of quantum gates, measurements, and classical control logic. These circuits are developed to manipulate quantum states for specific computational tasks or experimental outcomes. Quantum programs may be executed on quantum processors, simulated on classical hardware, or implemented through laboratory instrumentation for research purposes.

When working with quantum processor-based systems, quantum programming languages provide high-level abstractions to express quantum algorithms efficiently. These languages often integrate with classical programming environments and support hybrid quantum-classical workflows. The development of quantum software has been strongly influenced by the open-source community, with many toolkits and frameworks—such as Qiskit, Cirq, PennyLane, and qBraid SDK—available under open licenses.{{Cite journal|last1=Häner|first1=Thomas |last2=Steiger|first2=Damian S.|last3=Svore|first3=Krysta|author3-link= Krysta Svore |last4=Troyer|first4=Matthias|date=2018|title=A software methodology for compiling quantum programs|journal=Quantum Science and Technology|volume=3|issue=2|pages=020501|doi=10.1088/2058-9565/aaa5cc|issn=2058-9565|arxiv=1604.01401|bibcode=2018QS&T....3b0501H }}{{Cite web|url=https://github.com/qiskit/qiskit|title=Qiskit GitHub repository|website=GitHub}}

Quantum programming can also be used to model or control experimental systems through quantum instrumentation and sensor-based platforms. While some quantum computing architectures—such as linear optical quantum computing using the KLM protocol—require specialized hardware, others use gate-based quantum processors accessible through software interfaces. In both cases, quantum programming serves as the bridge between theoretical algorithms and physical implementation.

Quantum instruction sets

Quantum instruction sets are used to turn higher level algorithms into physical instructions that can be executed on quantum processors. Sometimes these instructions are specific to a given hardware platform, e.g. ion traps or superconducting qubits.

= Blackbird =

Blackbird{{Cite web|url=https://quantum-blackbird.readthedocs.io/en/latest/|title=Blackbird Quantum Assembly Language — Blackbird 0.2.0 documentation|website=quantum-blackbird.readthedocs.io|access-date=2019-06-24}}{{Cite journal|last1=Weedbrook|first1=Christian|last2=Amy|first2=Matthew|last3=Bergholm|first3=Ville|last4=Quesada|first4=Nicolás|last5=Izaac|first5=Josh|last6=Killoran|first6=Nathan|date=2019-03-11|title=Strawberry Fields: A Software Platform for Photonic Quantum Computing|journal=Quantum|language=en-GB|volume=3|pages=129|doi=10.22331/q-2019-03-11-129|arxiv=1804.03159|bibcode=2019Quant...3..129K |s2cid=54763305}} is a quantum instruction set and intermediate representation used by Xanadu Quantum Technologies and Strawberry Fields. It is designed to represent continuous-variable quantum programs that can run on photonic quantum hardware.

= cQASM =

cQASM,{{Cite arXiv|last1=Bertels|first1=K.|last2=Almudever|first2=C. G.|last3=Hogaboam|first3=J. W.|last4=Ashraf|first4=I.|last5=Guerreschi|first5=G. G.|last6=Khammassi|first6=N.|date=2018-05-24|title=cQASM v1.0: Towards a Common Quantum Assembly Language|language=en|eprint=1805.09607v1|class=quant-ph}} also known as common QASM, is a hardware-agnostic quantum assembly language which guarantees the interoperability between all the quantum compilation and simulation tools. It was introduced by the QCA Lab at TUDelft.

= OpenQASM =

{{Main|OpenQASM}}

OpenQASM{{Citation|title=qiskit-openqasm: OpenQASM specification|date=2017-07-04|url=https://github.com/IBM/qiskit-openqasm|publisher=International Business Machines|access-date=2017-07-06}} is the intermediate representation introduced by IBM for use with Qiskit and the IBM Quantum Platform.

= QIR =

Quantum Intermediate Representation (QIR) is a hardware-agnostic intermediate representation developed by Microsoft as part of the Quantum Development Kit. It is based on the LLVM compiler infrastructure and is designed to represent quantum programs in a way that supports optimization and execution across diverse quantum hardware backends.{{Cite web|title=Quantum Intermediate Representation (QIR) |url=https://github.com/qir-alliance/qir-spec|website=QIR Alliance|access-date=2025-06-02}} QIR serves as a common target for quantum compilers, enabling interoperation between different programming languages, such as Q#, and low-level hardware control layers. It is maintained by the QIR Alliance, a collaborative group of academic and industry partners.

= Quil =

{{Main|Quil (instruction set architecture)}}

Quil is an instruction set architecture for quantum computing that first introduced a shared quantum/classical memory model. It was introduced by Robert Smith, Michael Curtis, and William Zeng in A Practical Quantum Instruction Set Architecture.{{cite arXiv |eprint=1608.03355 |title=A Practical Quantum Instruction Set Architecture |last1=Smith |first1=Robert S. |last2=Curtis |first2=Michael J. |last3=Zeng |first3=William J. |year=2016 |class=quant-ph }} Many quantum algorithms (including quantum teleportation, quantum error correction, simulation,{{Cite journal|last1=McClean|first1=Jarrod R.|last2=Romero|first2=Jonathan|last3=Babbush|first3=Ryan|last4=Aspuru-Guzik|first4=Alán|date=2016-02-04|title=The theory of variational hybrid quantum-classical algorithms|arxiv=1509.04279|journal=New Journal of Physics|volume=18|issue=2|pages=023023|doi=10.1088/1367-2630/18/2/023023|issn=1367-2630|bibcode=2016NJPh...18b3023M|s2cid=92988541}}{{cite arXiv |eprint=1610.06910 |title=A Hybrid Classical/Quantum Approach for Large-Scale Studies of Quantum Systems with Density Matrix Embedding Theory |last1=Rubin |first1=Nicholas C. |last2=Curtis |first2=Michael J. |last3=Zeng |first3=William J. |year=2016 |class=quant-ph }} and optimization algorithms{{cite arXiv |eprint=1411.4028|title=A Quantum Approximate Optimization Algorithm|last1=Farhi|first1=Edward|last2=Goldstone|first2=Jeffrey|last3=Gutmann|first3=Sam|year=2014|class=quant-ph}}) require a shared memory architecture.

Quantum software development kits

Quantum software development kits provide collections of tools to create and manipulate quantum programs.{{Cite journal|last1=Häner|first1=Thomas |last2=Steiger|first2=Damian S.|last3=Svore|first3=Krysta|author3-link= Krysta Svore |last4=Troyer|first4=Matthias|date=2018|title=A software methodology for compiling quantum programs|journal=Quantum Science and Technology|volume=3|issue=2|pages=020501|doi=10.1088/2058-9565/aaa5cc|issn=2058-9565|arxiv=1604.01401|bibcode=2018QS&T....3b0501H |s2cid=1922315 }} They also provide the means to simulate the quantum programs or prepare them to be run using cloud-based quantum devices and self-hosted quantum devices.

= SDKs with access to quantum processors =

The following software development kits can be used to run quantum circuits on prototype quantum devices, as well as on simulators.

== Cirq ==

{{Main|Cirq}}

An open source project developed by Google, which uses the Python programming language to create and manipulate quantum circuits. Programs written in Cirq can be run on IonQ, Pasqal, Rigetti, and Alpine Quantum Technologies.

== Classiq ==

A cloud-based quantum IDE developed by Classiq, uses a high-level quantum language, Qmod, to generate scalable and efficient quantum circuits with a hardware-aware synthesis engine, that can be deployed across a wide range of QPUs. The platform includes a large library of quantum algorithms.

== Forest ==

An open source project developed by Rigetti, which uses the Python programming language to create and manipulate quantum circuits. Results are obtained either using simulators or prototype quantum devices provided by Rigetti. As well as the ability to create programs using basic quantum operations, higher level algorithms are available within the Grove package.{{Cite web|url=https://grove-docs.readthedocs.io/en/latest/|title=Welcome to the Documentation for Grove! — Grove 1.7.0 documentation|website=grove-docs.readthedocs.io}} Forest is based on the Quil instruction set.

== MindQuantum ==

MindQuantum is a quantum computing framework based on MindSpore, focusing on the implementation of NISQ algorithms.{{Cite web|url=https://www.mindspore.cn/mindquantum/docs/en/master/index.html|title=MindSpore Quantum Documentation|website=www.mindspore.cn/mindquantum}}{{Cite arXiv|title=MindSpore Quantum: A User-Friendly, High-Performance, and AI-Compatible Quantum Computing Framework|eprint=2406.17248 |last1=Xu |first1=Xusheng |last2=Cui |first2=Jiangyu |last3=Cui |first3=Zidong |last4=He |first4=Runhong |last5=Li |first5=Qingyu |last6=Li |first6=Xiaowei |last7=Lin |first7=Yanling |last8=Liu |first8=Jiale |last9=Liu |first9=Wuxin |last10=Lu |first10=Jiale |last11=Luo |first11=Maolin |last12=Lyu |first12=Chufan |last13=Pan |first13=Shijie |last14=Pavel |first14=Mosharev |last15=Shu |first15=Runqiu |last16=Tang |first16=Jialiang |last17=Xu |first17=Ruoqian |last18=Xu |first18=Shu |last19=Yang |first19=Kang |last20=Yu |first20=Fan |last21=Zeng |first21=Qingguo |last22=Zhao |first22=Haiying |last23=Zheng |first23=Qiang |last24=Zhou |first24=Junyuan |last25=Zhou |first25=Xu |last26=Zhu |first26=Yikang |last27=Zou |first27=Zuoheng |last28=Bayat |first28=Abolfazl |last29=Cao |first29=Xi |last30=Cui |first30=Wei |date=2024 |class=quant-ph |display-authors=1 }}{{Cite web|url=https://github.com/mindspore-ai/mindquantum|title=mindquantum|website=github.com}}

== Ocean ==

An open source suite of tools developed by D-Wave. Written mostly in the Python programming language, it enables users to formulate problems in Ising Model and Quadratic Unconstrained Binary Optimization formats (QUBO). Results can be obtained by submitting to an online quantum computer in Leap, D-Wave's real-time Quantum Application Environment, customer-owned machines, or classical samplers.{{citation needed|date=June 2021}}

File:QProg1-Refreshed.png

== PennyLane ==

An open-source Python library developed by Xanadu Quantum Technologies for differentiable programming of quantum computers.{{Cite web|title=PennyLane Documentation — PennyLane 0.14.1 documentation|url=https://pennylane.readthedocs.io/en/stable/|access-date=2021-03-26|website=pennylane.readthedocs.io}}{{Cite web|date=2021-02-17|title=AWS joins PennyLane, an open-source framework that melds machine learning with quantum computing|url=https://siliconangle.com/2021/02/17/aws-throws-weight-behind-pennylane-open-source-framework-melds-machine-learning-quantum-computing/|access-date=2021-03-26|website=SiliconANGLE|language=en-US}}{{Cite web|date=2021-02-26|title=SD Times Open-Source Project of the Week: PennyLane|url=https://sdtimes.com/open-source/sd-times-open-source-project-of-the-week-pennylane/|access-date=2021-03-26|website=SD Times|language=en-US}}{{Cite web|last=Salamone|first=Salvatore|date=2020-12-13|title=Real-time Analytics News Roundup for Week Ending December 12|url=https://www.rtinsights.com/real-time-analytics-news-roundup-for-week-ending-december-12/|access-date=2021-03-26|website=RTInsights|language=en-US}} PennyLane provides users the ability to create models using TensorFlow, NumPy, or PyTorch, and connect them with quantum computer backends available from IBMQ, Google Quantum, Rigetti, Quantinuum{{Cite web|url=https://www.quantinuum.com/|title=Accelerating Quantum Computing|website=www.quantinuum.com}} and Alpine Quantum Technologies.{{Cite web|url=https://www.aqt.eu/|title=Home|website=AQT | ALPINE QUANTUM TECHNOLOGIES}}{{Cite web|title=Plugins and ecosystem — PennyLane|url=https://pennylane.ai/plugins.html|access-date=2021-03-26|website=pennylane.ai|language=en}}

== Perceval ==

An open-source project created by {{interlanguage link|Quandela|fr}} for designing photonic quantum circuits and developing quantum algorithms, based on Python. Simulations are run either on the user's own computer or on the cloud. Perceval is also used to connect to Quandela's cloud-based photonic quantum processor.{{cite news |title=La puissance d'un ordinateur quantique testée en ligne (The power of a quantum computer tested online) |newspaper=Le Monde.fr |date=November 22, 2022 |url=https://www.lemonde.fr/sciences/article/2022/11/22/la-puissance-d-un-ordinateur-quantique-testee-en-ligne_6151063_1650684.html |publisher=Le Monde}}{{cite journal |last1=Heurtel |first1=Nicolas |last2=Fyrillas |first2=Andreas |last3=de Gliniasty |first3=Grégoire |last4=Le Bihan |first4=Raphaël |last5=Malherbe |first5=Sébastien |last6=Pailhas |first6=Marceau |last7=Bertasi |first7=Eric |last8=Bourdoncle |first8=Boris |last9=Emeriau |first9=Pierre-Emmanuel |last10=Mezher |first10=Rawad |last11=Music |first11=Luka |last12=Belabas |first12=Nadia |last13=Valiron |first13=Benoît |last14=Senellart |first14=Pascale |last15=Mansfield |first15=Shane |last16=Senellart |first16=Jean |title=Perceval: A Software Platform for Discrete Variable Photonic Quantum Computing |journal=Quantum |date=February 21, 2023 |volume=7 |page=931 |doi=10.22331/q-2023-02-21-931 |arxiv=2204.00602 |bibcode=2023Quant...7..931H |s2cid=247922568 |url=https://quantum-journal.org/papers/q-2023-02-21-931/}}

== ProjectQ ==

An open source project developed at the Institute for Theoretical Physics at ETH, which uses the Python programming language to create and manipulate quantum circuits.{{Cite web|url=https://projectq.ch/|title=Home}} Results are obtained either using a simulator, or by sending jobs to IBM quantum devices.

== qBraid SDK ==

The qBraid SDK is an open-source platform-agnostic quantum runtime framework developed by qBraid. It enables users to write quantum programs once and execute them across various quantum hardware and simulators without modifying the code. The SDK supports multiple quantum programming libraries, including Qiskit, Cirq, PennyLane, PyQuil, and Braket, among others. It features a graph-based transpiler that facilitates conversion between different quantum program types, allowing seamless interoperability between frameworks. The SDK also provides tools for job submission, result retrieval, and circuit visualization. It is integrated with qBraid Lab, offering access to over 20 quantum devices and simulators from providers such as IonQ, Rigetti, QuEra, and IQM.{{Cite web|url=https://docs.qbraid.com/sdk/user-guide/overview|title=qBraid SDK Overview|website=docs.qbraid.com}}{{Cite web|url=https://www.qbraid.com/blog-posts/qbraid-announces-qbraid-sdk-integrated-with-amazon-braket|title=qBraid Announces qBraid SDK Integrated with Amazon Braket on qBraid Lab|website=qbraid.com}}

== Qibo ==

An open source full-stack API for quantum simulation, quantum hardware control and calibration developed by multiple research laboratories, including QRC, CQT and INFN. [https://github.com/qiboteam/qibo Qibo] is a modular framework which includes multiple backends for quantum simulation and hardware control.{{Cite journal |last1=Efthymiou |first1=Stavros |last2=Ramos-Calderer |first2=Sergi |last3=Bravo-Prieto |first3=Carlos |last4=Pérez-Salinas |first4=Adrián |last5=García-Martín |first5=Diego |last6=Garcia-Saez |first6=Artur |last7=Latorre |first7=José Ignacio |last8=Carrazza |first8=Stefano |date=2022-01-01 |title=Qibo: a framework for quantum simulation with hardware acceleration |url=https://iopscience.iop.org/article/10.1088/2058-9565/ac39f5 |journal=Quantum Science and Technology |volume=7 |issue=1 |pages=015018 |doi=10.1088/2058-9565/ac39f5 |arxiv=2009.01845 |bibcode=2022QS&T....7a5018E |hdl=2434/887963 |s2cid=221507478 |issn=2058-9565}}{{Cite journal |last1=Efthymiou |first1=Stavros |last2=Lazzarin |first2=Marco |last3=Pasquale |first3=Andrea |last4=Carrazza |first4=Stefano |date=2022-09-22 |title=Quantum simulation with just-in-time compilation |url=https://quantum-journal.org/papers/q-2022-09-22-814/ |journal=Quantum |language=en-GB |volume=6 |pages=814 |doi=10.22331/q-2022-09-22-814|arxiv=2203.08826 |bibcode=2022Quant...6..814E |s2cid=247518955 |doi-access=free }} This project aims at providing a platform agnostic quantum hardware control framework with drivers for multiple instruments{{Cite web|url=https://github.com/qiboteam/qibolab|title=Qibolab|date=November 2, 2022|via=GitHub}} and tools for quantum calibration, characterization and validation.{{Cite web|url=https://github.com/qiboteam/qibocal|title=Qibocal|date=November 1, 2022|via=GitHub}} This framework focuses on self-hosted quantum devices by simplifying the software development required in labs.

== Qiskit ==

{{Main|Qiskit}}

An open source project developed by IBM.{{Cite web|url=https://qiskit.org/|title=qiskit.org|website=qiskit.org}} Quantum circuits are created and manipulated using Python. Results are obtained either using simulators that run on the user's own device, simulators provided by IBM or prototype quantum devices provided by IBM. As well as the ability to create programs using basic quantum operations, higher level tools for algorithms and benchmarking are available within specialized packages.{{cite web |url=https://qiskit.org/overview/ |title=Qiskit Overview |access-date=2021-02-10}} Qiskit is based on the OpenQASM standard for representing quantum circuits. It also supports pulse level control of quantum systems via QiskitPulse standard.{{cite arXiv |eprint=1809.03452|title=Qiskit Backend Specifications for OpenQASM and OpenPulse Experiments|last1=McKay|first1=David C.|last2=Alexander|first2=Thomas|last3=Bello|first3=Luciano|last4=Biercuk|first4=Michael J.|last5=Bishop|first5=Lev|last6=Chen|first6=Jiayin|last7=Chow|first7=Jerry M.|last8=Córcoles|first8=Antonio D.|last9=Egger|first9=Daniel|last10=Filipp|first10=Stefan|last11=Gomez|first11=Juan|last12=Hush|first12=Michael|last13=Javadi-Abhari|first13=Ali|last14=Moreda|first14=Diego|last15=Nation|first15=Paul|last16=Paulovicks|first16=Brent|last17=Winston|first17=Erick|last18=Wood|first18=Christopher J.|last19=Wootton|first19=James|last20=Gambetta|first20=Jay M.|year=2018|class=quant-ph}}

== Qrisp ==

Qrisp{{cite web|title = Qrisp official website|url=https://www.qrisp.eu/}} is an open source project coordinated by the Eclipse Foundation{{cite web |title=Eclipse Foundation (website) |url=https://www.eclipse.org/org/foundation/}} and developed in Python programming by Fraunhofer FOKUS{{cite web |title=Fraunhofer FOKUS (website) |url=https://www.fokus.fraunhofer.de/}}

Qrisp is a high-level programming language for creating and compiling quantum algorithms. Its structured programming model enables scalable development and maintenance. The expressive syntax is based on variables instead of qubits, with the QuantumVariable as core class, and functions instead of gates. Additional tools, such as a performant simulator and automatic uncomputation, complement the extensive framework.

Furthermore, it is platform independent, since it offers alternative compilation of elementary functions down to the circuit level, based on device-specific gate sets.

== Quantum Development Kit ==

A project developed by Microsoft{{Cite web|url=https://learn.microsoft.com/en-us/azure/quantum/|title=Azure Quantum documentation, QDK & Q# API reference - Azure Quantum|website=learn.microsoft.com}} as part of the .NET Framework. Quantum programs can be written and run within Visual Studio and VSCode using the quantum programming language Q#. Programs developed in the QDK can be run on Microsoft's Azure Quantum,{{Cite web|url=https://learn.microsoft.com/en-us/azure/quantum/overview-azure-quantum|title=What is Azure Quantum? - Azure Quantum|website=learn.microsoft.com|date=January 11, 2023 }} and run on quantum computers from Quantinuum, IonQ, and Pasqal.{{Cite web|url=https://pasqal.io/|title=PASQAL|website=PASQAL}}

== Strawberry Fields ==

An open-source Python library developed by Xanadu Quantum Technologies for designing, simulating, and optimizing continuous variable (CV) quantum optical circuits.{{Cite web|title=Strawberry Fields — Strawberry Fields 0.8.0 documentation|url=https://strawberryfields.readthedocs.io/en/latest/|access-date=2018-09-25|website=strawberryfields.readthedocs.io|language=en}}{{cite journal|last1=Killoran|first1=Nathan|last2=Izaac|first2=Josh|last3=Quesada|first3=Nicolás|last4=Bergholm|first4=Ville|last5=Amy|first5=Matthew|last6=Weedbrook|first6=Christian|year=2019|title=Strawberry Fields: A Software Platform for Photonic Quantum Computing|journal=Quantum|volume=3|pages=129|arxiv=1804.03159|doi=10.22331/q-2019-03-11-129|bibcode=2019Quant...3..129K |s2cid=54763305}} Three simulators are provided - one in the Fock basis, one using the Gaussian formulation of quantum optics,{{Cite journal|last1=Weedbrook|first1=Christian|last2=Pirandola|first2=Stefano|last3=García-Patrón|first3=Raúl|last4=Cerf|first4=Nicolas J.|last5=Ralph|first5=Timothy C.|last6=Shapiro|first6=Jeffrey H.|last7=Lloyd|first7=Seth|date=2012-05-01|title=Gaussian quantum information|journal=Reviews of Modern Physics|volume=84|issue=2|pages=621–669|arxiv=1110.3234|bibcode=2012RvMP...84..621W|doi=10.1103/RevModPhys.84.621|s2cid=119250535}} and one using the TensorFlow machine learning library. Strawberry Fields is also the library for executing programs on Xanadu's quantum photonic hardware.{{Cite web|title=Hardware — Strawberry Fields|url=https://strawberryfields.ai/photonics/hardware/index.html|access-date=2021-03-26|website=strawberryfields.ai}}{{Cite web|title=In the Race to Hundreds of Qubits, Photons May Have "Quantum Advantage"|url=https://spectrum.ieee.org/race-to-hundreds-of-photonic-qubits-xanadu-scalable-photon|access-date=2021-03-26|website=IEEE Spectrum: Technology, Engineering, and Science News|date=5 March 2021|language=en}}

== t|ket> ==

A quantum programming environment and optimizing compiler developed by Quantinuum that targets simulators and several trapped-ion quantum hardware backends, released in December 2018.{{cite web |title=pytket|website=GitHub|date=22 January 2022|url=https://github.com/CQCL/pytket}}

Quantum programming languages

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,{{cite web |author=Bernhard Omer |title=The QCL Programming Language |url=http://tph.tuwien.ac.at/~oemer/qcl.html}} LanQ{{cite web |author=Hynek Mlnařík |title=LanQ – a quantum imperative programming language |url=http://lanq.sourceforge.net/}} and Q|SI>.

== Ket ==

Ket{{Cite journal |last1=Da Rosa |first1=Evandro Chagas Ribeiro |last2=De Santiago |first2=Rafael |date=2022-01-31 |title=Ket Quantum Programming |url=https://dl.acm.org/doi/10.1145/3474224 |journal=ACM Journal on Emerging Technologies in Computing Systems |language=en |volume=18 |issue=1 |pages=1–25 |doi=10.1145/3474224 |issn=1550-4832}} 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,{{Cite web |title=Ket Quantum Programming |url=https://quantumket.org |access-date=2023-05-18 |website=quantumket.org |language=en}} 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`

  1. 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.A. Baltag and S. Smets, [https://arxiv.org/abs/2110.01361 "LQP: The Dynamic Logic of Quantum Information"], Mathematical Structures in Computer Science 16(3):491-525, 2006.{{cite journal | url=https://link.springer.com/article/10.1007/s10773-013-1987-3 | doi=10.1007/s10773-013-1987-3 | title=PLQP & Company: Decidable Logics for Quantum Algorithms | year=2014 | last1=Baltag | first1=Alexandru | last2=Bergfeld | first2=Jort | last3=Kishida | first3=Kohei | last4=Sack | first4=Joshua | last5=Smets | first5=Sonja | last6=Zhong | first6=Shengyang | journal=International Journal of Theoretical Physics | volume=53 | issue=10 | pages=3628–3647 | bibcode=2014IJTP...53.3628B | s2cid=254573992 }}

== Q language ==

Q Language is the second implemented imperative quantum programming language.{{cite web |url=http://sra.itc.it/people/serafini/qlang/ |title=Software for the Q language |date=2001-11-23 |access-date=2017-07-20 |url-status=dead |archive-url=https://web.archive.org/web/20090620011647/http://sra.itc.it/people/serafini/qlang/ |archive-date=2009-06-20 }} 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# ==

{{Main|Q Sharp}}

A language developed by Microsoft to be used with the Quantum Development Kit.{{Cite web|url=https://learn.microsoft.com/en-us/azure/quantum/overview-what-is-qsharp-and-qdk|title=Introduction to Q# & Quantum Development Kit - Azure Quantum|website=learn.microsoft.com|date=March 30, 2023 }}

== QCL ==

{{Main|Quantum Computation Language}}

Quantum Computation Language (QCL) is one of the first implemented quantum programming languages.{{cite web|url=http://tph.tuwien.ac.at/~oemer/qcl.html |title=QCL - A Programming Language for Quantum Computers |website=tuwien.ac.at |access-date=2017-07-20}} 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.Scott Pakin, [https://ieeexplore.ieee.org/document/7761637/ "A Quantum Macro Assembler"], Proceedings of the 20th Annual IEEE High Performance Extreme Computing Conference 2016

== 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 [https://classiq.io 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.{{Cite journal|last1=Liu|first1=Shusen|last2=Zhou|first2=li|last3=Guan|first3=Ji|last4=He|first4=Yang|last5=Duan|first5=Runyao|last6=Ying|first6=Mingsheng|date=2017-05-09|title=Q|SI>: A Quantum Programming Language|journal=Scientia Sinica Informationis|volume=47|issue=10|pages=1300|doi=10.1360/N112017-00095|arxiv=1710.09500|s2cid=9163705}}{{Cite journal|last=Ying|first=Mingsheng|date=January 2012|title=Floyd–hoare Logic for Quantum Programs|journal=ACM Trans. Program. Lang. Syst.|volume=33|issue=6|pages=19:1–19:49|doi=10.1145/2049706.2049708|s2cid=416960|issn=0164-0925|doi-access=free}} This platform includes a compiler of the quantum while-language{{Cite journal|last1=Ying|first1=Mingsheng|last2=Feng|first2=Yuan|date=2010|title=A Flowchart Language for Quantum Programming|url=https://www.computer.org/csdl/trans/ts/2011/04/tts2011040466-abs.html|journal=IEEE Transactions on Software Engineering|volume=37|issue=4|pages=466–485|doi=10.1109/TSE.2010.94|s2cid=5879273|issn=0098-5589}} and a chain of tools for the simulation of quantum computation, optimisation of quantum circuits, termination analysis of quantum programs,{{Cite journal|last1=Ying|first1=Mingsheng|last2=Yu|first2=Nengkun|last3=Feng|first3=Yuan|last4=Duan|first4=Runyao|title=Verification of quantum programs|journal=Science of Computer Programming|volume=78|issue=9|pages=1679–1700|doi=10.1016/j.scico.2013.03.016|year=2013|arxiv=1106.4063|s2cid=18913620}} and verification of quantum programs.{{Citation |doi=10.1145/3093333.3009840|hdl=10453/127333 |title=Invariants of quantum programs: Characterisations and generation |date=2017 |last1=Ying |first1=Mingsheng |last2=Ying |first2=Shenggang |last3=Wu |first3=Xiaodi |journal=ACM SIGPLAN Notices |volume=52 |pages=818–832 |hdl-access=free }}{{cite arXiv |eprint=1601.03835|title=A Theorem Prover for Quantum Hoare Logic and its Applications|last1=Liu|first1=Tao|last2=Li|first2=Yangjia|last3=Wang|first3=Shuling|last4=Ying|first4=Mingsheng|last5=Zhan|first5=Naijun|year=2016|class=cs.LO}}

== 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 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.{{cite web |last1=Javadi-Abhari |first1=Ali |title=Scaffold: Quantum Programming Language |url=https://www.cs.princeton.edu/research/techreps/TR-934-12 |website=Princeton University-Department of Computer Science |publisher=Princeton University |access-date=22 September 2020}}{{cite journal |last1=Litteken |first1=Andrew |title=An updated LLVM-based quantum research compiler with further OpenQASM support |journal=Quantum Science and Technology |date=28 May 2020 |volume=5 |issue=3 |page=034013 |doi=10.1088/2058-9565/ab8c2c |bibcode=2020QS&T....5c4013L |osti=1803951 |s2cid=219101628 |doi-access=free }}

== Silq ==

Silq is a high-level programming language for quantum computing with a strong static type system, developed at ETH Zürich.{{Cite web|title=What is Silq?|url=https://silq.ethz.ch/|access-date=2020-06-21|website=silq.ethz.ch}}{{Cite book|last1=Bichsel|first1=Benjamin|last2=Baader|first2=Maximilian|last3=Gehr|first3=Timon|last4=Vechev|first4=Martin|title=Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation |chapter=Silq: A high-level quantum language with safe uncomputation and intuitive semantics |date=2020-06-11|language=en|location=London UK|publisher=ACM|pages=286–300|doi=10.1145/3385412.3386007|isbn=978-1-4503-7613-6|s2cid=219397029}}

= 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,Peter Selinger, [http://www.mathstat.dal.ca/~selinger/papers.html#qpl "Towards a quantum programming language"], Mathematical Structures in Computer Science 14(4):527-586, 2004. and the Haskell-like language QML by Altenkirch and Grattage.[http://www.cs.nott.ac.uk/~jjg/qml.html Jonathan Grattage: QML Research] (website)T. Altenkirch, V. Belavkin, J. Grattage, A. Green, A. Sabry, J. K. Vizzotto, [http://sneezy.cs.nott.ac.uk/qml QML: A Functional Quantum Programming Language] {{webarchive|url=https://web.archive.org/web/20060710201728/http://sneezy.cs.nott.ac.uk/QML/ |date=2006-07-10 }} (website) Higher-order quantum programming languages, based on lambda calculus, have been proposed by van Tonder,Andre van Tonder, [https://dx.doi.org/10.1137/S0097539703432165 "A Lambda Calculus for Quantum Computation"], SIAM J. Comput., 33(5), 1109–1135. (27 pages), 2004. Also available from [https://arxiv.org/abs/quant-ph/0307150 arXiv:quant-ph/0307150] Selinger and ValironPeter Selinger and Benoît Valiron, [http://www.mathstat.dal.ca/~selinger/papers/#qlambda "A lambda calculus for quantum computation with classical control"], Mathematical Structures in Computer Science 16(3):527-552, 2006. and by Arrighi and Dowek.Pablo Arrighi, Gilles Dowek, [http://www.arxiv.org/abs/quant-ph/0612199 "Linear-algebraic lambda-calculus: higher-order, encodings and confluence"], 2006

== LIQUi|> ==

LIQUi|> (pronounced liquid) is a quantum simulation extension on the F# programming language.{{cite web|url=https://stationq.github.io/Liquid/|title=The Language Integrated Quantum Operations Simulator |website=github.io |access-date=2017-07-20}} It is currently being developed by the Quantum Architectures and Computation Group (QuArC)Quantum Architectures and Computation Group (QuArC), https://www.microsoft.com/en-us/research/group/quantum-architectures-and-computation-group-quarc/, 2011 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.{{cite web|url=https://stationq.microsoft.com/ |title=StationQ |website=microsoft.com |access-date=2017-07-20}}

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.{{cite web|url=https://www.microsoft.com/en-us/research/project/language-integrated-quantum-operations-liqui/|title=Language-Integrated Quantum Operations: LIQUi|>|website=Microsoft|date=2016}}

== 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.{{cite web |url=http://sneezy.cs.nott.ac.uk/QML/ |title=QML: A Functional Quantum Programming Language |date=2007-09-26 |archive-url=https://web.archive.org/web/20070926230222/http://sneezy.cs.nott.ac.uk/QML/ |archive-date=2007-09-26}} Unlike Selinger's QPL, this language takes duplication, rather than discarding, of quantum information as a primitive operation. Duplication in this context is understood to be the operation that maps |\phi\rangle to |\phi\rangle\otimes|\phi\rangle, and is not to be confused with the impossible operation of cloning; the authors claim it is akin to how sharing is modeled in classical languages. QML also introduces both classical and quantum control operators, whereas most other languages rely on classical control.

An operational semantics for QML is given in terms of quantum circuits, while a denotational semantics is presented in terms of superoperators, and these are shown to agree. Both the operational and denotational semantics have been implemented (classically) in Haskell.Jonathan Grattage, [http://sneezy.cs.nott.ac.uk/qml/compiler QML: A Functional Quantum Programming Language (compiler)] {{Webarchive|url=https://web.archive.org/web/20160305052237/http://sneezy.cs.nott.ac.uk/qml/compiler/ |date=2016-03-05 }}, 2005–2008

== 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.Philip Maymin, [https://arxiv.org/abs/quant-ph/9612052 "Extending the Lambda Calculus to Express Randomized and Quantumized Algorithms"], 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 {{Citation needed|date=February 2019}}.

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.{{cite web |author=André van Tonder |title=A lambda calculus for quantum computation (website) |url=http://www.het.brown.edu/people/andre/qlambda |access-date=October 2, 2007 |archive-date=March 5, 2016 |archive-url=https://web.archive.org/web/20160305100936/http://www.het.brown.edu/people/andre/qlambda/ |url-status=dead }}

In 2004, Selinger and Valiron defined a strongly typed lambda calculus for quantum computation with a type system based on linear logic.Peter Selinger, Benoˆıt Valiron, [https://www.mscs.dal.ca/~selinger/papers/qlambdabook.pdf "Quantum Lambda Calculus"]

== Quipper ==

{{For|the education technology company|Quipper (company)}}

Quipper was published in 2013.{{cite web | url=http://www.mathstat.dal.ca/~selinger/quipper/ | title=The Quipper Language}}{{cite web |author1=Alexander S. Green |author2=Peter LeFanu Lumsdaine |author3=Neil J. Ross |author4=Peter Selinger |author5=Benoît Valiron |title=The Quipper Language (website) |url=http://www.mathstat.dal.ca/~selinger/quipper/}} It is implemented as an embedded language, using Haskell as the host language.{{Cite book |author1=Alexander S. Green |author2=Peter LeFanu Lumsdaine |author3=Neil J. Ross |author4=Peter Selinger |author5=Benoît Valiron |title=Reversible Computation |chapter=An Introduction to Quantum Programming in Quipper |arxiv=1304.5485|year=2013 |doi=10.1007/978-3-642-38986-3_10 |volume=7948 |pages=110–124|series=Lecture Notes in Computer Science |isbn=978-3-642-38985-6 |s2cid=9135905 }} 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 <- qinit b

r <- hadamard q

return r

References

{{reflist}}

Further reading

  • {{ Cite book |title=Foundations of quantum programming |last=Mingsheng |first=Ying |publisher=Morgan Kaufmann |isbn=978-0-4431-5942-8 |id=978-0-4431-5943-5 (eBook) |edition=2nd |location=Cambridge, Massachusetts |oclc=1406095194 |date=2024 }}
  • {{Cite book |title=Quantum Software Engineering |publisher=Springer |year=2022 |isbn=978-3-031-05323-8 |edition=1st|location=Cham, Switzerland |editor-last=Serrano |editor-first=Manuel A. |doi=10.1007/978-3-031-05324-5 |oclc=1347696597 |id=978-3-031-05326-9 (softcover) & 978-3-031-05324-5 (eBook) |editor-last2=Pérez-Castillo |editor-first2=Ricardo |editor-last3=Piattini |editor-first3=Mario}}