You are on page 1of 152

Functional Quantum

Programming
Thorsten Altenkirch
University of Nottingham
based on joint work with Jonathan Grattage
supported by EPSRC grant GR/S30818/01

Tallinn Feb 06 – p.1/44


Background

Tallinn Feb 06 – p.2/44


Background
Simulation of quantum systems is expensive:
PSPACE complexity for polynomial circuits.

Tallinn Feb 06 – p.2/44


Background
Simulation of quantum systems is expensive:
PSPACE complexity for polynomial circuits.
Feynman: Can we exploit this fact to perform
computations more efficiently?

Tallinn Feb 06 – p.2/44


Background
Simulation of quantum systems is expensive:
PSPACE complexity for polynomial circuits.
Feynman: Can we exploit this fact to perform
computations more efficiently?
Shor: Factorisation in quantum polynomial time.

Tallinn Feb 06 – p.2/44


Background
Simulation of quantum systems is expensive:
PSPACE complexity for polynomial circuits.
Feynman: Can we exploit this fact to perform
computations more efficiently?
Shor: Factorisation in quantum polynomial time.
Grover: Blind search in




Tallinn Feb 06 – p.2/44


Background
Simulation of quantum systems is expensive:
PSPACE complexity for polynomial circuits.
Feynman: Can we exploit this fact to perform
computations more efficiently?
Shor: Factorisation in quantum polynomial time.
Grover: Blind search in



Can we build a quantum computer?

Tallinn Feb 06 – p.2/44


Background
Simulation of quantum systems is expensive:
PSPACE complexity for polynomial circuits.
Feynman: Can we exploit this fact to perform
computations more efficiently?
Shor: Factorisation in quantum polynomial time.
Grover: Blind search in



Can we build a quantum computer?
yes We can run quantum algorithms.

Tallinn Feb 06 – p.2/44


Background
Simulation of quantum systems is expensive:
PSPACE complexity for polynomial circuits.
Feynman: Can we exploit this fact to perform
computations more efficiently?
Shor: Factorisation in quantum polynomial time.
Grover: Blind search in



Can we build a quantum computer?
yes We can run quantum algorithms.
no Nature is classical after all!

Tallinn Feb 06 – p.2/44


The quantum software crisis

Tallinn Feb 06 – p.3/44


The quantum software crisis

Quantum algorithms are usually presented


using the circuit model.

Tallinn Feb 06 – p.3/44


The quantum software crisis

Quantum algorithms are usually presented


using the circuit model.
Nielsen and Chuang, p.7, Coming up with
good quantum algorithms is hard.

Tallinn Feb 06 – p.3/44


The quantum software crisis

Quantum algorithms are usually presented


using the circuit model.
Nielsen and Chuang, p.7, Coming up with
good quantum algorithms is hard.
Richard Josza, QPL 2004: We need to
develop quantum thinking!

Tallinn Feb 06 – p.3/44


QML

Tallinn Feb 06 – p.4/44


QML
QML: a functional language for quantum computations
on finite types.

Tallinn Feb 06 – p.4/44


QML
QML: a functional language for quantum computations
on finite types.
Quantum control and quantum data.

Tallinn Feb 06 – p.4/44


QML
QML: a functional language for quantum computations
on finite types.
Quantum control and quantum data.
Design guided by semantics

Tallinn Feb 06 – p.4/44


QML
QML: a functional language for quantum computations
on finite types.
Quantum control and quantum data.
Design guided by semantics
Analogy with classical computation
Finite classical computations




Finite quantum computations





Tallinn Feb 06 – p.4/44


QML
QML: a functional language for quantum computations
on finite types.
Quantum control and quantum data.
Design guided by semantics
Analogy with classical computation
Finite classical computations




Finite quantum computations





Important issue: control of decoherence

Tallinn Feb 06 – p.4/44


QML
QML: a functional language for quantum computations
on finite types.
Quantum control and quantum data.
Design guided by semantics
Analogy with classical computation
Finite classical computations




Finite quantum computations





Important issue: control of decoherence


Compiler under construction (Jonathan)

Tallinn Feb 06 – p.4/44


Example: Hadamard operation

Tallinn Feb 06 – p.5/44


Example: Hadamard operation
Matrix







Tallinn Feb 06 – p.5/44


QML
Matrix

 


 


,+   
  

 
 
  


     
!" "!

#$  
 #
')(& 
"  
 %
*
'() &
"

*
Example: Hadamard operation

Tallinn Feb 06 – p.5/44


] /.0- /.0-
K CDB
3241 3241
E
H FG
I />5 765
F b
J :98
@  @ ?
A

C
E KL 9 8
DaB ]C \ M
C
OGN
O 
O  Q:P < ;
=
Q P UTSR
XZ W
H SU R H U
Deutsch algorithm

O V
C C XYZ W
E KL E KL
DaB DaB > U
C ]C \ C ]C \
?
[
O N
G N N O N
G
^ 
_ ^ 
_
Q P Q P
SU R ` ` SU R
O  O 
V V
Q:P Q:P
^ 
_ ^ 
_
SUTR TSUR
` `
O  O V O V O 
XZ W XZ W XZ W XZ W
U U U U

[ [ [ [
Tallinn Feb 06 – p.6/44
Overview

1. Finite classical computation


2. Finite quantum computation
3. QML basics
4. Compiling QML
5. Conclusions and further work

Tallinn Feb 06 – p.7/44


1. Semantics

1. Finite classical computation


2. Finite quantum computation
3. QML basics
4. Compiling QML
5. Conclusions and further work

Tallinn Feb 06 – p.8/44


Something we know well . . .

Tallinn Feb 06 – p.9/44


Something we know well . . .
Start with classical computations on finite types.

Tallinn Feb 06 – p.9/44


Something we know well . . .
Start with classical computations on finite types.
Quantum mechanics is time-reversible. . .

Tallinn Feb 06 – p.9/44


Something we know well . . .
Start with classical computations on finite types.
Quantum mechanics is time-reversible. . .
. . . hence quantum computation is based on reversible
operations.

Tallinn Feb 06 – p.9/44


Something we know well . . .
Start with classical computations on finite types.
Quantum mechanics is time-reversible. . .
. . . hence quantum computation is based on reversible
operations.
However: Newtonian mechanics, Maxwellian
electrodynamics are also time-reversible. . .

Tallinn Feb 06 – p.9/44


Something we know well . . .
Start with classical computations on finite types.
Quantum mechanics is time-reversible. . .
. . . hence quantum computation is based on reversible
operations.
However: Newtonian mechanics, Maxwellian
electrodynamics are also time-reversible. . .
. . . hence classical computation should be based on
reversible operations.

Tallinn Feb 06 – p.9/44


Classical computation ( )

Tallinn Feb 06 – p.10/44


Classical computation ( )

Given finite sets (input) and (output):

d
e
 

h
f

Tallinn Feb 06 – p.10/44


Classical computation ( )

Given finite sets (input) and (output):

d
e
 

h
f

g
a finite set of initial heaps ,

Tallinn Feb 06 – p.10/44


Classical computation ( )

Given finite sets (input) and (output):

d
e
 

h
f

g
a finite set of initial heaps ,
an initial heap ,
kji

Tallinn Feb 06 – p.10/44


Classical computation ( )

Given finite sets (input) and (output):

d
e
 

h
f

g
a finite set of initial heaps ,
an initial heap ,
kji

a finite set of garbage states ,

Tallinn Feb 06 – p.10/44


Classical computation ( )

Given finite sets (input) and (output):

d
e
 

h
f

g
a finite set of initial heaps ,
an initial heap ,
kji

a finite set of garbage states ,


a bijection ,
j

l
m

Tallinn Feb 06 – p.10/44


Composing classical computations

Tallinn Feb 06 – p.11/44


Composing classical computations

o
n
 >> 88  
n

n
>> 88
>> 88
>> 
  8 
o

o
o

n

Tallinn Feb 06 – p.11/44


Composing classical computations

o
n
 >> 88  
n

n
>> 88
>> 88
>> 
  8 
o

o
o

n
Theorem:
U U U
$

 $

%
p $

%
pq

q
Tallinn Feb 06 – p.11/44
Extensional equality

Tallinn Feb 06 – p.12/44


Extensional equality

A classical computation

 $

%
i
q

r
r

r
induces a function U by

j
q
/

l
s
O

{zy
x w

|}

vut

/
U

Tallinn Feb 06 – p.12/44


Extensional equality

A classical computation

 $

%
i
q

r
r

r
induces a function U by

j
q
/

l
s
O

{zy
x w

|}

vut

/
U

n
We say that two computations are
extensionally equivalent, if they give rise to
the same function.

Tallinn Feb 06 – p.12/44


Extensional equality . . .
Theorem:
U U U

 $

%
p $

%
pq

q
Tallinn Feb 06 – p.13/44
Extensional equality . . .
Theorem:
U U U

 $

%
p $

%
pq

q
Hence, classical computations upto
extensional equality give rise to the category
.

Tallinn Feb 06 – p.13/44


Extensional equality . . .
Theorem:
U U U

 $

%
p $

%
pq

q
Hence, classical computations upto
extensional equality give rise to the category
.
Theorem: Any function on finite

j
sets can be realized by a computation.
r

Tallinn Feb 06 – p.13/44


Extensional equality . . .
Theorem:
U U U

 $

%
p $

%
pq

q
Hence, classical computations upto
extensional equality give rise to the category
.
Theorem: Any function on finite

j
sets can be realized by a computation.
r

Translation for Category Theoreticians:


U is full and faithful.

Tallinn Feb 06 – p.13/44


Example :


function

%




j
€~

r
$

%



~

Tallinn Feb 06 – p.14/44


Example :


function

%




j
€~

r
$

%



~

r
computation


 

…„
ƒ e

Tallinn Feb 06 – p.14/44


Example :
function

%



r
 $

%
 †

r 

Tallinn Feb 06 – p.15/44


Š

function
 † j†
Š $ Š $ Šj

computation
$ 

r  r  ‰  $
 
% % r $
Example :


r 
%  ‰ ‡ 
 $  $
  % r 
 $
%
r r  ‰


‹ % r 
% %
'!"#&%$

‡ ‡
Tallinn Feb 06 – p.15/44
 
2. Finite quantum computation

1. Finite classical computation


2. Finite quantum computation
3. QML basics
4. Compiling QML
5. Conclusions and further work

Tallinn Feb 06 – p.16/44


Linear algebra revision

Tallinn Feb 06 – p.17/44


Linear algebra revision

Given a finite set (the base)


is a Hilbert space.
Œ

Tallinn Feb 06 – p.17/44


Linear algebra revision

Given a finite set (the base)


is a Hilbert space.
Œ

Linear operators:
induces

j 
.

Ž
j

we write
j

Tallinn Feb 06 – p.17/44


Linear algebra revision

Given a finite set (the base)


is a Hilbert space.
Œ

Linear operators:
induces

j 
.

Ž
j

we write
j


Norm of a vector:
,
”

•
 


%$

j %
“

“


Œ
’
‘

Tallinn Feb 06 – p.17/44


Linear algebra revision

Given a finite set (the base)


is a Hilbert space.
Œ

Linear operators:
induces

j 
.

Ž
j

we write
j


Norm of a vector:
,
”

•
 


%$

j %
“

“


Œ
’
‘

Unitary operators:
A unitary operator is a linear iso-
j

unitary 

morphism that preserves the norm.


Tallinn Feb 06 – p.17/44
Basics of quantum computation

Tallinn Feb 06 – p.18/44


Basics of quantum computation

A pure state over is a vector with

Œ
j

unit norm .

 





Tallinn Feb 06 – p.18/44


Basics of quantum computation

A pure state over is a vector with

Œ
j

unit norm .

 




A reversible computation is given by a
unitary operator .


unitary

Tallinn Feb 06 – p.18/44


Quantum computations ( )

Tallinn Feb 06 – p.19/44


Quantum computations ( )
Given finite sets (input) and (output):

d
e
 

h
f

Tallinn Feb 06 – p.19/44


Quantum computations ( )
Given finite sets (input) and (output):

d
e
 

h
f

g
a finite set , the base of the space of initial
heaps,

Tallinn Feb 06 – p.19/44


Quantum computations ( )
Given finite sets (input) and (output):

d
e
 

h
f

g
a finite set , the base of the space of initial
heaps,
a heap initialisation vector ,

–
ji

Tallinn Feb 06 – p.19/44


Quantum computations ( )
Given finite sets (input) and (output):

d
e
 

h
f

g
a finite set , the base of the space of initial
heaps,
a heap initialisation vector ,

–
ji
a finite set , the base of the space of
garbage states,

Tallinn Feb 06 – p.19/44


Quantum computations ( )
Given finite sets (input) and (output):

d
e
 

h
f

g
a finite set , the base of the space of initial
heaps,
a heap initialisation vector ,

–
ji
a finite set , the base of the space of
garbage states,
a unitary operator .
j


unitary
Tallinn Feb 06 – p.19/44
Composing quantum computations

Tallinn Feb 06 – p.20/44


Composing quantum computations

o
n
 >> 88  
n

n
>> 88
>> 88
>> 
  8 
o

o
o

n

Tallinn Feb 06 – p.20/44


Semantics of quantum computations. .

Tallinn Feb 06 – p.21/44


Semantics of quantum computations. .

. . . is a bit more subtle.

Tallinn Feb 06 – p.21/44


Semantics of quantum computations. .

. . . is a bit more subtle.


There is no (sensible) operator on vector
spaces, replacing .

l
~

Tallinn Feb 06 – p.21/44


Semantics of quantum computations. .

. . . is a bit more subtle.


There is no (sensible) operator on vector
spaces, replacing .

l
~
Indeed: Forgetting part of a pure state
results in a mixed state.

Tallinn Feb 06 – p.21/44


Density matrizes

Tallinn Feb 06 – p.22/44


Density matrizes

Mixed states can be represented by density


matrizes .

—j

Tallinn Feb 06 – p.22/44


Density matrizes

Mixed states can be represented by density


matrizes .

—j


Eigenvalues represent probabilities

˜
 ™
—


System is in state with prob.
˜

™


Tallinn Feb 06 – p.22/44


Density matrizes

Mixed states can be represented by density


matrizes .

—j


Eigenvalues represent probabilities

˜
 ™
—


System is in state with prob.
˜

™


Eigenvalues have to be positive and their sum


(the trace) is .


Tallinn Feb 06 – p.22/44


Example: forgetting a qbit

Tallinn Feb 06 – p.23/44


Example: forgetting a qbit

EPR is represented by
:
—j





›

›
œ

œ
<

<
œ

œ
š


š


š


œ

œ
›

›
œ

œ
<

<

Tallinn Feb 06 – p.23/44


Example: forgetting a qbit

EPR is represented by
:
—j





›

›
œ

œ
<

<
œ

œ
š


š


š


œ

œ
›

›
œ

œ
<

<



— $

Ÿ
%

Ÿ
‰
‰




‰
‰




ž

ž



Tallinn Feb 06 – p.23/44
Example: forgetting a qbit . . .

After measuring one qbit we obtain


:
—j  




œ
<

›
œ
<

Tallinn Feb 06 – p.24/44


Example: forgetting a qbit . . .

After measuring one qbit we obtain


:
—j  




œ
<

›
œ
<


—  
#
Ÿ

#
Ÿ
‰

‰



—  
#
Ÿ

#
Ÿ






Tallinn Feb 06 – p.24/44


Superoperators

Tallinn Feb 06 – p.25/44


Superoperators

Morphisms on density matrizes are called


superoperators, these are linear maps, which
are
completely positive, and
trace preserving

Tallinn Feb 06 – p.25/44


Superoperators

Morphisms on density matrizes are called


superoperators, these are linear maps, which
are
completely positive, and
trace preserving
Every unitary operator
¡
gives rise to a
superoperator .

Tallinn Feb 06 – p.25/44


Superoperators. . .

There is an operator

'&

¢j


super

Ž
z
called partial trace.

Tallinn Feb 06 – p.26/44


Superoperators. . .

There is an operator

'&

¢j


super

Ž
z
called partial trace.
E.g. is
¤£('&

¥ j


super
¥ £


z

represented by a matrix.

§

Tallinn Feb 06 – p.26/44


Semantics

Tallinn Feb 06 – p.27/44


Semantics

Every quantum computation gives rise to a

q
superoperator U

j
q


super

s ¨
O

« ª©
¬
x

/
U

Tallinn Feb 06 – p.27/44


Semantics

Every quantum computation gives rise to a

q
superoperator U

j
q


super

s ¨
O

« ª©
¬
x

/
U

n
Theorem: Every superoperator


super
(on finite Hilbert spaces) comes from a quantum
computation.

Tallinn Feb 06 – p.27/44


Classical vs quantum

Tallinn Feb 06 – p.28/44


Classical vs quantum

classical ( ) quantum ( )








Tallinn Feb 06 – p.28/44
Classical vs quantum

classical ( ) quantum ( )








finite sets

Tallinn Feb 06 – p.28/44


Classical vs quantum

classical ( ) quantum ( )








finite sets finite dimensional Hilbert space

Tallinn Feb 06 – p.28/44


Classical vs quantum

classical ( ) quantum ( )








finite sets finite dimensional Hilbert space
cartesian product ( )

Tallinn Feb 06 – p.28/44


Classical vs quantum

classical ( ) quantum ( )








finite sets finite dimensional Hilbert space
cartesian product ( ) tensor product ( )

¯
®

Tallinn Feb 06 – p.28/44


Classical vs quantum

classical ( ) quantum ( )








finite sets finite dimensional Hilbert space
cartesian product ( ) tensor product ( )

¯
®
bijections

Tallinn Feb 06 – p.28/44


Classical vs quantum

classical ( ) quantum ( )








finite sets finite dimensional Hilbert space
cartesian product ( ) tensor product ( )

¯
®
bijections unitary operators

Tallinn Feb 06 – p.28/44


Classical vs quantum

classical ( ) quantum ( )








finite sets finite dimensional Hilbert space
cartesian product ( ) tensor product ( )

¯
®
bijections unitary operators
functions

Tallinn Feb 06 – p.28/44


Classical vs quantum

classical ( ) quantum ( )








finite sets finite dimensional Hilbert space
cartesian product ( ) tensor product ( )

¯
®
bijections unitary operators
functions superoperators

Tallinn Feb 06 – p.28/44


Classical vs quantum

classical ( ) quantum ( )








finite sets finite dimensional Hilbert spaces
cartesian product ( ) tensor product ( )

¯
®
bijections unitary operators
functions superoperators
injective functions ( M )




Tallinn Feb 06 – p.28/44


Classical vs quantum

classical ( ) quantum ( )








finite sets finite dimensional Hilbert spaces
cartesian product ( ) tensor product ( )

¯
®
bijections unitary operators
functions superoperators
injective functions ( M ) isometries ( )

M







Tallinn Feb 06 – p.28/44
Classical vs quantum

classical ( ) quantum ( )








finite sets finite dimensional Hilbert spaces
cartesian product ( ) tensor product ( )

¯
®
bijections unitary operators
functions superoperators
injective functions ( M ) isometries ( )

M







projections

Tallinn Feb 06 – p.28/44


Classical vs quantum

classical ( ) quantum ( )








finite sets finite dimensional Hilbert spaces
cartesian product ( ) tensor product ( )

¯
®
bijections unitary operators
functions superoperators
injective functions ( M ) isometries ( )

M







projections partial trace

Tallinn Feb 06 – p.28/44


Decoherence

Tallinn Feb 06 – p.29/44


Decoherence


ˆ
 '!"#&%$ 

…„
ƒ e
° e
±

Tallinn Feb 06 – p.29/44


Decoherence


ˆ
 '!"#&%$ 

…„
ƒ e
° e
±
Classically

²
p
~

Tallinn Feb 06 – p.29/44


Decoherence


ˆ
 '!"#&%$ 

…„
ƒ e
° e
±
Classically

²
p
~


Quantum

Tallinn Feb 06 – p.29/44


Decoherence


ˆ
 '!"#&%$ 

…„
ƒ e
° e
±
Classically

²
p
~


Quantum


input:


#
Ÿ

#
Ÿ
*
‰

‰
ž

ž


Tallinn Feb 06 – p.29/44


Decoherence


ˆ
 '!"#&%$ 

…„
ƒ e
° e
±
Classically

²
p
~


Quantum


input:


#
Ÿ

#
Ÿ
*
‰

‰
ž

ž





output:
#

Ÿ
*

#

Ÿ
*
‰




Tallinn Feb 06 – p.29/44


3. QML basics

1. Finite classical computation


2. Finite quantum computation
3. QML basics
4. Compiling QML
5. Conclusions and further work

Tallinn Feb 06 – p.30/44


QML basics

Tallinn Feb 06 – p.31/44


QML basics

QML is a first order functional languages, i.e.


programs are well-typed expressions.

Tallinn Feb 06 – p.31/44


QML basics

QML is a first order functional languages, i.e.


programs are well-typed expressions.
QML types are

r ´


r

Tallinn Feb 06 – p.31/44


QML basics

QML is a first order functional languages, i.e.


programs are well-typed expressions.
QML types are

r ´


r
Qbytes
.
µ





Tallinn Feb 06 – p.31/44


QML basics . . .

A QML program is an expression in a context


of typed variables, e.g.

¶·¸





 


¶·¸

 
 

!"

, +

'() &


"


Tallinn Feb 06 – p.32/44


QML basics . . .

A QML program is an expression in a context


of typed variables, e.g.

¶·¸





 


¶·¸

 
 

!"

, +

'() &


"

We can compile QML programs into quantum
computations (i.e. quantum circuits).

Tallinn Feb 06 – p.32/44


QML basics . . .

Forgetting variables has to be explicit.

Tallinn Feb 06 – p.33/44


QML basics . . .

Forgetting variables has to be explicit.


E.g.
»¹
¶º





¹$

%
¶º


r

is illegal,

Tallinn Feb 06 – p.33/44


QML basics . . .

Forgetting variables has to be explicit.


E.g.
»¹
¶º





¹$

%
¶º


r

is illegal,
but
»¹
¶º





¹$

*
¶º



‚
r

is ok.

Tallinn Feb 06 – p.33/44


QML basics . . .
There are two different if-then-else constructs.

Tallinn Feb 06 – p.34/44


QML basics . . .
There are two different if-then-else constructs.


¼





 


¼

 

')(&
"


 
, +


!"

is just the identity,

Tallinn Feb 06 – p.34/44


QML basics . . .
There are two different if-then-else constructs.


¼





 


¼

 

')(&
"


 
, +


!"

is just the identity, but
½¾
º







½¾
º





 

')(&
"


 
,+


!"


introduces a measurement (end hence


decoherence).
Tallinn Feb 06 – p.34/44
QML basics . . .
Using is only allowed, if the branches are



orthogonal, i.e. observable different.

Tallinn Feb 06 – p.35/44


QML basics . . .
Using is only allowed, if the branches are



orthogonal, i.e. observable different.
º
¿

À Á






$



º
¿

À Á

¿

r
$

%
 

r ‚
$

%
, +


‚
r
is illegal,

Tallinn Feb 06 – p.35/44


QML basics . . .
Using is only allowed, if the branches are



orthogonal, i.e. observable different.
º
¿

À Á






$



º
¿

À Á

¿

r
$

%
 

r ‚
$

%
, +


‚
r
is illegal, but

%
º
¿

À Á






$



º
¿

À Á

¿

r
$

%
%
 

'() &
"


r ‚
r
$

%
%
 
, +


!"


‚
r

is ok.
Tallinn Feb 06 – p.35/44
QML basics . . .

We can introduce superpositions, e.g.









 


 


#$

 %

*
 
 

!"

')(&
"

 


 #

*
 
,+

!"

')(&


"

Tallinn Feb 06 – p.36/44


QML basics . . .

We can introduce superpositions, e.g.









 


 


#$

 %

*
 
 

!"

')(&
"

 


 #

*
 
,+

!"

')(&


"
However, the terms in the superposition have
to be orthogonal.

Tallinn Feb 06 – p.36/44


4. Compiling QML

1. Finite classical computation


2. Finite quantum computation
3. QML basics
4. Compiling QML
5. Conclusions and further work

Tallinn Feb 06 – p.37/44


Compilation

Tallinn Feb 06 – p.38/44


Compilation

Correct QML programs are defined by typing


rules, e.g.

Â
ÃÄ


ÆÃ


r ³


r

ÉÈÇ
"
Í$

%
ËÊÃ
Â

 Ä

ÏÐÎ
r ‡
Å

Æ
Ì


Tallinn Feb 06 – p.38/44
Compilation

Correct QML programs are defined by typing


rules, e.g.

Â
ÃÄ


ÆÃ


r ³


r

ÉÈÇ
"
Í$

%
ËÊÃ
Â

 Ä

ÏÐÎ
r ‡
Å

Æ
Ì


For each rule we can construct a quantum
computation, i.e. a circuit.

Tallinn Feb 06 – p.38/44


Â
-elim

Â
ÃÊ r
ÃÄ

Ì 
Í$
r ³ ³

r ‡
Å ´
% ´

 Ä ÆÃ

ÏÎ
Æ


"

È Ç
Tallinn Feb 06 – p.39/44
-elim

Â
ÃÄ


ÆÃ


r ³


r

È Ç
"
Í$

%
Â

 Ä

ÏÎ
ÃÊ

r ‡
Å

Æ
Ì


Â

Ø
×
;; 
;;
Ô ÓÒ Ñ


Ö
Õ

  ;
Ø
Û
Ú

Ý
z

ß
Þ
Ü
 ;;  ;;  
Ü

Ü
;; ;;
  ;;  ;; 
 
Ù

Ù
Tallinn Feb 06 – p.39/44
Compiler

Tallinn Feb 06 – p.40/44


Compiler

A compiler is currently being implemented by


my student Jonathan Grattage (in Haskell).

Tallinn Feb 06 – p.40/44


Compiler

A compiler is currently being implemented by


my student Jonathan Grattage (in Haskell).
The output of the compiler are quantum
circuits which can be simulated by a quantum
circuit simulator.

Tallinn Feb 06 – p.40/44


Compiler

A compiler is currently being implemented by


my student Jonathan Grattage (in Haskell).
The output of the compiler are quantum
circuits which can be simulated by a quantum
circuit simulator.
Amr Sabry and Juliana Vizotti (Indiana
University) embarked on an independent
implementation of QML based on our paper.

Tallinn Feb 06 – p.40/44


5. Conclusions

1. Semantics of finite classical and quantum


computation
2. QML basics
3. Compiling QML
4. Conclusions and further work

Tallinn Feb 06 – p.41/44


Conclusions

Tallinn Feb 06 – p.42/44


Conclusions
Our semantic ideas proved useful when designing a
quantum programming language, analogous concepts
are modelled by the same syntactic constructs.

Tallinn Feb 06 – p.42/44


Conclusions
Our semantic ideas proved useful when designing a
quantum programming language, analogous concepts
are modelled by the same syntactic constructs.
Our analysis also highlights the differences between
classical and quantum programming.

Tallinn Feb 06 – p.42/44


Conclusions
Our semantic ideas proved useful when designing a
quantum programming language, analogous concepts
are modelled by the same syntactic constructs.
Our analysis also highlights the differences between
classical and quantum programming.
We have developed an algebra of quantum programs
which for pure programs is complete wrt the semantics
and a normalisation algorithm.

Tallinn Feb 06 – p.42/44


Conclusions
Our semantic ideas proved useful when designing a
quantum programming language, analogous concepts
are modelled by the same syntactic constructs.
Our analysis also highlights the differences between
classical and quantum programming.
We have developed an algebra of quantum programs
which for pure programs is complete wrt the semantics
and a normalisation algorithm.
Quantum programming introduces the problem of
control of decoherence, which we address by making
forgetting variables explicit and by having different
if-then-else constructs.
Tallinn Feb 06 – p.42/44
Further work

Tallinn Feb 06 – p.43/44


Further work
We have to analyze more quantum programs to
evaluate the practical usefulness of our approach.

Tallinn Feb 06 – p.43/44


Further work
We have to analyze more quantum programs to
evaluate the practical usefulness of our approach.
We should be able to extend our algebra and
normalisation to the full language (including
measurements).

Tallinn Feb 06 – p.43/44


Further work
We have to analyze more quantum programs to
evaluate the practical usefulness of our approach.
We should be able to extend our algebra and
normalisation to the full language (including
measurements).
Are we able to come up with completely new
algorithms using QML?

Tallinn Feb 06 – p.43/44


Further work
We have to analyze more quantum programs to
evaluate the practical usefulness of our approach.
We should be able to extend our algebra and
normalisation to the full language (including
measurements).
Are we able to come up with completely new
algorithms using QML?
How to deal with higher order programs?

Tallinn Feb 06 – p.43/44


Further work
We have to analyze more quantum programs to
evaluate the practical usefulness of our approach.
We should be able to extend our algebra and
normalisation to the full language (including
measurements).
Are we able to come up with completely new
algorithms using QML?
How to deal with higher order programs?
How to deal with infinite datatypes?

Tallinn Feb 06 – p.43/44


Further work
We have to analyze more quantum programs to
evaluate the practical usefulness of our approach.
We should be able to extend our algebra and
normalisation to the full language (including
measurements).
Are we able to come up with completely new
algorithms using QML?
How to deal with higher order programs?
How to deal with infinite datatypes?
Investigate the similarities/differences between FCC
and FQC from a categorical point of view.
Tallinn Feb 06 – p.43/44
The end

Thank you for your attention.


Papers, available from
//www.cs.nott.ac.uk/˜txa/publ/
A functional quantum programming language LICS 2005
with J.Grattage
Structuring Quantum Effects: Superoperators as Arrows
MFCS 2006
with J.Vizzotto and A.Sabry
An Algebra of Pure Quantum Programming QPL 2005
with J.Grattage, J.Vizzotto and A.Sabry Tallinn Feb 06 – p.44/44

You might also like