Quantum Effects. Juliana K. Vizzotto 1 Thorsten Altenkirch 2. Amr Sabry January Yale CS Colloquium Page 1

Similar documents
Structuring Quantum Effects: Superoperators as Arrows

Quantum Programming. Juliana K. Vizzotto 1 and Amr Sabry 2. 8 November Yale CS Colloquium Page 1. 1 Federal University of Rio Grande do Sul

Towards a High Level Quantum Programming Language

Modelling Parallel Quantum Computing Using Transactional Memory

arxiv:quant-ph/ v5 19 Apr 2005

A functional quantum programming language

Type Systems for Quantum Computation

Towards a High Level Quantum Programming Language

Quantum data and control made easier

A Functional Quantum Programming Language

Conservation of Information

Quantum Error Correcting Codes and Quantum Cryptography. Peter Shor M.I.T. Cambridge, MA 02139

QWIRE Practice: Formal Verification of Quantum Circuits in Coq

1 Measurements, Tensor Products, and Entanglement

Baby's First Diagrammatic Calculus for Quantum Information Processing

Introduction to Quantum Computation

Hilbert Space, Entanglement, Quantum Gates, Bell States, Superdense Coding.

QUANTUM COMPUTER SIMULATION

Orthogonality and Algebraic Lambda-Calculus

Quantum computing! quantum gates! Fisica dell Energia!

Introduction to Quantum Computing for Folks

A categorical model for a quantum circuit description language

Quantum Functional Programming Language & Its Denotational Semantics

QWIRE: A Core Language for Quantum Circuits

Quantum Computing. Thorsten Altenkirch

Introduction to Quantum Computing

Single qubit + CNOT gates

From Symmetric Pattern-Matching to Quantum Control

A review on quantum teleportation based on: Teleporting an unknown quantum state via dual classical and Einstein- Podolsky-Rosen channels

A functional quantum programming language. by Jonathan James Grattage, BSc (Hons)

Seminar 1. Introduction to Quantum Computing

6.080/6.089 GITCS May 6-8, Lecture 22/23. α 0 + β 1. α 2 + β 2 = 1

Great Ideas in Theoretical Computer Science. Lecture 28: A Gentle Introduction to Quantum Computation

Basics on quantum information

Basics on quantum information

Lecture 3: Constructing a Quantum Model

Quantum Computing. 6. Quantum Computer Architecture 7. Quantum Computers and Complexity

Quantum Computing: Foundations to Frontier Fall Lecture 3

Factoring on a Quantum Computer

Chapter 2. Basic Principles of Quantum mechanics

Modeling Quantum Computing in Haskell

Introduction into Quantum Computations Alexei Ashikhmin Bell Labs

SUPERDENSE CODING AND QUANTUM TELEPORTATION

6.896 Quantum Complexity Theory September 9, Lecture 2

Quantum gate. Contents. Commonly used gates

Chapter 10. Quantum algorithms

arxiv: v3 [quant-ph] 4 Jan 2010

Quantum Computing. Quantum Computing. Sushain Cherivirala. Bits and Qubits

Quantum Gates, Circuits & Teleportation

Quantum Computation: from a Programmer s Perspective

Tutorial on Quantum Computing. Vwani P. Roychowdhury. Lecture 1: Introduction

Quantum Computing Virtual Machine. Author: Alexandru Gheorghiu Scientific advisor: PhD. Lorina Negreanu

Simply Typed Lambda Calculus

Complex numbers: a quick review. Chapter 10. Quantum algorithms. Definition: where i = 1. Polar form of z = a + b i is z = re iθ, where

Lecture 2: From Classical to Quantum Model of Computation

Embedding Classical and Quantum Circuits in Haskell

THE UNIVERSITY OF CALGARY. Programming with a Quantum Stack. Brett Gordon Giles A THESIS SUBMITTED TO THE FACULTY OF GRADUATE STUDIES

Quantum information and quantum computing

Advanced Cryptography Quantum Algorithms Christophe Petit

Quantum Information & Quantum Computation

Physics, Language, Maths & Music

Quantum decoherence. Éric Oliver Paquette (U. Montréal) -Traces Worshop [Ottawa]- April 29 th, Quantum decoherence p. 1/2

Quantum Computer Architecture

A lambda calculus for quantum computation with classical control

Introduction to Quantum Algorithms Part I: Quantum Gates and Simon s Algorithm

Locality NIMS. The Principle of. Made Simpler but Harder. Man-Duen Choi.

Adriaan van Wijngaarden

In the beginning God created tensor... as a picture

CSI717 Quantum Computer Programming George Mason University Mid-Term Exam Spring 2007

1 Quantum Lambda Calculus

6.896 Quantum Complexity Theory September 18, Lecture 5

1 Quantum Lambda Calculus

Is Quantum Search Practical?

2. Introduction to quantum mechanics

The information content of a quantum

Quantum Recursion and Second Quantisation Basic Ideas and Examples

- Why aren t there more quantum algorithms? - Quantum Programming Languages. By : Amanda Cieslak and Ahmana Tarin

The Relativistic Quantum World

Private quantum subsystems and error correction

Bicubical Directed Type Theory

Beginnings... Computers might as well be made of green cheese. It is no longer safe to assume this! The first axiom I learnt in Computer Science:

1 The Quantum IO Monad

Reversible and Quantum computing. Fisica dell Energia - a.a. 2015/2016

QWIRE: A QRAM-Inspired Quantum Circuit Language

1. Basic rules of quantum mechanics

Towards a Quantum Programming Language

Some Introductory Notes on Quantum Computing

)j > Riley Tipton Perry University of New South Wales, Australia. World Scientific CHENNAI

Errata list, Nielsen & Chuang. rrata/errata.html

Lecture 11 September 30, 2015

Quantum Predicative Programming

Quantum Information & Quantum Computation

Teleportation of Quantum States (1993; Bennett, Brassard, Crepeau, Jozsa, Peres, Wootters)

Universal quantum computers

Towards a Flowchart Diagrammatic Language for Monad-based Semantics

Unitary Dynamics and Quantum Circuits

Quantum parity algorithms as oracle calls, and application in Grover Database search

Quantum Recursion and Second Quantisation

. Here we are using the standard inner-product over C k to define orthogonality. Recall that the inner-product of two vectors φ = i α i.

Concepts and Algorithms of Scientific and Visual Computing Advanced Computation Models. CS448J, Autumn 2015, Stanford University Dominik L.

Transcription:

Quantum Effects Juliana K. Vizzotto 1 Thorsten Altenkirch 2 Amr Sabry 3 1 Federal University of Rio Grande do Sul 2 The University of Nottingham 3 Indiana University 2 January 25 Yale CS Colloquium Page 1

Quantum mechanics Real Black Magic Calculus Albert Einstein If quantum mechanics hasn t profoundly shocked you, you haven t understood it yet Niels Bohr I think I can safely say that nobody today understands quantum mechanics Richard Feynman I can t possibly know what I am talking about Amr Sabry Yale CS Colloquium Page 2

Models of (quantum) computation Abstract (Compositional) Values and functions Circuits Vectors and matrices Physics Particle spins and electromagnetic fields Yale CS Colloquium Page 3

Abstract models of (quantum) computation Semantic foundation for functional quantum programming language: Category theory categorical models of quantum computation [Abramsky, Selinger, van Tonder] λ-calculus quantum λ-calculus [Van Tonder] Domain theory, logic, etc [Birkhoff, von Neumann] Haskell (not perfect but rich executable language) Yale CS Colloquium Page 4

Plan Quantum computation (I): unitary operations on state vectors Embedding in Haskell using monads What to do with measurement? Quantum computation (II): superoperators on density matrices Arrows Embedding in Haskell using arrows QML [Altenkirch and Grattage] Open problems; related work; conclusions Yale CS Colloquium Page 5

Quantum Computing (I) Yale CS Colloquium Page 6

Example: Toffoli circuit Not V Not V H VT...... 1... 1 i 1 1 1 1...... 1 i 1 i... 1 i... 1... H FFF FFT FTF FTT TFF TFT TTF TTT In this example, input is T T F After first step, state vector is a superposition T T F + T T T Result: Negate the last bit Yale CS Colloquium Page 7

Entanglement The state vector of multiple qubits can sometimes be teased into the product of simpler state vectors: F F + F T = F ( F + T ) If the qubits are entangled, this is impossible: F F + T T ( F + T ) ( F + T ) (or any other product we might try) Must basically manipulate the global state at all times even if we want to apply an operation to only one qubit Yale CS Colloquium Page 8

Global state Reg r 1 2 3 4 1 QCL [Knill] A global state with n qubits Registers are realized using pointers to the global state Apply operation U to register r using Π.(U I (n m) ).Π where Π is the inverse of Π and I is the identity Π Yale CS Colloquium Page 9

Flowchart notation [Selinger] A global state with n variables that can be assigned once To apply operation U to part of the state, use the same idea that is used in QCL: re-order the variables to bring relevant variables to the front compose U with the identity and apply it to the entire state input q1,q2,q3 : qubit q1, q2, q3 : qubit permute φ 1 q3, q2, q1: qubit q3, q2, q1 *= H x Id permute φ 2 q3, q2, q1: qubit q2, q3, q1 : qubit q2, q3, q1 *= cv x Id. Yale CS Colloquium Page 1

Lambda-calculus extension [Valiron and Selinger] Idea: the lambda term gives classical control over the quantum data which is accessed via pointers to a global data structure. The state is a triple [Q, Q f, M] Q is the state vector M is a lambda term with free variables Q f is a linking function which maps every free variable of M to a qubit in Q Yale CS Colloquium Page 11

Virtual values and adaptors [Sabry] Also uses a global state and pointers mediated using adaptors Hides the management of pointers using virtual values Adaptors can almost be derived from the types but their actual generation is tedious and ugly toffoli state = let b = virt state adaptor mb = virt state adaptor 1 tm = virt state adaptor 2 tb = virt state adaptor 3 in do app hadamard b app cv mb app cnot tm app cvt mb app cnot tm app cv tb app hadamard b Yale CS Colloquium Page 12

Can we do better than pointers to a global state? Common theme so far: A global state vector accessed via pointers Each operation transforms the global state to a new state Monads are often used to structure and reason about computational effects. class Monad m where return : : a. a m a ( =) : : a b. m a (a m b) m b Is there a nice monad here? Yale CS Colloquium Page 13

Embedding in Haskell using monads Yale CS Colloquium Page 14

Finite sets We only consider computations over finite bases. For a type a to be a type of observables, it needs to represent a finite set: class Eq a Basis a where basis : : [a] instance Basis Bool where basis = [False, True] Can automatically construct more complicated sets (on demand): instance (Basis a, Basis b) Basis(a, b) where basis = [(a, b) a basis, b basis ] Programs at the end produce classical observable values: False, (True, False), etc Yale CS Colloquium Page 15

State vectors A state vector associates a complex probability amplitude with each basis element: type PA = Complex Double type Vec a = a PA Can add, substract, and multiply vectors: (definitions omitted) vzero : : Vec a ( + ) : : Vec a Vec a Vec a ( ) : : Vec a Vec a Vec a ($ ) : : PA Vec a Vec a ( ) : : Vec a Vec b Vec (a, b) ( ) : : Basis a Vec a Vec a PA Yale CS Colloquium Page 16

Examples of vectors over Bool The simplest vector is a unit representing a basis element: The two basic unit vectors: unit : : Basis a a Vec a unit a = (\ b if a == b then 1 else ) qfalse = unit False in Dirac notation qtrue = unit True in Dirac notation 1 Vector representing superpositions: qft = (1 / sqrt 2) $ (qfalse + qtrue) 1 2 ( + 1 ) qfmt = (1 / sqrt 2) $ (qfalse qtrue) 1 2 ( 1 ) Yale CS Colloquium Page 17

Examples of vectors over (Bool, Bool) Using the tensor product: p1 = qfalse qft in Dirac notation ( 1 2 ( + 1 )) Using the classical product over the basis: qff = unit (False, False) in Dirac notation qtt = unit (True, True) in Dirac notation 11 A vector representing the EPR pair 1 2 ( + 11 ): epr = (1 / sqrt 2) $ (qff + qtt ) Yale CS Colloquium Page 18

Linear operators Given a function f : : a Vec b, we can produce the linear operator of type Vec a Vec b Apply f to each basis element and accumulate the results: linop : : Basis a (a Vec b) (Vec a Vec b) linop f va = (\ b sum [ (va a) (f a b) a basis]) So we can define: type Lin a b = a Vec b Yale CS Colloquium Page 19

Examples of linear operators Construct a linear operator from any pure function: fun2lin : : (Basis a, Basis b) (a b) Lin a b fun2lin f a = unit (f a) Common linear operators on booleans: qnot = fun2lin not hadamard False = qft hadamard True = qfmt Yale CS Colloquium Page 2

More linear operations Outer product: ( ) : : Basis a Vec a Vec a Lin a a (v 1 v 2 ) a 1 a 2 = v 1 a 1 conjugate (v 2 a 2 ) Composition: Controlled-operations: o : : (Basis a, Basis b, Basis c) Lin a b Lin b c Lin a c o f g a = linop g (f a) controlled : : Basis a Lin a a Lin (Bool, a) (Bool, a) controlled f (b 1, b 2 ) = (unit b 1 ) (if b 1 then f b 2 else unit b 2 ) Yale CS Colloquium Page 21

Almost a monad! We can define: return return : : Basis a a Vec a = unit ( =) : : Basis a Vec a (a Vec b) Vec b (va = f ) = linop f va The right equations are satisfied The types are wrong: the extra constraints mean that the construction is not universal. In Haskell terms, we cannot use the do-notation Already observed [Mu and Bird, 21] but in a system restricted to manipulating lists of qubits Yale CS Colloquium Page 22

Toffoli circuit toffoli : : Lin (Bool, Bool, Bool) (Bool, Bool, Bool) toffoli (top, middle, bottom) = let cnot = controlled qnot cphase = controlled phase in hadamard bottom = \ b 1 cphase (middle, b 1 ) = \ (m 1, b 2 ) cnot (top, m 1 ) = \ (t 1, m 2 ) controlled (adjoint phase) (m 2, b 2 ) = \ (m 3, b 3 ) cnot (t 1, m 3 ) = \ (t 2, m 4 ) cphase (t 2, b 3 ) = \ (t 3, b 4 ) hadamard b 4 = \ b 5 return (t 3, m 4, b 5 ) Yale CS Colloquium Page 23

So far (Almost) monads can be used to structure quantum parallelism: no explicit global state and pointers Connections to category theory, etc That s the easy part... How do we deal with measurement? Yale CS Colloquium Page 24

Measurement Yale CS Colloquium Page 25

Measurement & collapse Measuring qft (= 1 2 ( + 1 )): returns with probability 1/2 and as a side-effect collapses qft to, or returns 1 with probability 1/2 and as a side-effect collapses qft to 1 Yale CS Colloquium Page 26

Measurement & spooky action at a distance Measuring the left qubit of epr: (= 1 2 ( + 11 )): returns with probability 1/2 and as a side-effect collapses epr to, or returns 1 with probability 1/2 and as a side-effect collapses epr to 11 The right qubit is affected even if physically distant! Yale CS Colloquium Page 27

Ignore measurement? Measurements can always be delayed to the end; many formalisms ignore them Mu and Bird use the IO monad to explain measurement; cannot mix measurement with linear operations Can we deal with measurements in the formalism? Yale CS Colloquium Page 28

Teleportation Alice EPR Bob { Not Z q Not m2 q H m1 Communication uses a classical channel, sending classical bits. Yale CS Colloquium Page 29

Quantum Computing (II) Yale CS Colloquium Page 3

State vectors have too much information Perhaps vectors are not expressive enough? Vector is exact state of the system but much of the information in the state is not observable Take qft and measure it. The result is either: 1 2 or 1 2 1 Apply Hadamard to the result: 1 2 ( + 1 ) or 1 2 ( 1 ) The two configurations are indistinguishable (observationally equivalent) Yale CS Colloquium Page 31

Density matrices Statistical perspective of the state vector Technically, we use the outer product: Examples: type Dens a = Vec (a, a) pured : : Basis a Vec a Dens a pured v = lin2vec (v v) qfalse qtrue qft 1 1 2 ( + 1 ) ( 1 ) ( 1 ) ( 1/2 1/2 1/2 1/2 ) Yale CS Colloquium Page 32

Density matrices and measurement When we measure qft ( 1 2 ( + 1 )) we get: False with probability 1/2, or True with probability 1/2: ( 1/2 ) + ( 1/2 ) = ( 1/2 1/2 The density matrix can represent a mixed state ) Operations are linear: ( ) ( 1/2 1/2 H = H 1/2 ) + H ( 1/2 ) = ( 1/2 1/2 ) The two states are indeed observationally equivalent. Yale CS Colloquium Page 33

Superoperators Every linear operator can be lifted to an operator on density matrices Such operators are called superoperators: type Super a b = (a, a) Dens b lin2super : : (Basis a, Basis b) Lin a b Super a b lin2super f (a 1, a 2 ) = (f a 1 ) (dual (adjoint f ) a 2 ) where dual f a b = f b a Yale CS Colloquium Page 34

Tracing and measurement trl measures and forgets the result of measurement meas measures and returns the result of measurement trl : : (Basis a, Basis b) Super (a, b) b trl ((a 1, b 1 ), (a 2, b 2 )) = if a 1 == a 2 then return (b 1, b 2 ) else vzero meas : : Basis a Super a (a, a) meas (a 1, a 2 ) = if a 1 == a 2 then return ((a 1, a 1 ), (a 1, a 1 )) else vzero Measuring qft and forgetting the collapsed quantum state: pured qft = meas = trl evaluates to: ( 1/2 1/2 ) Yale CS Colloquium Page 35

No longer a monad At least we can t prove it is a monad Superoperators do not form a basis We seem to have lost all our structure Yale CS Colloquium Page 36

Arrows Yale CS Colloquium Page 37

A generalization of monads class Arrow a where arr : : (b c) a b c ( ) : : a b c a c d a b d first : : a b c a (b, d) (c, d) arr >>> first b f c b c d f g b f c d d (a) (b) (c) Yale CS Colloquium Page 38

More about arrows Look up excellent work at Yale Yale CS Colloquium Page 39

Embedding in Haskell using arrows Yale CS Colloquium Page 4

Superoperators are arrows Well... almost: the types have additional constraints arr : : (Basis b, Basis c) (b c) Super b c arr f = fun2lin (\ (b 1, b 2 ) (f b 1, f b 2 )) ( ) : : (Basis b, Basis c, Basis d) Super b c Super c d Super b d ( ) = o first : : (Basis b, Basis c, Basis d) Super b c Super (b, d) (c, d) first f ((b 1, d 1 ), (b 2, d 2 )) = permute ((f (b 1, b 2 )) (return (d 1, d 2 ))) where permute v ((b 1, b 2 ), (d 2, d 2 )) = v ((b 1, d 1 ), (b 2, d 2 )) Yale CS Colloquium Page 41

Superoperators as a model of quantum computing The category of superoperators is known to be an adequate model of quantum computation [Selinger] This work suggests that this category corresponds to a functional language with arrows Can we accurately express quantum computation in a functional language with arrows? Yale CS Colloquium Page 42

Toffoli toffoli : : Super (Bool, Bool, Bool) (Bool, Bool, Bool) toffoli = let hads = lin2super hadamard cnots = lin2super (controlled qnot) cphases = lin2super (controlled phase) caphases = lin2super (controlled (adjoint phase)) in proc (a, b, c ) do c 1 hads c (b 1, c 2 ) cphases (b, c 1 ) (a 1, b 2 ) cnots (a, b 1 ) (b 3, c 3 ) caphases (b 2, c 2 ) (a 2, b 4 ) cnots (a 1, b 3 ) (a 3, c 4 ) cphases (a 2, c 3 ) c 5 hads c 4 returna (a 3, b 4, c 5 ) Yale CS Colloquium Page 43

Teleportation (I) Can write, type, reason about each component separately. Can incorporate measurement in the computation Main: teleport : : Super (Bool, Bool, Bool) Bool teleport = proc (eprl, eprr, q) do (m 1, m 2 ) alice (eprl, q) q bob (eprr, m 1, m 2 ) returna q Yale CS Colloquium Page 44

Teleportation (II) alice : : Super (Bool, Bool) (Bool, Bool) alice = proc (eprl, q) do (q 1, e 1 ) lin2super (controlled qnot) (q, eprl) q 2 lin2super hadamard q 1 ((q 3, e 2 ), (m 1, m 2 )) meas (q 2, e 1 ) (m 1, m 2) trl ((q 3, e 2 ), (m 1, m 2 )) returna (m 1, m 2) bob : : Super (Bool, Bool, Bool) Bool bob = proc (eprr, m 1, m 2 ) do (m 2, e 1 ) lin2super (controlled qnot) (m 2, eprr) (m 1, e 2 ) lin2super (controlled z) (m 1, e 1 ) q trl ((m 1, m 2 ), e 2) returna q Yale CS Colloquium Page 45

QML Yale CS Colloquium Page 46

Why Haskell is not adequate There is more to quantum computation than a functional language with arrows Cloning? δ : : Super Bool (Bool, Bool) δ = arr (\ x (x, x)) Weakening weaken : : Super (Bool, Bool) Bool weaken = arr (\ (x, y) y) Yale CS Colloquium Page 47

Cloning Well-known non-cloning property of quantum states! δ : : Super Bool (Bool, Bool) δ = arr (\ x (x, x)) δ only clones classical information encoded in quantum data Applying δ to qfalse will give qfalse qfalse But applying δ to qft does not produce qft qft ; rather it produces epr One can think of it as cloning a pointer; and sharing the quantum data. Yale CS Colloquium Page 48

Weakening The definition weaken allows us to drop some values weaken : : Super (Bool, Bool) Bool weaken = arr (\ (x, y) y) Applying weaken to epr gives qft But dropping a value amounts to measuring it, and if we measure the left qubit of epr, we should be getting either qfalse or qtrue or the mixed state of both measurements, but never qft. Must prevent weakening Yale CS Colloquium Page 49

QML [Altenkirch and Grattage] A functional language to model quantum computation Prevent weakening using strict linear logic Two semantics: translation to quantum circuits and translation to superoperators Source language models irreversible computations; semantics (compiler) takes care of making everything reversible (by adding a heap input and a garbage output) Yale CS Colloquium Page 5

QML type system Must keep track of uses of variables Variables in the context that are not used must be measured: x: σ, y: τ x {y} : σ Variables in the context can be used more than once (by essentially applying δ) Yale CS Colloquium Page 51

Using variables Does f use x? f x = if x then qtrue else qtrue Depends on the semantics of if Classical control: measure the qubit x to get a classical boolean value and then select appropriate branch Quantum control (if ): return the superposition of the branches Quantum control returns qtrue without using x The version with if must not be allowed to typecheck Yale CS Colloquium Page 52

Quantum control & orthogonality In an if expression, the superposition of e 1 and e 2 is calculated using the probability amplitudes of the superposition of x: if x then e 1 else e 2 Basically if e 1 and e 2 are orthogonal then it is safe to replace the superposition in x with the superposition of e 1 and e 2. This is ok: f x = if x then qtrue else qfalse Yale CS Colloquium Page 53

Conclusions Fairly elegant semantic analysis Quantum computing = functional language + arrows (for parallelism and measurement) + some kind of linear type system (to control weakening) Formalize the connections between QML and a functional languages with superoperators as arrows Still need to explain a few open issues Higher-order programs, infinite datatypes, etc Yale CS Colloquium Page 54