on coinduction and quantum lambda calculi
play

On Coinduction and Quantum Lambda Calculi Yuxin Deng East China - PowerPoint PPT Presentation

On Coinduction and Quantum Lambda Calculi Yuxin Deng East China Normal University (Joint work with Yuan Feng and Ugo Dal Lago) To appear at CONCUR15 1 Outline Motivation A quantum -calculus Coinductive proof techniques


  1. 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

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

  3. Motivation 3

  4. 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

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

  6. 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

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

  8. 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

  9. A Quantum λ -Calculus 9

  10. Types A, B, C ::= qubit | A ⊸ B | !( A ⊸ B ) | 1 | A ⊗ B | A ⊕ B | A l 10

  11. 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

  12. 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

  13. Typing rules A linear !∆ , x : !( A ⊸ B ) ⊢ x : A ⊸ B !∆ , x : A ⊢ x : A !∆ , ∆ ′ ⊢ M : A ⊸ B !∆ , ∆ ′′ ⊢ N : A ∆ , x : A ⊢ M : B !∆ , ∆ ′ , ∆ ′′ ⊢ MN : B ∆ ⊢ λx A .M : A ⊸ B !∆ , ∆ ′ ⊢ M : A !∆ , ∆ ′ ⊢ 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 ) ⊢ N : C !∆ , f : !( A ⊸ B ) , x : A ⊢ M : B !∆ , ∆ ′ ⊢ 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

  14. Quantum closure Def. A quantum closure is a triple [ q, l, M ] where • q is a normalized vector of C 2 n , 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 � , { x �→ 1 } , x ] √ 2 14

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

  16. Structural rule p [ q, l, M ] � [ r, i, N ] p [ q, j ⊎ l, E [ M ]] � [ 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

  17. Extreme derivative k , µ × Def. Suppose we have subdistributions µ , µ → k for k ≥ 0 with the following properties: 0 + µ × µ → µ = 0 1 + µ × µ → µ → → 0 1 2 + µ × µ → µ → → 1 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

  18. 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

  19. Big-step reduction C ⇓ ε [ q, l, V ] ⇓ [ q, l, V ] � [ q, l, M ] ⇓ p k · [ r k , i k , V k ] { [ r k , i k , N ] ⇓ µ k } k ∈ K k ∈ K � [ q, l, M ⊗ N ] ⇓ p k ( V k ⊗ µ k ) k ∈ K � [ q, l, M ] ⇓ p k · [ r k , i k , V k ⊗ W k ] { [ r k , i k , ( N { V k /x, W k /y } )] ⇓ µ k } k ∈ K k ∈ K [ q, l, let x A ⊗ y B = M in N ] ⇓ � p k µ k k ∈ K Lem. [ [ C ] ] = sup { µ | C ⇓ µ } 19

  20. 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

  21. Coinductive proof techniques 21

  22. A Probabilistic Labelled Transition System i U i meas [ q, l, x 1 ⊗ · · · ⊗ x n ] − − → [ q, l, U ( x 1 ⊗ · · · ⊗ x n )] − − − − → [ q, l, meas x ] [ q, l, x ] ∅ ⊲ V : A ⊸ B ∅ ⊲ W : A skip [ q, ∅ , skip ] − − − → [ q, ∅ , Ω Ω Ω] @[ r,W ] [ q, l, V ] − − − − − → [ q, l ⊎ r, V W ] ∅ ⊲ in l V : A ⊕ B x : A ⊲ M : C l [ r,M ] − − − − − → [ q, l ⊎ r, M { V/x } ] [ q, l, in l V ] ∅ ⊲ V ⊗ W : A ⊗ B x : A, y : B ⊲ M : C eval − − − → [ ⊗ [ r,M ] C [ C ] ] [ q, l, V ⊗ W ] − − − − − → [ l ⊎ r, M { V/x, W/y } ] 22

  23. 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

  24. State-based bisimilarity Def. C ∼ s D iff • env ( C ) = env ( D ); ] ∼ s † [ • [ [ C ] [ D ] ]; → ν with µ ∼ s † ν , and a a • if C, D are values then C − → µ implies D − 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. i p i · tr fqv ( M ) q i q † env ( µ ) = � i for any µ = � i p i · [ q i , l i , M i ]. 24

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

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

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

  28. Soundness 28

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend