Boomerang attack: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Yobot
m WP:CHECKWIKI error fixes + general fixes using AWB (8024)
 
en>BattyBot
m →‎References: fixed CS1 errors: dates using AWB (9803)
Line 1: Line 1:
'''Quantum programming''' is a set of computer [[programming language]]s that allow the expression of [[quantum algorithm]]s using high-level constructs. The point of quantum languages is not so much to provide a tool for programmers, but to provide tools for researchers to understand better how quantum computation works and how to formally reason about quantum algorithms.


One can single out two main groups of quantum programming languages: imperative quantum programming languages and functional quantum programming languages.


I woke up yesterday  and realised - Now I've been solitary for some time and following much intimidation from buddies I today find myself signed up for online dating. They guaranteed me  [http://www.netpaw.org luke bryan tour schedule 2014] that there are lots of sweet, standard and interesting individuals to fulfill, so here goes the toss!<br>My fam and friends are wonderful and hanging out together at tavern gigabytes or meals is constantly essential. I haven't ever been into dance clubs as I discover that you could never get a nice dialog with all the noise. Additionally, I have 2 definitely cheeky and very [http://www.answers.com/topic/adorable+dogs adorable dogs] who are almost always ready to meet up fresh people.<br>I attempt to maintain as toned as potential being at the   [http://lukebryantickets.hamedanshahr.com luke bryan tour dates] gymnasium many times a week. [http://lukebryantickets.sgs-suparco.org luke brian concerts] love my athletics and try to perform or view because many a potential. Being winter I shall [http://www.google.co.uk/search?hl=en&gl=us&tbm=nws&q=regularly&gs_l=news regularly] at Hawthorn fits. Note: In case that you considered buying an athletics I really do not mind, I have experienced the carnage of wrestling suits at stocktake sales.<br><br>Here is  [http://okkyunglee.com concerts for luke bryan] my web site [http://lukebryantickets.asiapak.net garth brooks tour dates]
The most prominent representatives of the first group are QCL and LanQ.<ref>{{cite web |author=Hynek Mlnařík |title=LanQ – a quantum imperative programming language |url=http://lanq.sourceforge.net/}}</ref>
 
Efforts are underway to develop [[functional programming languages]] for [[quantum computing]]. Examples include Selinger's QPL,<ref name="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.</ref> and the [[Haskell (programming language)|Haskell-like]] language QML by Altenkirch and Grattage.<ref name="qml1">[http://www.cs.nott.ac.uk/~jjg/qml.html Jonathan Grattage: QML Research<!-- Bot generated title -->] (website)</ref><ref name="qml2">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] (website)</ref> Higher-order quantum programming languages, based on [[lambda calculus]], have been proposed by van Tonder,<ref>Andre van Tonder, [http://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 [http://arxiv.org/abs/quant-ph/0307150 arXiv:quant-ph/0307150]</ref> Selinger and Valiron <ref>Peter 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.</ref> and by Arrighi and Dowek.<ref>Pablo Arrighi, Gilles Dowek, [http://www.arxiv.org/abs/quant-ph/0612199 "Linear-algebraic lambda-calculus: higher-order, encodings and confluence"], 2006</ref>
 
Simon Gay's [http://www.dcs.gla.ac.uk/~simon/quantum Quantum Programming Languages Survey] provides information on the state of research and a comprehensive bibliography of resources about quantum programming as of 2007.
 
== Imperative quantum programming languages ==
 
=== Quantum pseudocode ===
Quantum pseudocode proposed by E. Knill is the first formalised language for description of [[quantum algorithm]]s was introduced and, moreover, it was tightly connected with a model of quantum machine called [[Quantum Random Access Machine]] (QRAM).
 
=== Quantum computing language ===
[http://tph.tuwien.ac.at/~oemer/qcl.html QCL] (Quantum Computation Language) is one of the first implemented quantum [[programming languages]]. Its [[syntax]] resembles the syntax of the [[C programming language]] and its classical [[data type]]s are similar to primitive data types in C. One can combine classical code and quantum code in the same program.
 
The basic built-in quantum data type in QCL is the qureg (quantum register). It can be interpreted as an array of qubits (quantum bits).
 
    qureg x1[2]; // 2-qubit quantum register x1
    qureg x2[2]; // 2-qubit quantum register x2
    H(x1); // Hadamard operation on x1
    H(x2[1]); // Hadamard operation on the first qubit of the register x2
 
Since the qcl interpreter uses qlib simulation library, it is possible to observe the internal state of the quantum machine during execution of the quantum program.
 
    qcl> dump
    : STATE: 4 / 32 qubits allocated, 28 / 32 qubits free
    0.35355 |0> + 0.35355 |1> + 0.35355 |2> + 0.35355 |3>
    + 0.35355 |8> + 0.35355 |9> + 0.35355 |10> + 0.35355 |11>
 
Note that the dump operation is different from measurement, since it does not influence the state of the quantum machine and can be realised only using a simulator.
 
The QCL standard library provides standard quantum operators used in quantum algorithms such as:
 
* controlled-not with many target qubits,
* Hadamard operation on many qubits,
* parse and controlled phase.
 
But the most important feature of QCL is the support for user-defined operators and functions. Like in modern programming languages, it is possible to define new operations which can be used to manipulate quantum data. For example:
 
    operator diffuse (qureg q) {
      H(q);                // Hadamard Transform
      Not(q);              // Invert q
      CPhase(pi, q);        // Rotate if q=1111..
      !Not(q);              // undo inversion
      !H(q);                // undo Hadamard Transform
    }
 
defines inverse about the mean operator used in [[Grover's algorithm]]. This allows one to define algorithms on a higher level of abstraction and extend the library of functions available for programmers.
 
====Syntax====
*Data types
**Quantum - qureg, quvoid, quconst, quscratch, qucond
**Classical - int, real, complex, boolean, string, vector, matrix, tensor
*Function types
**qufunct - Pseudo-classic operators. Can only change the permutation of basic states.
**operator - General unitary operators. Can change the amplitude.
**procedure - Can call measure, print, and dump inside this function. This function is non-invertible.
*Built-in functions
**Quantum
***qufunct - Fanout, Swap, Perm2, Perm4, Perm8, Not, CNot
***operator - Matrix2x2, Matrix4x4, Matrix8x8, Rot, Mix, H, CPhase, SqrtNot, X, Y, Z, S, T
***procedure - measure, dump, reset
**Classical
***Arithmetic - sin, cos, tan, log, sqrt, ...
***Complex - Re, Im, conj
 
=== Q language ===
[http://sra.itc.it/people/serafini/qlang/ 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 environment can be
simulated using parameters of the simulator.
 
=== 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 programmes specification.
 
==  Functional quantum programming languages ==
During the last few years many quantum programming languages based on the [[functional programming]] paradigm were proposed. Functional programming languages are well-suited for reasoning about programs.
 
=== 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
[[superoperator]]s.
 
=== QML ===
 
[http://sneezy.cs.nott.ac.uk/QML/ QML] is a [[Haskell (programming language)|Haskell]]-like quantum programming language by Altenkirch and Grattage.<ref name="qml1"/> 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 <math>|\phi\rangle</math> to <math>|\phi\rangle\otimes|\phi\rangle</math>, and is not to be confused with the impossible operation of [[no cloning theorem|cloning]]; the authors claim it is akin to how sharing is modelled 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 circuit]]s, while a [[denotational semantics]] is presented in terms of [[superoperator]]s, and these are shown to agree. Both the operational and denotational semantics have been implemented (classically) in Haskell.<ref>Jonathan Grattage, [http://sneezy.cs.nott.ac.uk/qml/compiler QML: A Functional Quantum Programming Language (compiler)], 2005–2008</ref>
 
=== Quantum lambda calculi ===
Quantum lambda calculi are extensions of the [[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.<ref>Philip Maymin, [http://arxiv.org/abs/quant-ph/9612052 "Extending the Lambda Calculus to Express Randomized and Quantumized Algorithms"], 1996</ref>
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)|Scheme]] programming language.<ref>{{cite web |author=André van Tonder |title=A lambda calculus for quantum computation (website) |url=http://www.het.brown.edu/people/andre/qlambda}}</ref>
 
In 2004, Selinger and Valiron defined a [[strongly typed]] lambda calculus for quantum computation with a type system based on [[linear logic]].
 
=== Quipper ===
 
Quipper has been published in 2013.<ref>{{cite web |author=Alexander S. Green, Peter LeFanu Lumsdaine, Neil J. Ross, Peter Selinger, Benoît Valiron |title=The Quipper Language (website) |url=http://www.mathstat.dal.ca/~selinger/quipper/}}</ref> It is implemented as an embedded language, using [[Haskell (programming language)|Haskell]] as the host language.<ref>{{cite web |author=Alexander S. Green, Peter LeFanu Lumsdaine, Neil J. Ross, Peter Selinger, Benoît Valiron |title=An Introduction to Quantum Programming in Quipper |url=http://arxiv.org/abs/1304.5485 |year=2013}}</ref> For this reason, quantum programms written in Quipper are written in [[Haskell (programming language)|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 ==
<references />
 
== External links ==
* [http://www.comlab.ox.ac.uk/people/bob.coecke/DCM_QPL_08.html 5th International Workshop on Quantum Physics and Logic]
* [http://www.mathstat.dal.ca/~selinger/qpl2006/ 4th International Workshop on Quantum Programming Languages]
* [http://www.mathstat.dal.ca/~selinger/qpl2005/ 3rd International Workshop on Quantum Programming Languages]
* [http://www.mathstat.dal.ca/~selinger/qpl2004/ 2nd International Workshop on Quantum Programming Languages]
* [http://www.dcs.gla.ac.uk/~simon/quantum/ Bibliography on Quantum Programming Languages] (updated in May 2007)
* [http://www.quantiki.org/wiki/index.php/Quantum_Programming_Language Quantum programming language] in [http://www.quantiki.org/ Quantiki]
 
{{Quantum computing}}
 
[[Category:Programming language classification]]
[[Category:Quantum information science]]
[[Category:Programming paradigms]]

Revision as of 17:59, 21 December 2013

Quantum programming is a set of computer programming languages that allow the expression of quantum algorithms using high-level constructs. The point of quantum languages is not so much to provide a tool for programmers, but to provide tools for researchers to understand better how quantum computation works and how to formally reason about quantum algorithms.

One can single out two main groups of quantum programming languages: imperative quantum programming languages and functional quantum programming languages.

The most prominent representatives of the first group are QCL and LanQ.[1]

Efforts are underway to develop functional programming languages for quantum computing. Examples include Selinger's QPL,[2] and the Haskell-like language QML by Altenkirch and Grattage.[3][4] Higher-order quantum programming languages, based on lambda calculus, have been proposed by van Tonder,[5] Selinger and Valiron [6] and by Arrighi and Dowek.[7]

Simon Gay's Quantum Programming Languages Survey provides information on the state of research and a comprehensive bibliography of resources about quantum programming as of 2007.

Imperative quantum programming languages

Quantum pseudocode

Quantum pseudocode proposed by E. Knill is the first formalised language for description of quantum algorithms was introduced and, moreover, it was tightly connected with a model of quantum machine called Quantum Random Access Machine (QRAM).

Quantum computing language

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

The basic built-in quantum data type in QCL is the qureg (quantum register). It can be interpreted as an array of qubits (quantum bits).

   qureg x1[2]; // 2-qubit quantum register x1
   qureg x2[2]; // 2-qubit quantum register x2
   H(x1); // Hadamard operation on x1
   H(x2[1]); // Hadamard operation on the first qubit of the register x2

Since the qcl interpreter uses qlib simulation library, it is possible to observe the internal state of the quantum machine during execution of the quantum program.

   qcl> dump
   : STATE: 4 / 32 qubits allocated, 28 / 32 qubits free
   0.35355 |0> + 0.35355 |1> + 0.35355 |2> + 0.35355 |3>
   + 0.35355 |8> + 0.35355 |9> + 0.35355 |10> + 0.35355 |11>

Note that the dump operation is different from measurement, since it does not influence the state of the quantum machine and can be realised only using a simulator.

The QCL standard library provides standard quantum operators used in quantum algorithms such as:

  • controlled-not with many target qubits,
  • Hadamard operation on many qubits,
  • parse and controlled phase.

But the most important feature of QCL is the support for user-defined operators and functions. Like in modern programming languages, it is possible to define new operations which can be used to manipulate quantum data. For example:

   operator diffuse (qureg q) {
     H(q);                 // Hadamard Transform
     Not(q);               // Invert q
     CPhase(pi, q);        // Rotate if q=1111..
     !Not(q);              // undo inversion
     !H(q);                // undo Hadamard Transform
   }

defines inverse about the mean operator used in Grover's algorithm. This allows one to define algorithms on a higher level of abstraction and extend the library of functions available for programmers.

Syntax

  • Data types
    • Quantum - qureg, quvoid, quconst, quscratch, qucond
    • Classical - int, real, complex, boolean, string, vector, matrix, tensor
  • Function types
    • qufunct - Pseudo-classic operators. Can only change the permutation of basic states.
    • operator - General unitary operators. Can change the amplitude.
    • procedure - Can call measure, print, and dump inside this function. This function is non-invertible.
  • Built-in functions
    • Quantum
      • qufunct - Fanout, Swap, Perm2, Perm4, Perm8, Not, CNot
      • operator - Matrix2x2, Matrix4x4, Matrix8x8, Rot, Mix, H, CPhase, SqrtNot, X, Y, Z, S, T
      • procedure - measure, dump, reset
    • Classical
      • Arithmetic - sin, cos, tan, log, sqrt, ...
      • Complex - Re, Im, conj

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 environment can be simulated using parameters of the simulator.

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 programmes specification.

Functional quantum programming languages

During the last few years many quantum programming languages based on the functional programming paradigm were proposed. Functional programming languages are well-suited for reasoning about programs.

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.[3] 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 modelled 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.[8]

Quantum lambda calculi

Quantum lambda calculi are extensions of the 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.[9] 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.[10]

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

Quipper

Quipper has been published in 2013.[11] It is implemented as an embedded language, using Haskell as the host language.[12] For this reason, quantum programms 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

  1. Template:Cite web
  2. Peter Selinger, "Towards a quantum programming language", Mathematical Structures in Computer Science 14(4):527-586, 2004.
  3. 3.0 3.1 Jonathan Grattage: QML Research (website)
  4. T. Altenkirch, V. Belavkin, J. Grattage, A. Green, A. Sabry, J. K. Vizzotto, QML: A Functional Quantum Programming Language (website)
  5. 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
  6. 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.
  7. Pablo Arrighi, Gilles Dowek, "Linear-algebraic lambda-calculus: higher-order, encodings and confluence", 2006
  8. Jonathan Grattage, QML: A Functional Quantum Programming Language (compiler), 2005–2008
  9. Philip Maymin, "Extending the Lambda Calculus to Express Randomized and Quantumized Algorithms", 1996
  10. Template:Cite web
  11. Template:Cite web
  12. Template:Cite web

External links

Template:Quantum computing