Quantum programming

From Wikipedia, the free encyclopedia
  (Redirected from Quantum programming language)
Jump to: navigation, search

Quantum programming is the process of assembling sequences of instructions, called quantum programs, that are capable of running on a quantum computer. Quantum programming languages help express quantum algorithms using high-level constructs.[1]

Quantum instruction sets[edit]

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.

Quil[edit]

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.[2] Many quantum algorithms (including quantum teleportation, quantum error correction, simulation,[3][4] and optimization algorithms[5]) require a shared memory architecture.

OpenQASM[edit]

OpenQASM[6] is the intermediate representation introduced by IBM for use with their Quantum Experience.

Quantum programming languages[edit]

There are two main groups of quantum programming languages: imperative quantum programming languages and functional quantum programming languages.

Imperative languages[edit]

The most prominent representatives of the imperative languages are QCL,[7] LanQ[8] and Q|SI>.[9]

QCL[edit]

Quantum Computation Language (QCL) is one of the first implemented quantum programming languages.[10] 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.

Quantum pseudocode[edit]

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).

Q|SI>[edit]

Q|SI>[9] is a platform embedded in .Net language supporting quantum programming in a quantum extension of while-language.[11] This platform includes a compiler of the quantum while-language[12] and a chain of tools for the simulation of quantum computation, optimisation of quantum circuits, termination analysis of quantum programs,[13] and verification of quantum programs.[14][15]

Q language[edit]

Q Language is the second implemented imperative quantum programming language.[16] 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.

qGCL[edit]

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[edit]

Quantum Macro Assembler (QMASM) is a low-level language specific to quantum annealers such as the D-Wave.[17]

Functional languages[edit]

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,[18] and the Haskell-like language QML by Altenkirch and Grattage.[19][20] Higher-order quantum programming languages, based on lambda calculus, have been proposed by van Tonder,[21] Selinger and Valiron[22] and by Arrighi and Dowek.[23]

QFC and QPL[edit]

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[edit]

QML is a Haskell-like quantum programming language by Altenkirch and Grattage.[19] 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 to , 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.[24]

LIQUi|>[edit]

LIQUi|> (pronounced 'liquid') is a quantum simulation extension on the F# programming language.[25] It is currently being developed by the Quantum Architectures and Computation Group (QuArC)[26] 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.[27]

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.[28]

Quantum lambda calculi[edit]

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.[29] 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.[30]

In 2004, Selinger and Valiron defined a strongly typed lambda calculus for quantum computation with a type system based on linear logic.

Quipper[edit]

Quipper was published in 2013.[31] It is implemented as an embedded language, using Haskell as the host language.[32] 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

Multi-Paradigm languages[edit]

Q#[edit]

Q# is a quantum programming language from Microsoft.

References[edit]

  1. ^ Jarosław Adam Miszczak. High-level Structures in Quantum Computing. ASIN 1608458512. 
  2. ^ Smith, Robert S.; Curtis, Michael J.; Zeng, William J. (2016-08-10). "A Practical Quantum Instruction Set Architecture". arXiv:1608.03355Freely accessible [quant-ph]. 
  3. ^ McClean, Jarrod R.; Romero, Jonathan; Babbush, Ryan; Aspuru-Guzik, Alán (2016-02-04). "The theory of variational hybrid quantum-classical algorithms". New Journal of Physics. 18 (2): 023023. arXiv:1509.04279Freely accessible. Bibcode:2016NJPh...18b3023M. doi:10.1088/1367-2630/18/2/023023. ISSN 1367-2630. 
  4. ^ Rubin, Nicholas C. (2016-10-21). "A Hybrid Classical/Quantum Approach for Large-Scale Studies of Quantum Systems with Density Matrix Embedding Theory". arXiv:1610.06910Freely accessible [quant-ph]. 
  5. ^ Farhi, Edward; Goldstone, Jeffrey; Gutmann, Sam (2014-11-14). "A Quantum Approximate Optimization Algorithm". arXiv:1411.4028Freely accessible [quant-ph]. 
  6. ^ qiskit-openqasm: OpenQASM specification, International Business Machines, 2017-07-04, retrieved 2017-07-06 
  7. ^ Bernhard Omer. "The QCL Programming Language". 
  8. ^ Hynek Mlnařík. "LanQ – a quantum imperative programming language". 
  9. ^ a b Liu, Shusen; Zhou, li; Guan, Ji; He, Yang; Duan, Runyao; Ying, Mingsheng (2017-05-09). "Q|SI>: A Quantum Programming Language". SCIENTIA Sinica Information. 47 (10): 1300. doi:10.1360/N112017-00095. 
  10. ^ "QCL - A Programming Language for Quantum Computers". tuwien.ac.at. Retrieved 2017-07-20. 
  11. ^ Ying, Mingsheng (January 2012). "Floyd–hoare Logic for Quantum Programs". ACM Trans. Program. Lang. Syst. 33 (6): 19:1–19:49. doi:10.1145/2049706.2049708. ISSN 0164-0925. 
  12. ^ Ying, Mingsheng; Feng, Yuan (2010). "A Flowchart Language for Quantum Programming". IEEE Transactions on Software Engineering. 37 (4): 466–485. doi:10.1109/TSE.2010.94. ISSN 0098-5589. 
  13. ^ Ying, Mingsheng; Yu, Nengkun; Feng, Yuan; Duan, Runyao (2013). "Verification of quantum programs". Science of Computer Programming. 78 (9): 1679–1700. doi:10.1016/j.scico.2013.03.016. 
  14. ^ Ying, Mingsheng; Ying, Shenggang; Wu, Xiaodi (2017). "Invariants of Quantum Programs: Characterisations and Generation". Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages. POPL 2017. New York, NY, USA: ACM. 52: 818–832. doi:10.1145/3093333.3009840. ISBN 9781450346603. 
  15. ^ Liu, Tao; Li, Yangjia; Wang, Shuling; Ying, Mingsheng; Zhan, Naijun (2016-01-15). "A Theorem Prover for Quantum Hoare Logic and Its Applications". arXiv:1601.03835Freely accessible [cs.LO]. 
  16. ^ "Software for the Q language". archive.org. 2001-11-23. Retrieved 2017-07-20. 
  17. ^ Scott Pakin, "A Quantum Macro Assembler", Proceedings of the 20th Annual IEEE High Performance Extreme Computing Conference 2016
  18. ^ Peter Selinger, "Towards a quantum programming language", Mathematical Structures in Computer Science 14(4):527-586, 2004.
  19. ^ a b Jonathan Grattage: QML Research (website)
  20. ^ T. Altenkirch, V. Belavkin, J. Grattage, A. Green, A. Sabry, J. K. Vizzotto, QML: A Functional Quantum Programming Language (website)
  21. ^ Andre van Tonder, "A Lambda Calculus for Quantum Computation", SIAM J. Comput., 33(5), 1109–1135. (27 pages), 2004. Also available from arXiv:quant-ph/0307150
  22. ^ Peter Selinger and Benoît Valiron, "A lambda calculus for quantum computation with classical control", Mathematical Structures in Computer Science 16(3):527-552, 2006.
  23. ^ Pablo Arrighi, Gilles Dowek, "Linear-algebraic lambda-calculus: higher-order, encodings and confluence", 2006
  24. ^ Jonathan Grattage, QML: A Functional Quantum Programming Language (compiler), 2005–2008
  25. ^ "The Language Integrated Quantum Operations Simulator". github.io. Retrieved 2017-07-20. 
  26. ^ Quantum Architectures and Computation Group (QuArC), https://www.microsoft.com/en-us/research/group/quantum-architectures-and-computation-group-quarc/, 2011
  27. ^ "StationQ". microsoft.com. Retrieved 2017-07-20. 
  28. ^ "Language-Integrated Quantum Operations: LIQUi|>". 2016. 
  29. ^ Philip Maymin, "Extending the Lambda Calculus to Express Randomized and Quantumized Algorithms", 1996
  30. ^ André van Tonder. "A lambda calculus for quantum computation (website)". 
  31. ^ Alexander S. Green; Peter LeFanu Lumsdaine; Neil J. Ross; Peter Selinger; Benoît Valiron. "The Quipper Language (website)". 
  32. ^ Alexander S. Green; Peter LeFanu Lumsdaine; Neil J. Ross; Peter Selinger; Benoît Valiron (2013). "An Introduction to Quantum Programming in Quipper". Lecture Notes in Computer Science. Lecture Notes in Computer Science. 7948: 110–124. arXiv:1304.5485Freely accessible. doi:10.1007/978-3-642-38986-3_10. ISBN 978-3-642-38985-6. 

External links[edit]

Further reading[edit]

Mingsheng, Ying. Foundations of quantum programming. Cambridge, MA. ISBN 9780128025468. OCLC 945735387.