Functional QuantumProgramming
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
Simulation of quantum systems is expensive:PSPACE complexity for polynomial circuits.
Feynman: Can we exploit this fact to performcomputations 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
BackgroundSimulation of quantum systems is expensive:PSPACE complexity for polynomial circuits.
Feynman: Can we exploit this fact to performcomputations 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
BackgroundSimulation of quantum systems is expensive:PSPACE complexity for polynomial circuits.
Feynman: Can we exploit this fact to performcomputations 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
BackgroundSimulation of quantum systems is expensive:PSPACE complexity for polynomial circuits.
Feynman: Can we exploit this fact to performcomputations 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
BackgroundSimulation of quantum systems is expensive:PSPACE complexity for polynomial circuits.
Feynman: Can we exploit this fact to performcomputations 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
BackgroundSimulation of quantum systems is expensive:PSPACE complexity for polynomial circuits.
Feynman: Can we exploit this fact to performcomputations 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
BackgroundSimulation of quantum systems is expensive:PSPACE complexity for polynomial circuits.
Feynman: Can we exploit this fact to performcomputations 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
BackgroundSimulation of quantum systems is expensive:PSPACE complexity for polynomial circuits.
Feynman: Can we exploit this fact to performcomputations 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
Quantum algorithms are usually presentedusing the circuit model.
Nielsen and Chuang, p.7, Coming up withgood quantum algorithms is hard.Richard Josza, QPL 2004: We need todevelop quantum thinking!
Tallinn Feb 06 – p.3/44
The quantum software crisis
Quantum algorithms are usually presentedusing the circuit model.
Nielsen and Chuang, p.7, Coming up withgood quantum algorithms is hard.Richard Josza, QPL 2004: We need todevelop quantum thinking!
Tallinn Feb 06 – p.3/44
The quantum software crisis
Quantum algorithms are usually presentedusing the circuit model.
Nielsen and Chuang, p.7, Coming up withgood quantum algorithms is hard.
Richard Josza, QPL 2004: We need todevelop quantum thinking!
Tallinn Feb 06 – p.3/44
The quantum software crisis
Quantum algorithms are usually presentedusing the circuit model.
Nielsen and Chuang, p.7, Coming up withgood quantum algorithms is hard.Richard Josza, QPL 2004: We need todevelop quantum thinking!
Tallinn Feb 06 – p.3/44
QML
QML: a functional language for quantum computationson 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
QMLQML: a functional language for quantum computationson 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
QMLQML: a functional language for quantum computationson 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
QMLQML: a functional language for quantum computationson 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
QMLQML: a functional language for quantum computationson 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
QMLQML: a functional language for quantum computationson 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
QMLQML: a functional language for quantum computationson 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
Matrix
QML
Tallinn Feb 06 – p.5/44
Example: Hadamard operation
Matrix
� ��
� �� �
QML
Tallinn Feb 06 – p.5/44
Example: Hadamard operation
Matrix
� ��
� �� �
QML �� �� � � ��� �� � �� � ������ ��� ��� �!" #$ � % � &(') " *
� +�, � ��� ��� �!" # � &(') " *
Tallinn Feb 06 – p.5/44
Deutsch algorithm-/.0 1324 576 8:9 8 9 ;=<-/.0 1324 5/> ?A@BDC E �GFIH J � @ KL M NGO P:Q RTSU V O WYXZ U [
E \ C] �O W XZ U H KL >E \ C] NGO P Q RSU V �_^ ` � O W XZ U [
C BDa C N �_^ ` � O P:Q RTSU V O W XZ U [
C BDa C �O P Q RSU H KL ?E \ C] N �_^ ` � O P:Q RTSU V O W XZ U [
C BDa C NGO P Q RSU V �_^ ` � O W XZ U [
K] b FTallinn 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 . . .
Start with classical computations on finite types.
Quantum mechanics is time-reversible. . .
. . . hence quantum computation is based on reversibleoperations.
However: Newtonian mechanics, Maxwellianelectrodynamics are also time-reversible. . .
. . . hence classical computation should be based onreversible 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 reversibleoperations.
However: Newtonian mechanics, Maxwellianelectrodynamics are also time-reversible. . .
. . . hence classical computation should be based onreversible 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 reversibleoperations.
However: Newtonian mechanics, Maxwellianelectrodynamics are also time-reversible. . .
. . . hence classical computation should be based onreversible 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 reversibleoperations.
However: Newtonian mechanics, Maxwellianelectrodynamics are also time-reversible. . .
. . . hence classical computation should be based onreversible 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 reversibleoperations.
However: Newtonian mechanics, Maxwellianelectrodynamics are also time-reversible. . .
. . . hence classical computation should be based onreversible 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 reversibleoperations.
However: Newtonian mechanics, Maxwellianelectrodynamics are also time-reversible. . .
. . . hence classical computation should be based onreversible operations.
Tallinn Feb 06 – p.9/44
Classical computation ( )
Given finite sets (input) and (output):
� �
a finite set of initial heaps ,
an initial heap ,
a finite set of garbage states ,
a bijection ,
Tallinn Feb 06 – p.10/44
Classical computation ( )
Given finite sets (input) and (output):
c def � g h �
a finite set of initial heaps ,
an initial heap ,
a finite set of garbage states ,
a bijection ,
Tallinn Feb 06 – p.10/44
Classical computation ( )
Given finite sets (input) and (output):
c def � g h �
a finite set of initial heaps ,
an initial heap ,
a finite set of garbage states ,
a bijection ,
Tallinn Feb 06 – p.10/44
Classical computation ( )
Given finite sets (input) and (output):
c def � g h �
a finite set of initial heaps ,
an initial heapikj ,
a finite set of garbage states ,
a bijection ,
Tallinn Feb 06 – p.10/44
Classical computation ( )
Given finite sets (input) and (output):
c def � g h �
a finite set of initial heaps ,
an initial heapikj ,
a finite set of garbage states ,
a bijection ,
Tallinn Feb 06 – p.10/44
Classical computation ( )
Given finite sets (input) and (output):
c def � g h �
a finite set of initial heaps ,
an initial heapikj ,
a finite set of garbage states ,
a bijection j l m l ,
Tallinn Feb 06 – p.10/44
Composing classical computations
�
>>>>
>>>>
8888
888 �
�
��������
������� �
Theorem:U U U
Tallinn Feb 06 – p.11/44
Composing classical computations
n d on �
>>>>
>>>>
8888
888 n�
o �
��������
������� o�
o � n
Theorem:U U U
Tallinn Feb 06 – p.11/44
Composing classical computations
n d on �
>>>>
>>>>
8888
888 n�
o �
��������
������� o�
o � nTheorem:
U
$ pq % �$ U
% p$ Uq %
Tallinn Feb 06 – p.11/44
Extensional equality
A classical computationinduces a function U by
//
��
OO
U//
We say that two computations areextensionally equivalent, if they give rise tothe same function.
Tallinn Feb 06 – p.12/44
Extensional equality
A classical computationq �$ r i r r %induces a function Uq j by
l s // ltvu
��
wyx{z | }OO
U n //
We say that two computations areextensionally equivalent, if they give rise tothe same function.
Tallinn Feb 06 – p.12/44
Extensional equality
A classical computationq �$ r i r r %induces a function Uq j by
l s // ltvu
��
wyx{z | }OO
U n //
We say that two computations areextensionally equivalent, if they give rise tothe same function.
Tallinn Feb 06 – p.12/44
Extensional equality . . .
Theorem:
U
$ pq % �$ U
% p$ Uq %
Hence, classical computations uptoextensional equality give rise to the category
.
Theorem: Any function on finitesets can be realized by a computation.
Translation for Category Theoreticians:U is full and faithful.
Tallinn Feb 06 – p.13/44
Extensional equality . . .
Theorem:
U
$ pq % �$ U
% p$ Uq %
Hence, classical computations uptoextensional equality give rise to the category
.
Theorem: Any function on finitesets can be realized by a computation.
Translation for Category Theoreticians:U is full and faithful.
Tallinn Feb 06 – p.13/44
Extensional equality . . .
Theorem:
U
$ pq % �$ U
% p$ Uq %
Hence, classical computations uptoextensional equality give rise to the category
.
Theorem: Any function j on finitesets r can be realized by a computation.
Translation for Category Theoreticians:U is full and faithful.
Tallinn Feb 06 – p.13/44
Extensional equality . . .
Theorem:
U
$ pq % �$ U
% p$ Uq %
Hence, classical computations uptoextensional equality give rise to the category
.
Theorem: Any function j on finitesets r can be realized by a computation.
Translation for Category Theoreticians:U is full and faithful.
Tallinn Feb 06 – p.13/44
Example � :function ~�� j $ � r � % �
~�� $ � r � % � �
computation
�
Tallinn Feb 06 – p.14/44
Example � :function ~�� j $ � r � % �
~�� $ � r � % � �
computation � �
� �e���
Tallinn Feb 06 – p.14/44
Example :
function �j � $ � r � %
�� �$ � r� %
computation
� '&%$ !"#
Tallinn Feb 06 – p.15/44
Example :
function �j � $ � r � %
�� �$ � r� %
computation � � � � � � �
� � � � '&%$ !"# � � �
� � j $ � r � % $ � 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
Given a finite set (the base)is a Hilbert space.
Linear operators:induces .
we writeNorm of a vector:
,Unitary operators:A unitary operator unitary is a linear iso-morphism that preserves the norm.
Tallinn Feb 06 – p.17/44
Linear algebra revision
Given a finite set (the base)� � is a Hilbert space.
Linear operators:induces .
we writeNorm of a vector:
,Unitary operators:A unitary operator unitary is a linear iso-morphism that preserves the norm.
Tallinn Feb 06 – p.17/44
Linear algebra revision
Given a finite set (the base)� � is a Hilbert space.Linear operators:j induces
�j � �
.we write j �
Norm of a vector:,
Unitary operators:A unitary operator unitary is a linear iso-morphism that preserves the norm.
Tallinn Feb 06 – p.17/44
Linear algebra revision
Given a finite set (the base)� � is a Hilbert space.Linear operators:j induces
�j � �
.we write j �Norm of a vector:��� � � � � �$ �� % �$ �� % j �
,
Unitary operators:A unitary operator unitary is a linear iso-morphism that preserves the norm.
Tallinn Feb 06 – p.17/44
Linear algebra revision
Given a finite set (the base)� � is a Hilbert space.Linear operators:j induces
�j � �
.we write j �Norm of a vector:��� � � � � �$ �� % �$ �� % j �
,Unitary operators:A unitary operator j �
unitary is a linear iso-morphism that preserves the norm.
Tallinn Feb 06 – p.17/44
Basics of quantum computation
A pure state over is a vector withunit norm .
A reversible computation is given by aunitary operator unitary .
Tallinn Feb 06 – p.18/44
Basics of quantum computation
A pure state over is a vector � j �with
unit norm
��� � � �
.
A reversible computation is given by aunitary operator unitary .
Tallinn Feb 06 – p.18/44
Basics of quantum computation
A pure state over is a vector � j �with
unit norm
��� � � �
.
A reversible computation is given by aunitary operator j �
unitary .
Tallinn Feb 06 – p.18/44
Quantum computations ( )
Given finite sets (input) and (output):
� �
a finite set , the base of the space of initialheaps,
a heap initialisation vector ,
a finite set , the base of the space ofgarbage states,
a unitary operator unitary .
Tallinn Feb 06 – p.19/44
Quantum computations ( )Given finite sets (input) and (output):
c def � g h �
a finite set , the base of the space of initialheaps,
a heap initialisation vector ,
a finite set , the base of the space ofgarbage states,
a unitary operator unitary .
Tallinn Feb 06 – p.19/44
Quantum computations ( )Given finite sets (input) and (output):
c def � g h �
a finite set , the base of the space of initialheaps,
a heap initialisation vector ,
a finite set , the base of the space ofgarbage states,
a unitary operator unitary .
Tallinn Feb 06 – p.19/44
Quantum computations ( )Given finite sets (input) and (output):
c def � g h �
a finite set , the base of the space of initialheaps,
a heap initialisation vector
i j �
,
a finite set , the base of the space ofgarbage states,
a unitary operator unitary .
Tallinn Feb 06 – p.19/44
Quantum computations ( )Given finite sets (input) and (output):
c def � g h �
a finite set , the base of the space of initialheaps,
a heap initialisation vector
i j �
,
a finite set , the base of the space ofgarbage states,
a unitary operator unitary .
Tallinn Feb 06 – p.19/44
Quantum computations ( )Given finite sets (input) and (output):
c def � g h �
a finite set , the base of the space of initialheaps,
a heap initialisation vector
i j �
,
a finite set , the base of the space ofgarbage states,
a unitary operator j �
unitary .Tallinn Feb 06 – p.19/44
Composing quantum computations
�
>>>>
>>>>
8888
888 �
�
��������
������� �
Tallinn Feb 06 – p.20/44
Composing quantum computations
n d on �
>>>>
>>>>
8888
888 n�
o �
��������
������� o�
o � n
Tallinn Feb 06 – p.20/44
Semantics of quantum computations. . .
. . . is a bit more subtle.
There is no (sensible) operator on vectorspaces, replacing .
Indeed: Forgetting part of a pure stateresults in a mixed state.
Tallinn Feb 06 – p.21/44
Semantics of quantum computations. . .
. . . is a bit more subtle.
There is no (sensible) operator on vectorspaces, replacing .
Indeed: Forgetting part of a pure stateresults in a mixed state.
Tallinn Feb 06 – p.21/44
Semantics of quantum computations. . .
. . . is a bit more subtle.
There is no (sensible) operator on vectorspaces, replacing ~ � j l .
Indeed: Forgetting part of a pure stateresults in a mixed state.
Tallinn Feb 06 – p.21/44
Semantics of quantum computations. . .
. . . is a bit more subtle.
There is no (sensible) operator on vectorspaces, replacing ~ � j l .
Indeed: Forgetting part of a pure stateresults in a mixed state.
Tallinn Feb 06 – p.21/44
Density matrizes
Mixed states can be represented by densitymatrizes .
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
Density matrizes
Mixed states can be represented by densitymatrizes �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
Density matrizes
Mixed states can be represented by densitymatrizes �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
Density matrizes
Mixed states can be represented by densitymatrizes �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
EPR is represented by:
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
Morphisms on density matrizes are calledsuperoperators, these are linear maps, whichare
completely positive, andtrace preserving
Every unitary operator gives rise to asuperoperator .
Tallinn Feb 06 – p.25/44
Superoperators
Morphisms on density matrizes are calledsuperoperators, these are linear maps, whichare
completely positive, andtrace preserving
Every unitary operator gives rise to asuperoperator .
Tallinn Feb 06 – p.25/44
Superoperators
Morphisms on density matrizes are calledsuperoperators, these are linear maps, whichare
completely positive, andtrace preserving
Every unitary operator gives rise to asuperoperator
¡.
Tallinn Feb 06 – p.25/44
Superoperators. . .
There is an operator&' �z ¢ j �super
called partial trace.
E.g. super isrepresented by a matrix.
Tallinn Feb 06 – p.26/44
Superoperators. . .
There is an operator&' �z ¢ j �super
called partial trace.
E.g. &('¤£ ¥z £ ¥ j � � �super
� isrepresented by a
�¦ l §matrix.
Tallinn Feb 06 – p.26/44
Semantics
Every quantum computation gives rise to asuperoperator U super
//
��
OO
U//
Theorem: Every superoperator super
(on finite Hilbert spaces) comes from a quantumcomputation.
Tallinn Feb 06 – p.27/44
Semantics
Every quantum computationq gives rise to asuperoperator Uq j �
super
¨s //©�ª«
��
x ¬ |OO
U n //
Theorem: Every superoperator super
(on finite Hilbert spaces) comes from a quantumcomputation.
Tallinn Feb 06 – p.27/44
Semantics
Every quantum computationq gives rise to asuperoperator Uq j �
super
¨s //©�ª«
��
x ¬ |OO
U n //
Theorem: Every superoperator j �
super
(on finite Hilbert spaces) comes from a quantumcomputation.
Tallinn Feb 06 – p.27/44
Classical vs quantum
classical ( ) quantum ( )
finite sets finite dimensional Hilbert spaces
cartesian product ( ) tensor product ( )
bijections unitary operators
functions superoperators
injective functions ( ) isometries ( )
projections partial trace
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 ( ) isometries ( )
projections partial trace
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 ( ) isometries ( )
projections partial trace
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 ( ) isometries ( )
projections partial trace
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 ( ) isometries ( )
projections partial trace
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 ( ) isometries ( )
projections partial trace
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 ( ) isometries ( )
projections partial trace
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 ( ) isometries ( )
projections partial trace
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 ( ) isometries ( )
projections partial trace
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 ( ) isometries ( )
projections partial trace
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 ( )
projections partial trace
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
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
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
� '&%$ !"# �
Classically
Quantum
input:
output:
Tallinn Feb 06 – p.29/44
Decoherence
� � �
� � '&%$ !"# �
e±° e���
Classically
Quantum
input:
output:
Tallinn Feb 06 – p.29/44
Decoherence
� � �
� � '&%$ !"# �
e±° e���Classically ~� p � � ²
Quantum
input:
output:
Tallinn Feb 06 – p.29/44
Decoherence
� � �
� � '&%$ !"# �
e±° e���Classically ~� p � � ²
Quantum
input:
output:
Tallinn Feb 06 – p.29/44
Decoherence
� � �
� � '&%$ !"# �
e±° e���Classically ~� p � � ²
Quantum
input:
� �� � # � � � � � # � � *
output:
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
QML is a first order functional languages, i.e.programs are well-typed expressions.
QML types are
Qbytes.
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
Qbytes.
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
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 contextof typed variables, e.g.¶·¸ ¹� � � �¶·¸ ¹� � �� � ����� � � � � !"� +, � � &(') "
We can compile QML programs into quantumcomputations (i.e. quantum circuits).
Tallinn Feb 06 – p.32/44
QML basics . . .
A QML program is an expression in a contextof typed variables, e.g.¶·¸ ¹� � � �¶·¸ ¹� � �� � ����� � � � � !"� +, � � &(') "We can compile QML programs into quantumcomputations (i.e. quantum circuits).
Tallinn Feb 06 – p.32/44
QML basics . . .
Forgetting variables has to be explicit.
E.g.
is illegal,but
is ok.
Tallinn Feb 06 – p.33/44
QML basics . . .
Forgetting variables has to be explicit.E.g. ¶º ¹»� � � � �¶ º ¹$ � r � % � �
is illegal,
but
is ok.
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.
is just the identity, but
introduces a measurement (end hencedecoherence).
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 hencedecoherence).
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 hencedecoherence).
Tallinn Feb 06 – p.34/44
QML basics . . .Using
�� �
is only allowed, if the branches areorthogonal, i.e. observable different.
is illegal, but
is ok.
Tallinn Feb 06 – p.35/44
QML basics . . .Using
�� �
is only allowed, if the branches areorthogonal, i.e. observable different.¿º À�Á � � � � � � � �¿º À�Á $ � r � % ¿ � �� � ¿���� � $ � r� %
� +, � $ � r � %is illegal,
but
is ok.
Tallinn Feb 06 – p.35/44
QML basics . . .Using
�� �
is only allowed, if the branches areorthogonal, i.e. observable different.¿º À�Á � � � � � � � �¿º À�Á $ � r � % ¿ � �� � ¿���� � $ � r� %
� +, � $ � r � %is illegal, but¿º À�Á � � � � � � � $ � � %
¿º À�Á $ � r � % ¿ � �� � ¿���� � $ � &(') " r$ � r� % %
� +, � $ � � � !" r$ � r � % %
is ok.Tallinn Feb 06 – p.35/44
QML basics . . .
We can introduce superpositions, e.g.�� �� � � ��� �� � �� � ������ ��� ��� �!" #$ � % � &(') " *
� +�, � ��� ��� �!" # � &(') " *
However, the terms in the superposition haveto be orthogonal.
Tallinn Feb 06 – p.36/44
QML basics . . .
We can introduce superpositions, e.g.�� �� � � ��� �� � �� � ������ ��� ��� �!" #$ � % � &(') " *
� +�, � ��� ��� �!" # � &(') " *
However, the terms in the superposition haveto 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
Correct QML programs are defined by typingrules, e.g.
For each rule we can construct a quantumcomputation, i.e. a circuit.
Tallinn Feb 06 – p.38/44
Compilation
Correct QML programs are defined by typingrules, e.g.
 ÃÄ � ³ ´
r � � ³ r Å � ´ Ã�Æ � " ÇÉÈ ÃËÊ Ì Í $ � r Å % �Ä ÎÐÏ Æ �
For each rule we can construct a quantumcomputation, i.e. a circuit.
Tallinn Feb 06 – p.38/44
Compilation
Correct QML programs are defined by typingrules, e.g.
 ÃÄ � ³ ´
r � � ³ r Å � ´ Ã�Æ � " ÇÉÈ ÃËÊ Ì Í $ � r Å % �Ä ÎÐÏ Æ �
For each rule we can construct a quantumcomputation, 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
A compiler is currently being implemented bymy student Jonathan Grattage (in Haskell).
The output of the compiler are quantumcircuits which can be simulated by a quantumcircuit simulator.
Amr Sabry and Juliana Vizotti (IndianaUniversity) embarked on an independentimplementation of QML based on our paper.
Tallinn Feb 06 – p.40/44
Compiler
A compiler is currently being implemented bymy student Jonathan Grattage (in Haskell).
The output of the compiler are quantumcircuits which can be simulated by a quantumcircuit simulator.
Amr Sabry and Juliana Vizotti (IndianaUniversity) embarked on an independentimplementation of QML based on our paper.
Tallinn Feb 06 – p.40/44
Compiler
A compiler is currently being implemented bymy student Jonathan Grattage (in Haskell).
The output of the compiler are quantumcircuits which can be simulated by a quantumcircuit simulator.
Amr Sabry and Juliana Vizotti (IndianaUniversity) embarked on an independentimplementation of QML based on our paper.
Tallinn Feb 06 – p.40/44
Compiler
A compiler is currently being implemented bymy student Jonathan Grattage (in Haskell).
The output of the compiler are quantumcircuits which can be simulated by a quantumcircuit simulator.
Amr Sabry and Juliana Vizotti (IndianaUniversity) embarked on an independentimplementation of QML based on our paper.
Tallinn Feb 06 – p.40/44
5. Conclusions
1. Semantics of finite classical and quantumcomputation
2. QML basics
3. Compiling QML
4. Conclusions and further work
Tallinn Feb 06 – p.41/44
Conclusions
Our semantic ideas proved useful when designing aquantum programming language, analogous conceptsare modelled by the same syntactic constructs.
Our analysis also highlights the differences betweenclassical and quantum programming.
We have developed an algebra of quantum programswhich for pure programs is complete wrt the semanticsand a normalisation algorithm.
Quantum programming introduces the problem ofcontrol of decoherence, which we address by makingforgetting variables explicit and by having differentif-then-else constructs.
Tallinn Feb 06 – p.42/44
ConclusionsOur semantic ideas proved useful when designing aquantum programming language, analogous conceptsare modelled by the same syntactic constructs.
Our analysis also highlights the differences betweenclassical and quantum programming.
We have developed an algebra of quantum programswhich for pure programs is complete wrt the semanticsand a normalisation algorithm.
Quantum programming introduces the problem ofcontrol of decoherence, which we address by makingforgetting variables explicit and by having differentif-then-else constructs.
Tallinn Feb 06 – p.42/44
ConclusionsOur semantic ideas proved useful when designing aquantum programming language, analogous conceptsare modelled by the same syntactic constructs.
Our analysis also highlights the differences betweenclassical and quantum programming.
We have developed an algebra of quantum programswhich for pure programs is complete wrt the semanticsand a normalisation algorithm.
Quantum programming introduces the problem ofcontrol of decoherence, which we address by makingforgetting variables explicit and by having differentif-then-else constructs.
Tallinn Feb 06 – p.42/44
ConclusionsOur semantic ideas proved useful when designing aquantum programming language, analogous conceptsare modelled by the same syntactic constructs.
Our analysis also highlights the differences betweenclassical and quantum programming.
We have developed an algebra of quantum programswhich for pure programs is complete wrt the semanticsand a normalisation algorithm.
Quantum programming introduces the problem ofcontrol of decoherence, which we address by makingforgetting variables explicit and by having differentif-then-else constructs.
Tallinn Feb 06 – p.42/44
ConclusionsOur semantic ideas proved useful when designing aquantum programming language, analogous conceptsare modelled by the same syntactic constructs.
Our analysis also highlights the differences betweenclassical and quantum programming.
We have developed an algebra of quantum programswhich for pure programs is complete wrt the semanticsand a normalisation algorithm.
Quantum programming introduces the problem ofcontrol of decoherence, which we address by makingforgetting variables explicit and by having differentif-then-else constructs.
Tallinn Feb 06 – p.42/44
Further work
We have to analyze more quantum programs toevaluate the practical usefulness of our approach.
We should be able to extend our algebra andnormalisation to the full language (includingmeasurements).
Are we able to come up with completely newalgorithms using QML?
How to deal with higher order programs?
How to deal with infinite datatypes?
Investigate the similarities/differences between FCCand FQC from a categorical point of view.
Tallinn Feb 06 – p.43/44
Further workWe have to analyze more quantum programs toevaluate the practical usefulness of our approach.
We should be able to extend our algebra andnormalisation to the full language (includingmeasurements).
Are we able to come up with completely newalgorithms using QML?
How to deal with higher order programs?
How to deal with infinite datatypes?
Investigate the similarities/differences between FCCand FQC from a categorical point of view.
Tallinn Feb 06 – p.43/44
Further workWe have to analyze more quantum programs toevaluate the practical usefulness of our approach.
We should be able to extend our algebra andnormalisation to the full language (includingmeasurements).
Are we able to come up with completely newalgorithms using QML?
How to deal with higher order programs?
How to deal with infinite datatypes?
Investigate the similarities/differences between FCCand FQC from a categorical point of view.
Tallinn Feb 06 – p.43/44
Further workWe have to analyze more quantum programs toevaluate the practical usefulness of our approach.
We should be able to extend our algebra andnormalisation to the full language (includingmeasurements).
Are we able to come up with completely newalgorithms using QML?
How to deal with higher order programs?
How to deal with infinite datatypes?
Investigate the similarities/differences between FCCand FQC from a categorical point of view.
Tallinn Feb 06 – p.43/44
Further workWe have to analyze more quantum programs toevaluate the practical usefulness of our approach.
We should be able to extend our algebra andnormalisation to the full language (includingmeasurements).
Are we able to come up with completely newalgorithms using QML?
How to deal with higher order programs?
How to deal with infinite datatypes?
Investigate the similarities/differences between FCCand FQC from a categorical point of view.
Tallinn Feb 06 – p.43/44
Further workWe have to analyze more quantum programs toevaluate the practical usefulness of our approach.
We should be able to extend our algebra andnormalisation to the full language (includingmeasurements).
Are we able to come up with completely newalgorithms using QML?
How to deal with higher order programs?
How to deal with infinite datatypes?
Investigate the similarities/differences between FCCand FQC from a categorical point of view.
Tallinn Feb 06 – p.43/44
Further workWe have to analyze more quantum programs toevaluate the practical usefulness of our approach.
We should be able to extend our algebra andnormalisation to the full language (includingmeasurements).
Are we able to come up with completely newalgorithms using QML?
How to deal with higher order programs?
How to deal with infinite datatypes?
Investigate the similarities/differences between FCCand 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 2005with J.Grattage
Structuring Quantum Effects: Superoperators as Arrows
MFCS 2006with J.Vizzotto and A.Sabry
An Algebra of Pure Quantum Programming QPL 2005with J.Grattage, J.Vizzotto and A.Sabry Tallinn Feb 06 – p.44/44