Classical Control in Quantum Programs Dominique Unruh IAKS, Universität Karlsruhe Founded by the European Project ProSecCo IST-2001-39227.

Slides:



Advertisements
Similar presentations
A number of MATLAB statements that allow us to control the order in which statements are executed in a program. There are two broad categories of control.
Advertisements

1 Turing Machines and Equivalent Models Section 13.2 The Church-Turing Thesis.
1 CHAPTER 4 RELATIONAL ALGEBRA AND CALCULUS. 2 Introduction - We discuss here two mathematical formalisms which can be used as the basis for stating and.
1.6 Behavioral Equivalence. 2 Two very important concepts in the study and analysis of programs –Equivalence between programs –Congruence between statements.
Expressions and Statements. 2 Contents Side effects: expressions and statements Expression notations Expression evaluation orders Conditional statements.
Copyright © Cengage Learning. All rights reserved.
CHAPTER 1: AN OVERVIEW OF COMPUTERS AND LOGIC. Objectives 2  Understand computer components and operations  Describe the steps involved in the programming.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Axiomatic Semantics.
ISBN Chapter 3 Describing Syntax and Semantics.
Program Proving Notes Ellen L. Walker.
1 Semantic Description of Programming languages. 2 Static versus Dynamic Semantics n Static Semantics represents legal forms of programs that cannot be.
CS 355 – Programming Languages
Comp 205: Comparative Programming Languages Semantics of Imperative Programming Languages denotational semantics operational semantics logical semantics.
What is an Algorithm? (And how do we analyze one?)
1 Basic abstract interpretation theory. 2 The general idea §a semantics l any definition style, from a denotational definition to a detailed interpreter.
CPSC 411, Fall 2008: Set 12 1 CPSC 411 Design and Analysis of Algorithms Set 12: Undecidability Prof. Jennifer Welch Fall 2008.
Programming Language Semantics Denotational Semantics Chapter 5 Based on a lecture by Martin Abadi.
1 Operational Semantics Mooly Sagiv Tel Aviv University Textbook: Semantics with Applications.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
Iteration This week we will learn how to use iteration in C++ Iteration is the repetition of a statement or block of statements in a program. C++ has three.
Specification Formalisms Book: Chapter 5. Properties of formalisms Formal. Unique interpretation. Intuitive. Simple to understand (visual). Succinct.
CS5371 Theory of Computation Lecture 10: Computability Theory I (Turing Machine)
16/27/ :53 PM6/27/ :53 PM6/27/ :53 PMLogic Control Structures Arithmetic Expressions Used to do arithmetic. Operations consist of +,
What is an Algorithm? (And how do we analyze one?) COMP 122, Spring 04.
Describing Syntax and Semantics
1 Relational Algebra and Calculus Yanlei Diao UMass Amherst Feb 1, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
Programming Language Semantics Denotational Semantics Chapter 5 Part III Based on a lecture by Martin Abadi.
Quantum Computation and Quantum Information – Lecture 2 Part 1 of CS406 – Research Directions in Computing Dr. Rajagopal Nagarajan Assistant: Nick Papanikolaou.
Propositional Calculus Math Foundations of Computer Science.
1 1.1 © 2012 Pearson Education, Inc. Linear Equations in Linear Algebra SYSTEMS OF LINEAR EQUATIONS.
Computability and Modeling Computation What are some really impressive things that computers can do? –Land the space shuttle (and other aircraft) from.
Alice and Bob’s Excellent Adventure
Systems Architecture I1 Propositional Calculus Objective: To provide students with the concepts and techniques from propositional calculus so that they.
A Few Simple Applications to Cryptography Louis Salvail BRICS, Aarhus University.
1 2. Independence and Bernoulli Trials Independence: Events A and B are independent if It is easy to show that A, B independent implies are all independent.
CSI 3125, Axiomatic Semantics, page 1 Axiomatic semantics The assignment statement Statement composition The "if-then-else" statement The "while" statement.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
1 TABLE OF CONTENTS PROBABILITY THEORY Lecture – 1Basics Lecture – 2 Independence and Bernoulli Trials Lecture – 3Random Variables Lecture – 4 Binomial.
CS 363 Comparative Programming Languages Semantics.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
Pseudocode. Simple Program Design, Fourth Edition Chapter 2 2 Objectives In this chapter you will be able to: Introduce common words, keywords, and meaningful.
Pseudocode Simple Program Design Third Edition A Step-by-Step Approach 2.
1 Relational Algebra and Calculas Chapter 4, Part A.
Relational Algebra.
Algorithm Design.
Turing Machines Chapter 17. Languages and Machines SD D Context-Free Languages Regular Languages reg exps FSMs cfgs PDAs unrestricted grammars Turing.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Chapter 3 Part II Describing Syntax and Semantics.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
COP4020 Programming Languages Introduction to Axiomatic Semantics Prof. Robert van Engelen.
1 8. One Function of Two Random Variables Given two random variables X and Y and a function g(x,y), we form a new random variable Z as Given the joint.
Database Management Systems, R. Ramakrishnan1 Relational Algebra Module 3, Lecture 1.
1 / 48 Formal a Language Theory and Describing Semantics Principles of Programming Languages 4.
CS 203: Introduction to Formal Languages and Automata
1 Introduction to Quantum Information Processing CS 467 / CS 667 Phys 467 / Phys 767 C&O 481 / C&O 681 Richard Cleve DC 3524 Course.
Operational Semantics Mooly Sagiv Tel Aviv University Textbook: Semantics with Applications Chapter.
From Natural Language to LTL: Difficulties Capturing Natural Language Specification in Formal Languages for Automatic Analysis Elsa L Gunter NJIT.
Algorithms and Pseudocode
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
C HAPTER 3 Describing Syntax and Semantics. D YNAMIC S EMANTICS Describing syntax is relatively simple There is no single widely acceptable notation or.
Operational Semantics Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Theory of Computation Automata Theory Dr. Ayman Srour.
Generating Random Variates
Modeling Arithmetic, Computation, and Languages
Introduction to Computer Programming
Algorithms & Pseudocode
Predicate Transformers
Presentation transcript:

Classical Control in Quantum Programs Dominique Unruh IAKS, Universität Karlsruhe Founded by the European Project ProSecCo IST

Design Goals Quantum programming language We present a method of modelling a quantum programming language in a way that should allow to write quantum programs in a formal way, without loosing the similarity to pseudo-code which is essential for an intuitive approach to algorithms. Terminating and non-terminating Our modelling shall support the design of terminating as well of non-terminating programs within the same mathematical framework. Mixed classical and quantum operations We want to be able to represent both pure quantum (unitary) as well as classical operations (measurements, erasure) using the same framework. That is, we do not impose a strict separation between a classical controlling computer and the controlled quantum registers. Output during the program’s run We show how to model programs which give classical (i.e. measured) output during the program’s run. This is especially useful, if the programs in consideration do not terminate but give a continuous stream of results, since the usual run-and-then-measure-after-termination approach is not sensible in that case. Physical interpretation A programs behaviour can be modelled as a measurement process (with defined resulting state in case of termination). In order to avoid artificial constructions we adhere to these operational semantics and show how to transform any program into the mathematical description of a measurement process.

Operational Semantics A program is a physical experiment The process of running a program is very much comparable to performing a physical experiment: At the beginning, the machine is in a given initial state. Then this state is modified by performing various operations. These may include measurements during the experiment (outputs of the program). The experiment possibly terminates (real life experiments always do, due to limited resources, programs not necessarily). If the program terminates, the machine afterwards is in a well-defined post-measurement state. A physical experiment is a measurement Any physical experiment can be seen as a measurement operation. We distinguish two kinds: a measurement operation defining the post-measurement state (called general measurement or PMVM), and a measurement not defining the post-measurement state (a POVM). To describe measurements which may or may not have a post-measurement state, we need to use the convex combination of a general measurement and a PMVM. This combination we will call a mixed measurement. A program is a measurement Since we can consider a program as an experiment, and an experiment as a mixed measurement, it is natural to model a program as a mixed measurement. The outputs of the program are measurement results and are finite or infinite sequences over an alphabet Σ. This gives rise to operational semantics of programs, which are simply mathematical descriptions of measurements. Classical, measurement, unitary operations The mixed measurement formalism is strong enough to have as special cases classical (probabilistic) programs, orthogonal measurements, and unitary operations, thus capturing all kinds of operations in a single mathematical framework.

Composing programs Sequentially execute several programs If two programs P and Q are defined, the composed program P;Q can be interpreted as first executing P (yielding some output), and then—if P terminated—executing Q on the post- execution state of P. The output of the composed program is then given by the concatenation of the respective inputs. Examples P;Q Run P then run Q {P;Q};R Composition is associative, so these three are equal P;{Q;R} P;Q;R print x; print y Outputs xy

Print-Command Any outputs can be build up from constant outputs By defining an elementary program print x, one can build up any output by using switch (see below). E.g. switch (M as m) print m outputs the result of measurement M. Constant outputs are constant measurements The program print x outputting x is simply a measurement with constant outcome x and which does not modify the programs state. Examples print a; print b Equivalent programs outputting ab print ab switch (M as m) print m Outputs result of measuring M. print M (shorthand) while (true) print x Outputs infinite sequence x ∞

Branching (if/switch) Branching as classical control In our modelling we consider branching which is conditional upon the outcomes of measurements. This is opposed to controlled unitary transformation (e.g. CNOT), where the controlling qubit is not measured. More complex quantum algorithms usually have such classical control, be it an overall loop repeating the experiment until a useful result is obtained (e.g. a non-trivial factor in Shor’s factoring algorithm). Branching programs are composed measurements A program if (M) P can be interpreted as the experiment measuring M and then executing the program P if M yielded the outcome true. This experiment can be expressed as a measurement in a straightforward manner: if M i denotes the superoperator describing the post-measurement state on outcome i, then if (M) P is simply defined as PM true +M false. Analogously we define if (M) P else Q. More powerful: the switch-statement An if -statement can only distinguish between two cases: true and false. In many cases a more powerful statement, the switch statement. switch (M as m) P(m) measures M and then executes the program P(m) where m is the outcome of the measurement. Examples if (M) P else Q Measure M, if true, run P otherwise Q switch (M as m) print m^2 Outputs the square of the result of measuring M. print M^2 (shorthand) switch (M as m) { case m=1: print “one” case m>1: print “many” } Measure M, output one or many, depending of the outcome

Loops Informal description simple The program while (M) P denotes the experiment of repeatedly measuring M and if the outcome is true then executing P. If the outcome is false, abort. Mathematical description turns out to be difficult Two approaches immediately come to mind for defining while. The first would be to define while as a least fixed point. However due to the possibility of outputs there is no natural lattice structure. The second would be to define while as the limit of if(M){P;if(M){P;...}}. However, there is no natural topology giving the desired results. Axiomatic approach Since a direct limit/fixed point approach fails, we define while (M) P by stating some properties the experiment above should fulfill. These axioms can informally be stated as follows: The loop runs n times and terminates, iff M yields n times true and then false, and if P terminates n times. The loop runs n times and does not terminate, iff M yields n times true, and if P terminates n–1 times and does not terminate the n-th time. The loop runs an infinite number of times, iff always M yields true, and if P always terminates. The probability that one of these events occurs is 1. It can be shown that there is exactly one program (i.e. mixed measurement) exists fulfilling these axioms. Examples while (M) P Run program P while measurement M yields true. while (M) print N Measure M. If nonzero, measure N, output the outcome, and redo from start

Reasoning about programs Conditions are sets of states Modelling a pre-/postcondition as a set of states (density operators) gives as the ability to express even complex conditions like “variable x contains an uniform random value” or “variables x and y are unentangled” or “variable x is in the computational basis”. Pre-/postconditions If for any state ρ in M, the program P takes ρ to a state in N, we write {M} P {N} Conditional equivalence of programs If two programs P, Q behave identically upon a given set M of initial states, we say they are equivalent on M, written {M} P = Q. Programs can be conditioned on outputs If P is a program possibly having output a, we can define P | a as the program P restricted to having output a. Note that P | a is not probability preserving. Examples {1} P {1} If the initial state is a random state, so is the post-execution state (e.g. P is a permutation of basis states) { x in computational basis} P = noop If variable x is in the computational basis, program P has no effect (e.g. P might be a dephasing of x ) {tr ρ = 1} P | a { tr ρ=½} Program P has probability ½ of outputting a