On Coinduction and Quantum Lambda Calculi

Similar documents
Probabilistic Applicative Bisimulation and Call-by-Value Lam

Quantum Functional Programming Language & Its Denotational Semantics

Applying quantitative semantics to higher-order quantum computing

Congruence of Bisimulation in a Non-Deterministic Call-By-Need Lambda Calculus

Bisimulation and coinduction in higher-order languages

A probabilistic lambda calculus - Some preliminary investigations

An introduction to process calculi: Calculus of Communicating Systems (CCS)

Foundations of Quantum Programming

Přednáška 12. Důkazové kalkuly Kalkul Hilbertova typu. 11/29/2006 Hilbertův kalkul 1

Stochastic Domain Theory

Bisimulation for Neighbourhood Structures

On Distribution Based Bisimulations for Probabilistic Automata

QWIRE Practice: Formal Verification of Quantum Circuits in Coq

Bisimulation for Neighbourhood Structures

Systems of modal logic

Simulation in the Call-by-Need Lambda-Calculus with Letrec, Case, Constructors, and Seq

A few bridges between operational and denotational semantics of programming languages

Operational Semantics Using the Partiality Monad

Step-indexed models of call-by-name: a tutorial example

Towards Correctness of Program Transformations Through Unification and Critical Pair Computation

A call-by-name lambda-calculus machine

Complete Partial Orders, PCF, and Control

A Propositional Dynamic Logic for Instantial Neighborhood Semantics

arxiv: v1 [cs.lo] 22 Jun 2015

A Note on Scope and Infinite Behaviour in CCS-like Calculi p.1/32

Streams and Coalgebra Lecture 2

A categorical model for a quantum circuit description language

Bringing class diagrams to life

Communication and Concurrency: CCS

Coalgebra, lecture 10: Algebra and Coalgebra for Regular Expressions

On Coinductive Equivalences for Higher-Order Probabilistic Functional Programs

Probabilistic Bisimilarity as Testing Equivalence

Coinductive big-step semantics and Hoare logics for nontermination

Chapter 2 Classical Probability Theories

Orthogonality and Algebraic Lambda-Calculus

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω

Meaning and Reference INTENSIONAL AND MODAL LOGIC. Intensional Logic. Frege: Predicators (general terms) have

Minimal logic for computable functionals

Simulation in the Call-by-Need Lambda-Calculus with letrec

An Equational Axiomatization for Multi-Exit Iteration

Understanding Process Semantics

Communication and Concurrency: CCS. R. Milner, A Calculus of Communicating Systems, 1980

Operationally-Based Theories of Program Equivalence

Local time of self-affine sets of Brownian motion type and the jigsaw puzzle problem

Computational Soundness of a Call by Name Calculus of Recursively-scoped Records. UMM Working Papers Series, Volume 2, Num. 3.

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

2 Results I: Lifting Computer Science

Formal Techniques for Software Engineering: Denotational Semantics

Completeness for coalgebraic µ-calculus: part 2. Fatemeh Seifan (Joint work with Sebastian Enqvist and Yde Venema)

Parameterizations and Fixed-Point Operators on Control Categories

Kleene modules and linear languages

Extending Abramsky s Lazy Lambda Calculus: (Non)-Conservativity of Embeddings

Automated Verification of Asymmetric Encryption

Logical Characterizations of Simulation and Bisimulation for Fuzzy Transition Systems

Equations, contractions, and unique solutions

Simply Typed Lambda-Calculi (II)

On the Executability of Interactive Computation. June 23, 2016 Where innovation starts

COMPUTER ARITHMETIC. 13/05/2010 cryptography - math background pp. 1 / 162

The space of located subsets

Propositional Logic Language

First-order logic Syntax and semantics

Automated Synthesis of Tableau Calculi

Environmental Bisimulations for Probabilistic Higher-Order Languages

Lazy Strong Normalization

A Lambda Calculus Foundation for Universal Probabilistic Programming

Small families. (at INRIA with Gérard and in the historical λ-calculus) Jean-Jacques Lévy

Topology, Math 581, Fall 2017 last updated: November 24, Topology 1, Math 581, Fall 2017: Notes and homework Krzysztof Chris Ciesielski

On simulations and bisimulations of general flow systems

Strong bisimilarity can be opened

ON THE AXIOMATIZABILITY OF IMPOSSIBLE FUTURES

Example. Lemma. Proof Sketch. 1 let A be a formula that expresses that node t is reachable from s

CS522 - Programming Language Semantics

Analyzing Quantum Circuits Via Polynomials

Streams and Coalgebra Lecture 1

CPSC 313 Introduction to Computability

The L Machines are very high-level, in two senses:

Axiomatic Semantics. Lecture 9 CS 565 2/12/08

Predicate Calculus - Semantic Tableau (2/2) Moonzoo Kim CS Division of EECS Dept. KAIST

Quantum Recursion and Second Quantisation

Topological dynamics: basic notions and examples

On a Categorical Framework for Coalgebraic Modal Logic

The State Explosion Problem

MODERN APPLIED ALGEBRA

n-dimensional Boolean algebras

Iris: Higher-Order Concurrent Separation Logic. Lecture 4: Basic Separation Logic: Proving Pointer Programs

Names and Symmetry in Computer Science

Preuves de logique linéaire sur machine, ENS-Lyon, Dec. 18, 2018

Notation for Logical Operators:

Realizability Semantics of Parametric Polymorphism, General References, and Recursive Types

Justification logic for constructive modal logic

How to Prove Similarity a Precongruence in Non-Deterministic Call-by-Need Lambda Calculi

On Böhm Trees and Lévy-Longo Trees in π-calculus

Extending the Lambda Calculus: An Eager Functional Language

Constructive Formalization of Regular Languages

Baire category theorem and nowhere differentiable continuous functions

Marie Duží

Rings and Fields Theorems

Algebraic Semantics for Coalgebraic Logics

Advanced Lambda Calculus Lecture 5

Partially commutative linear logic: sequent calculus and phase semantics

Transcription:

On Coinduction and Quantum Lambda Calculi Yuxin Deng East China Normal University (Joint work with Yuan Feng and Ugo Dal Lago) To appear at CONCUR 15 1

Outline Motivation A quantum λ-calculus Coinductive proof techniques Soundness Completeness Summary 2

Motivation 3

Quantum programming languages Fruitful attempts of language design, e.g. QUIPPER: an expressive functional higher-order language that can be used to program many quantum algorithms and can generate quantum gate representations using trillions of gates. [Green et al. PLDI 13] LIQUi : a modular software architecture designed to control quantum hardware - it enables easy programming, compilation, and simulation of quantum algorithms and circuits. [Wecker and Svore. CoRR 2014] Open problem: Fully abstract denotational semantics wrt operational semantics 4

Contextual equivalence An important notion of program equivalence in programming languages. M N if C : C[M] C[N] 5

An example in linear PCF f 1 := val(λx.val(0) val(1)) f 2 := val(λx.val(0)) val(λx.val(1)). [Deng and Zhang, TCS, 2015] 6

An example f 1 := val(λx.val(0) val(1)) f 2 := val(λx.val(0)) val(λx.val(1)). f 1 f 2 C := bind f = [ ] in bind x = f(0) in bind y = f(0) in val(x = y). 7

Linear context? f 1 := val(λx.val(0) val(1)) f 2 := val(λx.val(0)) val(λx.val(1)). Equivalence under linear contexts. 8

A Quantum λ-calculus 9

Types A,B,C ::= qubit A B!(A B) 1 A B A B A l 10

Terms M, N, P ::= x Variables λx A.M M N Abstractions / applications skip M;N Skip / seq. compositions M N let x A y B = M in N Tensor products / proj. in l M in r M Sums match P with (x A : M y B : N) Matches split A Split letrec f A B x = M in N Recursions new meas U Quantum operators 11

Values V,W ::= x c λx A.M V W in l V in r W where c {skip,split A,meas,new,U}. As syntactic sugar bit = 1 1, tt = in r skip, and ff = in l skip. 12

Typing rules A linear!,x : A x : A,x : A M : B λx A.M : A B!, M : A!,x :!(A B) x : A B!, M : A B!, N : A!,, MN : B!, M : B!, in l M : A B!, in r M : A B!, P : A B!,,x : A M : C!,,y : B N : C!,, match P with (x A : M y B : N) : C!,f :!(A B),x : A M : B!,,f :!(A B) N : C!, letrec f A B x = M in N : C U of arity n! new : bit qubit! meas : qubit bit! U : qubit n qubit n 13

Quantum closure Def. A quantum closure is a triple [q,l,m] where q is a normalized vector of C 2n, for some integer n 0. It is called the quantum state; M is a term, not necessarily closed; l is a linking function that is an injective map from fqv(m) to the set {1,...,n}. A closure [q,l,m] is total if l is surjective. In that case we write l as x 1,...,x n if dom(l) = {x 1,...,x n } and l(x i ) = i for all i {1...n}. Non-total closures are allowed. E.g. [ 00 + 11 2,{x 1},x] 14

Small-step reduction axioms [q, l, (λx A.M)V] 1 [q, l, M{V/x}] [q, l, let x A y B = V W in N] [q, l, skip;n] 1 [q, l, N] [q, l, match in l V with (x A : M y B : N)] [q, l, match in r V with (x A : M y B : N)] [q, l, letrec f A B x = M in N] [q,, newff] [q,, newtt] 1 [q 0, {x n+1}, x] 1 [q 1, {x n+1}, x] [αq 0 +βq 1, {x i}, measx] [αq 0 +βq 1, {x i}, measx] [q, l, U(x 1 x k )] 1 [q, l, N{V/x,W/y}] 1 [q, l, M{V/x}] 1 [q, l, N{V/y}] 1 [q, l, N{(λx A.letrec f A B x = M in M)/f}] α 2 [r 0,, ff] β 2 [r 1,, tt] 1 [r, l, (x 1 x k )] 15

Structural rule [q, l, M] [q, j l, E[M]] p [r, i, N] p [r, j i, E[N]] where E is any evaluation context generated by the grammar E ::= [] E M V E E;M E M V E in l E in r E let x A y B = E in M match E with (x A : M y B : N). 16

Extreme derivative Def. Suppose we have subdistributions µ, µ k, µ k following properties: for k 0 with the µ = µ 0 +µ 0 µ 0 µ 1 +µ 1 µ 1 µ 2 +µ 2. and each µ k is stable in the sense that C, for all C µ k. Then we call µ := k=0 µ k an extreme derivative of µ, and write µ µ. NB: µ could be a proper subdistribution. 17

Example Consider a Markov chain with three states {s 1,s 2,s 3 } and two transitions s 1 1 2 s 2 + 1 2 s 3 and s 3 s 3. Then s 1 1 2 s 2. Let C be a quantum closure in the Markov chain (Cl, ). Then C [C] for a unique subdistribution [C]. 18

Big-step reduction C ε [q,l,v] [q,l,v] [q,l,m] k Kp k [r k,i k,v k ] {[r k,i k,n] µ k } k K [q,l,m N] k Kp k (V k µ k ) [q,l,m] k Kp k [r k,i k,v k W k ] {[r k,i k,(n{v k /x,w k /y})] µ k } k K [q,l,let x A y B = M in N] k Kp k µ k Lem. [C] = sup{µ C µ} 19

Linear contextual equivalence Def. A linear context is a term with a hole, written C( ;A), such that C[M] is a closed program when the hole is filled in by a term M, where M : A, and the hole lies in linear position. Def. Linear contextual equivalence is the typed relation given by M N : A if for every linear context C, quantum state q and linking function l such that C( ;A) : B, and both [q,l,c[m]] and [q,l,c[n]] are total quantum closures, [[q,l,c[m]]] = [[q,l,c[n]]] 20

Coinductive proof techniques 21

A Probabilistic Labelled Transition System [q,l,x 1 x n ] iu [q,l,u(x 1 x n )] [q,l,x] imeas [q,l,measx] [q,,skip] skip [q,,ω] V : A B W : A [q, l, V] @[r,w] [q, l r, VW] in l V : A B x : A M : C [q,l,in l V] l[r,m] [q,l r,m{v/x}] V W : A B [q,l,v W] x : A,y : B M : C [r,m] [l r,m{v/x,w/y}] C eval [C] 22

Lifting relations Def. Let S,T be two countable sets and R S T be a binary relation. The lifted relation R D(S) D(T) is defined by letting µ R ν iff µ(x) ν(r(x)) for all X S. Here R(X) = {t T s X. s R t} and µ(x) = s X µ(s). There are alternative formulations; related to the Kantorovich metric and the maximum network flow problem. See e.g. 23

State-based bisimilarity Def. C s D iff env(c) = env(d); [C] s [D]; if C,D are values then C a µ implies D a ν with µ s ν, and vice-versa. Write M s N : A if [q,l,m] s [q,l,n] for any q and l such that [q,l,m] and [q,l,n] are both typable quantum closures. env(µ) = i p i tr fqv(m) q i q i for any µ = i p i [q i,l i,m i ]. 24

Distribution-based bisimilarity Def. µ a ρ if ρ = s µ µ(s) µ s, where µ s is determined as follows: either s a µ s or there is no ν with s a ν, and in this case we set µ s = ε. Def. µ d ν iff env(µ) = env(ν); [µ] d [ν]; if µ and ν are value distributions and µ a ρ, then ν a ξ for some ξ with ρ d ξ, and vice-versa. Write M d N : A if [[q,l,m]] d [[q,l,n]] for any q and l such that [q,l,m] and [q,l,n] are quantum closures. 25

s is finer than d s t a a s 1 b 1 2 1 2 t 1 t 2 1 2 1 2 b b s 2 s 3 t 3 t 4 c d c d s 4 t 5 s s t 26

Similar behaviour by quantum closures [,,(λxy.meas(h(new ff)))x] eval [ 00 + 11 2, x 1 x 2,(λxy.measx 1 )(measx 2 )] eval [,, λy.meas(h(new ff))] @[,V] 1 2 1 2 [,, meas(h(new ff))] [ 0, x 1,λy.measx 1 ] [ 1, x 1,λy.measx 1 ] eval @[,V] @[,V] [ 0, x 1,measx 1 ] [ 1, x 1,measx 1 ] 1 2 1 2 eval eval [,,ff] [,,tt] [,,ff] [,,tt] ff tt ff tt [,,Ω] [,,Ω] 27

Soundness 28

Congruence Basic idea: Given a relation R, construct a congruence candidate R H, and then show R=R H. 29

Howe s construction,x : A [q,l,m] R H [r,j,n] [r,j,λx A.N] R [p,i,l] [q,l,λx A.M] R H [p,i,l]!, [q,l,m] R H [r,j,n]!, [q,i,l] R H [r,m,p]!,, [r,j m,np] R [s,n,q]!,, [q,l i,ml] R H [s,n,q]!, [q,l,m] R H [r,j,n]!, [q,i,l] R H [r,m,p]!,, [r,j m,n P] R [s,n,q]!,, [q,l i,m L] R H [s,n,q] 30

Congruence Lem. If [q,l,m] s H [r,j,n] then [[q,l,m]] ( s H ) [[r,j,n]]. Lem. If [q,l,v] H s [r,j,w] then we have that [q,l,v] a [r,j,w] ν and µ ( H s ) ν. a µ implies Consequently, s = s H. Similar arguments apply to d. 31

Soundness Thm. Both s and d are included in. 32

Completeness 33

A simple testing language The tests: t ::= ω a t Apply a test to a distribution in a reactive plts Pr(µ,ω) = µ Pr(µ,a t) = Pr(ρ,t) where µ a ρ µ = T ν iff t T : Pr(µ,t) = Pr(ν,t). 34

Characterisation of d by tests Thm. Let µ and ν be two distributions in a reactive plts. Then µ d ν if and only if µ = T ν. 35

Converting a test into a context Lem. Let A be a type and t a test. There is a context C A t such that C A t ( ;A) : bit and for every M with M : A, we have Pr([q,l,M],t) = [[q,l,c A t [M]]] where [q,l,m] and [q,l,c A t [M]] are quantum closures for any q and l. 36

Full abstraction Thm. coincides with d. 37

Summary 38

Conclusion Two notions of bisimilarity for reasoning about higher-order quantum programs Both bisimilarities are sound with respect to the linear contextual equivalence The distribution-based one is complete. 39

Future work A denotational model fully abstract with respect to the linear contextual equivalence. 40

Thank you! 41