towards a high level quantum programming language

133
Towards a High Level Quantum Programming Language Thorsten Altenkirch University of Nottingham based on joint work with Jonathan Grattage and discussionswith V.P. Belavkin Towards aHigh LevelQuantum Programming Language – p.1/36

Upload: others

Post on 11-Feb-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Towards aHigh Level

Quantum Programming LanguageThorsten Altenkirch

University of Nottingham

based on joint work with Jonathan Grattage

and discussions with V.P. Belavkin

Towards aHigh LevelQuantum Programming Language – p.1/36

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!

Assumption: Nature is fair. . .

Towards aHigh LevelQuantum Programming Language – p.2/36

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!

Assumption: Nature is fair. . .

Towards aHigh LevelQuantum Programming Language – p.2/36

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!

Assumption: Nature is fair. . .

Towards aHigh LevelQuantum Programming Language – p.2/36

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!

Assumption: Nature is fair. . .

Towards aHigh LevelQuantum Programming Language – p.2/36

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!

Assumption: Nature is fair. . .

Towards aHigh LevelQuantum Programming Language – p.2/36

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!

Assumption: Nature is fair. . .

Towards aHigh LevelQuantum Programming Language – p.2/36

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!

Assumption: Nature is fair. . .

Towards aHigh LevelQuantum Programming Language – p.2/36

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!

Assumption: Nature is fair. . .

Towards aHigh LevelQuantum Programming Language – p.2/36

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!

Assumption: Nature is fair. . .

Towards aHigh LevelQuantum Programming Language – p.2/36

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!

Towards aHigh LevelQuantum Programming Language – p.3/36

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!

Towards aHigh LevelQuantum Programming Language – p.3/36

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!

Towards aHigh LevelQuantum Programming Language – p.3/36

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!

Towards aHigh LevelQuantum Programming Language – p.3/36

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

Draft paper available(Google:Thorsten,functional,quantum)

Compiler under construction (Jonathan)

Towards aHigh LevelQuantum Programming Language – p.4/36

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

Draft paper available(Google:Thorsten,functional,quantum)

Compiler under construction (Jonathan)

Towards aHigh LevelQuantum Programming Language – p.4/36

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

Draft paper available(Google:Thorsten,functional,quantum)

Compiler under construction (Jonathan)

Towards aHigh LevelQuantum Programming Language – p.4/36

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

Draft paper available(Google:Thorsten,functional,quantum)

Compiler under construction (Jonathan)

Towards aHigh LevelQuantum Programming Language – p.4/36

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

Draft paper available(Google:Thorsten,functional,quantum)

Compiler under construction (Jonathan)

Towards aHigh LevelQuantum Programming Language – p.4/36

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

Draft paper available(Google:Thorsten,functional,quantum)

Compiler under construction (Jonathan)

Towards aHigh LevelQuantum Programming Language – p.4/36

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

Draft paper available(Google:Thorsten,functional,quantum)

Compiler under construction (Jonathan)

Towards aHigh LevelQuantum Programming Language – p.4/36

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

Draft paper available(Google:Thorsten,functional,quantum)

Compiler under construction (Jonathan)Towards aHigh LevelQuantum Programming Language – p.4/36

Example: Hadamard operation

Matrix

QML

Towards aHigh LevelQuantum Programming Language – p.5/36

Example: Hadamard operation

Matrix

� ��

� �� �

QML

Towards aHigh LevelQuantum Programming Language – p.5/36

Example: Hadamard operation

Matrix

� ��

� �� �

QML �� �� � � ��� �� � �� � ������ ��� � ��� !" � # � $&%' (

� )�* � ��� � ��� ! � $&%' (

Towards aHigh LevelQuantum Programming Language – p.5/36

Overview

1. Semantics of finite classical and quantumcomputation

2. QML basics

3. Compiling QML

4. Conclusions and further work

Towards aHigh LevelQuantum Programming Language – p.6/36

1. Semantics

1. Semantics of finite classical and quantumcomputation

2. QML basics

3. Compiling QML

4. Conclusions and further work

Towards aHigh LevelQuantum Programming Language – p.7/36

Something we know well . . .

Start with classical computationson 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.

Towards aHigh LevelQuantum Programming Language – p.8/36

Something we know well . . .

Start with classical computationson 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.

Towards aHigh LevelQuantum Programming Language – p.8/36

Something we know well . . .

Start with classical computationson 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.

Towards aHigh LevelQuantum Programming Language – p.8/36

Something we know well . . .

Start with classical computationson 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.

Towards aHigh LevelQuantum Programming Language – p.8/36

Something we know well . . .

Start with classical computationson 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.

Towards aHigh LevelQuantum Programming Language – p.8/36

Something we know well . . .

Start with classical computationson 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.

Towards aHigh LevelQuantum Programming Language – p.8/36

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 ,

Towards aHigh LevelQuantum Programming Language – p.9/36

Classical computation ( )

Given finite sets (input) and (output):

+ ,-. � / 0 �

a finite set of initial heaps ,

an initial heap ,

a finite set of garbage states ,

a bijection ,

Towards aHigh LevelQuantum Programming Language – p.9/36

Classical computation ( )

Given finite sets (input) and (output):

+ ,-. � / 0 �

a finite set of initial heaps ,

an initial heap ,

a finite set of garbage states ,

a bijection ,

Towards aHigh LevelQuantum Programming Language – p.9/36

Classical computation ( )

Given finite sets (input) and (output):

+ ,-. � / 0 �

a finite set of initial heaps ,

an initial heap132 ,

a finite set of garbage states ,

a bijection ,

Towards aHigh LevelQuantum Programming Language – p.9/36

Classical computation ( )

Given finite sets (input) and (output):

+ ,-. � / 0 �

a finite set of initial heaps ,

an initial heap132 ,

a finite set of garbage states ,

a bijection ,

Towards aHigh LevelQuantum Programming Language – p.9/36

Classical computation ( )

Given finite sets (input) and (output):

+ ,-. � / 0 �

a finite set of initial heaps ,

an initial heap132 ,

a finite set of garbage states ,

a bijection 2 4 5 4 ,

Towards aHigh LevelQuantum Programming Language – p.9/36

Semantics

A classical computation

induces a function U by

U

Theorem Any function (on finitesets ) can be realized by a quantumcomputation.

Towards aHigh LevelQuantum Programming Language – p.10/36

Semantics

A classical computation6 �" 7 7 7 1 2 7 7 2 4 5 4 #

induces a function U 6 2 by

U 68 � 9;: " 1 7 8 #

Theorem Any function (on finitesets ) can be realized by a quantumcomputation.

Towards aHigh LevelQuantum Programming Language – p.10/36

Semantics

A classical computation6 �" 7 7 7 1 2 7 7 2 4 5 4 #

induces a function U 6 2 by

U 68 � 9;: " 1 7 8 #

Theorem Any function 2 (on finitesets 7 ) can be realized by a quantumcomputation.

Towards aHigh LevelQuantum Programming Language – p.10/36

Composing classical computations

>>>>

>>>>

8888

888 �

��������

������� �

Theorem:U U U

Towards aHigh LevelQuantum Programming Language – p.11/36

Composing classical computations

< , =< �

>>>>

>>>>

8888

888 <�

= �

��������

������� =�

= � <

Theorem:U U U

Towards aHigh LevelQuantum Programming Language – p.11/36

Composing classical computations

< , =< �

>>>>

>>>>

8888

888 <�

= �

��������

������� =�

= � <Theorem:

U

" > 6 # �" U

# >" U 6 #

Towards aHigh LevelQuantum Programming Language – p.11/36

Coming next: Quantum computations

Develop analogously to . . .

Towards aHigh LevelQuantum Programming Language – p.12/36

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.

Towards aHigh LevelQuantum Programming Language – p.13/36

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.

Towards aHigh LevelQuantum Programming Language – p.13/36

Linear algebra revision

Given a finite set (the base)� is a Hilbert space.Linear operators:2 induces

?2 .we write 2 �

Norm of a vector:,

Unitary operators:A unitary operator unitary is a linear iso-morphism that preserves the norm.

Towards aHigh LevelQuantum Programming Language – p.13/36

Linear algebra revision

Given a finite set (the base)� is a Hilbert space.Linear operators:2 induces

?2 .we write 2 �Norm of a vector:@�A @ � B C D" A 8 # E" A 8 # 2 F

,

Unitary operators:A unitary operator unitary is a linear iso-morphism that preserves the norm.

Towards aHigh LevelQuantum Programming Language – p.13/36

Linear algebra revision

Given a finite set (the base)� is a Hilbert space.Linear operators:2 induces

?2 .we write 2 �Norm of a vector:@�A @ � B C D" A 8 # E" A 8 # 2 F

,Unitary operators:A unitary operator 2 �

unitary is a linear iso-morphism that preserves the norm.

Towards aHigh LevelQuantum Programming Language – p.13/36

Basics of quantum computation

A pure state over is a vector withunit norm .

A reversible computation is given by aunitary operator unitary .

Towards aHigh LevelQuantum Programming Language – p.14/36

Basics of quantum computation

A pure state over is a vector A 2 withunit norm

@�A @ � �

.

A reversible computation is given by aunitary operator unitary .

Towards aHigh LevelQuantum Programming Language – p.14/36

Basics of quantum computation

A pure state over is a vector A 2 withunit norm

@�A @ � �

.

A reversible computation is given by aunitary operator 2 �

unitary .

Towards aHigh LevelQuantum Programming Language – p.14/36

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 .

Towards aHigh LevelQuantum Programming Language – p.15/36

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

+ ,-. � / 0 �

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 .

Towards aHigh LevelQuantum Programming Language – p.15/36

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

+ ,-. � / 0 �

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 .

Towards aHigh LevelQuantum Programming Language – p.15/36

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

+ ,-. � / 0 �

a finite set , the base of the space of initialheaps,

a heap initialisation vector

1 2 ,

a finite set , the base of the space ofgarbage states,

a unitary operator unitary .

Towards aHigh LevelQuantum Programming Language – p.15/36

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

+ ,-. � / 0 �

a finite set , the base of the space of initialheaps,

a heap initialisation vector

1 2 ,

a finite set , the base of the space ofgarbage states,

a unitary operator unitary .

Towards aHigh LevelQuantum Programming Language – p.15/36

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

+ ,-. � / 0 �

a finite set , the base of the space of initialheaps,

a heap initialisation vector

1 2 ,

a finite set , the base of the space ofgarbage states,

a unitary operator 2 �

unitary .Towards aHigh LevelQuantum Programming Language – p.15/36

Composing quantum computations

>>>>

>>>>

8888

888 �

��������

������� �

Towards aHigh LevelQuantum Programming Language – p.16/36

Composing quantum computations

< , =< �

>>>>

>>>>

8888

888 <�

= �

��������

������� =�

= � <

Towards aHigh LevelQuantum Programming Language – p.16/36

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.

Towards aHigh LevelQuantum Programming Language – p.17/36

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.

Towards aHigh LevelQuantum Programming Language – p.17/36

Semantics of quantum computations. . .

. . . is a bit more subtle.

There is no (sensible) operator on vectorspaces, replacing 9 : 2 4 .

Indeed: Forgetting part of a pure stateresults in a mixed state.

Towards aHigh LevelQuantum Programming Language – p.17/36

Semantics of quantum computations. . .

. . . is a bit more subtle.

There is no (sensible) operator on vectorspaces, replacing 9 : 2 4 .

Indeed: Forgetting part of a pure stateresults in a mixed state.

Towards aHigh LevelQuantum Programming Language – p.17/36

Density matrices and superoperators

Mixed states are represented by densitymatrices.

Operations on mixed states (i.e. densitymatrices) are represented by superoperators.

Every unitary operator gives rise to asuperoperator .

There is an operator

super

called partial trace.

Towards aHigh LevelQuantum Programming Language – p.18/36

Density matrices and superoperators

Mixed states are represented by densitymatrices.

Operations on mixed states (i.e. densitymatrices) are represented by superoperators.

Every unitary operator gives rise to asuperoperator .

There is an operator

super

called partial trace.

Towards aHigh LevelQuantum Programming Language – p.18/36

Density matrices and superoperators

Mixed states are represented by densitymatrices.

Operations on mixed states (i.e. densitymatrices) are represented by superoperators.

Every unitary operator gives rise to asuperoperator .

There is an operator

super

called partial trace.

Towards aHigh LevelQuantum Programming Language – p.18/36

Density matrices and superoperators

Mixed states are represented by densitymatrices.

Operations on mixed states (i.e. densitymatrices) are represented by superoperators.

Every unitary operator gives rise to asuperoperator

G.

There is an operator

super

called partial trace.

Towards aHigh LevelQuantum Programming Language – p.18/36

Density matrices and superoperators

Mixed states are represented by densitymatrices.

Operations on mixed states (i.e. densitymatrices) are represented by superoperators.

Every unitary operator gives rise to asuperoperator

G.

There is an operatorHJILKNM O 2 �

super

called partial trace.Towards aHigh LevelQuantum Programming Language – p.18/36

Semantics

Every quantum computation gives rise to asuperoperator U super

//

��

OO

U//

Theorem: Every superoperator super

(on finite Hilbert spaces) comes from a quantumcomputation.

Towards aHigh LevelQuantum Programming Language – p.19/36

Semantics

Every quantum computation 6 gives rise to asuperoperator U 6 2 �

super

PRQ //S;TU

��

V W XZYOO

U < //

Theorem: Every superoperator super

(on finite Hilbert spaces) comes from a quantumcomputation.

Towards aHigh LevelQuantum Programming Language – p.19/36

Semantics

Every quantum computation 6 gives rise to asuperoperator U 6 2 �

super

PRQ //S;TU

��

V W XZYOO

U < //

Theorem: Every superoperator 2 �

super

(on finite Hilbert spaces) comes from a quantumcomputation.

Towards aHigh LevelQuantum Programming Language – p.19/36

Classical vs quantum

classical quantum

finite sets finite dimensional Hilbert spaces

bijections unitary operators

cartesian product ( ) tensor product ( )

functions superoperators

projections partial trace

Towards aHigh LevelQuantum Programming Language – p.20/36

Classical vs quantum

classical quantum

finite sets finite dimensional Hilbert spaces

bijections unitary operators

cartesian product ( ) tensor product ( )

functions superoperators

projections partial trace

Towards aHigh LevelQuantum Programming Language – p.20/36

Classical vs quantum

classical quantum

finite sets

finite dimensional Hilbert spaces

bijections unitary operators

cartesian product ( ) tensor product ( )

functions superoperators

projections partial trace

Towards aHigh LevelQuantum Programming Language – p.20/36

Classical vs quantum

classical quantum

finite sets finite dimensional Hilbert spaces

bijections unitary operators

cartesian product ( ) tensor product ( )

functions superoperators

projections partial trace

Towards aHigh LevelQuantum Programming Language – p.20/36

Classical vs quantum

classical quantum

finite sets finite dimensional Hilbert spaces

bijections

unitary operators

cartesian product ( ) tensor product ( )

functions superoperators

projections partial trace

Towards aHigh LevelQuantum Programming Language – p.20/36

Classical vs quantum

classical quantum

finite sets finite dimensional Hilbert spaces

bijections unitary operators

cartesian product ( ) tensor product ( )

functions superoperators

projections partial trace

Towards aHigh LevelQuantum Programming Language – p.20/36

Classical vs quantum

classical quantum

finite sets finite dimensional Hilbert spaces

bijections unitary operators

cartesian product ( [ )

tensor product ( )

functions superoperators

projections partial trace

Towards aHigh LevelQuantum Programming Language – p.20/36

Classical vs quantum

classical quantum

finite sets finite dimensional Hilbert spaces

bijections unitary operators

cartesian product ( [ ) tensor product ( \)

functions superoperators

projections partial trace

Towards aHigh LevelQuantum Programming Language – p.20/36

Classical vs quantum

classical quantum

finite sets finite dimensional Hilbert spaces

bijections unitary operators

cartesian product ( [ ) tensor product ( \)functions

superoperators

projections partial trace

Towards aHigh LevelQuantum Programming Language – p.20/36

Classical vs quantum

classical quantum

finite sets finite dimensional Hilbert spaces

bijections unitary operators

cartesian product ( [ ) tensor product ( \)functions superoperators

projections partial trace

Towards aHigh LevelQuantum Programming Language – p.20/36

Classical vs quantum

classical quantum

finite sets finite dimensional Hilbert spaces

bijections unitary operators

cartesian product ( [ ) tensor product ( \)functions superoperators

projections

partial trace

Towards aHigh LevelQuantum Programming Language – p.20/36

Classical vs quantum

classical quantum

finite sets finite dimensional Hilbert spaces

bijections unitary operators

cartesian product ( [ ) tensor product ( \)functions superoperators

projections partial trace

Towards aHigh LevelQuantum Programming Language – p.20/36

Decoherence

� '&%$ !"# �

Classically

Quantum

input:

output:

Towards aHigh LevelQuantum Programming Language – p.21/36

Decoherence

� ] �

^ � '&%$ !"# �

-`_ -bac

Classically

Quantum

input:

output:

Towards aHigh LevelQuantum Programming Language – p.21/36

Decoherence

� ] �

^ � '&%$ !"# �

-`_ -bacClassically 9L: > d � e

Quantum

input:

output:

Towards aHigh LevelQuantum Programming Language – p.21/36

Decoherence

� ] �

^ � '&%$ !"# �

-`_ -bacClassically 9L: > d � e

Quantum

input:

output:

Towards aHigh LevelQuantum Programming Language – p.21/36

Decoherence

� ] �

^ � '&%$ !"# �

-`_ -bacClassically 9L: > d � e

Quantum

input:

� :f � ! ^ g : f � ! ^ g (

output:

Towards aHigh LevelQuantum Programming Language – p.21/36

Decoherence

� ] �

^ � '&%$ !"# �

-`_ -bacClassically 9L: > d � e

Quantum

input:

� :f � ! ^ g : f � ! ^ g (

output:: � � ! ^ g ( : � � ! � g (

Towards aHigh LevelQuantum Programming Language – p.21/36

2. QML basics

1. Semantics of finite classical and quantumcomputation

2. QML basics

3. Compiling QML

4. Conclusions and further work

Towards aHigh LevelQuantum Programming Language – p.22/36

QML basics

QML is a first order functional languages, i.e.programs are well-typed expressions.

QML types are

Qbits

Qbytes.

Towards aHigh LevelQuantum Programming Language – p.23/36

QML basics

QML is a first order functional languages, i.e.programs are well-typed expressions.

QML types are

Qbits

Qbytes.

Towards aHigh LevelQuantum Programming Language – p.23/36

QML basics

QML is a first order functional languages, i.e.programs are well-typed expressions.

QML types are

� 7 h i 7 h i

Qbits

Qbytes.

Towards aHigh LevelQuantum Programming Language – p.23/36

QML basics

QML is a first order functional languages, i.e.programs are well-typed expressions.

QML types are

� 7 h i 7 h iQbits � � � �

Qbytes.

Towards aHigh LevelQuantum Programming Language – p.23/36

QML basics

QML is a first order functional languages, i.e.programs are well-typed expressions.

QML types are

� 7 h i 7 h iQbits � � � �Qbytesj� � � � � � � � � �.

Towards aHigh LevelQuantum Programming Language – p.23/36

QML basics . . .

A QML program is an expression in a contextof typed variables, e.g.�k l $� � � ��k l $� � �� � ����� � � � ���

� )* � � $&%'

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

Towards aHigh LevelQuantum Programming Language – p.24/36

QML basics . . .

A QML program is an expression in a contextof typed variables, e.g.�k l $� � � ��k l $� � �� � ����� � � � ���

� )* � � $&%' We can compile QML programs into quantumcomputations (i.e. quantum circuits).

Towards aHigh LevelQuantum Programming Language – p.24/36

QML basics . . .

Forgetting variables has to be explicit.

E.g.

is illegal,but

is ok.

Towards aHigh LevelQuantum Programming Language – p.25/36

QML basics . . .

Forgetting variables has to be explicit.E.g.� � $m� � � � �� � $" � 7 n # � �

is illegal,

but

is ok.

Towards aHigh LevelQuantum Programming Language – p.25/36

QML basics . . .

Forgetting variables has to be explicit.E.g.� � $m� � � � �� � $" � 7 n # � �

is illegal,but � � $m� � � � �� � $" � 7 n # � � � n (

is ok.

Towards aHigh LevelQuantum Programming Language – p.25/36

QML basics . . .There are two different if-then-else (or moregenerally case) constructs.

is just the identity, but

introduces a measurement (end hencedecoherence).

Towards aHigh LevelQuantum Programming Language – p.26/36

QML basics . . .There are two different if-then-else (or moregenerally case) constructs.o � � � �o � � � � � ������ � $&%'

� )* � � � � � is just the identity,

but

introduces a measurement (end hencedecoherence).

Towards aHigh LevelQuantum Programming Language – p.26/36

QML basics . . .There are two different if-then-else (or moregenerally case) constructs.o � � � �o � � � � � ������ � $&%'

� )* � � � � � is just the identity, butp � � � � � �p � � � � �� � ���� � � $&%'

� )�* � � � ���

introduces a measurement (end hencedecoherence). Towards aHigh LevelQuantum Programming Language – p.26/36

QML basics . . .Using

�� �

is only allowed, if the branches areorthogonal, i.e. observable different.

is illegal, but

is ok.

Towards aHigh LevelQuantum Programming Language – p.27/36

QML basics . . .Using

�� �

is only allowed, if the branches areorthogonal, i.e. observable different.q �r �s � � � � � � � �q �r �s " � 7 n # q � �� � q���� � " n 7� #

� )* � " � 7 n #is illegal,

but

is ok.

Towards aHigh LevelQuantum Programming Language – p.27/36

QML basics . . .Using

�� �

is only allowed, if the branches areorthogonal, i.e. observable different.q �r �s � � � � � � � �q �r �s " � 7 n # q � �� � q���� � " n 7� #

� )* � " � 7 n #is illegal, butq �r �s � � � � � � � " � � #q �r �s " � 7 n # q � �� � q���� � " � $&%' 7" n 7� # #

� )* � " � � � � 7" � 7 n # #

is ok.Towards aHigh LevelQuantum Programming Language – p.27/36

QML basics . . .

We can introduce superpositions, e.g.�� �� � � ��� �� � �� � ������ ��� � ��� !" � # � $&%' (

� )�* � ��� � ��� ! � $&%' (

However, the terms in the superposition haveto be orthogonal.

Towards aHigh LevelQuantum Programming Language – p.28/36

QML basics . . .

We can introduce superpositions, e.g.�� �� � � ��� �� � �� � ������ ��� � ��� !" � # � $&%' (

� )�* � ��� � ��� ! � $&%' (

However, the terms in the superposition haveto be orthogonal.

Towards aHigh LevelQuantum Programming Language – p.28/36

3. Compiling QML

1. Semantics of finite classical and quantumcomputation

2. QML basics

3. Compiling QML

4. Conclusions and further work

Towards aHigh LevelQuantum Programming Language – p.29/36

Compilation

Correct QML programs are defined by typingrules, e.g.

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

Towards aHigh LevelQuantum Programming Language – p.30/36

Compilation

Correct QML programs are defined by typingrules, e.g.

t uv � h i

7 w � h 7 x � i u�y � z {|~}t u�� � � " w 7 x # �v ��� y �

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

Towards aHigh LevelQuantum Programming Language – p.30/36

Compilation

Correct QML programs are defined by typingrules, e.g.

t uv � h i

7 w � h 7 x � i u�y � z {|~}t u�� � � " w 7 x # �v ��� y �

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

Towards aHigh LevelQuantum Programming Language – p.30/36

-elim t uv � h i

7 w � h 7 x � i u�y � z { |}t u�� � � " w 7 x # �v � � y �

;;;;

;

�����

;;;;

;;

;;;;

;;�

������

������ �

Towards aHigh LevelQuantum Programming Language – p.31/36

-elim t uv � h i

7 w � h 7 x � i u�y � z { |}t u�� � � " w 7 x # �v � � y �

t ����� � �

;;;;

;�

��M � � � ������

�� �

� �

;;;;

;;

;;;;

;; ��

� �

������

������ ��

Towards aHigh LevelQuantum Programming Language – p.31/36

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.

Towards aHigh LevelQuantum Programming Language – p.32/36

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.

Towards aHigh LevelQuantum Programming Language – p.32/36

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.

Towards aHigh LevelQuantum Programming Language – p.32/36

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.

Towards aHigh LevelQuantum Programming Language – p.32/36

4. Conclusions

1. Semantics of finite classical and quantumcomputation

2. QML basics

3. Compiling QML

4. Conclusions and further work

Towards aHigh LevelQuantum Programming Language – p.33/36

Conclusions

Our semantic ideas proved useful whendesigning a quantum programming language,analogous concepts are modelled by thesame syntactic constructs.

Our analysis also highlights the differencesbetween classical and quantumprogramming.

Quantum programming introduces theproblem of control of decoherence, which weaddress by making forgetting variablesexplicit and by having different if-then-elseconstructs.

Towards aHigh LevelQuantum Programming Language – p.34/36

ConclusionsOur semantic ideas proved useful whendesigning a quantum programming language,analogous concepts are modelled by thesame syntactic constructs.

Our analysis also highlights the differencesbetween classical and quantumprogramming.

Quantum programming introduces theproblem of control of decoherence, which weaddress by making forgetting variablesexplicit and by having different if-then-elseconstructs.

Towards aHigh LevelQuantum Programming Language – p.34/36

ConclusionsOur semantic ideas proved useful whendesigning a quantum programming language,analogous concepts are modelled by thesame syntactic constructs.

Our analysis also highlights the differencesbetween classical and quantumprogramming.

Quantum programming introduces theproblem of control of decoherence, which weaddress by making forgetting variablesexplicit and by having different if-then-elseconstructs.

Towards aHigh LevelQuantum Programming Language – p.34/36

ConclusionsOur semantic ideas proved useful whendesigning a quantum programming language,analogous concepts are modelled by thesame syntactic constructs.

Our analysis also highlights the differencesbetween classical and quantumprogramming.

Quantum programming introduces theproblem of control of decoherence, which weaddress by making forgetting variablesexplicit and by having different if-then-elseconstructs.

Towards aHigh LevelQuantum Programming Language – p.34/36

Further work

We have to analyze more quantum programsto evaluate the practical usefulness of ourapproach.

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/differencesbetween FCC and FQC from a categoricalpoint of view.

Towards aHigh LevelQuantum Programming Language – p.35/36

Further work

We have to analyze more quantum programsto evaluate the practical usefulness of ourapproach.

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/differencesbetween FCC and FQC from a categoricalpoint of view.

Towards aHigh LevelQuantum Programming Language – p.35/36

Further work

We have to analyze more quantum programsto evaluate the practical usefulness of ourapproach.

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/differencesbetween FCC and FQC from a categoricalpoint of view.

Towards aHigh LevelQuantum Programming Language – p.35/36

Further work

We have to analyze more quantum programsto evaluate the practical usefulness of ourapproach.

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/differencesbetween FCC and FQC from a categoricalpoint of view.

Towards aHigh LevelQuantum Programming Language – p.35/36

Further work

We have to analyze more quantum programsto evaluate the practical usefulness of ourapproach.

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/differencesbetween FCC and FQC from a categoricalpoint of view.

Towards aHigh LevelQuantum Programming Language – p.35/36

Further work

We have to analyze more quantum programsto evaluate the practical usefulness of ourapproach.

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/differencesbetween FCC and FQC from a categoricalpoint of view.

Towards aHigh LevelQuantum Programming Language – p.35/36

The end

Thank you for your attention.

Towards aHigh LevelQuantum Programming Language – p.36/36