<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>A History and Reversibility for Quantum Programming Language QML</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Nely Plata Cesar</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>J. Raymundo Marcial Romero</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>J. Antonio Hernandez Serv n</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>History Re-</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Facultad de Ingenier a Universidad Autonoma del Estado de Mexico</institution>
        </aff>
      </contrib-group>
      <volume>1</volume>
      <fpage>25</fpage>
      <lpage>39</lpage>
      <abstract>
        <p>We developed an operational model that incorporates a history track for the quantum programming language QML, considering classical and quantum data, and omitting measurements. With the history, the reversibility can be explicitly and naturally applied from the proposed rules. The language is worked rst with classical data and extrapolated to quantum data.</p>
      </abstract>
      <kwd-group>
        <kwd>Functional quantum programming QML versibility</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Introduction
There are several quantum programming languages, based on the imperative,
functional or other paradigms. Only a few are described below: QML [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], nQML
[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] and Quantum Lambda Calculus ( q) [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] with operational semantics and
implicit reversibility, and QML and nQML have denotational semantic and
implementation, but only q have a history track and measurements.
      </p>
      <p>
        Some languages based on imperative paradigm are: QCL [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], LanQ [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] and
qGCL [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], all three with measurements; QCL and LanQ have an implementation
and implicit reversibility, but only LanQ and qGCL have operational semantic.
And based on other paradigms are pQCL [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], QPAlg [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], CQP [
        <xref ref-type="bibr" rid="ref10 ref9">9,10</xref>
        ], etc [11{13].
      </p>
      <p>
        We will focus on QML developed by Grattage y Altenkirch, is a rst order
language and has nite data-types, the semantics of QML assigns to every
welltyped program a quantum circuit, the computations have the property of being
reversible and irreversible. Also implements the notion of quantum control if,
which would lead to implicit measurements and quantum collapse [
        <xref ref-type="bibr" rid="ref1 ref7">1, 7</xref>
        ].
      </p>
      <p>
        Several authors have considered this language, is the case of D az-Caro,
Arrighi, Gadella y Grattage who give an idea to implement a history track and
quantum measurements [14{16]. Altenkirch, Grattage, Vizzotto and Sabry not
de ne operational semantics in terms of circuits and develop a sound and
complete equational theory omitting measurements, they work QML subdividing
the classical and quantum part of the language [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ]. Also Lampis, Ginis,
Papakyriakou and Papaspyrou de ne nQML with quantum data and control, an
interpreter written in Haskell and being a more intuitive language [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
      <p>Quantum languages must consider the implicit property of reversibility, if the
operations are de ned as unit matrix, and therefore, if the previous immediate
matrix is applied to actual state, it can be returned to the previous step, and
successively.</p>
      <p>
        The contribution of this article is incorporate a history track to the
operational model, the track will store the operations performed in a program. With
this, reversibility can be explicitly executed. The above is added to QML
language de ned by Altenkirch, Grattage, Vizzotto and Sabry [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ]. Our research
guide is proposed by D az-Caro, Arrigui, Gadella and Grattage, who work a
similar area but in the quantum lambda calculus language [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. The resulting
operational model considers classical and quantum data (superpositions), preserving
orthogonality in programs that consider if. The rules to apply reversibility based
on the history track are also de ned.
2
2.1
      </p>
      <p>Preliminaries</p>
    </sec>
    <sec id="sec-2">
      <title>Quantum computing</title>
      <p>
        There are four principles or postulates that de ne the behavior of quantum
computing. The pure states are unitary vectors, which store in memory the
information used. Evolution, this indicates how change from one state to another,
for which unit matrices are applied, they have implicit instructions that the
computer will carry out and that will be applied to the state to evolve. Measurement
or observation focuses on the existence of an observer who, upon seeing the state
of the system, will determine with what probability a result can happen,
implying a collapse of the system. Composite systems, will be in charge of de ning
states conformed by states of di erent systems and how they interact among
them [
        <xref ref-type="bibr" rid="ref18 ref19">18, 19</xref>
        ].
2.2
      </p>
      <p>
        Quantum programming language QML
QML is a functional quantum language introduced by Grattage and Altenkirch,
they apply quantum properties and develop a denotational and operational
semantics [
        <xref ref-type="bibr" rid="ref1 ref20">1, 20</xref>
        ]. Subsequently, they research and develop a sound and complete
equational theory, omitting recursive types and measurements [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ]. This latest
research will be retaken, which describes its syntax.
      </p>
      <p>(Variables) x; y; : : : 2 V ars (Terms) t; u ::= x j () j (t; u)
(Prob. amplitudes) ; ; : : : 2 C j let p = t in uj f alse
(Patterns) p; q ::= x j (x; y) j truej 0 j t j t + u
j if t then u else u0</p>
      <p>From the syntax you can form conventional programs such as tuples, let, if,
among others, and in turn append terms with a probability amplitude , that is,
have a probability value that they happen, and also de ne superposition t + u,
it means than a term can be in t and u at the same time.</p>
      <p>The types are given by the grammar: = Q1jQ2j , where Q1 is the type
(), which carry no information and Q2 corresponds to qubits (0 and 1). The
types are nite and non-recursive, and the only types that can be represented
are those in the collection of qubits.</p>
      <p>Typing contexts ( ; ) are given by: ; x : = j ; x : , where stands
for the empty context. We context correspond to functions from a nite set of
variables to types. For this case, we assume that every variable appears at most
once. To maps pairs of contexts to contexts, the operator is incorporated, with
the following operation:
; x : ; x : = ( ); x :
; x : = ( ); x : si x 2= dom</p>
      <p>=</p>
      <p>Interpret a judgement ` t : as a function is J ` t : K 2 J K ! J K,
where, given a typing contexts, it returns a type of the collection of qubits.</p>
      <p>To de ne well-formed programs ` t : , the rules can be observed in Table
1. For example: ` if c then t else u : , requires that ` c : Q2 and
` t; u : , that is, c has a value of qubit, and t and u are the same type.
` t :</p>
      <p>
        ; x : ` t :
` let x = t in u :
let
The quantum computation implicitly has the property of reversibility, for this,
several authors have made contributions in classical and quantum computation
[21{24]. For example Van Tonder proposes in quantum lambda calculus a history
stack that stores the executed operations in a program [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. For reversibility, we
propose that is enough su cient to execute operations in reverse order and return
to initial value.
      </p>
      <p>Our proposal will be described below, which is based on modifying the
operational model, to which are added inverse functions that allow storing the
operation executed in a certain step; also the functions used in the model are
modi ed and appended.
3</p>
      <p>Quantum Data and Control
In this section the history stack is added to operational model, as well as the
functions and rules to execute a program and reversibility. The base model is
located at Appendix 1. Our operational model stores the inverse operations
executed during a certain derivation. The rules are observed in Table 2.</p>
      <p>J ` () : Q1 KQ = (const 0) 1; const 0
J ` f alse : Q2 KQ = (const 0) 1; const 0
J ` true : Q2 KQ = (const 1) 1; const 1
Jx :
` x :</p>
      <p>KQ = id+1 ; id+
J</p>
      <p>J</p>
      <p>J</p>
      <p>` let x = t in u :
J</p>
      <p>
        Rules like J ` f alse : Q2 KQ = (const 0) 1; const 0, that is, if you have a
f alse term, then the function const 0 is applied, and its inverse is stored. This
is similar for all statements.
Considering the auxiliary functions (Appendix 2) de ned in the operational
model (with quantum operations), the authors extend the functions using a
Kleisli Triple, where each derivation returns a complex vector [
        <xref ref-type="bibr" rid="ref17 ref25 ref26">17, 25, 26</xref>
        ].
      </p>
      <p>We develop the inverse functions (: 1) and the r function applied to all, such
that later allow the reversibility. The r function is responsible for storing the
argument received respectively.</p>
      <p>
        In quantum environment the states are complex unit vectors and can be
in superposition, to achieve this, Kleisli Triple are used [
        <xref ref-type="bibr" rid="ref17 ref25">17, 25</xref>
        ]. With this, we
interpret judgements ` t : as a function Q J KQ = J K !
J K ! J K ,Qwihsedreenoted as V
CRermepemrebseenrtsthcaotmpleisx avetcytpores, odveerntehde fbroamse set=J QK;1jJQ2Kj , interpretedJ asK:.
JQ2 K = f0; 1g (associated with qubits) and JQ1 K (no information).
De nition 1 (Triple Kleisli). A Triple Kleisli on a category C, is de ned by
tuple (V; return; ), where:
{ V : C ! C
{ return : S ! V S, for S 2 C
{ f : V S ! V T , for f : S ! V T
      </p>
      <p>To work with complex vectors, it is required modify the functions of the
operational model by implementing Kleisli Triple. Every function of type S ! T
turns to a function of type S ! V T using the return function; this must be
done for all the classical auxiliary functions (Appendix 2). For example, consider
the function const a : JQ1 K ! S, then, adjusting Kleisli Triple, you get: return
const a : JQ1 K ! V S. We use const a = return const a.</p>
      <p>Now, we de ne an r function which allows to carry the input arguments and
output for any auxiliary function f .</p>
      <p>Let f be any auxiliary function where classically f : J K ! J K, such that
f (a) = b. Then, the function r has type J K ! J KQ, e.g. r : J K ! J K ! C
(by de nition of J KQ), de ned as r(a f (a)) = , 2 C, where (r a f (a)) = 1:0
if a = f (a) and 0.0 otherwise. So f a = r(a f (a)). Our function r has a
call-byname evaluation mechanism, so its argument will not be evaluated until needed.</p>
      <p>The following functions are part of our contribution. For each auxiliary
functions f we consider r to de ne the inverse f 1, the lift f (associated with a
Kleisli Triple) and its inverse f 1. Consider S 2 JQ2 K, the modi ed functions
are:</p>
      <p>id+ 1(r a0 b; r a0 a) =
{ id : S ! (S ! S ! C), this function returns the argument it receives, and
is de ned as: id(a) = (r a a).
id : (S ! V S) ! (S ! S ! C) de ned as: id (r a0 a) = (r a0 a)
id 1 : (S ! V S) ! S de ned as: id 1(r a0 a) = a
id 1 : (S ! V S) ! (S ! S ! C) de ned as: id 1(r a0 a) = (r a0 a)
{ id+ : S ! (S ! JQ1 K ! C), concatenates the received argument with the
value 0 and is de ned as: id+(a) = (r a 0; r 0 a)
id+ : (S ! V S) ! (S ! JQ1 K ! C) (S ! S ! C) de ned as:
id+ (r a0 a) = (r a 0; r 0 a), and the other options are de ned as:
(a; if b=0</p>
      <p>b; if b=1
id+ 1(r a0 0; r a0 a) = (r a0 a)
{ id+ : (JQ1 K S) ! (S ! S ! C) de ned as: id+(0; a) = (r a a)
id+ : (S ! V JQ1 K) (S ! V S) ! (S ! S ! C) de ned with the
conditions: id+(r a0 0; r a0 a) = (r a0 a) and id+(r a00 1; r a0 a) = (r a0 1)
id+1(r a0 a) = (0; a)
id+ 1(r a0 a) = (r a0 a; r 0 a)
const 0 1(r a0 a) = 0, and const 1 1(r a0 a) =
const 0 1(r a0 a) = (r a 0), and const 1 1(r a0 a) =
(1; if a=0
0; if a=1
(r a 1; if a=0
r a 0; if a=1
{ const a : JQ1 K ! (JQ1 K ! S ! C) is de ned as: const a(0) = (r 0 a)
const a : (S ! V S) ! (JQ1 K ! S ! C) de ned as: const a (r a0 a00) =
(r 0 a), and its inverse as:
{</p>
      <p>: S ! ((S ! S ! C) (S ! S ! C)) double the argument received,
de ned as: (a) = (r a a; r a a)</p>
      <p>: (S ! V S) ! ((S ! S ! C) (S ! S ! C)), de ned as: (r a0 a) =
(r a0 a; r a0 a), and
1(r a0 a; r a0 a) = a
1(r a00 a; r a0 a) = (r a0 a)
{ swap : (S T ) ! (S ! T ! C) (T ! S ! C), function that exchanges
the arguments, de ned as: swap(a; b) = (r a b; r b a)
swap : ((S ! V S) (S ! V T )) ! ((S ! T ! C)) (T ! S ! C))
de ned as: swap (r a0a; r b0 b) = (r a b; r b a)
swap 1(r a b; r b a) = (a; b)
swap 1(r a0 b; r b0 a) = (r b a; r a b)
{ f g; for any two functions:
f : S1 ! (S1 ! V T1); and f : (S1 ! V S10) ! (S10 ! T1 ! C)
g : S2 ! (S2 ! V T2); and g : (S2 ! V S20) ! (S20 ! T2 ! C), we have:
f g : (S1 S2) ! (S1 ! T1 ! C) (S2 ! T2 ! C) is de ned as:
f g (a; b) = (f a; g b)
f g : (S1 ! V S10) (S2 ! V S20) ! (S10 ! T1 ! C) (S20 ! T2 ! C),
de ned as: f g (r a0 a; r b0 b) = (f (r a0 a); g (r b0 b))
(f 1 g 1) (r a0 a; r b0 b) = (f 1 (r a0 a); g 1 (r b0 b))
(f 1 g 1) (r a0 a; r b0 b) = (f 1 (r a0 a); g 1 (r b0 b))
{</p>
      <p>; , separate contexts depending on the program formed, the conditions
are below.</p>
      <p>; : J K ! (S ! J K ! C) (S ! J K ! C) de ned as: ; (a
a0) = ((r a a); (r a0 a0)), if one of the contexts is empty , then it applies:
; (a) = (r a a). The function with is de ned as:
; ((r a a0) (r b b0)) = ((r a a0); (r b b0)) or ; (r a a0) = (r a a0), the
inverse functions are obtained similarly to the previous cases.</p>
      <p>The conditions are the following:</p>
      <p>&gt;8 0; 0 if = 0; x : y = 0; x :
( ; ) = &lt; 0; id if = 0; x : y x 2= dom( )</p>
      <p>&gt;:id+ if =
{ (f jg) : (JQ2 K S) ! (S ! T ! C), is associated with if conditional,
de ned as: (f jg) (1; a) = (f a) and (f jg) (0; a) = (g a).
(f 1jg 1) : (S ! V T ) ! ((S ! S ! C) (S ! S ! C)), de ned as:
Consider the following: (f g) = f g and (f g) 1 = f 1 g 1.</p>
      <p>With the previous rules and functions, certain programs can be derived,
however, we still need de ne the modi ed rules for terms with probability amplitudes
and superpositions. The new rules to form well-typed judgements and for
deriving terms (quantum and classic) are in Table 3 and Table 4, respectively.
Based on these de nitions, we propose the modi cation that also allows storing
operations in the history stack.
prob
sup
` t; u :
`</p>
      <p>` t :
Three rules are attached that consider: the vector zero, a term with a certain
probability amplitude and superposition.</p>
      <p>If we have quantum data and control, consider the programs that contain
if or t + u, its terms must be orthogonal to each other. This is denoted in the
derivations with the symbol ` , the orthogonality with ? and internal product
with h j i. To satisfy orthogonality we can see Table 5, and for a quantum terms
well formed see Table 3.</p>
      <p>Having the above, now we can apply the operational model with a program,
for example: J ` if 1 then ( 1) true + f alse else true + f alse : Q2 KQ =
(g jh ) (f id 1; id ) (( ; ) 1; ; ):
At this point, the functions are mixed with their inverses, which must be
separated, how to achieve this we will de ne immediately.</p>
      <p>J `</p>
      <p>t : KQ = ( ) f
J ` t + u : KQ = p12
f + g
where 8a 2 J K:v a = 0:0
where 8b 2 J K
f = J ` t : KQ
where 8a 2 J K
f = J ` t : K
g = J ` u : K</p>
      <p>Q
Q
To apply reversibility, several points are important: A concept called a history
stack and auxiliary functions de ned in our proposal of the operational model.
Considering that each derivation is given from functions, and these are stored in
a stack, then, the inverse functions will result in reversibility, allowing returns to
the initial argument of the program. Formally, the terms and the history stack
make a computational state, that is:
De nition 2 (Computational state). The computational state is a sequence
of the form:
htn ;
tn
where htn ; ; ht2 ; ht1 , is called the history track and t1
the computational register.
t2;
tn,
Regarding hti ; ti, the part hti represents and stores the inverse operation that
executes ti.</p>
      <p>De nition 3. H, denotes the (possibly empty) history track.</p>
      <p>To arrive at the computational state, the terms must be factored, considering
di erent cases.
4.1</p>
    </sec>
    <sec id="sec-3">
      <title>Factorization</title>
      <p>Let the expression ht1 ; t1 ht2 ; t2 htn ; tn, where the semicolon (;)
denotes string concatenation. The hti expressions are histories corresponding to
each term ti, respectively. The terms ti are associated with functions of
operational model. therefore, they will receive arguments.</p>
      <p>The expressions (hti ; ti) can have di erent forms, for wich, to factor consider
the following cases:</p>
      <p>ht ; tjht0 ; t0 (a; b) =
i) H; ht ; t(a) factored as: H; ht ; t(a)
ii) H; ht1 ; t1 ht2 ; t2 (a; b) is factored as: H; ht1 ht2 ; t1 ; t2 (a; b)
iii) H; ht1 ; t1 + ht2 ; t2 (a) factored as: H; ht1 + ht2 ; t1(a) + t2(a)
iv) H; ht1 ; t1 (a) factored as: H; ht1 ; t1(a) , where 2 C
v) If t; t0 are superpositions or tuples then
(H; ht ; t(b)</p>
      <p>H; ht0 ; t0(b)
if a = 1
if a = 0
else
ht ; tjht0 ; t0 (a; b) = H; (ht jht0 ); (tjt0)(a; b) , and the conditional
de nition is applied.</p>
      <p>The factorization is started from right to left, namely:
ht1 ; t1
ht2 ; t2
htn ; tn = htn ; ht1 ; t1
ht2 ; t2</p>
      <p>tn
= htn ;
= htn ;
|</p>
      <p>If there exists a conditional (tjt0), where t and t0, are superpositions; will
be incorporated into the history track once the conditional has been evaluated.
With the above we have the computational state, and we continue with the rules
developed for the reversibility.
The reversibility can be executed starting from the fact that if we have a state
and execute all the functions of the computational register we will obtain a nal
value q, i.e., htn ; ; ht2 ; ht1 ; t1 t2 tn (a) = = htn ; ; ht2 ;
ht1 ; q. Let a computational state (result of derivations) with the form:
ht1 ;</p>
      <p>; ht2 ; ht1 ; q;
where q it's an irreducible term (for the operational model). Given hti a history,
apply as argument q to the previous immediate history, replacing by the symbol
, and applying the respective function, for example: hti ; a = hti (a).
Reversibility can be applied to the value q, from the history stack (ht1 ; ht2 ; ; htn ),
considering the following cases:
i) hti ; q = hti (q)
ii) (hti htj ) (q1; q2) = (hti q1; htj q2)
iii) (hti + htj ) (q1 + q2) = (hti q1; htj q2), where
iv) ht1 ; q = ht1 (q)
where ; 2 C are discarded.</p>
      <p>With the previous proposals, we show an example with classic and quantum
data, this is the Hadamard gate.
5</p>
      <p>Example: Hadamard gate
had 1 = if 1 then ( 1) true + f alse else true + f alse
J ` had 1 : Q2 KQ = (g jh ) (f id 1; id ) (( ; ) 1; ; )
=
z1
p2 (( 1) const 1
g
}|
1; const 1 + const 0</p>
      <p>{
1; const 0 ) j
If evaluate r functions we get: p12 ( 1) (0:0) + (1:0) . Explicitly H is:
(id+ 1); (const 1 1 id 1); (const 1 1 + const 0 1);</p>
      <p>Applying reversibility we have:
(id+ 1); (const 1
1
id
1); (const 1
1 + const 0
1)(r 0 1 + r 0 0)
= (id+ 1); (const1
= (id+ 1); (const 1
= (id+ 1); (const 1
= (id+ 1); (const 1
1
1
1
id
id
id
1); (const 1
1); (const 1
1)(r 1 0; r 0 0)
1 + const 0</p>
      <p>1)(r 0 1 + r 0 0)
1(r 0 1); const 0
1(r 0 0))
1(r 1 0); id</p>
      <p>1(r 0 0)) = id+ 1(r 0 1; r 0 0) = 1</p>
      <p>Through this example, is observed how the reversibility is executed and that
it is successfully achieved, that is, return to the initial argument, in this case, to
value 1. We proceed with the conclusions and future work.
6</p>
      <p>Conclusions and Further Work
The construction to add the history track was partially worked, the classical
elements of the syntax and its respective operational model were considered rst,
immediately, the inverse functions were de ned and added to the model, where
the inverse operations are stored in the history stack. This is extrapolated to the
complete syntax incorporating terms with probability amplitude and
superpositions, allowing a model also with inverse functions.</p>
      <p>If you have a value (resulting from a program) and this is applied to the
respective history stack, then the inverse functions are applied, allowing you to
return to the initial value of the program, this results in reversibility.</p>
      <p>As a possible future work, a simple implementation of programs can be made
than execute reversibility in a more direct and natural way.</p>
      <sec id="sec-3-1">
        <title>Appendix 1</title>
        <p>J ` () : Q1 K = const 0
J ` false : Q2 K = const 0
J ` true : Q2 K = const 1</p>
        <p>Jx : ` x : K = id
` let x = t in u : K = g (f id) ;
where:
J</p>
      </sec>
      <sec id="sec-3-2">
        <title>Appendix 2. Auxiliary functions</title>
        <p>
          Let a; a0; b 2 S, S = f0; 1g (Source: [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ], p. 30).
        </p>
        <p>id : S ! V S, de ned by: id(a) = a
id+ : S ! JQ1 K S, de ned by: id+(a) = (0; a)
id+ : JQ1 K S ! S, de ned by: id+(0; a) = a
const a : JQ1 K ! S, de ned by: const a(0) = a</p>
        <p>: S ! (S; S), de ned by: (a) = (a; a)
swap : S T ! T S, de ned by: swap(a; b) = (b; a)
Let a functions f : S1 ! T1 and g : S2 ! T2, therefore
f g : S1 S2 ! T1 T2, is de ned by: f g (a; b) = (f a; g b)
; : J K ! J K J K de ned by induction as follows:
8&gt; 0; 0 if = 0; x : y = 0; x :
; = &lt; 0; id if = 0; x : y x 2= dom( )
&gt;:id+ if =
For any two functions f; g 2 S ! T; (f jg) 2 S ! T , de ned as:
(f jg) (1; a) = (f a)
(f jg) (0; a) = (g a)
Example 1. true + false
therefore:</p>
        <p>J ` true + f alse : Q2 KQ = p12 (f + g)
f = J ` true : Q2 KQ = const 1 1; const 1
g = J ` f alse : Q2 KQ = const 0 1; const 0
J ` true + f alse : Q2 KQ = p12 const 1 1; const 1 (0)
=(0 + 0)</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Altenkirch</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grattage</surname>
            ,
            <given-names>J.:</given-names>
          </string-name>
          <article-title>A functional quantum programming language</article-title>
          .
          <source>In: 20th Annual IEEE Symposium on Logic in Computer Science (LICS' 05)</source>
          . pp.
          <volume>249</volume>
          {
          <issue>258</issue>
          (
          <year>2005</year>
          ).
          <volume>10</volume>
          .1109/LICS.
          <year>2005</year>
          .1
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Lampis</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ginis</surname>
            ,
            <given-names>K.G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Papakyriakou</surname>
            ,
            <given-names>M.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Papaspyrou</surname>
            ,
            <given-names>N.S.</given-names>
          </string-name>
          :
          <article-title>Quantum data and control made easier</article-title>
          .
          <source>Electron. Notes Theor. Comput. Sci</source>
          .
          <volume>210</volume>
          ,
          <issue>85</issue>
          {105 (Jul
          <year>2008</year>
          ).
          <volume>10</volume>
          .1016/j.entcs.
          <year>2008</year>
          .
          <volume>04</volume>
          .020
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Tonder</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          v.:
          <article-title>A lambda calculus for quantum computation</article-title>
          .
          <source>SIAM J. Comput</source>
          .
          <volume>33</volume>
          (
          <issue>5</issue>
          ),
          <volume>1109</volume>
          {
          <fpage>1135</fpage>
          (
          <year>2004</year>
          ).
          <volume>10</volume>
          .1137/S0097539703432165
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>O</given-names>
            <surname>mer</surname>
          </string-name>
          , B.:
          <article-title>A procedural formalism for quantum computing</article-title>
          .
          <source>AIP Conference Proceedings</source>
          <volume>627</volume>
          (
          <issue>1</issue>
          ),
          <volume>276</volume>
          (
          <year>2002</year>
          ).
          <volume>10</volume>
          .
          <issue>1063</issue>
          /1.1503695
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Mlnar'k</surname>
          </string-name>
          , H.:
          <article-title>Quantum Programming Language LanQ</article-title>
          . phdthesis, Faculty of Informatics (
          <year>September 2007</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Sanders</surname>
            ,
            <given-names>J.W.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zuliani</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>Quantum programming</article-title>
          . In: Backhouse,
          <string-name>
            <given-names>R.</given-names>
            ,
            <surname>Oliveira</surname>
          </string-name>
          ,
          <string-name>
            <surname>J.N</surname>
          </string-name>
          . (eds.)
          <source>Mathematics of Program Construction</source>
          . pp.
          <volume>80</volume>
          {
          <fpage>99</fpage>
          . Springer Berlin Heidelberg, Berlin, Heidelberg (
          <year>2000</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Gay</surname>
            ,
            <given-names>S.J.:</given-names>
          </string-name>
          <article-title>Quantum programming languages: Survey and bibliography</article-title>
          .
          <source>Mathematical. Structures in Comp. Sci</source>
          .
          <volume>16</volume>
          (
          <issue>4</issue>
          ),
          <volume>581</volume>
          {
          <fpage>600</fpage>
          (
          <year>2006</year>
          ).
          <volume>10</volume>
          .1017/S0960129506005378
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Jorrand</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lalire</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>From Quantum Physics to Programming Languages: A Process Algebraic Approach</article-title>
          , pp.
          <volume>1</volume>
          {
          <fpage>16</fpage>
          . Springer Berlin Heidelberg, Berlin, Heidelberg (
          <year>2005</year>
          ).
          <volume>10</volume>
          .1007/11527800 1
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Gay</surname>
            ,
            <given-names>S.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nagarajan</surname>
          </string-name>
          , R.:
          <article-title>Communicating quantum processes</article-title>
          .
          <source>In: Proceedings of the 32Nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages</source>
          . pp.
          <volume>145</volume>
          {
          <fpage>157</fpage>
          . POPL '05,
          <string-name>
            <surname>ACM</surname>
          </string-name>
          , New York, NY, USA (
          <year>2005</year>
          ).
          <volume>10</volume>
          .1145/1040305.1040318
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Gay</surname>
            ,
            <given-names>S.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nagarajan</surname>
          </string-name>
          , R.:
          <article-title>Communicating quantum processes</article-title>
          .
          <source>SIGPLAN Not</source>
          .
          <volume>40</volume>
          (
          <issue>1</issue>
          ),
          <volume>145</volume>
          {
          <fpage>157</fpage>
          (
          <year>2005</year>
          ).
          <volume>10</volume>
          .1145/1047659.1040318
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Miszczak</surname>
            ,
            <given-names>J.A.</given-names>
          </string-name>
          :
          <article-title>High-level structures for quantum computing</article-title>
          .
          <source>Synthesis Lectures on Quantum Computing</source>
          <volume>4</volume>
          (
          <issue>05</issue>
          <year>2012</year>
          ).
          <volume>10</volume>
          .2200/S00422ED1V01Y201205QMC006
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Selinger</surname>
            ,
            <given-names>P.:</given-names>
          </string-name>
          <article-title>A brief survey of quantum programming languages</article-title>
          .
          <source>In: In Proceedings of the 7th International Symposium on Functional and Logic Programming</source>
          .
          <source>Springer (2004). 10.1007/978-3-540-24754-8 1</source>
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Selinger</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>Towards a quantum programming language</article-title>
          .
          <source>In: Mathematical Structures in Computer Science</source>
          . pp.
          <volume>527</volume>
          {
          <issue>586</issue>
          (
          <year>2004</year>
          ).
          <volume>10</volume>
          .1017/S0960129504004256
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <article-title>D az-</article-title>
          <string-name>
            <surname>Caro</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Arrighi</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gadella</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grattage</surname>
          </string-name>
          , J.:
          <article-title>Measurements and con uence in quantum lambda calculi with explicit qubits</article-title>
          .
          <source>Electronic Notes in Theoretical Computer Science</source>
          <volume>270</volume>
          (
          <issue>1</issue>
          ),
          <volume>59</volume>
          {
          <fpage>74</fpage>
          (
          <year>2011</year>
          ).
          <volume>10</volume>
          .1016/j.entcs.
          <year>2011</year>
          .
          <volume>01</volume>
          .006,
          <source>proceedings of the Joint 5th International Workshop on Quantum Physics and Logic and 4th Workshop on Developments in Computational Models (QPL/DCM</source>
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Abramsky</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Computational interpretations of linear logic</article-title>
          .
          <source>Theoretical Computer Science</source>
          <volume>111</volume>
          (
          <issue>1</issue>
          ),
          <volume>3</volume>
          {
          <fpage>57</fpage>
          (
          <year>1993</year>
          ).
          <volume>10</volume>
          .1016/
          <fpage>0304</fpage>
          -
          <lpage>3975</lpage>
          (
          <issue>93</issue>
          )
          <fpage>90181</fpage>
          -
          <lpage>R</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <surname>Abramsky</surname>
            ,
            <given-names>S.:</given-names>
          </string-name>
          <article-title>A structural approach to reversible computation</article-title>
          .
          <source>Theor. Comput. Sci</source>
          .
          <volume>347</volume>
          (
          <issue>3</issue>
          ),
          <volume>441</volume>
          {
          <fpage>464</fpage>
          (
          <year>2005</year>
          ).
          <volume>10</volume>
          .1016/j.tcs.
          <year>2005</year>
          .
          <volume>07</volume>
          .002
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <surname>Altenkirch</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grattage</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vizzotto</surname>
            ,
            <given-names>J.K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sabry</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>An algebra of pure quantum programming</article-title>
          .
          <source>Electronic Notes in Theoretical Computer Science</source>
          <volume>170</volume>
          ,
          <issue>23</issue>
          {
          <fpage>47</fpage>
          (
          <year>2007</year>
          ).
          <volume>10</volume>
          .1016/j.entcs.
          <year>2006</year>
          .
          <volume>12</volume>
          .010,
          <source>proceedings of the 3rd International Workshop on Quantum Programming Languages (QPL</source>
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <surname>Nielsen</surname>
            ,
            <given-names>M.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Chuang</surname>
            ,
            <given-names>I.L.</given-names>
          </string-name>
          :
          <article-title>Quantum Computation and Quantum Information: 10th Anniversary Edition</article-title>
          . Cambridge University Press (
          <year>2010</year>
          ).
          <volume>10</volume>
          .1017/CBO9780511976667
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19.
          <string-name>
            <surname>McMahon</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          : Quantum Computing Explained
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          20.
          <string-name>
            <surname>Grattage</surname>
            ,
            <given-names>J.J.:</given-names>
          </string-name>
          <article-title>A functional quantum programming language (</article-title>
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          21.
          <string-name>
            <surname>Landauer</surname>
          </string-name>
          , R.:
          <article-title>Irreversibility and heat generation in the computing process</article-title>
          .
          <source>IBM Journal of Research and Development</source>
          <volume>5</volume>
          (
          <issue>3</issue>
          ),
          <volume>183</volume>
          {
          <fpage>191</fpage>
          (
          <year>July 1961</year>
          ).
          <volume>10</volume>
          .1147/rd.53.0183
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          22.
          <article-title>Reversible computation in term rewriting</article-title>
          .
          <source>Journal of Logical and Algebraic Methods in Programming</source>
          <volume>94</volume>
          ,
          <issue>128</issue>
          {
          <fpage>149</fpage>
          (
          <year>2018</year>
          ).
          <volume>10</volume>
          .1016/j.jlamp.
          <year>2017</year>
          .
          <volume>10</volume>
          .003
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          23.
          <string-name>
            <surname>Abramsky</surname>
            ,
            <given-names>S.:</given-names>
          </string-name>
          <article-title>A structural approach to reversible computation</article-title>
          .
          <source>Theoretical Computer Science</source>
          <volume>347</volume>
          (
          <issue>3</issue>
          ),
          <volume>441</volume>
          {
          <fpage>464</fpage>
          (
          <year>2005</year>
          ).
          <volume>10</volume>
          .1016/j.tcs.
          <year>2005</year>
          .
          <volume>07</volume>
          .002
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          24.
          <string-name>
            <surname>Bennett</surname>
            ,
            <given-names>C.H.</given-names>
          </string-name>
          :
          <article-title>Logical reversibility of computation</article-title>
          .
          <source>IBM J. Res. Dev</source>
          .
          <volume>17</volume>
          (
          <issue>6</issue>
          ),
          <volume>525</volume>
          {
          <fpage>532</fpage>
          (
          <year>1973</year>
          ).
          <volume>10</volume>
          .1147/rd.176.0525
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          25.
          <string-name>
            <surname>Moggi</surname>
          </string-name>
          , E.:
          <article-title>Computational lambda-calculus and monads</article-title>
          .
          <source>In: Proceedings of the Fourth Annual Symposium on Logic in Computer Science</source>
          . pp.
          <volume>14</volume>
          {
          <fpage>23</fpage>
          . IEEE Press (
          <year>1989</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref26">
        <mixed-citation>
          26.
          <string-name>
            <surname>Awodey</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <source>Category Theory. Oxford Logic Guides</source>
          (
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>