Toward certified quantum programming Christophe Chareton S - - PowerPoint PPT Presentation

toward certified quantum programming
SMART_READER_LITE
LIVE PREVIEW

Toward certified quantum programming Christophe Chareton S - - PowerPoint PPT Presentation

GT IQ November 28-29th 2019 Toward certified quantum programming Christophe Chareton S ebastien Bardin, Franc ois Bobot, Valentin Perrelle (CEA) and Beno t Valiron (LRI) Take away Quantum computers (are going to / will . . . ) arrive


slide-1
SLIDE 1

Toward certified quantum programming

Christophe Chareton

S´ ebastien Bardin, Franc ¸ois Bobot, Valentin Perrelle (CEA) and Benoˆ ıt Valiron (LRI)

GT IQ

November 28-29th 2019

slide-2
SLIDE 2

Take away

Quantum computers (are going to / will . . . ) arrive

→ How to write correct programs?

Need specification and verification mechanisms

scale invariant close to quantum algorithm descriptions well distinguished from code itself largely automated

We are developing Qbricks as a first step towards this goal

Core building circuit language Dual semantics High level specification framework

Certified implementation of the phase estimation algorithm (quantum part of Shor)

GT IQ — Christophe Chareton — p. 2

slide-3
SLIDE 3

Outline

The case for verification of quantum algorithms Qbricks Circuit language Dual semantics Derive proof obligations Toward further automation Case study: phase estimation algorithm Conclusion

GT IQ — Christophe Chareton — p. 3

slide-4
SLIDE 4

The QRAM model

A quantum co-processor (QRAM), controlled by a classical computer

Classical control flow Quantum computing request, sent to the QRAM

→ Structured sequences of instructions: quantum circuits

QRAM x C(f)

  • (C(f), x)

GT IQ — Christophe Chareton — p. 4

slide-5
SLIDE 5

The QRAM model

A quantum co-processor (QRAM), controlled by a classical computer

Classical control flow Quantum computing request, sent to the QRAM

→ Structured sequences of instructions: quantum circuits

let C(f)(x) = . . .

?

f(x) x C(f)

  • (C(f), x)
  • (C(f), x)

Does the circuit fit the computation need?

GT IQ — Christophe Chareton — p. 4

slide-6
SLIDE 6

The case for verification of quantum algorithms

How do we check them?

Quantum phase estimation (from Nielsen & Chuang) Quipper QFT circuit building function

implements builds

GT IQ — Christophe Chareton — p. 5

slide-7
SLIDE 7

The case for verification of quantum algorithms

How do we check them?

Quantum phase estimation (from Nielsen & Chuang) Quipper QFT circuit building function

implements builds runs ?

Quantum programming is tricky and non-intuitive No means to control an execution Tests are expensive and often statistical

GT IQ — Christophe Chareton — p. 5

slide-8
SLIDE 8

The case for verification of quantum algorithms

How do we check them?

Quantum phase estimation (from Nielsen & Chuang) Quipper QFT circuit building function

implements builds runs ?

Testing is difficult . . . What about full verification? allows to handle

Infinite state space absolute guarantee

GT IQ — Christophe Chareton — p. 5

slide-9
SLIDE 9

The case for verification of quantum algorithms

[A parte] Annotated code and deductive verification

  • Provides absolute guarantee
  • Automates proofs
  • Industrial successes
  • Verify wide-spread languages

(C, Java, caml . . . ) Three main ingredients:

  • perational semantics

specification language proof engine

GT IQ — Christophe Chareton — p. 6

slide-10
SLIDE 10

The case for verification of quantum algorithms

State of affairs in quantum computing

Three main ingredients:

  • operational semantics:

matrices → matrix product,

from Heisenberg (1925), Dirac (1939)

  • specification language:

???

  • proof engine:

???

GT IQ — Christophe Chareton — p. 7

slide-11
SLIDE 11

The case for verification of quantum algorithms

Our goal

Specifications for a quantum specification language

Specifications fitting algorithm Separate specifications from definitions

  • Easier to adopt
  • Separation of concerns

Scale invariance Automate proofs

GT IQ — Christophe Chareton — p. 8

slide-12
SLIDE 12

The case for verification of quantum algorithms

State of the art

QMC Coq Qwire (Coq) Path-sums Qbricks

  • Separate specification from code
  • Scale invariance
  • Specifications fitting algorithm
  • Automate proofs

Table: Formal verification of quantum circuits

GT IQ — Christophe Chareton — p. 9

slide-13
SLIDE 13

The case for verification of quantum algorithms

State of the art, achievements in quantum formal verification

Size (number of qbits) Difficulty 10 100 1000

Superposition coin flip teleportation QFT Phase estimation

Shor algorithm

×

Coq

×

QMC

×

Qwire

×

Qwire

×

Path-sums Our contribution

GT IQ — Christophe Chareton — p. 10

slide-14
SLIDE 14

Qbricks

Outline

The case for verification of quantum algorithms Qbricks Circuit language Dual semantics Derive proof obligations Toward further automation Case study: phase estimation algorithm Conclusion

GT IQ — Christophe Chareton — p. 11

slide-15
SLIDE 15

Qbricks – Dual semantics

The quantum case : Back to basics

Algorithm for the quantum phase estimation

GT IQ — Christophe Chareton — p. 12

slide-16
SLIDE 16

Qbricks – Dual semantics

The quantum case : Back to basics

Algorithm for the quantum phase estimation

A sequence of

  • perations

Intermediate assertions, describing the state of the system at each step

GT IQ — Christophe Chareton — p. 12

slide-17
SLIDE 17

Qbricks – Dual semantics

The quantum case : Back to basics

Algorithm for the quantum phase estimation Derive function specifications, eg : let create superposition (state) pre: |u is a ket vector pre: state = |0|u post: state =

1 √ 2t

2t −1

j=0 |j|u

= (* The program *)

Functions decorated with pre and post conditions : annotated programming

→ embedding in the Why3 environment

GT IQ — Christophe Chareton — p. 12

slide-18
SLIDE 18

Qbricks – Dual semantics

Circuit building functions

I(0) . . . H

. . .

I(0) . . . H . . .

. . .

. . . . . . . . . . . . U2t−1 U2t−2 U20 Rev(QFT (n))

  • I(0)

. . . H . . .

. . .

. . . . . . . . . . . . U2t−1 U2t−2 U20 Rev(QFT (n))

  • GT IQ — Christophe Chareton — p. 13
slide-19
SLIDE 19

Qbricks – Dual semantics

Specification and verification

Leading idea

x: quantum state C: quantum circuit

C, x: quantum state

semantics Path-sum semantics, general form

C, |kn

1 √ 2r

2r−1

j=0 ph(k, j)|ket(i, j)n

path sum sem

Three separated parameters, whith recursive definitions: r: int ph : int → int → complex ket : int → int → int

GT IQ — Christophe Chareton — p. 14

slide-20
SLIDE 20

Qbricks – Derive proof obligations

Specified circuit building

Three separated parameters:

r: int ph : int → int → complex ket : int → int → int

functions r (sum range), ph (phase part) and ket (ket part) are defined by recursion for circuits,

GT IQ — Christophe Chareton — p. 15

slide-21
SLIDE 21

Qbricks – Derive proof obligations

Specified circuit building

Three separated parameters:

r: int ph : int → int → complex ket : int → int → int

functions r (sum range), ph (phase part) and ket (ket part) are defined by recursion for circuits, they specify circuit lifted constructors

GT IQ — Christophe Chareton — p. 15

slide-22
SLIDE 22

Qbricks – Derive proof obligations

Specified circuit building

Three separated parameters:

r: int ph : int → int → complex ket : int → int → int

functions r (sum range), ph (phase part) and ket (ket part) are defined by recursion for circuits, they specify circuit lifted constructors and the circuit building functions

GT IQ — Christophe Chareton — p. 15

slide-23
SLIDE 23

Qbricks – Derive proof obligations

Generating proof obligations (why3)

Compilation generates proof obligations

GT IQ — Christophe Chareton — p. 16

slide-24
SLIDE 24

Qbricks – Derive proof obligations

Generating proof obligations (why3)

Compilation generates proof obligations Calling a function provides its postconditions as axioms

. . .

GT IQ — Christophe Chareton — p. 16

slide-25
SLIDE 25

Qbricks – Derive proof obligations

Supporting proof obligations

Proof obligations may be sent to SMT-solvers, and they can be eased, if needed, by to interactive transformations

GT IQ — Christophe Chareton — p. 17

slide-26
SLIDE 26

Qbricks – Toward further automation

Toward further automation

reasoning abstractly from path-sums (instead of r, ph and ket)

Nice path-sum theorems:

  • Linearity
  • Translate sequence as function composition
  • Translate parallel as Kronecker product

Enables abstract specifications:

  • Eigen value specifications
  • Controlled operations, etc

Precious when dealing with underspecified circuit parameters

Simplified path-semantics, for adequate language fragments

Property Class of circuits Design input flat {rz, ph, cnot} syntax easy specification diag {rz, ph} syntax very easy specification iterators

GT IQ — Christophe Chareton — p. 18

slide-27
SLIDE 27

Case study: phase estimation algorithm

Outline

The case for verification of quantum algorithms Qbricks Circuit language Dual semantics Derive proof obligations Toward further automation Case study: phase estimation algorithm Conclusion

GT IQ — Christophe Chareton — p. 19

slide-28
SLIDE 28

Case study: phase estimation algorithm

Phase estimation

Input: an unitary operator U and an eigenstate |v of U Output: the eigenvalue associated to |v Eigen decomposition Solving linear systems Shor (with arithmetic assumption and probability) Size (number of qbits) Difficulty 10 100 1000

Superposition coin flip teleportation QFT Phase estimation

Shor algorithm

×

Coq

×

QMC

×

Qwire

×

Qwire

×

Path-sums Our contribution

GT IQ — Christophe Chareton — p. 20

slide-29
SLIDE 29

Case study: phase estimation algorithm

Case study

#Lines #Def. #Lem #POs #Aut. #Cmd create superposition 42 2 1 11 6 36 apply black box 57 3 1 50 44 46 QFT 75 3 57 51 30 phase estimation 63 4 72 65 51 Total 237 12 2 190 166 163

#Aut.: automatically proven POs — #Cmd: interactive commands

Table: Implementation & verification of phase estimation

#Lines #Def. #Lem #POs #Aut. #Cmd QFT (full Qbricks) 75 3 57 51 30 QFT (path-sum only) 87 3 73 64 49 QFT (matrix only) 200 8 15 306 285 106 #Aut.: automatically proven POs — #Cmd: interactive commands

Table: Comparison of several approaches, QFT algorithm

GT IQ — Christophe Chareton — p. 21

slide-30
SLIDE 30

Conclusion

Conclusion

Qbricks: a core development framework for certified quantum programming

scale invariant close to quantum algorithm descriptions well distinguished from code itself largely automated

Implementation

Circuit building language Dual semantics + equivalence proof Shorcuts for further automation Certified implementation of the phase estimation algorithm

Future works:

Further automate proof framework Extend Qbricks to measure → Shor

GT IQ — Christophe Chareton — p. 22

slide-31
SLIDE 31

Commissariat ` a l’´ energie atomique et aux ´ energies alternatives CEA Tech List Centre de Saclay — 91191 Gif-sur-Yvette Cedex www- list.cea.fr Etablissement public ` a caract` ere industriel et commercial — RCS Paris B 775 685 019