Functional Quantum Programming Thorsten Altenkirch University of - - PowerPoint PPT Presentation

functional quantum programming
SMART_READER_LITE
LIVE PREVIEW

Functional Quantum Programming Thorsten Altenkirch University of - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

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

slide-2
SLIDE 2

Background

Tallinn Feb 06 – p.2/44

slide-3
SLIDE 3

Background

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

Tallinn Feb 06 – p.2/44

slide-4
SLIDE 4

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

slide-5
SLIDE 5

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

slide-6
SLIDE 6

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

slide-7
SLIDE 7

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

slide-8
SLIDE 8

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

slide-9
SLIDE 9

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

slide-10
SLIDE 10

The quantum software crisis

Tallinn Feb 06 – p.3/44

slide-11
SLIDE 11

The quantum software crisis

Quantum algorithms are usually presented using the circuit model.

Tallinn Feb 06 – p.3/44

slide-12
SLIDE 12

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

slide-13
SLIDE 13

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

slide-14
SLIDE 14

QML

Tallinn Feb 06 – p.4/44

slide-15
SLIDE 15

QML

QML: a functional language for quantum computations

  • n finite types.

Tallinn Feb 06 – p.4/44

slide-16
SLIDE 16

QML

QML: a functional language for quantum computations

  • n finite types.

Quantum control and quantum data.

Tallinn Feb 06 – p.4/44

slide-17
SLIDE 17

QML

QML: a functional language for quantum computations

  • n finite types.

Quantum control and quantum data. Design guided by semantics

Tallinn Feb 06 – p.4/44

slide-18
SLIDE 18

QML

QML: a functional language for quantum computations

  • n 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

slide-19
SLIDE 19

QML

QML: a functional language for quantum computations

  • n 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

slide-20
SLIDE 20

QML

QML: a functional language for quantum computations

  • n 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

slide-21
SLIDE 21

Example: Hadamard operation

Tallinn Feb 06 – p.5/44

slide-22
SLIDE 22

Example: Hadamard operation

Matrix

✝ ✞ ✟ ✞ ✞ ✞ ✠ ✞

Tallinn Feb 06 – p.5/44

slide-23
SLIDE 23

Example: Hadamard operation

Matrix

✝ ✞ ✟ ✞ ✞ ✞ ✠ ✞

QML

✡☞☛ ✌✎✍ ✏ ✑ ✏ ✡☞☛ ✌☞✒ ✝ ✓✔ ✕ ✒ ✖ ✗✙✘ ✚ ✛✢✜ ✣☞✤ ✥✙✦✧ ★✩ ✠ ✞ ✪ ✜ ✫✭✬✮ ✧ ✯ ✘ ✰✙✱ ✘ ✛✢✜ ✣☞✤ ✥✙✦✧ ★ ✜ ✫✭✬ ✮ ✧ ✯

Tallinn Feb 06 – p.5/44

slide-24
SLIDE 24

Deutsch algorithm

✲✴✳✵ ✶✸✷✹ ✺✼✻ ✽✿✾ ✽ ✾ ❀❂❁ ✲✴✳✵ ✶✸✷✹ ✺✴❃ ❄❆❅ ❇❉❈ ❊ ✁●❋■❍ ❏ ✄ ❅ ❑▲ ▼ ◆●❖ P✿◗ ❘❚❙❯ ❱ ❖ ❲❨❳❩ ❯ ❬ ❊ ❭ ❈ ❪ ✁ ❖ ❲ ❳❩ ❯ ❍ ❑▲ ❃ ❊ ❭ ❈ ❪ ◆●❖ P ◗ ❘ ❙❯ ❱ ✁❴❫ ❵ ✄ ❖ ❲ ❳❩ ❯ ❬ ❈ ❇❉❛ ❈ ◆ ✁❴❫ ❵ ✄ ❖ P✿◗ ❘❚❙❯ ❱ ❖ ❲ ❳❩ ❯ ❬ ❈ ❇❉❛ ❈ ✁ ❖ P ◗ ❘ ❙❯ ❍ ❑▲ ❄ ❊ ❭ ❈ ❪ ◆ ✁❴❫ ❵ ✄ ❖ P✿◗ ❘❚❙❯ ❱ ❖ ❲ ❳❩ ❯ ❬ ❈ ❇❉❛ ❈ ◆●❖ P ◗ ❘ ❙❯ ❱ ✁❴❫ ❵ ✄ ❖ ❲ ❳❩ ❯ ❬ ❑ ❪ ❜ ❋

Tallinn Feb 06 – p.6/44

slide-25
SLIDE 25

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

slide-26
SLIDE 26
  • 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

slide-27
SLIDE 27

Something we know well . . .

Tallinn Feb 06 – p.9/44

slide-28
SLIDE 28

Something we know well . . .

Start with classical computations on finite types.

Tallinn Feb 06 – p.9/44

slide-29
SLIDE 29

Something we know well . . .

Start with classical computations on finite types. Quantum mechanics is time-reversible. . .

Tallinn Feb 06 – p.9/44

slide-30
SLIDE 30

Something we know well . . .

Start with classical computations on finite types. Quantum mechanics is time-reversible. . . . . . hence quantum computation is based on reversible

  • perations.

Tallinn Feb 06 – p.9/44

slide-31
SLIDE 31

Something we know well . . .

Start with classical computations on finite types. Quantum mechanics is time-reversible. . . . . . hence quantum computation is based on reversible

  • perations.

However: Newtonian mechanics, Maxwellian electrodynamics are also time-reversible. . .

Tallinn Feb 06 – p.9/44

slide-32
SLIDE 32

Something we know well . . .

Start with classical computations on finite types. Quantum mechanics is time-reversible. . . . . . hence quantum computation is based on reversible

  • perations.

However: Newtonian mechanics, Maxwellian electrodynamics are also time-reversible. . . . . . hence classical computation should be based on reversible operations.

Tallinn Feb 06 – p.9/44

slide-33
SLIDE 33

Classical computation ( )

Tallinn Feb 06 – p.10/44

slide-34
SLIDE 34

Classical computation ( )

Given finite sets (input) and (output):

❝ ❞ ❡ ❢
  • Tallinn Feb 06 – p.10/44
slide-35
SLIDE 35

Classical computation ( )

Given finite sets (input) and (output):

❝ ❞ ❡ ❢
  • a finite set of initial heaps

,

Tallinn Feb 06 – p.10/44

slide-36
SLIDE 36

Classical computation ( )

Given finite sets (input) and (output):

❝ ❞ ❡ ❢
  • a finite set of initial heaps

, an initial heap

✐❦❥

,

Tallinn Feb 06 – p.10/44

slide-37
SLIDE 37

Classical computation ( )

Given finite sets (input) and (output):

❝ ❞ ❡ ❢
  • a finite set of initial heaps

, an initial heap

✐❦❥

, a finite set of garbage states ,

Tallinn Feb 06 – p.10/44

slide-38
SLIDE 38

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

slide-39
SLIDE 39

Composing classical computations

Tallinn Feb 06 – p.11/44

slide-40
SLIDE 40

Composing classical computations

♥ ❞ ♦ ♥
✕ ♥

Tallinn Feb 06 – p.11/44

slide-41
SLIDE 41

Composing classical computations

♥ ❞ ♦ ♥
✕ ♥

Theorem: U

✩ ♣q ✪ ✝ ✩

U

✪ ♣ ✩

U

q ✪

Tallinn Feb 06 – p.11/44

slide-42
SLIDE 42

Extensional equality

Tallinn Feb 06 – p.12/44

slide-43
SLIDE 43

Extensional equality

A classical computation

q ✝ ✩ r ✐ r r ✪

induces a function U

q ❥

by

❧ s
t✈✉
  • ✇②①④③
⑤ ⑥
  • U
  • Tallinn Feb 06 – p.12/44
slide-44
SLIDE 44

Extensional equality

A classical computation

q ✝ ✩ r ✐ r r ✪

induces a function U

q ❥

by

❧ s
t✈✉
  • ✇②①④③
⑤ ⑥
  • U
  • We say that two computations are

extensionally equivalent, if they give rise to the same function.

Tallinn Feb 06 – p.12/44

slide-45
SLIDE 45

Extensional equality . . .

Theorem:

U

✩ ♣q ✪ ✝ ✩

U

✪ ♣ ✩

U

q ✪

Tallinn Feb 06 – p.13/44

slide-46
SLIDE 46

Extensional equality . . .

Theorem:

U

✩ ♣q ✪ ✝ ✩

U

✪ ♣ ✩

U

q ✪

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

Tallinn Feb 06 – p.13/44

slide-47
SLIDE 47

Extensional equality . . .

Theorem:

U

✩ ♣q ✪ ✝ ✩

U

✪ ♣ ✩

U

q ✪

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

  • n finite

sets

r

can be realized by a computation.

Tallinn Feb 06 – p.13/44

slide-48
SLIDE 48

Extensional equality . . .

Theorem:

U

✩ ♣q ✪ ✝ ✩

U

✪ ♣ ✩

U

q ✪

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

  • n finite

sets

r

can be realized by a computation. Translation for Category Theoreticians:

U is full and faithful.

Tallinn Feb 06 – p.13/44

slide-49
SLIDE 49

Example

:

function

⑦⑨⑧ ❥ ✩ ✟ r ✟ ✪ ✟ ⑦⑩⑧ ✩ ✒ r ❶ ✪ ✝ ✒

Tallinn Feb 06 – p.14/44

slide-50
SLIDE 50

Example

:

function

⑦⑨⑧ ❥ ✩ ✟ r ✟ ✪ ✟ ⑦⑩⑧ ✩ ✒ r ❶ ✪ ✝ ✒

computation

✟ ✟ ✟
  • ❡❸❷

Tallinn Feb 06 – p.14/44

slide-51
SLIDE 51

Example :

function

❺ ❥ ✟ ✩ ✟ r ✟ ✪ ❺ ✒ ✝ ✩ ✒ r ✒ ✪

Tallinn Feb 06 – p.15/44

slide-52
SLIDE 52

Example :

function

❺ ❥ ✟ ✩ ✟ r ✟ ✪ ❺ ✒ ✝ ✩ ✒ r ✒ ✪

computation

❻ ✍ ✟ ❼ ❻ ✍ ✟ ❽ ✍ ✟
✍ ✟ ❾ ❾ ❥ ✩ ✟ r ✟ ✪ ✩ ✟ r ✟ ✪ ❾ ✩ ❽ r ✒ ✪ ✝ ✩ ❽ r ✒ ✪ ❾ ✩ ✞ r ✒ ✪ ✝ ✩ ✞ r ❿ ✒ ✪

Tallinn Feb 06 – p.15/44

slide-53
SLIDE 53
  • 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

slide-54
SLIDE 54

Linear algebra revision

Tallinn Feb 06 – p.17/44

slide-55
SLIDE 55

Linear algebra revision

Given a finite set (the base)

➀ ✝

is a Hilbert space.

Tallinn Feb 06 – p.17/44

slide-56
SLIDE 56

Linear algebra revision

Given a finite set (the base)

➀ ✝

is a Hilbert space. Linear operators:

induces

➁ ❥ ➀ ➂

. we write

❥ ✑

Tallinn Feb 06 – p.17/44

slide-57
SLIDE 57

Linear algebra revision

Given a finite set (the base)

➀ ✝

is a Hilbert space. Linear operators:

induces

➁ ❥ ➀ ➂

. we write

❥ ✑

Norm of a vector:

➃✢➄ ➃ ✝ ➅ ➆ ➀ ✩ ➄➇ ✪ ➈ ✩ ➄➇ ✪ ❥ ➉

,

Tallinn Feb 06 – p.17/44

slide-58
SLIDE 58

Linear algebra revision

Given a finite set (the base)

➀ ✝

is a Hilbert space. Linear operators:

induces

➁ ❥ ➀ ➂

. we write

❥ ✑

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

slide-59
SLIDE 59

Basics of quantum computation

Tallinn Feb 06 – p.18/44

slide-60
SLIDE 60

Basics of quantum computation

A pure state over is a vector

➄ ❥ ➀

with unit norm

➃✢➄ ➃ ✝ ✞

.

Tallinn Feb 06 – p.18/44

slide-61
SLIDE 61

Basics of quantum computation

A pure state over is a vector

➄ ❥ ➀

with unit norm

➃✢➄ ➃ ✝ ✞

. A reversible computation is given by a unitary operator

❥ ✑

unitary

.

Tallinn Feb 06 – p.18/44

slide-62
SLIDE 62

Quantum computations ( )

Tallinn Feb 06 – p.19/44

slide-63
SLIDE 63

Quantum computations ( )

Given finite sets (input) and (output):

❝ ❞ ❡ ❢
  • Tallinn Feb 06 – p.19/44
slide-64
SLIDE 64

Quantum computations ( )

Given finite sets (input) and (output):

❝ ❞ ❡ ❢
  • a finite set

, the base of the space of initial heaps,

Tallinn Feb 06 – p.19/44

slide-65
SLIDE 65

Quantum computations ( )

Given finite sets (input) and (output):

❝ ❞ ❡ ❢
  • a finite set

, the base of the space of initial heaps, a heap initialisation vector

✐ ❥ ➊

,

Tallinn Feb 06 – p.19/44

slide-66
SLIDE 66

Quantum computations ( )

Given finite sets (input) and (output):

❝ ❞ ❡ ❢
  • a finite set

, the base of the space of initial heaps, a heap initialisation vector

✐ ❥ ➊

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

Tallinn Feb 06 – p.19/44

slide-67
SLIDE 67

Quantum computations ( )

Given finite sets (input) and (output):

❝ ❞ ❡ ❢
  • a finite set

, the base of the space of initial heaps, a heap initialisation vector

✐ ❥ ➊

, a finite set , the base of the space of garbage states, a unitary operator

❥ ✑

unitary

.

Tallinn Feb 06 – p.19/44

slide-68
SLIDE 68

Composing quantum computations

Tallinn Feb 06 – p.20/44

slide-69
SLIDE 69

Composing quantum computations

♥ ❞ ♦ ♥
✕ ♥

Tallinn Feb 06 – p.20/44

slide-70
SLIDE 70

Semantics of quantum computations. .

Tallinn Feb 06 – p.21/44

slide-71
SLIDE 71

Semantics of quantum computations. .

. . . is a bit more subtle.

Tallinn Feb 06 – p.21/44

slide-72
SLIDE 72

Semantics of quantum computations. .

. . . is a bit more subtle. There is no (sensible) operator on vector spaces, replacing

⑦ ⑧ ❥ ❧

.

Tallinn Feb 06 – p.21/44

slide-73
SLIDE 73

Semantics of quantum computations. .

. . . is a bit more subtle. There is no (sensible) operator on vector spaces, replacing

⑦ ⑧ ❥ ❧

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

Tallinn Feb 06 – p.21/44

slide-74
SLIDE 74

Density matrizes

Tallinn Feb 06 – p.22/44

slide-75
SLIDE 75

Density matrizes

Mixed states can be represented by density matrizes

➋ ❥ ✑

.

Tallinn Feb 06 – p.22/44

slide-76
SLIDE 76

Density matrizes

Mixed states can be represented by density matrizes

➋ ❥ ✑

. Eigenvalues represent probabilities

➋ ➌ ➄ ✝ ➍ ➌ ➄

System is in state

➌ ➄

with prob.

Tallinn Feb 06 – p.22/44

slide-77
SLIDE 77

Density matrizes

Mixed states can be represented by density matrizes

➋ ❥ ✑

. 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

slide-78
SLIDE 78

Example: forgetting a qbit

Tallinn Feb 06 – p.23/44

slide-79
SLIDE 79

Example: forgetting a qbit

EPR is represented by

➋ ❥ ✏ ✏ ✑ ✏ ✏

:

➎ ➎ ➎ ➏ ❁ ➐ ➐ ➏ ❁ ➐ ➐ ➐ ➐ ➐ ➐ ➐ ➐ ➏ ❁ ➐ ➐ ➏ ❁ ➑ ➑ ➑

Tallinn Feb 06 – p.23/44

slide-80
SLIDE 80

Example: forgetting a qbit

EPR is represented by

➋ ❥ ✏ ✏ ✑ ✏ ✏

:

➎ ➎ ➎ ➏ ❁ ➐ ➐ ➏ ❁ ➐ ➐ ➐ ➐ ➐ ➐ ➐ ➐ ➏ ❁ ➐ ➐ ➏ ❁ ➑ ➑ ➑ ➋ ✩ ⑧ ➒ ✏ ★ ❽ ❽ ➓ ⑧ ➒ ✏ ★ ✞ ✞ ➓ ✪ ✝ ⑧ ➒ ✏ ★ ❽ ❽ ➓ ⑧ ➒ ✏ ★ ✞ ✞ ➓

Tallinn Feb 06 – p.23/44

slide-81
SLIDE 81

Example: forgetting a qbit . . .

After measuring one qbit we obtain

➋ ➔ ❥ ✏ ✑ ✏

:

➏ ❁ ➐ ➐ ➏ ❁

Tallinn Feb 06 – p.24/44

slide-82
SLIDE 82

Example: forgetting a qbit . . .

After measuring one qbit we obtain

➋ ➔ ❥ ✏ ✑ ✏

:

➏ ❁ ➐ ➐ ➏ ❁ ➋ ➔ ★ ❽ ➓ ✝ ✞ ✟ ★ ❽ ➓ ➋ ➔ ★ ✞ ➓ ✝ ✞ ✟ ★ ✞ ➓

Tallinn Feb 06 – p.24/44

slide-83
SLIDE 83

Superoperators

Tallinn Feb 06 – p.25/44

slide-84
SLIDE 84

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

slide-85
SLIDE 85

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

slide-86
SLIDE 86
  • Superoperators. . .

There is an operator

✫ ✬ ➂ ③ ➣ ❥ ✑

super

called partial trace.

Tallinn Feb 06 – p.26/44

slide-87
SLIDE 87
  • Superoperators. . .

There is an operator

✫ ✬ ➂ ③ ➣ ❥ ✑

super

called partial trace. E.g.

✫✭✬↕↔ ➙ ③ ↔ ➙ ❥ ✏ ✏ ✑

super

is represented by a

✞➛ ❧ ➜

matrix.

Tallinn Feb 06 – p.26/44

slide-88
SLIDE 88

Semantics

Tallinn Feb 06 – p.27/44

slide-89
SLIDE 89

Semantics

Every quantum computation

q

gives rise to a superoperator U

q ❥ ✑

super

➝ s
  • ➞⑩➟
➡ ➢ ⑤
  • U
  • Tallinn Feb 06 – p.27/44
slide-90
SLIDE 90

Semantics

Every quantum computation

q

gives rise to a superoperator U

q ❥ ✑

super

➝ s
  • ➞⑩➟
➡ ➢ ⑤
  • U
  • Theorem: Every superoperator
❥ ✑

super

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

Tallinn Feb 06 – p.27/44

slide-91
SLIDE 91

Classical vs quantum

Tallinn Feb 06 – p.28/44

slide-92
SLIDE 92

Classical vs quantum

classical (

☎ ✆ ✆

) quantum (

☎ ✆

)

Tallinn Feb 06 – p.28/44

slide-93
SLIDE 93

Classical vs quantum

classical (

☎ ✆ ✆

) quantum (

☎ ✆

) finite sets

Tallinn Feb 06 – p.28/44

slide-94
SLIDE 94

Classical vs quantum

classical (

☎ ✆ ✆

) quantum (

☎ ✆

) finite sets finite dimensional Hilbert spaces

Tallinn Feb 06 – p.28/44

slide-95
SLIDE 95

Classical vs quantum

classical (

☎ ✆ ✆

) quantum (

☎ ✆

) finite sets finite dimensional Hilbert spaces cartesian product (

)

Tallinn Feb 06 – p.28/44

slide-96
SLIDE 96

Classical vs quantum

classical (

☎ ✆ ✆

) quantum (

☎ ✆

) finite sets finite dimensional Hilbert spaces cartesian product (

) tensor product (

)

Tallinn Feb 06 – p.28/44

slide-97
SLIDE 97

Classical vs quantum

classical (

☎ ✆ ✆

) quantum (

☎ ✆

) finite sets finite dimensional Hilbert spaces cartesian product (

) tensor product (

) bijections

Tallinn Feb 06 – p.28/44

slide-98
SLIDE 98

Classical vs quantum

classical (

☎ ✆ ✆

) quantum (

☎ ✆

) finite sets finite dimensional Hilbert spaces cartesian product (

) tensor product (

) bijections unitary operators

Tallinn Feb 06 – p.28/44

slide-99
SLIDE 99

Classical vs quantum

classical (

☎ ✆ ✆

) quantum (

☎ ✆

) finite sets finite dimensional Hilbert spaces cartesian product (

) tensor product (

) bijections unitary operators functions

Tallinn Feb 06 – p.28/44

slide-100
SLIDE 100

Classical vs quantum

classical (

☎ ✆ ✆

) quantum (

☎ ✆

) finite sets finite dimensional Hilbert spaces cartesian product (

) tensor product (

) bijections unitary operators functions superoperators

Tallinn Feb 06 – p.28/44

slide-101
SLIDE 101

Classical vs quantum

classical (

☎ ✆ ✆

) quantum (

☎ ✆

) finite sets finite dimensional Hilbert spaces cartesian product (

) tensor product (

) bijections unitary operators functions superoperators injective functions (

☎ ✆ ✆ ▼

)

Tallinn Feb 06 – p.28/44

slide-102
SLIDE 102

Classical vs quantum

classical (

☎ ✆ ✆

) quantum (

☎ ✆

) finite sets finite dimensional Hilbert spaces cartesian product (

) tensor product (

) bijections unitary operators functions superoperators injective functions (

☎ ✆ ✆ ▼

) isometries (

☎ ✆ ▼

)

Tallinn Feb 06 – p.28/44

slide-103
SLIDE 103

Classical vs quantum

classical (

☎ ✆ ✆

) quantum (

☎ ✆

) finite sets finite dimensional Hilbert spaces cartesian product (

) tensor product (

) bijections unitary operators functions superoperators injective functions (

☎ ✆ ✆ ▼

) isometries (

☎ ✆ ▼

) projections

Tallinn Feb 06 – p.28/44

slide-104
SLIDE 104

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

slide-105
SLIDE 105

Decoherence

Tallinn Feb 06 – p.29/44

slide-106
SLIDE 106

Decoherence

✟ ❼ ✟ ❽
  • ❡➧➦
❡❸❷ ❹

Tallinn Feb 06 – p.29/44

slide-107
SLIDE 107

Decoherence

✟ ❼ ✟ ❽
  • ❡➧➦
❡❸❷ ❹

Classically

⑦ ⑧ ♣ ❺ ✝ ➨

Tallinn Feb 06 – p.29/44

slide-108
SLIDE 108

Decoherence

✟ ❼ ✟ ❽
  • ❡➧➦
❡❸❷ ❹

Classically

⑦ ⑧ ♣ ❺ ✝ ➨

Quantum

Tallinn Feb 06 – p.29/44

slide-109
SLIDE 109

Decoherence

✟ ❼ ✟ ❽
  • ❡➧➦
❡❸❷ ❹

Classically

⑦ ⑧ ♣ ❺ ✝ ➨

Quantum input:

✛ ⑧ ➒ ✏ ★ ❽ ➓ ⑧ ➒ ✏ ★ ❽ ➓ ✯

Tallinn Feb 06 – p.29/44

slide-110
SLIDE 110

Decoherence

✟ ❼ ✟ ❽
  • ❡➧➦
❡❸❷ ❹

Classically

⑦ ⑧ ♣ ❺ ✝ ➨

Quantum input:

✛ ⑧ ➒ ✏ ★ ❽ ➓ ⑧ ➒ ✏ ★ ❽ ➓ ✯
  • utput:
⑧ ✏ ✛ ★ ❽ ➓ ✯ ⑧ ✏ ✛ ★ ✞ ➓ ✯

Tallinn Feb 06 – p.29/44

slide-111
SLIDE 111
  • 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

slide-112
SLIDE 112

QML basics

Tallinn Feb 06 – p.31/44

slide-113
SLIDE 113

QML basics

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

Tallinn Feb 06 – p.31/44

slide-114
SLIDE 114

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

slide-115
SLIDE 115

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

slide-116
SLIDE 116

QML basics . . .

A QML program is an expression in a context

  • f typed variables, e.g.
➯➲➳ ➵ ✍ ✏ ✑ ✏ ➯➲➳ ➵ ✒ ✝ ✓✔ ✕ ✒ ✖ ✗✙✘ ✚ ✜ ✣ ✤ ✥ ✦✧ ✘ ✰ ✱ ✘ ✜ ✫✭✬✮ ✧

Tallinn Feb 06 – p.32/44

slide-117
SLIDE 117

QML basics . . .

A QML program is an expression in a context

  • f typed variables, e.g.
➯➲➳ ➵ ✍ ✏ ✑ ✏ ➯➲➳ ➵ ✒ ✝ ✓✔ ✕ ✒ ✖ ✗✙✘ ✚ ✜ ✣ ✤ ✥ ✦✧ ✘ ✰ ✱ ✘ ✜ ✫✭✬✮ ✧

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

Tallinn Feb 06 – p.32/44

slide-118
SLIDE 118

QML basics . . .

Forgetting variables has to be explicit.

Tallinn Feb 06 – p.33/44

slide-119
SLIDE 119

QML basics . . .

Forgetting variables has to be explicit. E.g.

➯➸ ➵➺✍ ✏ ✏ ✑ ✏ ➯➸ ➵ ✩ ✒ r ❶ ✪ ✝ ✒

is illegal,

Tallinn Feb 06 – p.33/44

slide-120
SLIDE 120

QML basics . . .

Forgetting variables has to be explicit. E.g.

➯➸ ➵➺✍ ✏ ✏ ✑ ✏ ➯➸ ➵ ✩ ✒ r ❶ ✪ ✝ ✒

is illegal, but

➯➸ ➵➺✍ ✏ ✏ ✑ ✏ ➯➸ ➵ ✩ ✒ r ❶ ✪ ✝ ✒ ✛ ❶ ✯

is ok.

Tallinn Feb 06 – p.33/44

slide-121
SLIDE 121

QML basics . . .

There are two different if-then-else constructs.

Tallinn Feb 06 – p.34/44

slide-122
SLIDE 122

QML basics . . .

There are two different if-then-else constructs.

➻ ✌ ✍ ✏ ✑ ✏ ➻ ✌ ✒ ✝ ✓ ✔ ✕ ✒ ✖ ✗✙✘ ✚ ✜ ✫✭✬ ✮ ✧ ✘ ✰ ✱ ✘ ✜ ✣ ✤ ✥✙✦ ✧

is just the identity,

Tallinn Feb 06 – p.34/44

slide-123
SLIDE 123

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

slide-124
SLIDE 124

QML basics . . .

Using

✓✔ ✕

is only allowed, if the branches are

  • rthogonal, i.e. observable different.

Tallinn Feb 06 – p.35/44

slide-125
SLIDE 125

QML basics . . .

Using

✓✔ ✕

is only allowed, if the branches are

  • rthogonal, i.e. observable different.
➾ ➸ ➚ ☛➪ ✍ ✏ ✏ ✑ ✏ ✑ ✏ ✏ ➾ ➸ ➚ ☛➪ ✩ ✒ r ❶ ✪ ➾ ✝ ✓✔ ✕ ➾ ✖ ✗✙✘ ✚ ✩ ❶ r ✒ ✪ ✘ ✰ ✱ ✘ ✩ ✒ r ❶ ✪

is illegal,

Tallinn Feb 06 – p.35/44

slide-126
SLIDE 126

QML basics . . .

Using

✓✔ ✕

is only allowed, if the branches are

  • rthogonal, i.e. observable different.
➾ ➸ ➚ ☛➪ ✍ ✏ ✏ ✑ ✏ ✑ ✏ ✏ ➾ ➸ ➚ ☛➪ ✩ ✒ r ❶ ✪ ➾ ✝ ✓✔ ✕ ➾ ✖ ✗✙✘ ✚ ✩ ❶ r ✒ ✪ ✘ ✰ ✱ ✘ ✩ ✒ r ❶ ✪

is illegal, but

➾ ➸ ➚ ☛➪ ✍ ✏ ✏ ✑ ✏ ✑ ✏ ✩ ✏ ✏ ✪ ➾ ➸ ➚ ☛➪ ✩ ✒ r ❶ ✪ ➾ ✝ ✓✔ ✕ ➾ ✖ ✗✙✘ ✚ ✩ ✜ ✫✭✬✮ ✧ r ✩ ❶ r ✒ ✪ ✪ ✘ ✰ ✱ ✘ ✩ ✜ ✣ ✤ ✥ ✦✧ r ✩ ✒ r ❶ ✪ ✪

is ok.

Tallinn Feb 06 – p.35/44

slide-127
SLIDE 127

QML basics . . .

We can introduce superpositions, e.g.

✡☞☛ ✌✎✍ ✏ ✑ ✏ ✡☞☛ ✌☞✒ ✝ ✓✔ ✕ ✒ ✖ ✗✙✘ ✚ ✛✢✜ ✣☞✤ ✥✙✦✧ ★✩ ✠ ✞ ✪ ✜ ✫✭✬✮ ✧ ✯ ✘ ✰✙✱ ✘ ✛✢✜ ✣☞✤ ✥✙✦✧ ★ ✜ ✫✭✬ ✮ ✧ ✯

Tallinn Feb 06 – p.36/44

slide-128
SLIDE 128

QML basics . . .

We can introduce superpositions, e.g.

✡☞☛ ✌✎✍ ✏ ✑ ✏ ✡☞☛ ✌☞✒ ✝ ✓✔ ✕ ✒ ✖ ✗✙✘ ✚ ✛✢✜ ✣☞✤ ✥✙✦✧ ★✩ ✠ ✞ ✪ ✜ ✫✭✬✮ ✧ ✯ ✘ ✰✙✱ ✘ ✛✢✜ ✣☞✤ ✥✙✦✧ ★ ✜ ✫✭✬ ✮ ✧ ✯

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

Tallinn Feb 06 – p.36/44

slide-129
SLIDE 129
  • 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

slide-130
SLIDE 130

Compilation

Tallinn Feb 06 – p.38/44

slide-131
SLIDE 131

Compilation

Correct QML programs are defined by typing rules, e.g.

➶ ➹ ➘ ✍ ➩ ➫ r ❻ ✍ ➩ r ➴ ✍ ➫ ➹☞➷ ✍ ✧ ✥ ➬➱➮ ➶ ➹❐✃ ❒ ❮ ✩ ❻ r ➴ ✪ ✝ ➘ ❰ÐÏ ➷ ✍

Tallinn Feb 06 – p.38/44

slide-132
SLIDE 132

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

slide-133
SLIDE 133
  • elim
➶ ➹ ➘ ✍ ➩ ➫ r ❻ ✍ ➩ r ➴ ✍ ➫ ➹☞➷ ✍ ✧ ✥ ➬ ➮ ➶ ➹ ✃ ❒ ❮ ✩ ❻ r ➴ ✪ ✝ ➘ ❰ Ï ➷ ✍

Tallinn Feb 06 – p.39/44

slide-134
SLIDE 134
  • elim
➶ ➹ ➘ ✍ ➩ ➫ r ❻ ✍ ➩ r ➴ ✍ ➫ ➹☞➷ ✍ ✧ ✥ ➬ ➮ ➶ ➹ ✃ ❒ ❮ ✩ ❻ r ➴ ✪ ✝ ➘ ❰ Ï ➷ ✍ ➶ ÑÓÒÕÔ Ö ×
  • Ø
Ù Ú ③ Û
  • Ø
  • Ü
Ý Þ ß Ü
  • Ü
  • Ù
  • Ù
  • Tallinn Feb 06 – p.39/44
slide-135
SLIDE 135

Compiler

Tallinn Feb 06 – p.40/44

slide-136
SLIDE 136

Compiler

A compiler is currently being implemented by my student Jonathan Grattage (in Haskell).

Tallinn Feb 06 – p.40/44

slide-137
SLIDE 137

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

slide-138
SLIDE 138

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

slide-139
SLIDE 139
  • 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

slide-140
SLIDE 140

Conclusions

Tallinn Feb 06 – p.42/44

slide-141
SLIDE 141

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

slide-142
SLIDE 142

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

slide-143
SLIDE 143

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

slide-144
SLIDE 144

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

slide-145
SLIDE 145

Further work

Tallinn Feb 06 – p.43/44

slide-146
SLIDE 146

Further work

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

Tallinn Feb 06 – p.43/44

slide-147
SLIDE 147

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

slide-148
SLIDE 148

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

slide-149
SLIDE 149

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

slide-150
SLIDE 150

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

slide-151
SLIDE 151

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

slide-152
SLIDE 152

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