P1: SBT cuus834-fm
cuus834-gay
978 0 521 51374 6
October 24, 2009 13:39
This page intentionally left blank
ii
P1...
48 downloads
1428 Views
3MB Size
Report
This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
Report copyright / DMCA form
P1: SBT cuus834-fm
cuus834-gay
978 0 521 51374 6
October 24, 2009 13:39
This page intentionally left blank
ii
P1: SBT cuus834-fm
cuus834-gay
978 0 521 51374 6
October 24, 2009 13:39
Semantic Techniques in Quantum Computation The study of computational processes based on the laws of quantum mechanics has led to the discovery of new algorithms, cryptographic techniques, and communication primitives. This book explores quantum computation from the perspective of the branch of theoretical computer science known as semantics, as an alternative to the more well-known studies of algorithmics, complexity theory, and information theory. It collects chapters from leading researchers in the field, discussing the theory of quantum programming languages, logics and tools for reasoning about quantum systems, and novel approaches to the foundations of quantum mechanics. This book is suitable for graduate students and researchers in quantum information and computation, as well as those in semantics, who want to learn about a new field arising from the application of semantic techniques to quantum information and computation. Simon Gay is a Senior Lecturer in the Department of Computing Science at the University of Glasgow. Prior to taking his current position, he worked as a research associate at Imperial College London, where he also earned his Ph.D. in computer science, and as a lecturer at Royal Holloway, University of London. Ian Mackie earned his M.Sc. and Ph.D. degrees in computer science at Imperial College London. He is editor-in-chief of an undergraduate textbook series and coauthor of an advanced textbook on proof theory and automated deduction.
i
P1: SBT cuus834-fm
cuus834-gay
978 0 521 51374 6
October 24, 2009 13:39
ii
P1: SBT cuus834-fm
cuus834-gay
978 0 521 51374 6
October 24, 2009 13:39
Semantic Techniques in Quantum Computation
Edited by SIMON GAY
IAN MACKIE
iii
CAMBRIDGE UNIVERSITY PRESS
Cambridge, New York, Melbourne, Madrid, Cape Town, Singapore, São Paulo, Delhi, Dubai, Tokyo Cambridge University Press The Edinburgh Building, Cambridge CB2 8RU, UK Published in the United States of America by Cambridge University Press, New York www.cambridge.org Information on this title: www.cambridge.org/9780521513746 © Cambridge University Press 2010 This publication is in copyright. Subject to statutory exception and to the provision of relevant collective licensing agreements, no reproduction of any part may take place without the written permission of Cambridge University Press. First published in print format 2009 ISBN-13
978-0-511-65864-8
eBook (NetLibrary)
ISBN-13
978-0-521-51374-6
Hardback
Cambridge University Press has no responsibility for the persistence or accuracy of urls for external or third-party internet websites referred to in this publication, and does not guarantee that any content on such websites is, or will remain, accurate or appropriate.
P1: SBT cuus834-fm
cuus834-gay
978 0 521 51374 6
October 24, 2009 13:39
Contents
Contributors Preface
page vii xi
1 No-Cloning in Categorical Quantum Mechanics Samson Abramsky
1
2 Classical and Quantum Structuralism ´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
29
3 Generalized Proof-Nets for Compact Categories with Biproducts Ross Duncan
70
4 Quantum Lambda Calculus Peter Selinger and Benoˆıt Valiron
135
5 The Quantum IO Monad Thorsten Altenkirch and Alexander S. Green
173
6 Abstract Interpretation Techniques for Quantum Computation Philippe Jorrand and Simon Perdrix
206
7 Extended Measurement Calculus Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
235
8 Predicate Transformer Semantics of Quantum Programs Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
311
9 The Structure of Partial Isometries Peter Hines and Samuel L. Braunstein
361
10 Temporal Logics for Reasoning about Quantum Systems 389 Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas 11 Specification and Verification of Quantum Protocols Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
414
Index
473 v
P1: SBT cuus834-fm
cuus834-gay
978 0 521 51374 6
October 24, 2009 13:39
vi
P1: SBT cuus834-fm
cuus834-gay
978 0 521 51374 6
October 24, 2009 13:39
Contributors
Samson Abramsky Oxford University Computing Laboratory, Wolfson Building, Parks Road, Oxford OX1 3QD, UK Thorsten Altenkirch School of Computer Science, University of Nottingham, Jubilee Campus, Wollaton Road, Nottingham NG8 1BB, UK Samuel L. Braunstein Department of Computer Science, University of York, Heslington, York YO10 5DD, UK Bob Coecke Oxford University Computing Laboratory, Wolfson Building, Parks Road, Oxford OX1 3QD, UK Vincent Danos School of Informatics, University of Edinburgh, Informatics Forum, 10 Crichton Street, Edinburgh EH8 9AB, UK Runyao Duan Centre for Quantum Computation and Intelligent Systems, Faculty of Engineering and Information Technology, University of Technology Sydney, City Campus, 15 Broadway, Ultimo, NSW 2007, Australia; and State Key Laboratory of Intelligent Technology and Systems, Tsinghua National Laboratory for Information Science and Technology, Department of Computer Science and Technology, Tsinghua University, Beijing 100084, China Ross Duncan Oxford University Computing Laboratory, Wolfson Building, Parks Road, Oxford OX1 3QD, UK
vii
P1: SBT cuus834-fm
cuus834-gay
viii
978 0 521 51374 6
October 24, 2009 13:39
Contributors
Yuan Feng Centre for Quantum Computation and Intelligent Systems, Faculty of Engineering and Information Technology, University of Technology Sydney, City Campus, 15 Broadway, Ultimo, NSW 2007, Australia; and State Key Laboratory of Intelligent Technology and Systems, Tsinghua National Laboratory for Information Science and Technology, Department of Computer Science and Technology, Tsinghua University, Beijing 100084, China Simon J. Gay Department of Computing Science, University of Glasgow, Sir Alwyn Williams Building, Lilybank Gardens, Glasgow G12 8QQ, UK Alexander S. Green School of Computer Science, University of Nottingham, Jubilee Campus, Wollaton Road, Nottingham NG8 1BB, UK Peter Hines Department of Computer Science, University of York, Heslington, York YO10 5DD, UK Zhengfeng Ji Perinmeter Institute for Theoretical Physics, 31 Caroline Street N., Waterloo, Ontario, Canada Philippe Jorrand Laboratoire d’Informatique de Grenoble, 220 me de la Chimie, 38400 Saint Martin d’H`eres, France Elham Kashefi School of Informatics, University of Edinburgh, Informatics Forum, 10 Crichton Street, Edinburgh EH8 9AB, UK Paulo Mateus Security and Quantum Information Group, Instituto de Telecomunicac¸o˜ es and Departmento de Matem´atica, Instituto Superior T´ecnico, Av. Rovisco Pais, 1049001 Lisboa, Portugal Rajagopal Nagarajan Department of Computer Science, University of Warwick, Coventry CV4 7AL, UK Prakash Panangaden School of Computer Science, McGill University, 3480 University Street, Montr´eal, Qu´ebec H3A 2A7, Canada Nikolaos Papanikolaou International Digital Laboratory, WMG, University of Warwick, Coventry CV4 7AL, UK
P1: SBT cuus834-fm
cuus834-gay
978 0 521 51374 6
Contributors
October 24, 2009 13:39
ix
´ Oliver Paquette Eric Oxford University Computing Laboratory, Wolfson Building, Parks Road, Oxford OX1 3QD, UK Dusko Pavlovic Kestrel Institute, 3260 Hillview Avenue, Palo Alto, California 94304, USA; and Oxford University Computing Laboratory, Wolfson Building, Parks Road, Oxford OX1 3QD, UK Simon Perdrix School of Informatics, University of Edinburgh, Informatics Forum, 10 Crichton Street, Edinburgh EH8 9AB, UK; and Laboratoire PPS, Universit´e Paris DiderotParis 7, Case 7014, 75205 Paris Cedex 13, France Jaime Ramos Security and Quantum Information Group, Instituto de Telecomunicac¸o˜ es and Departmento de Matem´atica, Instituto Superior T´ecnico, Av. Rovisco Pais, 1049001 Lisboa, Portugal Peter Selinger Department of Mathematics and Statistics, Dalhousie University, Halifax, Nova Scotia B3H 3J5, Canada Am´ılcar Sernadas Security and Quantum Information Group, Instituto de Telecomunicac¸o˜ es and Departmento de Matem´atica, Instituto Superior T´ecnico, Av. Rovisco Pais, 1049001 Lisboa, Portugal Cristina Sernadas Security and Quantum Information Group, Instituto de Telecomunicac¸o˜ es and Departmento de Matem´atica, Instituto Superior T´ecnico, Av. Rovisco Pais, 1049001 Lisboa, Portugal Benoˆıt Valiron INRIA and Laboratoire d’Informatique, Ecole Polytechnique, 91128 Palaiseau Cedex, France Mingsheng Ying Centre for Quantum Computation and Intelligent Systems, Faculty of Engineering and Information Technology, University of Technology Sydney, City Campus, 15 Broadway, Ultimo, NSW 2007, Australia; and State Key Laboratory of Intelligent Technology and Systems, Tsinghua National Laboratory for Information Science and Technology, Department of Computer Science and Technology, Tsinghua University, Beijing 100084, China
P1: SBT cuus834-fm
cuus834-gay
978 0 521 51374 6
October 24, 2009 13:39
x
P1: SBT cuus834-fm
cuus834-gay
978 0 521 51374 6
October 24, 2009 13:39
Preface
The idea of quantum computation, in the algorithmic sense, originated from the suggestion by Feynman (1982) that a computer based on the principles of quantum mechanics might be capable of efficiently simulating quantum systems of interest to physicists; such simulation seems to be very difficult with classical computers. Feynman’s suggestion was followed up by Deutsch (1985), who introduced the notion of the quantum Turing machine and investigated the possible computational power of physically realizable computers. He showed that a specific problem, now known as Deutsch’s problem, can be solved more efficiently by a quantum algorithm than by a classical algorithm. Several years later, Shor (1994) discovered efficient quantum algorithms for two important practical problems – integer factorization and the “discrete logarithm” problem – and shortly afterwards, Grover (1996) discovered an efficient quantum algorithm for unstructured searching. Since then, quantum algorithmics and quantum complexity theory have developed into substantial and active research fields. Meanwhile, the principles of quantum mechanics were being used as the foundation for a new approach to cryptography. Bennett and Brassard (1984) defined a protocol for key distribution whose security is guaranteed by the laws of quantum theory. Their system built on earlier work by Wiesner (1983), which remained unpublished until several years after its conception. We regard quantum cryptography as an aspect of quantum computation, in particular distributed quantum computation; alternatively, both quantum algorithmics and quantum cryptography can be viewed as branches of quantum information processing. Although Deutsch had observed in 1985 that “quantum computers raise interesting questions for the design of programming languages” (Deutsch 1985), it took some time for computing scientists to begin to rise to the challenge. Knill (1996) introduced a structured pseudocode for quantum algorithms, as an alternative to ¨ circuit diagrams; later, Omer (1998) began the systematic design of an imperative quantum programming language. Similar ideas, although not as extensively developed, had also been investigated by Baker (1996). An alternative approach, based
xi
P1: SBT cuus834-fm
cuus834-gay
xii
978 0 521 51374 6
October 24, 2009 13:39
Preface
on λ-calculus, was introduced by Maymin (1996); the λ-calculus approach was also followed by Van Tonder (2004). Another early influential project was that of Sanders and Zuliani (2000). During the next few years there was a rapid increase in interest in quantum computation from the research community in the theory of programming languages. Broadly speaking we refer to this community as the semantic side of theoretical computing science, in distinction to the algorithmic and complexitytheoretic side. Its interests encompass programming language semantics, type theory, semantics-based program analysis, and formal specification and verification of computational systems. There is a particular emphasis on compositional reasoning and connections with formal (and often nonclassical) logics. In relation to quantum computation, the logical and type-theoretic dimension of this community’s activity had been foreshadowed by Pratt (1992) and Wehr (1996) but was given prominence by Abramsky and Coecke (2003, 2004). A more comprehensive overview and a complete bibliography can be found in the survey by Gay (2006). By 2003 there was enough activity for Peter Selinger to organize a workshop on Quantum Programming Languages as part of the Fields Institute Summer School in Logic and Computation at the University of Ottawa. This meeting, as well as Selinger’s own research (Selinger 2004), was influential in drawing more semanticists into quantum computation. Several of the speakers have written or coauthored chapters for the present volume. The QPL workshops have flourished as an annual series of meetings; more recently the scope has broadened and the title has changed to “Quantum Physics and Logic.” With this background, and noting that a substantial part of the activity in the area was taking place in the UK, in 2006 we obtained funding from the UK Engineering and Physical Sciences Research Council (EPSRC) for a research network on Semantics of Quantum Computation (Gay and Mackie 2006–2009), known informally as QNET. Through grants EP/E00623X/1 and EP/E006833/1, the network provided funding for travel within the UK and for international research visits and conference attendance, in order to build a research community. Membership of the network has grown significantly, and three successful workshops have been held, in Glasgow (2006), London (2007), and Edinburgh (2008). A final workshop will take place in Oxford at the end of 2009. Many members of QNET are also involved in the European Union FP6 STREP project “QICS: Foundational Structures in Quantum Information and Computation” (Coecke 2007–2009), which has broadly similar themes. This volume provides a snapshot of research on the topics covered by QNET. We selected the authors in order to give complete coverage of the field; many, although by no means all, are members of QNET. Some of the chapters describe novel research, not published elsewhere, while others draw on several of their authors’ publications to provide a coherent picture of recent research on a particular topic. We followed a process whereby authors submitted draft versions of their chapters,
P1: SBT cuus834-fm
cuus834-gay
978 0 521 51374 6
Preface
October 24, 2009 13:39
xiii
which were reviewed in order to provide feedback before preparation of the final version. In general, each chapter was reviewed by an author of another chapter and by an independent reviewer. The first three chapters are set within the category-theoretic framework for quantum mechanics introduced by Abramsky and Coecke (2004). In Chapter 1, Samson Abramsky gives a category-theoretic analysis of the “no-cloning” property of quantum mechanics, which prevents arbitrary quantum information from ´ Paquette, and Dusko being copied. The topic of Chapter 2, by Bob Coecke, Eric Pavlovic, is the representation and structure of classical data, which can be freely copied, within categorical quantum mechanics. Ross Duncan, in Chapter 3, further develops the graphical calculus that has been a feature of categorical quantum mechanics from the beginning, showing how it can include reasoning about measurement. The next five chapters apply semantic techniques in several ways. Peter Selinger and Benoˆıt Valiron, in Chapter 4, present a quantum λ-calculus. They describe an operational semantics, a category-theoretic semantics (which has much structure in common with Chapters 1–3) and a type system. Chapter 5, by Thorsten Altenkirch and Alexander Green, moves from λ-calculus to the functional programming language Haskell and shows how quantum operations can be structured as a monad. In Chapter 6, Philippe Jorrand and Simon Perdrix use the formal semantics of an imperative quantum programming language as the basis for an abstraction interpretation which enables static analysis of entanglement. Chapter 7 is by Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix. It gathers together the results of their research programme on the measurement calculus, a formally defined language for measurement-based quantum computation. In Chapter 8, Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji study a different style of semantics – predicate transformers – that refers back to some of the first work on formal semantics of quantum programs (Sanders and Zuliani 2000). The final three chapters return to the theme of quantum logic, introduced in categorical form in the first three chapters. Peter Hines and Samuel Braunstein, in Chapter 9, extend the Birkhoff–von Neumann approach to quantum logic by generalizing from projectors to partial isometries, and study the resulting categorical structures. In Chapter 10, Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas discuss a temporal extension of exogenous quantum propositional logic (EQPL) which is designed to support reasoning about the dynamic behaviour of quantum systems such as algorithms and protocols. Finally, in Chapter 11, Simon Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou describe a model-checking tool that, given a formal model of a quantum system, can automatically verify specifications expressed in terms of EQPL and its temporal extensions. Simon Gay and Ian Mackie May 2009
P1: SBT cuus834-fm
cuus834-gay
xiv
978 0 521 51374 6
October 24, 2009 13:39
Preface
Bibliography Abramsky, S., and Coecke, B. (2003) Physical traces: Quantum vs. classical information processing. In Proceedings of the 9th Conference on Category Theory and Computer Science (CTCS 2002), volume 69 of Electronic Notes in Theoretical Computer Science. Elsevier Science. Also arXiv:cs.CG/0207057. Abramsky, S., and Coecke, B. (2004) A categorical semantics of quantum protocols. In Proceedings of the 19th Annual IEEE Symposium on Logic in Computer Science. IEEE Computer Society. Also arXiv:quant-ph/0402130. Baker, G. (1996) Qgol: A system for simulating quantum computations: Theory, implementation and insight. Honours thesis, Macquarie University; available as www.ifost.org.au/ ∼gregb/q-gol/QgolThesis.pdf. Bennett, C. H., and Brassard, G. (1984) Quantum cryptography: Public-key distribution and coin tossing. In Proceedings of the IEEE International Conference on Computer Systems and Signal Processing, pages 175–179. Coecke, B. (2007–2009) EU FP6 STREP QICS: Foundational Structures in Quantum Information and Computation. se10.comlab.ox.ac.uk:8080/FOCS/FP6STREPQICS en.html. Deutsch, D. (1985) Quantum theory, the Church-Turing principle and the universal quantum computer. Proceedings of the Royal Society of London A 400:97–117. Feynman, R. P. (1982) Simulating physics with computers. International Journal of Theoretical Physics 21(6–7):467–488. Gay, S. J. (2006) Quantum programming languages: Survey and bibliography. Mathematical Structures in Computer Science 16(4):581–600. Gay, S. J., and Mackie, I. C. (2006–2009) EPSRC Network on Semantics of Quantum Computation. www.qnet.org.uk. Grover, L. (1996) A fast quantum mechanical algorithm for database search. In Proceedings of the 28th Annual ACM Symposium on the Theory of Computation, pages 212–219. ACM Press. Also arXiv:quant-ph/9605043. Knill, E. (1996) Conventions for quantum pseudocode. Technical Report LAUR-96-2724, Los Alamos National Laboratory. Maymin, P. (1996) Extending the lambda calculus to express randomized and quantumized algorithms. arXiv:quant-ph/9612052. ¨ Omer, B. (1998) A Procedural Formalism for Quantum Computing. Master’s thesis, Department of Theoretical Physics, Technical University of Vienna. Pratt, V. (1992) Linear logic for generalized quantum mechanics. In Proceedings of the IEEE Workshop on Physics and Computation. Sanders, J. W., and Zuliani, P. (2000) Quantum programming. In Mathematics of Program Construction, volume 1837 of Lecture Notes in Computer Science. Springer. Selinger, P. (2004) Towards a quantum programming language. Mathematical Structures in Computer Science 14(4):527–586. Shor, P. W. (1994) Algorithms for quantum computation: discrete logarithms and factoring. In Proceedings of the 35th Annual IEEE Symposium on Foundations of Computer Science, pages 124–134. IEEE Press. Van Tonder, A. (2004) A lambda calculus for quantum computation. SIAM Journal on Computing 33(5):1109–1135. Also arXiv:quant-ph/0307150. Wehr, M. (1996) Quantum computing: A new paradigm and its type theory. Lecture given at the Quantum Computing Seminar, Lehrstuhl Prof. Beth, Universit¨at Karlsruhe. Wiesner, S. (1983) Conjugate coding. SIGACT News 15(1):78–88. Original manuscript written circa 1970.
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:18
1 No-Cloning in Categorical Quantum Mechanics Samson Abramsky
Abstract The no-cloning theorem is a basic limitative result for quantum mechanics, with particular significance for quantum information. It says that there is no unitary operation that makes perfect copies of an unknown (pure) quantum state. We re-examine this foundational result from the perspective of the categorical formulation of quantum mechanics recently introduced by the author and Bob Coecke. We formulate and prove a novel version of the result, as an incompatibility between having a “natural” copying operation and the structural features required for modeling quantum entanglement coexisting in the same category. This formulation is strikingly similar to a well-known limitative result in categorical logic, Joyal’s lemma, which shows that a “Boolean cartesian closed category” trivializes and hence provides a major roadblock to the computational interpretation of classical logic. This shows a heretofore unsuspected connection between limitative results in proof theory and no-go theorems in quantum mechanics. The argument is of a robust, topological character and uses the graphical calculus for monoidal categories to advantage.
1.1 Introduction The no-cloning theorem (Dieks 1982; Wootters and Zurek 1982) is a basic limitative result for quantum mechanics, with particular significance for quantum information. It says that there is no unitary operation that makes perfect copies of an unknown (pure) quantum state. A stronger form of this result is the nobroadcasting theorem (Barnum et al. 1996), which applies to mixed states. There is also a no-deleting theorem (Pati and Braunstein 2000). Recently, the author and Bob Coecke have introduced a categorical formulation of quantum mechanics (Abramsky and Coecke 2004, 2005, 2008), as a basis for a more structural, high-level approach to quantum information and computation. This has been elaborated by ourselves, our colleagues, and other workers in the field (Abramsky 2004, 2005, 2007; Abramsky and Duncan 2006; Coecke and Pavlovic 1
P1: SBT CUUS834-01
cuus834-gay
2
978 0 521 51374 6
October 30, 2009
18:18
Samson Abramsky
2007; Coecke and Duncan 2008; Selinger 2007; Vicary 2008) and has been shown to yield an effective and illuminating treatment of a wide range of topics in quantum information. Diagrammatic calculi for tensor categories (Joyal and Street 1991; Turaev 1994), suitably extended to incorporate the various additional structures that have been used to reflect fundamental features of quantum mechanics, play an important role, both as an intuitive and vivid visual presentation of the formalism and as an effective calculational device. It is clear that such a novel reformulation of the mathematical formalism of quantum mechanics, a subject more or less set in stone since von Neumann’s classic treatise (von Neumann 1932), has the potential to yield new insights into the foundations of quantum mechanics. In the present paper, we use it to open up a novel perspective on no-cloning. What we find, quite unexpectedly, is a link to some fundamental issues in logic, computation, and the foundations of mathematics. A striking feature of our results is that they are visibly in the same genre as a well-known result by Joyal in categorical logic (Lambek and Scott 1986) showing that a “Boolean cartesian closed category” trivializes, which provides a major roadblock to the computational interpretation of classical logic. In fact, they strengthen Joyal’s result, insofar as the assumption of a full categorical product (diagonals and projections) in the presence of a classical duality is weakened. This shows a heretofore unsuspected connection between limitative results in proof theory and no-go theorems in quantum mechanics. The further contents of the paper are as follows: • In the next section, we briefly review the three-way link between logic, computation, and categories and recall Joyal’s lemma. • In Section 1.3, we review the categorical approach to quantum mechanics. • Our main results are in Section 1.4, where we prove our limitative result, which shows the incompatibility of structural features corresponding to quantum entanglement (essentially, the existence of Bell states enabling teleportation) with the existence of a “natural” (in the categorical sense, corresponding essentially to basis-independent) copying operation. This result is mathematically robust, since it is proved in a very general context and has a topological content that is clearly revealed by a diagrammatic proof. At the same time it is delicately poised, since non-natural, basis-dependent copying operations do in fact play a key role in the categorical formulation of quantum notions of measurement. We discuss this context, and the conceptual reading of the results. • We conclude with some discussion of extensions of the results, further directions, and open problems.
1.2 Categories, Logic, and Computational Content: Joyal’s Lemma Categorical logic (Lambek and Scott 1986) and the Curry-Howard correspondence in Proof Theory (Sørensen and Urzyczyn 2006) give us a beautiful three-way correspondence:
P1: SBT cuus834-gay
978 0 521 51374 6
October 30, 2009
18:18
1 No-Cloning in Categorical Quantum Mechanics
3
- Computation
Logic
-
-
CUUS834-01
Categories More particularly, we have as a paradigmatic example: - λ-calculus -
IntuitionisticLogic
Cartesian Closed Categories Here we are focusing on the fragment of intuitionistic logic containing conjunction and implication, and the simply typed λ-calculus with product types. We shall assume familiarity with basic notions of category theory (Mac Lane 1998; Lawvere and Schanuel 1997). Recall that a cartesian closed category is a category with a terminal object, binary products, and exponentials. The basic cartesian closed adjunction is C(A × B, C) ∼ = C( A, B ⇒ C) . More explicitly, a category C with finite products has exponentials if for all objects A and B of C there is a couniversal arrow from − × A to B, i.e., an object A ⇒ B of C and a morphism ev A,B : (A ⇒ B) × A −→ B with the couniversal property: for every g : C × A −→ B, there is a unique morphism (g) : C −→ A ⇒ B such that A⇒B 6 (g) C
( A ⇒ B) × A 6 (g) × id A
ev A,B -
-
B
g
C×A
The correspondence between the intuitionistic logic of conjunction and implication and cartesian closed categories is summarized in the following table:
P1: SBT CUUS834-01
cuus834-gay
4
978 0 521 51374 6
October 30, 2009
18:18
Samson Abramsky
Axiom
Conjunction
, A A
Id
A∧B ∧ E2 B
f : −→ A g : −→ B f, g : −→ A × B f : −→ A × B π1 ◦ f : −→ A f : −→ A × B π2 ◦ f : −→ B
, A B ⊃I A⊃B
f : × A −→ B ( f ) : −→ (A ⇒ B)
A⊃B A ⊃E B
f : −→ (A ⇒ B) g : −→ A ev A,B ◦ f, g : −→ B
A B ∧I A∧B A∧B ∧ E1 A
Implication
π2 : × A −→ A
1.2.1 Joyal’s Lemma It is a very natural idea to seek to extend the preceding correspondence to the case of classical logic. Joyal’s lemma shows that there is a fundamental impediment to doing so.1 The natural extension of the notion of cartesian closed category, which corresponds to the intuitionistic logic of conjunction and implication, to the classical case is to introduce a suitable notion of classical negation. We recall that it is customary in intuitionistic logic to define the negation by ¬A := A ⊃ ⊥ where ⊥ is the falsum. The characteristic property of the falsum is that it implies every proposition. In categorical terms, this translates into the notion of an initial object. Note that for any fixed object B in a cartesian closed category, there is a well-defined contravariant functor C −→ C op :: A → ( A ⇒ B) . This will always satisfy the properties corresponding to negation in minimal logic, and if B = ⊥ is the initial object in C, then it will satisfy the laws of intuitionistic negation. In particular, there is a canonical arrow A −→ ( A ⇒ ⊥) ⇒ ⊥ that is just the curried form of the evaluation morphism. This corresponds to the valid intuitionistic principle A ⊃ ¬¬A. What else is needed in order to 1
It is customary to refer to this result as Joyal’s lemma, although, apparently, he never published it. The usual reference is to Lambek and Scott (1986), who attribute the result to Joyal, but follow the proof given by Freyd (1972). Our statement and proof are somewhat different from those by Lambek and Scott (1986).
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:18
1 No-Cloning in Categorical Quantum Mechanics
5
obtain classical logic? As is well known, the missing principle is that of proof by contradiction: the converse implication ¬¬A ⊃ A. This leads us to the following notion. A dualizing object ⊥ in a closed category is one for which the canonical arrow A −→ ( A ⇒ ⊥) ⇒ ⊥ is an isomorphism for all A. We can now state Joyal’s lemma: Proposition 1.2.1 (Joyal’s Lemma). Any cartesian closed category with a dualizing object is a preorder (hence trivial as a semantics for proofs or computational processes). Proof. Note first that, if ⊥ is dualizing, the induced negation functor C −→ C op is a contravariant equivalence C C op . Since ( ⇒ A) ∼ = A where is the terminal object, it follows that ⊥ is the dual of , and hence initial. So it suffices to prove Joyal’s lemma under the assumption that the dualizing object is initial. We assume that ⊥ is a dualizing initial object in a cartesian closed category C. By cartesian closure, C(A × ⊥, B) ∼ = C(⊥, A ⇒ B), which is a singleton by initiality of ⊥. It follows that A × ⊥ is initial.2 Now C( A, B) ∼ = C(B ⇒ ⊥, A ⇒ ⊥) ∼ = C((B ⇒ ⊥) × A, ⊥).
(1.1)
Given any h, k : C −→ ⊥, note that h = π1 ◦ h, k,
k = π2 ◦ h, k.
But ⊥ × ⊥ ∼ = ⊥, hence by initiality π1 = π2 , and so h = k, which by (1.1) implies that f = g for f, g : A −→ B.
1.2.2 Linearity and Classicality However, we know from linear logic that there is no impediment to having a closed structure with a dualizing object, provided we weaken our assumption on the underlying context-building structure, from cartesian × to monoidal ⊗. Then we get a wealth of examples of ∗-autonomous categories (Barr 1979), which stand to multiplicative linear logic as cartesian closed categories do to intuitionistic logic (Seely 1998). Joyal’s lemma can thus be stated in the following equivalent form. Proposition 1.2.2. A ∗-autonomous category in which the monoidal structure is cartesian is a preorder. 2
A slicker proof simply notes that A × (−) is a left adjoint by cartesian closure and hence preserves all colimits, in particular initial objects.
P1: SBT CUUS834-01
cuus834-gay
6
978 0 521 51374 6
October 30, 2009
18:18
Samson Abramsky
Essentially, a cartesian structure is a monoidal structure plus natural diagonals, and with the tensor unit a terminal object, i.e., plus cloning and deleting!
1.3 Categorical Quantum Mechanics In this section, we provide a brief review of the structures used in categorical quantum mechanics, their graphical representation, and how these structures are used in formalizing some key features of quantum mechanics. Further details can be found elsewhere (Abramsky and Coecke 2008; Abramsky 2005; Selinger 2007).
1.3.1 Symmetric Monoidal Categories We recall that a monoidal category is a structure (C, ⊗, I, a, l, r ) where: • • • •
C is a category, ⊗ : C × C → C is a functor (tensor), I is a distinguished object of C (unit), a, l, r are natural isomorphisms (structural isos) with components: a A,B,C : A ⊗ (B ⊗ C) ∼ = (A ⊗ B) ⊗ C rA : A ⊗ I ∼ lA : I ⊗ A ∼ =A =A such that certain diagrams commute, which ensure coherence (Mac Lane 1998), described by the slogan: All diagrams only involving a, l and r must commute.
Examples: • Both products and coproducts give rise to monoidal structures – which are the common denominator between them. (But in addition, products have diagonals and projections, and coproducts have codiagonals and injections.) • (N, , +, 0) is a monoidal category. • Rel, the category of sets and relations, with cartesian product (which is not the categorical product). • Vectk with the standard tensor product. Let us examine the example of Rel in some detail. We take ⊗ to be the cartesian product, which is defined on relations R : X → X and S : Y → Y as follows: ∀(x, y) ∈ X × Y, (x , y ) ∈ X × Y . (x, y)R ⊗ S(x , y ) ⇐⇒ x Rx ∧ y Sy . It is not difficult to show that this is indeed a functor. Note that, in the case that R, S are functions, R ⊗ S is the same as R × S in Set. Moreover, we take each a A,B,C to be the associativity function for products (in Set), which is an iso in Set and hence also in Rel. Finally, we take I to be the one-element set, and l A , r A to be the projection functions: their relational converses are their inverses in Rel. The monoidal coherence diagrams commute simply because they commute in Set.
P1: SBT cuus834-gay
978 0 521 51374 6
October 30, 2009
18:18
1 No-Cloning in Categorical Quantum Mechanics
7
Tensors and products. As mentioned earlier, products are tensors with extra structure: natural diagonals and projections, corresponding to cloning and deleting operations. This fact is expressed more precisely as follows. Proposition 1.3.1. Let C be a monoidal category (C, ⊗, I, a, l, r ). The tensor ⊗ induces a product structure iff there exist natural diagonals and projections, i.e., natural transformations A : A −→ A ⊗ A ,
p A,B : A ⊗ B −→ A ,
q A,B : A ⊗ B −→ B
such that the following diagrams commute. A⊗B
id
p A,A
? A⊗ A
A,B -
q A,A
( A ⊗ B) ⊗ (A ⊗ B)
id
A⊗
-
A
A
id A
A
A
CUUS834-01
- A
p A,B ⊗ q A,B B
-
? A⊗B
Symmetry. A symmetric monoidal category is a monoidal category (C, ⊗, I, a, l, r ) with an additional natural isomorphism (symmetry), σ A,B : A ⊗ B ∼ =B⊗A −1 , and some additional coherence diagrams commute. such that σ B,A = σ A,B
1.3.2 Scalars Let (C, ⊗, I, l, a, l, r ) be a monoidal category. We define a scalar in C to be a morphism s : I → I , i.e., an endomorphism of the tensor unit. Example 1.3.2. In FdVecK , linear maps K → K are uniquely determined by the image of 1 and hence are in bijective correspondence with elements of K ; composition corresponds to multiplication of scalars. In Rel, there are just two scalars, corresponding to the Boolean values 0, 1. The (multiplicative) monoid of scalars is then just the endomorphism monoid C(I, I ). The first key point is the elementary but beautiful observation by Kelly and Laplaza (1980) that this monoid is always commutative. Lemma 1.3.3. C(I, I ) is a commutative monoid.
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
8
October 30, 2009
18:18
Samson Abramsky
Proof. I 6
r I−1-
I
r I−1-
s ⊗t
I⊗I
? I
t
? I⊗I 6
1⊗t
t
- I
1⊗t
s⊗1
s
lI
I ⊗ I ====== I ⊗ I 6
lI
? - I 6
s⊗1
? - I ⊗ I ====== I ⊗ I −1
lI
s
rI
- I
using the coherence equation l I = r I .
The second point is that a good notion of scalar multiplication exists at this level of generality. That is, each scalar s : I → I induces a natural transformation sA : A
-
I ⊗A
s ⊗ 1A
I ⊗A
A
with the naturality square A
sA A
f
f ? B
sB
? - B
We write s • f for f ◦ s A = s B ◦ f . Note that 1• f = f s • (t • f ) = (s ◦ t) • f (s • g) ◦ (t • f ) = (s ◦ t) • (g ◦ f ) (s • f ) ⊗ (t • g) = (s ◦ t) • ( f ⊗ g) which exactly generalizes the multiplicative part of the usual properties of scalar multiplication. Thus scalars act globally on the whole category.
1.3.3 Compact Closed Categories A category C is ∗-autonomous (Barr 1979) if it is symmetric monoidal and comes equipped with a full and faithful functor ( )∗ : Cop → C
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
October 30, 2009
1 No-Cloning in Categorical Quantum Mechanics
18:18
9
such that a bijection C( A ⊗ B, C ∗ ) C( A, (B ⊗ C)∗ ) exists which is natural in all variables. Hence a ∗-autonomous category is closed, with A B := ( A ⊗ B ∗ )∗ . These ∗-autonomous categories provide a categorical semantics for the multiplicative fragment of linear logic (Seely 1998). A compact closed category (Kelly and Laplaza 1980) is a ∗-autonomous category with a self-dual tensor, i.e., with natural isomorphisms u A,B : (A ⊗ B)∗ A∗ ⊗ B ∗
uI : I∗ I .
It follows that A B A∗ ⊗ B . An alternative definition arises when one considers a symmetric monoidal category as a one-object bicategory. In this context, compact closure simply means that every object A, qua 1-cell of the bicategory, has a specified adjoint (Kelly and Laplaza 1980). Definition 1.3.4 (Kelly-Laplaza). A compact closed category is a symmetric monoidal category in which to each object A a dual object A∗ , a unit η A : I → A∗ ⊗ A and a counit A : A ⊗ A∗ → I are assigned, in such a way that the diagram r A−1-
A
A⊗I
1 A ⊗ ηA
A ⊗ ( A∗ ⊗ A)
1A
a A,A∗,A ? A
lA
? I⊗ A ( A ⊗ A∗ ) ⊗ A A ⊗ 1A
∗
and the dual one for A both commute. Examples. The symmetric monoidal categories (Rel, ×) of sets, relations, and cartesian product and (FdVecK , ⊗) of finite-dimensional vector spaces over a field K, linear maps, and tensor product are both compact closed. In (Rel, ×), we simply set X ∗ = X . Taking a one-point set {∗} as the unit for ×, and writing R ∪ for the converse of a relation R: η X = X∪ = {(∗, (x, x)) | x ∈ X } .
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
10
October 30, 2009
18:18
Samson Abramsky
For (FdVecK , ⊗), we take V ∗ to be the dual space of linear functionals on V . The unit and counit in (FdVecK , ⊗) are ηV : K → V ∗ ⊗ V :: 1 →
n
e¯ i ⊗ ei
i=1
and V : V ⊗ V ∗ → K :: ei ⊗ e¯ j → e¯ j (ei ) n where n is the dimension of V , {ei }i=1 is a basis of V and e¯ i is the linear functional ∗ in V determined by e¯ j (ei ) = δi j .
Definition 1.3.5. The name f and the coname f of a morphism f : A → B in a compact closed category are A∗⊗ A 6 ηA
1 A∗⊗f
A∗ ⊗ B -
f
f A⊗ B ∗
I
I - 6 B
- B ⊗ B∗ f ⊗1 B ∗
For R ∈ Rel(X, Y ) we have R = {(∗, (x, y)) | x Ry, x ∈ X, y ∈ Y } and R = {((x, y), ∗) | x Ry, x ∈ X, y ∈ Y } n and and for f ∈ FdVecK (V, W ) with (m i j ) the matrix of f in bases {eiV }i=1 W m {e j } j=1 of V and W respectively
f : K → V ∗ ⊗ W :: 1 →
n,m m i j · e¯ iV ⊗ e W j
i, j=1
and f : V ⊗ W ∗ → K :: eiV ⊗ e¯ W j → m i j . Given f : A → B in any compact closed category C we can define f ∗ : B ∗ → A∗ as B∗
l −1 B ∗-
I ⊗ B∗
∗ η A ⊗ 1 B-
f∗ ? A∗
A∗ ⊗ A ⊗ B ∗ 1 A∗ ⊗ f ⊗ 1 B ∗
r A∗
A∗ ⊗ I 1 A∗ ⊗ B
? A∗ ⊗ B ⊗ B ∗
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:18
1 No-Cloning in Categorical Quantum Mechanics
11
This operation ( )∗ is functorial and makes Definition 1.3.4 coincide with the one given at the beginning of this section. It then follows by C(A ⊗ B ∗ , I) ∼ = C( A, B) ∼ = C(I, A∗ ⊗ B) that every morphism of type I → A∗ ⊗ B is the name of some morphism of type A → B and every morphism of type A ⊗ B ∗ → I is the coname of some morphism of type A → B. In the case of the unit and the counit we have η A = 1 A
and
A = 1 A .
For R ∈ Rel(X, Y ) the dual is the converse, R ∗ = R ∪ ∈ Rel(Y, X ), and for f ∈ FdVecK (V, W ), the dual is f ∗ : W ∗ → V ∗ :: φ → φ ◦ f .
1.3.4 Dagger Compact Categories In order to fully capture the salient structure of FdHilb, the category of finitedimensional complex Hilbert spaces and linear maps, an important refinement of compact categories, to dagger- (or strongly) compact categories, was introduced by Abramsky and Coecke (2004, 2005). We do not make any significant use of this refined definition here, since our results hold at the more general level of compact categories.3 Nevertheless, we give the definition since we shall refer to this notion later. We adopt the most concise and elegant axiomatization of strongly or dagger compact closed categories, which takes the adjoint as primitive, following Abramsky and Coecke (2005). It is convenient to build the definition up in several stages, as in Selinger (2007). Definition 1.3.6. A dagger category is a category C equipped with a contravariant, identity-on-objects, strictly involutive functor f → f † : 1† = 1,
(g ◦ f )† = f † ◦ g † ,
f †† = f .
We define an arrow f : A → B in a dagger category to be unitary if it is an isomorphism such that f −1 = f † . An endomorphism f : A → A is self-adjoint if f = f †. Definition 1.3.7. A dagger symmetric monoidal category (C, ⊗, I, a, l, r, σ, †) combines dagger and symmetric monoidal structure, with the requirement that the natural isomorphisms a, l, r , σ are componentwise unitary, and moreover that † is a strict monoidal functor: ( f ⊗ g)† = f † ⊗ g † . Finally we come to the main definition. 3
We often use the abbreviated form “compact categories” instead of “compact closed categories.”
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
12
October 30, 2009
18:18
Samson Abramsky
Definition 1.3.8. A dagger compact category is a dagger symmetric monoidal category that is compact closed, and such that the following diagram commutes: I
ηA
A∗ ⊗ A
A
†
σ A∗ ,A -
? A ⊗ A∗
This implies that the counit is definable from the unit and the adjoint: †
A = η A ◦ σ A,A∗ and similarly the unit can be defined from the counit and the adjoint. Furthermore, it is in fact possible to replace the two commuting diagrams required in the definition of compact closure with one. We refer to Abramsky and Coecke (2005) for the details.
1.3.5 Trace An essential mathematical instrument in quantum mechanics is the trace of a linear map. In quantum information, extensive use is made of the more general notion of partial trace, which is used to trace out a subsystem of a compound system. A general categorical axiomatization of the notion of partial trace has been given by Joyal, Street, and Verity (Joyal et al. 1996). A trace in a symmetric monoidal category C is a family of functions TrUA,B : C( A ⊗ U, B ⊗ U ) −→ C(A, B) for objects A, B, U of C, satisfying a number of axioms, for which we refer to Joyal et al. (1996) or Abramsky (1996, 2005). This specializes to yield the total trace for endomorphisms by taking A = B = I . In this case, Tr( f ) = TrUI,I ( f ) : I → I is a scalar. Expected properties such as the invariance of the trace under cyclic permutations Tr(g ◦ f ) = Tr( f ◦ g) follow from the general axioms. Any compact closed category carries a canonical (in fact, a unique) trace. For an endomorphism f : A → A, the total trace is defined by Tr( f ) = A ◦ ( f ⊗ 1 A∗ ) ◦ σ A∗ ,A ◦ η A . This definition gives rise to the standard notion of trace in FdHilb.
P1: SBT cuus834-gay
978 0 521 51374 6
October 30, 2009
18:18
1 No-Cloning in Categorical Quantum Mechanics
13
1.3.6 Graphical Representation Complex algebraic expressions for morphisms in symmetric monoidal categories can rapidly become hard to read. Graphical representations exploit twodimensionality, with the vertical dimension corresponding to composition and the horizontal to the monoidal tensor, and provide more intuitive presentations of morphisms. We depict objects by wires, morphisms by boxes with input and output wires, composition by connecting outputs to inputs, and the monoidal tensor by locating boxes side by side. C
A
f
B
A
f
C
B
g
B
B A
f
B
B
f
C
A
A
g
f
C
g
B
A
h
B
E
A
Algebraically, these correspond to 1 A : A → A,
f : A → B, g ◦ f, 1 A ⊗ 1 B ,
f ⊗ 1C ,
f ⊗ g, ( f ⊗ g) ◦ h
respectively. (The convention in these diagrams is that the “upward” vertical direction represents progress of time.) Kets, bras, and scalars. A special role is played by boxes with either no input or no output, i.e., arrows of the form I −→ A or A −→ I respectively, where I is the unit of the tensor. In the setting of FdHilb and quantum mechanics, they correspond to states and costates respectively (cf. Dirac’s kets and bras; Dirac, 1947), which we depict by triangles. Scalars then arise naturally by composing these elements (cf. inner-product or Dirac’s bra-ket): A
π
ψ
π oψ
A
=
CUUS834-01
π A
ψ
Formally, scalars are arrows of the form I −→ I . In the physical context, they provide numbers (“probability amplitudes,” etc.). For example, in FdHilb, the tensor unit is C, the complex numbers, and a linear map s : C −→ C is determined by a single number, s(1). In Rel, the scalars are the Boolean semiring {0, 1}. This graphical notation can be seen as a substantial two-dimensional generalization of Dirac notation (Dirac 1947): φ |
| ψ
φ | ψ
Note how the geometry of the plane (more precisely, the fact that these diagrams are taken modulo planar isotopy) absorbs functoriality and naturality conditions, e.g.:
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
14
October 30, 2009
18:18
Samson Abramsky
g
f = g
f
(f ⊗ 1) ◦ (1 ⊗ g)
=
f ⊗g
=
(1 ⊗ g) ◦ (f ⊗ 1)
Cups and caps. We introduce a special diagrammatic notation for the unit and counit. A∗
A A
A
A∗
: A ⊗ A∗ −→ I
ηA : I −→ A∗ ⊗ A.
The lines indicate the information flow accomplished by these operations. Compact closure. The basic algebraic laws for units and counits become diagrammatically evident in terms of the information-flow lines:
=
(
A ⊗ 1A ) ◦ (1A ⊗ ηA )
=
= 1A
(1A∗ ⊗
A ) ◦ ( ηA ⊗ 1A∗ )
= 1A ∗
Names and conames in the graphical calculus. The units and counits are powerful; they allow us to define a closed structure on the category. In particular, we can form the name f of any arrow f : A → B, as a special case of λ-abstraction, and dually the coname f :
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:18
1 No-Cloning in Categorical Quantum Mechanics
15
f f
f : A ⊗ B∗ → I
f : I → A∗ ⊗ B
This is the general form of map-state duality: C(A ⊗ B ∗ , I ) ∼ = C(A, B) ∼ = C(I, A∗ ⊗ B).
1.3.7 Formalizing Quantum Information Flow In this section, we give a brief glimpse of categorical quantum mechanics. Although not needed for the results to follow, it provides the motivating context for them. For further details, see, e.g., Abramsky and Coecke (2008).
1.3.7.1 Quantum Entanglement We consider for illustration two standard examples of two-qubit entangled states, the Bell state: |00 + |11 and the EPR state: |01 + |10 In quantum mechanics, compound systems are represented by the tensor product of Hilbert spaces: H1 ⊗ H2 . A typical element of the tensor product has the form λi · φi ⊗ ψi i
where φi , ψi range over basis vectors and the coefficients λi are complex numbers. Superposition encodes correlation: in the Bell state, the off-diagonal elements have zero coefficients. This gives rise to Einstein’s “spooky action at a distance.” Even if the particles are spatially separated, measuring one has an effect on the state of the other. In the Bell state, for example, when we measure one of the two qubits
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
16
October 30, 2009
18:18
Samson Abramsky
we may get either 0 or 1, but once this result has been obtained, it is certain that the result of measuring the other qubit will be the same. This leads to Bell’s famous theorem (Bell 1964): QM is essentially nonlocal, in the sense that the correlations it predicts exceed those of any “local realistic theory.” From “paradox” to “feature”: Teleportation |φ
x ∈ B2
Ux
MBell
|00 + |11 |φ Alice
Bob
In the teleportation protocol (Bennett et al. 1993), Alice sends an unknown qubit φ to Bob, using a shared Bell pair as a “quantum channel.” By performing a measurement in the Bell basis on φ and her half of the entangled pair, a collapse is induced on Bob’s qubit. Once the result x of Alice’s measurement is transmitted by classical communication to Bob (there are four possible measurement outcomes, hence this requires two classical bits), Bob can perform a corresponding unitary correction Ux on his qubit, after which it will be in the state φ.
1.3.7.2 Categorical Quantum Mechanics and Diagrammatics We now outline the categorical approach to quantum mechanics developed in Abramsky and Coecke (2004, 2005). The same graphical calculus and underlying algebraic structure which we have seen in the previous section has been applied to quantum information and computation, yielding an incisive analysis of quantum information flow and powerful and illuminating methods for reasoning about quantum informatic processes and protocols (Abramsky and Coecke 2004). Bell states and costates. The cups and caps we have already seen in the guise of deficit and cancellation operations now take on the role of Bell states and costates (or preparation and test of Bell states), the fundamental building blocks of quantum
P1: SBT cuus834-gay
978 0 521 51374 6
October 30, 2009
18:18
1 No-Cloning in Categorical Quantum Mechanics
17
entanglement. (Mathematically, they arise as the transpose and cotranspose of the identity, which exist in any finite-dimensional Hilbert space by “map-state duality.”) A*
A A*
A
The formation of names and conames of arrows (i.e., map-state and map-costate duality) is conveniently depicted thus:
f
=:
f
=:
f
f
The key lemma in exposing the quantum information flow in (bipartite) entangled quantum systems can be formulated diagrammatically as follows: g f
=
g
g
=
f
=
CUUS834-01
g f
f
Note in particular the interesting phenomenon of “apparent reversal of the causal order.” Although on the left, physically, we first prepare the state labeled g and then apply the costate labeled f , the global effect is as if we applied f itself first, and then g. Derivation of quantum teleportation. This is the most basic application of compositionality in action. We can read off the basic quantum mechanical potential for teleportation immediately from the geometry of Bell states and costates:
ψ
ψ Alice
Bob
ψ
=
= Alice
Bob
Alice
Bob
The Bell state forming the shared channel between Alice and Bob appears as the downward triangle in the diagram; the Bell costate forming one of the possible measurement branches is the upward triangle. The information flow of the input qubit from Alice to Bob is then immediately evident from the diagrammatics.
P1: SBT cuus834-gay
978 0 521 51374 6
18
October 30, 2009
18:18
Samson Abramsky
This is not quite the whole story, because of the nondeterministic nature of measurements. But in fact, allowing for this shows the underlying design principle for the teleporation protocol. Namely, we find a measurement basis such that each possible branch i through the measurement is labeled, under map-state duality, with a unitary map f i . The corresponding correction is then just the inverse map f i−1 . Using our lemma, the full description of teleportation becomes:
-1
fi
-1
=
fi
fi
=
CUUS834-01
fi
1.4 No-Cloning Note that the proof of Joyal’s lemma given in Section 1.2.1 makes full use of both diagonals and projections, i.e., of both cloning and deleting. Our aim is to examine cloning and deleting as separate principles and to see how far each in isolation is compatible with the strong form of duality that, as we have seen, plays a basic structural role in the categorical axiomatization of quantum mechanics and applies very directly to the analysis of entanglement.
1.4.1 Axiomatizing Cloning Our first task is to axiomatize cloning as a uniform operation in the setting of a symmetric monoidal category. As a preliminary, we recall the notions of monoidal functor and monoidal natural transformation. Let C and D be monoidal categories. A (strong) monoidal functor (F, e, m) : C −→ D comprises: • A functor F : C −→ D • An isomorphism e : I ∼ = FI • A natural isomorphism m A,B : F A ⊗ F B −→ F( A ⊗ B) subject to various coherence conditions. Let (F, e, m), (G, e , m ) : C −→ D be monoidal functors. A monoidal natural . transformation between them is a natural transformation t : F −→ G such that e FI
I
e
tI -
? GI
FA ⊗ FB
m A,B -
t A ⊗ tB ? GA ⊗ GB
F( A ⊗ B) t A⊗B
? - G( A ⊗ B)
m A,B
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:18
1 No-Cloning in Categorical Quantum Mechanics
19
We say that a monoidal category has uniform cloning if it has a diagonal, i.e., a monoidal natural transformation A : A −→ A ⊗ A
A
A⊗ A σ A,A
? A⊗ A
-
that is moreover coassociative and cocommutative: 1 ⊗ A⊗ A A ⊗ ( A ⊗ A) A a A,A,A ? - A⊗ A - ( A ⊗ A) ⊗ A A ⊗1
Note that in the case when the monoidal structure is induced by a product, the standard diagonal A : A
1 A ,1 A
- A× A
automatically satisfies all these properties. To simplify the presentation, we shall henceforth make the assumption that the monoidal categories we consider are strictly associative. This is a standard maneuver and, by the coherence theorem for monoidal categories (Mac Lane 1998), is harmless. Note that the functor A → A ⊗ A that is the codomain of the diagonal has as its monoidal structure maps m A,B = A ⊗ B ⊗ A ⊗ B e=I
1 ⊗ σ ⊗1 A⊗ A⊗B⊗B l −1 I -
I⊗I.
Of course the identity functor, which is the domain of the diagonal, has identity morphisms as its structure maps.
1.4.2 Compact Categories with Cloning (Almost) Collapse Theorem 1.4.1. Let C be a compact category with cloning. Then every endomorphism is a scalar multiple of the identity. More precisely, for f : A → A, f = Tr( f ) • id A . This means that for every object A of C, C( A, A) is a retract of C(I, I ): α : C(A, A) C(I, I ) : β,
α( f ) = Tr( f ),
β(s) = s • id A .
In a category enriched over vector spaces, this means that each endomorphism algebra is one-dimensional. In the cartesian case, there is a unique scalar, and we recover the reflexive part of the posetal collapse of Joyal’s lemma. But in general, the collapse given by our result is of a different nature than that of Joyal’s lemma, as we see later.
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
20
October 30, 2009
18:18
Samson Abramsky
Note that our collapse result only refers to endomorphisms. In the daggercompact case, every morphism f : A → B has an associated endomorphism σ ◦ ( f ⊗ f †) : A ⊗ B → A ⊗ B . Moreover the passage to this associated endomorphism can be seen as a kind of “projective quotient” of the original category (Coecke 2007). Thus in this case, the collapse given by our theorem can be read as saying that the projective quotient of the category is trivial.
1.4.3 Proving the Cloning Collapse Theorem We make some use of the graphical calculus in our proofs. We use slightly different conventions from those adopted in the previous section: • First, the diagrams to follow are to be read downward rather than upward. • Second, we shall depict the units and counits of a compact category simply as “cups” and “caps,” without any enclosing triangles. To illustrate these points, the units and counits are depicted thus: A A∗
A∗
A
η A : I −→ A∗ ⊗ A
A : A ⊗ A∗ −→ I
whereas the identities for the units and counits in compact categories appear thus:
=
=
The small nodes appearing in these diagrams indicate how the figures are built by composition from basic figures such as cups, caps, and identities. Finally, we depict diagonal morphisms diagrammatically by “forking”:
for : A → A ⊗ A. First step. We begin by showing that “parallel caps = nested caps”
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:18
1 No-Cloning in Categorical Quantum Mechanics
21
Diagrammatically:
A∗
A
A∗
=
A
A∗
A
A∗
A
This amounts to a “confusion of entanglements.” In fact, we find it more convenient to prove this result in the following form: η A ⊗ η A = (3 2 1 4) ◦ (η A ⊗ η A ) Here (3 2 1 4) is the permutation acting on the tensor product of four factors that is built from the symmetry isomorphisms in the obvious fashion. Diagrammatically: =
Lemma 1.4.2. We have I = l −1 I : I → I ⊗ I. Proof. This is an immediate application of the monoidality of , together with e = l −1 I for the codomain functor. Lemma 1.4.3. Let u : I → A ⊗ B be a morphism in a symmetric monoidal category with cloning. Then u ⊗ u = (3 2 1 4) ◦ (u ⊗ u) . Proof. Consider the following diagram. I
I
- I⊗I u⊗u
u ? A⊗B A ⊗ B
A⊗B -
? A⊗ A⊗B⊗B
A
⊗
? A⊗B⊗ A⊗B 6 1⊗σ ⊗1
- A⊗ A⊗B⊗B σ ⊗1 B
The upper square commutes by naturality of . The upper triangle of the lower square commutes by monoidality of . The lower triangle commutes by cocommutativity of in the first component, and then tensoring with the second component and using the bifunctoriality of the tensor.
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
22
October 30, 2009
18:18
Samson Abramsky
Let f = (u ⊗ u) ◦ I , and g = ( A ⊗ B ) ◦ u. Then by the preceding diagram f = (1 ⊗ σ ⊗ 1) ◦ (σ ⊗ 1) ◦ g . A simple computation with permutations shows that (1 ⊗ σ ⊗ 1) ◦ (σ ⊗ 1) = (1 3 2 4) ◦ (2 1 3 4) = (3 2 1 4) ◦ (1 ⊗ σ ⊗ 1) . Appealing to the diagram again, f = (1 ⊗ σ ⊗ 1) ◦ g. Hence f = (1 ⊗ σ ⊗ 1) ◦ (σ ⊗ 1) ◦ g = (3 2 1 4) ◦ (1 ⊗ σ ⊗ 1) ◦ g = (3 2 1 4) ◦ f . Applying the previous lemma: u ⊗ u = f ◦ l I = (3 2 1 4) ◦ f ◦ l I = (3 2 1 4) ◦ (u ⊗ u) . Diagrammatically, this can be presented as follows: =
=
=
and hence =
Note that this lemma is proved in generality, for any morphism u of the required shape. However, as expected, we apply it by taking u = η A . It is convenient to give the remainder of the proof in diagrammatic form. Second step. We use the first step to show that the twist map = the identity in a compact category with cloning, by putting parallel and serial caps in a common context and simplifying using the triangular identities.
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:18
1 No-Cloning in Categorical Quantum Mechanics
23
The context is: A
A A∗
A
A∗
A
A
A
We get: A
A
A
A
A
A
A
A
A
A
= A A and: A
A
= A A
We used the original picture of nested caps for clarity. If we use the picture directly corresponding to the statement of Lemma 1.4.3, we obtain the same result: A
A
A
A
A
A
= A A
The important point is that the left input is connected to the right output, and the right input to the left output.
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
24
October 30, 2009
18:18
Samson Abramsky
Third step. Finally, we use the trace to show that any endomorphism f : A −→ A is a scalar multiple of the identity: f = s • 1A for s = Tr( f ). A
A
f
=
A =
f
A
A
f
A
This completes the proof of the cloning collapse theorem 1.4.1.
1.4.4 Examples We note another consequence of cloning. Proposition 1.4.4. In a monoidal category with cloning, the multiplication of scalars is idempotent. Proof. This follows immediately from naturality I-
I
I⊗I s⊗s
s ? I
? - I⊗I
I
together with Lemma 1.4.2.
Thus the scalars form a commutative, idempotent monoid, i.e., a semilattice. Given any semilattice S, we regard it qua monoid as a one-object category, say with object •. We can define a trivial strict monoidal structure on this category, with •⊗•=•= I . Bifunctoriality follows from commutativity. A natural diagonal is also given trivially by the identity element (which is the top element of the induced partial order, if we view the semilattice operation as meet). Units and counits are also given trivially by the identity. Note that the scalars in this category are of course just the elements of S. Thus any semilattice yields an example of a (trivial) compact category with cloning. Note the contrast with Joyal’s lemma. While every Boolean algebra is of course a semilattice, it forms a degenerate cartesian closed category as a poset, with
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
October 30, 2009
1 No-Cloning in Categorical Quantum Mechanics
18:18
25
many objects but at most one morphism in each homset. The degenerate categories we are considering are categories qua monoids, with arbitrarily large hom-sets, but only one object. Posets and monoids are opposite extremal examples of categories, which appear as contrasting degenerate examples allowed by these no-go results. Note that our result as it stands is not directly comparable with Joyal’s, since our hypotheses are weaker insofar as we only assume a monoidal diagonal rather than full cartesian structure, but stronger insofar as we assume compact closure. A Boolean algebra that is compact closed qua category is necessarily the trivial, one-element poset, since meets and joins – and in particular the top and bottom of the lattice – are identified.
1.4.5 Discussion The cloning collapse theorem can be read as a no-go theorem. It says that it is not possible to combine basic structural features of quantum entanglement with a uniform cloning operation without collapsing to degeneracy. It should be understood that the key point here is the uniformity of the cloning operation, which is formalized as the monoidal naturality of the diagonal. A suitable intuition is to think of this as corresponding to basis independence.4 The distinction is between an operation that exists in a representation-independent form, for logical reasons, as compared to operations that do intrinsically depend on specific representations. In fact, in turns out that much significant quantum structure can be captured in our categorical setting by nonuniform copying operations (Coecke and Pavlovic 2007). Given a choice of basis for a finite-dimensional Hilbert space H, one can define a diagonal |i → |ii . This is coassociative and cocommutative and extends to a comonoid structure. Applying the dagger yields a commutative monoid structures, and the two structures interact by the Frobenius law. It can be shown that such “dagger Frobenius structures” on finite-dimensional Hilbert spaces correspond exactly to bases. Since bases correspond to “choice of measurement context,” these structures can be used to formalize quantum measurements, and quantum protocols involving such measurements (Coecke and Pavlovic 2007). It is of the essence of quantum mechanics that many such structures can coexist on the same system, leading to the idea of incompatible measurements. This too has been axiomatized in the categorical setting, enabling the effective description of many central features of quantum computation (Coecke and Duncan 2008). Thus the no-go result is delicately poised on the issue of naturality. It seems possible that a rather sharp delineation between quantum and classical, and more generally a classification of the space of possible theories incorporating various features, may be achieved by further development of these ideas. 4
In fact, the original example that led Eilenberg and Mac Lane to define naturality was the naturality of the isomorphism from a finite-dimensional vector space to its second dual, as compared with the non-natural isomorphism to the first dual.
P1: SBT CUUS834-01
cuus834-gay
26
978 0 521 51374 6
October 30, 2009
18:18
Samson Abramsky
1.5 No-Deleting The issue of no-deleting is much simpler from the current perspective. A uniform deleting operation is a monoidal natural transformation d A : A → I . Note that the domain of this transformation is the identity functor, while the codomain is the constant functor valued at I . The following result was originally observed by Bob Coecke in the dagger compact case: Proposition 1.5.1. If a compact category has uniform deleting, then it is a preorder. Proof. Given f : A −→ B, consider the naturality square A ⊗ B∗
d A⊗B ∗ -
f ? I
dI
I
- I
By monoidal naturality, d I = 1 I . So for all f, g : A −→ B: f = d A⊗B ∗ = g and hence f = g.
1.6 Further Directions We conclude by discussing some further developments and possible extensions of these ideas. • In a forthcoming joint paper with Bob Coecke, the results are extended to cover no-broadcasting by lifting the cloning collapse theorem to the CPM category (Selinger 2007), which provides a categorical treatment of mixed states. • The proof of the cloning collapse theorem makes essential use of compactness. Open Question. Are there nontrivial examples of ∗-autonomous categories with uniform cloning operations? One can also consider various possible sharpenings of our results, by weakening the hypotheses, e.g., on monoidality of the diagonal, or by strengthening the conclusions, to a more definitive form of collapse. • Finally, the role of scalars in these results hints at the relevance of projectivity ideas (Coecke 2007), which should be developed further in the abstract setting.
P1: SBT CUUS834-01
cuus834-gay
978 0 521 51374 6
October 30, 2009
1 No-Cloning in Categorical Quantum Mechanics
18:18
27
Altogether, these results, although preliminary, suggest that the categorical axiomatization of quantum mechanics in Abramsky and Coecke (2004, 2005, 2008) does indeed open up a novel and fruitful perspective on no-go theorems and other foundational results. Moreover, these foundational topics in physics can usefully be informed by results and concepts stemming from categorical logic and theoretical computer science.
Bibliography Abramsky, S. (1996) Retracing some paths in process algebra. In Montanari, U., and Sassone, V., editors, Proceedings of CONCUR ‘96, volume 1119 of Lecture Notes in Computer Science, pages 1–17. Springer-Verlag. Abramsky, S. (2004) High-level methods for quantum computation and information. In Proceedings of the 19th Annual IEEE Symposium on Logic in Computer Science, pages 410–414. IEEE Computer Science Press. Abramsky, S. (2005) Abstract scalars, loops, and free traced and strongly compact closed categories. In Fiadeiro, J., editor, Proceedings of CALCO 2005, volume 3629 of Lecture Notes in Computer Science, pages 1–29. Springer-Verlag. Abramsky, S. (2007) Temperley-Lieb algebras and geometry of interaction. In Chen, G., Kauffman, L. and Lamonaco, S., editors, Mathematics of Quantum Computing and Technology, pages 415–458. Taylor and Francis. Abramsky, S., and Coecke, B. (2004) A categorical semantics of quantum protocols. In Proceedings of the 19th Annual IEEE Symposium on Logic in Computer Science, pages 415–425. IEEE Computer Science Press. quant-ph/0402130. Abramsky, S., and Coecke, B. (2005) Abstract physical traces. Theory and Applications of Categories 14:111–124. Abramsky, S., and Coecke, B. (2008) Categorical quantum mechanics. In Gabbay, D., and Engesser, K., editors, Handbook of Quantum Logic Vol. II, pages 261–324. Elsevier. Abramsky, S., and Duncan, R. W. (2006) A categorical quantum logic. Mathematical Structures in Computer Science 16:469–489. Barnum, H., Caves, C. M., Fuchs, C. A., Jozsa, R., and Schumacher, B. (1996) Noncommuting mixed states cannot be broadcast. Physical Review Letters 76:2818–2821. Barr, M. (1979) ∗-Autonomous Categories, volume 752 of Lecture Notes in Mathematics. Springer. Bell, J. S. (1964) On the Einstein Podolsky Rosen paradox. Physics 1:195. Bennett, C. H., Brassard, G., Cr´epeau, C., Jozsa, R., Peres, A., and Wooters, W. K. (1993) Teleporting an unknown quantum state via dual classical and Einstein-Podolsky-Rosen channels. Physical Review Letters 70:1895–1899. Coecke, B. (2007) De-linearizing linearity: projective quantum axiomatics from strong compact closure. Electronic Notes in Theoretical Computer Science 170:47–72. Coecke, B., and Duncan, R. W. (2008) Interacting quantum observables. In Proceedings of the 35th International Colloquium on Automata, Languages and Programming, volume 5126 of Lecture Notes in Computer Science, pages 298–310. Springer-Verlag. Coecke, B., and Pavlovic, D. (2007) Quantum measurements without sums. In Chen, G., Kauffman, L., and Lamonaco, S., editors, Mathematics of Quantum Computing and Technology, pages 567–604. Taylor and Francis. Dieks, D. G. B. J. (1982) Communication by EPR devices. Physics Letters A 92:271–272. Dirac, P. A. M. (1947) The Principles of Quantum Mechanics (third edition). Oxford University Press. Freyd, P. J. (1972) Aspects of topoi. Bulletin of the Australian Mathematical Society 7:1–76 and 467–80.
P1: SBT CUUS834-01
cuus834-gay
28
978 0 521 51374 6
October 30, 2009
18:18
Samson Abramsky
Joyal, A. and Street, R. (1991) The geometry of tensor calculus I. Advances in Mathematics 88:55–112. Joyal, A., Street, R., and Verity, D. (1996) Traced monoidal categories. Mathematical Proceedings of the Cambridge Philosophical Society 119:447–468. Kelly, G. M., and Laplaza, M. L. (1980) Coherence for compact closed categories. Journal of Pure and Applied Algebra 19:193–213. Lambek, J., and Scott, P. J. (1986) Introduction to Higher-Order Categorical Logic. Cambridge University Press. Lawvere, F., and Schanuel, S. (1997) Conceptual Mathematics: A First Introduction to Categories. Cambridge University Press. Mac Lane, S. (1998) Categories for the Working Mathematician (second edition). Springer. Pati, A. K., and Braunstein, S. L. (2000) Impossibility of deleting an unknown quantum state. Nature 404:164–165. Seely, R. A. G. (1998) Linear logic, ∗-autonomous categories and cofree algebras. Contemporary Mathematics 92:371–382. Selinger, P. (2007) Dagger compact closed categories and completely positive maps. Electronic Notes in Theoretical Computer Science 170:139–163. Sørensen, M. H., and Urzyczyn, P. (2006) Lectures on the Curry-Howard Isomorphism. Elsevier. Turaev, V. (1994) Quantum Invariants of Knots and 3-Manifolds. de Gruyter. Vicary, J. (2008) A categorical framework for the quantum harmonic oscillator. International Journal of Theoretical Physics. 47(12):3408–3447. von Neumann, J. (1932) Mathematische Grundlagen der Quantenmechanik. Springer-Verlag. Wootters, W., and Zurek, W. (1982) A single quantum cannot be cloned. Nature 299:802–803.
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:55
2 Classical and Quantum Structuralism ´ Bob Coecke, Eric Oliver and, Paquette Dusko Pavlovic
Abstract In recent work, several researchers including the authors have developed a categorical formalization of quantum mechanics in terms of symmetric monoidal dagger categories. In this framework, classical data turned out to be represented by an algebraic structure, that of special commutative dagger Frobenius algebras. This structure captures the distinct capabilities that apply to classical data – that they can be copied and deleted. In the present paper, we provide categorical semantics and diagrammatic representations of deterministic, nondeterministic, and probabilistic operations over classical data represented in this way. Moreover, a combination of some fundamental categorical constructions (the Kleisli construction of the category of free algebras and the Grothendieck construction of the total category of an indexed category) with the specific categorical presentations of pure and mixed quantum states provides a resource-sensitive categorical account of classical control of quantum data and of classical data resulting from quantum measurements, as well as of the classical data processing that may happen in between measurements and controls. Along the way we also discover some apparently novel quantum typing structures. One of the salient features of categorical quantum mechanics is still its graphic calculus, which allows succinct presentations of diverse quantum protocols. The elements of an abstract stochastic calculus are beginning to emerge from it, pointing toward convenient refinements of resource-sensitive logics that are hoped to capture the probabilistic content and limited observability of quantum data. Examples are drawn from measurement based quantum computing.
2.1 Introduction Quantum systems are very different from their classical counterparts. This is captured within the quantum mechanical formalism as follows: • A compound quantum system is not described by a cartesian structure – i.e., a structure in which all the properties of a joint system can be traced back to 29
P1: SBT cuus834-02
cuus834-gay
30
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
those of its components – but by a genuinely linear tensor. Physically, this fact is witnessed by “entangled states.” • A Hilbert space admits many different choices of a basis. Physically this means that a quantum system admits “incompatible observables” to which no sharp values can be simultaneously attributed. Via the eigenvectoreigenvalue connection each of the bases also represents the classical data type corresponding to the observable. These features are the key players in a general abstract theory of quantum systems and, in particular, a theory of classical-quantum interaction. Abramsky and Coecke (2004) axiomatized entangled states in terms of dagger compact categories. Here, we refer to the objects in such a dagger compact category, each coming with a chosen Bell state, as quantum systems. Coecke and Pavlovic (2007) axiomatized quantum observables within this context as special dagger Frobenius algebras, to which we refer here as classical structures, or basis structures. One can think of quantum observables as the “classical interfaces” that provide (limited) access to a “quantum universe”; here we explore how information gets extracted by measurement at these interfaces, how it gets processed by applying suitable quantum operations, and how these operations are classically controlled. This chapter is structured as follows: • In Section 2.2, we describe the basic structures of quantum categorical semantics, i.e., the quantum universe, and its classical interfaces. • In Section 2.3, we describe the families of morphisms between the classical interfaces, used to control the classical information flows. They include deterministic operations (functions, permutations) and nondeterministic operations (relations), as well as probabilistic operations (stochastic matrices). • In Section 2.4, we describe how the quantum universe interacts with a fixed classical interface, a classical structure X ; how information flows from the quantum universe to X ; and how X controls the quantum universe. We consider both closed (pure) and open (mixed) quantum systems. We then let X vary over the different classical structures, connected by the morphisms described in Section 2.3. • Section 2.5 unifies the foregoing and poses a challenge for future research. Related work. Previous structural models for quantum-classical interaction required either additional completeness assumptions, most notably biproducts, to model quantum spectra (Abramsky and Coecke 2004; Selinger 2004, 2007) or a second monoidal structure (Coecke 2007b). Our notion of classicality is internal, emergent from symmetric monoidal dagger structure by articulating the local capabilities, in terms of symmetric monoidal dagger language only, and hence formalizable in purely diagrammatic terms. More applications. An earlier version of this paper has been in circulation since 2007 under the title Classical and quantum structures (Coecke et al. 2008a).
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
Classical and Quantum Structuralism
18:55
31
Besides a complementary formal development, it contains several applications not discussed in this paper. A more detailed account on these is also in the second author’s Ph.D. thesis (Paquette 2008).
2.2 Elements of Quantum Semantics Prerequisites. We expect the reader to be familiar with symmetric monoidal categories and also to have some familiarity with compact (closed) categories (Kelly and Laplaza 1980; Abramsky and Coecke 2005; Selinger 2007), as well as with the corresponding graphical calculus (Joyal and Street 1991; Freyd and Yetter 1989; Selinger 2007). By a symmetric monoidal dagger category we mean a symmetric monoidal category C together with an involutive contravariant identity-on-objects-functor (−)† : Cop → C that coherently preserves the symmetric monoidal structure. In particular, this means that the natural isomorphisms θ of the symmetric monoidal structure are all unitary, that is, θ −1 = θ † . Notation. When the confusion seems unlikely, we elide g ◦ f to g f and X ⊗ A ⊗ B to X AB. The tensorial symmetry is denoted by σ : AB → B A. The set of abstract vectors, denoted as C( A), is just the hom-set C(I, A). An abstract scalar is just a morphism in C(I, I ). Graphical notation. In the graphical calculus, morphisms are drawn upward. The identity on an object A is depicted as
A A morphism f : A → B is depicted as B f A Given two morphisms f : A → B and g : B → C, their composition g ◦ f : A → C is depicted as
P1: SBT cuus834-02
cuus834-gay
32
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
C g B f A Given two morphisms f : A → B and g : C → D, their tensor product f ⊗ g : A ⊗ C → B ⊗ D is depicted as B
D g
f A
C
Finally, given a morphism f : A → B, the corresponding morphism f † : B → A is depicted by flipping graphical components upside-down (Selinger 2007). In the following, we assume C to be a symmetric monoidal dagger category. We use it to model simple quantum processes, algorithms, and protocols, along the lines of Abramsky and Coecke (2004); Selinger (2007); Coecke and Pavlovic (2007); Coecke and Duncan (2008); and Coecke et al. (2008b).
2.2.1 Bell States Categorical quantum semantics started with the observation by Abramsky and one of the authors that the duality (or compactness) in monoidal dagger categories can be used to model interaction of entangled states and effects (or costates) (Abramsky and Coecke 2004). Our Bell state structure thus consists of dualities, modeled in terms of compact structures (Kelly and Laplaza 1980). Definition 2.2.1. A compact structure in any symmetric monoidal category C ε / is a quadruple ( A, A∗ , ε, η), where the pairing A ⊗ A∗ I and copairing η ∗ / A ⊗ A make the following diagrams commute: I / A ⊗ A∗ ⊗ A A GG A∗ H HH GG HH GG HH GG HH id GG HH GG η⊗ A∗ ε⊗A HH id GG HH GG HH G GG HH G# # ∗ ∗ ∗ /A A ⊗ A⊗ A A A∗ ⊗ε A⊗η
When C is a symmetric monoidal dagger category, then we define a Bell state (A, A∗ , η) on A to be a compact structure ( A, A∗ , η† ◦ σ, η).
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
33
Remark. If C is viewed as a bicategory with one object, then a compact structure makes the 1-cell A∗ into a right adjoint of A (Kelly and Laplaza 1980). A dagger compact category is a symmetric monoidal dagger category where each object comes with a chosen Bell state. We call such objects quantum systems. For an arbitrary symmetric monoidal dagger category C, we denote by Cq the category with classical structures (X, X ∗ , η) as objects and with Cq ((X, X ∗ , η X ), (Y, Y ∗ , ηY )) = C(X, Y ). Remark. Obviously, rather than introducing Cq we could as well have assumed that in the symmetric monoidal dagger category C all objects come with coherently chosen Bell states. Constructing Cq removes the need to single out a specific Bell state for each object. Notation. When the structure is clear from the context, we often leave it implicit. For instance, we write A instead of (A, A∗ , η A ) in the case of a Bell state; the same also applies to classical structures defined hereafter. We write (−)∗ for the contravariant transpose endofunctor on a compact category, that is, for a morphism f : A → B we have f ∗ = B∗
ηA B∗
/ A∗ AB ∗
A∗ f B ∗
/ A∗ B B ∗
A∗ ε B
/ A∗ .
We write (−)∗ = (−)†∗ = (−)∗† for the covariant conjugate endofunctor. The dimension of an object A relative to a compact structure is dim(A) = η A ◦ σ ◦ ε A . Graphical notation. As usual we represent ε and η as A∗
A
A∗
A so that compactness becomes A∗
A∗
A =
= A∗
A
A∗
A
A
– the arrows on the identities distinguish the object A from A∗ .
2.2.2 Classical Structure Classical structures, first considered for this purpose by Coecke and Pavlovic (2007), are described using special commutative Frobenius algebras (Lawvere 1969; Carboni and Walters 1987).
P1: SBT cuus834-02
cuus834-gay
34
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
Definition 2.2.2. A Frobenius algebra in a symmetric monoidal category is an internal monoid I
⊥
/X o
∇
X⊗X
/X⊗X
and an internal comonoid I o
X
that together satisfy the Frobenius condition X ⊗
X ⊗ XK KK KK∇ KK KK K%
⊗X
X⊗X⊗X
/X⊗X⊗X
∇⊗X X KK KK KK KK KK % /X⊗X X ⊗∇
A Frobenius algebra is called special if ∇ ◦ = id X and it is commutative if σ ◦ = . A classical structure (X, ∇, ⊥) in a dagger symmetric monoidal category C is a commutative special Frobenius algebra for which = ⊥†
and
= ∇† .
We denote by Cc the category with classical structures (X, ∇, ⊥) as objects and with Cc ((X, ∇ X , ⊥ X ), (Y, ∇Y , ⊥Y )) = C(X, Y ). Example. In the category FdHilb of finite-dimensional Hilbert spaces and linear maps with the tensor product as monoidal structure, classical structures are in bijective correspondence with orthonormal bases. This fact was established by Vicary and two of the authors (Coecke et al. 2008c). It supports the name “classical” in terms of standard quantum theory, since given an orthonormal basis {|i} there is a corresponding nondegenerate observable with projector spectrum {|ii|}. Concretely, the bijective correspondence is as follows: Each classical structure arises as :: |i → |i ⊗ |i
:: |i → 1
for some orthonormal basis {|i}. There, the comultiplication copies the vectors of the corresponding basis while its unit uniformly deletes them. Hence classical structure counterfactually addresses the no-cloning and no-deleting theorems for quantum data (Dieks 1982; Wootters and Zurek 1982; Pati and Braunstein 2000;
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
35
Abramsky 2010). Other papers (Coecke and Pavlovic 2007; Coecke et al. 2008c) provide more details on this. Remark. While the morphisms of Cc are initially completely oblivious to the classical structures, it is convenient to have the category Cc at hand. The gamut of classical categories that we analyze in the next section are extracted from Cc , as the morphisms are constrained to preserve various fragments of classical structure. Remark. If the category C is viewed as a bicategory with a single 0-cell, then the objects of C are 1-cells. In the internal sense of this bicategory, classical structures are just those 1-cells that happen to be both monads and comonads. Such a structure is studied in Eilenberg and Moore (1965) – one of the earliest papers about monads – in which Eilenberg and Moore introduced the monadic view of universal algebra. The monoidal structure of the unit I is a canonical classical structure (I, λ I : I I ⊗ I, id I ). Moreover, if (X, ∇ X , ⊥ X ) and (Y, ∇ X , ⊥ X ) are classical structures, then so is (X ⊗ Y, ∇ X,Y , ⊥ X,Y ) where ∇ X,Y = (id X ⊗ σ ⊗ idY ) ◦ (∇ X ⊗ ∇Y )
⊥ X,Y = (⊥ X ⊗ ⊥Y ) ◦ λ I .
From this, it follows that Cc is a symmetric monoidal dagger category. The forgetful functor Cc → C thus is full and faithful, is monoidal, and preserves the dagger. Graphical notation. We represent , , ∇, ⊥ respectively as
For example, the Frobenius condition corresponds to
=
=
The following fact is discussed in detail in Lack (2004) and Coecke and Paquette (2008). Proposition 2.2.3. If in graphical representation a morphism generated from classical structure and symmetric monoidal dagger structure is connected, then it is completely characterized by its domain and codomain. So if the domain is X ⊗ . . . ⊗ X and the codomain is X ⊗ . . . ⊗ X then it can be reduced to a n
“spider” with n input and m output wires:
m
P1: SBT cuus834-02
cuus834-gay
36
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric m outputs
................ ... ... ................ n inputs
All the defining axioms of classical structure follow from this rewriting principle, since all expressions involved have connected graphical representations. Proposition 2.2.4. Each classical structure (X, ∇, ⊥) induces a “self-dual” Bell state on X , namely (X , X ∗ = X , η = ◦ ⊥) . Moreover, by commutativity of the monoid, we have σ ◦η = η.
(2.1)
Hence, the category Cc of classical structures is dagger compact. Equation (2.1) tells us that we can omit the arrows when depicting the Bell state induced by a classical structure. The equation η = ◦ ⊥ then corresponds to X
X
X
X
=
Remark. Typically, a quantum system will admit more than one classical structure corresponding to incompatible observables – we do not explicitly impose this in this paper, and we refer the reader to Coecke and Duncan (2008) for work in this direction. In the light of Proposition 2.2.4 this means that a Bell state may “factor” in many different ways into a classical structure. Bell states extracted from different classical structures on the same object may be different, a fact that turns out to be closely related to the self-duality of those Bell states (Coecke et al. 2008b). Remark. For some constructions in this paper it is important to rely on a fixed Bell state for each quantum system, hence the dagger compact category Cq . For several other constructions involving a specific classical structure it is important that the Bell state is the one extracted from that classical structure, hence the dagger compact category Cc .
2.3 Classical Varieties In this section, we study the categories spanned by classical structures. The largest one is Cc itself, spanned by classical structures, and all C-morphisms between them, ignoring the classical structure. The smallest nontrivial one is a groupoid,
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
37
where the morphisms preserve all of the classical structure, i.e., both monoid and comonoid homomorphisms (Kock 2003). For C = FdHilb, it then follows from (Coecke et al. 2008c) that this groupoid boils down to finite sets and permutations between them.
2.3.1 Classical Morphisms Definition 2.3.1. Let C be a dagger category. An endomorphism e ∈ C( A, A) is positive if there exist a morphism g : C → A such that e
A
g†
/ A=A
/ C
/ A.
g
Lemma 2.3.2. If an endomorphism e : A → A is positive then for every “element” x ∈ C(A) the scalar ex | x := (e ◦ x)† ◦ x is also positive. The converse holds if the tensor unit I is a generator of the category. Definition 2.3.3. Let C be a monoidal dagger category. We call a morphism f : X → Y in C classical relative to classical structures (X, ∇ X , ⊥ X ) and (Y, ∇Y , ⊥Y ) if the endomorphism X Y
XY
/ X XY
XfY
/ XY Y
X ∇Y
/ XY
(2.2)
is positive, which graphically means X
X Y
Y
g =
f
X
Y
C g† X Y
Classical maps are closed under composition:
f f
f =
= f
f
f
=
g
g
g†
g† h †
h
Since identities are also classical, it follows that classical structures and classical maps form a subcategory C c of Cc .
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
38
Example. As explained previously, classical structures in FdHilb are in oneto-one correspondence with orthonormal bases. If a linear map f : X → Y is represented as an n × m-matrix in the bases induced by the classical structures X and Y , then the operation on f described in (2.2) redistributes the entries of this matrix over the diagonal of an (n × m) × (n × m) matrix. Classical maps in FdHilb thus correspond to the matrices with non-negative entries. They map basis vectors to linear combinations of basis vectors involving only non-negative coefficients. Definition 2.3.4 (Selinger 2007). Let A and B be quantum systems in the dagger compact category Cq . A morphism f : A∗ A → B ∗ B in Cq is called completely positive if its transpose AB ∗
η A∗ AB ∗
/ AA∗ AB ∗
A f B∗
/ AB ∗ BB ∗
AB ∗ ε B
/ AB ∗
is positive, i.e., A B∗
B∗
A
g f
=
A B∗
g† A B∗
A completely positive element is called a mixed state. Let PC be the category with the same objects as Cq and with PC( A, B) = { f ∈ C( A∗ A, B ∗ B)| f is completely positive} . Example. In FdHilb the abstract notions of complete positivity and mixed state coincide with the usual ones (Selinger 2007), except for the fact that the abstract mixed states are not normalized. For example, in the case that A = C and B = H we obtain bipartite states : C C∗ ⊗ C → H∗ ⊗ H for which the transpose (cf. map-state duality) H∗ C ⊗ H∗
(idH∗ ⊗εH )◦(⊗idH∗ )
/ H∗ ⊗ C H∗
is positive, that is, it is a density operator up to a positive real scalar multiple. So these transposes provide the mixed states of the usual quantum mechanical formalism. General completely positive maps f : H1∗ ⊗ H1 → H2∗ ⊗ H2 are linear operators which map bipartite states : C → H1∗ ⊗ H1 to bipartite states f ◦ : C → H2∗ ⊗ H2 . The positivity condition of the transpose of f
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
39
guarantees that if represents (via the transpose) a positive operator that f ◦ also represents a positive operator, and also assures that we indeed have “completely” positive maps. Later we give an example of a completely positive map, namely decoherence. Remark. Complete positivity and the category PC of mixed states and completely positive maps can be defined in any symmetric monoidal category, even in the absence of compactness (Coecke 2007a). It is easy to see that the constraint on f in Definition 2.3.4 is equivalent to: B∗
B
g
g∗
B∗ B =
f A∗ A
A∗
=
B∗
B
h∗
h
A∗
A
A
As explained in Selinger (2007) and Coecke et al. (2008b), in order to keep the graphs of the compact structure planar, we swap the wires of the conjugate morphisms: D∗ C ∗ C D h A
h∗ B ∗ A∗
B
Since each classical structure (X, ∇, ⊥) induces a self-dual compact structure (X, X, η† , η) where η = ◦ ⊥ and hence σ ◦ η = η, the notion of complete positivity applies to the morphisms in the form f : XX → YY between the classical structures X and Y . The following proposition is then easily proven in graphical language. Proposition 2.3.5. For a morphism f : X → Y between classical structures X and Y the following statements are equivalent : • f : X → Y is classical ; • f = X X
∇
/ X
f
/ Y
/ XX • f = g c = X g : X X → Y Y which satisfies g
/ Y Y is completely positive ; / Y Y ∇ / Y for a completely positive map
Y ◦ g = g ◦ X = g for X = X ◦ ∇ X and Y = Y ◦ ∇Y .
(2.3)
P1: SBT cuus834-02
cuus834-gay
40
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
Definition 2.3.6. A morphism X = X ◦ ∇X : X X → X X induced by a classical structure on X is called a decoherence. Decoherent morphisms are completely positive maps that preserve decoherences, like in (2.3). The subcategory of P(Cc ) consisting of all classical structures with decoherent completely positive maps is denoted by C . Example. In FdHilb a mixed state is decoherent for a classical structure – that is, an orthonormal basis – if its matrix representation in that basis is diagonal. Indeed, decoherences are completely positive maps that, when applied to a density matrix, erase the nondiagonal elements (Coecke and Pavlovic 2007). This justifies their name: they maximally destroy coherence. Physically, this means that these states correspond to a probability distribution on the basis vectors, up to a positive real scalar multiple. Since we interpret these basis vectors as classical data, decoherent mixed states correspond to probability distributions on classical data, up to a positive real scalar multiple. A completely positive map is decoherent if it maps mixed states with diagonal matrices to mixed states with diagonal matrices. Hence they map probability distributions on classical data to probability distributions on classical data, all again up to positive real scalar multiples. In Section 2.3.5 we define normalized probability distributions on classical data and corresponding mappings, i.e., stochastic maps. Graphically, complete positivity of f means
f
=
g
g∗
As in Proposition 2.2.3, decoherences are graphically depicted as
Given a classical morphism f : X → Y , a completely positive map of the form f = Y ◦ f ◦ ∇ X is decoherent. Indeed, since classical structures are special, we have
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
f
=
f
41
f
Conversely, if a completely positive map g is decoherent then
g
g
=
g c
so it indeed has the desired form, and that g c is a classical morphism follows from g being completely positive. Corollary 2.3.7. The category C c of classical structures and classical morphisms is isomorphic to the category C of classical structures and decoherent morphisms: (−)
C c i
)
C
(−) c
Example. In the case of FdHilb the isomorphism (−) of corollary 2.3.7 takes a column vector with positive real entries and maps it on on a diagonal matrix with these entries on the diagonal, i.e., a mixed state. Similarly, it maps matrices with positive real entries on a map that takes these diagonal mixed states to other diagonal mixed states in the same way as the initial matrix transforms the underlying vectors. Definition 2.3.8. A morphism in a dagger compact category is real if f∗ = f . Proposition 2.3.9. The inclusion functor / Cc C c preserves dagger symmetric monoidal structure. Hence C c is a symmetric monoidal dagger category. Since for classical structure (X, ∇, ⊥) the two morphisms ∇ and ⊥ are both classical morphisms relative to (X, ∇, ⊥), C c inherits classical structures from Cc along this inclusion. Hence C is also dagger comc pact. Moreover, all morphisms in C are real. c
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
42
For instance, that the comultiplication of a classical structure is itself classical relative to that classical structure holds by Proposition 2.2.3:
g
=
g†
Similarly, we prove that classical maps are real:
f
=
f
=
g
g∗
=
g
g∗
=
f∗
where we used (co)commutativity of the (co)multiplication.
2.3.2 Relations Given classical structures X and Y , we define the convolution monoid (C(X, Y ), , ι X Y ) by f g = ∇Y ◦ ( f ∗ ⊗ g) ◦ X
ι X Y = Y ◦ ⊥ X .
Remark. Given the convolution monoid on C(X ) induced by classical structure X we can recover the inner product of x, y ∈ C(X ) as x | y = I
xy
/ X
/ I.
Moreover, for morphisms f, g ∈ C(X, Y ) we have by compactness that
f g = ( X ) ◦ X ((X f ) ◦ η) ((Xg) ◦ η) where (X f ) ◦ η, (Xg) ◦ η ∈ C(X ⊗ Y ), that is,
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
Classical and Quantum Structuralism
f g f
18:55
43
((X f ) ◦ η) ((Xg) ◦ η)
=
g
f
g
Hence, knowing how − − acts on states implies knowing how it acts on morphisms. Speciality of classical structure just means that id X is an idempotent element of the convolution monoid C(X, X ). In general it is, of course, not the only idempotent. Definition 2.3.10. A morphism r ∈ Cc (X, Y ) is a relation if it is an idempotent of the convolution monoid, that is, r = r r = ∇Y ◦ (r∗ ⊗ r ) ◦ X . Every commutative monoid is a semilattice iff it is idempotent. Therefore, convolution of relations is written as the intersection operation r ∧s =r s. As usual, the induced partial order is r s ⇐⇒ r = r ∧ s . Proposition 2.3.11. All relations are classical morphisms, and hence also real. If (X, ∇, ⊥) is a classical structure then ∇ and ⊥ are relations relative to this classical structure. That relations are classical is established as follows:
f
=
f∗
f
f†
g
f
g†
=
where we relied again on Proposition 2.2.3. Remark. In general, relations are not closed under composition in C; however, they are closed under the tensor. We show hereafter how composition in C induces a new composition on relations. Example. In FdHilb, the abstract relations as defined previously correspond to the matrices f such that f i j = f i2j . Since the only idempotent complex numbers are 0 and 1, these matrices correspond to the usual matrix representation of a
P1: SBT cuus834-02
cuus834-gay
44
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
binary relation, in this case relating basis vectors in Hilbert spaces. Relative to these bases they are the classical maps involving only 0s and 1s as coefficients. However, this family of matrices is not closed under composition in FdHilb; for example, 1 1 1 ◦ =2 1 is not a relation. However, when considering relational composition instead, we obtain 1 1 1 ◦r = 1. 1 We do obtain a category FdHilbr which is isomorphic to FRel, the category of finite sets and relations with the cartesian product as monoidal structure. The key difference of composition in FdHilb and in FRel is that in FdHilb we rely on the field structure of C while for composition in FRel we rely on the semiring (or rig) structure of the Booleans. Rather than a subcategory, FdHilbr can be viewed as a quotient category of FdHilb c . The quotient FdHilb c → FdHilbr is identity on the objects, and it maps each matrix of non-negative reals into a matrix of 0s and 1s, keeping the 0s, and mapping all positive reals to 1. In general, setting1
f = f t rf = t = t t ∈ C c (X, Y ) for classical maps f : X → Y , we can define an equivalence relation f ∼ g ⇐⇒ r f = r g . When restricting to the subcategory of C c generated by all relations, which we denote by D, the equivalence turns out to be a congruence with respect to composition, and hence we obtain a quotient R : D → Cr . Explicitly, the objects of Cr are the same as those of Cc , the morphisms are the equivalence classes for ∼, and composition is inherited. This means that for the equivalence classes respectively containing relations s ∈ C c (X, Y ) and r ∈ C c (Y, Z ), composition in Cr yields the equivalence class that contains the relation
t = t t ∈ C r ◦˜ s := c (X, Z ) r ◦ s = (r ◦ s) t . Notation. When confusion is unlikely, it is convenient to refer by Cr not only to the codomain of the quotient just constructed, but also to the category that 1
For clarity of the argument we assume all meets involved to be finite, as it is for example the case in FdHilb.
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
45
has relations as morphisms and ◦˜ as composition. Obviously both categories are isomorphic. Proposition 2.3.12. Classical structures and relations between them constitute a symmetric monoidal dagger category Cr . It is moreover a locally thin bicategory for the partial ordering . Proposition 2.3.13. In Cr all morphisms are lax comonoid homomorphisms with respect to the partial ordering . For r ∈ Cr (X, Y ) to be a lax comonoid homomorphism means Y ◦ r (r ⊗ r ) ◦ X
Y ◦ r X .
and
Unfolding the definition of the first inequality becomes an equality
† Y ◦ r = Y ⊗Y ◦ Y ◦ r ⊗ (r ⊗ r ) ◦ X ◦ X which indeed holds since graphically we have
r
=
r
r
=
r
r
r
r
where the first step uses r = r r = r (r r ) and the second one uses Proposition 2.2.3. Similarly, the second inequality becomes the equality † Y ◦ r = I ◦ (Y ◦ r ) ⊗ X ◦ X which also holds since =
r
r
where we again used Proposition 2.2.3. Proposition 2.3.14. If (X, , ) is a classical structure then and have right adjoints in Cr with respect to the partial ordering , namely ∇ = † and ⊥ = † . For r ∈ Cr (X, Y ) and s ∈ Cr (Y, X ) we have r s iff id X s ◦ r that is,
and
r ◦ s idY
† † id X = X ◦ id X ⊗ (s ◦ r ) ◦ X and r ◦ s = Y ◦ (r ◦ s) ⊗ idY ◦ Y .
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
46
In the graphical language this means
=
s
r
r
s
=
r s
and for the specific case of δ δ † these become
=
=
which hold by Proposition 2.2.3. Similarly, for ε ε † we have
=
=
which again hold by Proposition 2.2.3. By Propositions 2.3.12, and 2.3.14, the category Cr of classical structures and relations is a cartesian bicategory of relations in the sense of Carboni and Walters (1987). More specifically, it is a dagger cartesian bicategory of relations. Corollary 2.3.15. For a symmetric monoidal category C the corresponding category Cr is a dagger cartesian bicategory of relations, that is, • • • •
A symmetric monoidal locally posetal dagger bicategory, In which every object comes with a classical structure, In which each morphism is a lax comonoid homomorphism, And in which the classical structures (, ⊥) are left adjoint to († , ⊥† ), with respect to the partial ordering .
Example. The canonical example in Carboni and Walters (1987) of a cartesian bicategory of relations is FRel. As shown previously, we recover this example as FdHilbr , which has sets of basis vectors of orthonormal bases in FdHilb as objects, and ordinary relations between these as morphisms. Remark. Surprisingly, FRelr = FRel! Indeed, recently it was shown by Edwards and one of the authors that on the two elements set in FRel there is not only one, but there are two very different kinds of classical structures (Coecke and Edwards
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
47
2008). Setting I := {∗} and II := {0, 1}, the “expected” classical structure on II is 0 ∼ (0, 0) 0∼∗ and Z : II → I :: . Z : II → II × II :: 1 ∼ (1, 1) 1∼∗ This is not the only one. X : II → II × II ::
0 ∼ (0, 1), (1, 0) 1 ∼ (0, 0), (1, 1)
and X : II → I :: 0 ∼ ∗
is also a classical structure, which has properties very different from those of the previous one; for example, it only has one “classical point” – see Coecke and Edwards (2008) for the definition of this. All the classical structures in FRel, of which there are plenty, have been classified by one of the authors in Pavlovic (2009). These “nonstandard” classical structures result in some fascinating facts that we intend to present elsewhere. For example, consider the relation r : I → II :: ∗ ∼ 0. Then we have X ◦ r : I → II × II :: ∗ ∼ (0, 1), (1, 0) while (r ⊗ r ) ◦ λ I : I → II × II :: ∗ ∼ (0, 0). Hence r does not seem to be a lax comonoid homomorphism, contradicting Corollary 2.3.15. What resolves this is the fact that r X r = ∗ ∼ 1 = r . That is, as strange as it may sound, r is not a relation relative to (II, X , X )! But on the other hand, r : I → II :: ∗ ∼ 1 does satisfy r X r = ∗ ∼ 1 = r so it is a relation. Now we have X ◦ r : I → II × II :: ∗ ∼ (0, 0), (1, 1) while (r ⊗ r ) ◦ λ I : I → II × II :: ∗ ∼ (1, 1). Since r being a lax comonoid homomorphism requires X ◦ r = ∗ ∼ (0, 0), (1, 1) to be below (r ⊗ r ) ◦ λ I = ∗ ∼ (1, 1) in the partial order on relations, this again seems to be in contradiction with Corollary 2.3.15. What resolves this is the fact that the partial order on relations depends on the classical structure relative to which we define it, and indeed, {(0, 0), (1, 1)} X {(1, 1)}! Remark. Our definition differs from the one in Carboni and Walters (1987) in that we do not assume that on each object there is no other classical structure that is also a comonoid homomorphism. While we do not know of a counterexample, we were not able to prove that relative to a fixed local order induced by chosen classical structures, these classical structures are the only ones that have right adjoints relative to it. In particular, the classical structures discussed in Coecke and Edwards (2008) that differ from the ones that provide FRel with the structure of a dagger cartesian bicategory of relations do not admit right adjoint with respect to the local ordering in FRel, since the structure maps are proper relations, not functions (cf. Definition 1.5 and Lemma 2.5 in Carboni and Walters, 1987). Remark. From the foregoing it follows that being a lax comonoid homomorphism means that r = r 3 = r (r r ), which is a strictly weaker condition than r = r 2 = r r , the defining equation for relations. For example, while there are only two complex numbers c ∈ C satisfying c = c2 , 0 and 1, there are three satisfying c = c3 , 0, 1 and −1. As a consequence, not all lax comonoid homomorphisms are relations.
P1: SBT cuus834-02
cuus834-gay
48
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
2.3.3 Functions Following Carboni and Walters (1987), the preservation of the parts of the comonoid structure corresponds to the familiar properties of relations. A relation r ∈ Cr (X, Y ) is called • Single-valued if Y ◦ r = (r ⊗ r ) ◦ X ; • Total if Y ◦ r = X ; • Function if it is both total and single-valued. Example. In FdHilb, these notions correspond to the standard ones: • The matrix of a single-valued relation has at most one 1 in each column, while the remaining entries must be 0 ; • The matrix of a total relation has at least one 1 in each column ; • The matrix of a function has exactly one 1 in each column. Proposition 2.3.16. The following are equivalent for f ∈ Cc (X, Y ): • f is a function, i.e., a total single-valued relation ; • f is a real comonoid homomorphism, i.e., we have that f = f ∗ , and that the following two diagrams commute: X
X
/ XX
X
f⊗f
f
Y
Y
X
/I
f
/ YY
(2.4) id I
Y
Y
/I
• The following two diagrams commute : X
X
/ XX
X
f∗ ⊗ f
f
Y
Y
X
/I
f
/ YY
(2.5) id I
Y
Y
/I
Restricting to comonoid homomorphisms makes the comonoid components of the classical structures into natural transformations :X →X⊗X
and
:X →I.
It is easy to see that a tensor with such natural transformation is just a cartesian product from which (Fox 1976): Proposition 2.3.17. The category C f of classical structures and functions is cartesian. The inclusion functor / Cc Cf maps cartesian products of C f to symmetric monoidal structure of Cc .
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
49
2.3.4 Permutations Lemma 2.3.18. If a relation r has an inverse r then r is a function. Indeed, one easily verifies that if a relation r has an inverse r , then r r , so by Definition 1.5 and Theorem 1.6 in Carboni and Walters (1987) it is a function. Lemma 2.3.19. If both r and r † are functions, then they are invertible. Indeed, if both r and r † are functions then r is both a monoid and a comonoid homomorphism, and in Kock (2003) it was shown that a morphism between Frobenius algebras that is both a monoid and a comonoid homomorphism must be invertible. Lemma 2.3.20. If r and r † are functions, then r † ◦ r = id. Indeed, we have
r† r
=
r∗
r
=
=
=
r
where we relied on Equation (2.5) and on the assumption that r † is total. So if both r and r † are functions then they must be unitary. Proposition 2.3.21. The following are equivalent for r ∈ Cr (X, Y ) : • r and r † are functions ; • r has an inverse r ; • r is unitary. Definition 2.3.22. A permutation is a relation that satisfies the equivalent conditions of Proposition 2.3.21. We denote by C p the groupoid of classical structures and permutations. The cartesian category C f is in general not self-dual, so it is not a dagger category. The category C p , on the other hand, has a degenerate dagger, mapping each f : X → Y to its inverse f † : Y → X .
2.3.5 Stochastic Maps In Section 2.3.1 we defined classical morphisms, and in FdHilb these classical morphisms map probability distributions to probability distributions, up to a positive real scalar. We now define the normalized counterpart.
P1: SBT cuus834-02
cuus834-gay
50
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
Definition 2.3.23. A total classical morphism s ∈ Cc (X, Y ) is called stochastic. It is doubly stochastic if both s and s † are stochastic. Denote by Cs the category of classical structures and stochastic morphisms. / C The inclusion Cs c is both functorial and monoidal, but obviously, Cs does not inherit dagger structure or compact structure in general. If h : A → B is doubly stochastic then dim(A) = dim(B). For two objects of the same dimension we denote by Cds ( A, B) the set of all doubly stochastic maps of type A → B. Since all relations are positive, permutations are doubly stochastic. Definition 2.3.24. A morphism f : X 1 → X 2 is majorized by a morphism g : Y1 → Y2 if there exist doubly stochastic maps h 1 : X 1 → Y1 and h 2 : X 2 → Y2 † such that g = h 2 ◦ f ◦ h 1 . Proposition 2.3.25. Majorization is a preordering on X Y Cs (X, Y ). Example. In FdHilb all the concepts defined in this section coincide with the usual ones. That is, states in FdHilbs (H) are probability distributions, and maps in FdHilbs (H, H ) send probability distributions to probability distributions. Ma jorization on HH FdHilbs (H, H ) extends the usual notion of majorization, which is typically defined only for probability distributions (Alberti and Uhlmann 1983; Nielsen 1999).
2.3.6 Hierarchy of Classical Varieties We order all classical varieties extracted from Cc , that is, permutations C p , functions C f , stochastic maps Cs , relations Cr , and classical morphisms C c. CO c
< zz zz z zz . zz Cs bD DD DD DD DD 0P
? C c
DD DD DD DD D" " < Cr zz z zz zz . zz
Cf O
? Cp
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
51
2.4 Relativizing over Classical Interfaces Every object X in a symmetric monoidal dagger category C induces an endofunctor X ⊗ (−) : C → C. The endofunctors F : C → C that are in this form can be recognized by their strength, viz. the natural isomorphism F( A ⊗ B) ∼ = FA ⊗ B. Indeed, every monoidal category is equivalent with the category of strong endofunctors on it. Extending this correspondence, a monoid structure on X induces a monad structure on the corresponding endofunctor X ⊗ (−); a comonoid structure on X corresponds to a comonad structure on it. Since a classical structure X carries both a monoid and a comonoid structure, the induced endofunctor X ⊗ (−) is both a monad and a comonad. The structure of such correspondences and the particular logical meaning of the comonads X ⊗ (−) was analyzed in Pavlovic (1997). The case when C is a cartesian category, i.e., when the tensor ⊗ is the cartesian product ×, goes back to the early days of categorical logic: the comonads in the form X × (−) were already analyzed by Lambek and Scott (1986). In general, the Kleisli category C X induced by a comonad X ⊗ (−) : C → C, induced by a comonoid object X in a monoidal category C, captures the data flows relative to the data type X . When C is a symmetric monoidal dagger category, then these data flows can be construed as quantum flows relative to the classical data of type X . Commutative Frobenius algebra structure of X ensures that C X is also a symmetric monoidal dagger category (Pavlovic 2008).
2.4.1 Indexing over a Classical Structure In the sequel, we often abbreviate X ⊗ (−) to X (−). Recall that the Kleisli category C X , induced by the comonad X (−) : C → C corresponding to the comonoid I o
X
/X⊗X ,
consists of • The same objects as C, • C X ( A, B) = C(X A, B), A / • id A = X A A, • Given f : X A → B and g : X B → C, the composite is g ◦X f = X A
A
/ XXA
Xf
/ XB
g
/ C.
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
52
The monoidal structure of C X is • For A, B ∈ |C| the tensor A ⊗ X B = A ⊗ B is the same as in C; • For f : X A → B and h : XC → D, the tensor is f ⊗ X h = X AC
AC /
XσC /
X X AC
X AXC
f ⊗h
/ BD
• The monoid unit is I X = I , but the scalars in C X are C(X, I ). The dagger structure of C X makes the full use of the classical structure of X : • Given f ∈ C X ( A, B), i.e., an arrow f ∈ C(X A, B), f † X ∈ C X (B, A) is defined to be the transpose of its adjoint f † ∈ C(B, X A), i.e., Xf†
f †X = X B
/ XXA
εA
/ A.
Composition, tensor, and dagger in C X respectively are depicted as: g
f
h
f†
f
The Kleisli category C X for the monad X (−) : C → C has the hom-sets C ( A, B) = C( A, X B), and a structure dual to the foregoing. The duality is in fact formal, by transposing the X -type: X
Proposition 2.4.1. The identity-on-objects-functors (−) X
)
CX i
CX
(−) X
with
f
XA
/ B
(−) X
(−) X
→
A
ηA
/ XXA
Xf
/ XB
and A
f
/ XB
→
Xf
XA
/ XXB
make the Kleisli categories C X and C X isomorphic. The usual Kleisli adjunction F
Ch
⊥ U
)
CX
εB
/ B
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
53
where F
f
A
A → A
/ B → X A
Xf
B
/ XB
/ B
and U
f
XA
A→ XA
/ B → XA
A
/ XXA
Xf
/ XB
can now be graphically presented as follows: →
f
f
→
f
f
It is easy to see that F is a monoidal functor, but U is not. The monoidal functor F enables interpretation of quantum flows that do not involve the classical data type X . Proposition 2.4.2 (Pavlovic 2008). For X a classical structure, the Kleisli category C X inherits all classical structures from C along F, and therefore • If C is dagger compact then so is C X ; • We can consider (C X )Y and (C X )Y , for which we have (C X )Y (C X )Y C X ⊗Y . All constructions available in dagger compact categories thus lift to C X , but now relative to the classical data type X . For example, the inner product of x, y ∈ C X ( A) is x | y X = x † X ◦ X y =X
/ XX
Xy
/ XA
X x†
/ XX
ε
/ I
whereas the transpose and conjugate of f ∈ C X ( A, B) are f ∗ X = (A∗ ⊗ X ε B ) ◦ X ( A∗ ⊗ X f ⊗ X B ∗ ) ◦ X (η A ⊗ X B ∗ )
f∗X
X ηA B∗
σ AB ∗/
A∗X AB ∗
X η B A∗
σ B A∗/
B ∗X B A∗
= X B∗ ∗ X = f †X = X A∗ = f∗
or pictorially
/ X A∗AB ∗
/ X B ∗B A∗
A∗ f B ∗
/ A∗B B ∗
B ∗X f †A∗ ∗ /
A∗ ε B
B X X A A∗
/ A∗
B∗ εX εA
/ B∗
P1: SBT cuus834-02
cuus834-gay
54
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
B
A x†
f†
f
y X
X
B
A
X
2.4.1.1 Mixing and Convex Closure Let p be a stochastic state, that is, p ∈ Cs (I, X ) where X is a classical structure. Then define mappings ω pA,B : C X ( A, B) → C( A, B) with XA
/ B
f
ω pA,B
→
A
pA
/ XA
f
/ B
and we call these operations mixing or convex combining. We call morphisms in the range of ω pA,B mixtures or convex combinations. We sometimes omit the superscripts and just write ω p and ω p ( f ). Proposition 2.4.3. Both stochastic maps and doubly stochastic maps are “convex closed,” that is, respectively, for p ∈ Cc (X ), f ∈ (C X )s ( A, B) =⇒ ω pA,B ( f ) ∈ Cs ( A, B) f ∈ (C X )ds ( A, B) =⇒ ω pA,B ( f ) ∈ Cds ( A, B) Hence, convex combinations of permutations are doubly stochastic. This family of conceptually meaningful mappings is neither monoidal nor functorial. It connects quantum categorical semantics with the framework of convex theories (Barnum et al. 2006, and references therein).
2.4.1.2 Sum As a slight variation of the foregoing we define mappings : C X ( A, B) → C( A, B) X
with
XA
f
/ B
→
X
A
⊥A
/ XA
f
/ B
and we call these operations sum. This notion of sum for C X induces a notion of sum for C X that we denote by X .
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
Example. We can now write x | y =
55
x y.
In FdHilb, if x = (x1 , . . . , xn ) and y = (y1 , . . . , yn ) are coordinate vectors relative to a chosen basis, then we have x y = (x¯ 1 y1 , . . . , x¯ n yn ) and
x y = x¯ 1 y1 + . . . + x¯ n yn .
2.4.2 Indexed Pure Quantum States and Operations The W-construction2 for dagger compact categories is introduced in Coecke (2007b) to factor out redundant global phases and involves a passage from vector representation to density matrix representation for pure states. The category WC consists of the same objects as Cq and morphism f ∈ WC( A, B) are of the form f = ϕ∗ ⊗ ϕ for some ϕ ∈ Cq ( A, B). Definition 2.4.4 (Coecke 2007b). A pure quantum state is an element ψ ∈ WC( A). A pure quantum evolution is a unitary operation U ∈ WC( A, B). We now see that applying the W-construction to C X brings in important complementary features. The category WC X consists of • The same objects as Cq ; • Morphism f ∈ WC X ( A, B) are of the form f = ϕ∗ X ⊗ X ϕ = A∗ X A
A∗ A/
A∗ X X A
ϕ∗ ⊗ϕ
/ B∗ B
for some ϕ ∈ C (X A, B), that is graphically: ϕ∗
ϕ
The isomorphism C X ∼ = C X induces the isomorphism WC X ∼ = WC X and the X X morphism f ∈ WC ( A, B) corresponding to the preceding morphism f ∈ WC X ( A, B) is in the form f = π∗ X ⊗ X π = A∗ A 2
π∗ ⊗π
Was originally called W Pr oj-construction.
/ B∗ X X B
B ∗ ∇ B/
B∗ B
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
56
where π = ϕ X , that is graphically: π∗
π
Remark. The foregoing pictures display the important fact that the tensors ⊗ X of C X and ⊗ X effectively correlate the components over the classical interface X , in contrast with the tensor ⊗ of C, which leaves them separate, as in ν∗
ν
Definition 2.4.5 (Coecke and Pavlovic 2007). A pure quantum measurement on A of quantity X is a self-adjoint morphism m = π∗ X ⊗ X π ∈ WC X ( A) with • π an Eilenberg-Moore coalgebra for comonad X ⊗ − : C → C. We refer to this last condition as m being spectral. Explicitly we have π†
XA A
π
A
/ XA A
Xπ
/ A = XA
/ XXA π
/ XXA = A π
A
/ XA
εA
/ A Xπ
/ XA
/ XXA
/ A = id A
that is, graphically:
π
†
=
π
π
π
= π
π
=
A pure quantum measurement on A of quantity X is a morphism e ∈ WC X ( A, I ) that is such that e† ◦ e is a self-adjoint and spectral. Remark. The third equation can also be rewritten as π X = id .
(2.6)
X
When syntactically distinguishing between identical index types as X and X and setting δ X,X for ∇ ⊗ A the second one can be rewritten as π X π X = π X δ X,X
(2.7)
and the first can be rewritten as †
π XX = π X , so we recover an analogue of the properties of a projector spectrum.
(2.8)
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
57
Example. It was shown in Coecke and Pavlovic (2007) that Definition 2.4.5, instantiated to the category FdHilb, captures the usual pure measurements, i.e., spectra of orthogonal projectors indexed by basis vectors of the classical structure X , which now represent the outcomes of the measurement. The argument showing this is based on Equations (2.6), (2.7), and (2.8). Example. Each classical structure induces a canonical measurement, namely, the one obtained by taking π to be X . This is a measurement against the “basis” specified by the classical structure X . The following definition captures the idea that certain operations may depend on values of some classical data type X , for example, the outcomes of previously performed measurements. This is, for example, essential in teleportation-like protocols and measurement-based quantum computational schemes. Definition 2.4.6. An operation controlled by X is a morphism in WC X . In particular we have: • Pure quantum states controlled by X are ψ ∈ WC X ( A) ; • Pure quantum evolution controlled by X are unitary U ∈ WC X ( A, B) ; • Pure quantum measurements on A of quantity Y controlled by quantity X are self-adjoint spectral m ∈ W(CY ) X ( A, A). The pure quantum states and operations of Definition 2.4.4 can be represented in WC X via the canonical functor (−) X : WC → WC X with (−) X
A∗ A
f
A → A
/ B ∗ B → A∗ X A
A∗ A/
A∗ A
f
/ B∗ B
and the pure quantum measurement of quantity X of Definition 2.4.5 can be represented in WC X along the isomorphism (−) X : WC X ∼ = WC X . With the foregoing definitions, we can now model quantum protocols in WC X , assuming that X is the space of classical data, and interpreting the classical flows in terms of the Kleisli structure. For example, the teleportation protocol is simply the composite T =A
/ A A∗ A
A(η A ) X
mX A
/ A
U
/ A
/ A∗ A is the pairing in C X , U ∈ WC X ( A, A) is the appropriate where I unitary, and m ∈ WC X ( A A∗ , I ) is the transpose (coname) of the conjugate of U , obtained by composing in C X , (η A ) X
m = A A∗
AU∗
/ A A∗
/ I.
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
58
Showing that T = id A boils down to an easy exercise using the compositionality lemmas for compact categories (Abramsky and Coecke 2004). In the graphical language of the dagger compact category WC X this proof is just U
U U∗
=
U†
=
So the diagrammatic proof of teleportation with classical data flow in WC X is just the diagrammatic proof of post-selected (or conditional) teleportation in WC. In the graphical language of the dagger compact category Cq this unfolds to the following diagrammatic equation:
(*)
(*)
(**)
=
=
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
59
where the annotated elements are:
(*) =
U∗
U
U∗
U
U∗
U†
(**) =
The distinction of “quantum vs. classical” is thus displayed as the distinction of “two wires vs. one wire.” Compared with the concise graphical representation of the same process in WC X , this unfolded picture displays the details of the interaction between the classical and quantum data flow. In particular, the equality
U∗
U =
U∗
U†
is a consequence of unitarity of U in WC X , because the unitarity equation U ◦ X U † X = id, unfolded in the graphical language of C, is just
U∗
U =
U∗
U†
2.4.3 Indexed Mixed Quantum States and Operations The P-construction of Definition 2.3.4 can be viewed as the hull of the Wconstruction in the sense that the canonical functor C → PC factors / PC . / / WC C Remark. Mixed states arise from pure states by mixing. If f ∈ WC X then one can show that ω p ( f ) ∈ PC by relying on Proposition 2.3.5. Conversely, one can
P1: SBT cuus834-02
cuus834-gay
60
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
also show that all mixed states arise in this manner. Hence, PC( A) is the “abstract” convex closure of WC(A). Repeating the foregoing but now for the P-construction will allow us to extend our dictionary of quantum operations from pure to mixed ones. The category PC X consists of • The same objects as Cq ; • Morphisms f ∈ PC X ( A, B) are of the form f = (B ∗ ⊗ X (εV ∗ ) X ⊗ X B) ◦ X (ϕ∗ X ⊗ X ϕ) = A∗ X A
A X A∗
/ A∗ X X A
ϕ∗ ⊗ϕ
/ B∗V ∗V B
B ∗ εV ∗ B
/ B∗ B
for some ϕ ∈ (X A, V B), that is, graphically; ϕ
ϕ∗
The isomorphism C X ∼ = C X induces the isomorphism PC X ∼ = PC X , and the morphism f X ∈ PC X ( A, B) depict graphically as
π∗
π
for some π ∈ (V A, X B). Definition 2.4.7. A mixed quantum state controlled by quantity X is an element of PC X ( A) and a mixed quantum evolution controlled by quantity X is a morphism in PC X ( A, B). For generalized measurements or PMVMs we refer the reader to Coecke and Paquette (2008). The reader can easily come up with many variations on the same theme. Similarly as in the case of pure operations, protocols involving mixed operations can now be represented in PC X .
2.4.4 Conjoining Classical Interfaces In Section 2.3 we introduced classical operations, and thus far in Section 2.4 we have adjoined a classical interface to a quantum universe. Each classical interface lived in a different category. The task in this section is to conjoin all these classical interfaces of the quantum universe within one category, and to apply the classical operations between the classical interfaces. We will then be able to feed processed data obtained at one interface (= observable) as control data into another interface.
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
61
A C-indexed category is a contravariant functor from C into CAT (Johnstone and Par´e 1978). The collection of classical interfaces together with the functions between them can be packaged as a C f -indexed category as follows:
℘ : Copf → CAT with
℘
X → PC X ϕ
(X
/ Y ) → PCY
℘ϕ /
PC X
where each ℘ ϕ is an identity-on-objects-functor with the arrow part
A∗ Y A
g
/ B∗ B
℘ϕ → A∗ X A
A∗ ϕ A
/ A∗ Y A
g
/ B∗ B
In the graphical language of C we have
f
℘ϕ →
f ϕ
Y X The well-definedness of ℘ and the reason for restricting to functions is explained in the following proposition. Proposition 2.4.8. Let ϕ : X → Y be a morphism between classical structures. With the preceding notation, ℘ ϕ(g) : A∗ X A → B ∗ B is in PC X for every g ∈ PC X if and only if ϕ is a classical map, and ℘ ϕ : PCY → PC X is a functor if and only if ϕ is a function. The first part of this proposition follows by Proposition 2.3.5. For ℘ ϕ to preserve composition ϕ needs to preserve , while for ℘ ϕ to preserve identities ϕ needs to preserve , and the converse also holds. We invite the reader to draw the appropriate pictures to verify this. Given any indexed category X , its total category, which is obtained by applying the Grothendieck construction, pairs morphisms in the indexing category with morphisms in the indexed categories. In the case of ℘ , it pairs functions on classical data with controlled completely positive maps on quantum data. Explicitly, we obtain a category SC = ℘ that consists of the following:
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
62
• Pairs X, A with X ∈ C f and A ∈ ℘ X as objects, that is, |SC| = |C f | × |Cq | ; • Pairs
ϕ : X → Y , g : A → ℘ ϕ(B)
as morphisms of type X, A → Y, B, with ϕ ∈ C f (X, Y ) and g ∈
℘ X ( A, B) – since ℘ is an identity-on-objects-functor and hence we have ℘ ϕ(B) = B – i.e., SC X, A, Y, B = C f (X, Y ) × PC X ( A, B) ;
• idX,A = X • Composition
X
/ X , A∗ X A
/ A∗ A ;
A∗ X A
ν, g ◦SC ϕ, f = ν ◦ ϕ ,
℘ ϕ(g) ◦ X
f
for ϕ, f : X, A → Y, B and ν, g : Y, B → Z , C. In the graphical calculus of C the morphism ℘ ϕ(g) ◦ X f is g Y ϕ
f
X Proposition 2.4.9. SC is a symmetric monoidal category. Remark. Since C f is not a dagger category, neither is SC. From the composition law in SC it easily follows that we need to interpret a pair of morphisms ϕ : X → Y, g as follows: • The components are a classical operation ϕ and a X -controlled quantum operation g, applied in parallel, hence each consuming one copy of the initially available classical data of type X . After this joint process the available classical data is now of type Y . Example. The ability to vary classical data types in particular enables erasure of classical data. For example, erasure of all classical data is just the cartesian map to I as the final object of C f X , id A : X, A → I, A
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
Classical and Quantum Structuralism
18:55
63
while the erasure of part of it is just the cartesian projection id X × Y , id A : X × Y, A → X, A . Example. We can write down pairs consisting of measurement data obtained in a measurement and the corresponding bra|, e.g., + X , + X | : I, Q → X, I for a +-outcome in a destructive measurement of a qubit along the X -axis. Somewhat more involved is the following example taken from one-way quantum computing (Raussendorf et al. 2003). We can represent consecutive measurements on the first three qubits of a four-qubit cluster state followed by an operation f / Q ∗ Q that performs an operation on the last qubit that depends Q∗ X Y Z Q on all the measured data:
I, O Q
X Y Z , f
X Y ZO , Q X Y − Z ,− Z |Q
X Y, O Q Q X +Y ,+Y |Q Q
X, QO Q Q + X ,+ X |Q Q Q
I, Q QO Q Q I,cluster
I, I where we can rely on the categorical axiomatisation of unbiased observables in Coecke and Duncan (2008) and Coecke et al. (2008b) to provide explicit categorical semantics for the X -, Y -, and Z -measurements. In a picture we have
P1: SBT cuus834-02
cuus834-gay
64
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
f
−Z −Z +Y +Y +X +X
cluster where the bras and cluster each in fact correspond to two triangles:
+X
+X
cluster
2.5 Embedding Measurements and Controls, Limitations, and Final Remarks Unfortunately, due to Proposition 2.4.8, which prohibits probabilistic classical data operations in SC, we cannot represent stochastic variables within SC. For this reason, we also cannot represent the quantum measurements except for in postselected fashion as we did previously. More concretely, measurement of classical data type Y “would be” a composite A∗ X A
idY ⊗X ,m◦SC ⊥Y ⊗id X ,id A
/ A∗ X Y A
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
18:55
Classical and Quantum Structuralism
where m ∈ PCY ( A, A) corresponds via WCY WCY
65
/ PCY
to a pure quantum measurement in the sense of Definition 2.4.5, if it were not for the fact that ⊥Y : I → Y is not a function. Indeed: =
2.5.1 Classicality = Decoherence The characterization in Proposition 2.3.5 of classical information flows in terms of decoherence indicates a typewise distinction between classical and quantum data flows by requiring the former to be decoherent. In other words: we characterize classical data by the fact that it is invariant under the application of corresponding decoherences. Proposition 2.5.1. For a morphism f : A∗ X A → B ∗ Y B where X and Y are classical structures, the following are equivalent : ∗
∗
f A ∇ A/ / B ∗ Y B B B/ B ∗ Y Y B is a comA∗ X A • f X,Y = A∗ X X A pletely positive map ; ∗ g A∗ A/ X,Y ∗ / B ∗ Y Y B B ∇ B/ B ∗ Y B where g : • f = g A∗ X X A c = A XA A∗ X X A → B ∗ Y Y B is a completely positive map which is “decoherent in the classical data types,” that is,
(B ∗ Y B) ◦ g = g ◦ ( A∗ X A) = g . Moreover, there is an identity-on-objects isomorphism of categories: (−)
Cq c j
*
Cq
(−) c
where the categories Cq c and Cq both have the same objects as SC and where X,Y the morphisms of type X, A → Y, B are respectively those of form g and c X,Y f subject to the conditions stipulated previously. These morphisms are graphically represented by
f X,Y =
f
X,Y = g c
g
P1: SBT cuus834-02
cuus834-gay
66
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
Proposition 2.5.2. The category Cq c is dagger compact. The category SC canonically embeds in Cq via the identity-on-objects c functor
ϕ ,
ϕ
→
f
f
Probabilistic operations C c also live in Cq c via the functor X → X, I C c → Cq c :: ϕ → id I ⊗ ϕ ⊗ id I and one easily verifies that all measurements and any other operations defined here all live within Cq c . Example. In the previous example we can now replace the “conditional” measurements with genuine measurements. We can also represent controlled measurements that depend on outcomes of other measurements:
m3
m2
m1 cluster
as well as the measurements that depend on a coin toss:
m Alice ⊥
m Bob ⊥
that are used in quantum key distribution (Ekert 1991).
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
Classical and Quantum Structuralism
2.5.2
18:55
67
? = broadcasting cloning
SC
If the ultimate goal of categorical quantum mechanics is a full categorical description of the interaction between classical and quantum information flows, then the category SC built here is not big enough. Indeed, it does not capture probabilistic operations on classical data as well as on quantum measurements. On the other hand, Cq c is “not satisfactory” for a number of reasons, including: • Cq c does not encode the properties of classical data flow in a structural manner in a similar manner in which co-Kleilsli composition in SC embodies cloneability and deleteability of classical data. • Cq c lacks the clear separation between classical operations and classically controlled quantum operations of SC. So why do the constructions in Section 2.4 prohibit probabilistic classical data? The answer is simply that while deterministic classical data can be cloned, probabilistic classical data can not. Moreover, the composition mechanism underlying Kleisli indexing – and consequently the interaction between classical and quantum data in SC – allows us to distinguish classical data from quantum data because only the former can be cloned. If we want to separate probabilistic classical data from quantum data we should not appeal to their distinct behavior under cloning but to their distinct behavior under broadcasting (Barnum et al. 1996). Solving the equation in the title of this section remains an open challenge.
Bibliography Abramsky, S. (2010) No-Cloning in categorical quantum mechanics. In this volume, pages 1–33. Abramsky, S., and Coecke, B. (2004) A categorical semantics of quantum protocols. In Proceedings of 19th IEEE Conference on Logic in Computer Science, pages 415–425. IEEE Press. arXiv:quant-ph/0402130. Abramsky, S., and Coecke, B. (2005) Abstract physical traces. Theory and Applications of Categories 14:111–124. Alberti, P. M., and Uhlmann, A. (1983) Stochasticity and Partial Order. Doubly Stochastic Maps and Unitary Mixing. Reidel. Barnum, H., Barrett, J., Leifer, M., and Wilce, A. (2006) Cloning and broadcasting in generic probabilistic theories. arXiv:quant-ph/0611295. Barnum, H., Caves, C. M., Fuchs, C. A., Jozsa, R., and Schumacher, B. (1996) Noncommuting mixed states cannot be broadcast. Physical Review Letters 76:2818–2821. arXiv:quantph/9511010. Carboni, A., and Walters, R. F. C. (1987) Cartesian bicategories I. Journal of Pure and Applied Algebra 49:11–32. Coecke, B. (2007a) Complete positivity without positivity and without compactness, OUCL Research Report PRG-RR-07-05. http://web.comlab.ox.ac.uk/publications/publication54abstract.html.
P1: SBT cuus834-02
cuus834-gay
68
978 0 521 51374 6
October 30, 2009
18:55
´ Oliver Paquette, and Dusko Pavlovic Bob Coecke, Eric
Coecke, B., (2007b) De-linearizing linearity: projective quantum axiomatics from strong compact closure. Electronic Notes in Theoretical Computer Science 170:47–72. arXiv:quantph/0506134. Coecke, B., and Duncan, R. W. (2008) Interacting quantum observables. In Proceedings of the 35th International Colloquium on Automata, Languages and Programming, number 5126 in Lecture Notes in Computer Science, pages 298–310. Springer-Verlag. Coecke, B., and Edwards, B. (2008) Toy quantum categories. In Proceedings of Quantum Physics and Logic/Development of Computational Models (QPL-DCM) (to appear). Electronic Notes in Theoretical Computer Science. arXiv:0808.1037. Coecke, B., and Paquette, E. O. (2008) Povms and Naimark’s theorem without sums. Electronic Notes in Theoretical Computer Science 210:15–31. arXiv:quant-ph/0608072. Coecke, B., Paquette, E. O., and Pavlovic, D. (2008a) Classical and quantum structures, OUCL Research Report PRG-RR-08-02. http://web.comlab.ox.ac.uk/publications/publication65abstract.html. Coecke, B., Paquette, E. O., and Perdrix, S. (2008b) Bases in diagrammatic quantum protocols. Electronic Notes in Theoretical Computer Science 218:131–152. arXiv:0808.1037. Coecke, B., and Pavlovic, D. (2007) Quantum measurements without sums. In Chen, G., Kauffman, L., and Lamonaco, S., editors, Mathematics of Quantum Computing and Technology, pages 567–604. Taylor and Francis. arXiv:quant-ph/0608035. Coecke, B., Pavlovic, D., and Vicary, J. (2008c) A new description of orthogonal bases. arXiv:0810.0812. Dieks, D. G. B. J. (1982) Communication by epr devices. Physics Letters A 92:271–272. Eilenberg, S., and Moore, J. C. (1965) Adjoint functors and triples. Illinois Journal of Mathematics 9:381–398. Ekert, A. K. (1991) Quantum cryptography based on Bell’s theorem. Physical Review Letters 67:661–663. Fox, T. (1976) Coalgebras and cartesian categories. Communications in Algebra 4:665–667. Freyd, P., and Yetter, D. (1989) Braided compact closed categories with applications to lowdimensional topology. Advances in Mathematics 77:156–182. Johnstone, P., and Par´e, R., editors (1978) Indexed Categories and Their Applications, volume 661 of Lecture Notes in Mathematics. Springer-Verlag. Joyal, A., and Street, R. (1991) The geometry of tensor calculus I. Advances in Mathematics 88:55–112. Kelly, G. M., and Laplaza, M. L. (1980) Coherence for compact closed categories. Journal of Pure and Applied Algebra 19:193–213. Kock, J. (2003) Frobenius Algebras and 2D Topological Quantum Field Theories. Cambridge University Press. Lack, S. (2004) Composing PROPs. Theory and Applications of Categories 13:147–163. Lambek, J., and Scott, P. J. (1986) Higher Order Categorical Logic. Cambridge University Press. Lawvere, F. W. (1969) Ordinal sums and equational doctrines. In Seminar on Triples and Categorical Homology Theory, number 80 in Springer Lecture Notes in Mathematics, pages 141–155. Springer-Verlag. Nielsen, M. A. (1999) Conditions for a class of entanglement transformations. Physical Review Letters 83:436–439. Paquette, E. O. (2008) Categorical quantum computation. Ph.D. thesis, Universit´e de Montr´eal. Pati, A. K., and Braunstein, S. L. (2000) Impossibility of deleting an unknown quantum state. Nature 404:164–165. arXiv:quant-ph/9911090. Pavlovic, D. (1997) Categorical logic of names and abstraction in action calculus. Mathematical Structures in Computer Science 7:619–637. Pavlovic, D. (2008) Geometry of abstraction in quantum computation. Draft paper. Pavlovic, D. (2009) Quantum and classical structures in nondeterministic computation. In Proceedings of Quantum Interaction 2009, number 5494 in Lecture Notes in Artificial Intelligence, pages 143–158. Springer-Verlag. arXiv:0812.2266.
P1: SBT cuus834-02
cuus834-gay
978 0 521 51374 6
2
October 30, 2009
Classical and Quantum Structuralism
18:55
69
Raussendorf, R., Browne, D. E., and Briegel, H.-J. (2003) Measurement-based quantum computation on cluster states. Physical Review A 68:022312. arXiv:quant-ph/0301052. Selinger, P. (2004) Towards a quantum programming language. Mathematical Structures in Computer Science 14:527–586. Selinger, P. (2007) Dagger compact categories and completely positive maps. Electronic Notes in Theoretical Computer Science 170:139–163. Wootters, W., and Zurek, W. (1982) A single quantum cannot be cloned. Nature 299:802–803.
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
October 30, 2009
19:29
3 Generalized Proof-Nets for Compact Categories with Biproducts Ross Duncan
Abstract Just as conventional functional programs may be understood as proofs in an intuitionistic logic, so quantum processes can also be viewed as proofs in a suitable logic. We describe such a logic, the logic of compact closed categories and biproducts, presented both as a sequent calculus and as a system of proof-nets. This logic captures much of the necessary structure needed to represent quantum processes under classical control, while remaining agnostic to the fine details. We demonstrate how to represent quantum processes as proof-nets and show that the dynamic behavior of a quantum process is captured by the cut-elimination procedure for the logic. We show that the cut-elimination procedure is strongly normalizing: that is, that every legal way of simplifying a proof-net leads to the same, unique, normal form. Finally, taking some initial set of operations as nonlogical axioms, we show that that the resulting category of proof-nets is a representation of the free compact closed category with biproducts generated by those operations.
3.1 Introduction 3.1.1 Logic, Processes, and Categories Birkhoff and von Neumann initiated the logical study of quantum mechanics in their well-known 1936 paper. They constructed a logic by assigning a proposition letter to each observable property of a given quantum system and studied negations, conjunctions, and disjunctions of these properties. The resulting lattice is nondistributive, and so the heart of what is called “quantum logic” is the study of various kinds of nondistributive lattices. These traditional quantum logics suffer from a number of defects. First, they are monolithic: there is no way to derive the properties of a composite system from the properties of its parts. Each system has its own associated lattice that can only rarely be related to those of other systems. Further, these systems are seen statically: a system that undergoes some dynamical change is a new system. Finally, the failure of compositionality is connected with 70
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
71
the fact that quantum logic has no decent notion of implication (Smets 2001); hence we have a logic that has a notion of validity, but no concept of inference or proof. These limitations form a serious obstacle to the use of Birkhoff–von Neumannstyle quantum logic to study interacting quantum systems. If by “system” we understand the ubiquitous qubit, then it is precisely such interactions that form the basis of quantum informatics. Indeed, the principal concern of the computer scientist1 – how to soundly construct large systems from smaller ones – is exactly where quantum logic is weakest. Here I describe a very different kind of logic that can address these questions. This logic is called tensor-sum logic and it shares many features with linear logic (Girard 1987a), which has been widely studied in computer science and structural proof theory. We proceed in accordance with an old tradition in computer science, that of linking computational systems and logics, of claiming that a certain logic “is the same as” some formal computing machine. The archetype of this approach is the Curry-Howard correspondence between intuitionistic natural deduction (Gentzen 1935; Prawitz 1965) and the simply-typed λ-calculus (Curry and Feys 1958; Howard 1980). The basic insight is that the inference rules of the logic are essentially the same as the constructors used to form a λ-term. The valid types of the λ-calculus are nothing more than the theorems of the logic, and more importantly every proof represents a λ-term. We can thus view the logic itself as a computational system, with the important proviso that the objects of interest are the proofs and not the theorems. This correspondence is not just skin deep. Recall that the β-reduction relation between λ-terms expresses the execution behavior of the calculus; we consider terms to be computationally equivalent when they reduce to the same β-normal form. This dynamical aspect of the λ-calculus corresponds exactly to the normalization procedure for natural deduction proofs or, in the sequent calculus setting, to the cut-elimination procedure (Gentzen 1935). In our presentation of tensor-sum logic we will take this correspondence as given and treat the proof-theoretic presentation as a computational system in its own right. The normalization procedure gives the computational dynamics. There is a further correspondence that we engage with rather more seriously: that between the proofs in a given logic and the arrows in a particular class of categories (Lambek 1968, 1969). We can equate the propositions of a logic L with the objects of a category C; for each proof of, say, a proposition B from a premise A, we define a corresponding arrow f : A → B in the category. Stated so blandly, we have little structure to work with, so we go further and demand that the logical connectives be represented by functors on C. The natural transformations between these functors then give rise to the inference rules of the logic. In this way an arrow in C may be constructed for each proof in L; we say that C is a denotational model of L if, whenever two proofs share the same normal form, they have equal denotations in C. The categorical model gives an extensional 1
At least: the principal concern of many computer scientists.
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
72
October 30, 2009
19:29
Ross Duncan
Table 3.1. Curry-Howard-Lambek correspondences Computation
Logic
Category
types terms type formers term constructors
formulae proofs connectives inference rules
objects arrows functors natural transformations
account of the computational dynamics represented in the term language. The general schema of this tripartite relation is shown in Table 3.1. To return to our earlier example, the simply typed λ-calculus forms such a triple with intuitionistic natural deduction and the class of cartesian closed categories (Lambek and Scott 1986). Another example is provided by intuitionistic multiplicative linear logic (Girard 1987a); this logical system corresponds to the linear λ-calculus and to the class of *-autonomous categories (Barr 1979, 1991). The pattern is quite general, and more examples can easily be found. This relationship between a logic and its categorical models can be made exact. In the preceding description we embedded the connectives and inference rules of L into C using only functors and natural transformations: the logical structure is agnostic with respect to the concrete elements of the category. Hence any category with the requisite functors can provide a model, up to some assignment of the basic proposition letters. Of course such a category may well contain other objects or arrows that do not correspond to anything in the logic we are trying to model. To make the correspondence exact we must be able to translate from the free category (with appropriate structure) faithfully back to our logic. That is, we must find an injective translation from the arrows of C onto the cut-free proofs of L. In the case of our generalized proof-nets, that is indeed possible, but for a simpler example, consider the simply typed λ-calculus with just one ground type; then the category of its terms is the free cartesian closed category generated by the category 1, which has only one object and one identity arrow. The choice of generator can be rather important. By choosing a discrete category (i.e., a set) the resulting logic will have that set as its propositional variables. By choosing a category with nontrivial arrows, we introduce nonlogical axioms: if cut elimination for the resulting logic is to be retained we must lift the composition operation of C into the cut-elimination procedure of L itself. If other equations between arrows are required, these too must be hoisted into the logic. In the case we consider here, the situation is even worse: we will take as a generator a compact symmetric polycategory (Duncan 2006). This esoteric creature will be described in a later section, but for now we note that the intricacy of the required composition forces the adoption of the proof-net formalism, an illustration of the power of graphical methods over conventional syntax. The development in the following sections will be the reverse of the foregoing exposition. We first describe the mathematical basis of quantum computation in its concrete setting – finite-dimensional Hilbert spaces – then we identify certain
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
73
structures of the category fdHilb that are the essential features for carrying out quantum computation. Next we present the syntax of tensor-sum logic, and finally prove that the category of generalized proof-nets is the free compact closed category with biproducts generated by a compact symmetric polycategory. Prior work. The original formulation of quantum mechanics in terms of compact closed categories with biproducts was due to Abramsky and Coecke (2004). An early attempt to formalize quantum computations in terms of proof-nets for MLL was Duncan (2004). The first description of a logic based on compact closed categories and biproducts was given by Abramsky and Duncan (2006); however, this logic is essentially restricted to quantum systems with only bipartite entanglement. This restriction was lifted in Duncan (2006) via the use of polycategories, although only the multiplicative fragment of the logic was treated. The present article is essentially a fusion of the previous two: giving a complete presentation of two-sided proof-nets with generalized axioms, and both the tensor and sum connectives. A notable distinction between the treatment of the biproduct here as compared to that of Abramsky and Coecke (2004) is that here the biproduct is freely generated, hence the our treatment is closer to that of Selinger (2004); we discuss the vexed position of this connective at the end of Section 3.1.2.
3.1.2 Quantum Mechanics Concretely and Abstractly The main work of this chapter is to characterize the structure of certain kinds of category in terms of proof-nets. The particular categories we are interested in are compact closed categories with biproducts, and in the next section we go into considerable detail defining, characterizing, and giving some of the basic properties of such categories. In this section we describe, at a more intuitive level, how the structure relates to quantum mechanics and quantum computation in particular. We start with a schematic description of quantum mechanics. Since we are interested in quantum computation, we restrict ourselves to quantum systems with finite-dimensional state spaces. Consider the following axioms. (i) To each quantum system we associate a finite-dimensional Hilbert space, its state space; the possible states of the system are unit vectors in the state space, modulo a global phase factor. (ii) If two systems are combined, then their joint state space is the tensor product of the two state spaces. (iii) Measuring a quantum system is nondeterministic; possible outcomes are the eigenvectors of some self-adjoint operator on the state space, and the probability of observing a particular outcome depends on the inner product of the current state and the eigenvector for that outcome. After the measurement the state is updated to match the observed vector2, assuming it is not destroyed by the act of measuring. 2
We have implicitly assumed that the measurement is nondegenerate.
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
74
October 30, 2009
19:29
Ross Duncan
(iv) For any discrete time step, the next state of the system is determined by a unitary map on its state space. Of course, we have omitted some important details, but the preceding axioms approximate the level of abstraction of our categorical formalisation. The first thing we should note that the fdHilb, the category of finite-dimensional Hilbert spaces and linear maps, is the “natural” category in which to formalize the listed axioms.3 The second point is that fdHilb is compact closed and has biproducts. Third, the preceding axioms can be rephrased in terms of the categorical structure alone. Before showing how the ingredients of the axioms translate into categorical terms, let us dispose of some unnecessary baggage. Consider a linear map ψ : C → H. Since it is linear, and its domain is one-dimensional, its value is fixed by its value on 1; hence maps of this type are in 1-1 correspondence with vectors of H. Hence we can forget about vectors and talk only of linear maps. Now consider measurements. There are three parts to a quantum measurement: the nondeterministic possibilities, the calculation of the probabilities, and the updated state. We deal with these in reverse order. The new state of a measured system depends only on which outcome i of the measurement happened; hence it is just a new state |φi , with no particular relation to the old one. Of course, the measurement process may destroy the system, in which case there is no new state. To calculate the probability of seeing outcome i when we are in state |ψ we must calculate the inner product φi | ψ. This process too can be seen as a linear map, namely the projection map φi | : H → C; when composed with |ψ this yields the inner product. Hence the state transformation associated to the ith outcome of some measurement is described by the map H
φi |
- C
|φi
- H.
Note that this is a desired transformation even in the case when only part of a composite system is measured. For the purposes of this work, calculating the probabilities is not so important, but the transformation of the state is essential. Finally let us consider the nondeterministic aspect of measurement. The main point is that there are several possible outcomes and we know which one happened. Suppose we perform a measurement with two outcomes; we can view this process as a map of type H→H⊕H where the two sides of the direct sum correspond to the two “possible worlds” induced by the two outcomes of the measurement. One can then represent conditional operations by acting on only one subspace or the other; for example f ⊕ g 3
As the first and last axioms suggest fdHilb is actually too big: it contains vectors and maps that do not correspond to anything in quantum mechanics. The general program of describing quantum mechanics in categorical terms aims to find the minimal structure required.
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
75
behaves as the linear map f : H → H if the first outcome was observed, and g : H → H if the second was observed. How then can we write the axioms of quantum mechanics in the language of compact closed categories and biproducts? First, compact closed categories are equipped with a tensor product, and this tensor product has a neutral element I . In fdHilb the tensor product is simply the usual Kronecker product, and its neutral element is the base field, namely C. This gives us the first two axioms: • To each quantum system we associate an object A, its state space; the possible states of the system are given by arrows ψ : I → A. • If two systems with state spaces A and B respectively are combined, then their joint state space is A ⊗ B. In fdHilb the biproduct is the direct sum of Hilbert spaces, and this will allow the formalization of measurements. • An n-outcome measurement of a quantum system whose state space is A is represented by an arrow m:A Bi i
where each of the projections πi ◦ m : A → Bi factors as A
- I
- Bi .
This is a very general notion of measurement. The common cases are when Bi = I and the original system is destroyed, and when Bi = A and the original system is preserved. Since we are interested in formalizing as much of quantum mechanics as possible within one category, we do not restrict state transformations to unitary evolutions; note that a measurement is a valid transformation of a quantum state that is not unitary. Hence the last axiom is simply the following. • A quantum system A may transform to another system B by means of any arrow f : A → B. We have not yet mentioned the role of the compact structure of the category. While not required to paraphrase the axioms, the compact structure plays an important role in capturing quantum phenomena. Recall that the tensor product of two vector spaces contains points : I → A ⊗ B which cannot be factored into a pair of vectors ψ1 : I → A and ψ2 : I → B. Such quantum states are called entangled, and they play a central role in quantum computation. The compact structure guarantees the existence of certain entangled states, namely Bell states for every finite-dimensional Hilbert space: η A : I → A∗ ⊗ A .
P1: SBT CUUS834-03
cuus834-gay
76
978 0 521 51374 6
October 30, 2009
19:29
Ross Duncan
If A is two-dimensional, i.e., a qubit, then the corresponding vector is η A (1) = |00 + |11 . Furthermore, the compact structure also provides a projection onto this state A : A ⊗ A∗ → I and hence we can define measurements on Bell states. These two operations allow many more entangled states to be defined. This completes our impressionistic description of how quantum mechanics may be formalized in the categorical setting. Before moving on, it is worth pointing out what has been excluded from our formalization. Perhaps the most striking omission in moving between the concrete axioms and the abstract is the concept of unitarity. The abstract formulation of quantum mechanics described here is derived from that introduced by Abramsky and Coecke (2004); which uses strongly compact closed categories. Also called †-compact, these categories are equipped with a contravariant involutive functor that sends each map f to its adjoint f † and has no effect on objects. This functor can then be used to define unitarity and the inner product. In this article, we focus on freely constructing the compact closed and biproduct structure from some underlying category of generators. One could consider the case when these structures cohere with the (·)† operation, giving a †-compact category with †-biproducts; however, the only difference here between the †-structure and the original is that the structural isomorphisms are required to be unitary. That is to say, the only new maps that are introduced are the adjoints of the generators. Hence we can simply enlarge the class of generators beforehand, and thereafter ignore the †-structure. Of course, when working on concrete examples it is important to be aware of the adjoints, and the equational theory of the generators more generally, but that is not the focus here. The other important deviation from usual quantum mechanics is that we have been extremely liberal about measurements. In particular we do not make any restriction on the number of outcomes a measurement may have. Of course, in quantum mechanics the outcomes are the spectrum of some operator and hence are bounded by the dimension of the space. Considering these issues would take us too far afield, but we touch briefly later on the approach of Abramsky and Coecke (2004); more recent papers (Coecke et al. 2008b; Coecke and Duncan 2008) present a different categorical treatment of quantum observables. In any case, it seems unlikely that the structure of quantum measurements – being fundamentally connected to the bases of the underlying space – will yield to a description in terms of natural transformations of some functors.
Some Remarks on the Biproduct In their 2004 paper, Abramsky and Coecke used the biproduct of fdHilb in two roles: first, to encode classical branching, as described previously; and second, to
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
77
construct bases for the underlying space. In particular, they define state preparations and destructive measurements as isomorphisms of the forms I → A and meas : A → I . base : i
i
This second use of the biproduct has been criticised by later works (Coecke 2005a; Selinger 2005) on two main accounts. In the original approach the composite meas meas - A A I i
yields the identity map, contradicting physical reality – a real experiment would transform a pure state to a mixed state, something not handled within this simple framework. More importantly, when moving from a “vector space” setting like fdHilb to a “projective” setting, such as Selinger’s CPM construction or Coecke’s WProj, the direct sum of the underlying space no longer yields a biproduct. The only option is to construct the biproduct as formal vectors and matrices. The works cited earlier show that, in the projective setting, if there is a biproduct then the scalars are essentially restricted to probabilities rather than amplitudes. The immediate consequence is that we must give up any hope of using the additive structure to encode interference effects: we are essentially restricted to a classical probabilistic setting. The approach to biproducts taken in this work is absolutely consonant with these restrictions. We construct both the multiplicative and additive structures freely, and hence the scalars are simply a (free) semiring. The theory of processes thus produced is much like that introduced by Selinger (2004), based on classically controlled quantum operations.
3.1.3 An Example Proof-Net Sections 3.3 and 3.4 introduce tensor-sum logic and its proof-net notation. Since those sections focus on the technical details of the formalism, we present here an illustrative example of how proof-nets can be used to to model quantum processes. We describe an old favourite: the quantum teleportation protocol (Bennett et al. 1993). The sketch of the protocol goes like this: Two parties, Alice and Bob, initially share an entangled pair of particles in a Bell state, |Bell =
|00 + |11 √ 2
The parties then separate, and at some later point Alice wants to send a qubit to Bob, but unfortunately she has only a classical channel. However, it is still possible to transmit the qubit by using the shared entanglement between the two parties. To proceed, Alice performs a joint measurement on the qubit she wishes to transmit together with her half of the entangled pair. She measures in the Bell
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
78
October 30, 2009
19:29
Ross Duncan
basis, so her state will be projected onto one of the following vectors: |00 + |11 √ 2 |01 + |10 |Bell X = √ 2 |Bell1 =
|00 − |11 √ 2 |01 − |10 |BellY = √ 2
|Bell Z =
These states are all entangled, and further, each of them can be produced by starting with |Bell1 (aka η) and applying one of the Pauli operators; hence we can associate a Pauli operator to each outcome of the measurement. In order to complete the protocol, Alice transmits a classical message to Bob, saying which of the four outcomes she observed. Bob then applies the corresponding Pauli operation to his qubit and – as if by magic – it is now in the state that Alice wished to transmit. We now show how this protocol can be represented in term of proof-nets using the compact closed structure and biproducts. By normalizing the proof-net we will effectively simulate the execution of the protocol. We start with a premise representing Alice’s input and a unit link representing the initial shared Bell state: —
η
Note that in these diagrams time flows from the top to the bottom: input at the top of the page, outputs at the bottom. The right two qubits are taken to belong to Alice, the leftmost belonging to Bob. The next element is the Bell basis measurement. We assume this is a destructive measurement, so the four possible transformations are simply projections. To indicate that these form an exclusive choice, we put them in a box: X
Y
Z
I
I
I
I
⊕1
⊕2
⊕3
⊕4
— ⊕4i=1 I
— ⊕4i=1 I
⊕4i=1 I
— ⊕4i=1 I
Notice the output of type ⊕i I serves simply to indicate which outcome occurred. Finally we consider Bob’s correction. Since his behavior is conditional on a classical input, he has a box with an input of type ⊕i I :
⊕1 —
X I
—
⊕2
Y I
—
⊕3
I
Z
⊕4
—
I
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
79
Putting it all together we have the following picture: Q —
η
X
Q
Y
Z
I
I
I
I
⊕1
⊕2
⊕3
⊕4
— ⊕4i= 1 I
— ⊕4i= 1 I
⊕4i= 1 I
— ⊕4i= 1 I
⊕i I ⊕1 —
I
X
⊕2
—
I
Y
⊕3
—
I
Z
⊕4
—
I
— Q
Now we can begin to simulate the protocol. The first step is to resolve the nondeterminism of Alice’s measurement. We do this by “opening the box,” essentially making four copies of the whole system, one for each possible outcome of the measurement. Q —
η
Q —
η
Z
Y
⊕4
Q ⊕i I ⊕1 —
I
X
⊕2
—
I
Y
⊕3
—
I
⊕i I
Z
⊕4
—
⊕1 I
—
I
— Q
X
⊕2
—
I
Y
⊕3
—
I
Q —
X
⊕2
—
— Q
I
I
Y
⊕3
—
I
Z
⊕4
—
⊕2
Q
⊕i I
I
X
⊕1
Q
⊕4
Q —
η
⊕1
Z —
— Q η
—
⊕3
Q
⊕i I ⊕1 I
—
I
X
⊕2
—
— Q
I
Y
⊕3
—
I
Z
⊕4
—
I
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
80
October 30, 2009
19:29
Ross Duncan
Next, in every copy the interaction of the entangled state and the measurement can be rewritten as shown.
Q —
Q —
Z
Y
⊕4
⊕3
Q
Q ⊕i I
⊕1 —
I
X
⊕2
—
I
Y
⊕3
—
I
⊕i I
Z
⊕4
—
⊕1 I
—
I
— Q
X
⊕2
—
I
Y
⊕3
—
I
I
X
⊕2
—
— Q
I
X
⊕1
⊕2 Q
⊕i I
Q —
Q
⊕1
⊕4
— Q Q —
—
Z —
I
Y
⊕3
—
I
Z
⊕4
—
⊕i I ⊕1 I
—
I
X
⊕2
—
I
Y
⊕3
—
I
Z
⊕4
—
I
— Q
Now we can open the box corresponding to Bob’s nondeterminism; this will leave us with 16 copies of the system. We won’t draw all of these copies, since 12 of them can be erased: these are the cases in which the input that Bob is expecting does not match what Alice sends. We are left with
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
Q —
Q —
Z
Y
Q
81
Q
Z
Y
— Q
— Q Q —
Q —
X Q
Q X — Q
— Q
Now we simply note (and this is not a logical axiom) that X 2 = Y 2 = Z 2 = 1, so we can simply remove these maps. Hence we have the normal form: Q —
Q —
Q
Q
— Q
— Q Q —
Q —
Q
— Q
Q
— Q
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
82
October 30, 2009
19:29
Ross Duncan
which shows that in every possible world, Alice has successfully formed a channel to Bob along which her state can be transmitted. Although we presented the rewrites in the order that the steps of the protocol would be carried out, in fact our proof-nets are strongly normalizing, so any order would produce the same results. Having sketched the system, we move to the details. First the category theory, then in Sections 3.3 and 3.4 the logic.
3.2 Categorical Preliminaries In this section, we introduce the necessary categorical structures, compact closed categories and biproducts, and present their basic properties. Much of this material is well known, so proofs are omitted. Standard references are Mac Lane (1997) and Kelly and Laplaza (1980); other material is derived from the author’s thesis (Duncan 2006). Other sources are cited as needed. Compact closed categories (Kelly and Laplaza 1980) are abundant throughout mathematics and computer science. Examples include Rel, the category of sets and relations, finitely generated projective modules over a commutative ring, and Conway games (as categorified by Joyal, 1977). In Hilb, the category of all Hilbert spaces, the subcategory of determined by the Hilbert-Schmitt maps is compact closed, and more generally, the nuclear maps of any tensored *-category (Abramsky et al. 1999) for a compact closed subcategory. Of course, fdHilb, the category of finite-dimensional Hilbert spaces is compact closed. In computer science compact closed categories have been studied in the context of typed concurrency as interaction categories (Abramsky et al. 1996); in logic, compact closed categories are degenerate models of multiplicative linear logic (Abramsky and Jagadeesan 1994; Loader 1994; Hyland and Schalk 2003); in physics the category of n-dimensional cobordisms, used in topological quantum field theory, is compact closed (Baez and Dolan 1995). More examples are easy to find. We define biproducts and investigate their basic properties in relation to compact closed categories. Categories with biproducts have been studied since the earliest days of category theory as part of the theory of Abelian categories (Mitchell 1965; Mac Lane 1997). Compact closed categories with biproducts have been studied by Soloviev (1987). A special case of compact closed categories with biproducts are the Tannakien categories (Deligne 1991). A recent contribution is by Houston (2008), who proved that every compact closed category with products has biproducts.
3.2.1 Monoidal Categories Definition 3.2.1. A category C is monoidal if equipped with a functor ⊗ : C × C → C, a distinguished neutral object I , and natural isomorphisms ∼ = α A,B,C : A ⊗ (B ⊗ C) - ( A ⊗ B) ⊗ C, λA : I ⊗ A
∼ = -
A,
ρA : A ⊗ I
∼ = -
A.
P1: SBT cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
83
For the associativity morphism α we require that the pentagon α α A ⊗ (B ⊗ (C ⊗ D)) - (A ⊗ B) ⊗ (C ⊗ D) - ((A ⊗ B) ⊗ C) ⊗ D 6 1⊗α
α⊗1
? A ⊗ ((B ⊗ C) ⊗ D)
- ( A ⊗ (B ⊗ C)) ⊗ D
α
commutes. The isomorphisms λ and ρ express the neutrality of I ; we require that the following diagram commutes: α
A ⊗ (I ⊗ B)
- (A ⊗ I ) ⊗ B
1 -
ρ
⊗
λ
1
⊗
A ⊗ B. Proposition 3.2.2. In a monoidal category the equality λI = ρI holds and the following diagrams commute: αI ⊗ ( A ⊗ B)
λ
λ⊗
ρ
1
-
1⊗
(I ⊗ A) ⊗ B
A⊗B
αA ⊗ (B ⊗ I )
ρ
(A ⊗ B) ⊗ I
CUUS834-03
A ⊗ B.
Proof. See Joyal and Street (1993).
Definition 3.2.3. A monoidal category is symmetric if it has a natural isomorphism σ A,B : A ⊗ B → B ⊗ A
P1: SBT cuus834-gay
978 0 521 51374 6
84
October 30, 2009
19:29
Ross Duncan
such that σC ⊗ ( A ⊗ B)
α
α−
1
(A ⊗ B) ⊗ C
-
A ⊗ (B ⊗ C)
(C ⊗ A) ⊗ B
1
1
⊗
⊗
-
σ
σ
A ⊗ (C ⊗ B)
α
- ( A ⊗ C) ⊗ B,
and σ-
I⊗A
A⊗B
1A⊗B
-
A⊗I
σ
λ
σ
ρ
-
-
CUUS834-03
B⊗A
A commute.
Mac Lane’s celebrated coherence theorem states that any formal diagram constructed from the α, ρ, λ, and σ will commute. A monoidal category is called strict if the isomorphisms α, λ, and ρ are all identities. To minimize syntactic overhead we make use of the following theorem throughout this section: Theorem 3.2.4 (Mac Lane). Every monoidal category C is equivalent to some strict monoidal category A. Note, however, that the category of proof-nets constructed in Section 3.4 is not strict: we will produce nontrivial associativity and unit morphisms.
3.2.2 Compact Closed Categories Let C be a symmetric monoidal category. We say that C is compact closed if every object A has a chosen dual4 A∗ and maps η A : I → A∗ ⊗ A A : A ⊗ A∗ → I 4
Some writers call this the “adjoint” in light of the relation between A and A∗ ; we use “dual” here to avoid confusion with the linear algebraic use of the word adjoint.
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
85
such that the composites 1 A ⊗η
A
- A ⊗ A∗ ⊗ A
⊗1 A
- A∗ ⊗ A ⊗ A∗
1 A∗ ⊗
- A
and A∗
η⊗1 A∗
- A∗
are equal to 1 A and 1 A∗ respectively. We call η A and A the unit and counit maps. Proposition 3.2.5. In a compact closed category we have natural isomorphisms: u : (A ⊗ B)∗ ∼ = B ∗ ⊗ A∗ v : I∗ ∼ =I w : A∗∗ ∼ = A,
A compact closed category that, in addition to being strictly monoidal, has all of the isomorphisms u, v, w equal to the identity is called a strict compact closed category. Kelly and Laplaza (1980) show that any compact closed category is equivalent to a strict one; hence we will take the preceding isomorphisms to be equalities whenever convenient. Proposition 3.2.6. In a compact closed category the units and counits define dinatural transformations; see Girard et al. (1992). η : I ⇒ ((−)∗ ⊗ −) : (− ⊗ (−)∗ ) ⇒ I. We have a bijection between C(A, B) and C(B ∗ , A∗ ): given f : A → B, define f ∗ : B ∗ → A∗ by B∗
η A ⊗ 1B∗ - ∗ A ⊗ A ⊗ B∗
f∗ ? A∗
1 A∗ ⊗ f ⊗ 1 B ∗ 1 A∗ ⊗ B
? A∗ ⊗ B ⊗ B ∗ .
We call f ∗ the dual of f . Proposition 3.2.7. The operation (−)∗ defines a functor C op → C, which is an equivalence of categories. Proof. We have 1∗A = 1 A∗ immediately from the definition of dual, and ( f ◦ g)∗ = g ∗ ◦ f ∗ follows from a routine calculation. Taking C to be strict, we we have A∗∗ = A, it follows from the defining property of compact closure that f ∗∗ = f , which gives the equivalence.
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
86
October 30, 2009
19:29
Ross Duncan
Since we have the equivalence between C and C op , any statement about some arrow applies equally well to its dual. In particular, results concerning units translate directly into results about counits and vice versa. The duality of a compact closed category gives a particularly strong form of monoidal closure. Every arrow in the category has a point that represents it, and dually a copoint. These representatives, the names and conames, will be crucial to our treatment of entangled quantum states. Definition 3.2.8. Let f : A → B in a compact closed category C. Define the name and coname of f to be the maps f : I → A∗ ⊗ B and f : A ⊗ B ∗ → I which are defined by I
ηA
A∗ ⊗ A
A ⊗ B∗
f -
? B∗ ⊗ B
-
? A∗ ⊗ B
f
1 A∗ ⊗ f f ⊗ 1 B ∗
B
- I
An immediate consequence of this definition is the isomorphism of hom-sets C(I, A∗ ⊗ B) ∼ = C( A, B) ∼ = C(A ⊗ B ∗ , I ).
Lemma 3.2.9. Let C be compact closed and suppose we have arrows D
- A
h
- B
f
- C;
g
then the following equations hold: (1 A∗ ⊗ g) ◦ f = g ◦ f , (h ∗ ⊗ 1 B ) ◦ f = f ◦ h , and ( f ⊗ 1C ) ◦ (1 A ⊗ g) = g ◦ f . We can also define partial versions of the name and coname; essentially currying and uncurrying. Lemma 3.2.10 (Partial Names and Conames). In any compact closed category we have the following isomorphisms: C(A ⊗ C, B) C(A, C ⊗ B)
∼ = ∼ =
C( A, C ∗ ⊗ B) ∗
C( A ⊗ C , B).
(3.1) (3.2)
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
87
Proof. Since the two isomorphisms are dual, we prove only the first. Define F : C( A ⊗ C, B) → C( A, C ∗ ⊗ B) and G : C( A, C ∗ ⊗ B) → C( A ⊗ C, B) by F : f → (1 ⊗ f ) ◦ (η A ⊗ 1) G : g → ( A ⊗ 1) ◦ (1 ⊗ g). Their composition gives G F f = ( A ⊗ 1) ◦ (1 ⊗ f ) ◦ (1 ⊗ η A 1), from which A⊗C
1 ⊗ η A ⊗1
A ⊗ A∗ ⊗ A ⊗ C
1 ⊗f
A ⊗ A∗ ⊗ B
A ⊗ 1
1
- ? A⊗C
A ⊗ 1
f
? - B
and hence G F = Id. Similarly Id = F G, which establishes the isomorphism. Equation (3.1) essentially states that compact closed categories are indeed closed with B A = A∗ ⊗ B. Since A∗ ⊗ I ∼ = A∗ this gives immediately the following. Corollary 3.2.11. Compact closed categories are ∗-autonomous (Barr 1979). Hence compact closed categories are models of MLL, and in particular the linear λ-calculus, although these are rather strange models equipped with only one, self-dual, tensor. Definition 3.2.12. Let C be compact closed and define a map Tr : C( A ⊗ C, B ⊗ C) → C( A, B) by setting TrCA,B ( f ) = (1 B ⊗ C ) ◦ ( f ⊗ 1C ∗ ) ◦ (1 A ⊗ ηC ∗ ) The map Tr( f ) is called the trace of f . The trace so defined makes C into a traced monoidal category in the sense of Joyal, Street, and Verity (1996). Few of the properties of the trace are required here, so we do not recapitulate the definition – in any case the relevant facts can be deduced from the properties of η and . We do, however, need the following lemma: Lemma 3.2.13 (Abramsky et al. 2002). Given arrows A symmetric traced monoidal category; then: g ◦ f = Tr BA,C (σ B,C ◦ ( f ⊗ g)) .
- B
f
- C in a
g
P1: SBT cuus834-gay
978 0 521 51374 6
88
October 30, 2009
19:29
Ross Duncan
The partial trace just defined may be extended to a full trace over any endomorphism f : A → A by setting A Tr( f ) = Tr I,I (ρ ◦ f ◦ ρ −1 ).
In fdHilb, the category of finite-dimensional Hilbert spaces, this coincides with the usual trace, explicitly given by summing the diagonal elements of a matrix representation of f .
3.2.3 Scalars and Loops Definition 3.2.14. In any monoidal category C the endomorphisms of the neutral element C(I, I ) are called the scalars. Lemma 3.2.15. The scalars form a commutative monoid with respect to composition. Proof. Let s, t ∈ C(I, I ); then
1 1 -
ρ −1
I⊗I
s -
s ⊗t
t⊗
t ? I
I⊗I
- I⊗I
1⊗
ρ −1-
t -
s I
ρ
- I⊗I
- I
-
ρ −1
1⊗
I 6
s⊗
CUUS834-03
ρ
t ρ
? - I 6 s - I.
Corollary 3.2.16. For scalars s, t the composite I ∼ =I⊗I
- I⊗I ∼ =I
s⊗t
is equal to s ◦ t = t ◦ s. Definition 3.2.17. Let C be a monoidal category. Given a scalar s and some arrow f : A → B define a scalar multiplication s • f by the composition: A
ρ −1-
A⊗I
f ⊗s B⊗I
ρ B.
We could have defined s • f equivalently by multiplication on the left rather than on the right as previously done. Note that u := λ−1 ◦ ρ is a natural isomorphism
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
89
(− ⊗ I ) ⇒ (I ⊗ −), so the following diagram commutes: −1
ρ
A⊗I -
A
f ⊗s B⊗I
u
λ −1 -
? I⊗A
ρ
u
-
? - I⊗B s⊗ f
B
λ
Hence the two definitions coincide. Lemma 3.2.18. Each scalar s determines a natural transformation Id ⇒ Id such that s • f = f ◦ s A = s B ◦ f . Proof. The top and bottom edges define s A and s B respectively: A
ρ −1-
A⊗I
f ⊗ 1I
f ? B
ρ
? - B⊗I
−1
1A ⊗ s
f⊗
A⊗I
ρ A
f ⊗ 1I
s -
? - B⊗I 1B ⊗ s
ρ
f ? - B.
The outer squares commute due to naturality of ρ, and the middle due to the functoriality of the tensor. Hence s defines a natural transformation. Note that the middle path from A to B is the definition of s • f . Corollary 3.2.19. The following are immediate. (i) s • (t • f ) = (s ◦ t) • f (ii) (s • f ) ◦ (t • g) = (s ◦ t) • ( f ◦ g) (iii) (s • f ) ⊗ (t • g) = (s ◦ t) • ( f ⊗ g) Definition 3.2.20. In a compact closed category C define the dimension of an object A, to be the following composite: dim A = I
ηA
- A∗ ⊗ A
σ
- A ⊗ A∗
A
- I.
Of course, this is nothing more than the trace of 1 A . The presence of these nontrivial scalars gives a qualitative aspect even to freely constructed compact closed categories.
3.2.4 Freely Constructed Compact Closed Categories Define the set of endomorphisms E(A) by the disjoint union A( A, A) E(A) = A∈|A|
P1: SBT cuus834-gay
978 0 521 51374 6
90
October 30, 2009
19:29
Ross Duncan
and let the set of loops [A] be the quotient of E(A) generated by the relation f g f ◦ g ∼ g ◦ f whenever A - B - A. Let τ : E(A) → [A] be the canonical map onto the loops, and for each endomorphism f write [ f ] for its image under τ . The key theorem is the following of Kelly and Laplaza (1980). Theorem 3.2.21. Let T : Aop × A × Aop × A × · · · × Aop × A
- B
be a functor of 2n variables, let K and L be objects of B and let α : K ⇒ T and β : T ⇒ L be natural transformations with typical components - T ( A1 , A1 , A2 , A2 , A3 , . . . , An−1 , An , An ) , β : T (B1 , B2 , B2 , B3 , . . . , Bn−1 , Bn , Bn , B1 ) - L ;
α:K
(3.3) (3.4)
given maps Bn
B1
···
-
1
-
-
A2
f2n
f4
···
f 2n−
f3
f1 A1
···
-
-
B3
-
B2
B1
f2
CUUS834-03
An
the composite of (3.3), T ( f 1 , f 2 , f 3 , . . . , f 2n−1 , f n ) and (3.4), depends only on [ f 2n f 2n−1 · · · f 2 f 1 ] so that α and β give rise to a function [A] → B(K , L). Taking A = B, K = L = I , α = η and β = gives a ready source of scalars in any compact closed category A; indeed this is the dimension map given in Definition 3.2.20. If the category is freely constructed these are the only nontrivial scalars. This is a consequence of the more general coherence theorem of Kelly and Laplaza. Before stating the theorem we must introduce some additional terminology, which is also required later in this section. Definition 3.2.22. A signed set S is a function from a carrier set |S| to the set {+, −}. Given signed sets R and S, let R ∗ denote the signed set with the opposite signing to R; let R ⊗ S be the disjoint union of R and S, such that |R ⊗ S| = |R| + |S|. Definition 3.2.23. An involution is a category that is a coproduct of copies of the category 2. Given an involution σ , its object set |σ | can form a signed set by assigning − to the source and + to the target of each arrow of 2. Call σ an involution on the signed set S when this signing agrees with that of S. Given some category A, we can construct the free compact closed category generated by A, which we call FA. The objects of the FA are constructed from those of A by repeated application of the functors − ⊗ −, (−)∗ and the constant I . This characterization may be used to inductively construct a signed set S(X )
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
91
corresponding to each object X of FA. Let S(I ) = ∅ , S(X ⊗ Y ) = S(X ) ⊗ S(Y ) , S(X ∗ ) = S(X )∗ , S( A) = { A → +}
if A is an object of A .
The basic structure of arrows in FA depends upon involutions on the signed sets generated by its objects. Theorem 3.2.24 (Kelly-Laplaza). Let A be a category; each arrow f : A → B of the free compact closed category generated by A is completely described by the following data: (i) An involution σ on S( A∗ ⊗ B); (ii) A functor θ : σ → A agreeing with σ on objects (i.e., a labeling of σ with arrows of A); (iii) A multiset L of loops from A. The baroque statement of this theorem conceals its graphical content. One can view the objects of FA as lists of positively and negatively occurring objects of A, and an arrow between two such lists is simply a collection of arcs, each connecting a negative occurrence to a positive one and labeled by an arrow of A. To compose arrows in FA we simply connect up the arcs, using the underlying composition in A. From this point of view we can see an immediate limitation in the use of such freely generated compact closed categories to model quantum states. Recall that when we interpret processes in categorical terms, we view the objects as state spaces; hence the objects of the generating category A are the state spaces of the elementary subsystems from which our composite systems will be built. A state of a compound system, that is, an arrow ψ : I → X in FA, is thus composed of pairs of elementary systems related by some arrow from A, and each pair is unconnected to the others. Quantum informatics attaches great importance to entangled states, that is, states that cannot be broken down into their constituent parts. However, the preceding result states that free compact closed categories can only result in bipartite entanglement, which does not suffice to describe all entangled states. To extend our reach we now introduce polycategories.
3.2.5 Compact Symmetric Polycategories The reason that the free construction previously described yields only bipartite states is simple. The states are based on the arrows of the underlying category A, and an arrow has exactly two ends. In order to represent multipartite states we need generators with more than one and input and output, suggesting the need to construct the compact closed category from a category that already has a
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
92
October 30, 2009
19:29
Ross Duncan
monoidal structure. However the direct route leaves open the problem of ensuring that the downstairs tensor (from the monoidal category A) and the upstairs tensors (freely generated in FA) cohere correctly. Worse, there is no reason to believe that an arrow in a monoidal category is in any sense indecomposable among its subsystems. Fortunately there is a natural generalization of category, a polycategory, whose arrows may have more than one object in their domain and codomain. The original notion of polycategory (Lambek 1968; Szabo 1975) was introduced to study classical logic, where a sequent may have multiple premises and conclusions; composition is defined by the cut rule, so one output is connected to one input. Here we consider compact symmetric polycategories (Duncan 2006), where composition is defined by the multi-cut rule, allowing arbitrary vectors of inputs and outputs to be composed. Definition 3.2.25. A compact symmetric polycategory, P, consists of a class of objects ObjP and, to each pair (, ) of finite sequences over ObjP , a set of polyarrows P(, ). Given a nonempty sequence of objects and polyarrows
- 1 , , 2
f
and
1 , , 2
-
g
we may form the composition k
1 , , 2
g i◦j f
- 1 , , 2
where |1 | = i, |1 | = j and || = k > 0. For each object A there is an identity arrow 1 A : A → A for the singleton sequence A. In general there are many ways to compose the polyarrows, and many equations that must be satisfied. We spare the reader the full definition,5 and instead we offer a theorem in the spirit of the Kelly-Laplaza result cited earlier, characterizing the free compact closed category generated by such a polycategory. Before proceeding we note the most important point about these polycategories: there is no nullary composition and no tensor product. Each input of a polyarrow has a path (not necessarily directed) to each output, and hence despite having many inputs and outputs, polyarrows cannot be decomposed into noninteracting parts. Before we can state the representation theorem we must make some definitions. Definition 3.2.26. A graph consists of a 5-tuple (V, E, C, s, t) where V ,E, and C are sets, respectively of vertices, edges, and circles, and s and t are maps s E t 5
- V
For the full glory of its coherence equations, and also the proof of the theorem cited, see Duncan (2006).
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
dom Γ
◦
◦ ◦ ◦ ◦
◦
cod Γ
• •
• •
93
◦ ◦ ◦
• IΓ ∂Γ
◦
◦
Figure 3.1. Anatomy of a circuit
which we call source and target. Let in(v) and out(v) be V -indexed subsets of E defined by in(v) = t −1 (v) out(v) = s −1 (v). The in-degree of a vertex v is the cardinality of in(v) and the out-degree is the cardinality of out(v). The degree of a vertex is the sum of its in- and out-degrees. Definition 3.2.27. A open graph is a pair (G, ∂G) of an underlying graph G = (V, E, C, s, t) and a distinguished subset of the degree one vertices ∂G called the boundary of G; V − ∂G is called the interior of G, written IG . If a vertex x ∈ ∂G it is an outer or boundary node; otherwise it is an inner or interior node. Definition 3.2.28. A circuit = (G, dom , cod ,
∼ = -
Nk
where k = |in(v)|. •
∼ = -
Nk
where k = |out(v)|. Figure 3.1 illustrates Definition 3.2.28. As suggested by their name, the purpose of the two maps
P1: SBT CUUS834-03
cuus834-gay
94
978 0 521 51374 6
October 30, 2009
19:29
Ross Duncan
order in N lifts, and hence we often simply treat these sets as ordered and write < for this ordering whenever it is unambiguous to do so. For simplicity, in the following we consider a polycategory P that is freely generated from some set of basic arrows6 called ArrP . Definition 3.2.29. Given a polycategory P, a P-labeling for a circuit is a pair of maps θ = (θ O , θ A ) where θ O : E +C θA : V
- Obj P - ArrP
such that for each node f , in( f ) = a1 , . . . , an and out( f ) = b1 , . . . , bm imply dom(θ f ) = θa1 , . . . , θan cod(θ f ) = θ b1 , . . . , θ bm , and subject to the further restriction that θ A (v) = 1 A if and only if v ∈ ∂. Call a circuit P-labelable if there exists a P-labeling for it; if θ is a labeling for , then the pair (, θ ) is a P-labeled circuit. The boundary nodes perform a different role than do the interior nodes. The incidence of the unique edge at a boundary vertex b defines a signing on the boundary: we say that b is positive if it has in-degree 1; and negative if its outdegree is 1. We take the boundary vertices as labeled by objects of P rather than the corresponding identity maps and treat the boundary as an Obj P -labeled signed set. We denote the class of P-labeled circuits Circ(P); it forms a monoidal category in a rather natural way. The objects of Circ(P) are signed sequences of objects from Obj P . An arrow from f : A → B is defined by a P-labeled circuit whose codomain is B and whose domain is A∗ (i.e., A with the opposite signing). Composition is defined by joining two circuits at their respective domain and codomain vertices and erasing the vertices. The tensor product can be defined by taking the disjoint union of the circuits and concatenating the domain and codomains. We leave the reader to fill in the details. We can now state the promised representation theorem: Theorem 3.2.30. Circ(P) is the free compact closed category generated by the compact symmetric polycategory P. Since categories are a special case of polycategory (where all the arrows are between singleton sequences) we can ask: what is Circ(P) when P is just a normal category? In this case, Circ(P) is exactly the same as FP as per Kelly-Laplaza. One way to understand the generalization in going from a category of generators to a polycategory of generators is by considering the case with only one ground type. If we have a category with just one object, we can view its arrows as 6
This is not essential, but will greatly simplify the subsequent discussion of generalised proof-nets; see the discussion of homotopy in Duncan (2006) for the details.
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
95
evolutions of this state space. On the other hand, if we have a polycategory with a single object, the arrows are in some sense interactions between systems of that type, possibly fusing or splitting, producing a different number of systems than began the interaction. By moving to the compact closed category generated by a polycategory of interactions we avoid the restriction to bipartite states mentioned earlier. This concludes the multiplicative structures; now we move onto the additives.
3.2.6 Zero Objects Definition 3.2.31. In any category C a zero object is an object, denoted 0, that is both initial and terminal. By its initiality, there is a unique map from 0 to every object, and dually there is a unique map from each object to 0. Hence there is unique map between every pair - 0
A
- B
of objects A and B. This map is called the zero map and denoted 0 A,B . Since 0 is initial and terminal, any map composed with a zero map is again a zero map; the zeros form a two-sided ideal with respect to composition among the arrows C. Hence the following diagram commutes: - 0
A f ? C
- B 10
g
? - 0
? - D,
which makes the family 0 A,B natural in both A and B. A useful family of arrows in a category with 0 is the Kronecker delta δi j : - A j , defined for all pairs of objects Ai , A j as Ai δii = 1 Ai
δi j = 0 Ai ,A j .
Lemma 3.2.32. If 1 A = 0 A,A then A ∼ = 0. Proof. Note that the composite 0
!A A
!A 0
is equal to 00,0 , which by uniqueness is equal to 10 . Thus ! A ◦ ! A = 1 A and ! A ◦ ! A = 10 , which gives the isomorphism. Proposition 3.2.33. Let C be a monoidal closed category with a zero object. Then A⊗0∼ = 0.
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
96
October 30, 2009
19:29
Ross Duncan
Proof. Since C is closed, C(A ⊗ 0, B) ∼ = C(0, A −◦ B) ∼ = {∗}. Taking B = A ⊗ 0 implies 1 A⊗0 = 0, and hence the result follows.
Monoidal closure is required; if we take the tensor to be a coproduct, e.g., the direct sum of vector spaces, it is clear that the isomorphism does not hold. Corollary 3.2.34. Given f : A → B an arrow of C, f ⊗ 0C,D = 0 A⊗C,B⊗D . If the zero object is also the neutral object for the tensor, then the entire category collapses to a single object via A ∼ = A⊗0∼ = 0. So any cartesian closed category with zero is trivial. Note that in a compact closed category C with a terminal object 1, by duality 1∗ is initial. If the terminal object is the monoidal unit, then the isomorphism I ∼ = I ∗ makes I the zero object, and hence the category collapses. Proposition 3.2.35. If C is compact closed with respect to a product then it is trivial.
3.2.7 Biproducts In any category C with finite products and coproducts every map f Aj Ai has a “matrix” representation ( f i j ) where each f i j is given by the composite πj ini- f- - Aj Aj Ai Ai with ini and π j the appropriate injections and projections. Supposing that C also - Ai whose matrix is has a zero object, there is a canonical map 1 : Ai the identity 1 = (δi j ). Definition 3.2.36. A category C has finite biproducts if it has finite products and coproducts, such that • The unique map 0 - 1 is invertible; and • The canonical map 1 : A B - A B is an isomorphism for all objects A, B. If C has biproducts, for all objects A and B, there is a unique (upto isomorphism) object A ⊕ B and maps A
in1π1
in2 A⊕B - B π2
(3.5)
such that (A ⊕ B, π1 , π2 ) is a product and ( A ⊕ B, in1 , in2 ) is a coproduct. A choice of A ⊕ B for every pair of objects makes − ⊕ − into a functor C × C - C whose action on arrows f 1 ⊕ f 2 is given by πi ◦ ( f 1 ⊕ f 2 ) = f i ◦ πi
for i = 1, 2
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
97
or alternatively ( f 1 ⊕ f 2 ) ◦ ini = ini ◦ f i
for i = 1, 2.
Lemma 3.2.37. In a category with biproducts we have the following natural isomorphisms: • ( A ⊕ B) ⊕ C ∼ = A ⊕ (B ⊕ C) ; • A⊕B ∼ = B⊕A; • A⊕0∼ =A∼ = 0 ⊕ A. Proof. All these isomorphisms hold for products (and also coproducts); hence they hold for the biproduct. We have natural diagonal and codiagonal maps, - A⊕ A ∇A : A ⊕ A - A
A : A
defined as A = 1 A , 1 A
∇ A = [1 A , 1 A ].
It is useful to note the equations ( f ⊕ g) ◦ A = f, g, ∇ A ◦ ( f ⊕ g) = [ f, g]. Definition 3.2.38. Let f, g : A A
A-
- B; then define f + g as the composite
A⊕ A
f ⊕g B⊕B
∇B B.
Proposition 3.2.39. In a category with biproducts C, the addition of Definition 3.2.38: • Makes each hom-set C( A, B) is a commutative monoid; and • Distributes over composition. Proof. The addition is associative due to the following diagram:
A
A⊕ A -
A ⊕ 1A
( A ⊕ A) ⊕ A ∼ =
A
A
A⊕ A
( f ⊕ g) ⊕h
(B ⊕ B) ⊕ B
∇ B ⊕ 1B B⊕B
∇B
∼ =
? ? - B ⊕ (B ⊕ B) - A ⊕ (A ⊕ A) - B⊕B 1A ⊕ A f ⊕ (g ⊕ h) 1B ⊕ ∇B
-
∇B
B
P1: SBT cuus834-gay
978 0 521 51374 6
98
October 30, 2009
19:29
Ross Duncan
and commutative since
A
A⊕ A σ
A
A
- ? A⊕ A
f ⊕g B⊕B
∇B
σ
-
? - B⊕B g⊕ f
B
∇B
∼ =
A
∇B
∼ = -
A⊕ A
-
commutes. The neutral element of C(A, B) is 0 A,B since the following commutes: f - B A
CUUS834-03
- A⊕0 - B⊕0 - B⊕B 1A ⊕ 0 f ⊕0 1B ⊕ 0
Hence C is enriched over commutative monoids. To see that the addition distributes over composition recall the identities f, g ◦ h = f ◦ h, g ◦ h h ◦ [ f, g] = [h ◦ f, h ◦ g]. Hence g ◦ ( f + f ) ◦ h = g ◦ ∇ ◦ ( f ⊕ f ) ◦ h = [g, g] ◦ ( f ⊕ f ) ◦ h, h = ∇ ◦ ((g ◦ f ◦ h) ⊕ (g ◦ f ◦ h)) ◦ = (g ◦ f ◦ h) + (g ◦ f ◦ h). Proposition 3.2.40. In a category with biproducts the injections and projections shown in Eq. (3.5) satisfy πi ◦ in j = δi j
for i, j = 1, 2
in1 ◦ π1 + in2 ◦ π2 = 1 A1 ⊕A2 . Proof. For any product A × B we have π1 × π2 ◦ = π1 , π2 = 1 A×B and dually for any coproduct ∇ ◦ in1 + in2 = 1 A+B . Hence in1 ◦ π1 + in2 ◦ π2 = ∇ ◦ (in1 ⊕ in2 ) ◦ (π1 ⊕ π2 ) ◦ = 1 A⊕B . Due to the universal property of the biproduct, the canonical map from A ⊕ B to itself is equal to 1 A⊕B . Therefore πi ◦ in j = πi ◦ 1 ◦ in j = δi j .
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
99
The binary biproduct may be generalized to arbitrary finite families of objects A1 , . . . , An by iteration. Up to an associativity isomorphism, the n-fold biproduct is characterized by the diagram πj ini - Aj Ai Ak k
subject to the equations πi ◦ in j = δi j , πk ◦ ink = 1⊕k Ak . k
Arrows between biproducts have matrix representations as described at the start of this section, and composition of of arrows gives the usual matrix multiplication. Proposition 3.2.41. Suppose we have arrows
Then (g ◦ f )ik =
i j (g jk
g- Ck .
f- Bj f j
Ai
k
◦ f i j ) and ( f + f )i j = f i j + f ij .
Proof. Let h = g ◦ f ; then h ik = πk ◦ g ◦ f ◦ ini = πk ◦ g ◦ 1⊕B j ◦ f ◦ ini = πk ◦ g ◦ ( π j ◦ in j ) ◦ f ◦ ini =
j
πk ◦ g ◦ in j ◦ π j ◦ f ◦ ini
j
=
g jk ◦ f i j .
j
The second equation follows directly from the naturality of the diagonal and codiagonal maps. Proposition 3.2.39 implies that any category with biproducts is enriched over CMon, the category of commutative monoids; conversely, we have the following. Proposition 3.2.42. Let C be a CMon-category with a 0 object and, for every pair of objects A and B, a diagram (3.5) such that Proposition 3.2.40 holds; then C has biproducts. Theorem 3.2.43. A CMon-category has products (or coproducts) if and only if it has biproducts. Proof. This is a fairly trivial modification of Mac Lane (1997) VIII.2, Theorem 2.
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
100
October 30, 2009
19:29
Ross Duncan
Definition 3.2.44. Call a CMon-category semiadditive if it has 0 and a biproduct for each pair of its objects. Let A and B be CMon-categories with zero objects; a - B is semiadditive if F0 = 0 and F f + Fg = F( f + g) for functor F : A all parallel arrows f, g in A. Proposition 3.2.45. Let A have biproducts and let B be CMon-enriched with 0; then a functor FA → B is semiadditive if and only if it carries every biproduct diagram in A to a biproduct diagram in B.
Proof. See Mac Lane (1997), VIII.2, Proposition 4.
Given a category C we can construct the free biproduct structure on C, first by freely enriching C over CMon and then taking matrices over the resulting category. Proposition 3.2.46. Let CN be the category whose objects are those of C and where CN ( A, B) = N(C( A, B)), the free commutative monoid on C( A, B). Then CN is CMon enriched and the inclusion of C into CN is a universal arrow from C to a CMon-category. Proposition 3.2.47. Let C be a CMon-category and let Matr(C) be the category whose objects are n-tuples of objects of C, for n ≥ 1, and whose arrows are matrices of arrows C. Then Matr(C) is semiadditive, and the evident semiadditive embedding of C into Matr(C) is universal among semiadditive functors from C to semiadditive categories.
3.2.8 Compact Closed Categories with Biproducts Proposition 3.2.48. Let C be a monoidal closed category with biproducts; then there are natural distribution isomorphisms A ⊗ (B ⊕ C) ∼ = (A ⊗ B) ⊕ (A ⊗ C) (A ⊕ B) ⊗ C ∼ = ( A ⊗ C) ⊕ (B ⊗ C). Proof. Since A ⊗ − is a left adjoint it preserves colimits, and hence the diagram A⊗B
1 A ⊗ in1 -
1 A ⊗ in2 A ⊗ (B ⊕ C)
A⊗C
is a coproduct and hence A ⊗ (B ⊕ C) ∼ = ( A ⊗ B) ⊕ ( A ⊗ C). The right-hand distribution is similar. Corollary 3.2.49. In a monoidal closed category C with biproducts, the functor A ⊗ − : C → C is additive. In fact we can easily construct the distribution isomorphisms explicitly. Let d A,B,C = 1 A ⊗ π1 , 1 A ⊗ π2 and −1 = [1 A ⊗ in1 , 1 A ⊗ in2 ]. d A,B,C
P1: SBT cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
101
Then [1 A ⊗ in1 , 1 A ⊗ in2 ] ◦ 1 A ⊗ π1 , 1 A ⊗ π2 = ∇ ◦ ((1 A ⊗ in1 ) ⊕ (1 A ⊗ in2 )) ◦ ((1 A ⊗ π1 ) ⊕ (1 A ⊗ πC )) ◦ = ∇ ◦ (1 A ⊗ (in1 ◦ π1 )) ⊕ (1 A ⊗ (in2 ◦ π2 )) ◦ = (1 A ⊗ (in1 ◦ π1 )) + (1 A ⊗ (in2 ◦ π2 )) = 1 A ⊗ (in1 ◦ π1 + in2 ◦ π2 ) = 1 A ⊗ 1 B⊕C = 1 A⊗(B⊕C) . If a compact closed category C has a binary product − × − then the duality (·)∗ sends every product diagram
f
f, g
πB -
B
-
A×B 6
g
πA A
C to a coproduct diagram ∗ ππ∗ A ( A × B)∗ B
B∗
f, g∗
f∗
g∗
A∗
-
? C . As mentioned earlier, if C has a terminal object 1 then 1∗ is initial. Hence the question of whether or not C has biproducts boils down to whether the canonical maps 0 (A × B)
∗
CUUS834-03
- 1 - A∗ × B ∗
are isomorphisms. It turns out that this is always the case. Proposition 3.2.50 (Houston). If a compact closed category C has all finite products (or coproducts) it has all finite biproducts.
Proof. See Houston (2008). Corollary 3.2.51. In any compact closed category with biproducts: • We have natural isomorphisms 0∼ = 0∗
( A ⊕ B)∗ ∼ = A∗ ⊕ B ∗ ;
• The duality (·)∗ is an additive functor.
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
102
October 30, 2009
19:29
Ross Duncan
It then follows that we may choose the biproduct in any compact closed category so that the equation inA ∗ = π A∗ holds for all objects A. We now turn our attention to the construction of the free compact closed category with biproducts upon some polycategory P. The earlier results of Propositions 3.2.46 and 3.2.47 described how to freely construct the biproduct as matrices whose elements are drawn from some category C, and this provides the core of our proof. Write C BP to denote the free compact closed category with biproducts generated by a compact polycategory P. We refer to the objects of P, their images under (·)∗ , and the constants 0 and I as the literals of C BP. According to Corollary 3.2.51, in any compact closed category with biproducts, (·)∗ commutes with ⊕, and since both the biproduct and tensor structures are freely generated, the objects of C BP are formed from the literals by repeated application of the functors (− ⊗ −) and (− ⊕ −).7 Any object may therefore be described by such a functor and a vector of literals. Let ⊗n : C BP × · · · × C BP → C BP be the n-fold tensor; similarly let ⊕n be the n-fold biproduct. Call N a normal functor if it is has the form N = ⊕n (⊗m 1 (−), . . . , ⊗m n (−)). Lemma 3.2.52. Let G be a functor constructed from (− ⊗ −) and (− ⊕ −); then G is naturally isomorphic to a normal functor N G . Proof. The required isomorphism is constructed from the distributivity isomorphisms. Hence we have that all arrows in C BP have the form FA
f GB
∼ = ? NF A
∼ =
f
? - NG B
and since f is an arrow between normal functors, it has matrix elements f i j : ⊗m i Ai → ⊗n j B j , each of which is a (possibly empty) sum of arrows from the freely constructed compact structure, Circ(P). 7
See Soloviev (1987) for a more general treatment of this.
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
103
Hence the free compact closed category with biproducts is produced by forming Matr(Circ(P)N ) – that is, the free biproduct category on top of the free compact closed category – and simply adjoining the distributivity isomorphisms. This free construction is the final piece of category theory needed in this article. In Section 3.4 we introduce a system of proof-nets that represent this category.
3.3 Tensor-Sum Logic In this section we introduce the syntax of tensor-sum logic in a sequent calculus LTS and give it a semantics over a suitable category. Let A be a category and denote by FA the free compact closed category with biproducts generated by A. The atomic formulae of LTS will be the objects of A, and the arrows of A will give its nonlogical axioms. In the next section we generalize to the situation where the generators are a polycategory, but that requires a proof-net presentation. For now we stick to this simpler case, since the essence of the connectives can be seen equally well via a sequent presentation. Definition 3.3.1. The formulae of LTS are given by the following grammar: F ::= 0 | I | A | A∗ | F ⊗ F | F ⊕ F where A ∈ ObjA are called atoms. Given a formula F we define its de Morgan dual F ∗ by: 0∗ := 0 I ∗ := I A∗∗ := A (F1 ⊗ F2 )∗ := F2∗ ⊗ F1∗ (F1 ⊕ F2 )∗ := F1∗ ⊕ F2∗ . An LTS formula is called multiplicative if neither 0 nor ⊕ occurs in it. We use the convention that letters A,B,C, etc., range over the atoms, while X ,Y ,Z , etc., range over arbitrary formulae. We take for granted that all formulae are in de Morgan normal form – that is, with the negation symbol (·)∗ occurring only on atoms. Definition 3.3.2. A sequent of LTS has the form ; L where and are lists of formulae, respectively called the antecedent and succedent of the sequent, and L is a tree whose leaves are labeled by loops from A. Given two such trees L 1 , L 2 , we write L 1 · L 2 for the tree formed by fusing their roots; we write L 1 + L 2 for the tree whose root has L 1 and L 2 as its only subtrees. We do not distinguish between a loop l in A and the tree whose only leaf node is l.
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
104
October 30, 2009
19:29
Ross Duncan
Axiom Group: where f : A → B and h : A → A are arrows of A. f ( f -axiom) A B ;∅
; [h]
(h-unit)
The Cut: , X , X ; L (cut) ;L Multiplicative Group: σ, τ permutations. ;L ; L (mix) , , ; L · L
;L (exchange) τ () σ () ; L
, X, Y ; L , X ⊗ Y ; L (⊗-L)
X, Y, ; L X ⊗ Y, ; L (⊗-R)
;L , I ; L (I -L)
;L , I ; L (I -R)
, X ; L (*-L) , X ∗ ; L
, X ; L (*-R) , X ∗ ; L
Additive Group: where i = 1 or 2. , X i ; L , X 1 ⊕ X 2 ; L (⊕i -L)
, X i ; L , X 1 ⊕ X 2 ; L (⊕i -R)
0YX (zero) X Y ;∅
;L ; L (sum) ; L + L
Figure 3.2. Inference rules for LTS
Definition 3.3.3. An LTS proof is a tree of inferences drawn from the rules shown in Figure 3.2; the leaves of the tree must be drawn from the axiom group. A proof is called multiplicative if (1) only multiplicative formulae occur in it and (2) no rule from the additive group occurs. The reduced sequent calculus consisting only of multiplicative proofs we call LT.
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
105
One could summarize the rules of LTS as “multiplicative-additive linear logic with self-dual connectives.” Certainly one can embed MALL into LTS by translating both multiplicative connectives as ⊗ and both additives as ⊕ and nothing will go terribly wrong. However, since both connectives of LTS are self-dual, many cuts that would be forbidden in MALL are allowed in LTS, and we must introduce some novel rules to deal with this. It is worthwhile to point out some of the more idiosyncratic rules. Axiom rule. In the case that A is a discrete category then the only arrows are identities, so we regain the usual A A axioms. The restriction of axioms to ground types is for technical convenience; identity axioms for every type are constructable and indeed admissible. Unit rule. A distinctive feature of compact closed categories is the presence of loops, so incorporating this rule allows an exact connection between the syntax and the semantics to be established. Perhaps more importantly, the unit rule allows “circular” cuts to be eliminated. Cut rule. The cut rule, as shown here, might be better described as a trace rule. The more traditional cut rule, , A A, (cut) , , can be defined in LTS using the mix and exchange rules, viz.: , A , A (mix) , , A , A, (exchange) , , A , , A (cut) , , Mix rule. The mix rule (combined with the two rules for tensor) asserts that the comma is the same on both sides of the sequent, unlike most logics. It allows usual two-premise cut and tensor rules to be constructed. Zero rule. Without the zero rule certain cuts are impossible to remove. It has been noted that the logic of biproducts is inconsistent: every sequent is provable. By including the zero axiom we embrace this inconsistency. A more computational point of view is that every type is inhabited, at least by the divergent program, or in the quantum setting, the evolution with zero probability. Sum rule. This rule asserts that each LTS proof is a (finite) formal weighted sum of LTS proofs, with the weights given by the pair L and L . Otherwise this rule performs a similar role to the mix, allowing the usual binary rules for additives to be constructed. The formulae of LTS are just the objects of A; hence we do not even bother to distinguish them notationally. To give semantics for LTS it remains to translate proofs into arrows of FA.
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
106
October 30, 2009
19:29
Ross Duncan
Definition 3.3.4. Let π be an LTS proof of the sequent X 1 , . . . , X n Y1 , . . . Ym ; L . We define its denotation, an arrow π : X 1 ⊗ · · · ⊗ X n → Y1 ⊗ · · · ⊗ Ym by recursion over the structure of π according to the rules shown in Figure 3.3. Theorem 3.3.5 (Cut Elimination). For every LTS proof π of the sequent ; L there exists a proof π of ; L which contains no occurrence of the cut rule, and such that π = π . The proof proceeds in the standard way so we omit it here. (The general strategy can be translated from the proof-net version presented later.) We remark that preserving the denotation is the nontrivial part; otherwise the zero rule can be used to give a cut-free proof immediately. We would like the formulae of LTS to be in exact correspondence with the objects of the free category FA. Unfortunately we have several equations between syntactically distinct formulae. To work around this blemish we introduce a special class of formulae. Definition 3.3.6 A formula is called multiplicatively reduced if it is different from I and contains neither X ⊗ I nor I ⊗ X as a subformula, for any formula X . A sequent is monoidally reduced if all its formulae are monoidally reduced. A formula is called additively reduced if it has no subformula of the forms 0 ⊕ X , X ⊕ 0, 0 ⊗ X or X ⊗ 0. A sequent is additively reduced if all its formulae are. A formula or sequent that is both multiplicatively and additively reduced is simply called reduced. The content of this definition is that the only place that I may occur in a reduced formula is under the ⊕ connective; the only reduced formula containing 0 is 0 itself. Proposition 3.3.7 Every sequent is provably equivalent to a reduced one. Proof. We have the following provable equivalences: X⊗I ≡X I⊗X≡X X ⊗0≡0 0⊗ X ≡0 X ⊕0≡ X 0⊕ X ≡ X
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
Axiom Group: where f : A → B and h : A → A are arrows of A. f : A → B ( f -axiom)
A Tr I,I (h) : I → I
(h-unit)
The Cut: π :⊗ X →⊗ X (cut) X Tr, (π ) : → Multiplicative Group: σ, τ permutations. π :→ (exchange) σ ◦ π ◦ τ −1 : τ () → σ () π :→ π : → (mix) (π ⊗ π ) : ⊗ → ⊗ (No interpretation for tensor or I rules) π : →⊗ X (*-L) (1 ⊗ X ) ◦ (π ⊗ 1 X ∗ ) : ⊗ X ∗ → π : X ⊗ → (*-R) (1 X ∗ ⊗ π ) ◦ (η X ⊗ 1 ) : → X ∗ ⊗ Additive Group: where i = 1 or 2. π : ⊗ Xi → (⊕ -L) π ◦ (1 ⊗ pi ) : ⊗ (X 1 ⊕ X 2 ) → i π : → ⊗ Xi (⊕ -R) (1 ⊗ qi ) ◦ π : → ⊗ (X 1 ⊕ X 2 ) i π :→ π : → (sum) π +π : →
0YX : X → Y
(zero)
Figure 3.3. Semantics for rules of LTS
107
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
108
October 30, 2009
19:29
Ross Duncan
and the denotation of each proof is an isomorphism in FA. The only remaining case is that of a sequent containing the formula I ; in this case it can be removed by means of a cut, possibly after adjoining a new I on the left or right as needed. This result means that the reduced formulae of LTS are in 1-1 correspondence with the objects of FA. We call a proof reduced if its conclusion is reduced. Note that we cannot restrict to reduced formulae throughout, since they must be introduced to construct certain formulae, for example I ⊕ I . Having dealt with the objects of FA, we turn our attention to the arrows. Theorem 3.3.8 (Completeness). Let f be an arrow in FA; there exists a cut-free LTS proof π such that f = π . We again omit the proof since it follows from a more general result proved later. However, this theorem marks the end of the line as far as the sequent system is concerned. Our attempt to find a proof-theoretic characterization of FA founders on the usual curse of sequent calculi: the existence of distinct cut-free forms for the same proof. LTS is especially bad in this respect since it enjoys a great many sound commuting conversions.
3.4 Generalized Proof-Nets In this section we define a system of two-sided proof-nets constructed over the generators of a compact symmetric polycategory P. The resulting system of proofnets will be denoted PN(P). Using these proof-nets we obtain a logical system closer in behaviour to a term system: every proof-net has a unique normal form. The availability of such normal forms allows us to make an exact correspondence between the PN(P) and the free compact closed category with biproducts.
3.4.1 Tensor-Sum Proof-Nets Graphical notations for monoidal categories have been studied as far back as the early seventies (Kelly 1972; Penrose 1971; Joyal and Street 1991) and such two-dimensional representations provide for beautifully simple reasoning in a setting normally awash with coherence equations. When proofs are represented graphically, as in proof-nets for multiplicative linear logic, a further advantage is gained: by relaxing the allowed shapes of proofs, from trees to graphs, the artificial sequentiality imposed by the use of sequent proofs is removed. Work on MLL (Girard 1987b; Danos and Regnier 1989; Blute et al. 1996) extended the graphical tensor notation to the case of two tensors which enjoy a “weak” distribution law8 (Cockett and Seely 1997). In these settings the two tensors are essentially similar, and indeed can be made formally dual. In the following we study the case of a single self-dual tensor, so while much of the work of Blute et al. (1996) applies, we 8
Also called linear distribution.
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
109
can make some significant simplifications. We are forced into some complications too, but the we retain a purely graphical language for the multiplicative fragment of LTS, closely related to the diagrams of Coecke (2005b). We note that because LTS is so permissive, no correctness criterion, a` la Danos and Regnier (1989), is needed here. However, into our multiplicative paradise we must admit the additive connectives, and this complicates matters. We handle the additive structure using a system of slices and boxes. The notion of slices in linear proof-nets first appeared in the original Girard (1987a) paper but was not entirely satisfactory for the unrestricted multiplicative-additive fragment of linear logic; the correctness of the proof-structure as a whole could not be derived from the correctness of its slices (Girard 1996). A similar notion was later employed by Hughes and van Glabbeek (2003) to give a satisfactory notion of MALL proof-net. In the more restricted setting of polarized linear logic, the naive use of slices works very well since the additional constraint of polarity forces the additive connectives to cohere nicely (Laurent and Tortora de Falco 2004). Just as compact closed categories are degenerate models of the multiplicative part of linear logic, the biproduct is a degenerate version of the linear logic’s additive connectives. Happily, this degeneracy means that slicing will give good results, for essentially the opposite reasons to the polarized case: we have so many equations that the question of correctness becomes trivial. Slices and boxes are defined by mutual recursion. Definition 3.4.1. A PN(P) proof-slice is a finite directed graph with edges labeled by LTS formulae. The graph is constructed by composing the following links, while respecting the labeling on the incoming and outgoing edges. The links are illustrated in Figure 3.4. Premise: No incoming edges; one outgoing edge. The edge is labeled with an arbitrary formula and the link is unlabeled. Conclusion: One incoming edge; no outgoing edges. The edge is labeled with an arbitrary formula and the link is unlabeled. Unit: No incoming edges; two outgoing edges. The first outgoing edge is labeled X ∗ , the other, X , for some formula X . The link itself is labeled by η. Counit: Two incoming edges; no outgoing edges. Each counit is labeled by and its incoming edges are labeled by X and X ∗ for an arbitrary formula X . Tensor: Two incoming edges labeled X and Y ; one outgoing edge labeled X ⊗ Y . Cotensor: One incoming edge labeled X ⊗ Y ; two outgoing edges labeled X and Y . Circle: No incoming or outgoing edges; a circle is a closed loop labeled by a formula. Axiom: Each polyarrow f : Ai i → B j j in ArrP defines a link labeled by f . Its n incoming edges are labeled by A1 , . . . , An and its m outgoing edges are labeled by B1 , . . . , Bm .
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
110
October 30, 2009
19:29
Ross Duncan
η
X —
— X
Premise
X∗
Conclusion
Counit
X
Unit A1
X
⊗
X∗
X
X ⊗Y
Y
X ⊗Y
Tensor
X
Y
B1
Cotensor
X
Y
⊕1
⊕2
Circle X ⊕Y
X ⊕Y
X ⊕Y
Plus 1
Plus 2
An
f
⊗ X
···
X ⊕Y
⊕1
⊕2
X
Y
Coplus 1 X1
· · · Bm Axiom
···
Coplus 2
Xn
i
I
I
Star
Costar
Y1
··· Box
Ym
Figure 3.4. Links for PN(P) proof-nets
Plus 1: One incoming edge labeled X ; one outgoing edge labeled X ⊕ Y , for an arbitrary formula Y . Plus 2: One incoming edge labeled Y ; one outgoing edge labeled X ⊕ Y , for an arbitrary formula X . CoPlus 1: One incoming edge labeled X ⊕ Y ; one outgoing edge labeled X . CoPlus 2: One incoming edge labeled X ⊕ Y ; one outgoing edge labeled Y . Star: One outgoing edge labeled I ; no incoming edges. Costar: One incoming edge labeled I ; no outgoing edges. Box: Any numbers of incoming and outgoing formulae edge, labeled by arbitrary formulae – see Definition 3.4.2 subsequently. A proof-slice is oriented such that edges enter the node from the top, and exit from the bottom. This implies that any premise, star or unit link is above the links they are connected to and, conversely, any conclusion, costar, or counit links are below the links they are connected to. The order of premises and conclusions is significant, and the type of a proofslice is the pair (, ) of lists of formulae determined by the premises and
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
111
conclusions respectively. Usually this will be written as a sequent . The empty slice is valid slice, with type . A premise or conclusion link is called atomic if the formula labeling it is a literal; a proof-slice is called atomic if all its premises and conclusions are atomic. A slice is called flat if it contains no boxes. Proof-slices are permitted to be disconnected or cyclic, when considered as directed or undirected graphs. In particular, an edge may leave a link and return as an input to the same link, although the labeling on edges will prohibit this for all except axiom links. If a proof-slice is directed-acyclic then it is called process-like. Definition 3.4.2. A PN(P) box is a finite multiset of proof-slices, all of the same type; if its component slices are of type then the formula of are the inputs of the box, and those of are its outputs. A box may be empty, in which case it may have any inputs and outputs. Indeed, such an empty box is the only normal proof of the formula 0. Operationally a box may be viewed as local classical knowledge (or rather, nondeterminism) embedded in one part of the system – the distribution of addition over composition codes the transmission of this information. The details of this distribution, presumably mediated by some classical control structure, will not be investigated here, but it seems an interesting direction for further exploration. Definition 3.4.3. Let s be a proof-slice; define its depth d(s) as d(s) =
k
d(bi ) + k
i=1
where the bi range over the boxes occurring in s. Let b be a box containing slices {si }i ; then define its depth d(b) by d(b) = d(si ). i
Definition 3.4.4. A PN(P) proof-net is a PN(P) box of finite depth. According to Definition 3.4.4 every slice is contained in a box, which is called the ambient box for that slice. Also, if a slice s contains a box, the slices contained within that box are not considered part of s; that is, from the point of view of their containing slice, boxes are considered totally opaque. On the other hand, the phrase “a slice in proof-net π ” should be understood unrestrictedly as denoting a slice at any level of nesting with the proof-net structure. Since proof-nets have finite depth, any box occurring within a proof-net is itself a valid proof-net; hence there is no loss in generality by assuming that ambient box is always the top-level. Since PN(P) proof-nets are rather unwieldy objects, it is helpful to introduce a symbolic shorthand for working with them algebraically. Writing si for a sequence of slices, a box containing those slices is written as a summation, i si . The crucial ingredient is a “slice with a hole.” A hole can be thought of as a link with arbitrary
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
112
October 30, 2009
19:29
Ross Duncan
incoming and outgoing edges; we write s{ } to represent a slice with a hole. Such an object is not a valid part of our notation; we introduce it only in order to write such expressions as s{t}, where t is a proof-net fragment having the same incoming and outgoing edges as the hole in s such that the slice produced by replacing the hole in s with the fragment t is a valid slice. Simply writing the empty brackets { } denotes a slice that is all hole – it has no structure besides its type. We use letters π, π to denote proof-nets; π { } should be understood as a proof-net with a hole in one of its slices. When we write π { }{ } to denote a proof-net with two holes, it should always be understood that both holes are in the same slice. It will never be necessary to speak of holes in separate slices. Example 3.4.5. This two-sliced net encodes the distribution of ⊗ over ⊕. ηX
Y
ηY
∗
⊕1
X∗
⊗ —
ηX
Z∗ X
Y ∗ ⊕Z ∗
X ∗ ⊗(Y ∗ ⊕Z ∗ )
ηZ
⊗
Y
X ⊗Y
⊕1 —
(X ⊗Y )⊕(X ⊗Z )
⊕2
X∗
⊗ —
X
Y ∗ ⊕Z ∗
X ∗ ⊗(Y ∗ ⊕Z ∗ )
⊗
Z
X ⊗Z
⊕2 —
(X ⊗Y )⊕(X ⊗Z )
Since categories are a special case of polycategories, we can define PN(A) equally well when A is just a category. In this case the axiom links have exactly one input and one output; there is one for each arrow of A. In this situation we can translate from LTS sequent proofs to proof-nets. Definition 3.4.6 (Translation from sequents). Given an LTS proof π , we define a proof-net N π by recursion over the structure of π . • If proof π is just an f -axiom, let N π be the single slice containing just the corresponding axiom link, connected to a premise and a conclusion link, leaving a net of type A B. • If proof π is a just an application of the h-unit rule for some h : A → A, we form N π by introducing h as an axiom, as described previously, and forming a cut between, as described later, between its input and output. • If π is simply an application of the zero rule, then N π is an empty box with the desired type. • If π arises from π by an application of the cut rule for arrow on some formula X form N π from N π by replacing, in every slice of N π , the premise link corresponding to the negative occurrence of X with an η X link and replacing the conclusion link corresponding to the positive occurrence of X with an X
P1: SBT CUUS834-03
cuus834-gay
3
• • • •
•
• • • • •
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
113
link. The X ∗ output of the new unit link is connected to the X ∗ input of the new counit link. Suppose π arises from subproofs π1 and π2 by the mix rule. Then let N π = {N π1 }{N π2 }, i.e., a single slice containing two boxes, one for each subproof. If π arises from π by an application of the (⊗-R) rule, form N π adding, in every slice, a tensor link between the conclusions of N π corresponding to the active formulae of the rule. If π arises from π by an application of the (⊗-L) rule, form N π adding, in every slice, a cotensor link between the premises of N π corresponding to the active formulae of the rule. If π arises from π by an application of the (*-R) rule on some formula X , form N π by adding, in every slice, an η X link whose X output is connected to the premise of N π corresponding to the active formulae of the rule, and whose X ∗ output is connected to a new conclusion link. If π arises from π by an application of the (*-L) rule on some formula X , form N π by adding, in every slice, an X link whose X input is connected to the conclusion of N π corresponding to the active formulae of the rule, and whose X ∗ input is connected to a new premise link. If π arises from π by an application of the (I -R) rule, form N π adding, in every slice, a star link connected to a new conclusion link. If π arises from π by an application of the (I -L) rule, form N π adding, in every slice, a costar link connected to a new premise link. If π arises from π by an application of the (⊕i -R) rule, form N π by adding a plus-i link to the conclusion corresponding to the active formula in every slice of N π . If π arises from π by an application of the (⊕i -L) rule, form N π by adding a coplus-i link to the premise corresponding to the active formula in every slice of N π . Suppose π arises via an application of the sum rule to proofs π1 and π2 ; suppose also that N π1 = i si and N π2 = j t j . Then let N π = i si + j tj.
3.4.2 Normalization Definition 3.4.7. Let e be an edge in a slice, going from some link L 1 to link L 2 . We say that e is expandable when: (i) e is labeled by a a compound formula (i.e. either X ⊗ Y or X ⊕ Y ); (ii) L 1 is a premise, cotensor, or coplus link; and, (iii) L 2 is a conclusion, tensor, or plus link. Definition 3.4.8 (Rewrite Steps). Let ν, µ be proof-nets; define a one-step reduction relation on proof-nets Rβ such that ν Rβ µ if ν can be rewritten to µ by one of the following local rewrite rules.
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
114
October 30, 2009
19:29
Ross Duncan
Elimination Rules
η-elim:
.. .
η .. .
..X .
X∗
X
X
.. . .. .
η X ∗.
.. .
..
X∗
X∗
X
.. .
⊗-elim: .. .
.. .
X
Y
⊗
.. . X
X ⊗Y
⊗
X
.. .
.. . Y
.. .
Y
.. .
.. .
I-elim:
I
[ nothing ]
I
[ nothing ]
I —
I —
— I
— I
⊕-elim: .. . Xi
⊕i
.. . .. . Xi
X 1 ⊕X 2
⊕i
Xi
.. .
where i = j.
Xi
⊕i
.. .
X 1 ⊕X 2
⊕j
Xj
.. .
[ Delete Slice ]
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
115
0-elim: L1 [ Delete Slice ]
0
[ Delete Slice ]
0
L2
where either of the links L 1 , L 2 is a premise, conclusion, tensor, cotensor, unit, or counit. Circle reversal: A∗
A
where A is an atom.
Expansion Rules Circle expansion: X ⊗Y
X
Y
X ⊕Y
X
Y
η-expansion: η
η
η X∗ ∗
X ⊗Y
∗
Y
X ⊗Y
.. .
∗
X
Y
⊗
⊗
.. .
X ∗ ⊗Y
∗
X ⊗Y
.. .
.. .
η η X ∗ ⊕Y
∗
.. .
X∗ X ⊕Y
.. .
X
⊕1 —
X ∗ ⊕Y
η Y
—
—
X ∗ ⊕Y
X ⊕Y
.. .
X ∗ ⊕Y
Y
⊕2
⊕1 ∗
∗
∗
.. .
⊕2 ∗
X ⊕Y
—
X ⊕Y
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
116
October 30, 2009
19:29
Ross Duncan
-expansion: .. .
.. .
.. .
.. .
X ⊗Y
X ∗ ⊗Y
⊗
⊗ X ∗ ⊗Y
X ⊗Y
∗
X
X∗
Y
.. . X ∗ ⊕Y
.. .
.. .
∗
∗
∗
X ⊕Y
—
∗
X
X ∗ ⊕Y
.. .
∗ ∗
X ⊕Y X ⊕Y
—
—
⊕1
⊕1
X ⊕Y
∗
∗
Y
X
∗
X ⊕Y
—
⊕2
⊕2 Y
X ⊕Y
∗
Y
⊗- and ⊕-expansions: L1 X ⊕Y
L1
L1
L1
X ⊕Y
—
X ⊕Y
⊕1
⊕2
—
⊗ X ⊗Y
X ⊕Y X
Y
⊗
L2
L2
X
Y
⊕1
⊕2
—
L2
—
X ⊕Y
X ⊕Y X ⊕Y
L2
An edge from link L 1 to link L 2 and labeled by a compound formula X is expanded when both of the following hold: • L 1 is a cotensor coplus, or premise link; and • L 2 is a tensor plus, or conclusion link.
Unboxing Rule
If a slice s contains a box b =
i ti , replace s in the ambient box via β ti } s{ti }. s{ i
i
i.e., make a new copy of s for each slice in b, and in each replace b with the slice.
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
117
Definition 3.4.9. Let β- be the transitive, reflexive closure of Rβ and let =β be the symmetric closure of β- . Lemma 3.4.10 (Subject Reduction). Suppose that ν is a proof-net with type (, ) and ν β- µ; then µ also has type (, ). Proof. No rewrites change the premises or conclusions; hence the type is unchanged by β-reduction. We now begin to approach the proof that β-reduction is strongly normalizing. First some intermediary definitions. Definition 3.4.11. Let X be a formula; define its depth d(X ) by d( A) = d( A∗ ) = d(I ) = d(0) = 1, d(X ⊗ Y ) = d(X )d(Y ),
d(X ⊕ Y ) = d(X ) + d(Y ).
Lemma 3.4.12. Let e be an expandable edge labeled by X ; then e can be expanded to give a box with at most d(X ) slices. Proof. We use induction on X . Suppose that X contains a connective; the expansion rule for that connective will introduce expandable edges labeled by the subformulae Y and Z . By induction, these yield boxes with d(Y ) and d(Z ) slices respectively. If X = Y ⊗ Z , then the expansion rule introduces the new edges in parallel; applying the unboxing rule to one, then the other, we obtain d(Y ) d(Z ) slices. Alternatively suppose X = Y ⊕ Z . The expansion rule introduces a box containing two slices, with an expandable edge in each. Again, we can apply the unboxing rule twice and obtain a box with d(Y ) + d(Z ) slices. Definition 3.4.13. We define the size of a proof-net π , written n(π ) by mutual recursion over slices and boxes. Let s be a slice with boxes bi ; then n(bi ) d(bi ) Ns + n(s) = d(bi ) i i links found in s, except conclusions, premises, and where Ns is the number of boxes. If we have a box b = j t j then let n(b) = n(t j ) . j
Definition 3.4.14. We define the rank of a proof-net π , written r (π ) by mutual recursion over slices and boxes. Let s be a slice with boxes bi ; then r (bi ) d(bi ) K s + r (s) = d(bi ) i i
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
118
October 30, 2009
19:29
Ross Duncan
where K s is the total number of times the symbols ⊗ and ⊕ occur in the labels of expandable edges of s. If we have a box b = j t j then let r (b) = r (t j ) . j
The following lemma is immediate from the definitions: Lemma 3.4.15. Let s{ i ti } be a slice in a proof-net; then the following hold: n(s{ ti }) = n(s{ti }) i
i
i
i
ti }) = r (s{ti }) r (s{ ti }) > d(s{ti }). d(s{ i
i
Theorem 3.4.16 (Termination). Every β-reduction sequence is finite. Proof. We define an order on proof-nets by setting π π whenever (r (π ), n(π ), d(π )) > (r (π ), n(π ), d(π )) in the lexicographic order. Note that these quantities are all non-negative integers, so this order has no infinite decreasing chain. Suppose now that π Rβ π . By inspection of the rules we notice: • If the rewrite is an expansion, then we have r (π ) > r (π ); • If the rewrite is an elimination rule, then n(π ) > n(π ) and r (π ) ≥ r (π ); and, • If the rewrite is the unboxing rule, then by Lemma 3.4.15 we have that r (π ) = r (π ), n(π) = n(π ) and d(π ) > d(π ). Hence π β- π then necessarily π terminates.
π , and therefore every rewrite sequence
Theorem 3.4.17 (Local Confluence). If a proof-net π β-reduces to π1 and π2 by different rewrites r1 , r2 , then there exist sequences of rewrites s1 , s2 such that π
r1 π1
r2 ? π2
s1
s2
? - π∗
Proof. Within a box, rewrites on one slice do not affect any of the other slices. Hence, for a conflict to exist, either r1 and r2 both affect the same slice or that r2 operates on a child slice of that where r1 acts. Otherwise there is no conflict between the rewrites and they can be trivially unified.
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
119
The rules also exhibit locality in the vertical direction. The only rule that allows slices on different levels to interact is the unboxing rule – and this only pulls slices up from the level below. Hence if r1 and r2 act on slices that are more than two levels apart, they do not conflict. Observe that there are three kinds of rules in the system: those that add slices to the ambient box (just the unboxing rule); those that delete a slice (the zero rule and the incoherent case of ⊕-elimination); and those that have purely local effect (all the rest). We deal with the cases in that order. Suppose that the rewrite r1 is the unboxing rule; without loss of generality we have r1 π= si + s{ tj} si + s{t j } = π1 . i
j
i
j
Since we need only consider the case where r2 acts on s{ } or one of the t j , the other slices si will be neglected. Suppose r2 acts on s{ }: • If r2 is the unboxing rule acting on some other box, then we have r1 r2 s{ti }{ t j } s{ ti }{ t j } s{ ti }{t j } i
j
i
j
j
i
which can be unified by repeating r2 in each slice on the left, and r1 in each slice on the right: r1 j r2 s{ti }{ t } s{ti }{t } i s{ ti }{t }. j
i
j
j
i
j
j
j
i
• If r2 deletes s, then this must be due some structure in s{ }; hence the same rule can delete each of the s{ti }, which suffices to unify the divergence. • If r2 is any other rewrite, then we have r1 r2 s{ti } s{ ti } - s { ti } i
i
i
where r2 matches some structure in s{ }; hence it is still available in each of the s{ti }, permitting the unification r2 r1 s{ti } is {ti } s { ti }. i
i
i
Now suppose rs acts on one of the ti , which we simply call t. • Suppose r2 is the unboxing rule acting on some box in t: r2 t j . t j
Then we have the divergence r1 s{ti } + s{t} s{ ti + t} i
i
- s{
r2
i
ti +
j
t j }
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
120
October 30, 2009
19:29
Ross Duncan
which we unify using repeated application of the unboxing rule: s s{ti } + s{t} s{ti } + s{t j } { ti + t j }. i
i
j
i
j
• Suppose that r2 deletes t; then same rule will delete s{t}, which will unify the divergence. • Otherwise r2 rewrites t to some t ; again this same rewrite will do s{t} → s{t }, which will unify the divergence. This shows that the unboxing rule cannot conflict with the others. Now suppose that r1 deletes slice s. This implies that s contains either a pair of incoherent ⊕-links or an edge labeled by 0. Notice that none of the slice-local rules can remove either of these features from the graph. Hence regardless of which rule it is, no slice-local rule r2 can block r1 , so the divergence can always be unified by deleting s. Of course, if r2 also deletes s, then there is no divergence. Finally we consider the case where both r1 an r2 are slice-local. Since all the action is within a single slice, it suffices to show that any pair of overlapping rewrites that diverge can be unified. Due to the large number of expansion rules, there are a very large number of potential critical pairs. Fortunately the rules are very regular and have been carefully designed to ensure their confluence. For reasons of space we do not include this analysis here, but checking all the pairs is a routine, albeit lengthy, exercise. All divergent rewrites can be unified; hence PN(P) is locally confluent under β-reduction. Theorem 3.4.18 (Strong normalization). β-reduction for proof-nets is strongly normalising. Proof. Since β-reduction is confluent, each proof-net has a unique normal form; since it is terminating, every rewrite sequence must arrive at the normal form. Having established the existence of β-normal proof-nets, we now characterise them intrinsically. Recall that for multiplicative linear logic proof-nets (Girard 1987b), the structure of a cut-free proof can be separated into the axiom structure and the connective structure. The following lemmas give a similar result, flattening the additive structure and pushing the connectives to the outside of the proof-net. Lemma 3.4.19. Let π be a normal proof-net; then every slice of π is flat. Proof. If any slice contains a box, we can apply the unboxing rule, contradicting the normality of π. Since the box structure of a normal net is trivial, we turn our attention to the structure of the slices. Notice that we will assume that a normal slice is in a normal net, and hence the rule for 0-elimination has been applied, implying that a normal slice contains no edge labeled by 0.
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
121
Lemma 3.4.20. Let π be a normal proof-slice, and suppose x is a link in π . • If x is a tensor or a plus link all links below x are tensors, pluses, or conclusions. • If x is a cotensor or coplus link, all links above x are cotensors, copluses, or premises. Proof. Let x be either a tensor link or a plus link. Its outgoing edge is labeled by some formula, either X ⊗ Y or X ⊕ Y ; suppose there is a link below it, called x . Note that since π is normal, x cannot be a box. • If x is a counit, then it is labeled by a nonatomic formula, hence an -expansion rewrite applies and π is not normal. • If x is an axiom, it has an incoming edge labeled by a non-atomic formula, which contradicts the definition of axiom link. Now there are two cases depending on what kind of link x is. • Suppose that x is a tensor link; then x cannot be a coplus link because its incoming formula is X ⊗ Y . Suppose that x is a cotensor link: then rewrite rule ⊗-elim applies, hence π is not normal. • Suppose that x is a plus link; then x cannot be a cotensor link because its incoming formula is X ⊕ Y . Suppose that x is a coplus link: then rewrite rule ⊕-elim applies, hence π is not normal. Hence x cannot be a coplus, cotensor, counit, or axiom link. If it is a conclusion then the hypothesis is satisfied. If x is a tensor or plus link, then by induction all the links below x are also tensors, pluses, or conclusions. The case when x is a cotensor or coplus is exactly dual. Corollary 3.4.21. Any normal proof-slice π can be formed from a normal atomic slice π by adding tensor and plus links to its conclusions and cotensors and copluses to its premises. Corollary 3.4.22. All the edges of a normal atomic proof-net are labeled by literals. Proposition 3.4.23. An atomic proof-slice is normal if and only if: all its edges are labeled by atomic formulae; its circles are labeled by positive atoms; no edge is labeled by 0; every edge labeled by I connects a premise to a costar, or a star to conclusion; and no unit link is connected to a counit link. Proof. If π is normal, Corollary 3.4.22 gives that all its edges’ labels are atomic; by its normality no unit is connected to a counit since otherwise rewrite η-elim 1 or 2 would apply. Since π is normal, it contains no boxes; hence the formula 0 can only introduced by a premise of conclusion link, but in this case the 0 elimination
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
122
October 30, 2009
19:29
Ross Duncan
rule would apply. Since π is atomic, the formula I may only be introduced by star, costar, premise, or conclusion links; any such edge labeled by I is can be eliminated unless it connects a premise to a costar, or a star to conclusion as required. Conversely, suppose that π is atomic, such that all the foregoing conditions are satisfied. Since all its edges are labeled by literals, none of the expansion rules can apply. For the same reason it contains no tensor, cotensor, plus, coplus, or box links; hence rewrites for ⊗, ⊕, 0, and circle elimination do not apply, nor does unboxing. Star and costar links can only appear in forms such that the I elimination rules do not apply. By hypothesis, no unit is connected to a counit; hence rewrites η-elim 1 and 2 cannot apply, and circles are labeled by positive literals so the circle reversal rule does not apply. Since no rewrites are possible, π is in its normal form.
3.4.3 The Categorical Structure of PN(P) In this section we prove the main remaining theorems about PN(P). First we show that PN(P) forms a compact closed category with biproducts, and then we show that it is a representation of the free compact closed category with biproducts generated by P. Proposition 3.4.24. The class of proof-nets, PN(P), forms a category. The objects of PN(P) are LTS formulae. An arrow π : X → Y is a proof-net whose only premise is X and whose only conclusion is Y . Two arrows in PN(P) are considered equal if they have the same normal form. Note that the restriction to single formulae is rather weak since the comma of tensor-sum logic is implicitly the tensor; given a proof-net not in this form, we may insert tensor links between the conclusions, and cotensors between the premises, to obtain a proof-net of the desired kind. The restriction to single formulae also avoids having to provide a bracketing, since the connectives of LTS are not strictly associative. We define the identity proof-net 1 X to be a net with one slice, containing only a premise link and a conclusion link, both labeled by X . (Note that since the edge linking them may be expandable, this is not usually the normal form.) Before defining composition of nets, we first define it for slices. Suppose s, t are proof-slices such that both the conclusion of s and the premise of t are some formula X ; we define t ◦ s by removing the conclusion link of s, removing the premise link of t, and forming a new slice by joining the two graphs along the resulting open edges. Notice that this operation is manifestly associative. Further, we have equations 1X ◦ s = s
and
t ◦ 1 X = t,
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
123
since, considering the first case only, we have simply removed a conclusion link from s and adjoined an identical conclusion link. The other case is the same. Now let f : X → Y and g : Y → Z be proof-nets, with slices f i and g j respec tively; their composition g ◦ f = i j g j ◦ f i where the composition on slices is as before. Given a third net h : Z → W , we have h ◦ (g ◦ f ) =
h k ◦ (g j ◦ f i ) =
(h k ◦ g j ) ◦ f i = (h ◦ g) ◦ f
i jk
i jk
so composition of proof-nets is associative as required. The identity equations
1Y ◦ f = 1Y ◦ (
f ◦ 1Y = (
fi ) =
i
(1Y ◦ f i ) = fi = f i
i
i
i
f i ) ◦ 1Y = ( f i ◦ 1Y ) = fi = f
i
follow directly from the slice case. Hence all the axioms required to be a category are satisfied. Proposition 3.4.25. PN(P) is compact closed. First we define the monoidal structure of PN(P). Let f : X 1 → Y1 and g : X 2 → Y2 be proof-nets; then define their tensor product as X 1 ⊗X 2
— ⊗
X1
f ⊗g =
X2
g
f ⊗
Y1
Y2
—
Y 1 ⊗Y 2
If f = { f i }i and g = {g j } then by unboxing we have X 1 ⊗X 2
—
X1 ⊗ X2 ( f ⊗ g)i j = fi gj
Y1
⊗ —
Y 1 ⊗Y 2
Y2
P1: SBT cuus834-gay
978 0 521 51374 6
October 30, 2009
19:29
—
Z 1 ⊗Z 2
—
Z 1 ⊗Z 2
Z2
⊗ Z1
—
Z1
f
Y1
Z 1 ⊗Z 2
Z2
⊗
g
Z1
—
⊗
Z 1 ⊗Z 2
Z2
ij lk
g
⊗
Y2
f
Y1
⊗ Y1
f
Y 1 ⊗Y 2
f Y2
X1
g
X2 X1
⊗
—
Y2
g
⊗
—
X 1 ⊗X 2
X2
2 Y 1 Y gl fk
Z1
f ◦ f
⊗
⊗ X1
—
X 1 ⊗X 2
⊗ X2 fi gj X1
—
X 1 ⊗X 2
Z2
g ◦ g
Ross Duncan
X2
124
X 1 ⊗X 2
CUUS834-03
Figure 3.5. Reduction sequence showing that ( f ⊗ g ) ◦ ( f ⊗ g) = ( f ◦ f ) ⊗ (g ◦ g)
Let f : Y1 → Z 1 and g : Y2 → Z 2 be proof-nets; then we have the equation ( f ⊗ g ) ◦ ( f ⊗ g) = ( f ◦ f ) ⊗ (g ◦ g) via the reduction sequence shown in Figure 3.5. To see that 1 X ⊗Y = 1 X ⊗ 1Y we simply observe that 1 X ⊗Y β- 1 X ⊗ 1Y by ⊗-expansion. Hence ⊗ does indeed define a functor.
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
125
The left unit, right unit, symmetry, and associativity isomorphisms are defined by
X —
(X ⊗ Y ) ⊗ Z —
X ⊗Y —
X —
⊗
⊗
Y
X Y
I
⊗
X
X
— I ⊗X
Y ⊗Z
⊗
X
Z
I
⊗
Y
— X ⊗I
⊗
X
X
⊗
Y
X ⊗Y
— Y ⊗X
Z
⊗
— X ⊗ (Y ⊗ Z)
We leave as an easy exercise to check that the required coherence equations are satisfied. Turning our attention to the compact structure, recall that every formula X has its de Morgan dual X ∗ as defined in Definition 3.3.1. The unit and counit maps η X and X are defined by the nets I —
X∗ —
X — η
and — X∗
— X
— I
The required equations follows more or less immediately from the η-elimination rules. Hence PN(P) is compact closed. Proposition 3.4.26. PN(P) is enriched over commutative monoids. Proof. This property follows directly from the slice structure of proof-nets. If f, g : X → Y are proof-nets then f + g is just the proof net containing all slices of both f and g; since the order of the slices is not significant, this operation is commutative. The net with no slices, denoted ∅, gives the zero element. Proposition 3.4.27. PN(P) has a 0 object. Proof. Obviously, the formula 0 is the zero object. Note that for any formula X , the empty proof-net (i.e., the net with no slices) provides a proof ∅ : X → 0 and also ∅ : 0 → X . Suppose that we have a proof-net f : X → 0. Each slice in f must contain a conclusion link labeled by 0; hence by the rule for 0-elimination, every slice of f must be deleted, so the normal form of f is the empty proof-net. Hence, for every X , there is exactly one arrow of type X → 0, and similarly there is exactly one arrow 0 → X , so 0 is both initial and terminal in PN(P).
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
126
October 30, 2009
19:29
Ross Duncan
Proposition 3.4.28. PN(P) has biproducts. Proof. Consider the following one-sliced proof-nets: X1 ⊕ X2 —
π1 =
⊕1 — X1
X1 ⊕ X2 —
π2 =
X1 —
in1 =
⊕2 — X2
X2 —
in2 =
⊕1 — X1 ⊕ X2
⊕2 — X1 ⊕ X2
Observe that the rules for ⊕-eliminations imply that π j ◦ ini =
1Xi ∅
if i = j if i = j
Next, consider the identity map 1 X 1 ⊕X 2 . We have the equation
1 X 1 ⊕X 2 =
ini ◦ πi
i=1,2
via the following rewrite sequence: X1 ⊕ X2 —
X1 ⊕ X2 —
X 1 ⊕X 2
—
X 1 ⊕X 2
⊕1
⊕2
X1
— X1 ⊕ X2
⊕1 —
X 1 ⊕X 2
—
X1 ⊕ X2 X1 ⊕ X2 — — ⊕1
X2
X1
⊕2 —
X 1 ⊕X 2
⊕1
⊕2 X2
⊕2
— — X1 ⊕ X2 X1 ⊕ X2
— X1 ⊕ X2
Since we can form these maps for any pair of objects and, by Propositions 3.4.26 and 3.4.27, PN(P) is a CMon-category with a 0 object, the result now follows by Proposition 3.2.42. Proposition 3.4.29. In PN(P) we have natural distribution isomorphisms: X ⊗ (Y ⊕ Z ) ∼ = (X ⊗ Y ) ⊕ (X ⊗ Z ) ∼ (X ⊗ Z ) ⊕ (Y ⊗ Z ). (X ⊕ Y ) ⊗ Z = Proof. The required maps are given by the following proof-nets. We leave the reader to check that these nets do indeed define natural isomorphisms.
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
—
X ⊗(Y ⊕Z )
Y
X ⊗Y
⊕1 (X ⊗Y )⊕(X ⊗Z )
X ⊕Y
X
(X ⊕Y )⊗Z
—
X ⊕Y
⊕1
Z
⊗
127
⊗
Z
⊕2 X
⊗
Y ⊕Z
⊕1
—
—
⊗ Y ⊕Z
⊗
(X ⊕Y )⊗Z )
—
⊗
X
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
X ⊗(Y ⊕Z )
X
October 30, 2009
X
X ⊗Z
Z
⊕2 ⊗
Z
Y
⊗
X ⊗Z
⊕2
⊕1
—
—
(X ⊗Y )⊕(X ⊗Z )
(X ⊗Z )⊕(Y ⊗Z )
Z
Y ⊗Z
⊕2 —
(X ⊗Z )⊕(Y ⊗Z )
The preceding six propositions established that PN(P) is indeed a compact closed category with biproducts as described in Section 3.2.8. Note further that the objects of PN(P) – the LTS formulae – are freely generated from the atoms, which are themselves the objects the underlying polycategory P. Every object of PN(P) is therefore isomorphic to a formula in disjunctive normal form, X∼ ⊗ ji X ji , = i
where the X ji are literals and the constants 0 and I occur only when a sum or product is empty. (We assume some given bracketing of the connectives.) Hence every proof-net f : X → Y is equivalent to some f of the form f : ⊗ ji X ji → ⊗ ji Y ji . i
i
Since f is an arrow between sums, we can consider its matrix elements πi ◦ f ◦ in j . Without loss of generality take f to be in normal form; by Lemmas 3.4.19 and 3.4.20, f consists of flat slices, whose connective links are all at the outside, and since its type is in disjunctive normal form all its plus and coplus links are outside all its tensor and cotensor links. Hence f = inik ◦ f k ◦ π jk k
where each f k is a proof-slice between multiplicative formulae. Hence, inik ◦ f k ◦ π jk ) ◦ in j πi ◦ f ◦ in j = πi ◦ ( =
k
πi ◦ inik ◦ f k ◦ π jk ◦ in j
k
=
fk
k
where k ∈ {k | jk = j and i k = i}. By Corollary 3.4.21, each of the f k corresponds to a unique normal atomic slice, which is monoidally reduced. Hence, the
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
128
October 30, 2009
19:29
Ross Duncan
A∗ —
— A∗
A∗ —
.. . A
.. .A — A∗
Figure 3.6. Negative edges
only part of the structure of PN(P) that is not freely generated by its connectives is the normal atomic slices; we now characterize these, and by so doing prove that PN(P) is a representation of the free compact closed category with biproducts generated by P. The reduced normal atomic proof-slices are very closely related to the P-labelable circuits. Let PN(P) N denote the subcategory of PN(P) determined by the multiplicative formulae, and flat, single-sliced proof-nets. We take PN(P) N to be monoidally strict; hence its arrows are in 1-1 correspondence to the reduced atomic proof-slices. A simple formal transformation produces a circuit from each such proof-slice, and vice versa. This correspondence can be boosted up to a pair of functors -
F
Circ(P)
PN(P) N
U
that form an equivalence of categories. Lemma 3.4.30. Suppose ν is an atomic normal proof-net; suppose e is an edge in ν labeled by a negative literal. One of the following holds: • e connects a premise to a conclusion; • e connects a premise to a counit link; • e connects a unit link to a conclusion. Proof. By Lemma 3.4.20, ν contains no tensor, cotensor, plus, or coplus links, nor any boxes; neither axioms nor stars nor costars can introduce negative negative edges, therefore e must connect either a premise, unit, counit or conclusion. Since the proof-net is normal, e cannot join a unit to a counit by the preceding lemma. Since an edge cannot be incoming or outgoing at both endpoints, the pairings unit/unit, counit/counit, premise/premise, conclusion/conclusion, conclusion/ counit, and premise/unit are excluded. This leaves the three possibilities claimed. These can occur validly in a normal proof-net as shown by Figure 3.6. Suppose that π : → is normal and atomic; then π can be rewritten to produce a P-labeled circuit c(π ) : → by the following procedure. (i) The premises and conclusions of π become the boundary nodes of c(π ); the premises form dom c(π ) and the conclusions cod c(π ). They are labeled
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
129
by the edges formulae and signed according to whether the atom is positive or negative. (ii) For all edges e labeled by a negative literal A∗ , reverse e’s direction, and change its labeling to A. This guarantees that negatively signed nodes in the codomain have incoming edges, and vice versa. (iii) Erase every unit and counit node, merging their incident edges, which are now pointing in the same direction. (iv) The remaining links of π must all be axioms links. These become the internal nodes of c(π). At each node x, the ordering on in(x) and out(x) is simply that of the components of the domain and codomain of the arrow (in A) that labels that node. Lemma 3.4.30 guarantees that c(n) really is a circuit. There is a dual procedure, taking a circuit f : i Ai → j B j to a normal atomic proof-net. (i) The nodes in dom f become premises; those of cod f , conclusions. (ii) If e is an edge, labeled by A, going from some node n to a premise p, replace e with a counit link whose incoming edges are from e and p, labeled by A and A∗ respectively. (iii) If e is an edge, labeled by B, going to some node n from a conclusion c, replace e with a unit link whose outgoing edges go to e and c and are labeled by B and B ∗ respectively. (iv) The interior nodes of f become axiom links, each determined by the label on the corresponding node. This defines a proof-net p( f ) : A1 , . . . , An B1 , . . . Bm , which by Proposition 3.4.23 is normal. The two procedures are mutually inverse, which leads to the following characterization result. Definition 3.4.31. Let X be formula; an additive path for X is a map that assigns a Boolean value to each occurrence of ⊕ in X . Given an additive path b, we can define a purely multiplicative formula X (b) by replacing each subformula Y ⊕ Z with Y if b assigns 0 to this ⊕ and Z if b assigns 1. Theorem 3.4.32. Let π be a normal proof-slice; then π is completely determined by its type, an additive path for its domain and codomain, and a P-labelable circuit. Proof. Suppose that π has type X Y . Given a formula X and an additive path b, let X, b be the list of literals produced by replacing every occurrence of ⊗ in X (b) by a comma. By Lemma 3.4.20, π can be decomposed into three layers: on top π X,b of type X X, b consisting only of cotensor, coplus, and costar links; the middle π − : X X, b Y, b that is both normal, reduced, and atomic; and at the bottom πY,b : Y, b Y consisting only of tensors, pluses, and stars.
P1: SBT CUUS834-03
cuus834-gay
978 0 521 51374 6
130
October 30, 2009
19:29
Ross Duncan
— — Fixed by the premise type Γ
⊗
⊗
⊗
—
···
···
···
···
···
Defines a unique P-labeled circuit f ···
Fixed by the conclusion type ∆
—
···
···
···
··· ⊗
⊗ ⊗
—
— Figure 3.7. Normal proof-slice decomposition
The layers π and π are uniquely determined by X, b and Y, b , while π − is uniquely determined by the circuit c(π − ). In the case in which the proof slice contains only multiplicative formulae, the additive path can be dispensed with, leaving the three-layered structure shown in Figure 3.7. Corollary 3.4.33. A normal reduced atomic slice is completely determined by a P-labeled circuit f. Justified by the corollary we write π ∼ f for any normal reduced atomic slice π . The required functors F and U are now easily defined. For each A of PN(P), let U A be the positively signed singleton, labeled by A; then define U (A∗ ) = (U A)∗ and U (X ⊗ Y ) = U X ⊗ U Y . Let π β- ν ∼ f where ν is normal; then define U π = f . To map Circ(P) into PN(P), let f be a circuit; then let F f be the proof-net obtained from p( f ) by adding tensor links to all the conclusions (bracketed to the left) and, similarly, cotensors to all the premises. Theorem 3.4.34. The 4-tuple (Circ(P), PN(P) N , F, U ) is an equivalence of categories.
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
131
Proof. Obviously, from the construction of U and F, we have U F = Id. On the other hand, a proof-net π : X → Y only differs from FU π : FU X → FU Y by the associativity of the tensor, hence Id ∼ = FU . This theorem establishes that the matrix elements of a proof-net π in PN(P) are nothing more than formal sums of circuits over P, i.e., elements of the free compact closed category generated by P. Hence we have the main result: Theorem 3.4.35. The category of proof-nets PN(P) is the free compact closed category with biproducts generated by the compact symmetric polycategory P.
3.5 Conclusions To recap: we sketched how key parts of quantum mechanics can be formalized in the language of compact closed categories and biproducts; we demonstrated how to represent quantum processes as proof-nets and showed that normalization of such proof-nets allows some of the behavior of the corresponding processes to be simulated. We introduced the formal syntax of tensor-sum logic and its proof-net notation. We showed that proof-nets are strongly normalizing and characterized the normal forms. Finally we proved the main theorem: that the category of proof-nets is exactly the free compact closed category with biproducts generated by the polycategory from which its axioms are drawn. This result can be viewed as a coherence theorem for compact closed categories with biproducts, in the style of Kelly and Laplaza’s classic result for compact closed categories (Kelly and Laplaza 1980). To return to our starting point, tensor-sum logic is almost an orthogonal theory to Birkhoff–von Neumann quantum logic. Tensor-sum logic is entirely preoccupied with the areas that quantum logic neglects: compoundness, interaction, and control. However, as the main theorem shows, we abdicate all responsibility for the internal structure of our quantum systems. Since our arrows are characterized by normal proof-nets, they are nothing more than type constructors wrapped around the generators: the fine structure must be described by an equational theory of the generators. We can view this as a strength: the logic is extremely general and could be easily applied to situations other than quantum computing. On the other hand, we suffer strong limitations on how much of quantum mechanics can be formulated in this setting without adjoining ad hoc rules to account for the particular situations we are modelling. In a sense, this work is the end of the road for those “logical” approaches to quantum mechanics deriving from linear logic9 . Already the dividing line between substructural logic and algebra is thin, and what we have shown here is that, while proof-theoretic tools may suffice for the coarse business of putting together systems and pulling them apart again, the true quantum structure is living in the 9
Those approaches deriving from topos theory, for example (Doering and Isham 2008; Heunen et al. 2009), are a different matter entirely.
P1: SBT CUUS834-03
cuus834-gay
132
978 0 521 51374 6
October 30, 2009
19:29
Ross Duncan
(poly)category of generators, and more subtle algebraic tools are needed to tease out the details. In particular the importance of spectra in quantum mechanics weighs against any approach based on natural transformations. Recent work (Coecke, Pavlovic, and Vicary 2008b; Coecke, Paquette, and Perdrix 2008a; Coecke and Duncan 2008) provides a categorical account of observables that is essentially algebraic. Fittingly, such theories have graphical representations that allow them to slot into the proof-net framework as generators. In that case combining the two systems would yield a well-behaved two-level system of types and terms suitable for representing quantum processes under classical control.
Bibliography Abramsky, S., Blute, R., and Panangaden, P. (1999) Nuclear and trace ideals in tensored *-categories. Journal of Pure and Applied Algebra 143:3–47. Abramsky, S., and Coecke, B. (2004) A categorical semantics of quantum protocols. In Proceedings of the 19th Annual IEEE Symposium on Logic in Computer Science: LICS 2004, pages 415–425. IEEE Computer Society. Abramsky, S., and Duncan, R. (2006) A categorical quantum logic. Mathematical Structures in Computer Science 16(3):469–489. Special Issue for the Proceedings of QPL 2004. Abramsky, S., Gay, S., and Nagarajan, R. (1996) Interaction categories and the foundations of typed concurrent programming. In Broy, M., editor, Proceedings of the 1994 Marktoberdorf Summer School on Deductive Program Design, pages 35–113. Springer-Verlag. Abramsky, S., Haghverdi, E., and Scott, P. (2002) Geometry of interaction and linear combinatory algebras. Mathematical Structures in Computer Science 12:625–665. Abramsky, S., and Jagadeesan, R. (1994) New foundations for the geometry of interaction. Information and Computation 111(1):53–119. Conference version appeared in LiCS ’92. Baez, J., and Dolan, J. (1995) Higher-dimensional algebra and topological quantum field theory. Journal of Mathematical Physics 36:6073–6105. Barr, M. (1979) ∗-Autonomous Categories, volume 752 of Lecture Notes in Mathematics. SpringerVerlag. Barr, M. (1991) *-autonomous categories and linear logic. Mathematical Structures in Computer Science 1:159–178. Bennett, C., Brassard, G., Crepeau, C., Jozsa, R., Peres, A., and Wootters, W. (1993) Teleporting an unknown quantum state via dual classical and EPR channels. Physical Review Letters, pages 1895–1899. Birkhoff G., and von Neumann, J. (1936) The logic of quantam mechanics. Annals of Mathematics 37(823). Blute, R., Cockett, J., Seely, R., and Trimble, T. (1996) Natural deduction and coherence for weakly distributive categories. Journal of Pure and Applied Algebra 113:229–296. Cockett, R., and Seely, R. (1997) Weakly distributive categories. Journal of Pure and Applied Algebra 113(2):229–296. Coecke, B. (2005a) De-linearizing linearity: Projective quantum axiomatics from strong compact closure. In Proceedings of the 3rd International Workshop on Quantum Programming Languages. Coecke, B. (2005b) Kindergarten quantum mechanics. arxiv.org/abs/quant-ph/0510032. Coecke, B., and Duncan, R. (2008) Interacting quantum observables. In Aceto, L., Damg˚ard, I., Goldberg, L. A., Halld´orsson, M. M., Ing´olfsd´ottir, A., and Walukiewic, I., editors, Automata, Languages and Programming, 35th International Colloquium, ICALP 2008, Reykjavik, Iceland, July 7–11, 2008, Proceedings, Part II, volume 5126 of Lecture Notes in Computer Science, pages 298–310. Springer. Coecke, B., Paquette, E. O., and Perdrix, S. (2008a) Bases in diagrammatic quantum protocols. In Proceedings of Mathematical Foundations of Programming Semantics XXIV.
P1: SBT CUUS834-03
cuus834-gay
3
978 0 521 51374 6
October 30, 2009
19:29
Generalized Proof-Nets for Compact Categories with Biproducts
133
Coecke, B., Pavlovic, D., and Vicary, J. (2008b) A new description of orthogonal bases. Mathematical Structures in Computer Science 13pp, to appear, arxiv.org/abs/0810.0812. Curry, H. B., and Feys, R. (1958) Combinatory Logic I. North-Holland. Danos, V., and Regnier, L. (1989) The structure of multiplicatives. Archive Mathematical Logic 28(3):181–203. Deligne, P. (1991) Cat´egories tannakiennes. In Grothendieck Festschrift, volume 2, pages 111– 194. Birkhauser. Doering, A., and Isham, C. J. (2008) A topos foundation for theories of physics: I. Formal languages for physics. Journal of Mathematical Physics 49. Duncan, R. (2004) Believe it or not, Bell states are a model of multiplicative linear logic. Technical Report PRG-RR-04-18, Oxford University Computing Laboratory. Duncan, R. (2006) Types for Quantum Computation. Ph.D. thesis, Oxford University. Gentzen, G. (1935) Untersuchungen u¨ ber das Schliessen. In Szabo, M., editor, The Collected Papers of Gerhard Gentzen. North-Holland. Girard, J.-Y. (1987a) Linear logic. Theoretical Computer Science 50(1). Girard, J.-Y. (1987b) Multiplicatives. In Lolli, G., editor, Logic and Computer Science: New Trends and Applcations, pages 11–37. Rendiconti del Seminario Mathematico dell’Universita e Politecnico di Torino. Girard, J.-Y. (1996) Proof-nets: the parallel syntax for proof theory. In Ursini, A., and Aglian`o, P., Logic and Algebra. Volume 180 of Lecture Notes in Pure and Applied Mathematics. Marcel Dekker. Girard, J.-Y., Scedrov, A., and Scott, P. J. (1992) Normal forms and cut-free proofs as natural transformations. In Moschovakis, Y. N., editor, Logic from Computer Science, Mathematical Sciences Research Institute Publications 21, pages 217–241. Springer-Verlag. Heunen, C., Landsman, K., and Spitters, B. (2009) A topos for algebraic quantum theory. Communications in Mathematical Physics. To appear Houston, R. (2008) Finite products are biproducts in a compact closed category. Journal of Pure and Applied Algebra 212(2):394–400. Howard, W. A. (1980) The formulæ-as-types notion of construction. In Hindley, J. R., and Seldin, J. P., editors, To H. B. Curry, Essays on Combinatory Logic, Lambda Calculus and Formalism, pages 479–490. Academic Press. Hughes, D., and van Glabbeek, R. (2003) Proof nets for unit-free multiplicative-additive linear logic. In Proc. Logic in Computer Science 2003. IEEE. Hyland, M., and Schalk, A. (2003) Gluing and orthogonality for models of linear logic. Theoretical Computer Science 294:183–231. Joyal, A. (1977) Remarques sur la th´eories des jeux a` deux personnes. Gazette des sciences math´ematiques du Qu´ebec 1(4). Joyal, A., and Street, R. (1991) The geometry of tensor categories i. Advances in Mathematics 88:55–113. Joyal, A., and Street, R. (1993) Braided tensor categories. Advances in Mathematics 102:20– 78. Joyal, A., Street, R., and Verity, D. (1996) Traced monoidal categories. Mathematical Proceedings of the Cambridge Philosophical Society 119:447–468. Kelly, G. (1972) Many-variable functorial calculus I, volume 281 of Lecture Notes in Mathematics, pages 66–105. Springer. Kelly, G., and Laplaza, M. (1980) Coherence for compact closed categories. Journal of Pure and Applied Algebra 19:193–213. Lambek, J. (1968) Deductive systems and categories I. syntactic calculus and residuated categories. Mathematical Systems Theory 2(4):287–318. Lambek, J. (1969) Deductive systems and categories (ii). In Hilton, R. J., editor, Category Theory, Homology Theory and their Applications I, volume 87 of Lecture Notes in Mathematics, pages 76–122. Springer. Lambek, J., and Scott, P. J. (1986) Introduction to Higher Order Categorical Logic, volume 7 of Cambridge Studies in Advanced Mathematics. Cambridge University Press.
P1: SBT CUUS834-03
cuus834-gay
134
978 0 521 51374 6
October 30, 2009
19:29
Ross Duncan
Laurent, O., and Tortora de Falco, L. (2004) Slicing polarized additive normalisation. In Ehrhard, T., Girard, J.-Y., Ruet, P., and Scott, P., editors, Linear Logic in Computer Science, volume 316 of London Mathematical Society Lecture Notes, pages 247–282. Cambridge University Press. Loader, R. (1994) Models of Lambda Calculi and Linear Logic: Structural, Equational and Proof-theoretic Characterisations. Ph.D. thesis, St Hugh’s College, Oxford. Mac Lane, S. (1997) Categories for the Working Mathematician (second Edition). SpringerVerlag. Mitchell, B. (1965) Theory of Categories. Academic Press. Penrose, R. (1971) Applications of negative dimensional tensors. In Combinatorial Mathematics and its Applications, pages 221–244. Academic Press. Prawitz, D. (1965) Natural Deduction. A Proof-Theoretic Study. Almqvist & Wiksell. Selinger, P. (2004) Towards a quantum programming language. Mathematical Structures in Computer Science 14(4):527–586. Selinger, P. (2005) Dagger compact closed categories and completely positive maps. In Proceedings of the 3rd International Workshop on Quantum Programming Languages. Smets, S. (2001) The Logic of Physical Properties in Static and Dynamic Perspective. Ph.D. thesis, Vrije Universiteit Brussel. Soloviev, S. V. (1987) On natural transformations of distinguished functors and their superpositions in certain closed categories. Journal of Pure and Applied Algebra 47. Szabo, M. (1975) Polycategories. Communications in Algebra 3:663–689.
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
October 31, 2009
14:25
4 Quantum Lambda Calculus Peter Selinger and Benoˆıt Valiron
Abstract We discuss the design of a typed lambda calculus for quantum computation. After a brief discussion of the role of higher-order functions in quantum information theory, we define the quantum lambda calculus and its operational semantics. Safety invariants, such as the no-cloning property, are enforced by a static type system that is based on intuitionistic linear logic. We also describe a type inference algorithm and a categorical semantics.
4.1 Introduction The lambda calculus, developed in the 1930s by Church and Curry, is a formalism for expressing higher-order functions. In a nutshell, a higher-order function is a function that inputs or outputs a “black box,” which is itself a (possibly higher-order) function. Higher-order functions are a computationally powerful tool. Indeed, the pure untyped lambda calculus has the same computational power as Turing machines (Turing 1937). At the same time, higher-order functions are a useful abstraction for programmers. They form the basis of functional programming languages such as LISP (McCarthy 1960), Scheme (Sussman and Steele 1975), ML (Milner 1978), and Haskell (Hudak et al. 2007). In this chapter, we discuss how to combine higher-order functions with quantum computation. We believe that this is an interesting question for a number of reasons. First, the combination of higher-order functions with quantum phenomena raises the prospect of entangled functions. Certain well-known quantum phenomena can be naturally described in terms of entangled functions, and we give some examples of this in Section 4.2. Another interesting aspect of higher-order quantum computation is the interplay between classical objects and quantum objects in a higher-order context. A priori, quantum computation operates on two distinct kinds of data: classical data, which can be read, written, duplicated, and discarded as usual, and quantum data, which has state preparation, unitary maps, and measurements as primitive operations. 135
P1: SBT CUUS834-04
cuus834-gay
136
978 0 521 51374 6
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
The higher-order computational paradigm introduces a third kind of data, namely functions, and one may ask whether functions behave like classical data, quantum data, or something intermediate. The answer is that there will actually be two kinds of functions: those that behave like “quantum” objects, and those that behave like “classical” objects. Functions of the first kind carry the potential to be entangled and can only be used once. They are effectively a “quantum state with an interface.” Functions of the second kind carry no possibility of being entangled and can be duplicated and reused at will. Interestingly, this classification of functions is not directly related to the types of their inputs and outputs: as we will see, there exist quantum-like functions that act on classical data, as well as classical-like functions that act on quantum data. In Section 4.3.2, we discuss a type system by which one can mechanically determine, for every expression of the quantum lambda calculus, which of these categories it falls into. When designing a quantum lambda calculus, one naturally has to make a number of choices. We do not attempt to present all possible design choices that could have been made; instead, we present one set of coherent choices that we think is particularly useful, with occasional comments on possible alternatives. Various aspects of our quantum lambda calculus and its semantics have been developed (Valiron 2004a,b; Selinger and Valiron 2005, 2006, 2008a,b; Valiron 2008). We briefly discuss some of the main design choices, as well as related work, in Section 4.3.8. The remainder of this chapter is organized as follows. In Section 4.2, we give some examples of the use of higher-order functions in quantum computation. In Section 4.3, we introduce the quantum lambda calculus, its syntax, type system, and operational semantics. A type inference algorithm is described in Section 4.4. We discuss an extension of the language with infinite data types in Section 4.5. Finally, in Section 4.6 we discuss the category-theoretic semantics of the quantum lambda calculus.
4.2 Higher-order Quantum Computation Examples At the heart of the higher-order computation paradigm is the idea that “functions are data.” As such, functions can appear in any context in which data is normally used. In particular, they can appear as inputs to other functions, appear as outputs of other functions, or be stored in data structures (such as a pair of functions or a list of functions). An important restriction of higher-order computation is that all functions must be accessed via their interface. In other words, a program may interact with a function-as-data by applying it to an argument, but not, for instance, by examining its code. We give some examples illustrating how some common phenomena in quantum computation can be interpreted in terms of higher-order functions. In these examples, we informally use some concepts (such as types) that are more rigorously defined in later sections.
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
|1
H
October 31, 2009
14:25
Quantum Lambda Calculus |y
137
|y⊕ f (x)
Uf |0
H
|x
|x
H
| f (0) ⊕ f (1)
Figure 4.1. The Deutsch-Jozsa algorithm
4.2.1 The Deutsch-Jozsa Algorithm Maybe the easiest example to interpret in the context of higher order is the DeutschJozsa algorithm (Deutsch and Jozsa 1992). In its simplest form, this algorithm decides whether a Boolean function f : bit → bit is balanced or constant. It does so by interacting with an encoding of f and uses this encoding only once (contrary to the classical case, where two calls to f are needed). The function f must be provided in the form of a unitary 2-qubit circuit U f , where U f (|x ⊗ |y) = |x ⊗ |y ⊕ f (x). The algorithm constructs and runs the circuit shown in Figure 4.1. It measures the indicated qubit and returns f (0) + f (1). As the Deutsch-Jozsa algorithm inputs a binary gate, which is a function of type qbit ⊗ qbit → qbit ⊗ qbit, and outputs a classical bit, its type is: (qbit ⊗ qbit → qbit ⊗ qbit) → bit. We note that the preparation of the encoding U f from the original Boolean function f is itself a higher-order function of type (bit → bit) → (qbit ⊗ qbit → qbit ⊗ qbit). However, this latter function must still call f twice (or else, it must examine the implementation of f , which is not allowed in the higher-order paradigm).
4.2.2 The Teleportation Procedure The teleportation algorithm (Bennett et al. 1993) is a procedure for sending a quantum bit in an unknown state |φ from a location A to a location B using two classical bits. The procedure can be reversed to send two classical bits using a quantum bit. In this case it is called the dense coding algorithm (Bennett and Wiesner 1992). The teleportation procedure is summarized in Figure 4.2. The parts 1, 2, and 3 can be described functionally as follows: (1) takes no input and outputs an EPR pair of entangled quantum bits. Its type is therefore → qbit ⊗ qbit. (2) performs a Bell measurement on two quantum bits and outputs two classical bits x, y. Its type is thus qbit ⊗ qbit → bit ⊗ bit. (3) performs a correction. It takes one quantum bit and two classical bits and outputs a quantum bit. It has a type of the form qbit ⊗ bit ⊗ bit → qbit.
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
138
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
qubit 1: |φ
qubit 3: |0
H
_ _
H
•
⊕
⊕
M
(2)
(1) qubit 2: |0
•
__
x,y
location A ED
location B
@A
Ux y
|φ
(3) Figure 4.2. Quantum teleportation protocol
If one curries1 parts 2 and 3, one gets two respective functions qbit → (qbit → bit ⊗ bit),
qbit → (bit ⊗ bit → qbit).
Tensoring them and composing with 1 yields a map → qbit ⊗ qbit → (qbit → bit ⊗ bit) ⊗ (bit ⊗ bit → qbit). That is, the teleportation algorithm produces a pair of entangled functions f : qbit → bit ⊗ bit,
g : bit ⊗ bit → qbit,
such that g( f (|φ)) = |φ for all qubits |φ, and f (g(x, y)) = (x, y) for all Booleans x and y. These two functions are each other’s inverse, but because they contain an embedded qubit each, they can only be used once. They can be said to form a “single-use isomorphism” between the (otherwise nonisomorphic) types qbit and bit ⊗ bit. Note that the two functions f and g are entangled, since they still share the created EPR pair. One can also identify the “location” of each function: f is located at B while g is located at A. The tensor “⊗” acts as “space-like” separation.
4.2.3 Bell’s Experiment Recall Bell’s experiment (Bell 1964). Two quantum bits A and B are created in the maximally entangled state |φ AB = √12 (|0 ⊗ |1 − |1 ⊗ |0). These qubits are sent to Alice and Bob, respectively. Suppose that Alice and Bob can independently 1
Consider a function of two arguments h : A × B → C. Currying h means building a function h : A → (B → C) as follows: h is the function that outputs the function x → h(a, x) when given the input a.
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
139
choose one of the following three bases {a, b, c} for measuring their qubit: √ √ 3 3 1 1 |1, |0c = |0 − |1, |0a = |0, |0b = |0 + 2 2 2 2 √ √ 3 3 1 1 |1a = |1 |1b = |0 − |1, |1c = |0 + |1. 2 2 2 2 The question is to compute the probability of obtaining the same output when measuring A and B with respect to each of the nine possible choices of a pair of bases. One can interpret this experiment in the context of higher-order quantum computation. First, the state preparation can be viewed as a map EPR : → qbit ⊗ qbit. Then each of Alice and Bob takes 1 qubit, chooses a basis, and measures: the measurement they perform is then a function f : qbit ⊗ trit → bit, where trit = {0, 1, 2} is a classical three-element type. One can curry this function to f : qbit → (trit → bit). The Bell experiment can be viewed as the composition EPR
f ⊗ f
−−→ qbit ⊗ qbit −−−→ (trit → bit) ⊗ (trit → bit), which produces a term of type (trit → bit) ⊗ (trit → bit), i.e., a pair f, g of entangled functions. Although this final type is purely classical, the Bell inequalities prove that there is no classical probabilistic pair of functions exhibiting the same behavior, namely, such that f (x) = g(y) with probability 1 if x = y, but with probability 1/4 if x = y.
4.3 Design of a Typed Quantum Lambda Calculus In this section, we describe the design of a lambda calculus for quantum computation in which one can, in particular, interpret the algorithms described in Section 4.2.
4.3.1 Terms We begin by defining a generic lambda calculus to support the following programming constructs: higher-order functions, tuples, disjoint unions, and recursive function definitions. Definition 4.3.1. We define a set of lambda terms by the following abstract syntax: M, N , P ::= c | x | λx.M | M N | M, N | ∗ | let x, y = M in N | inj l (M) | inj r (M) | match P with (x → M | y → N ) | let rec f x = M in N . Here, c ranges over a given set of term constants (to be instantiated later); the symbol x ranges over a fixed given infinite set of term variables.
P1: SBT CUUS834-04
cuus834-gay
140
978 0 521 51374 6
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
The intended meaning of the different terms is as follows. The term λx.M denotes the function x → M. For example, λx.x is the identity function. The term M N stands for the application of the function M to the argument N . The term M, N represents a pair, and ∗ is the unique 0-tuple. The term let x, y = M in N is the program that first evaluates M to compute a pair V, W , then assigns V to x and W to y before executing N . The terms inj l (M) and inj r (M) denote the left and right inclusion function of data into a disjoint union, whereas the term match P with (x → M | y → N ) evaluates P to an element of a disjoint union, and then proceeds by case distinction depending on whether P is of the form inj l (x) or inj r (y). Finally, the term let rec f x = M in N defines a recursive function f (x) = M before evaluating N . The notions of free and bound variables, of substitution, and of α-equivalence are defined in a standard way (see, e.g., Barendregt 1984). We identify terms up to renaming of bound variables, so for instance, λx.x and λy.y are regarded as equal. Convention 4.3.2. The set of terms defined in Definition 4.3.1 is somewhat spartan. Following common practice, we will use the following shorthand notations to make terms more readable: λx1 . . . xn .M = λx1 .λx2 . . . . λxn .M M1 M2 . . . Mn = (. . . ((M1 M2 )M3 ) . . . Mn ) M1 , . . . , Mn = M1 , M2 , . . . λx, y.M = λz.(let x, y = z in M) λ∗.M = λz.M
(where z is fresh),
let x = M in N = (λx.N )M let ∗ = M in N = (λz.N )M
(where z is fresh)
let f y1 . . . yn = M in N = let f = (λy1 . . . yn .M) in N let rec f x y1 . . . yn = M in N = let rec f x = (λy1 . . .yn .M) in N 0 = inj r (∗) 1 = inj l (∗) if P then M else N = match P with (x → M | y → N ) (where x, y are fresh) We now specify a set of term constants specific to quantum computation. The constants are: • new is a function for state preparation. It inputs a classical bit (i.e., 0 or 1 as defined in Convention 4.3.2) and outputs a quantum bit prepared in state |0 or |1, respectively. • meas is a function for measurement. It inputs a quantum bit, measures it in the standard basis {|0, |1}, and outputs the result as a classical bit.
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
141
• A set of constants U , ranging over some fixed universal set of unitary gates of varying arities. The set of constants can be expanded when it is convenient to do so, for example to include new language features. We make use of this prerogative in Section 4.5.1. Example 4.3.3. In this language, one can write lambda terms that compute quantum algorithms. For example, a fair coin can be implemented as c = λ∗. meas(H (new 0)), where H is the Hadamard gate. More examples are given in Section 4.3.4.
4.3.2 Types Clearly, not every term defined in Section 4.3.1 makes sense in every possible context. For example, the term M N only makes sense if M is a function; the term let x, y = M in N only makes sense when M is a pair; the term match P with (x → M | y → N ) only makes sense when P is a member of a disjoint union; and the term meas M only makes sense if M is a quantum bit. Moreover, a term such as λx.x, x only makes sense when x is a duplicable value, such as a classical bit, and not, for example, a quantum bit (which cannot be duplicated by the no-cloning theorem). As is common in programming languages, we define a type system to rule out terms that “don’t make sense.” An important feature of a static type system is that well-typedness can be checked when a term is written and not when it is executed. Another useful feature of some type systems is that types can be inferred automatically, rather than having to be explicitly specified by the programmer. As we will see, the type system we are about to introduce has all of the above properties. Informally, and as a first approximation, it is useful to think of a type as a set of values. For example, qbit is the set of all 1-qubit states, whereas bit is the set of classical Booleans. A ⊗ B is the set of (possibly entangled) pairs of an element of type A and and element of type B. is a singleton type, and A ⊕ B is the disjoint union of A and B. Since we are interested in higher-order computation, the functions from A to B also form a type, which we write as A B. Finally, we write ! A for the subset of values of type A that have the additional property of being reusable (i.e., duplicable, cloneable). The type system is based on intuitionistic linear logic (Girard 1987) and is formally defined as follows. Definition 4.3.4. The set of types for the quantum lambda calculus is given by the following abstract syntax. Type A, B ::= qbit | ! A | ( A B) | | (A ⊗ B) | ( A ⊕ B). We call the operator “!” the exponential.
P1: SBT CUUS834-04
cuus834-gay
142
978 0 521 51374 6
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
Table 4.1. Subtyping relation !n qbit <: !m qbit
(qbit),
!n <: !m
(),
A1 <: B1 A2 <: B2 A <: A B <: B (), (⊗), n !n (A1 ⊗ A2 ) <: !m (B1 ⊗ B2 ) ! (A B) <: !m (A B ) A1 <: B1 A2 <: B2 (⊕). !n (A1 ⊕ A2 ) <: !m (B1 ⊕ B2 )
Convention 4.3.5. We write !n A for !!! . . .!!A, with n repetitions of !. We also use the notation A⊗n for the n-fold tensor product A ⊗ . . . ⊗ A = (. . . (A ⊗ A) . . . ⊗ A). Similarly, we write A⊕n for the n-fold sum: A ⊕ . . . ⊕ A = (. . . ( A ⊕ A) . . . ⊕ A). Finally, we use the shorthand notation bit = ⊕ . When it is convenient, the set of types can be extended to support new language features. For example, in Section 4.5.1, we define a type list( A) of list of elements of type A.
4.3.3 Typing Rules We have stated informally that ! A is the set of values of type A that have the additional property of being reusable. Consequently, any term that has type ! A should automatically also have type A. We say that !A is a subtype of A. The concept of a subtype also extends to composite types, for instance, any function of type A B that can accept an argument of type A can also accept a re-usable argument of type A. Therefore, A B is a subtype of !A B. This motivates the following definition: Definition 4.3.6. We define the subtyping relation <: to be the smallest relation on types satisfying the rules in Table 4.1, using the overall condition on n and m that (m = 0) ∨ (n 1). Note that the rules in Table 4.1 should be read as follows: if the premises (above the horizontal line) are all true, then the conclusion (below the horizontal line) is true. Lemma 4.3.7. The subtyping relation <: is reflexive and transitive. Lemma 4.3.8. If A <: !B, then A = ! A for some type A . Dually, if A is not of the form !A and if A <: B, then B is not of the form !B . The purpose of the type system is to assign a (not necessarily unique) type to each well-formed term, with the goal that a well-typed term can never perform an
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
143
Table 4.2. Typing rules A <: B (ax 1 ) , x : A x : B M : !n A (⊕.I1 ) inj l (M) : !n (A ⊕ B)
!Ac <: B (ax 2 ) c:B N : !n B (⊕.I2 ) inj r (N ) : !n (A ⊕ B)
!, 2 , x : !n A M : C !, 1 P : ! (A ⊕ B) !, 2 , y : !n B N : C n
1 , 2 , ! match P with (x → M | y → N ) : C
(⊕.E)
1 , ! M : A B 2 , ! N : A (app) 1 , 2 , ! M N : B x : A, M : B (λ1 ) λx.M : A B
If F V (M) ∩ || = ∅: , !, x : A M : B , ! λx.M : !n+1 (A B)
!, 1 M1 : !n A1 !, 2 M2 : !n A2 (⊗.I ) !, 1 , 2 M1 , M2 : !n (A1 ⊗ A2 )
(λ2 )
∗ : !n
()
!, 1 M : !n (A1 ⊗ A2 ) !, 2 , x1 :!n A1 , x2 :!n A2 N : A (⊗.E) !, 1 , 2 let x1 , x2 = M in N : A !, f : !(A B), x : A M : B !, , f : !(A B) N : C (rec) !, let rec f x = M in N : C
illegal operation. We write M : A to indicate that the term M is well-typed of type A. In general, it is not sufficient to reason about judgments of the form M : A, because the well-typedness of a term M also depends on the types of all of the free variables that appear in M. We therefore introduce the notion of a typing context. Definition 4.3.9. A typing context is a finite set {x1 : A1 , . . . , xn : An } of pairs of a variable and a type, such that no variable occurs more than once. We often write for a typing context, and we write || = {x1 , . . . , xn } and (xi ) = Ai . We also write ! for a context of the form {x1 : !A1 , . . . , xn : !An }. If || and | | are disjoint, we write , for the union of two typing contexts. Moreover, we extend the subtyping relation to contexts as follows. We write <: if and only if || = | | and for all x ∈ ||, (x) <: (x). Definition 4.3.10. A typing judgment is an expression of the form M : B, where is a typing context, M is a term, and B is a type. A typing derivation is called valid if it can be inferred from the rules in Table 4.2. In the table, the symbol c ranges over the set of term constants {meas, new , U }. To each constant c we associate a type Ac , as follows: Anew = bit qbit,
AU = qbit ⊗n qbit ⊗n ,
Ameas = qbit !bit.
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
144
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
Lemma 4.3.11. The following are derived rules: 0 : !n bit,
(bit.I1 )
1 : !n bit,
(bit.I2 )
!, 1 P : bit !, 2 M, N : A (bit.E) !, 1 , 2 if P then M else N : A. Proof. The proof is straightforward using the typing rules and Conventions 4.3.2 and 4.3.5. Remark 4.3.12. The type !Ac is understood as being the “most generic” one for c, as enforced by the typing rule (ax 2 ). For example, we defined Anew to be bit qbit. Since by the rule (ax 2 ), new can take any type B such that !Ac <: B, the term new can be typed with any type in the following poset: cc<:cc !(!bit qbit) [[<:[[[ !(bit qbit) [[<:[[[ ccc<:ccc !bit qbit. bit qbit This implies, as expected, that no created quantum bit can have the type !qbit. Remark 4.3.13. Note that the type system enforces the requirement that variables holding quantum data cannot be freely duplicated; thus λx.x, x is not a valid term of type qbit qbit ⊗ qbit. On the other hand, we allow variables to be discarded freely. Note also that due to rule (λ2 ) the term λx.M is duplicable only if all the free variables of M (other that x) are duplicable. This answers the question, raised in the introduction, what it means for a higher-order function to be “classical.” A function is classical (and therefore reusable) if and only if it does not contain any embedded nonduplicable data. This definition is of course recursive, in a way that is made precise by the typing rules.
4.3.4 Examples Example 4.3.14. The term c = λ∗. meas(H (new 0)) of Example 4.3.3 can be typed as c : bit. Example 4.3.15. Consider the term M = let rec f x = (if (c ∗) then H ( f x) else x) in f p, where c is the fair coin of Example 4.3.14. Intuitively, this term applies the Hadamard gate a random number of times to a qubit p. We claim that p : qbit M : qbit is a valid typing judgment. Indeed, assuming that c : bit is a valid typing judgment, one can write the following typing derivation: 1
(ax 1 )
f : !(qbitqbit), x : qbit x : qbit
2
()
!(qbitqbit) <: qbit qbit
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
3
(2, ax1 )
f : !(qbitqbit) f : qbit qbit
4
(3, 1, app)
f : !(qbitqbit), x : qbit ( f x) : qbit
5
(2, ax 2 )
H : qbit qbit
6
(5, 4, app)
f : !(qbitqbit), x : qbit H ( f x) : qbit
7
(Ex.4.3.14)
c : bit
8
(.I )
∗:
9
(7, 8, app)
c ∗ : bit
10
(9, 6, 1, if )
f : !(qbitqbit), x : qbit
145
if (c ∗) then H ( f x) else x : qbit 11
(ax 1 )
p : qbit p : qbit
12
(3, 11, app)
p : qbit, f : !(qbit qbit) f p : qbit
13
(10, 12, rec)
p : qbit let rec f x = if (c ∗) then H ( f x) else x in f p : qbit
Here, we have used the notation (x, y, z, R) for “The rule R is used with hypothesis lines x, y and z.” The rule () refers to Table 4.1. Example 4.3.16. Consider the Deutsch-Jozsa algorithm introduced in Section 4.2.1. We claimed that one can interpret it as a term of type (qbit ⊗ qbit qbit ⊗ qbit) → bit. Here is an implementation in the quantum lambda calculus, using the notations of Convention 4.3.2: let Deutsch U f = let tens f g = λx, y. f x, gy in let x, y = (tens H (λx.x))(U f H (new 0), H (new 1)) in meas x, One can check that Deutsch : !((qbit ⊗ qbit qbit ⊗ qbit) bit) is a well-typed typing judgment. Note that Deutsch is duplicable, and that U f does not need to be duplicable, since it is used only once. Example 4.3.17. The teleportation algorithm can similarly be defined. Part 1 is the function EPR : !( (qbit ⊗ qbit)), defined as EPR = λx.CNOT H (new 0), new 0. Part 2 is the function BellMeasure : !(qbit (qbit bit ⊗ bit)), defined as BellMeasure = λq2 .λq1 .(let x, y = CNOT q1 , q2 in meas(H x), meas y).
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
146
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
Part 3 is the function U : !(qbit (bit ⊗ bit qbit)) defined as U = λq.λx, y.if x then (if y then U11 q else U10 q) else (if y then U01 q else U00 q). The teleportation procedure as described in Section 4.2.2 can be written with the following code: telep = let x, y = EPR ∗ in let f = BellMeasure x in let g = U y in f, g. It can then be shown that telep : (qbit bit ⊗ bit) ⊗ (bit ⊗ bit qbit) is a valid typing judgment (for details, see Selinger and Valiron 2006).
4.3.5 The Evaluation of Terms: Operational Semantics So far, we have concentrated on the static properties of lambda terms and have only informally described their intended behavior. In this section, we present the formal computation rules by which terms are evaluated. Our informal description of the behavior of lambda terms has left many details undefined. For example, when evaluating a pair of terms M, N , we have not specified whether M or N will be evaluated first. Similarly, in terms such as let x = M in N , we have not specified whether M should be evaluated immediately, or whether it should be re-evaluated each time the term N needs to access the value of the variable x. Such seemingly arbitrary choices actually can affect the outcome of the computation, as the following example shows. Example 4.3.18. Consider the Boolean addition function, defined as plus = λx y.if x then (if y then 0 else 1) else (if y then 1 else 0). Now consider the term let x = c ∗ in plus x x, where c is the fair coin from Example 4.3.3. If we evaluate c ∗ each time the variable x is needed, we obtain plus(c ∗)(c ∗), which will be 0 or 1 with equal probability. On the other hand, if we evaluate c ∗ ahead of time, we obtain either plus 0 0 or plus 1 1, and in either case the final answer is 0. The former evaluation method is called the call-by-name method, and the latter is called the call-by-value method. One of the reasons we give a formal definition of the behavior of lambda terms is to resolve such imprecisions. Thus, we will have to make a specific choice in each instance where an ambiguity might arise. For example, we will be choosing
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
147
the call-by-value reduction strategy. Another reason for making a formal definition is that this will allow us to prove meta-theorems about the behavior of quantum lambda terms. For example, we will prove in Section 4.3.7 that a well-typed lambda term never executes an illegal operation such as attempting to clone a quantum bit. Definition 4.3.19. A quantum closure (or state) is a tuple [Q, L , M], where n • Q is a normalized vector of ⊗i=1 C2 , for some integer n 0. The vector Q is called the quantum array; • L is a list of n distinct term variables, written as |x1 , . . . , xn . • M is a lambda term whose free variables all appear in L.
We write |L| = {x1 , . . . , xn }, and we also write L(xi ) = i for the position of a variable xi in the list. The purpose of a quantum closure is to provide a mechanism to talk about terms with embedded quantum data. The idea is that the variable xi is bound in the term M to qubit number L(xi ) of the state Q. So for example, the quantum closure 1 [ √ (|00 + |11), 2
| pq,
λx.x pq]
denotes a term λx.x pq with two embedded qubits p, q in the entangled state | pq = √12 (|00 + |11). The notion of α-equivalence extends naturally to quantum closures; for instance, the states [Q, |x, λy.x] and [Q, |z, λy.z] are equivalent. We identify quantum closures up to renaming of bound variables. The evaluation of quantum lambda terms will be defined as a probabilistic rewrite procedure on quantum closures, using a call-by-value reduction strategy. Definition 4.3.20. A value is a term defined with the following grammar: Value V, W ::= c | x | λx.M | inj r V | inj l V | ∗ | V, W The quantum closure [Q, L , V ] is called a value state if V is a value. Definition 4.3.21. The reduction rules are shown in Tables 4.3 through 4.5. We write [Q, L , M] → p [Q , L , M ] for a single-step reduction of quantum closures that takes place with probability p. In the rules for let, let rec, and match, M[V /x] denotes the term M where the free variable x has been replaced by V (renaming bound variables as necessary). In the rule for reducing the term U x j1 , . . . , x jn , U is an n-ary built-in unitary gate, j1 , . . . , jn are pairwise distinct, and Q is the quantum state obtained from Q by applying this gate to qubits j1 , . . . , jn . In the rule for measurement, |Q 0 and |Q 1 are normalized states of the form |Q 0 = α j |φ 0j ⊗ |0 ⊗ |ψ 0j , |Q 1 = β j |φ 1j ⊗ |1 ⊗ |ψ 1j , j
j
P1: SBT CUUS834-04
cuus834-gay
148
978 0 521 51374 6
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
Table 4.3. Reductions rules: classical control [ Q, L , let x = V in M ] →1 [ Q, L , M[V /x] ] [ Q, L , let x, y = V, W in N ] →1 [ Q, L , N [V /x, W/y] ] [ Q, L , match inj l (V ) with (x → M | y → N ) ] →1 [ Q, L , M[V /x] ] [ Q, L , match inj r (W ) with (x → M | y → N ) ] →1 [ Q, L , N [W/y] ] [ Q, L , let rec f x = M in N ] →1 [ Q, L , N [λx.(let rec f x = M in M) / f ] ]
Table 4.4. Reductions rules: quantum data [ Q, |x1 . . . xn , U x j1 , . . . , x jn ] →1 [ Q , |x1 . . . xn , x j1 , . . . , x jn ] [ α|Q 0 + β|Q 1 , |x1 . . . xn , meas xi ] →|α|2 [ |Q 0 , |x1 . . . xn , 0 ] [ α|Q 0 + β|Q 1 , |x1 . . . xn , meas xi ] →|β|2 [ |Q 1 , |x1 . . . xn , 1 ] [ Q, |x1 . . . xn , new 0 ] →1 [ Q ⊗ |0, |x1 . . . xn+1 , xn+1 ] [ Q, |x1 . . . xn , new 1 ] →1 [ Q ⊗ |1, |x1 . . . xn+1 , xn+1 ]
Table 4.5. Reductions rules: congruence rules [ Q, L , N ] → p [ Q , L , N ] [ Q, L , M N ] → p [ Q , L , M N ] [ Q, L , M ] → p [ Q , L , M ] [ Q, L , M V ] → p [ Q , L , M V ] [ Q, L , M2 ] → p [ Q , L , M2 ] [ Q, L , M1 , M2 ] → p [ Q , L , M1 , M2 ] [ Q, L , M1 ] → p [ Q , L , M1 ] [ Q, L , M1 , V2 ] → p [ Q , L , M1 , V2 ] [ Q, L , M ] → p [ Q , L , M ] [ Q, L , inj l (M) ] → p [ Q , L , inj l (M ) ] [ Q, L , M ] → p [ Q , L , M ] [ Q, L , inj r (M) ] → p [ Q , L , inj r (M ) ] [ Q, L , P ] → p [ Q , L , P ] [ Q, L , match P with . . . ] → p [ Q , L , match P with . . . ] [ Q, L , M ] → p [ Q , L , M ] [ Q, L , let x, y = M in N ] → p [ Q , L , let x, y = M in N ]
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
149
where φ 0j and φ 1j are i-qubit states (so that the measured qubit is the one pointed to by xi ). In the rule for new, Q is an n-qubit state, so that Q ⊗ |i is an (n + 1)-qubit state. We write → for the reduction →1 , and →∗ for the reflexive, transitive closure of →. Note that the only probabilistic reduction step is the one corresponding to measurement. Example 4.3.22. Consider the term M = let rec f x = (if (c ∗) then H ( f x) else x) in f p from Example 4.3.15. Let us write P = if (c ∗) then H ( f x) else x R = let rec f x = P in P. We have M → [ |0, | p, ( f p)[λx.R / f ] ] → [ |0, | p, (λx.R) p ] → [ |0, | p, let rec f x = P in (if (c ∗) then H ( f p) else p) ] → [ |0, | p, (if (c ∗) then H ( f p) else p)[λx.R / f ] ] → [ |0, | p, if (c ∗) then H ((λx.R) p) else p ] = [ |0, | p, if (meas(H (new 0))) then H ((λx.R) p) else p ] → [ |00, | pq, if (meas(H q)) then H ((λx.R) p) else p ] 1 → [ √ (|00 + |01), | pq, if (meas q) then H ((λx.R) p) else p ] 2 [ |00, | pq, if 0 then H ((λx.R) p) else p ] → [ |01, | pq, if 1 then H ((λx.R) p) else p ] [ |00, | pq, p ] → [ |01, | pq, H ((λx.R) p) ] [ |00, | pq, p ] → [ |01, | pq, H (letrec f x = P in if (c ∗) then H ((λx.R) p) else p) ] [ |00, | pq, p ] →∗ [ √12 (|010 + |011), | pqr , H if (meas r ) then H ((λx.R) p) else p ] [ |00, | pq, p ] → [ |010, | pqr , H if 0 then H ((λx.R) p) else p ] [ |011, | pqr , H if 1 then H ((λx.R) p) else p ]
P1: SBT CUUS834-04
cuus834-gay
150
978 0 521 51374 6
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
[ |00, | pq, p ] → [ |010, | pqr , H p ] [ |011, | pqr , H (H ((λx.R) p)) ] [ |00, | pq, p ] [ √1 (|010 + |110), | pqr , p ] 2 →∗ [ |0110, | pqr s, H (H p) ] [ |0111, | pqr s, H (H (H ((λx.R) p))) ] [ |00, | pq, p ] 1 [ √2 (|010 + |110), | pqr , p ] ∗ → [%|0110, | pqr s, p ] 1 [ √2 (|01110 + |11110), | pqr st, p ] ··· where each split occurs with probability 12 , and where the result is read as the term part of the value state. On average, the term M reduces to |0 with probability ∞ 1 1 1 1 2 = = 1 2n 2 n=0 2 2 1− 4 3 and to √12 (|0 + |1) with probability 13 . Note that since there is no garbage collection, the quantum array is filled up with unused quantum bits. It is possible to define an operational semantics that removes unused quantum bits (see, e.g., Selinger and Valiron 2008b). Remark 4.3.23 (Error states). The purpose of the reduction rules is to evaluate a quantum closure until a value state is reached. However, this does not always succeed: there are states (so-called error states) that are not values, but from which no reduction is possible. Such states correspond to runtime errors of the programming language (and in actual implementations, these would lead either to runtime error messages or to undefined behavior). Examples of error states are the quantum closures [Q, L , let x, y = inj l (M) in N ], [Q, L , meas(λx.x)], and [Q, |x yz, U x, x]. In Sections 4.3.2 and 4.3.3, we introduced a type system precisely for the purpose of ruling out such error states. And indeed, we will show in Section 4.3.7 that well-typed closure can never lead to an error state.
4.3.6 Properties of the Type System Before we can prove type soundness of the reduction rules, we need to record some basic properties of the type system. Lemma 4.3.24. (1) If x ∈ FV (M) and , x : A M : B, then M : B. (2) If M : A, then , M : A. (3) If <: and M : A and A <: B, then M : B.
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
Quantum Lambda Calculus
Proof. By structural induction on the type derivation of M.
14:25
151
The next lemma is crucial in the proof of the substitution lemma. Note that it is only true for a value V , and in general fails for an arbitrary term M. Lemma 4.3.25. If V is a value and V : !A, then for all x ∈ FV (V ), there exists some type B such that (x) = !B. Conversely, if FV (V ) = || and if !, V : A is valid, so is !, V : !A. Proof. By structural induction on V .
Lemma 4.3.26 (Substitution). If V is a value such that 1 , !, x : A M : B and 2 , ! V : A, then 1 , 2 , ! M[V /x] : B. Proof. By structural induction on the derivation of the typing judgment 1 , !, x : A M : B, using Lemma 4.3.24. In the case (λ2 ), one uses Lemma 4.3.25. Remark 4.3.27. Those readers familiar with intuitionistic linear logic (Girard 1987; Troelstra 1992) may note that all the rules of affine intuitionistic logic are derived rules of our type system, except for the general promotion rule ! M : A ! M : !A. The absence of this rule is necessary: indeed, although the typing judgment new 0 : qbit is valid, the judgment new 0 : !qbit should not be allowed. However, as stated in Lemma 4.3.25, the promotion rule is true if M is a value. This point is further developed in Section 4.6 when we study the categorical semantics.
4.3.7 Safety Properties In this section, we wish to show that a well-typed program cannot reach an error state. We first define what it means for a quantum closure to be well-typed: Definition 4.3.28. Consider the quantum closure [ Q, L , M ] where L = |x1 . . . xk . We say that [ Q, L , M ] is well-typed (or valid) of type C, written [ Q, L , M ] : C, if x1 : qbit, . . . , xk : qbit M : C is a valid typing judgment. A well-typed quantum closure is also called a program. The first step in proving type safety is to show that well-typedness is preserved by the reduction rules. This property is known as the subject reduction property. In order to get the strongest possible result, we prove that type safety holds even in the presence of decoherence and imprecision of the physical operations. To that end, we define a notion of reachability of quantum closures that includes reduction steps of probability 0, as well as arbitrary perturbations of the quantum state. Definition 4.3.29. The reachability relation is the smallest transitive reflexive relation on quantum closures such that [Q, L , M] [Q , L , M ] holds whenever
P1: SBT CUUS834-04
cuus834-gay
152
978 0 521 51374 6
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
[Q, L , M] → p [Q , L , M ] with some probability p (even for p = 0), and such that [Q, L , M] [Q , L , M] whenever Q is a normalized vector of dimension equal to that of Q. Theorem 4.3.30 (Subject reduction). Suppose [ Q, L , M ] : A and [ Q, L , M ] [ Q , L , M ]. Then [ Q , L , M ] : A. Proof. Since well-typedness is defined without reference to Q, it suffices to show that if [ Q, L , M ] : A and if [ Q, L , M ] → p [ Q , L , M ], then [ Q , L , M ] : A. This is proved by induction on the derivation of the reduction, using Lemma 4.3.26 in the “let,” “let rec,” and “match” cases. We detail one of the less immediate cases, the case let rec. Suppose that .. .. .. π1 .. π2 !, f : !(A B), x : A M : B !, , f : !(A B) N : C !, let rec f x = M in N : C is a valid derivation. Then so is .. .. .. π1 .. π1 !, f : !(A B), x : A M : B !, f : !(A B), x : A M : B !, x : A let rec f x = M in M : B ! λx.(let rec f x = M in M) : !(A B). By Lemma 4.3.26, one concludes !, N [λx.(let rec f x = M in M) / f ] : C. Lemma 4.3.31. A well-typed value is a constant, a variable, or one of the following cases occurs: if it is of type !n ( A ⊕ B), it is of the form inj l (V ) or inj r (V ) with V a value; if it is of type !n ( A ⊗ B), it is of the form V, W with V and W values; if it is of type !n , it is precisely the term ∗; if it is of type !n ( A B), it is a lambda-abstraction. Proof. By structural induction on the derivation of the typing judgment.
Theorem 4.3.32 (Progress). Let [ Q, L , M ] be a program of type B. Then either [ Q, L , M ] is a value state, or there is a program [ Q , L , M ] such that [ Q, L , M ] → p [ Q , L , M ]. Moreover, the total probability of all possible single-step reductions from [ Q, L , M ] is 1. Proof. By structural induction on the derivation of the reduction of [ Q, L , M ], using Lemma 4.3.31. Corollary 4.3.33 (Type safety). A well-typed program does not reach an error state. In particular, any probabilistic computation path of a well-typed program either is infinite or reaches a value state in a finite number of steps.
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
153
Remark 4.3.34. The evaluation rules of the quantum lambda calculus were defined on untyped quantum closures. This is in line with our remark, in Section 4.3.2, that well-typedness is a property to be checked when a term is written, and not when it is executed. In other words, once it is established that a term is well-typed, it can be safely executed, without further well-typedness checks at runtime, and the type safety property guarantees that there will be no errors. In particular, the type system introduces no computational overhead in the evaluation of terms.
4.3.8 Design Choices and Some Related Work We briefly discuss some of the design decisions underlying our quantum lambda calculus. Classical control. Our quantum lambda calculus has classical control, by which we mean that it essentially fits into the QRAM paradigm of quantum computing (Knill 1996). This means that, while programs operate on quantum data, the programs themselves are classical. For example, we do not allow superpositions of two arbitrary lambda terms. Van Tonder (2004) gives convincing evidence that this choice is essentially necessary. Call-by-value reduction. We have equipped the quantum lambda calculus with a call-by-value reduction strategy, which means that the arguments to any function call are completely evaluated before the function is called. This is in contrast to call-by-name or lazy languages, which evaluate the arguments only if they are actually needed. Example 4.3.18 shows that it is necessary to choose a reduction strategy; the actual choice is largely a matter of taste. Uniformity of data. Our language treats classical and quantum data uniformly. This means that we do not have, for example, distinct sets of classical variables and quantum variables. For example, we use the same syntax for a function, regardless of whether the function accepts a classical argument, a quantum argument, or indeed a more complex object (such as a pair of a classical bit and a quantum bit). We use a type system to ensure well-formedness of programs. Implicit linearity tracking. Perhaps the most important choice that we have made, which distinguishes the quantum lambda calculus from other linear lambda calculi in the literature, is that there is no explicit syntax for linearity in the untyped language. This was motivated by the desire to design a language for practical use, which would be as natural as possible to the programmer. The literature contains a number of lambda calculi for intuitionistic linear logic. For example, the linear lambda calculi of Abramsky (1993) and Benton and colleagues (Benton et al. 1993b; Benton 1995; Benton and Wadler 1996) have typing rules such as M : !A derelict(M) : A
M : !A , x : !A, y : !A N : B , copy M as x, y in N : B
M : !A N :B , discard M in N : B
P1: SBT CUUS834-04
cuus834-gay
154
978 0 521 51374 6
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
This means, if one has a variable x of duplicable type ! A and one wants to use this variable twice, then one must write copy x as x1 , x2 in f (derelict(x1 ), derelict(x2 )), whereas in the quantum lambda calculus, we would simply write f (x, x). Our syntax is less faithful to the inference rules of intuitionistic linear logic. For example, the term f (g(x, x)) in the quantum lambda calculus could ambiguously refer to either of the following two terms in the language of Benton et al.: copy x as x 1 , x2 in f (g(derelict(x1 ), derelict(x2 ))), or f (copy x as x1 , x2 in g(derelict(x1 ), derelict(x2 ))). Our point of view is that this apparent ambiguity does not matter from a practical point of view, because the two terms will compute precisely the same thing. Therefore, the programmer should not have to worry about such details as the precise time of the duplication of a particular value. While this makes programming in the quantum lambda calculus simpler, it leads to a more complicated metatheory. Some of the technical complications are as follows: We need to introduce a subtyping relation, which complicates the proofs of type soundness. Also, because of the foregoing ambiguities, typing derivations are not unique in the quantum lambda calculus, which means that we have to work harder to prove that the meaning of terms is independent of the typing derivation used (see Theorem 4.6.30 later). Ultimately, we feel that this is a worthwhile tradeoff, as the more complicated metatheory can be settled once and for all. Moreover, it is reassuring to know that type checking, including checking of linearity constraints, can be completely automated by a type inference algorithm (see Section 4.4), so that the slightly more complicated type system does not result in a burden to the programmer. Type isomorphisms. In our formulation of the quantum lambda calculus, we have a type isomorphism !!A ∼ = ! A, which is not valid, e.g., in Benton’s system. This is a necessary consequence of our choice of implicit linearity tracking, as a value of type ! A can be used with type !!A and vice versa. For similar reasons, we have a type isomorphism !( A ⊗ B) ∼ = !A ⊗ !B, which is not valid in general linear logic. This is because in the quantum lambda calculus, a pair x, y of type A ⊗ B is duplicable if and only if x and y are duplicable. Copying versus cloning. Altenkirch and Grattage (2005) have described a quantum programming language where implicit copying of quantum data is allowed, but is interpreted as creating an entangled pair, rather than as cloning. This, however, requires an explicit operation for discarding unused data, similar to Benton et al.’s “discard” operation.
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
155
Table 4.6. Partial ordering of some possible types of λ f x. f x
/ (X Y )(X Y ) RRRR SSSS R( S) / !(X Y )(X Y ). !(!(X Y )(X Y )) k5 l6 kkkk llll / !(X Y )!(X Y ) !(!(X Y )!(X Y )) !((X Y )(X Y ))
4.4 Type Inference Algorithm When writing programs in the quantum lambda calculus, it is an important task, as we have seen in the previous section, to check that the program is well-typed. One way to ensure this would be to require the programmer to supply all type information. This means that the programmer would have to explicitly state the type of every variable and subexpression used in the program. In practice, this is quite cumbersome, as the types can be long and error-prone to write and make the program hard to read. Fortunately, the process can be automated. A type inference algorithm is an algorithm that inputs an untyped quantum closure and either outputs a possible type for it, or else announces that no such type exists. When a type inference algorithm exists, the programmer is free to write terms in an untyped way and can rely on the type inference algorithm to point out any potential safety problems. In “classical” lambda calculus, there exists a well-known type inference algorithm (for a reference, see, e.g., Pierce 2002), which is based on the fact that every term admits a principal type. A type is principal among the possible types of a term if any other possible type can be obtained from it by instantiation of type variables. For example, in simply typed lambda calculus, the term M = λ f x. f x admits a principal type of the form (X ⇒ Y ) ⇒ (X ⇒ Y ). Here, X and Y are type variables, and any valid type of M, such as (A ⇒ (B ⇒ A)) ⇒ (A ⇒ (B ⇒ A)), can be obtained by substituting particular types for X and Y . The quantum lambda calculus of this chapter does not satisfy the principal type property. The main complication is the subtyping relation <:, which allows a term to possess multiple types that are not instances of each other. Indeed, consider again the term M = λ f x. f x. Naively, a principal type would be (1) the most general with respect to instantiation of type variables, and (2) the smallest with respect to the subtyping relation. Here are some possible types for M, ordered by the subtyping relation (from left to right) as shown in Table 4.6. Note that the types !((X Y ) !(X Y )) and (X Y ) !(X Y ) are not valid for the term M. Therefore, there is no smallest element in the set of possible types for M. Despite the absence of principal types, it is nevertheless possible to find a type inference algorithm for the quantum lambda calculus. The idea is to proceed in two steps: first, find the principal type derivation for M in a simply typed version of the language (i.e., without the operator !, and without any restriction on duplication). Second, try to “annotate” this type derivation by putting “!” in the
P1: SBT CUUS834-04
cuus834-gay
156
978 0 521 51374 6
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
smallest possible number of locations to satisfy the constraints of the linear type system. It was shown in Valiron (2004a) that this algorithm succeeds if and only if the term M is typable in the quantum lambda calculus. We refer the reader to Valiron (2004a) and Selinger and Valiron (2006) for the full discussion.
4.5 Extending the Language with an Infinite Data Type For a computational formalism to be fully expressive, it must be able to operate on data of unlimited size. For example, in the quantum circuit model, an algorithm is not given by a single quantum circuit, but rather by a uniform family of circuits, one for each possible size of input. In the form given in Section 4.3, the quantum lambda calculus is only able to operate on finite-dimensional data, and therefore it is not universal for quantum, or even classical, computation. This situation can be easily remedied by adding an unbounded data type, such as a type of lists. We describe such an extension in Section 4.5.1, and then illustrate its use in Section 4.5.2 with the quantum Fourier transform on an unbounded number of qubits.
4.5.1 The Type list (A) The notion of a list can be easily defined recursively: a list of objects of type A is the empty list, or else it is a pair consisting of a head of type A and a tail that is another list of objects of type A. Therefore, if list( A) is the type of lists of elements of type A, then the following recursive equation is satisfied: list( A) = ⊕ ( A ⊗ list( A)). To add such list types to the quantum lambda calculus, we extend: • The type formation rules: whenever A is a type, then list( A) is a type; • The term formation rules: we add three term constructors cons(M, N ), nil , and unfold (M); • The typing rules: we add three new rules !, 1 M : !n A !, 2 N : !n list( A) !, 1 , 2 cons(M, N ) : !n list( A), !, 1 , 2 nil : !n list( A),
(list.I1 )
(list.I2 )
M : !n list( A) (list.E) unfold A (M) : !n ((!) ⊕ ( A ⊗ list( A))); • The reduction rules: [ Q, L , unfold nil ] →1 [ Q, L , inj l (∗) ], [ Q, L , unfold (cons(V, W )) ] →1 [ Q, L , inj r V, W ],
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
157
and the congruence rules: [ Q, L , N ] →1 [ Q, L , N ] [ Q, L , cons(M, N ) ] →1 [ Q, L , cons(M, N ) ] [ Q, L , M ] →1 [ Q, L , M ] [ Q, L , cons(M, V ) ] →1 [ Q, L , cons(M , V ) ] [ Q, L , M ] →1 [ Q, L , M ] [ Q, L , unfold (M) ] →1 [ Q, L , unfold (M ) ] Note that a list is duplicable only if all of its elements are duplicable. In particular, a list of quantum bits is duplicable only if it is empty. Remark 4.5.1. The extended language still satisfies the safety properties described in Theorems 4.3.30 and 4.3.32. Moreover, since the principal type property still applies for intuitionistic types in this context, the type inference algorithm can be extended to this situation.
4.5.2 Implementing the Quantum Fourier Transform From the list type, we can define a data type of natural numbers Nat = list(). Then we define the closed terms succ : Nat Nat and two : Nat as follows: let succ n = cons(∗, n),
let two = succ (succ nil ).
Assume that rn : Nat (qbit ⊗ qbit qbit ⊗ qbit) is a term such that rn n computes the gate
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0
. n
e2πi/2
Then one can define the term rotate : qbit qlist Nat (qbit ⊗ qlist): let rec rotate h t n = match unfold (t) with x → nil b → let x, y = b in let x, h = (rn n) x, h in let h, y = rotate h y (succ n) in h, cons(x, y),
P1: SBT CUUS834-04
cuus834-gay
158
978 0 521 51374 6
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
and the term QFT : qlist qlist: let rec QFT l = match unfold (l) with x → nil b → let h, t = b in let h, t = rotate h t two in let t = QFT t in cons(h, t). The QFT term implements the quantum Fourier algorithm but does not reverse the order of the qubits in the output list. Reversing the order of the elements in a list can be efficiently implemented as a map rev : list(A) list(A), defined using an auxiliary map aux : list( A) ⊗ list(A) list(A): let rec aux l1 l2 = match unfold (l1 ) with x → l2 b → let x, y = b in aux y cons(x, l2 ), let rev l = aux l nil . Note that these functions are linear: the function rev can therefore be used to reverse the order of a list of quantum bits to implement the end of the QFT algorithm. Remark 4.5.2. Unlike the examples of Section 4.2, the implementation of the quantum Fourier transform does not use higher-order structures.
4.6 Categorical Semantics In this section, we present some more advanced material on categorical models for the quantum lambda calculus. The mathematical area of category theory (Mac Lane 1971) is well suited for the study of programming languages, as it reveals the structure of programming language features, such as higher-order functions, computational effects, or linearity, at a more abstract level. For example, there is a well-known connection between higher-order functions and the theory of cartesian-closed categories (Lambek and Scott 1986). Moggi (1991) has given a general theory of computational effects (such as probabilistic programs) in terms of the categorical concept of a strong monad. Finally, Seely (1989), Bierman (1993), and Benton et al. (1993b,a) have given categorical models of linear logic. In this section, we show how to combine these models to obtain a categorical description of the higher-order probabilistic linear features of the quantum lambda calculus. Categorical semantics is fundamentally a theory of equations between programs. In investigating the equational theory of the quantum lambda calculus, we find that the equations can be divided into two classes: structural equations, such
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
159
as (λx.M)V = M[V /x], which derive from the higher-order type and term constructors, and ground equations, such as meas(H (H (new 0))) = 0, which encode special properties of the chosen set of elementary operators. The ground operations for quantum computation are already well understood: they are given by state preparation, unitary operations, and measurements, and they satisfy precisely the equations that hold in the usual formalism of finite-dimensional Hilbert spaces, density matrices, and superoperators (see, e.g., Selinger 2004). In constructing a concrete model for a programming language, one usually first focuses on the structural equations, i.e., without fixing a particular set of ground operations. This allows one to identify a whole class of categories that possess the required higher-order structure. In a second step, one may then look for a particular member of this class of categories that also supports the required ground operations. Have we focus exclusively on the first step, i.e., we work relative to an unspecified but fixed set of ground types (denoted α), ground operations (denoted c), and ground equations. The construction of a concrete model of higher-order quantum computation, i.e., a specific model that supports both the ground operations and the higher-order structure, is an open problem. To keep the presentation reasonably simple, we restrict ourselves to the subset of the quantum lambda calculus without union types or recursive function definitions. We call this the “core fragment” of the quantum lambda calculus. The results presented here can be easily extended to the full language.
4.6.1 Equational Description of the Core Fragment Definition 4.6.1. The core fragment of the linear lambda calculus is defined as follows: Type A, B ::= α | ! A | A B | | A ⊗ B Value V
::= x | c | ∗ | λx.M | V, V ,
Term M, N ::= V | M, N | (M N ) | let x, y = M in N . Definition 4.6.2. We define an equivalence relation on typing judgments as being the smallest equivalence relation ≈ax satisfying the axioms in Table 4.7, and satisfying the usual congruence relations, stating that if M is a term of the form C[N ], i.e. with a subterm N , such that N ≈ax N , then M is equivalent to C[N ]. We use the notations . , .. , and ... as place holders for x and x, y (not respectively). We also assume that V is a value. Note that the relation ≈ax is on typing judgments and not on untyped terms. We write M ≈ax M : A if we want to make the typing context explicit, but we also often write M ≈ax M when the typing information is implicit.
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
160
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
Table 4.7. Axiomatic equivalence (βλ )
let x = V in M
≈ax M[V /x],
(β⊗ )
let x, y = V, W in M
≈ax M[V /x, W/y],
(β∗ )
let ∗ = ∗ in M
≈ax M,
(ηλ )
λx.V x
≈ax V,
(βλ2 )
let x = N in x
≈ax N ,
(η⊗ )
let x, y = N in x, y
≈ax N ,
(η∗ )
let ∗ = N in ∗
≈ax N ,
app
let x = M in let y = N in x y
≈ax M N ,
λ
let x = V in λy.M
≈ax λy.let x = V in M,
⊗
(let )
let x = M in let y = N in x, y ≈ax M, N ,
(let 1 )
let
(let
)
(let )
(let 2 )
let
.
.
= (let
..
= M in N ) in P ≈ax let .. = M in let
= V in let
..
= W in M ≈ax let .. = W in let
.
.
= N in P, = V in M,
4.6.2 The Term Model Having an equivalence relation on typing judgements, it is possible to define categories from axiomatic equivalence classes of typing judgments, as in Lambek and Scott (1986). Definition 4.6.3. We define the notion of extended value as follows: ExtValue E, E ::= V | E, E | let x = E in E | let x, y = E in E , where V is a value. To distinguish between the two sorts of values we also call the values of Definition 4.6.1 core values. The relationship between extended values and core values is explained by the following lemma. Lemma 4.6.4. Suppose that no constant term c has a type of the form !n ( A ⊗ B). Then for every extended value E such that E : A, there exists a core value V with E ≈ax V : A. Proof. The proof is done by induction on the size of E.
Remark 4.6.5. The restriction on constants in Lemma 4.6.4 is not a serious one: if a constant c of type !n ( A ⊗ B) were ever needed, one could instead use two constants c1 : !n ( A) and c2 : !n (B).
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
161
Definition 4.6.6. We define three categories: The category D of computations. Objects are types and arrows of the form A → B are valid typing judgments x : A M : B. The composition of x : A M : B and y : B N : C is x : A let y = M in N : C and the identity on A is x : A x : A. The category C of values. Objects are types and arrows A → B are valid typing judgments of the form x : A E : B, where E is an extended value. Composition and identity are defined in the same way as for D. The category B of classical values. Objects are types and arrows A → B are valid typing judgments of the form x : !A E : !B, where E is an extended value. Composition and identity are defined in the same way as for D. The category D represents the class of quantum computations, i.e., terms that must still be evaluated and can result in a probability distribution of values. The category C stands for the category of quantum values. The category B is more specific: it is composed of the duplicable values with only duplicable free variables. We therefore call it the category of classical values. Lemma 4.6.7. The structures defined in Definition 4.6.6 are categories.
The remainder of this section is devoted to a study of the abstract properties of the categories B, C, and D.
4.6.3 Structure of the Tensor Operator “ ⊗” The first structural element coming from the type system is the tensor ⊗. As suggested by the notation, the tensor possesses the structure of a symmetric monoidal category. Definition 4.6.8. A monoidal category E is a tuple (E, ⊗, , α, λ, ρ) where E is a category, ⊗ : E × E → E is a functor, is an object of E, and α, λ, ρ are three natural isomorphisms α A,B,C : A ⊗ (B ⊗ C) → ( A ⊗ B) ⊗ C, λ A : ⊗ A → A,
ρA : A ⊗ → A
such that the diagrams (4.1)
(4.2)
( A ⊗ B) ⊗ (C ⊗ D) WWWαWW α g3 W+ ggggg ((A ⊗ B) ⊗ C) ⊗ D A ⊗ (B ⊗ (C ⊗ D)) >> ? >> > id⊗α > α⊗id / A ⊗ ((B ⊗ C) ⊗ D) α ( A ⊗ (B ⊗ C)) ⊗ D, A ⊗ ( ⊗ C) QQQQ ( id⊗λ
α
A ⊗ C,
/ ( A ⊗ ) ⊗ C mm vmmρ⊗id
⊗ ρ λ
(4.3)
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
162
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
commute. A monoidal category is said to be symmetric when it is equipped with a natural isomorphism σ A,B : A ⊗ B → B ⊗ A such that the diagrams σ A,B
(4.4)
A⊗B l
(4.6)
σ B,A
-
B ⊗ A,
A ⊗ (B ⊗ C) id⊗σ A ⊗ (C ⊗ B)
B⊗
σ B,
/ ⊗ B
λB
/5 B,
(4.5)
ρB α
/ ( A ⊗ B) ⊗ C
σ
α
/ ( A ⊗ C) ⊗ B
σ ⊗id
/ C ⊗ (A ⊗ B) α / (C ⊗ A) ⊗ B
commute. Lemma 4.6.9. Equipped with the morphisms α A,B,C =
x : A ⊗ (B ⊗ C) let y, z = x in let t, u = z in y, t, u : (A ⊗ B) ⊗ C,
λA =
x : ⊗ A let y, z = x in let ∗ = y in z : A,
ρA =
x : A ⊗ let y, z = x in let ∗ = z in y : A,
σ A,B =
x : A ⊗ B let y, z = x in z, y : B ⊗ A,
and with the map of arrows (x : A V : B) ⊗ (y : C W : D) = z : A ⊗ B let x, y = z in V, W : C ⊗ D, the category C is symmetric monoidal. Like the category C, the category B is also a category of values. One expects it to be symmetric monoidal too. This turns out to be the case, but in fact, the category B has more structure: it is cartesian. Definition 4.6.10. Given a category E and two objects A and B, the cartesian product of A and B is, if it exists, the data consisting of an object A × B and 1 2 two maps π A,B : A × B → A and π A,B : A × B → B, such that for any pair of maps f : C → A and g : C → B, there exists a unique map f, g : C → 1 2 A × B satisfying f, g; π A,B = f and f, g; π A,B = g. Note that uniqueness is 1 2 equivalent to the equation h; π A,B , h; π A,B = h for all h : C → A × B. We say that the category E has binary products if there is a cartesian product for all A and B. We say that it is cartesian if it also has a terminal object T . Lemma 4.6.11. The category (B, ⊗, ) is cartesian. 1 2 Proof. Consider A and B any types. One constructs π A,B and π A,B respectively as follows:
x : !(A ⊗ B) let y, z = x in y : !A, x : !( A ⊗ B) let y, z = x in z : !B. In this case, given two maps f and g respectively of the form x : !C U : !A and x : !C V : !B, one constructs the map f, g : C → A ⊗ B simply as x : !C U, V : !A ⊗ B.
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
163
1 2 Remark 4.6.12. Note that, although the maps π A,B and π A,B can be similarly defined in C and although is terminal in C, the map f, g cannot in general be defined due to linearity: for instance, there is no diagonal map for the type qbit.
4.6.4 Structure of the Function Operator “ ” Before explaining the nature of the function operator “,” we must briefly comment on the distinction between computations and values, which is reflected in the definitions of the categories C and D. This distinction holds in any call-by-value programming language, including the quantum lambda calculus. A computation is an arbitrary term M, i.e., something that must be evaluated to obtain a result. On the other hand, a value V represents the result of a computation. Because of the probabilistic nature of the quantum lambda calculus, a computation M in general does not yield a value, but a probability distribution of values. In the presence of recursive function definitions, a computation M may also diverge with nonzero probability. It is therefore natural to think of a value V : A as an “element” of type A, and to think of a computation M : A as a subprobability distribution of such elements. We informally write T (A) for the set of subprobability distributions on a set of values A. In the context of higher-order computation, computations of type A can be identified with values of type A. Indeed, given any computation M : A, we can form the value λ∗.M : A (called a “thunk”); and conversely, given any value V : A, we can form a computation V ∗ : A. The two constructions are mutually inverse modulo the axioms in Table 4.7. We can therefore identify T (A) with A. Moggi (1991) has established a general framework for dealing with values and computations in the context of side effects (such as probability and nontermination), in terms of the concept of strong monad. Definition 4.6.13. A monad over a category E is a tuple (T, η, µ), where T : E → E is a functor, η : id → ˙ T and µ : T 2 → ˙ T are natural transformations and the diagrams (4.7) and (4.8) in Table 4.8 commute. The natural transformation µ is called the multiplication of the monad and η the unit of the monad. A monad over a monoidal category (E, ⊗, ) is strong if moreover there exists a natural transformation t A,B : A ⊗ T B → T ( A ⊗ B), called the tensorial strength, such that the diagrams (4.11), (4.12), (4.13) commute. The category C described in Definition 4.6.6 does admit a strong monad: Lemma 4.6.14. In C, define the following maps: ηA = µA = t A,B =
x : A λ∗.x : A, x : ( A) λ∗.(x∗)∗ : A, z : A ⊗ ( B) let x, y = z in λ∗.x, y∗ : ( A ⊗ B),
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
164
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
Table 4.8. Equations for a strong monad (4.7)
T3A µT A
T2A
T µA
µA
/ T2A
ηT A / T 2 A o T η A T A. EE x EE xx µ A xx E EE x id id T A " |xx T A
T AE
µA
/ T A,
(4.8)
TA
α λ / TA (A ⊗ B) ⊗ T C o A ⊗ (B ⊗ T C) O JJ t (4.11) JJJ t id⊗t Tλ JJ J$ T ( ⊗ A), T ((A ⊗ B) ⊗ C) A ⊗ T (B ⊗ C) A ⊗ BJ gPPP JJ PPP JJη PPP JJ id⊗η t PPP JJ (4.12) T (α) $ t / T ( A ⊗ B) T (A ⊗ (B ⊗ C)), A ⊗O T B fMMM MMMµ MMM id⊗µ MM t / T ( A ⊗ T B) T t / T 2 (A ⊗ B) (4.13) A ⊗ T2B
⊗TJ A
and define a functor T as follows: for every object A, T A = A and for every morphism f : A → B of the form x : A V : B, the image T f : T A → T B is y : A λ∗.let x = (y∗) in V : B. Then (T, η, µ, t) is a strong monad on C. Definition 4.6.15. Given a monad (T, η, µ) over E, the Kleisli category ET is defined as follows: • • • •
The objects of ET are the objects of E, The set ET ( A, B) of morphisms from A to B in ET is E( A, T B), The identity on A is η A : A → T A, The composition of f ∈ ET ( A, B) and g ∈ ET (B, C) in ET is f ; T g; µC : A → T C.
Remark 4.6.16. The category D of computations is the Kleisli category CT over the category of values C, where (T, µ, η) is the monad described in Lemma 4.6.14. The operator has more structure than “just” providing a monad. Definition 4.6.17. A symmetric monoidal category (E, ⊗, ) together with a strong monad (T, η, µ) is said to have T-exponentials (Moggi 1991), or Kleisli exponentials, if it is equipped with a bifunctor : E op × E → E, and a natural isomorphism ∼ =
: E(A, B C) −−−−→ E( A ⊗ B, T C).
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
165
Lemma 4.6.18. Consider the functor : C op × C → C, defined on arrows by A (x : B V : C)
=
y : A B λz.let x = yz in V : A C,
(x : A V : B) C
=
y : B C λx.yV : A C,
and the map A,B,C : C(A, B C) → C( A ⊗ B, C), sending the morphism x : A V : B C to t : A ⊗ B λ∗.let x, y = t in V y : C. Together with these structures, C has T -exponentials, where (T, µ, η) is the monad described in Lemma 4.6.14.
4.6.5 Structure of the Exponential Operator “ !” The type operator “!” is first dealt with using a subtyping relation. Using this relation, one can construct a comonad for the category C. Definition 4.6.19. A comonad in a category E is a tuple (L , , δ), where L : E → E is a functor and : L → ˙ I and δ : L → ˙ L 2 are natural transformations such that the following diagrams commute: (4.14) L A δA
δA
L2 A
/ L2 A
δL A
Lδ A
/ L 3 A,
(4.15) L AF FF yy F id L A y F y FF δA yy FF " y| y o L A L A L 2 A L / L A. A id L A
A comonad is said to be idempotent if the comultiplication δ is an isomorphism. Lemma 4.6.20. Consider the map ! sending A to ! A and sending x : A V : B to x : !A V : !B (which is well-typed by Lemmas 4.3.24 and 4.3.25). Also consider the arrows A = x : !A x : A,
δ A = x : !A x : !2 A.
Then (!, , δ) is an idempotent comonad in C. The goal of the type operator “!” is to indicate when and how an object is duplicable. Besides being an idempotent comonad, it has additional properties, which we will detail below. As we have already remarked, the operator “!” is taken from intuitionistic linear logic (Girard 1987). It is therefore not surprising that its categorical semantics closely follows the model of intuitionistic linear logic proposed by Bierman (1993), and later simplified by Benton et al. (1993b,a). Good additional references are Melli`es (2003) and Maneggia (2004). We follow the terminology of Schalk (2004) and use the concept of linear exponential comonad. Definition 4.6.21 (Benton et al. 1993a; Bierman 1993). Let (E, ⊗, ) be a (symmetric) monoidal category. A (symmetric) monoidal comonad on E is a comonad (L , δ, ):
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
166
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
• Equipped with two natural transformations d A,B : L A ⊗ L B → L( A ⊗ B) and d : L → making (L , d) a lax (symmetric) monoidal functor, • Such that δ and are monoidal natural transformations, i.e. such that the following diagrams commute: d A,B
(4.16) L A ⊗ L >B
>> >> A ⊗ B >>
/ L(A ⊗ B), ~~ ~~ A⊗B ~ ~ ~
/ L, (4.17) 55 5 id 55
A⊗B
δ A ⊗δ A
L 2 A⊗L 2 B
/ L(A⊗B),
d A,B
L A⊗L B
δ A⊗B
(4.18) d L A,L B
d
5
/ L(L A⊗L B)
Ld A,B
d
d
/ L 2 (A⊗B)
/ L.
(4.19)
L
Ld
δ
/ L 2
Definition 4.6.22. Let (E, ⊗, , α, λ, ρ, σ ) be a symmetric monoidal category. Let (L , δ, , d L , d L ) be a monoidal comonad. We say that L is a linear exponential comonad provided that (i) each object in E of the form L A is equipped with a commutative comonoid (L A, $ A , ♦ A ), where $ A : L A → L A ⊗ L A and ♦ A : L A → ; (ii) $ A and ♦ A are monoidal natural transformations, i.e, the following diagrams LA ⊗ LB
$ A ⊗$ B
/ (L A ⊗ L A) ⊗ (L B ⊗ L B) sw
(L A ⊗ L B) ⊗ (L A ⊗ L B)
L d A,B
L L d A,B ⊗d A,B
L( A ⊗ B)
(4.21)
dL
L
/ L( A ⊗ B) ⊗ L(A ⊗ B)
$(A⊗B)
λ−1
/ ⊗
LA ⊗ LB
dL ⊗dL
/ L ⊗ L $
TTTTT TTT* dL
commute.
(4.20)
id
L
♦ A ⊗♦ B
/ ⊗ λ
L d A,B
L( A ⊗ B) 4/ ; jjjj jjjj♦
♦ A⊗B
/
(4.23)
(4.22)
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
167
(iii) The maps $ A : (L A, δ A ) → (L A ⊗ L A, (δ A ⊗ δ A ); d A ), ♦ A : (L A, δ A ) → (, dL ) are L-coalgebra morphisms, i.e., $A
LA (4.24)
δA
L2 A
/ LA ⊗ LA δ A ⊗δ A 2 L A ⊗ L2 A L dL A,L A / L(L A ⊗ L A),
L$ A
LA
♦A
/
δA
L2 A
dL
L♦ A
(4.25)
/ L;
(iv) Every map δ A is a comonoid morphism (L A, ♦ A , $ A ) → (L 2 A, ♦ L A , $ L A ), i.e., satisfying the diagrams LA (4.26) $ A LA ⊗ LA
δA
δA / L 2 A, / L 2 A. L AC C $L A w CC (4.27) w {ww ♦L A ♦A ! / L2 A ⊗ L2 A δ A ⊗δ A
Lemma 4.6.23. If we define the maps ! = d A,B
d!
=
z : !A ⊗ !B let x, y = z in x, y : !(A ⊗ B), z : ∗ : !,
$A =
x : !A x, x : !A ⊗ ! A,
♦A =
x : !A ∗ : ,
the comonad (!, δ, ) is an idempotent linear exponential comonad on the category C. Lemma 4.6.24. The category B is the co-Kleisli category of the comonad described in Lemma 4.6.23. ! and d! in Lemma 4.6.23 are isomorRemark 4.6.25. Note that the map d A,B phisms of C. In other words, we require the monoidal comonad to be strongly monoidal. This is because, unlike the work of Bierman (1993) and Benton et al. (1993b), the types !( A ⊗ B) and !A ⊗ !B are isomorphic in the quantum lambda calculus (as explained in Section 4.3.8).
4.6.6 A Linear Category for Duplication Putting together the features developed in the last three sections, we can abstract from the properties of the term categories B, C, and D and define a sound model for the core fragment of the linear lambda calculus of Section 4.6.1.
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
168
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
Definition 4.6.26. A linear category for duplication is a category E with the following structure: • A symmetric monoidal structure (⊗, , α, λ, ρ, σ ); • An idempotent, strongly monoidal, linear exponential (L , δ, , d L , d L , ♦, $); • A strong monad (T, µ, η, t); • A Kleisli exponential , that is, a natural map of arrows
comonad
: E(A ⊗ B, T C) → E( A, B C) and a bifunctor : E op × E → E. A linear category for duplication E is said to be weak if is a terminal object. Theorem 4.6.27. The category C (from Definition 4.6.6) is a weak linear category for duplication. Proof. The proof uses Lemmas 4.6.9, 4.6.14, 4.6.18, and 4.6.23.
Remark 4.6.28. A linear category for duplication gives rise to a double adjunction UL
EL f
⊥ FL
UT
&
Ef
⊥
'
ET .
FT
Here the left adjunction arises from the co-Kleisli category E L of the comonad L. It is a linear-nonlinear model in the sense of Benton (1995). The right adjunction arises from the Kleisli category ET of the computational monad T .
4.6.7 Interpretation of the Core Fragment The core fragment of linear lambda calculus, as given in Section 4.6.1, can be interpreted in any weak linear category for duplication E. Suppose that for each type constant α, we are given an object (α) of E. Then we can recursively assign to each type A an object [[ A]] via [[α]] = (α), [[!A]] = L[[A]], [[A B]] = [[A]] [[B]], [[]] = , and [[ A ⊗ B]] = [[A]] ⊗ [[B]]. Moreover, for any valid subtyping A <: B, there exists a canonical arrow I A,B : [[A]] → [[B]] in E, definable from the structure of the comonad L. If = {x1 : A1 , . . . , xn : An } is a typing context, we write [[]] = [[A1 ]] ⊗ . . . ⊗ [[An ]]. Further, suppose that for each constant c : Ac , we are given an interpretation as an arrow (c) : → [[Ac ]] in E. Then to each valid typing derivation, we can recursively assign an arrow of E as follows: • If π is a typing derivation of a value judgment x1 : A1 , . . . xn : An V : B, then [[π]]v is an arrow [[A1 ]] ⊗ . . . ⊗ [[An ]] → [[B]]; • If π is a typing derivation of a general judgment x1 : A1 , . . . xn : An M : A, then [[π ]]c is an arrow [[A1 ]] ⊗ . . . ⊗ [[An ]] → T ([[B]]).
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
14:25
Quantum Lambda Calculus
169
The actual definition is by recursion on typing derivations, and consists of a large number of straightforward cases. We only give one of the cases as an example, and refer to Selinger and Valiron (2008a) and Valiron (2008) for complete details. Consider a typing derivation ending in the rule 1 , ! M : A B 2 , ! N : A 1 , 2 , ! M N : B . If the two premises are interpreted, respectively, as morphisms f : [[!]] ⊗ [[1 ]] → T ([[A]] [[B]]) g : [[!]] ⊗ [[2 ]] → T ([[A]]), then the interpretation the conclusion is defined as ˜
→ [[!]] ⊗ [[!]] ⊗ [[1 ]] ⊗ [[2 ]] [[!]] ⊗ [[1 ]] ⊗ [[2 ]] − id⊗σ ⊗id
−−−−−→ [[!]] ⊗ [[1 ]] ⊗ [[!]] ⊗ [[2 ]] f ⊗g
−−→ T ([[A]][[B]]) ⊗ T ([[A]]) 1
−→ T (([[A]][[B]]) ⊗ [[A]]) T (ε)
−−→ T (T ([[B]])) µ
− → T ([[B]]), ˜ : [[]] → [[]] ⊗ [[]] is the canonical map definable from A : L A → where L A ⊗ L A of the linear exponential comonad, and ε : (A B) ⊗ A → T B is the canonical map arising from the Kleisli exponential. Remark 4.6.29. Note that the interpretation is defined on typing derivations, and not on typing judgments. And indeed, a valid typing judgment can in general possess many different typing derivations. For example, consider the following two typing judgments, where V and W are values: x : A V : !B,
y : B W : C.
Then the typing judgment x : A let y = V in W : C has two distinct valid typing derivations: x : A V : !B y : !B W : C x : A let y = V in W : C,
x : AV :B y:BW :C x : A let y = V in W : C.
Therefore, a major complication in the proof of soundness of the interpretation is that we must first show that the interpretation is well defined on typing judgments and independent of the particular typing derivation used to derive it. This is the subject of the following theorem. Theorem 4.6.30. Given a valid typing judgment with two typing derivations π and π , for any interpretation we have the equality [[π ]]c = [[π ]]c (and [[π ]]v = [[π ]]v if the typing judgment is a value).
P1: SBT CUUS834-04
cuus834-gay
170
978 0 521 51374 6
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
The proof of this theorem is technically complicated and occupies almost three chapters of Valiron’s Ph.D. thesis (see Valiron 2008, Corollary 11.2.6). then we have Theorem 4.6.31 (Soundness). If M ≈ax M : A c c [[ M : A]] = [[ M : A]] (and [[ M : A]]v = [[ M : A]]v if M and M are values) for every interpretation in a weak linear category for duplication. Proof. By induction on the definition of ≈ax , using a substitution lemma.
Theorem 4.6.32 (Completeness). If for every interpretation in every weak linear category for duplication, the equality [[ M : A]]c = [[ M : A]]c holds, then M ≈ax M : A. Proof. It suffices to consider the term model C of Section 4.6.2, with the identity map.
4.6.8 Toward a Concrete Model In light of the results of the last few subsections, we can now say what it means to be a “concrete model of the quantum lambda calculus.” Such a model should have the structure of a weak linear category for duplication, with the further property that the ground type operations (new , meas, and unitary operations) can be interpreted with their usual meanings. More precisely, a concrete model of the quantum lambda calculus is a weak linear category for duplication E with distributive finite coproducts, preserved by L, together with an object qbit ∈ |E|, such that the full monoidal subcategory of ET of objects of the form qbit n 1 ⊕ . . . ⊕ qbit n k is equivalent to the category Q of tuples of finite dimensional Hilbert spaces and norm nonincreasing completely positive maps (Selinger 2004). As mentioned in the introduction of Section 4.6, at the time of this writing, it is still an open problem to find such a concrete model (other than the term model). The only partial result in this direction is a model for the strictly linear fragment of the quantum lambda calculus (i.e., without the !A operator, and without the possibility of duplication or erasure of either classical or quantum information). A fully abstract model for this fragment was given in Selinger and Valiron (2008b).
Bibliography Abramsky, S. (1993) Computational interpretations of linear logic. Theoretical Computer Science 111:3–57. Altenkirch, T., and Grattage, J. (2005) A functional quantum programming language. In Proceedings of the 20th IEEE Symposium on Logic in Computer Science, LICS’05, pages 249–258. IEEE Computer Society Press. Barendregt, H. P. (1984) The Lambda Calculus: Its Syntax and Semantics, volume 103 of Studies in Logic and the Foundation of Mathematics. North Holland, second edition. Bell, J. S. (1964) On the Einstein Podolsky Rosen paradox. Physics 1:195–200. Bennett, C. H., Brassard, G., Cr´epeau, C., Jozsa, R., Peres, A., and Wootters, W. K. (1993) Teleporting an unknown quantum state via dual classical and Einstein-Podolsky-Rosen channels. Physical Review Letters 70(13):1895–1899.
P1: SBT CUUS834-04
cuus834-gay
978 0 521 51374 6
4
October 31, 2009
Quantum Lambda Calculus
14:25
171
Bennett, C. H., and Wiesner, S. J. (1992) Communication via one- and two-particle operators on Einstein-Podolsky-Rosen states. Physical Review Letters 69(20):2881–2884. Benton, N. (1995) A mixed linear and non-linear logic: Proofs, terms and models (extended abstract). In Proceedings of the Eighth Workshop on Computer Science Logic, CSL’94, Selected Papers, volume 933 of Lecture Notes in Computer Science, pages 121–135. Springer. Benton, N., Bierman, G., de Paiva, V., and Hyland, M. (1993a) Linear λ-calculus and categorical models revisited. In Proceedings of the Sixth Workshop on Computer Science Logic, CSL’92, Selected Papers, volume 702 of Lecture Notes in Computer Science, pages 61–84. Springer. Benton, N., Bierman, G., de Paiva, V., and Hyland, M. (1993b) A term calculus for intuitionistic linear logic. In Proceedings of the International Conference on Typed Lambda Calculi and Applications, TLCA’93, volume 664 of Lecture Notes in Computer Science, pages 75–90. Springer. Benton, N., and Wadler, P. (1996) Linear logic, monads and the lambda calculus. In Proceedings of the 11th IEEE Symposium on Logic in Computer Science, LICS’96, pages 420–431. IEEE Computer Society Press. Bierman, G. (1993) On Intuitionistic Linear Logic. Ph.D. thesis, University of Cambridge Computer Laboratory, Cambridge, England. Available as Technical Report 346, August 1994. Deutsch, D., and Jozsa, R. (1992) Rapid solution of problems by quantum computation. Proceedings of the Royal Society of London A 439:553–558. Girard, J.-Y. (1987) Linear logic. Theoretical Computer Science 50(1):1–101. Hudak, P., Hughes, J., Peyton Jones, S., and Wadler, P. (2007) A history of Haskell: Being lazy with class. In HOPL III: Proceedings of the Third ACM SIGPLAN Conference on History of Programming Languages, pages 12.1–55. Association for Computing Machinery. Knill, E. H. (1996) Conventions for quantum pseudocode. Technical Report LAUR-96-2724, Los Alamos National Laboratory. Lambek, J., and Scott, P. (1986) Introduction to Higher Order Categorical Logic, volume 7 of Cambridge Studies in Advanced Mathematics. Cambridge University Press. Mac Lane, S. (1971) Categories for the Working Mathematician, volume 5 of Graduate Texts in Mathematics. Springer. Maneggia, P. (2004) Models of Linear Polymorphism. Ph.D. thesis, School of Computer Science, University of Birmingham. McCarthy, J. (1960) Recursive functions of symbolic expressions and their computation by machine, part I. Communications of the ACM 3(4):184–195. Melli`es, P.-A. (2003) Categorical models of linear logic revisited. Technical Report 22, Laboratoire Preuves, Programmes et Syst`emes, CNRS and Paris 7. Milner, R. (1978) A theory of type polymorphism in programming. Journal of Computer and System Sciences 17:348–375. Moggi, E. (1991) Notions of computation and monads. Information and Computation 93(1):55– 92. Pierce, B. C. (2002) Types and Programming Languages. MIT Press. Schalk, A. (2004) What is a categorical model of linear logic? Manuscript, available from http://www.cs.man.ac.uk/∼schalk/work.html. Seely, R. A. (1989) Linear logic, *-autonomous categories and cofree coalgebras. In Proceedings of Categories in Computer Science and Logic, Boulder, 1987, volume 92 of Contemporary Mathematics, pages 371–382. American Mathematical Society. Selinger, P. (2004) Towards a quantum programming language. Mathematical Structures in Computer Science 14(4):527–586. Selinger, P., and Valiron, B. (2005) A lambda calculus for quantum computation with classical control. In Proceedings of the Seventh International Conference on Typed Lambda Calculi and Applications, TLCA’05, volume 3461 of Lecture Notes in Computer Science, pages 354–368. Springer. Selinger, P., and Valiron, B. (2006) A lambda calculus for quantum computation with classical control. Mathematical Structures in Computer Science 16(3):527–552.
P1: SBT CUUS834-04
cuus834-gay
172
978 0 521 51374 6
October 31, 2009
14:25
Peter Selinger and Benoˆıt Valiron
Selinger, P., and Valiron, B. (2008a) A linear-non-linear model for a computational call-by-value lambda calculus. In Proceedings of the Eleventh International Conference on Foundations of Software Science and Computation Structures, FOSSACS 2008, volume 4962 of Lecture Notes in Computer Science, pages 81–96. Budapest. Selinger, P., and Valiron, B. (2008b) On a fully abstract model for a quantum linear functional language. In Proceedings of the Fourth International Workshop on Quantum Programming Languages, QPL 2006, volume 210 of Electronic Notes in Theoretical Computer Science, pages 123–137. Sussman, G. J., and Steele, G. L., Jr. (1975) Scheme: An interpreter for extended lambda calculus. Technical Report AIM-349, MIT. Troelstra, A. S. (1992) Lectures on Linear Logic, volume 29 of CSLI Lecture Notes. University of Chicago Press, second edition. Turing, A. M. (1937) On computable numbers, with an application to the Entscheidungsproblem. Proceedings of the London Mathematical Society, Series 2 42:230–265. Valiron, B. (2004a) A functional Programming Language for Quantum Computation with Classical Control. Master’s thesis, Department of Mathematics and Statistics, University of Ottawa. Valiron, B. (2004b) Quantum typing. In Proceedings of the Second International Workshop on Quantum Programming Languages, QPL 2004, TUCS General Publication 33, pages 163–178. Turku Centre for Computer Science, Turku, Finland. Valiron, B. (2008) Semantics for a Higher-Order Functional Programming Language for Quantum Computation. Ph.D. thesis, Department of Mathematics and Statistics, University of Ottawa. van Tonder, A. (2004) A lambda calculus for quantum computation. SIAM Journal of Computing 33(5):1109–1135.
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
October 31, 2009
14:36
5 The Quantum IO Monad Thorsten Altenkirch and Alexander S. Green
Abstract The quantum IO monad is a purely functional interface to quantum programming implemented as a Haskell library. At the same time it provides a constructive semantics of quantum programming. The QIO monad separates reversible (i.e., unitary) and irreversible (i.e., probabilistic) computations and provides a reversible let operation (ulet), allowing us to use ancillas (auxiliary qubits) in a modular fashion. QIO programs can be simulated either by calculating a probability distribution or by embedding it into the IO monad using the random number generator. As an example we present a complete implementation of Shor’s algorithm.
5.1 Introduction We present an interface from a pure functional programming language, Haskell, to quantum programming: the quantum IO monad, and use it to implement Shor’s factorization algorithm. The implementation of the QIO monad provides a constructive semantics for quantum programming, i.e., a functional program that can also be understood as a mathematical model of quantum computing. Actually, the Haskell QIO library is only a first approximation of such a semantics; we would like to move to a more expressive language that is also logically sound. Here we are thinking of a language such as Agda (Norell 2007), which is based on Martin L¨of ’s type theory. We have already investigated this approach of functional specifications of effects in a classical context (Swierstra and Altenkirch 2007, 2008; Swierstra 2008). At the same time the QIO monad provides a high-level interface to a hypothetical quantum computer. To make the presentation accessible to the non-Haskell programmer, we give a brief introduction to the language in Section 5.2. The QIO monad separates reversible (i.e., unitary) and irreversible (i.e., probabilistic) computations and provides a reversible let operation (ulet), allowing us to use ancillas (auxiliary qubits) in a modular fashion. QIO programs can be simulated either by calculating a 173
P1: SBT CUUS834-05
cuus834-gay
174
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
probability distribution or by embedding it into the IO monad using the random number generator. An overview of the quantum IO Monad (QIO) is given in Section 5.3. Exploiting Haskell’s class system, we can present our algorithms in a highlevel way, implementing abstractions using functional programming technology. We describe the implementation of Shor’s algorithm in some detail (Section 5.5), also covering the necessary reversible arithmetic (Section 5.4). The actual implementation of QIO is covered in Section 5.6, where we focus in detail on the design of the QIO quantum simulator functions sim and run. Quantum programming is able to exploit the strange nature of quantum physics to achieve classically impossible, or rather infeasible, tasks. Most famously, Shor’s algorithm shows that on a quantum computer we can factor a number in polynomial time; hence we could break many encryption schemes. While physicists are working on building working quantum circuits with more than a handful of qubits, we computer scientists grapple with the challenges quantum computing creates for software: in designing algorithms like Shor’s that exploit quantumness; but also in designing languages that support abstractions relevant for quantum computing. See Gay (2006) and R¨udiger (2007) for recent language surveys. Here we investigate a different approach: instead of implementing a new language from scratch, we provide a monadic interface to do quantum programming in Haskell – the quantum IO monad (QIO). This has a number of advantages: • We can exploit existing means of abstraction present in Haskell to structure our quantum programs; indeed we will give an example of this by implementing the class Qdata, which relates classical data-types with their quantum counterparts. • We can explore which semantic primitives are most useful to structure quantum programs, without committing to a particular view too early. • We can exploit the existing support for Haskell, in the form of tools and libraries to develop our quantum programs. We believe that a purely functional approach is ideally suited for this venture, since it already makes effects explicit (in Haskell via the IO monad) and is close to a mathematical semantics of quantum programming (see our introductory comments on constructive semantics). While QIO realizes the infrastructure we need to control a quantum computer from Haskell, we don’t have to wait until the physicists develop a practical quantum computer; we can use the same interface to run a quantum simulator. Our approach is inspired by the first author’s work with Wouter Swierstra on functional specifications of IO (Swierstra and Altenkirch 2007). Indeed, we provide some choice here: we can embed QIO into the IO monad using pseudorandom numbers to simulate quantum randomness; we can statically calculate the probability distribution of possible results given a quantum program; and we can simulate the classical subset of our quantum operations directly. The last is useful for testing components efficiently since the quantum simulation generates a considerable overhead.
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
14:36
The Quantum IO Monad
175
All the code described in this chapter, i.e., the implementation of QIO and the quantum algorithms implemented in it, is available from the second author’s web page (Green 2008). There are a number of papers on modelling quantum programming in Haskell (Mu and Bird 2001; Sabry 2003; Karczmarczuk 2003; Vizzotto et al. 2006). They describe different abstractions one can use to simulate quantum computation in a functional setting – however, our approach is different in that we provide a high-level interface in the spirit of the IO monad that provides an interface to a hypothetical quantum computer. Our previous work on QML (Altenkirch and Grattage 2005) proposed a first-order functional quantum programming language; the present work is more modest but gives us a stepping stone to experiment with various alternative structures useful for structuring quantum programming and also to implement future versions of languages such as QML.
5.2 Functional Programming and the Real World Haskell is a pure functional programming language, treating computations as the evaluation of pure mathematical functions. A function is said to be pure if it always returns the same result when given the same arguments, and in producing that result has not caused any side effects to occur within the system. Haskell employs lazy evaluation, which allows expressions to be evaluated only when needed. This allows infinite data structures to be defined in Haskell, whereby a finite part of the data structure can be used as and when required. For example, you could define an infinite list of all the prime numbers, and then define a function that requires the first 10 elements of this list. The definition of a pure function as just given may seem to inhibit the creation of any sort of useful real-world programs, because if a program cannot depend on any state and cannot change any state, i.e., have any input or output, then it can be argued it is the same as a program that does nothing. However, we can make use of the categorical notion of a monad, which is a kind of abstract data type that can be used to model side effects within a purely functional setting. In Section 5.2.3 we’ll introduce the notion of a monad within Haskell and show how they can be used to define stateful computations. We’ll also look at how Haskell deals with I/O using the IO monad. In the following section (Section 5.2.1) we’ll see how functions are defined in Haskell, starting with some simple bitwise operations and then a look at how higher order functions and recursion are a mainstay of Haskell programs. Another useful aspect of programming in Haskell is its use of type classes that allow polymorphic functions to be defined for any type that satisfies the class requirements. Other functions can then be defined that have the prerequisite that the input type is a member of one of the type classes (as apposed to just a specific type). A common example of a type class in Haskell is the equality class (Eq). A type can become a member of the Eq class if it can define a function ≡1 that defines equality for that type. The programmer could then define a polymorphic 1
We use lhs2tex to typeset Haskell code; hence == becomes ≡.
P1: SBT CUUS834-05
cuus834-gay
176
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
function whose only restriction on the input type is that it is a member of Eq. We will see in Section 5.2.2 an example of how type classes can be used to define monoids within Haskell. You’ll also notice that monads are defined by a type class within Haskell.
5.2.1 Haskell by Example The Haskell language definition (Jones 2003), Haskell compilers and interpreters, the description of the standard libraries and much more can be found on the Haskell homepage: www.haskell.org. There are a number of introductory textbooks available, e.g. (Hutton 2007). We restrict ourselves here to a small number of introductory examples, relevant to our development.2 We have chosen the example of defining a full-adder function in Haskell as in Section 5.4 we go on to design reversible arithmetic functions, starting off with a reversible adder function. You’ll see that the basic idea is the same, defining a function that adds single bits and keeps a track of overflow. Addition is then achieved by calling this function recursively. In Haskell it is useful to first define the type of the function. For example, if we wanted to define a bitwise full-adder function, we could first define the function that adds together the two bits to be added and the input carry bit, and returns the pair consisting of the output bit and the output carry bit. Using the Bool type (of Booleans) to represent bits, this would give us a function that takes three input bits and returns a pair of output bits. addBit :: Bool → Bool → Bool → (Bool , Bool ) Currying allows us to chain the input bits in this way. Note that it is not always necessary for the programmer to define the type of a function, as Haskell employs type-inference at compile time to infer the type of a function; however, it is deemed good programming practice to do so. Now we have the type for our function, we can define the function itself. addBit c a b = ((a ∧ b) ∨ (a ∧ c) ∨ (b ∧ c), (a ≡ b) ≡ c) Given the three input bits (a,b the bits to be summed, and c the input carry bit) we can define the output as the pair of the two functions that define the two output bits respectively. The left-hand side of the pair computes the output carry bit (which occurs when at least two of the three input bits are true), and the right-hand side computes the sum of the three input bits (where addition modulo 2 is the same as the logical ≡ (or xor)). Addition can now be extended to lists of Booleans, recursively. This is achieved by feeding the carry-bit through the function. 2
It is useful to note that the current code (Green 2008) makes use of some of the extensions only available with the Glasgow Haskell Compiler.
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
The Quantum IO Monad
14:36
177
add :: Bool → [Bool ] → [Bool ] → [Bool ] add c [ ] [ ] = [ ] add c (a : as) (b : bs) = a : (add c as bs) where (c , a ) = addBit c a b When evaluated, Haskell will use pattern matching to apply the correct function definition to the current arguments, i.e., starting from the first line and going down until the current arguments match the patterns given in the definition. In the function add just shown, the first line will only pattern match when both the list arguments are empty ([ ] in Haskell), and the second line will only pattern match when both the list arguments have at least one element (The cons operator in Haskell : is used to construct lists, so a : as is the list with head element a and (possibly empty) tail as). The first line of the definition gives us the base case, where the sum of two empty lists of Booleans is also the empty list. This base case doesn’t take into account the final carry bit, showing us that our adder as defined here doesn’t deal with overflow. The second line of the definition is the recursive call and uses our addBit function from before to add the current bits, and then recursively calls add with the new carry bit and the tails of the input lists. The where keyword is used to give variable names to the result of calling addBit. The full adder is finished off by always starting the call to the addition function shown earlier with a False input carry-bit. The use of currying to define our functions means that this is a valid function as required. add :: [Bool ] → [Bool ] → [Bool ] add = add False As they stand, these functions aren’t defined for all inputs, as there is no definition of the function when only one of the input lists is empty. Our intention is that they are only used for lists of the same length, but it is not straightforward to express this constraint using Haskell’s type system (we’d be better off with Agda). Indeed, we will be using the functions only over a fixed wordsize that is useful when defining zero: wordSize :: Int wordSize = 8 zero :: [Bool ] zero = take wordSize (repeat False) data Word = Word [Bool ] Here Word is a datatype with one constructor that is also called Word , a common Haskell convention. The zero function just given shows how we can make use of infinite data structures, as the function repeat creates an infinite list of its argument (in this
P1: SBT CUUS834-05
cuus834-gay
178
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
case False), but calling zero is possible due to lazy evaluation and creates the data structure: [False, False, False, False, False, False, False, False ]
5.2.2 Monoids A monoid, or a semigroup, is defined as an algebraic structure with an associative binary operation, along with an identity element. In Haskell, we can realize this as a type-class that provides an element of the underlying type as the identity element, and a binary function acting on and returning the underlying type as the monoidal operation. In Haskell the identity element is usually referred to as mempty and the binary operator as mappend . class Monoid a where mempty :: a mappend :: a → a → a A nice example of a type that can fulfill the requirements of the monoid type class is the Word type that we defined previously. instance Monoid Word where mempty = Word zero (Word a) ‘mappend ‘ (Word b) = Word (a ‘add ‘ b) The identity element is the zero (lifted to a Word ), and the binary operation is the add function (again lifted to words). With monoids it is also possible to introduce an idea of stateful programs within the pure world of Haskell. However, it is not possible to access the state at intermediary stages within a computation. A stateful computation over the state type s is defined by a transition function: data State s = State{runState :: s → s } The destructor function runState, i.e., the inverse to the constructor, is generated automatically, satisfying the equation runState (State f ) = f . The monoidal structure is used to define how these transition functions can be sequenced: instance Monoid (State s) where mempty = State id (State f ) ‘mappend ‘ (State g) = State (g ◦ f ) The sequencing of these state transition functions is simply just functional composition.
5.2.3 Monads Monads are a natural generalization of the concept of a monoid in category theory, by looking at monoids in a given category. In functional programming they are used as a notion for defining computations. These computations in themselves don’t
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
The Quantum IO Monad
14:36
179
necessarily need to be pure computations, which can be achieved by defining datatypes that describe the side effects that a computation may have. In this way, it is possible to define effectful computations within Haskell as computations within a monad. The idea of a monad in Haskell is quite simple but is used extensively to create any sort of computations that would otherwise not be pure. In Section 5.2.4 we’ll see that all I/O in Haskell takes place in the IO monad, and that the use of monads within Haskell is so common that Haskell provides the do notation, which is a form of syntactic sugar that enables monadic programs to be written in a more imperative style. In this section we introduce monads, starting with their definition as a type class within Haskell: class Monad m where return :: a → m a (> >=) :: m a → (a → m b) → m b Here m :: ∗ → ∗ is an operator on types; this fact is inferred by Haskell. A monad is defined by a return function whose job it is to lift a member of the underlying type into the monadic version of the same type, and a bind function (denoted >>=) that defines how computations can be sequenced within the monad. A simple example of a monad is the Maybe monad, which is defined by the data type data Maybe a = Just a | Nothing a member of this data type is either Just a member of the underlying data type, or it’s Nothing. A simple way of thinking of this is that Nothing defines an error value in the monad, and it is the job of the monadic structure to propagate Nothing values through any computation where they may occur. This is achieved by defining Maybe as an instance of the monad type class as follows: instance Monad Maybe where return = Just Nothing > >= f = Nothing (Just x ) > >= f = f x The return function lifts values into the monad by making them a Just value, and the bind function pattern matches on the monadic type to either propagate a Nothing or apply a computation to the underlying Just value. A more interesting example of monads in Haskell is the state monad, which like the state monoid earlier allows stateful computations to be defined. However, unlike the monoid example, the state monad also allows values to be accessed, giving us effects (e.g., changes in state), and values that may depend on previous effectful computations. A stateful computation over the state type s that can return values of type a is defined by a transition function that returns a value along with the new state. data StateM s a = StateM {runStateM :: s → (a, s)}
P1: SBT CUUS834-05
cuus834-gay
180
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
We can now define the monadic behavior required to thread state through a computation. The return function can simply create a transition function that returns the underlying value but has no effect on the state. The bind function returns a transition function that extracts the value and new state from applying its left-hand argument to the given state and uses these new values in applying its right-hand argument. instance Monad (StateM s) where return a = StateM (λs → (a, s)) (StateM x ) > >= f = StateM (λs → let (v , s ) = x s in runStateM (f v ) s ) In order to actually use the state monad it is necessary to create some sort of an interface to it. The MonadState class is often used for this3 : class MonadState m s | m → s where get :: m s put :: s → m () instance MonadState (State s) s where get = State (λs → (s, s)) put s = State (λ → ((), s)) The get function is used to return the current state as the returned value and leaves the overall state unchanged, and the put function updates the state to the given value. Since put doesn’t return any information, we are using Haskell’s unit type () corresponding to void in C. We shall now give some examples of monads that we have created specifically for the implementation of the QIO monad. First is a type of vectors that are used in QIO for the creation of probability distributions, which we will use when defining the sim function later. A vector over types x and a is defined as a list of pairs of those types. data Vec x a = Vec{unVec :: [(a, x )]} The following functions4 are defined over vectors: empty :: Vec x a empty = Vec [ ] (@) :: (Num x , Eq a) ⇒ Vec x a → a → x (Vec ms)@a = foldr (λ(b, k ) m → if a ≡ b then m + k else m) 0 ms (⊗) :: Num x ⇒ x → (Vec x a) → Vec x a l ⊗ (Vec as) = (Vec (map (λ(a, k ) → (a, l ∗ k )) as)) (⊕) :: (Vec x a) → (Vec x a) → Vec x a (Vec as) ⊕ (Vec bs) = (Vec (as ++ bs)) 3 4
The functional dependency m → s is a hint to the Haskell type checker and may be ignored by the reader. unVec is the inverse of the constructor Vec.
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
14:36
The Quantum IO Monad
181
empty is simply the empty vector. @ is a lookup function that requires the type x to be in the Num class (of numeric types) and the type a to have equality (Eq) and returns the sum of the numeric argument of every member of the vector that matches the given argument. ⊗ is a scalar multiplication function that again requires the x type to be a numeric type, such that it can multiply the numeric part of each member of the vector by the given scalar. The ⊕ is simply the concatenation function for vectors and joins two vectors by using list concatenation. We can now define vectors over numeric types as a monad, specifically such that they can be used to hold the probability distributions required. The return function lifts an underlying value into the monad type by just giving it a probability of 1 as the only member of the probability distribution. The bind operation applies the bound function to the first argument of every member of the current probability distribution and multiplies the numeric argument by this new result, with the effect of updating the probability distribution depending on the effect of the given function. instance Num n ⇒ Monad (Vec n) where return a = Vec [(a, 1)] (Vec ms) > >= f = Vec [(b, i ∗ j ) | (a, i ) ← ms, (b, j ) ← unVec (f a)] To make use of these vectors in the implementation of QIO, we now define a PMonad or a probability monad as a monad along with the extra function merge. The merge function can be thought of as a function that defines how two computations (c,d ) of the same type can be merged depending on the given R argument, where merge p c d means that the probability of c occurring is p, and the probability of d occurring is 1 − p. class Monad m ⇒ PMonad m where merge :: R → m a → m a → m a To create our probability distributions for the sim function we can now define the actual type of our probability distributions (Prob a). data Prob a = Prob{unProb :: Vec R a } In this case, the distribution can be over any type a with a R argument as its current probability. We continue by defining the type Prob as a monad by lifting the monadic operations for Vec. instance Monad Prob where return = Prob ◦ return (Prob ps) > >= f = Prob (ps >>= unProb ◦ f ) instance PMonad Prob where merge pr (Prob ift) (Prob iff ) = Prob ((pr ⊗ ift) ⊕ ((1 − pr ) ⊗ iff )) The PMonad is then defined with the merge function multiplying each probability distribution by its respective probability and joining them. In comparison, the run
P1: SBT CUUS834-05
cuus834-gay
182
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
function requires that the IO monad be defined as a PMonad that is achieved by using the built-in random number generator to probabilistically return one of the given arguments depending on the given probability: instance PMonad IO where merge pr ift iff = Random.randomRIO (0, 1.0) > >= λpp → if pr > pp then ift else iff We’ll see more on how the PMonad type is used in the implementation of QIO in Section 5.6.
5.2.4 Haskell’s IO Monad, and do Notation All I/O in Haskell takes place within the IO monad; in fact, in a compiled Haskell program, the main function that is called by the system at run-time has type IO (). This should not be that surprising, as any interaction with the system makes use of I/O. A simple Hello World program written in Haskell would be: main :: IO () main = putStrLn "Hello, world!" where the function putStrLn :: String → IO () defines an effectful computation that outputs the given string to stdout and returns the unit type as its value. The IO monad defines many standard I/O functions that can be used within Haskell programs; however, we do not discuss them all in detail here. As the IO monad is indeed a monad within Haskell, it is necessary to bind all IO computations together using the monadic bind function. For example, if we wanted to write a function that echoes a character to the screen, we could use the two following IO functions: getChar :: IO Char putChar :: Char → IO () getChar is a computation that reads a character from stdin; putChar is a computation that outputs the given character to stdout, returning the unit type. The echo function that follows binds these two functions together such that the character obtained from the getChar function is fed as the argument to the putChar function and hence echoed to the screen. The echo function then goes on to call itself again. echo :: IO () echo = getChar > >= (λc → putChar c) >> echo This is quite a simple example, and already the monadic notation is looking quite complicated. Imagine if we wanted to bind lots of monadic operations together, such as prompting for a file name, reading in the file name, opening the file, reading in the file contents, doing a computation with the file contents, then saving the new data back to the file. This isn’t an unlikely request for a program, but it would seem that a complicated function would need to be defined in order to
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
The Quantum IO Monad
14:36
183
bind all these actions together. However, Haskell once again comes to our rescue, providing what is known as the do notation to simplify the creation of monadic programs. do notation is in fact just syntactic sugar, and the compiler converts it back to the necessary binds at compile time. The do notation is designed to give monadic programs a more imperative look and style. For example the echo example from above written using do notation: echo = do c ← getChar putChar c echo For the rest of this chapter we shall be making extensive use of do notation, which can be used for any monadic programs. In the next section (5.3) we introduce the QIO monad, in the style of the IO monad, whereby we shall be introducing its constructors and how they are used as apposed to the details of their implementation. For more details on the implementation, please see Section 5.6 toward the end of the chapter.
5.3 The QIO Interface The QIO monad (Figure 5.1) provides a functional interface to quantum programming, similar to the way the IO monad provides an interface to conventional stateful programming. We provide a constructive semantics of QIO later in Section 5.6, but for the moment we explain its constructs informally. The basic idea is that our classical computer is connected to a quantum device that contains a number of qubits. The quantum device can be instructed to set qubits to one of the computational base states (i.e., |0 = False or |1 = True), to perform unitary operations involving one or several qubits, or to measure qubits and observe the outcome, this operation is probabilistic. Figure 5.1 gives a quick overview of the API: it consists of two types5 Qbit and U and an operator on types QIO. We read QIO a as the type of quantum operations that return values of type a. The API specifies that QIO is a monad, i.e., provides operations for embedding functional computation (return) and allows sequential composition (> >=). Similarly, U is a monoid, i.e., it has a neutral element mempty and an operation mappend . The difference reflects the fact that we cannot extract any information from a reversible computation. As for conventional IO we use Haskell’s do notation, which enables us to write imperative-looking programs that are translated into pure functional programs using monadic combinators. As a first trivial example, let’s write our quantum hello world program, which initializes a qubit and then measures it: hqw :: QIO Bool hqw = do q ← mkQbit False measQbit q 5
The kind of types is written ∗ in Haskell.
P1: SBT CUUS834-05
cuus834-gay
184
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
Qbit :: ∗ QIO :: ∗ → ∗ U :: ∗ instance Monad QIO
instance Monoid U
mkQbit :: Bool → QIO Qbit applyU :: U → QIO () measQbit :: Qbit → QIO Bool
swap :: Qbit → Qbit → U cond :: Qbit → (Bool → U ) → U rot :: Qbit → ((Bool , Bool ) → C) → U ulet :: Bool → (Qbit → U ) → U urev :: U → U Prob :: ∗ → ∗ instance Monad Prob run :: QIO a → IO a sim :: QIO a → Prob a runC :: QIO a → a
Figure 5.1. The QIO API
We can now either run our quantum program, using run hqw , or since it doesn’t involve any nonclassical steps, using runC hqw . runC is only able to run QIO computations consisting of the classical subset of available operations and will throw an error if any quantum operations occur. We provide this functionality because the classical simulation is much more efficient and can be used to test classical (but reversible) components of a quantum program. Alternatively we can simulate the quantum program using sim hqw , which calculates a probability distribution; in this case the difference is unremarkable. A more interesting example is to apply the Hadamard transformation , 1 1 1 √ 2 1 −1 to our qubit before measuring it. Given a qubit q the expression uhad q :: U represents this unitary, i.e., reversible, computation – we provide the implementation later. The function applyU :: U → QIO () allows us to run a unitary computation, thereby embedding reversible into nonreversible quantum computations. We arrive at the following piece of code: rnd :: QIO Bool rnd = do q ← mkQbit False applyU (uhad q) measQbit q The expression run rnd will now produce a random result. How can this be, given that Haskell is a pure functional language? Indeed run embeds QIO into Haskell’s IO monad, which allows us to access effects such as random computations. In contrast sim rnd doesn’t use IO but returns the probability distribution: [(True, 0.5), (False, 0.5)].
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
The Quantum IO Monad
14:36
185
To demonstrate that QIO goes beyond classical random computation we can produce a pair of entangled qubits. To do this we use the unitary conditional cond , which allows us to construct branching reversible quantum programs. That is, given q :: Qbit and t, u :: U , the expression cond q (λb → if b then t else u) intuitively runs the programs t, u depending on q. Actually, if the current value of q is not a base state, both computations t and u will contribute to the result. This is the source of quantum parallelism. We exploit the conditional to produce a Bell pair and measure it. Given a qubit qa in any state and another qubit qb prepared in the base state False, we can entangle qb with qa using the one-sided ifQ, which is implemented as a conditional that applies the empty computation when the control qubit is False. The expression unot qb :: U negates qb. Putting everything together we obtain: testBell :: QIO (Bool , Bool ) testBell = do qa ← mkQbit False applyU (uhad qa) qb ← mkQbit False applyU (ifQ qa (unot qb)) a ← measQbit qa b ← measQbit qb return (a, b) Evaluating sim testBell reveals that the two apparently independent measurements always agree: [((True, True), 0.5), ((False, False), 0.5)]. The reason is that we created an entangled quantum state √12 (|00 + |11) and once we measure one of the bits it is projected into one of the base states |00 and |11 with probability 12 = | √12 |2 . The reader may wonder whether cond or ifQ will always produce a unitary, i.e., reversible operation. Couldn’t we irreversibly reset a qubit q by running ifQ q (unot q)? Indeed, the conditional has a semantic side condition that the computations in the branches will not change the qubit we are branching over. Haskell’s type system is too weak to express this constraint, but this violation will be caught by sim or run at runtime. This could be fixed by using a more expressive type system, e.g., Coq (Coq Development Team 2004) or Agda (Norell 2007). Using functional abstraction we can organize our quantum programs more succinctly. The bell example exploits the fact that we can share the state of a qubit. This can be realized by the following function: share :: Qbit → QIO Qbit share qa = do qb ← mkQbit False applyU (ifQ qa (unot qb)) return qb
P1: SBT CUUS834-05
cuus834-gay
186
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
It is important to realize that the quantum state is not copied (this would contradict the no-cloning theorem), but merely shared.6 That is, share qa produces a new qubit that shares the state of the given qubit. We can also separate the production of a qubit in the |+ or |− states: |− :: QIO Qbit |+ :: QIO Qbit |− = do q ← mkQbit True |+ = do q ← mkQbit False applyU (uhad q) applyU (uhad q) return q return q Moreover, we can separate the production of a Bell pair and its measurement: bell :: QIO (Qbit, Qbit) bell = do qa ← |+ qb ← share qa return (qa, qb) Now the function bell simply generates a Bell pair. The main function testBell now becomes testBell = do (qa, qb) ← bell a ← measQbit qa b ← measQbit qb return (a, b) This shows that functional abstraction and quantum programming interact well, extending Haskell’s functional approach for classical effects to quantum effects. We can go further and use Haskell’s class system to organize quantum data. The reader may have noticed that the functions mkQbit :: Bool → QIO Qbit and measQbit :: Qbit → QIO Bool look like inverses, relating the classical type Bool with the quantum representation Qbit. This idea extends to other types, i.e., in the example testBell we may want to exploit the correspondence of (Bool , Bool ) and (Qbit, Qbit) by providing functions mk2Qbits : (Bool , Bool ) → QIO (Qbit, Qbit) and meas2Qbits : (Qbit, Qbit) → QIO (Bool , Bool ). Indeed, the conditional can also be lifted to pairs, while cond had the type Qbit → (Bool → U ) → U the corresponding operation for pairs allows us to branch over a pair: cond2Qbits : (Qbit, Qbit) → ((Bool , Bool ) → U ) → U . More generally, we can introduce a class that allows us to relate classical data and quantum data in a systematic fashion7 : class Qdata a qa | a → qa, qa → a where mkQ :: a → QIO qa measQ :: qa → QIO a condQ :: qa → (a → U ) → U 6 7
Quantum sharing is used in QML (Altenkirch and Grattage 2005) and for the linear-algebraic λ-calculus (Arrighi and Dowek 2008) to model nonlinear use of quantum variables. The definition also exploits functional dependencies a → qa, qa → a, which are again hints to the Haskell type checker.
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
14:36
The Quantum IO Monad
187
An instance of this class is qubits with Booleans: instance Qdata Bool Qbit where mkQ = mkQbit measQ = measQbit condQ q br = cond q br and we can show that Qdata is closed under pairing: instance (Qdata a qa, Qdata b qb) ⇒ Qdata (a, b) (qa, qb) where mkQ (a, b) = do qa ← mkQ a qb ← mkQ b return (qa, qb) measQ (qa, qb) = do a ← measQ qa b ← measQ qb return (a, b) condQ (qa, qb) br = condQ qa (λx → condQ qb (λy → br (x , y))) Other instances of this class include the closure of Qdata over lists: instance Qdata a qa ⇒ Qdata [a ] [qa ] where mkQ n = sequence (map mkQ n) measQ qs = sequence (map measQ qs) letU as xsu = letU as [ ] where letU [ ] xs = xsu xs letU (a : as) xs = letU a (λx → letU as (xs ++ [x ])) condQ qs qsu = condQ qs [ ] where condQ [ ] xs = qsu xs condQ (a : as) xs = condQ a (λx → condQ as (xs ++ [x ])) and in Section 5.4 we’ll even present a quantum integer data type (QInt) that is a member of Qdata along with the classical Int data type. We can now use the generic operation measQ to define testBell : testBell = do qab ← bell measQ qab The complete overview of the QIO API is given in Figure 5.1. Let’s explain the operations we haven’t yet covered in our examples. First note that U is actually a monoid, i.e., we can execute unitary operations sequentially using mappend . The neutral element is the empty computation mempty, which is actually needed to derive ifQ from cond : ifQ :: Qbit → U → U ifQ q u = cond q (λx → if x then u else mempty)
P1: SBT CUUS834-05
cuus834-gay
188
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
For brevity, we shall now write mappend as and mempty as •. Our examples also already exploited the fact that QIO is a monad, using the do notation, which translates programs with an imperative look into pure monadic functional programs. Our primitive unitary operations are rot and swap. The function rot allows us to apply any unitary 2 × 2 complex valued matrix represented as a function (Bool , Bool ) → C to a given qubit. We can derive the operations uhad , unot, and uphase: unot :: Qbit → U unot x = rot x (λ(x , y) → if x ≡ y then 0 else 1) uhad :: Qbit → U uhad x = rot x (λ(x , y) → if x ∧ y then − h else h) where h = (1 / sqrt 2) uphase :: Qbit → R → U uphase x r = rot x (rphase r ) rphase :: R → Rotation rphase (False, False) = 1 rphase r (True, True) = exp (0 : + r ) rphase ( , ) =0 We also include swap x y as a primitive for reasons of efficiency even though this function could be derived: The swap operation is equivalent to three controlled not operations in a row as in the following circuit diagram: |ψ
•
X
•
|φ
|φ
X
•
X
|ψ
which could easily be implemented in QIO as: swap :: Qbit → Qbit → U swap qa qb = ifQ qa (unot qb) ifQ qb (unot qa) ifQ qa (unot qb) Many useful quantum computations use ancillas, i.e., auxiliary qubits; an example is quantum addition, as we will see later (Section 5.4). A quantum computation using ancillas is unitary, if it doesn’t change the state of the ancilla. This may sound useless; however, we are allowed to use the ancilla as long as we make sure that we leave it back in the state in which we found it. The QIO API supports ancillas with the function ulet :: Bool → (Qbit → U ) → U : the expression ulet b f temporarily creates a new qubit q initialized in the base state b, runs f q, and then returns q to the pool of unused qubits. Again ulet imposes a semantic condition: after running f q the qubit q has to again be in the base state b. As before, this semantic condition is caught at runtime. As the ulet constructor is again a
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
14:36
The Quantum IO Monad
189
function relating Booleans and qubits, we are able to extend the Qdata class with the function: class Qdata a qa | a → qa, qa → a where .. . letU :: a → (qa → U ) → U meaning any members of the Qdata class must also define a letU function to allow any Qdata to be used as an auxiliary quantum data structure. For example, the letU functions for qubits and for pairs of Qdata are as follows: instance Qdata Bool Qbit where .. . letU b xu = ulet b xu instance (Qdata a qa, Qdata b qb) ⇒ Qdata (a, b) (qa, qb) where .. . letU (a, b) xyu = letU a (λx → letU b (λy → xyu (x , y))) Finally, we have an operation urev that calculates the inverse of a given invertible operation. The following subsections go on to give some slightly more in-depth examples of quantum computations written in QIO. Section 5.3.1 gives details of our implementation of Deutsch’s algorithm, and Section 5.3.2 gives details of our implementation of quantum teleportation.
5.3.1 Deutsch’s Algorithm Deutsch’s algorithm (Deutsch 1985) was presented as one of the first and simplest quantum algorithms that could be proven to provide a solution to its problem quicker than any classical solution. The problem involves being given a function f :: Bool → Bool and being asked to calculate whether the function is balanced or constant. There are only four possible functions that f can be, which relate to the identity function, the not function, the constant False function, or the constant True function. Classically it can be shown that two applications of f are required to tell whether it is one of the balanced or one of the constant functions, but in a quantum computer it is possible to get the answer having to run the function f only once (albeit over a quantum state). In the QIO monad the algorithm can easily be modeled: we initialize two qubits in the |+ and |− states, and then conditionally negate the second qubit depending on the outcome of applying f to the first qubit. We then apply the Hadamard transformation to the first qubit and measure it. This is confusing at first glance because classically it seems that the first qubit should be unaffected by the operation we have performed. But indeed, doing the operation in the |+, |−-basis does the trick and we have to consult f only once.
P1: SBT CUUS834-05
cuus834-gay
190
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
deutsch :: (Bool → Bool ) → QIO Bool deutsch f = do x ← |+ y ← |− applyU (cond x (λb → if f b then unot y else •)) applyU (uhad x ) measQ x In either of the cases where f was a constant function, the measurement will yield False (with probability 1), and in the cases where f is a balanced function, the measurement will yield True (again with probability 1). Evaluating, sim (deutsch ¬) gives [(True, 1.0)], sim (deutsch id ) also gives [(True, 1.0)]. sim (deutsch (λx → False)) gives [(False, 1.0)], and sim (deutsch (λx → True)) also gives [(False, 1.0)].
5.3.2 Quantum Teleportation Quantum teleportation can be thought of as a process that transfers the state of a single qubit to another single qubit. It makes use of an entangled pair of qubits that are shared between the transmitting and receiving parties (usually referred to as Alice and Bob). It doesn’t break the rule of no-cloning as the state of the original qubit is lost in the process. An example textbook description of quantum teleportation as taken from Nielsen and Chuang (2000) is as follows: Alice and Bob met long ago but now live far apart. While together they generated an EPR pair, each taking one qubit of the EPR pair when they separated. Many years later, Bob is in hiding, and Alice’s mission, should she choose to accept it, is to deliver a qubit |ψ to Bob. She does not know the state of the qubit, and moreover can only send classical information to Bob. Should Alice accept the mission? Intuitively, things look pretty bad for Alice. She doesn’t know the state |ψ of the qubit she has to send to Bob, and the laws of quantum mechanics prevent from determining the state when she only has a single copy of |ψ in her possession. What’s worse, even if she did know the state |ψ, describing precisely takes an infinite amount of classical information since |ψ takes values in a continuous space. So even if she did know |ψ, it would take forever for Alice to describe the state to Bob. It’s not looking good for Alice. Fortunately for Alice, quantum teleportation is a way of utilising the entangled EPR pair in order to send |ψ to Bob, with only a small overhead of classical communication. In outline, the steps of the solution are as follows: Alice interacts the qubit |ψ with her half of the EPR pair, and then measures the two qubits in her possession, obtaining one of four classical results, 00, 01, 10, and 11. She sends this information to Bob. Depending on Alice’s classical message, Bob performs one of four operations on his half of the EPR pair. Amazingly by doing this he can recover the original state |ψ!
The following quantum circuit gives a more precise description of quantum teleportation. 76M23 54 • • |ψ H 01 1 X
76M23 54 01 2
•
EPR X M2
Z M1
|ψ
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
The Quantum IO Monad
14:36
191
The top two lines represent Alice’s qubits, that is, the input qubit (which is in the state |ψ) and her qubit from the EPR pair. The bottom line represents Bob’s qubit. Alice entangles the input qubit with her EPR pair qubit using a controlled Not operation, as we have shown previously in the sharing example. Then she performs a Hadamard rotation on the input qubit before measurement (which is equivalent to a measurement in the Hadamard basis). The double lines coming from the measurements represent the classical data that she sends to Bob, who correspondingly has to perform (conditionally depending on the classical bits) an X and a Z rotation on his qubit, which will then be in the state |ψ. It is also clear to see that the state of the original input qubit has been lost as it will be in one of the base states, |0 or |1, depending upon the measurement outcome. Within the QIO monad, quantum teleportation can be considered as given by three functions. First there is what Alice has to do, second there is what Bob has to do, but third there is the requirement that they each have one qubit from an entangled pair of qubits. This third requirement means that each part of the teleportation algorithm must take part within the same quantum system. Alice has her initial qubit (aq) and one of the entangled pair of qubits (eq). All she has to do is apply a controlled not between these two qubits, and then perform the Hadamard rotation on the first one. Finally she has to measure these two qubits and send the results of this measurement to Bob. In the QIO monad this can be coded as: alice :: Qbit → Qbit → QIO (Bool , Bool ) alice aq eq = do applyU (ifQ aq (unot eq)) applyU (uhad aq) measQ (aq, eq) Bob has his qubit from the entangled pair (eq) and receives the classical data from Alice (cd). Depending on the classical data, Bob must apply the necessary unitary. Again, in the QIO monad this can be coded as: uZ :: Qbit → U uZ qb = (uphase qb 0.5) bobsU bobsU bobsU bobsU bobsU
:: (Bool , Bool ) → Qbit → U (False, False) eq = • (False, True) eq = (unot eq) (True, False) eq = (uZ eq) (True, True) eq = ((unot eq) (uZ eq))
bob :: Qbit → (Bool , Bool ) → QIO Qbit bob eq cd = do applyU (bobsU cd eq) return eq The teleportation algorithm can be defined by creating an entangled pair; Alice uses the input qubit and one of the pair to return the classical data. Bob can then use this classical data and his element of the entangled pair to return the teleported qubit. In the QIO monad this is coded as:
P1: SBT CUUS834-05
cuus834-gay
192
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
teleportation :: Qbit → QIO Qbit teleportation iq = do (eq1 , eq2 ) ← bell cd ← alice iq eq1 tq ← bob eq2 cd return tq
5.4 Reversible Arithmetic Quantum computation is a superset of classical reversible computation, enabling classical reversible computations to be defined within QIO. Reversible computation can by definition have no side effects, and indeed our runC function for the evaluation of the classical subset of QIO doesn’t need to embed the result of the evaluation in a monad: runC :: QIO a → a just returns a pure result. However, as we are working in the quantum realm, it is possible to run these purely classical computations over a quantum state. In essence, this has the effect of running the computation over each base state within a given superposition. We’ll see later, in Section 5.5, that being able to run an albeit classical modular exponentiation function over a superposition of states plays a major role in Shor’s algorithm, and in the rest of this section we look at our library of reversible arithmetic functions in QIO that will build up to give us this modular exponentiation function that is required. Much of our work on reversible arithmetic follows from the work in Vedral et al. (1995). For this section we have created the quantum data-type QInt which is essentially a wrapper for a list of qubits. data QInt = QInt [Qbit ] deriving Show We provide functions that convert between classical integers and lists of Booleans of fixed length. The length is defined by: qIntSize :: Int These functions (int2bits and bits2int) are then used to create an instance of the Qdata class between Int and QInt. The definitions mostly use the definitions for lists of Qdata but lifted to the QInt datatype. instance Qdata Int QInt where mkQ n = do qn ← mkQ (int2bits n) return (QInt qn) measQ (QInt qbs) = do bs ← measQ qbs return (bits2int bs) letU n xu = letU (int2bits n) (λbs → xu (QInt bs)) condQ (QInt qi ) qiu = condQ qi (λx → qiu (bits2int x )) In simple Boolean arithmetic circuits (such as we defined previously in Section 5.2.1) the addition of integers is performed by going through the bits, adding the corresponding bits, and keeping track of any overflow. We can express both
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
14:36
The Quantum IO Monad
193
the calculation of the current sum and the calculation of the carry as reversible algorithms: sumq :: Qbit → Qbit → Qbit → U sumq qc qa qb = cond qc (λc → cond qa (λa → if a ≡ c then unot qb else •)) carry :: Qbit → Qbit → Qbit → Qbit → U carry qci qa qb qcsi = cond qci (λci → cond qa (λa → cond qb (λb → if ci ∧ a ∨ ci ∧ b ∨ a ∧ b then unot qcsi else •))) We note that carry needs access to the current and the next carry bit, while sumq only depends on the current qubits. Using these functions we could now implement reversible addition as a function of type qadd :: QInt → QInt → QInt → Qbit → U qadd (QInt qas) (QInt qbs) (QInt qcs) qc = qadd qas qbs qcs qc where qadd [ ] [ ] [ ] qc = • qadd [qa ] [qb ] [qci ] qc = carry qci qa qb qc sumq qci qa qb qadd (qa : qas) (qb : qbs) (qci : qcsi : qcs) qc = carry qci qa qb qcsi qadd qas qbs (qcsi : qcs) qc urev (carry qci qa qb qcsi ) sumq qci qa qb The algorithm requires an additional third register that needs to be initialized ' i.e., a quantum register where each qubit is |0, to store the auxiliary carry to |0, bits. We have designed the algorithm so that it leaves this register in the same state ' as it has found it. This is achieved by undoing the computation of the carry |0, bit using urev after it has been used. Hence, we could measure this additional register without affecting the rest of the computation. However, measuring the register means that we have to define a potentially irreversible operation living in QIO, which means that we cannot use addition to derive other unitary operations, which is exactly what we want to do for Shor’s algorithm. The other alternative is to thread the auxiliary qubits through all the arithmetic operations we define, reusing it at other places where we need temporary qubits. This leads to a very low-level design, where memory management is explicit – this leads to a drastic loss of modularity.
P1: SBT CUUS834-05
cuus834-gay
194
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
This is exactly the reason why we need ulet, that temporarily creates qubits that can be used in a unitary operation under the condition that they are restored to the state they were found in. qadd :: QInt → QInt → Qbit → U qadd (QInt qas) (QInt qbs) qc = ulet False (qadd qas qbs) where qadd [ ] [ ] qc = ifQ qc (unot qc ) qadd (qa : qas) (qb : qbs) qc = ulet False (λqc → carry qc qa qb qc qadd qas qbs qc urev (carry qc qa qb qc )) sumq qc qa qb Extending on this function for reversible addition, we can carry on following Vedral et al. (1995) and create the necessary functions to build up to the goal of a reversible modular exponentiation algorithm. The next step is to create a modular addition function using the addition function we have already created. adderMod :: Int → QInt → QInt → U Then we can use the modular addition function to create a modular multiplication function. multMod :: Int → Int → QInt → QInt → U This can easily be adapted into a controlled operation with our ifQ constructor: condMultMod :: Qbit → Int → Int → QInt → QInt → U condMultMod q n a x y = ifQ q (multMod n a x y) Modular exponentiation is achieved by using iterated squaring and takes advantage of the fact that modular inverses can be computed efficiently classically. modExp :: Int → Int → QInt → QInt → U
5.5 Shor’s Algorithm Shor’s algorithm (Shor 1994) is perhaps the most famous of all algorithms that have been designed specifically for use on quantum computers. It can be used to find the factors of large numbers, which in classical computation is currently believed to be computationally infeasible. The best known classical solution to the problem is an algorithm of exponential time complexity in the size of its input (the number of bits used). However, Shor’s algorithm, which is a quantum algorithm, has only a polynomial time complexity. This is an exponential speed-up over the best known classical solution. Shor’s algorithm is sometimes referred to as the “killer application” for quantum computers. This nomenclature came about because factorizing large numbers
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
|0
/
|1
/
H ⊗t
October 31, 2009
The Quantum IO Monad
| j
•
QFT †
14:36
195
7654 0123 M
x j mod N Figure 5.2. Shor’s algorithm
was thought to be so computationally infeasible that it forms the basis of the RSA encryption protocol (Rivest et al. 1977). The RSA encryption protocol is a very widely used public-key protocol for sending secure information over public channels such as the Internet. It works on the principle that multiplying two large prime numbers ( p and q) is computationally easy, and a public and private key can be computed from the result (n = p ∗ q). However, if it is possible for an eavesdropper to compute p and q from n, then it is also possible for them to work out the private key. If we can now factor large numbers in polynomial time, this encryption scheme has effectively been broken, allowing anyone with a sufficiently large quantum computer to intercept and decode encrypted data. It is not much of a coincidence that since 1994 when Peter Shor first published his algorithm, governments and other large organizations have been giving more and more money for research into quantum computers and quantum computation! Peter Shor exploited the fact that the factors of a number can be computed from the period of a given modular exponentiation function. In fact, the exponentiation function required was shown to be of the form f (x) = a x mod N , where N is the number we wish to factorize and a is known to be coprime to N . That is, the greatest common divisor of a and N is 1. Calculating the greatest common divisor of two numbers can be done efficiently classically, using the Euclidean algorithm, and hence finding values for a can also be done classically. Depending on the value of a, it is possible that the period of this function can be used to find factors of the input. Shor discovered that finding the period of this function (and other periodic functions) can be done efficiently on a quantum computer. The efficiency of this period-finding algorithm comes directly from the use of quantum parallelism. Two quantum registers (of sufficient number of qubits to represent N ) are ' The first of these two quantum registers is placed into initialized into the state |0. an equal superposition of all its possible base states (using Hadamard rotations). This register (|k) is then used as x in our exponential function f (x) = a x mod N such that the result of the function is stored in the second quantum register. At this point in the computation our quantum registers will be in the state (|k, a k mod N ) in such a way that each value of k in the first register is entangled with its corresponding a k mod N in the second register. Shor goes on to show that the application of a discrete Fourier transform to the first register will (with high probability) yield the period of the given input function. Figure 5.2 shows us what we essentially need to implement Shor’s algorithm within QIO. We can easily set up the required Hadamard rotations, and Section 5.4 shows us how we’ve implemented the necessary modular exponentiation
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
196
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green | j1
H
| j2
•
. . . | jn−1 | jn
R2 · · · Rn−1
Rn
··· . . . ···
H · · · Rn−2 . . . ···
•
|0 + e2πi0. j1 ... jn |1
Rn−1 · · ·
|0 + e2πi0. j2 ... jn |1
. . . ··· H
•
•
1 where Rk is the unitary 0
0
···
•
R2
···
···
•
···
···
.
|0 + e
2πi0. jn−1 jn
|1
|0 + e2πi0. jn |1
/
2πi
e 2k
Figure 5.3. A circuit for the Quantum Fourier transform
function; all we need now is the function implementing the inverse quantum Fourier transform.
5.5.1 Quantum Fourier Transform The quantum Fourier transformation (QFT) is basically the fast, discrete Fourier transformation applied to a quantum register, where the discrete Fourier transform maps functions in the time domain into functions in the frequency domain, or in other words, decomposes a function in terms of sinusoidal functions of different frequencies. In Shor’s algorithm the inverse Fourier transformation is used to recover the frequency representation of the modular exponential, thus giving direct access to the period. The QFT as developed in Nielsen and Chuang (2000), pp. 216–221 (given here in Figure 5.3) can be easily encoded in the QIO monad, giving rise to a nice functional implementation over a list of qubits: qft :: [Qbit ] → U qft qs = condQ qs (λbs → qftAcu qs bs [ ]) The qft functions makes use of a conditional statement over a list of qubits, allowing the definition to be decomposed into terms of an accumulator function8 : qftAcu :: [Qbit ] → [Bool ] → [Bool ] → U qftAcu [ ] [ ] =• qftAcu (q : qs) (b : bs) cs = qftBase cs q qftAcu qs bs (b : cs) qftBase :: [Bool ] → Qbit → U qftBase bs q = f bs q 2 where f [ ] q = uhad q f (b : bs) q x = if b then (rotK x q) f bs q (x + 1) else f bs q (x + 1) rotK :: Int → Qbit → U rotK k q = uphase q (1.0 / (2.0 ↑ k )) 8
Accumulator functions are often used in Haskell to create more efficient implementations of list processing functions, e.g. fast reverse.
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
The Quantum IO Monad
14:36
197
Although we have created the QFT here, Shor’s algorithm requires the inverse QFT. Fortunately, because of the reversible nature of unitaries, the inverse QFT can be given by urev qft.
5.5.2 Shor in QIO We’ve now seen how we can create all the necessary pieces for Shor’s algorithm; we can define the hadamards function recursively over the list representation of the QInt. hadamards :: QInt → U hadamards (QInt [ ]) = • hadamards (QInt (q : qs)) = uhad q hadamards (QInt qs) The inverse quantum Fourier transform can also be lifted to the QInt data type. qftI :: QInt → U qftI (QInt i ) = urev (qft i ) The unitary used by Shor’s algorithm can now be given as: shorU :: QInt → QInt → Int → Int → U shorU k i1 x n = hadamards k modExp n x k i1 qftI k To ensure that the given QInt arguments to the shorU function are correct (|0 and |1), we can now define shor as a function which takes two classical inputs, n the number to be factorized, and x a number that is coprime to n. The shor function initializes the necessary quantum integers, the shorU unitary applies the Hadamard rotations to the zeroed input, then the modExp unitary is applied over both of the quantum integers (along with the necessary classical inputs), and then the inverse quantum Fourier transform is applied. Finally, the period is measured and returned. shor :: Int → Int → QIO Int shor x n = do i0 ← mkQ 0 i1 ← mkQ 1 applyU (shorU i0 i1 x n) p ← measQ i0 return p Finding the x argument can be done classically, and extracting the result from the returned period is also a classical problem. These can easily be programmed in Haskell and used with the QIO monad to create the overall factorization function (factor :: Int → QIO (Int, Int)). A typical evaluation of run (factor 15) is (5, 3).
P1: SBT CUUS834-05
cuus834-gay
198
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
5.6 Implementing QIO In this section we go through the implementation of the QIO API, specifically how we realize run, runC , and sim. If we had a real quantum computer we could implement run much more efficiently, but here we use a classical random number generator to simulate the quantum behavior. To represent quantum states within a classical system, it is necessary to define a data structure that represents a superposition of classical base states. For this purpose we have defined a class of Heaps that are used to represent the classical base states, and then we have defined a class of vectors we have dubbed VecEq that can hold multiple occurrences of the heaps, whereby each one is associated with its corresponding complex amplitude in the current superposition. The name VecEq for these vectors is derived from the way that the primitive operations available for the vectors should automatically keep the overall state normalized and hence never allow a superposition to take up more space in memory than the number of classical base states that make up the super-position. Building the normalization directly into the vector class in this way follows from the fact that only types with equality can be normalized (such as our Heaps).
5.6.1 Heaps We define the Heap class by class Eq h ⇒ Heap h where initial :: h update :: h → Qbit → Bool → h (?) :: h → Qbit → Maybe Bool forget :: h → Qbit → h hswap :: h → Qbit → Qbit → h hswap h x y = update (update h y (fromJust (h ? x ))) x (fromJust (h ? y)) The Maybe monad is used here so that uninitialized qubits can have the state Nothing and don’t lead to an undefined Heap. A Heap must provide an initial element, which represents an empty Heap, before any qubits have been initialized. To accommodate the application of mkQbit the Heap must also come with an update function. The update function, when given a heap, a qubit, and a Boolean value, should just return a new heap in which the given qubit has been updated to the given Boolean value. This update function is also used whenever a rotation is applied to a state, as the only effect a rotation may have on the individual base states of a superposition is to apply the classical not function to one of the qubits in the base state. To deal with measurements, a query function (?) must also be provided, which just applies the given heap to the given qubit and returns the Boolean value of that qubit. If the qubit isn’t initialized, meaning the heap computes to Nothing, then a suitable error message is returned. The main case where an error of this sort
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
The Quantum IO Monad
14:36
199
occurs in practice is in a conditional where the control qubit appears as a variable in one of the branches. To accommodate the throwing of a runtime error whenever such a conditional occurs, the control qubit is temporarily forgotten from each base state using the provided forget function and hence, if it is used in one of the branches, the query function will fail, returning the error. A generic swap function on heaps, hswap, is also provided. This swaps the positions of two qubits within a Heap and is how the swap unitary is dealt with at the level of heaps. We use Haskell’s Map data type for our implementation of a Heap. The Map data type is an efficient implementation of key-value maps, which is exactly what we require for our heaps (between qubits and Booleans), and the operations required for heaps can be directly translated into the primitive operations provided by the Maps. type HeapMap = Map.Map Qbit Bool instance Heap HeapMap where initial = Map.empty update h q b = Map.insert q b h h ? q = Map.lookup q h forget h q = Map.delete q h The classical simulator runC uses a single Heap to represent the entire state of the system, along with an integer representing the next free qubit. data StateC = StateC {freeC :: Int, heap :: HeapMap } Any QIO program that uses only classical rotations is just translated into the primitive Heap operations given previously.
5.6.2 Vectors To hold our quantum states we define a class of vectors similar to the vectors we introduced in Section 5.2.3, the main difference being that these vectors (VecEq) require that the type they hold is a member of the Eq class. This is a requirement here as we know that we shall be using these vectors over the Heap data type, along with their complex amplitude in the current superposition. Heap is a member of Eq, and it allows us to keep the vectors normalized at the level of vector operations (specifically ⊕). This is achieved by combining the members of the vector that are equal, when concatenating two vectors. We have defined VecEq as a class such that we can change the specific implementation if we find a more efficient data type that fulfils the class. class VecEq v where vzero :: v x a (⊕) :: (Eq a, Num x ) ⇒ v x a → v x a → v x a (⊗) :: (Num x ) ⇒ x → v x a → v x a
P1: SBT CUUS834-05
cuus834-gay
200
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
(@) :: (Eq a, Num x ) ⇒ a → v x a → x fromList :: [(a, x )] → v x a toList :: v x a → [(a, x )] For the moment the implementation we’re using for VecEq is again lists of pairs, as in the Vec example. The main difference now is how the ⊕ operation works: data VecEqL x a = VecEqL{unVecEqL :: [(a, x )]} deriving Show vEqZero :: VecEqL x a vEqZero = VecEqL [ ] The ⊕ function (vEqPlus) uses a fold operation to add each element from the first vector to the second vector. The add function takes care of this by combining elements that occur in both vectors by adding their numeric values. vEqPlus :: (Eq a, Num x ) ⇒ VecEqL x a → VecEqL x a → VecEqL x a (VecEqL as) ‘vEqPlus‘ vbs = foldr add vbs as add :: (Eq a, Num x ) ⇒ (a, x ) → VecEqL x a → VecEqL x a add (a, x ) (VecEqL axs) = VecEqL (addV axs) where addV [ ] = [(a, x )] addV ((by@(b, y)) : bys) | a ≡ b = (b, x + y) : bys | otherwise = by : (addV bys) The ⊗ and @ functions (vEqTimes and vEqAt) are equivalent to the functions we saw for the vectors in Section 5.2.3. vEqTimes :: (Num x ) ⇒ x → VecEqL x a → VecEqL x a l ‘vEqTimes‘ (VecEqL bs) | l ≡ 0 = VecEqL [ ] | otherwise = VecEqL (map (λ(b, k ) → (b, l ∗ k )) bs) vEqAt :: (Eq a, Num x ) ⇒ a → VecEqL x a → x a ‘vEqAt‘ (VecEqL [ ]) = 0 a ‘vEqAt‘ (VecEqL ((a , b) : abs)) | a ≡ a = b | otherwise = a ‘vEqAt‘ (VecEqL abs) instance VecEq VecEqL where vzero = vEqZero (⊕) = vEqPlus (⊗) = vEqTimes (@) = vEqAt fromList as = VecEqL as toList (VecEqL as) = as The requirement that the underlying type be a member of Eq leads to a problem that we can no longer define VeqEq as a monad, which we require so we can sequence
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
14:36
The Quantum IO Monad
201
the QIO operations over it. To overcome this problem we use a technique suggested by Sittampalam (2008). We define an EqMonad class class EqMonad m where eqReturn :: Eq a ⇒ a → m a eqBind :: (Eq a, Eq b) ⇒ m a → (a → m b) → m b of which VecEq is a member: instance (VecEq v , Num x ) ⇒ EqMonad (v x ) where eqReturn a = fromList [(a, 1)] eqBind va f = case toList va of ([ ]) → vzero ((a, x ) : [ ]) → x ⊗ f a ((a, x ) : vas) → (x ⊗ f a) ⊕ ((fromList vas) ‘eqBind ‘ f ) Members of the EqMonad class can now be embedded into a monad using the AsMonad data-type. data AsMonad m a where Embed :: (EqMonad m, Eq a) ⇒ m a → AsMonad m a Return :: EqMonad m ⇒ a → AsMonad m a Bind :: EqMonad m ⇒ AsMonad m a → (a → AsMonad m b) → AsMonad m b instance EqMonad m ⇒ Monad (AsMonad m) where return = Return (> >=) = Bind In order to make use of our embedded EqMonad we provide the following unEmbed function: unEmbed unEmbed unEmbed unEmbed unEmbed unEmbed
:: Eq a ⇒ AsMonad m a → m a (Embed m) = m (Return a) = eqReturn a (Bind (Embed m) f ) = m ‘eqBind ‘ (unEmbed ◦ f ) (Bind (Return a) f ) = unEmbed (f a) (Bind (Bind m f ) g) = unEmbed (Bind m (λx → Bind (f x ) g))
Now that we have our VecEq as monads, we can see how our unitary operations (U ) in QIO are translated into operations on them.
5.6.3 Evaluating QIO Computations We start by defining the data type Pure as a vector of heaps along with their complex amplitudes: type Pure = VecEqL C HeapMap
P1: SBT CUUS834-05
cuus834-gay
202
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
We now define a type Unitary, which are functions that take a Heap and return a new Pure value. We will see that all members of our U data type are converted into a Unitary, which is then used to evaluate the specific U . The Unitary data type is also defined as a monoid so that unitaries can be combined using the (embedded) monadic structure of the underlying Pure data type. data Unitary = U {unU :: Int → HeapMap → Pure } instance Monoid Unitary where • = U (λfv h → unEmbed (return h)) (U f ) (U g) = U (λfv h → unEmbed (do h ← Embed (f fv h) h ← Embed (g fv h ) return h )) Defining the Unitary data type as a monoid in this way allows the unitary operations to be mapped over a whole Pure data type as is required to run a unitary over the whole quantum state: runU runU runU runU runU runU
:: U → Unitary UReturn = • (Rot x a u) = uRot x a runU u (Swap x y u) = uSwap x y runU u (Cond x us u) = uCond x (runU ◦ us) runU u (Ulet b xu u) = uLet b (runU ◦ xu) runU u
The functions uRot, uSwap, uCond , and uLet actually convert each of the underlying U type into a Unitary. For example, the uRot function is as follows: uRot :: Qbit → Rotation → Unitary uRot q r = (uMatrix q (r (False, False), r (False, True), r (True, False), r (True, True))) uMatrix :: Qbit → (C, C, C, C) → Unitary uMatrix q (m00 , m01 , m10 , m11 ) = U (λfv h → ( if (fromJust (h ? q)) then (m01 ⊗ (unEmbed (return (update h q False)))) ⊕ (m11 ⊗ (unEmbed (return h))) else (m00 ⊗ (unEmbed (return h))) ⊕ (m10 ⊗ (unEmbed (return (update h q True)))))) We can define our state as a free variable (the next available qubit), along with a Pure. data StateQ = StateQ{free :: Int, pure :: Pure }
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
14:36
The Quantum IO Monad
203
We make use of the State monad to thread our state throughout our computations evalWith :: PMonad m ⇒ QIO a → State StateQ (m a) The QReturn value is just the return of the monad. evalWith (QReturn a) = return (return a) Initializing a qubit updates the current Pure state with the value of the new qubit and increases the free variable by 1. evalWith (MkQbit b g) = do (StateQ f p) ← get put (StateQ (f + 1) (updateP p (Qbit f ) b)) evalWith (g (Qbit f )) Applying a unitary makes use of the runU function as described previously. evalWith (ApplyU u q) = do (StateQ f p) ← get put (StateQ f (unEmbed ( do x ← Embed (p) x ← Embed (uu f x ) return x ))) evalWith q where U uu = runU u Measurement splits the Pure state about the given qubit, then continues the computation in both Pure states, before leaving the merging of these two results up to the merge function of whichever PMonad we are working within. evalWith (Meas x g) = do (StateQ f p) ← get (let Split pr ift iff = split p x in if pr < 0 ∨ pr > 1 then error "pr < 0 or >1" else do put (StateQ f ift) pift ← evalWith (g True) put (StateQ f iff ) piff ← evalWith (g False) return (merge pr pift piff )) Lazy evaluation is specifically useful here because if the merge function requires only one of the Pure states (as is the case for the run function), then the other Pure state is not evaluated. The final definitions for run and sim simply call the eval function, but their given types tell the type system which PMonad it should use.
P1: SBT CUUS834-05
cuus834-gay
204
978 0 521 51374 6
October 31, 2009
14:36
Thorsten Altenkirch and Alexander S. Green
eval :: PMonad m ⇒ QIO a → m a eval p = evalState (evalWith p) initialStateQ run :: QIO a → IO a run = eval sim :: QIO a → Prob a sim = eval
5.7 Conclusions and Further Work This work has proved to be a nice example of monadic programming and is, we hope, also a step into the world of quantum computation for many functional programmers. The work also leads us on to many more ideas of what we would like to achieve in the realm of quantum computation. Our first thought on extending QIO is to implement a dependently typed version of QIO in either Coq or Agda, thus moving the checking of the semantic side conditions from runtime to the type checker at compile time. This change will allow the type U of unitary operations to be easier to reason about, leading to a nicer algorithmic approach to the design of quantum computations within QIO. Moving from functional programming to type theory also turns our programs into a formal semantics for quantum programs, with the possibility of developing formally verified quantum programs. An underlying design factor of the QIO monad is its relation to the circuit model of quantum computation. However, we are interested in providing a different semantics more in keeping with the ideas presented in the measurement calculus (Danos et al. 2007). The idea would be the same, that QIO will provide a interface from functional programming to quantum computation, but this different semantics will be available if the ideas of one-way quantum computation become the standard way in which physicists are able to create real-world quantum computers.
Acknowledgments We have profited from Ralf Hinze’s and Andres L¨oh’s implementation of lhs2TeX to typeset the Haskell code in this paper. The research reported in this paper has benefited from EPSRC’s QNET framework and from the QICS framework 7 STREP. We would also like to thank the editors (Simon Gay and Ian Mackie) for their efforts to publish this book and the anonymous referees for their helpful feedback. We have had useful discussions with members of the Functional Programming Laboratory in Nottingham; in particular we would like to thank Wouter Swierstra for his advice on Haskell programming techniques.
Bibliography Altenkirch, T., and Grattage, J. (2005) A functional quantum programming language. In Proceedings of the 20th Annual IEEE Symposium on Logic in Computer Science (LICS). IEEE Computer Society. Also arXiv:quant-ph/0409065.
P1: SBT CUUS834-05
cuus834-gay
978 0 521 51374 6
5
October 31, 2009
The Quantum IO Monad
14:36
205
Arrighi, P., and Dowek, G. (2008) Linear-algebraic A-calculus: higher-order, encodings, and confluence. In Rewriting Techniques and Applications: 19th International Conference, RTA 2008 Hagenberg, Austria, July 15–17, 2008, Proceedings, page 17. Springer. Coq Development Team (2004) The Coq Proof Assistant Reference Manual. LogiCal Project. Version 8.0. Danos, V., Kashefi, E., and Panangaden, P. (2007) The measurement calculus. Journal of the ACM 54(2). Preliminary version in arXiv:quant-ph/0412135. Deutsch, D. (1985) Quantum theory, the Church-Turing principle and the universal quantum computer. Proceedings of the Royal Society of London. Series A, Mathematical and Physical Sciences 400(1818):97–117. Gay, S. J. (2006) Quantum programming languages: survey and bibliography. Mathematical Structures in Computer Science 16(4). Green, A. (2008) The Quantum IO Monad, source code and examples. http://www.cs.nott.ac. uk/˜asg/QIO/. Hutton, G. (2007) Programming in Haskell. Cambridge University Press. Jones, S. P. (2003) Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press. Karczmarczuk, J. (2003) Structure and interpretation of quantum mechanics – a functional framework. In Proceedings of the ACM SIGPLAN Workshop on Haskell. ACM Press. Mu, S.-C., and Bird, R. (2001) Functional quantum programming. In Proceedings of the 2nd Asian Workshop on Programming Languages and Systems. Nielsen, M. A., and Chuang, I. L. (2000) Quantum Computation and Quantum Information. Cambridge University Press. Norell, U. (2007) Towards a Practical Programming Language Based on Dependent Type Theory. Ph.D. thesis, Department of Computer Science and Engineering, Chalmers University of Technology, SE-412 96 G¨oteborg, Sweden. Rivest, R. L., Shamir, A., and Adelman, L. M. (1977) A method for obtaining digital signatures and public-key cryptosystems. Technical Report MIT/LCS/TM-82. R¨udiger, R. (2007) Quantum programming languages: An introductory overview. The Computer Journal 50(2):134–150. Sabry, A. (2003) Modelling quantum computing in Haskell. In Proceedings of the ACM SIGPLAN Workshop on Haskell. ACM Press. Shor, P. (1994) Algorithms for quantum computation: discrete logarithms and factoring. In Proceedings, 35th Annual Symposium on Foundations of Computer Science. IEEE Press. Sittampalam, G. (2008) Restricted monads in Haskell, LiveJournal entry. http://hsenag. livejournal.com/11803.html. Swierstra, W. (2008) A Functional Specification of Effects. Ph.D. thesis, University of Nottingham. Swierstra, W., and Altenkirch, T. (2007) Beauty in the beast: A functional semantics of the awkward squad. In Haskell ’07: Proceedings of the ACM SIGPLAN workshop on Haskell. Swierstra, W., and Altenkirch, T. (2008) Dependent types for distributed arrays. Presented at Trends in Functional Programming (TFP 2008). Submitted for final proceedings. Vedral, V., Barenco, A., and Ekert, A. (1995) Quantum networks for elementary arithmetic operations. Vizzotto, J. K., Altenkirch, T., and Sabry, A. (2006) Structuring quantum effects: Superoperators as arrows. Mathematical Structures in Computer Science 16(3). Also arXiv:quant-ph/0501151.
P1: SBT CUUS834-06
cuus834-gay
978 0 521 51374 6
October 31, 2009
14:56
6 Abstract Interpretation Techniques for Quantum Computation Philippe Jorrand and Simon Perdrix
Abstract In this chapter, we present applications of abstract interpretation techniques in quantum computing. Quantum computing is a now well-established domain of computer science, and the recent developments of semantic techniques show the vitality of this rapidly growing area. On the other hand, the proof has been made that abstract interpretation is a powerful theory (of “classical” computer science) for comparing more or less precise semantics of the same programming language. In a more general picture, abstract interpretation can be seen as a framework for comparing the precision of several representations of the same dynamic system evolution. In this paper, we point out that abstract interpretation can be fruitfully used in quantum computing: (i) for establishing a hierarchy of quantum semantics and (ii) for analyzing entanglement evolution.
6.1 Introduction The field of quantum information processing is growing rapidly. This development is based on the exploitation of nonclassical phenomena such as superposition and entanglement, which gave rise to new protocols (cryptographic protocols with unconditional security, Bennett 1992; Bennett and Brassard 1984; teleportation Bennett et al. 1993), and new algorithms (polynomial time factorization, Shor 1994 and search algorithms (Grover 1996)). Some recent developments in quantum information processing are based on the use of high-level methods, adapting and extending the methods successfully used in classical computation (Abramsky and Coecke 2004; Gay and Nagarajan 2005, 2006; Gay et al. 2008; Kashefi 2003; Lalire and Jorrand 2004; Selinger 2004c,d). In particular the development of semantic techniques is of key importance for the successful development of quantum information processing. Abstract interpretation, a powerful framework of classical computation introduced by Cousot and Cousot (1977), is an example of a semantic technique that can be applied to quantum computing: 206
P1: SBT CUUS834-06
cuus834-gay
6
978 0 521 51374 6
October 31, 2009
14:56
Abstract Interpretation Techniques for Quantum Computation
207
• First, we have established (Perdrix 2008a) in the framework of abstract interpretation that different proposals of quantum semantics (based on superoperators, Selinger 2004d; on probabilistic functions, Abramsky 2004; and on admissible transformations, Perdrix 2008a, respectively) can be organized in a hierarchy of quantum semantics. Indeed, abstract interpretation is useful for organizing multiple semantics in a hierarchy of semantics corresponding to levels of detail (Cousot 1997). • Moreover, we have introduced (Perdrix 2008b) an entanglement evolution analysis based on abstract interpretation. Thus, abstract interpretation techniques can be used to address one of the most fascinating challenges in quantum computing, which is to understand the role of entanglement in quantum protocols (e.g., teleportation, Bennett et al. 1993), in quantum algorithms (e.g., Shor’s algorithm, Shor 1994); and in alternative models of quantum computing (e.g., the one-way model, Raussendorf et al. 2002; Danos et al. 2007, where the quantum entanglement is used as a resource of the computation). These two applications of abstract interpretation techniques are presented in this chapter. First, a brief introduction to the abstract interpretation theory (Section 6.1.1) and to quantum computing basics (Section 6.1.2) are given. A simple quantum imperative language is introduced (Section 6.2). A hierarchy of semantics is established by means of abstract interpretation (Section 6.3), and finally an entanglement analysis is presented (Section 6.4). This work is related to the works of Gay, Nagarajan, and Papanikolaou (Gay et al. 2007, 2008) and Baltazar, Chadha, Mateus, Sernadas (Baltazar et al. 2007, 2008), which consist in using model checking techniques in quantum information processing, especially for analysing and proving properties on cryptographic protocols. An analysis based on a typing system has also been proposed by Perdrix (2007). Prost and Zerrari (2008) have recently introduced a logical entanglement analysis for functional languages. More generally, this work is also related to the developments of quantum programming languages and their semantics, see Gay (2006) and Selinger (2004a) for a survey.
6.1.1 Abstract Interpretation Abstract interpretation was introduced by Cousot and Cousot (1977, 1979). This is a general framework that has been proved useful for analyzing programs (Cousot 1981) and for organizing multiple semantics of a given programming language into a hierarchy of semantics corresponding to different detail levels (Cousot 2002). In the following, we give an (incomplete) introduction to the powerful theory of abstract interpretation, focusing on the aspects of the framework that are used in the very first applications of abstract interpretation in quantum computing presented in this paper. For a more consistent introduction to abstract interpretation, please refer to Cousot and Cousot (1979). In particular, only denotational semantics are
P1: SBT CUUS834-06
cuus834-gay
208
978 0 521 51374 6
October 31, 2009
14:56
Philippe Jorrand and Simon Perdrix
considered, while the use of narrowing and widening, for instance, is left to further investigations. The following presentation of the abstract interpretation formalism is illustrated with very usual static analysis examples, such as parity and interval analysis (Cousot and Cousot 1976, 1977). We consider the following toy classical programming language: C
::= | | |
x := x + 1 x := x − 2 x := 2 ∗ x C; C
In this simple imperative language, there is a unique variable x representing an integer on which one can apply basic arithmetic operations. Since there is a unique variable, the (denotational) semantics of the language associates with any program C, a map C : N → N inductively defined as follows: x := x + 1 = y → y + 1 x := x − 2 = y → y − 2 x := 2 ∗ x = y → 2y C1 ; C2 = C2 ◦ C1 For instance x := x − 2; x := 2 ∗ x; x := x + 1 = y → 2y − 3. A first example of abstract interpretation is the parity analysis. For a given program C, we would like to analyze the parity evolution, i.e., to know the parity, even or odd, of C(y), depending on the parity of y. For instance, it is easy to see that x := 2 ∗ x(y) is even whatever the parity of y is, and x := x − 2(y) has the same parity as y. In order to realize an automatic parity analysis, one can define the following abstract semantics C : {even, odd} → {even, odd} for any program C: x := x + 1 = even → odd odd → even x := x − 2 = p → p x := 2 ∗ x = p → even C1 ; C2 = C2 ◦ C1 Definition 6.1.1. An abstract semantics . : D → D is an exact abstraction of . : D → D if there exists an abstraction function α : D → D such that α ◦ . = . ◦ α. If . is an exact abstraction of . then the following diagram commutes: D 6
.
α
α D
- D 6
.
- D
P1: SBT CUUS834-06
cuus834-gay
6
978 0 521 51374 6
October 31, 2009
14:56
Abstract Interpretation Techniques for Quantum Computation
209
In the parity analysis example, one can prove that . is an exact abstraction of . where the abstraction function α : N → {even, odd} associates with any integer its parity. It implies that if the parity of y is p = α(y) then the parity of C(y) is C ( p) (i.e., α(C(y)) = C (α(y)).) Another usual example of abstract interpretation is the interval analysis. The objective of this analysis is to know in which interval lies C(y) if y lies in an interval [a, b]. This analysis is useful to know the size of the memory that has to be allocated to a given variable and then avoid memory overflow. In order to realize this analysis we consider the abstract domain of closed intervals of N: D ) = {[a, b] ⊂ N}, and the following abstract semantics .) : D ) → D ) : x := x + 1) x := x − 2) x := 2 ∗ x) C1 ; C2 )
= [a, b] → [a + 1, b + 1] = [a, b] → [a − 2, b − 2] = [a, b] → [2a, 2b] = C2 ) ◦ C1 )
.) is an exact abstraction of .: α ◦ . = .) ◦ α , with α : D ) → N :: y → [y, y]. In the following, we show that exact abstraction fails if the following conditional structure is added to the language: if x > 0 then C else C The concrete semantics is extended as follows: if x > 0 then C1 else C2 = y →
%
C1 (y) C2 (y)
if y > 0 otherwise
Since, if y ∈ [−1, 1], then if x > 0 then x := x + 1 else x := x − 2(y) ∈ [−3, −2] ∪ (1, 2] which is not an interval, the abstract semantics .) is extended using approximation: if x > 0 then C1 else C2 ) = [a, b] → C1 ) ([a, b]) , C2 ) ([a, b]) where [a, b] , [c, d] := [min(a, c), max(b, d)]. As a consequence, if x > 0 then x := x + 1 else x := x − 2) ([−1, 1]) = [−3, 2]. .) is no more an exact abstraction of .. However, it is a sound approximation of the concrete semantics in the sense that for any C, if y ∈ [a, b] then C(y) ∈ C) ([a, b]). Soundness is formalized as follows in the abstract interpretation framework. Definition 6.1.2 (Soundness of abstract semantics; Cousot and Cousot 1977). . : D → D is a sound abstraction of . : D → D, if there exists a soundness relation σ ∈ D × D such that for any C, (u, v) ∈ σ =⇒ (C(u), C (v)) ∈ σ. In the interval analysis, we consider σ := {(y, [a, b]) | a ≤ y ≤ b}. Thus any interval that contains y is a sound approximation of y. However, intuitively, if [a , b ] ⊂ [a, b] then [a , b ] is a more precise approximation than [a, b]. More
P1: SBT CUUS834-06
cuus834-gay
210
978 0 521 51374 6
October 31, 2009
14:56
Philippe Jorrand and Simon Perdrix
generally, the precision of the approximation can be measured if there exists an approximation partial order . on the abstract domain such that (u, v) ∈ σ and v . w implies (u, w) ∈ σ . This is the abstract soundness assumption. Moreover, there is a best approximation (best abstraction assumption) if there exists an abstraction function α : D → D such that (u, α(u)) ∈ σ and if (u, v) ∈ σ then α(u) . v. Theorem 6.1.3 (Soundness theorem). Under the abstract soundness and best abstraction assumptions, . is a sound abstraction of . if . is .-monotonic and α ◦ . . . ◦ α D 6 α D
. /
D 6 α
. D
Proof. For a given program C, let (u, v) ∈ σ . According to the best abstraction assumption, α(u) . v, so C (α(u)) . C (v). Thus, α(C(u)) . C (v). Moreover (C(u), α(C(u))) ∈ σ , so according to the abstraction soundness assumption, (C(u), C (v)) ∈ σ . In the interval analysis example, abstract soundness and best abstraction assumptions are satisfied if the approximation partial order is the set inclusion, and α :: y → [y, y]. Moreover, for any C, C) is ⊆-monotonic and α ◦ C ⊆ C) ◦ α. Notice that in general, an abstract semantics can be refined in order to obtain a more precise analysis; the counterpart is often that this refinement makes the abstract semantics more complex to compute. For instance, one can refine the abstract semantics of the conditional structure as follows: ) if a > 0 C1 ([a, b]) ) if x > 0 then C1 else C2 ([a, b]) = C2 ) ([a, b]) if b ≤ 0 C1 ) ([a, b]) , C2 ) ([a, b]) other. This refined abstract semantics is sound and gives more precise results than the previous one. Indeed, the refined semantics is such that if x > 0 then x := 2 ∗ x else x := x + 1) ([4, 5]) = x := 2 ∗ x) ([4, 5]) = [8, 10] instead of the less precise interval [5, 10] obtained with the previous version.
6.1.2 Quantum Computing Basics The basic carrier of information in quantum computing is a two-level quantum system (qubit), or more generally a register of n qubits. According to the first
P1: SBT CUUS834-06
cuus834-gay
6
978 0 521 51374 6
October 31, 2009
14:56
Abstract Interpretation Techniques for Quantum Computation
211
postulate of quantum mechanics (Nielsen and Chuang 2000), the state of an n n-qubit register is a normalized vector of a Hilbert space C2 . The computational n basis of a 2n -dimensional Hilbert space C2 is an orthonormal basis denoted n {|x, x ∈ {0, 1}n }. So, a general state |ϕ ∈ C2 can be written as αx |x, x∈{0,1}n
2 with x∈{0,1}n |αx | = 1. Vectors and inner and outer products are expressed in the notation introduced by Dirac. Vectors are denoted |ϕ; the inner product of two vectors |ϕ, |ψ is denoted by ϕ|ψ. If |ϕ = x∈{0,1}n αx |x and |ψ = x∈{0,1}n βx |x, then ϕ|ψ = x∈{0,1}n αx∗ βx (where α ∗ stands for the complex conjugate). The left-hand side ϕ| of the inner product is a bravector, and the right-hand side |ψ is a ket-vector. A bra-vector is defined as the adjoint of the corresponding ket-vector: if |ϕ = x∈{0,1}n αx |x, then ϕ| = |ϕ† = x∈{0,1}n αx∗ x|. The bra-ket notation can also be used to describe outer products: |ϕψ| is a linear operator such that (|ϕψ|)| = ψ| |ϕ. The n m state of a register composed of two subsystems in state |ϕ ∈ C2 and |ψ ∈ C2 2n 2m ∼ 2n+m respectively is the normalized vector |ϕ ⊗ |ψ ∈ C ⊗ C = C , where ⊗ is the tensor product. For any x ∈ {0, 1}n , y ∈ {0, 1}m , |x, y denotes |x ⊗ |y. n An isolated system evolves according to a linear map U ∈ L(C2 ) transforming n a state |ϕ ∈ C2 into U |ϕ. This evolution has to be unitary, i.e., U † U = UU † = I . A unitary transformation U is approximated by V within > 0 if ||U − V || < . Any n-qubit unitary transformation U can be approximated within an arbitrary accuracy by composing unitary transformations from the universal set of unitary transformations {H, T, X }, composed of two 1-qubit and one 2-qubit unitary transformations, called respectively Hadamard, phase, and controlled-not. Notice that there exist several universal families of unitary transformations in the literature (Nielsen and Chuang 2000): 1 0 0 0 0 1 0 0 1 1 1 1 0 . H= √ ,T = iπ/4 , X = 0 e 0 0 0 1 2 1 −1 0 0 1 0 Moreover, we consider the following unitary transformations, called Pauli operators σz := T 4 , σx := H σz H and σ y := T 2 σx T 2 σz : 0 1 0 −i 1 0 , σy = , σz = . σx = 1 0 i 0 0 −1 A projective measurement is a probabilistic evolution described by a complete family {Pi }i∈A of orthogonal projectors, i.e., ∀i, j ∈ A, Pi P j = δi, j Pi (where δ is the Kronecker delta) and i∈A Pi = I . A measurement produces a classical n outcome i ∈ A and transforms the state |ϕ ∈ C2 into √ Pi |ϕ with probability ϕ|Pi |ϕ ϕ|Pi |ϕ.
P1: SBT CUUS834-06
cuus834-gay
212
978 0 521 51374 6
October 31, 2009
14:56
Philippe Jorrand and Simon Perdrix
6.2 A Quantum Programming Language Several quantum programming languages have been introduced recently, for a complete overview see Gay (2006) and Selinger (2004a). In this paper, we introduce a Quantum Imperative Language (QIL). The syntax is similar to the language SQPL introduced by Abramsky (2004), except for quantum measurements which are treated implicitly in QIL, as in QML (Altenkirch and Grattage 2005b,a). A QIL program is a pair (Q, C), where Q = {q0 , . . . , qn } is a finite set of symbols representing a finite memory of qubits, and C is a command defined as follows: C ::= skip | C1 ; C2 | if q then C1 else C2 | while q do C | σx (q) | σy (q) | σz (q) | H(q) | T(q) | CNot(q, q) Notice that QIL is not limited to a unitary fragment, since according to the semantics of the language, quantum measurements are encoded into the conditional structures of the language: when a qubit q is used as a condition, q is first measured, then the classical outcome of the measurement plays the role of the Boolean evaluation of the condition. We introduce the operational semantics of the language. For a given qubit q, let |trueq (true) and |falseq (false) be the two basis states of q. The state of q is then a normalized vector of the Hilbert space Hq = {α|trueq + β|falseq | α, β ∈ C} ∼ = C2 . For a given finite set Q of qubits, the state of Q is a normalized |Q| vector of H Q = q∈Q Hq ∼ = C2 , i.e., an element of the unit sphere H1Q = {|ϕ ∈ H Q | |||ϕ|| = 1} of H Q . A pair [C, |ϕ] such that (Q, C) is a program and |ϕ ∈ H1Q is a configuration. The final configurations are [skip, |ϕ] for any |ϕ. The operational semantics is given as a probabilistic transition system → p defined as follows: For any U ∈ {σx , σy , σz , H, T}, [U(q), |ϕ] →1 [skip, Uq |ϕ] [C1 , |ϕ] → p [C1 , |ϕ ] [C1 ; C2 ; |ϕ] → p [C1 ; C2 , |ϕ ] [skip; C, |ϕ] →1 [C, |ϕ] [if q then C1 else C2 , α|trueq ⊗ |ϕ+β|falseq ⊗ |ψ] →|α|2 [C1 ; |trueq ⊗ |ϕ] [if q then C1 else C2,α|trueq ⊗|ϕ+β|falseq ⊗ |ψ] →|β|2 [C2 ; |falseq ⊗ |ψ] [while q do C , |ϕ] →1 [if q then (C; while q do C) else skip , |ϕ] Let S(C, |ϕ, |ψ) be the set of all sequences [C, |ϕ] = [C0 , |ϕ0 ] → p1 [C1 , |ϕ1 ] → p2 . . . → pk [Ck , |ϕk ] = [skip, |ψ]. For any such sequence c, let
P1: SBT CUUS834-06
cuus834-gay
6
978 0 521 51374 6
October 31, 2009
14:56
Abstract Interpretation Techniques for Quantum Computation
213
k (c) := i=1 pk . The probability C(|ϕ, |ψ) that an initial configuration [C, |ϕ] produces the state |ψ is defined as follows: C(|ϕ, |ψ) := (c). c∈S(C,|ϕ,|ψ)
Example 6.2.1. Let ex1, ex2, and ex3 be three QIL-commands defined for a memory composed of a unique qubit (Q = {q}): ex1 :while q do H (q) ex2 : while q do H (q) ; H(q) ; if q then skip else skip
ex3 : while q do H (q) ; H(q) ; if q then H(q) else H(q)
The denotational semantics of these examples are given in examples 2,3 and 4. 1 For any |ϕ ∈ H{q} , ex1(|ϕ, |false) = 1 Intuitively, ex1 is a false-state initialization. Indeed, the computation halts when the measurement of q projects the state of this qubit on the basis state false, and if this measurement projects on true, then the application of Hadamard creates a superposition that guarantees that the next measurement projects the state of q on false with probability 0.5 so that, even if the program may not terminate, the 1 halting probability is 1. For any |ϕ ∈ H{q} , ex2(|ϕ, |false) = 1/2 ex2(|ϕ, |true) = 1/2 1 ex3(|ϕ, √ (|true + |false)) = 1/2 2 1 ex3(|ϕ, √ (|true − |false)) = 1/2 2 ex2 and ex3 can be seen as a coin tossing. ex2 produces true and false with equal probabilities, while ex3 produces two superposition states with equal probabilites.
6.3 Hierarchy of Semantics In this section three denotational semantics are introduced for the language QIL. First we review some basic notions of domain theory (Abramsky and Jung 1994), a mathematical foundation for defining the semantics of programs with recursions or loops by means of fixed points. We introduce here only the notions we use. A preorder (X, ≤) is a reflexive and transitive relation on X . An element x ∈ X is maximal if ∀y ∈ X, x ≤ y =⇒ x = y. Minimum is defined dually.
P1: SBT CUUS834-06
cuus834-gay
214
978 0 521 51374 6
October 31, 2009
14:56
Philippe Jorrand and Simon Perdrix
Given Y ⊆ X , an element x ∈ X is an upper bound for Y if y ∈ Y =⇒ y ≤ x. If the set of all upper bounds of Y has a minimum, it is called the least upper bound of Y or lub for short. Y denotes the lub of Y if it exists. Y ⊆ X is upward closed if for any y ∈ Y and x ∈ X , y ≤ x =⇒ x ∈ Y . Y ⊆ X is directed if for every finite set F ⊆ Y , there exists an upper bound y ∈ Y of F. Let (X, ≤) and (X , ≤ ) be two preorders. A function f : X → X is monotonic if x ≤ y =⇒ f (x) ≤ f (y). A directed complete partial order (DCPO) is a partial order (D, 1) such that every directed subset of D has a lub. If (D, 1) and (D , 1 ) are two DCPO, a function f : D → D is continuous if it is monotonic and for every directed subset X ⊆ D, f (X ) = f (X ). A complete partial order (CPO) is a DCPO with a minimum. The following theorem is used for defining the denotational semantics of programs with recursions or loops. Theorem 6.3.1 (Fixed point theorem). Let D be a CPO. If f : D → D is continuous, then f has a minimum fixed point lfp( f ), i.e., the set of d ∈ D such that f (d) = d is not empty and has a minimum.
6.3.1 Probabilistic Semantics According to the postulates of quantum mechanics, the state of a quantum system is a normalized vector in a Hilbert space, and its evolution is probabilistic. Thus, a natural way to define a quantum semantics consists in a quantum version of a classical probabilistic semantics, based for instance on probabilistic power domains (Jones and Plotkin 1989). Since the evolution of a quantum system is probabilistic, the state of memory is not, in general, a pure state but a probabilistic distribution of pure states. Such a probabilistic distribution is represented by a valuation on topological spaces. In the following, some definitions about topological spaces and valuations are given. For any set X , (X, τ ) is a topological space if τ ⊆ P(X ) is a family of subsets of X s.t. • ∅ ∈ τ , X ∈ τ ; • F ⊆ τ =⇒ F ∈ τ; • A1 , A2 ∈ τ =⇒ A1 ∩ A2 ∈ τ . The whole powerset (X, P(X )) is a topology on X called discrete topology. Another example of topology is the Scott topology (Scott 1972). Let (D, 1) be a DCPO. The Scott topology (D, τ ) is defined as follows: A ∈ τ if A is upward closed and for every directed set Y ⊆ X , if Y ∈ A, then it exists y ∈ Y s.t. y ∈ A. For a given topological space (X, τ ), ν : τ → [0, 1] is a valuation if and only if for every A, B ∈ τ : • A ⊆ B =⇒ ν( A) ≤ ν(B) (motonicity) • ν(∅) = 0 (strictness) • ν(A) + ν(B) = ν( A ∩ B) + ν( A ∪ B) (modularity)
P1: SBT CUUS834-06
cuus834-gay
6
978 0 521 51374 6
October 31, 2009
14:56
Abstract Interpretation Techniques for Quantum Computation
215
A valuation ν on a topological space (X, τ ) is continuous if for every directed subset A of (τ, ⊆), ν( A) = supY ∈A ν(Y ). A discrete valuation on a set X is a map ν : X → [0, 1]. A discrete valuation defines a unique continuous valuation on the discrete topology by, for any Y ⊆ X , ν[Y ] = ν(y). y∈Y
Since the set Y is not necessary finite, the sum over Y above is defined as follows: f (y) := sup f (z). y∈Y
Z ⊆Y and Z finite z∈Z
The support of a discrete valuation ν on X is defined by supp(ν) := {y ∈ X | ν(x) = 0}. The set of discrete valuations on X is denoted V∞ (X ). For any set X and any x ∈ X , let ηx : X → [0, 1] be a discrete valuation defined as follows: % 1 if x = y ηx (y) = 0 otherwise. A valuation ν on X is normalized if ν(X ) = 1 and subnormalized if ν(X ) ≤ 1. Whereas normalized valuations are used to represent a probability distribution, a subnormalized valuation is adapted to the representation of nonterminating evolutions: a process that produces a subnormalized valuation ν is a process that does not halt with probability 1 − ν(X ). A continuous valuation on a DCPO (D, 1) is a continuous valuation on its Scott topology. Let V(D) be the set of continuous valuations on D. (V(D), 1) is a DCPO as well (Jones and Plotkin 1989), where 1 is defined pointwise: ν 1 µ ⇐⇒ ∀A ∈ τ, ν( A) ≤ µ(A). Lemma 6.3.2. For any set X , the set V∞ (X ) of discrete valuations on X , ordered pointwise, is a DCPO. Proof. Let (X, ≤) be a flat DCPO, i.e. ∀x, y ∈ X, x ≤ y =⇒ x = y. Since (X, ≤) is a DCPO, (V(X ), 1) is a DCPO as well. Moreover the Scott topology of V∞ (X ) is nothing but the discrete topology. Let V Q := V∞ (H1Q ) = {ν ∈ H1Q → [0, 1]} be the set of discrete valuations on According to Lemma 6.3.2, (V Q , 1) ordered pointwise is a DCPO. Moreover (V Q , 1) is a CPO with 0 (an evaluation with empty support) as least element. Now we are ready to define the denotational semantics of the language QIL. The semantics of the language, called pure semantics, acts on probabilistic distributions of pure states. Notice that a unitary transformation and a projective measurement have fundamentally different behaviors since the former is determinsitic and the latter is probabilistic. Since any unitary transformation U is reversible, with U −1 = U † , the probability that a quantum system is in state |ϕ after the application of U is equal to the probability that the system was in state U † |ϕ before the application of U . Thus, H1Q .
P1: SBT CUUS834-06
cuus834-gay
216
978 0 521 51374 6
October 31, 2009
14:56
Philippe Jorrand and Simon Perdrix
U transforms a discrete valuation ν into λ|ϕ.ν(U † |ϕ). Notice that the λ-notation is used for representing functions: λx.y is a function that associates y with x, i.e., the function x → y. A projective measurement {Pi }i∈B , which is not reversible, produces the classical outcome i ∈ B and transforms a state |ϕ into √ Pi |ϕ with probability ϕ|Pi |ϕ ϕ|Pi |ϕ. Thus, {Pi }i∈B produces the classical outcome i ∈ B and transforms a discrete valuation ν into (up to a normalization) ν(|ϕ)ϕ|Pi |ϕη √ Pi |ϕ . ϕ|Pi |ϕ
|ϕ∈supp(ν)
A measurement in the standard basis of a qubit q is represented by two functions πqtrue , πqfalse that describe how a discrete valuation ν evolves if the qubit q is measured in the standard basis. Let q ∈ Q and x ∈ {true, false}: πqx : V Q → V Q ν → |ϕ|xq |2 ν(|ϕ)η (|xq xq |)|ϕ |ϕ∈supp(ν)
|ϕ|xq |
Thus, the measurement of the q in the standard basis transforms the valuation ν into πqtrue (ν) + πqfalse (ν). The probability for the outcome to be true is πqtrue (ν)(H1Q ). Definition 6.3.3 (Pure semantics). For any finite set Q, for any command C, let [[C]]p : V Q → V Q be defined as follows: [[skip]]p = I [[C1 ; C2 ]]p = [[C2 ]]p ◦ [[C1 ]]p [[σ (q)]]p = λν.λ|ϕ.ν(σq† |ϕ) [[T(q)]]p = λν.λ|ϕ.ν(Tq† |ϕ) [[H(q)]]p = λν.λ|ϕ.ν(Hq† |ϕ) [[CNot(q1 , q2 )]]p = λν.λ|ϕ.ν(X q†1 ,q2 |ϕ) [[if q then C1 else C2 ]]p = λν.[[C1 ]]p ◦ πqtrue (ν) + [[C2 ]]p ◦ πqfalse (ν)
[[while q do C ]]p = lfp λ f.λν. f ◦ [[C]]p ◦ πqtrue (ν) + πqfalse (ν) where Mq means that M is applied on qubit q. Theorem 6.3.4. For any command C, [[C]]p : V Q → V Q is continuous. The proof is by induction on the command. Note that the continuity of [[C]]p guaranties the existence, thanks to the fixed point Theorem 6.3.1, of the least fixed point in the definition of the semantics of the while.
P1: SBT CUUS834-06
cuus834-gay
6
978 0 521 51374 6
October 31, 2009
14:56
Abstract Interpretation Techniques for Quantum Computation
217
Example 6.3.5. The pure semantics of the programs defined in Example 6.2.1 are given. The pure semantics of ex1 is [[ex1]]p = [[while q do H(q) ]]p = λν.η|false Thus, this program outputs the state |false with probability 1, for any initial valuation. Notice that if the Hadamard transformation is replaced by a phase transformation, the pure semantics of the program is [[while q do T(q) ]]p = λν. ν(|ϕ)|ϕ|false|2 η|false |ϕ∈supp(ν)
Thus, the program while q do T(q) is a false state initialization as well, but with a halting probability that depends on the initial valuation. For instance, if the initial state is a uniform superposition √12 (|true + |false) then the halting probability is 0.5: [[while q do T(q) ]]p (η(|true+|false)/√2 ) =
1 η|false 2
The pure semantics of ex2 and ex3 are 1 1 η|true + η|false [[ex2]]p = λν. 2 2 and
[[ex3]]p = λν.
1 1 η(|true+|false)/√2 + η(|true−|false)/√2 2 2
which illustrates that these programs can be seen as a randomized preparation √ of the states √ |true and |false for ex2 and (|true + |false)/ 2 and (|true − |false)/ 2 for ex3. Now we establish the adequacy between the operational semantics and the probabilistic denotational semantics of the language. Theorem 6.3.6 (Adequacy). For any program (C, Q), and any |ϕ, |ψ ∈ H1Q , C(|ϕ, |ψ) = [[C]]p (η|ϕ )(|ψ). Proof. The proof is by induction on C. The adequacy for the conditional command if q then C1 else C2 is detailed. If |ϕ = α|trueq ⊗ |ϕ1 + β|falseq ⊗ |ϕ2 then πqtrue (η|ϕ ) = |α|2 η|true⊗|ϕ1 and πqfalse (η|ϕ ) = |β|2 η|false⊗|ϕ2 . Thus, [[if q then C1 else C2 ]]p (η|ϕ )(|ψ) = [[C1 ]]p ◦ πqtrue (η|ϕ )(|ψ) + [[C2 ]]p ◦ πqfalse (η|ϕ )(|ψ) = |α|2 [[C1 ]]p (η|true⊗|ϕ1 )(|ψ) + |β|2 [[C2 ]]p (η|false⊗|ϕ2 )(|ψ) = |α|2 C1 (|true ⊗ |ϕ1 )(|ψ) + |β|2 C2 (|false ⊗ |ϕ2 )(|ψ) = C(|ϕ)(|ψ).
P1: SBT CUUS834-06
cuus834-gay
978 0 521 51374 6
218
October 31, 2009
14:56
Philippe Jorrand and Simon Perdrix
6.3.2 Indistinguishability An external observer does not have access to the full description of a quantum state. The distinction between two quantum states can only be based on observations, i.e., on the classical outcomes of measurements. If for any measurement, two probability distributions produce every possible classical outcome with the same probability, then these two states are called indistinguishable, since there is actually no experimentation for distinguishing these two states. More formally: Definition 6.3.7 (Indistinguishability). For any finite set Q, ν, µ ∈ V Q are indistinguishable, if for any measurement {Pi }i∈B , and any i ∈ B, ν(|ϕ)ϕ|Pi |ϕ = µ(|ϕ)ϕ|Pi |ϕ. |ϕ∈supp(ν)
For
instance,
1 √ η 2 (|true−|false)/ 2
i ∈ B,
|ϕ∈supp(µ)
|ϕ∈supp(µ)
+ and µ := 12 η(|true+|false)/√2 + ν := are indistinguishable. Indeed, for any {Pi }i∈B , and any 1 η 2 |true
1 η 2 |false
1 true|Pi |true + true|Pi |false + false|Pi |true 4 1 + false|Pi |false + true|Pi |true − true|Pi |false 4 − false|Pi |true + false|Pi |false 1 = (true|Pi |true + false|Pi |false) 2 = ν(|ϕ)ϕ|Pi |ϕ.
µ(|ϕ)ϕ|Pi |ϕ =
|ϕ∈supp(ν)
6.3.3 Observable Semantics The pure semantics just introduced does not take indistinguishability into account. Indeed for any ν, [[ex2]]p (ν) and [[ex3]]p (ν) are indistinguishable, while [[ex2]]p = [[ex3]]p . In order to take into account the indistinguishability phenomenon, probability distributions of pure states are abstracted into matrices, called density matrices, using the following abstraction function: αp,o : V (C2 ) → C2 ×2 ν → n
n
n
ν(|ϕ)|ϕϕ|.
|ϕ∈supp(ν)
Lemma 6.3.8. Two probability distributions on pure states ν, µ are indistinguishable if and only if αp,o (ν) = αp,o (µ). Proof. Let ν, µ be two valuations such that αp,o (ν) = αp,o (µ). For any measurement {Pi }i∈B and any i ∈ B, tr(Pi αp,o (ν)) = tr(Pi αp,o (µ)) since αp,o (ν) = αp,o (µ),
P1: SBT CUUS834-06
cuus834-gay
6
978 0 521 51374 6
October 31, 2009
14:56
Abstract Interpretation Techniques for Quantum Computation
219
where tr(M) is the trace of the matrix M. Moreover,
=⇒
tr(Pi αp,o (ν)) = tr(Pi αp,o (µ)) ν(|ϕ)tr(Pi |ϕϕ|) = µ(|ϕ)tr(Pi |ϕϕ|)
|ϕ∈supp(ν)
=⇒
|ϕ∈supp(µ)
ν(|ϕ)tr(ϕ|Pi |ϕ) =
|ϕ∈supp(ν)
=⇒
|ϕ∈supp(ν)
µ(|ϕ)tr(ϕ|Pi |ϕ)
|ϕ∈supp(µ)
ν(|ϕ)ϕ|Pi |ϕ =
µ(|ϕ)ϕ|Pi |ϕ.
|ϕ∈supp(µ)
So ν and µ are indistinguishable. For the “only if ” part, let M = αp,o (ν) − αp,o (µ), and |ϕ a normalized eigenvector of M such that M|ϕ = λ|ϕ. So tr(|ϕϕ|M) = λ. Moreover, tr(|ϕϕ|M) = tr(|ϕϕ|αp,o (ν)) − tr(|ϕϕ|αp,o (µ)) = 0. Thus, λ = 0, so αp,o (ν) = αp,o (µ). Property 6.3.9. For any finite set Q, and any ν ∈ V Q , ρ := αp,o (ν) is a selfadjoint (ρ = ρ † ) positive semidefinite (all the eignenvalues of ρ are non-negative) complex matrix of trace less than 1. Proof. For any ν, αp,o (ν) is self-adjoint; moreover, for any |ϕ ∈ supp(ν), |ϕϕ| is positive and ν(|ϕ) > 0; thus αp,o (ν) is positive semidefinite. Finally, tr(αp,o (ν)) = |ϕ∈supp(ν) ν(|ϕ) ≤ 1. Let D N ⊂ C N ×N be the set of a self-adjoint positive semidefinite complex matrix of trace less than 1. n Property 6.3.10. αp,o : V (C2 ) → D2n := |ϕ∈supp(ν) ν(|ϕ)|ϕϕ| is surjective. Proof. Let ρ = i∈A λi |ϕi ϕi | be the spectral decomposition of a given density matrix ρ. Let ν be a valuation such that supp(ν) = {|ϕi , i ∈ A}, and ν(|ϕi ) = λi , then αp,o (ν) = ρ. The action of unitary transformations and projective measurements can be easily described in the density matrices formalism. For any density matrix ρ there exists a valuation ν such that ρ = αp,o (ν). Since a unitary transformation U maps ν with λ|ϕ.ν(U † |ϕ), U maps ρ with αp,o (λ|ϕ.ν(U † |ϕ)) = U αp,o (ν)U † = UρU † . Similarly, a projective measurement {Pi }i∈B produces a classical outcome i ∈ B and transforms ρ into Pi ρ Pi with probability tr(Pi ρ). For a finite set of variables Q = {q0 , . . . , qn }, let D Q = D(H Q ) be the set of density matrices on Q. Selinger (2004c) has proved that (D Q , 1) where 1 is the L¨owner partial order, is a complete partial order: Theorem 6.3.11 (Selinger 2004c). The poset (D Q , 1) is a complete partial order with 0 as least element, where M 1 N if N − M is positive (L¨owner partial order).
P1: SBT CUUS834-06
cuus834-gay
978 0 521 51374 6
220
October 31, 2009
14:56
Philippe Jorrand and Simon Perdrix
The observable semantics of the language QIL, which is a denotational semantics acting on density matrices, is defined as follows: Definition 6.3.12. (Observable semantics). For any finite set Q, for any command C, let [[C]]o : D Q → D Q be defined as follows: [[skip]]o = I [[C1 ; C2 ]]o = [[C2 ]]o ◦ [[C1 ]]o [[σ (q)]]o = λρ.σq ρσq† [[H(q)]]o = λρ.Hq ρ Hq† [[T(q)]]o = λρ.Tq ρTq† [[CNot(q1 , q2 )]]o = λρ.X q1 ,q2 ρX q†1 ,q2
[[if q then C1 else C2 ]]o = λρ. [[C1 ]]o (Pqtrue ρ Pqtrue ) + [[C2 ]]o (Pqfalse ρ Pqfalse )
[[while q do C ]]o = lf p λ f.λρ. f ◦[[C]]o (Pqtrue ρ Pqtrue ) + Pqfalse ρ Pqfalse (FP false ◦ ([[C]]o ◦ FP true )n (ρ)) = λρ. n∈N
0 , FM = λρ.Mρ M † . where P 1 1 0 Example 6.3.13. [[ex1]]o = λρ.P false , [[ex2]]o = λρ. 2 1 , and [[ex3]]o = 0 2 1 0 λρ. 2 1 . 0 2 true
1 = 0
0 0 false and P = 0 0
Lemma 6.3.14. For any finite set Q and any command C, [[C]]o : D Q → D Q is a superoperator, i.e., tr([[C]]o (ρ)) ≤ tr(ρ) and (Ik ⊗ [[C]]o )(ρ ) is positive for any k ≥ 0 and any ρ, ρ positive, where Ik : Ck → Ck is the identity map. Proof. The proof is by induction on the command C. For instance, if C = if q then C1 else C2 then for any positive matrix ρ, [[C]]o (ρ) = F1 (Pqtrue ρ Pqtrue ) + F2 (Pqfalse ρ Pqfalse ) where F1 and F2 are superoperators by induction hypothesis. tr([[C]]o (ρ)) = tr(F1 (Pqtrue ρ Pqtrue )) + tr(F2 (Pqfalse ρ Pqfalse )) ≤ tr(Pqtrue ρ Pqtrue ) + tr(Pqfalse ρ Pqfalse ) = tr(Pqtrue ρ) + tr(Pqfalse ρ) = tr((Pqtrue + Pqfalse )ρ) = tr(ρ) Moreover, for any k ≥ 0, P j ρ P j is positive, so Ik ⊗ Fi (P j ρ P j ) is positive, thus Ik ⊗ [[C]]o (ρ) is positive.
P1: SBT CUUS834-06
cuus834-gay
6
978 0 521 51374 6
October 31, 2009
14:56
Abstract Interpretation Techniques for Quantum Computation
221
Observable and probabilistic semantics of QIL are not equivalent, as it is illustrated in examples 2 and 3: [[ex2]]o = [[ex3]]o whereas [[ex2]]p = [[ex3]]p . However, observable semantics is an exact abstraction (see Section 6.1.1) of the pure semantics: Lemma 6.3.15. [[.]]o is an exact αp,o -abstraction of [[.]]p , i.e., for any command C, [[C]]o ◦ αp,o = αp,o ◦ [[C]]p
DQ
[[.]]o
- DQ
6
6
αp,o VQ
αp,o .
- VQ
Proof. The proof is by induction on the command C. The proof is immediate for the commands skip, the composition, and the unitary transformations σ , H, T, and CNot. For the if case, the main two ingredients of the proof are: – for any ν ∈ V Q , αp,o |ϕ|trueq |2 ν(|ϕ)η (|trueq trueq |)|ϕ = P true αp,o (ν)P true |ϕ∈supp(ν)
|ϕ|trueq |
– αp,o is linear: for any ν1 , ν2 , αp,o (ν1 + ν2 ) = αp,o (ν1 ) + αp,o (ν2 ) For the while case, in order to preserve the least fixed point, the continuity of αp,o is used. Lemma 6.3.15 establishes a connection between two domains used in quantum computation (Abramsky 2004; Selinger 2004c). Observable and pure semantics are not equivalent; however, the observable semantics is an abstraction of the pure one. This abstraction carries the indistinguishability to the pure semantics: let C1 , and C2 be two commands such that [[C1 ]]p = [[C2 ]]p and [[C1 ]]o = [[C2 ]]o , then for any ν ∈ V Q , [[C1 ]]p (ν) and [[C1 ]]p (ν) are indistinguishable. However, even if observable and pure semantics are not equivalent, none of them violate the postulates of quantum mechanics.
6.3.4 Admissible Semantics According to the Kraus representation theorem (Choi 1975), for any superoperator † F, there exists a set of linear maps {Mi }i∈A such that F = ρ → i∈A Mi ρ Mi and † i∈A Mi Mi 1 I . Such a set of linear maps is called an admissible transformation or general measurement. Admissible transformations can also be used to group
P1: SBT CUUS834-06
cuus834-gay
978 0 521 51374 6
222
October 31, 2009
14:56
Philippe Jorrand and Simon Perdrix
two postulates of quantum mechanics into one. Indeed, the postulate on unitary evolutions and the one on projective measurements can be seen as special cases of a more general postulate on admissible transformations. In this formulation, a quantum system (isolated or not) evolves according to an admissible transformation {Mi }i∈A , such that the application of {Mi }i∈A on a state |ϕ produces the † classical outcome i ∈ A with probability ϕ|Mi Mi |ϕ, and the state of the system Mi |ϕ. becomes 0 1 †
ϕ|Mi Mi |ϕ
If an admissible transformation is composed of a unique unitary transformation U , then there is a unique classical outcome whose probability of occurrence is 1, and the admissible transformations maps |ϕ with U |ϕ; thus one can recover the postulate on isolated systems. Moreover, if an admissible transformation is composed of projectors only, then this is nothing but a projective measurement. In this section, we introduce an admissible semantics that associates with any program an admissible transformation. Let M X,Y be the set of all countable multisets {Mi }i∈A such that ∀i ∈ A, Mi ∈ † L(H X , HY ) and i∈A Mi Mi 1 IH X . Let m K (x) be the multiplicity of x in the multiset K , i.e., the number of occurrences of x in K . For any two multisets K and L, K ⊆ L if for any x, m K (x) ≤ m L (x). The join K , L is such that for any x, m K ,L (x) = m K (x) + m L (x). Moreover, composition ◦ of admissible transformations is defined as follows: for any {Mi }i∈A ∈ MY,Z , {M j } j∈B ∈ M X,Y , {Mi }i∈A ◦ {M j } j∈B = {Mi M j }(i, j)∈A×B ∈ M X,Z . Let E X := M∅,X , where H∅ = C. A linear map M ∈ L(C, H X ) ∼ = H X is a quantum state preparation that associates with the state of an empty system the state M(1) = |ϕ ∈ H Q . A quantum state preparation can be identified with the prepared state. The elements of E X , called ensemble states, are multisets of (not necessary normalized) pure states {|ϕi }i∈A such that i∈A ϕi |ϕi = i∈A |||ϕi ||2 ≤ 1. {|ϕi }i∈A ∈ E Q can be interpreted as an encoding of a probability distribution |0 √ where the probability is encoded in the norm of the vector: { √ , |12 } means |0 2 with probability 0.5 and |1 with probability 0.5. Such an encoding is used in Danos et al. (2007). An admissible transformation L ∈ M X,Y can be interpreted as a map E X → EY such that for any E ∈ E X , L(E) = L ◦ E. For any finite set Q, let M Q := M Q,Q . In order to define an admissible semantics for the language QIL, the completeness of partial order set (M Q , ⊆) is proved: Theorem 6.3.16. (M Q , ⊆) is a complete partial order with {0} as least element. Proof. Let L 0 ⊆ L 1 . . . be an increasing sequence. Assume w.l.o.g. that L i = {M j } j∈Ii where Ii is an interval of N such that 0 ∈ Ii , and Ii ⊆ Ii+1 . The increasing sequence I0 ⊆ I1 ⊆ . . . has a limit J ⊆ N; thus the least upper bound of L 0 ⊆ † † L 1 . . . is L = {Mi }i∈J . Moreover, i∈ j Mi Mi = lim n→∞ i∈In Mi Mi 1 I , so L ∈ MQ .
P1: SBT CUUS834-06
cuus834-gay
6
978 0 521 51374 6
October 31, 2009
14:56
Abstract Interpretation Techniques for Quantum Computation
223
Definition 6.3.17. (Admissible semantics). For any finite set Q, for any command C, let Ca ∈ M Q be defined as follows: skipa = {I } C1 ; C2 a = C2 a ◦ C1 a σ (q)a = {σq } H(q)a = {Hq } T(q)a = {Tq } CNot(q1 , q2 )a = {X q1 ,q2 }
if q then C1 else C2 a = C1 a ◦ {Pqtrue } , C2 a ◦ {Pqfalse } while q do C a =
∞ 1
{Pqfalse } ◦ (Ca ◦ {Pqtrue })n
k=0
Example 6.3.18. Since for any n > 1, (H P true )n =
0 0 0 ex1a = { },{ 1 0 1 2n/2 1 0 ex2a = { √ 2 0 1 , { 2(n+1)/2 0
1 2n/2
1 1
0 , 0
0 } 0 n>0
1 0 0 1 ,√ } 0 2 0 −1 0 0 0 , } −1 0 0 n>0 2(n+1)/2
1 0 ex3a = { 2 0
1 1 0 −1 , } 1 2 0 1 −1 1 0 1 2(n+2)/2 0 2(n+2)/2 }n>0 ,{ , 1 1 0 2 2(n+2)/2 0 2(n+2)/2
Notice that the admissible semantics of a program is a multiset of linear maps, such that each linear map is associated with a branch of the program. The admissible semantics is not equivalent to the observable semantics since ex2a = ex3a , whereas [[ex2]]o = [[ex3]]o . Moreover, one can prove that [[ex1]]p = [[while q do H (q) ]]p = [[H (q); while q do H (q) ]]p but ex1a = H (q); while q do H (q) a , so the admissible semantics is not equivalent to the pure semantics. In the following, we show that observable and pure semantics are exact abstractions of the admissible semantics. Definition 6.3.19 (Abstraction function αa,p ). For any Q, let αa,p : E Q → V Q such |ϕi |ϕi that for any E = {|ϕi }i∈A ∈ E Q , supp(αa,p (E)) = { |||ϕ }i∈A and αa,p (E)( |||ϕ ) i || i || = ϕi |ϕi .
P1: SBT CUUS834-06
cuus834-gay
224
978 0 521 51374 6
October 31, 2009
14:56
Philippe Jorrand and Simon Perdrix
Lemma 6.3.20. [[.]]p is an exact αa,p -abstraction of .a , i.e., for any command C, [[C]]p ◦ αa,p = αa,p ◦ Ca
VQ
[[.]]p
- VQ
6
6
αa,p
αa,p
EQ
.a
- EQ
Proof. The proof is by induction on the command C and based on the continuity of αa,p and its linearity: αa,p ({Mi }i∈A , {N j } j∈B ) = αa,p ({Mi }i∈A ) + αa,p ({N j } j∈B ). Definition 6.3.21 (Abstraction function αa,o ). For any Q, let αa,o : E Q → D Q :: αp,o ◦ αa,p : |ϕi ϕi | αa,o ({|ϕi }i∈A ) = i∈A
Lemma 6.3.22. [[.]]o is an exact αa,o -abstraction of .a . [[C]]o ◦ αa,o = αa,p ◦ Ca
DQ
[[.]]o
- DQ
6
6
αa,o EQ
αa,o .a
- EQ
Proof. [[.]]o ◦ αa,o = [[.]]o ◦ αp,o ◦ αa,p = αp,o ◦ [[.]]p ◦ αa,p = αp,o ◦ αa,p ◦ .a = αa,o ◦ .a Exact abstractions between the semantics established in lemmas 6.3.4, 6.3.5, and 6.3.6 lead to a semantic hierarchy: Theorem 6.3.23 (Hierarchy of quantum semantics). For any commands C1 , C2 , C1 a = C2 a =⇒ [[C1 ]]p = [[C2 ]]p [[C1 ]]p = [[C2 ]]p =⇒ [[C1 ]]o = [[C2 ]]o
P1: SBT CUUS834-06
cuus834-gay
6
978 0 521 51374 6
October 31, 2009
14:56
Abstract Interpretation Techniques for Quantum Computation
DQ
[[.]]o
225
- DQ
6
6
αp,o
αp,o
VQ
[[.]]p
- VQ
6
6
αa,p EQ
αa,p .a
- EQ
6.4 Entanglement Analysis Quantum entanglement is a nonlocal property of quantum mechanics. The entanglement reflects the ability of a quantum system composed of several subsystems to be in a state that cannot be decomposed into the states of the subsystems. Entanglement is one of the properties of quantum mechanics that caused Einstein and others to dislike the theory. In 1935, Einstein, Podolsky, and Rosen formulated the EPR paradox (Einstein et al. 1935). On the other hand, quantum mechanics has been highly successful in producing correct experimental predictions, and the strong correlations associated with the phenomenon of quantum entanglement have indeed been observed (Aspect et al. 1981). Entanglement leads to correlations between subsystems that can be exploited in information theory (e.g., teleportation scheme; Bennett et al. 1993). The entanglement plays also a decisive, but not yet well-understood, role in quantum computation, since any quantum algorithm can be efficiently simulated on a classical computer when the quantum memory is not entangled during all the computation. As a consequence, interesting quantum algorithms, such as Shor’s algorithm for factorization (Shor 1994), exploit this phenomenon. In order to know what is the amount of entanglement of a quantum state, several measures of entanglement have been introduced (see for instance Nielsen and Chuang 2000). Recent work consists in characterizing, in the framework of the one-way quantum computation (Van den Nest et al. 2006; Danos and Kashefi 2006; Browne et al. 2007), the amount of entanglement necessary for a universal model of quantum computation. Notice that all these techniques consist in analyzing the entanglement of a given state, starting with its mathematical description. In the following, an entanglement analysis based on the framework of abstract interpretation is presented. The representation of entanglement, i.e., the design of the abstract domain, is a key issue. A representation of entanglement as a partition of the memory is chosen. An abstract semantics is introduced, and the soundness of the approximation is proved.
P1: SBT CUUS834-06
cuus834-gay
226
978 0 521 51374 6
October 31, 2009
14:56
Philippe Jorrand and Simon Perdrix
6.4.1 Entanglement Quantum entanglement is a nonlocal property that has no classical counterpart. Intuitively, a quantum state of a system composed of several subsystems is entangled if it cannot be decomposed into the state of its subsystems. A quantum state that is not entangled is called separable. More precisely, for a given finite set of qubits Q, let n = |Q|. For a given partition A, B of Q, and a given ρ ∈ D2n , ρ is biseparable according to A, B (or ( A, B)-separable for short) if and only if there exist K , pk ≥ 0, ρkA and ρkB such that pk ρkA ⊗ ρkB ρ= k∈K
ρ is entangled according to the partition A, B if and only if ρ is not ( A, B)separable. Notice that biseparability provides a very partial information about the entanglement of a quantum state; for instance, for a 3-qubit state ρ, which is ({1}, {2, 3})separable, qubit 2 and qubit 3 may be entangled or not. One way to generalize the biseparability is to consider that a quantum state is π -separable – where π = {Q j , j ∈ J } is a partition of Q – if and only if there Q exist K , pk ≥ 0, and ρk j such that 2 Qj pk ρk . ρ= k∈K
j∈J
Notice that the structure of quantum entanglement presents some interesting and nontrivial properties. For instance, there exist some 3-qubit states ρ such that ρ is biseparable for any bipartition of the 3 qubits, but not fully separable, i.e., separable according to the partition {{1}, {2}, {3}}. As a consequence, for a given quantum state, there is not necessarily a best representation of its entanglement. Example 6.4.1. Quantum entanglement between two qubits q2 and q3 can be created for instance by applying H and X on an appropriate state. Such an entangled state can then be used to teleporte the state of a third qubit q1 . The protocol of teleportation (Bennett et al. 1993) can be described as teleportation, {q1 , q2 , q3 }, where teleportation : H(q2 ); CNot(q2 , q3 ); CNot(q1 , q2 ); H(q1 ); if q1 then if q2 then skip else σx (q3 ) else if q2 then σz (q3 ) else σy (q3 )
P1: SBT CUUS834-06
cuus834-gay
6
978 0 521 51374 6
October 31, 2009
14:56
Abstract Interpretation Techniques for Quantum Computation
227
The program teleportation, {q1 , q2 , q3 } realises the teleportation from q1 to q3 , when the qubits q2 and q3 are both initialised in state Ptrue : for any ρ ∈ D2 , 1 Pk ⊗ Pl ⊗ ρ [[teleportation]]o (ρ ⊗ Ptrue ⊗ Ptrue ) = 4 k,l∈{true,false}
6.4.2 Standard and Diagonal Basis For a given state ρ ∈ D Q and a given qubit q ∈ Q, if ρ is ({q}, Q \ {q})-separable, then q is separated from the rest of the memory. Moreover, such a qubit may be a basis state in the standard basis (s) or the diagonal basis (d), meaning that the state of this qubit can be seen as a “classical state” according to the corresponding basis. More formally, a qubit q of ρ is in the standard basis if there exist p0 , p1 ≥ 0, and ρ0 , ρ1 ∈ D Q\{q} such that ρ = p0 P0 ⊗ ρ0 + p1 P1 ⊗ ρ1 . Equivalently, q is in (q) (q) (q) (q) the standard basis if and only if P0 ρP1 = P1 ρP0 = 0. A qubit q is in the diagonal basis in ρ if and only if q is in the standard basis in H (q) ρ H (q) . Notice that some states, like the maximally mixed 1-qubit state 12 (P0 + P1 ), are in both standard and diagonal basis, while others are in neither standard nor diagonal basis, like the 1-qubit state T H P0 H T . We introduce a function β : D Q → B Q , where B Q = Q → {s, d, , ⊥}, such that β(ρ) describes which qubits of ρ are in the standard or diagonal basis: Definition 6.4.2. For any finite Q, let β : D Q → B Q such that for any ρ ∈ D Q , and any q ∈ Q, ⊥ if q is in both standard and diagonal basis in ρ s if q is in the standard and not in the diagonal basis in ρ β(ρ)q = d if q is in the diagonal and not in the standard basis in ρ otherwise.
6.4.3 Analysis of Entanglement Evolution What is the role of the entanglement in quantum information theory? How does the entanglement evolve during a quantum computation? We consider the problem of analyzing the entanglement evolution on a classical computer, since no largescale quantum computer is available at the moment. Entanglement analysis using a quantum computer is left to further investigations. Notice that it is not clear that the use of a quantum computer avoids the use of the classical computer, since there is no way to measure the entanglement of a quantum state without transforming the state. In the absence of a quantum computer, an obvious solution consists in simulating the quantum computation on a classical computer. Unfortunately, the classical memory required for the simulation is exponentially large in the size of the
P1: SBT CUUS834-06
cuus834-gay
228
978 0 521 51374 6
October 31, 2009
14:56
Philippe Jorrand and Simon Perdrix
quantum memory of the program simulated. Moreover, the problem SEP of deciding whether a given quantum state ρ is biseparable or not is NP Hard (Gurvits 2003). Furthermore, the input of the problem SEP is a density matrix, the size of which is exponential in the number of qubits. As a consequence, a classical simulation is not suitable for an efficient entanglement analysis. To tackle this problem, a solution consists in reducing the size of the quantum state space by considering a subspace of possible states, such that there exist algorithms to decide whether a state of the subspace is entangled or not in a polynomial time in the number of qubits. This solution has been applied in Gay et al. (2007), by considering stabilizer states only. However, this solution, which may be suitable for some quantum protocols, is questionable for analyzing quantum algorithms since all the quantum programs on which such an entanglement analysis can be driven are also efficiently simulable on a classical computer. In this paper, an approach based on approximation is rather preferred. This solution is based on the framework of abstract interpretation. Since a classical domain for driving a sound and complete analysis of entanglement is exponentially large in the number n of qubits, we consider an abstract domain of size n and we introduce an abstract semantics that leads to a sound approximation of the entanglement evolution during the computation.
6.4.3.1 Abstract Semantics The entanglement of a quantum state can be represented as a partition of the qubits of the state (see Section 6.4.1); thus a natural abstract domain is a domain composed of partitions. Moreover, for a given state ρ, one can add a flag for each qubit q, indicating whether the state of this qubit is in the standard basis s or in the diagonal basis d (see Section 6.4.2). Definition 6.4.3 (Abstract domain). For a finite set of variables Q, let A Q = B Q × Π Q be an abstract domain, where B Q = Q → {s, d, , ⊥} and Π Q is the set of partitions of Q: 3 Π Q = {π ⊆ ℘(Q) \ {∅} | X = Q and (∀X, Y ∈ π, X ∩ Y = ∅ or X = Y )}. X ∈π
The abstract domain A is ordered as follows. Let ({s, d, , ⊥}, ≤) be a poset, where ≤ is defined as ⊥ ≤ s ≤ and ⊥ ≤ d ≤ . (B Q , ≤) is a poset, where ≤ is defined pointwise. Moreover, for any π1 , π2 ∈ Π Q , let π1 ≤ π2 if π1 refines π2 , i.e., for every block X ∈ π1 there exists a block Y ∈ π2 such that X ⊆ Y . Finally, for any (b1 , π ), (b2 , π2 ) ∈ A Q , (b1 , π ) ≤ (b2 , π2 ) if b1 ≤ b2 and π1 ≤ π2 . Proposition 6.4.4. For any finite set Q, (A Q , ≤) is a complete partial order, with ⊥ = (λq.⊥, {{q}, q ∈ Q}) as least element.
Proof. Every chain has a supremum since Q is finite. Basic operations of meet ∧ and join ∨ are defined on A . Q
P1: SBT CUUS834-06
cuus834-gay
6
978 0 521 51374 6
October 31, 2009
14:56
Abstract Interpretation Techniques for Quantum Computation
229
A removal operation on partitions is introduced as follows: For a given partition π = {Q i , i ∈ I }, let π \ q = {Q i \ {q}, i ∈ I } ∪ {{q}}. Moreover, for any pair of qubits q1 , q2 ∈ Q, let [q1 , q2 ] = {{q | q ∈ Q \ {q1 , q2 }}, {q1 , q2 }}. Finally, for any b ∈ B Q , any q0 , q ∈ Q, any k ∈ {s, d, , ⊥}, let % k if q = q0 q0 →k = bq bq otherwise. We are now ready to define the abstract semantics of the language: Definition 6.4.5 (Denotational abstract semantics). For any program C, Q, let Ca : A Q → A Q be defined as follows: For any (b, π ) ∈ A Q , skipa (b, π ) = (b, π ) C1 ; C2 a (b, π ) = C2 a ◦ C1 a (b, π ) σ (q)a (b, π ) = (b, π ) H(q)a (b, π ) = (bq →d , π ) if bq = s = (bq →s , π ) if bq = d = (b, π ) otherwise T(q)a (b, π ) = (bq → , π ) if bq = d = (bq →s , π ) if bq = ⊥ = (b, π ) otherwise CNot(q1 , q2 )a (b, π ) = (b, π ) if bq1 = s or bq2 = d = (bq1 →s , π ) if bq1 = ⊥ and bq2 > ⊥ = (bq2 →d , π ) if bq1 > ⊥ and bq2 = ⊥ = (bq1 →s,q2 →d , π ) if bq1 = ⊥ and bq2 = ⊥ = (bq1 ,q2 → , π ∨ [q1 , q2 ]) otherwise if q then C1 else C2 a (b, π ) = (C1 a (bq →s , π \ q) ∨ C2 a (bq →s , π \ q)) f ◦Ca (bq →s
, π \ q) ∨ (bq →s , π \ q))) while q do C a (b, π ) = lf p (λ f.λπ.( 4 = n∈N Fq ◦ (Ca ◦ Fq )n
where Fq = λ(b, π ).(bq →s , π \ q). Intuitively, quantum operations act on entanglement as follows: • A 1-qubit measurement makes the measured qubit separable from the rest of the memory. Moreover, the state of the measured qubit is in the standard basis.
P1: SBT CUUS834-06
cuus834-gay
230
978 0 521 51374 6
October 31, 2009
14:56
Philippe Jorrand and Simon Perdrix
• A 1-qubit unitary transformation does not modify entanglement. Any Pauli operator σ ∈ {σx , σ y , σz } preserves the standard and the diagonal basis of the qubits. Hadamard H transforms a state of the standard basis into a state of the diagonal basis and vice versa. Finally, the phase T preserves the standard basis but not the diagonal basis. • The 2-qubit unitary transformation X , applied on q1 and q2 , may create entanglement between the qubits or not. It turns out that if q1 is in the standard basis, or q2 is in the diagonal basis, then no entanglement is created and the bases of q1 and q2 are preserved. Otherwise, since a sound approximation is desired, X is abstracted into an operation that creates entanglement. Notice that the space needed to store a partition of n elements is O(n). Moreover, meet, join, and removal and can be done in either constant or linear time. Example 6.4.6. The abstract semantics of teleportation (see Example 6.4.1) is teleportationa : A{q1 ,q2 ,q3 } → A{q1 ,q2 ,q3 } = λ(b, π ).(bq1 ,q2 →s,q3 → , ⊥). Thus, for any 3-qubit state, the state of the memory after the teleportation is fully separable. Assume that a fourth qubit q4 is entangled with q1 before the teleportation, whereas q2 and q3 are in the state Ptrue , so that the state of the memory before the teleportation is [q1 , q4 ]-separable. The abstract semantics of teleportation, {q1 , q2 , q3 , q4 } is such that teleportationa (b, [q1 , q4 ]) = (bq1 ,q2 →s,q3 → , [q3 , q4 ]) Thus the abstract semantics predicts that q3 is entangled with q4 at the end of the teleportation, even if q3 never interacts with q4 . Example 6.4.7. Consider the program trap, {q1 , q2 }, where trap = CNot(q1 , q2 ); CNot(q1 , q2 ) Since X is self-inverse, [[trap]]o : D{q1 ,q2 } → D{q1 ,q2 } = λρ.ρ. For instance, [[trap]]o ( 21 (P true + P false ) ⊗ P true ) = 12 (P true + P false ) ⊗ P true . However, if bq1 = d and bq2 = s then trapa (b, {{q1 }, {q2 }}) = (bq1 →,q1 → , {{q1 , q2 }}) Thus, according to the abstract semantics, at the end of the computation, q1 and q2 are entangled.
6.4.3.2 Soundness Example 6.4.7 points out that the abstract semantics is an approximation, so it may differ from the entanglement evolution of the concrete semantics. However, in this section, we prove the soundness of the abstract interpretation (Theorem 6.4.12). First, we define a function β : D Q → B Q such that β(ρ) describes which qubits of ρ are in the standard or diagonal basis:
P1: SBT CUUS834-06
cuus834-gay
6
978 0 521 51374 6
October 31, 2009
14:56
Abstract Interpretation Techniques for Quantum Computation
231
Definition 6.4.8. For any finite Q, let β : D Q → B Q such that for any ρ ∈ D Q , and any q ∈ Q, true false false true s if Pq ρ Pq = Pq ρ Pq = 0 β(ρ)q = d if (Pqtrue+Pqfalse )ρ(Pqtrue − Pqfalse )=(Pqtrue−Pqfalse )ρ(Pqtrue+Pqfalse ) = 0 otherwise A natural soundness relation is then: Definition 6.4.9 (Soundness relation). For any finite set Q, let τ ∈ ℘(D Q , A Q ) be the soundness relation: τ = {(ρ, (b, π )) | ρ is π -separable and β(ρ) ≤ b}. The approximation relation is nothing but the partial order ≤: (b, π ) is a more precise approximation than (b , π ) if (b, π ) ≤ (b , π ). Notice that the abstract soundness assumption is satisfied: if ρ is π -separable and π ≤ π then ρ is π -separable. So, (ρ, a) ∈ τ and (ρ, a) ≤ (ρ , a ) imply (ρ , a ) ∈ τ . However, the best approximation is not ensured. Indeed, there exist some 3qubit states (Eggeling and Werner 2001; Bennett et al. 1999) that are separable according to any of the three bipartitions of their qubits {a, b, c} but that are not {{a}, {b}, {c}}-separable. Thus, the best approximation does not exist. However, the soundness relation τ satisfies the following lemma: Lemma 6.4.10. For any finite set Q, any ρ1 , ρ2 ∈ D Q , and any a1 , a2 ∈ A Q , (ρ1 , a1 ), (ρ2 , a2 ) ∈ τ =⇒ (ρ1 + ρ2 , π1 ∨ π2 ) ∈ τ. Moreover, the abstract semantics is monotonic according to the approximation relation: Lemma 6.4.11. For any command C, Ca is ≤-monotonic: for any π1 , π2 ∈ A Q , π1 ≤ π2 =⇒ Ca (π1 ) ≤ Ca (π2 ).
Proof. The proof is by induction on C.
Theorem 6.4.12 (Soundness). For any program C, Q, any ρ ∈ D Q , and any a ∈ AQ , (ρ, a) ∈ τ =⇒ (C(ρ), Ca (a)) ∈ τ.
Proof. The proof is by induction on C.
In other words, if ρ is π-separable and β(ρ) ≤ b, then C(ρ) is π -separable and β(C(ρ)) ≤ b , where (b , π ) = Ca (b, π ).
6.5 Conclusion and Perspectives In this paper, two applications of abstract interpretation in quantum information processing have been presented: for establishing a hierarchy of quantum semantics,
P1: SBT CUUS834-06
cuus834-gay
232
978 0 521 51374 6
October 31, 2009
14:56
Philippe Jorrand and Simon Perdrix
and for analyzing entanglement evolution. These works demonstrate that abstract interpretation techniques can be successfully applied in quantum computing. There are several perspectives for development of this work. First, more general settings can be considered. Indeed, the simple quantum imperative language considered in this paper is expressive enough to encode any quantum evolution. However, a perspective is to develop such abstract interpretations in a more general setting allowing high-order functions, representation of classical variables, or unbounded quantum memory. Regarding the entanglement analysis, a perspective in order to reach a more precise entanglement analysis is to refine the abstract domain, adding for instance a third basis, since it is known that there are three mutually unbiased basis for each qubit. The objective is also to provide a practical tool for analysing entanglement evolution of more sophisticated programs, like Shor’s algorithm for factorization (Shor 1994). Another perspective is to consider that a quantum computer is available for driving the entanglement analysis. Notice that such an analysis of entanglement evolution is not trivial, even if a quantum computer is available, since a tomography (White et al. 2007) is required to know the entanglement of the quantum memory state.
Bibliography Abramsky, S. (2004) A Cook’s tour of a simple quantum programming language. 3rd International Symposium on Domain Theory, Xi’an, China. Abramsky, S., and Coecke, B. (2004) A categorical semantics of quantum protocols. In LICS, pages 415–425. Abramsky, S., and Jung, A. (1994) Domain theory. In Abramsky, S., Gabbay, D., and Maibaum, T. S. E., editors, Handbook of Logic in Computer Science Volume 3, pages 1–168. Oxford University Press. Altenkirch, T., and Grattage, J. (2005a) A functional quantum programming language. In 20th Annual IEEE Symposium on Logic in Computer Science. Altenkirch, T., and Grattage, J. (2005b) QML: Quantum data and control. Manuscript. Aspect, A., Grangier, P., and Roger, G. (1981) Experimental tests of realistic local theories via Bell’s theorem. Physical Review Letters 47:460. Baltazar, P., Chadha, R., and Mateus, P. (2008) Quantum computation tree logic – model checking and complete calculus. International Journal of Quantum Information 6(2). Baltazar, P., Chadha, R., Mateus, P., and Sernadas, A. (2007) Towards model-checking quantum security protocols. In ICQNM, page 14. IEEE Computer Society. Bennett, C. H. (1992) Quantum cryptography using any two nonorthogonal states. Physical Review Letters 68:3121. Bennett, C. H., and Brassard, G. (1984) Quantum cryptography: Public key distribution and coin tossing. In Proceedings of IEEE international Conference on Computers, Systems and Signal Processing, Bangalore, India, page 175. IEEE Press. Bennett, C. H., Brassard, G., Cr´epeau, C., Jozsa, R., Peres, A., and Wootters, W. K. (1993) Teleporting an unknown quantum state via dual classical and Einstein-Podolsky-Rosen channels. Physical Review Letters 70:1895–1899. Bennett, C. H., DiVincenzo, D. P., Mor, T., Shor, P. W., Smolin, J. A., and Terhal, B. M. (1999) Unextendible product bases and bound entanglement. Physical Review Letters 82:5385. Browne, D., Kashefi, E., Mhalla, M., and Perdrix, S. (2007) Generalized flow and determinism in measurement-based quantum computation. arXiv.org preprint quant-ph/0702212.
P1: SBT CUUS834-06
cuus834-gay
6
978 0 521 51374 6
October 31, 2009
14:56
Abstract Interpretation Techniques for Quantum Computation
233
Choi, M.-D. (1975) Completely positive linear maps on complex matrices. Linear Algebra and its Applications 10:285. Cousot, P. (1981) Semantics Foundation of Program Analysis. In Muchnick, S. S. and Jones, N. D., editors, Program Flow Analysis: Theory and Applications, chapter 10, pages 303–342. Prentice-Hall. Cousot, P. (1997) Constructive design of a hierarchy of semantics of a transition system by abstract interpretation. Theoretical Computer Science 6. Cousot, P. (2002) Constructive design of a hierarchy of semantics of a transition system by abstract interpretation. Theoretical Computer Science 277(86). Cousot, P., and Cousot, R. (1976) Static determination of dynamic properties of programs. In 2nd International Symposium on Programming, Paris, France. Cousot, P., and Cousot, R. (1977) Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Conference Record of the Fourth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 238–252. ACM Press. Cousot, P., and Cousot, R. (1979) Systematic design of program analysis frameworks. In 6th POPL, San Antonio, Texas, pages 269–282. Danos, V., and Kashefi, E. (2006) Determinism in the one-way model. Physical Review A. Danos, V., Kashefi, E., and Panangaden, P. (2007) The measurement calculus. Journal of the ACM 54(2). Eggeling, T., and Werner, R. F. (2001) Separability properties of tripartite states with uuu symmetry. Physical Review A 63(0421111). Einstein, A., Podolsky, B., and Rosen, N. (1935) Can quantum-mechanical description of reality be considered complete? Physical Review 47(10):777–780. Gay, S. J. (2006) Quantum programming languages: Survey and bibliography. Mathematical Structures in Computer Science 16(4). Gay, S. J., Nagarajan, N., and Papanikolaou, N. (2008) QMC: A model checker for quantum systems. In CAV’08, volume 5123, pages 543–547. LNCS. Gay, S. J., and Nagarajan, R. (2005) Communicating quantum processes. In Proceedings of the 32nd ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL). ACM Press. Gay, S. J., and Nagarajan, R. (2006) Types and typechecking for Communicating Quantum Processes. Mathematical Structures in Computer Science 16(3):375–406. Gay, S. J., Nagarajan, R., and Papanikolaou, N. (2007) QMC: A model checker for quantum systems. arxiv:0704.3705. Grover, L. K. (1996) A fast quantum mechanical algorithm for database search. In STOC, pages 212–219. Gurvits, L. (2003) Classical deterministic complexity of Edmonds’ problem and quantum entanglement. In Proceedings of the 35th ACM Symposium on Theory of Computing, page 10. ACM Press. Jones, C., and Plotkin, G. D. (1989) A probabilistic powerdomain of evaluations. In LICS, pages 186–195. Kashefi, E. (2003) Complexity Analysis and Semantics for Quantum Computing. Ph.D. thesis, Imperial College London. Lalire, M., and Jorrand, P. (2004) A process algebraic approach to concurrent and distributed computation: operational semantics. In Selinger (2004b). Also arXiv:quant-ph/0407005. Nielsen, M. A., and Chuang, I. L. (2000) Quantum Computation and Quantum Information. Cambridge University Press. Perdrix, S. (2006) Formal models of quantum computation: resources, abstract machines and measurement-based quantum computation (in French). Ph.D. thesis, Institut National Polytechnique de Grenoble. Perdrix, S. (2007) Quantum patterns and types for entanglement and separability. Electronic Notes in Theoretical Computer Science 170:125–138. Proceedings of the 3rd International Workshop on Quantum Programming Languages.
P1: SBT CUUS834-06
cuus834-gay
234
978 0 521 51374 6
October 31, 2009
14:56
Philippe Jorrand and Simon Perdrix
Perdrix, S. (2008a) A hierarchy of quantum semantics. In Proceedings of the 3rd International Workshop on Development of Computational Models, ENTCS, volume 192(3), pages 71–83. Perdrix, S. (2008b) Quantum entanglement analysis based on abstract interpretation. In Proceedings of 15th International Symposium on Static Analysis, (SAS), LNCS, volume 5079, pages 270–282. Prost, F., and Zerrari, C. (2008) A logical analysis of entanglement and separability in quantum higher-order functions. arXiv.org:0801.0649. Raussendorf, R., Browne, D. E., and Briegel, H. J. (2002) The one-way quantum computer – a non-network model of quantum computation. Journal of Modern Optics 49:1299. Scott, D. (1972) Continuous lattices. In Lawvere, F. W., editor, Toposes, Algebraic Geometry, and Logic, number 274 in Lecture Notes in Mathematics, pages 97–136. Springer-Verlag. Selinger, P. (2004a) A brief survey of quantum programming languages. In Proceedings of the 7th International Symposium on Functional and Logic Programming, volume 2998 of Lecture Notes in Computer Science, pages 1–6. Springer. Selinger, P., editor (2004b) Proceedings of the 2nd International Workshop on Quantum Programming Languages, number 33 in TUCS General Publications. Turku Centre for Computer Science. Selinger, P. (2004c) Towards a quantum programming language. Mathematical Structures in Computer Science 14(4):527–586. Selinger, P. (2004d) Towards a semantics for higher-order quantum computation. In Selinger (2004b). Shor, P. (1994) Algorithms for quantum computation: Discrete logarithms and factoring. In Shafi Goldwasser, I. C. S. P., editor, Proceedings of the 35nd Annual Symposium on Foundations of Computer Science, pages 124–134. Van den Nest, M., Miyake, A., D¨ur, W., and Briegel, H. J. (2006) Universal resources for measurement-based quantum computation. White, A. G., Gilchrist, A., Pryde, G. J., O’Brien, J. L., Bremner, M. J., and Langford, N. K. (2007) Measuring two-qubit gates. Journal of the Optical Society of America B 24(2):172–183.
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
Abstract Measurement-based quantum computation (MBQC) has emerged as a new approach to quantum computation where the notion of measurement is the main driving force of computation. This is in contrast with the more traditional circuit model that takes unitary operations as fundamental. Among measurement-based quantum computation methods the recently introduced one-way quantum computer stands out as basic and fundamental. The key idea is to start from an entangled state and then use measurements and one-qubit unitaries, which may be dependent on the outcomes of measurements, to guide the computation. The main point is that one never has to perform unitaries on more than one qubit at a time after the initial preparation of an entangled state. The “programs” that one writes in this model are traditionally called “patterns.” In this chapter, we develop a rigorous mathematical model underlying measurement-based quantum computation. We give syntax, operational semantics, denotational semantics, and an algebra of programs derived from the denotational semantics. We also present a rewrite theory and prove a general standardization theorem that allows all programs to be put in a semantically equivalent standard form. Standardization has far-reaching consequences: a new physical architecture based on performing all the entanglement in the beginning, parallelization by exposing the dependency structure of measurements, and expressiveness theorems. We use our general measurement calculus not just to formalize the one-way model but also several other measurement-based models, e.g., Teleportation, Phase, and Pauli models, and present compositional embeddings of them into and from the one-way model. This allows us to transfer all the theory we develop for the one-way model to these models. This shows that the framework we have developed has a general impact on measurement-based computation and is not just particular to the one-way quantum computer. We introduce projection-based models of quantum computing that encapsulate the nonadaptive aspects of measurement-based computation and allow us to 235
P1: SBT CUUS834-07
cuus834-gay
236
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
explore algorithmic design principles for MBQC. We start with the observation that one-way patterns implicitly define a particular decomposition of unitary maps into a preparation map enlarging the input space, a diagonal map with unit coefficients, and a restriction map contracting the space back to the output space. We then demonstrate how this decomposition can be used to implement unitary maps directly into the projection-based model for quantum computing. A natural step to take from there is to investigate how to transform a projectionbased pattern specification to a measurement-based implementation. This is the basis of our next structural result, which asserts that under a graph-theoretic condition on the entanglement underlying a given computation, namely the existence of what we call a “flow,” it is possible to ensure the global determinism of the computation using suitable dependencies between measurements. Finally we conclude with a demonstration of how tools obtained from the MBQC formalism can be used in the traditional quantum circuit model to derive a rewriting system for quantum circuits that decreases computation depth, this being an important issue in relation to decoherence time.
7.1 Introduction The emergence of quantum computation has changed our perspective on many fundamental aspects of computing: the nature of information and how it flows, new algorithmic design strategies and complexity classes, and the very structure of computational models. New challenges have been raised in the physical implementation of quantum computers. This chapter is an investigation into the structure, scope, and limits of quantum computation. The main issues are questions about how quantum processes are defined, how quantum algorithms compose, how quantum resources are used, and how classical and quantum information interact. Traditionally, the main framework to explore quantum computation has been the circuit model (Deutsch 1989), based on unitary evolution. This is very useful for algorithmic development and complexity analysis (Bernstein and Vazirani 1997). There are other models such as quantum Turing machines (Deutsch 1985) and quantum cellular automata (Watrous 1995; van Dam 1996; D¨urr and Santha 1996; Schumacher and Werner 2004). Although they are all proved to be equivalent from the point of view of expressive power, there is no agreement on what is the canonical model for exposing the key aspects of quantum computation. On the other hand, physicists have introduced novel ideas based on the use of measurement and entanglement to perform computation (Gottesman and Chuang 1999; Raussendorf and Briegel 2001; Raussendorf et al. 2003; Nielsen 2003). This is very different from the circuit model where measurement is done only at the end to extract classical output. In measurement-based quantum computation the main operation to manipulate information and control computation is measurement. This is surprising because measurement creates indeterminacy, yet it is used to express deterministic computation defined by a unitary evolution.
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
237
The idea of computing based on measurements emerged from the teleportation protocol (Bennett et al. 1993). The goal of this protocol is for an agent to transmit an unknown qubit to a remote agent without actually sending the qubit. This protocol works by having the two parties share a maximally entangled state called a Bell pair. The parties perform local operations – measurements and unitaries – and communicate only classical bits. Remarkably, from this classical information the second party can reconstruct the unknown quantum state. In fact one can actually use this to compute via teleportation by choosing an appropriate measurement (Gottesman and Chuang 1999). This is the key idea of measurement-based computation. It turns out that the preceding method of computing is actually universal. This was first shown by Gottesman and Chuang (1999), who used two-qubit measurements and given Bell pairs. The one-way computer was then invented by Raussendorf and Briegel (2001, 2002); it used only single-qubit measurements with a particular multiparty entangled state, the cluster state. In another approach, Nielsen (2003) showed that one could do universal quantum computing with only 4-qubit measurements with no prior Bell pairs; however, this works only probabilistically. Later Leung (2004) improved Nielsen’s method using only two qubit measurements, and finally Perdrix and Jorrand (Perdrix 2003; Perdrix and Jorrand 2004) gave the minimal set of measurements to perform universal quantum computing – but still in the probabilistic setting – and introduced the state-transfer and measurement-based quantum Turing machine. More precisely, a computation consists of a phase in which a collection of qubits are set up in a standard entangled state. Then measurements are applied to individual qubits and the outcomes of the measurements may be used to determine further adaptive measurements. Finally – again depending on measurement outcomes – local adaptive unitary operators, called corrections, are applied to some qubits; this allows the elimination of the indeterminacy introduced by measurements. The phrase “one-way” is used to emphasize that the computation is driven by irreversible measurements. There are at least two reasons to take measurement-based models seriously: one conceptual and one pragmatic. The main pragmatic reason is that the one-way model is believed by physicists to lend itself to easier implementations (Nielsen 2004; Clark et al. 2005; Browne and Rudolph 2005; Tame et al. 2004, 2006; Walther et al. 2005; Kay et al. 2006; Benjamin et al. 2005; Chen et al. 2006; Benjamin et al. 2006). Physicists have investigated various properties of the cluster state and have accrued evidence that the physical implementation is scalable and robust against decoherence (Schlingemann 2003; Hein et al. 2004; D¨ur et al. 2003; den Nest et al. 2004b,a; Mhalla and Perdrix 2004; Gilbert et al. 2005; Hartmann et al. 2005; Dawson et al. 2006). Conceptually the measurement-based model highlights the role of entanglement and separates the quantum and classical aspects of computation; thus it clarifies, in particular, the interplay between classical control and the quantum evolution process. Our approach to understanding the structural features of measurement-based computation is to develop a formal calculus (Danos et al. 2007). One can think
P1: SBT CUUS834-07
cuus834-gay
238
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
of this as an “assembly language” for measurement-based computation. Ours is the first programming framework specifically based on the one-way model. We first develop a notation for such classically correlated sequences of entanglements, measurements, and local corrections. Computations are organized in patterns; we use the word “pattern” rather than “program” because this corresponds to the commonly used terminology in the physics literature. We give a careful treatment of the composition and tensor product (parallel composition) of patterns. We show next that such pattern combinations reflect the corresponding combinations of unitary operators. An easy proof of universality follows. So far, this is primarily a clarification of what was already known from the series of papers introducing and investigating the properties of the one-way model (Raussendorf and Briegel 2001, 2002; Raussendorf et al. 2003). However, we work here with an extended notion of pattern, where inputs and outputs may overlap in any way one wants them to, and this results in more efficient – in the sense of using fewer qubits – implementations of unitaries. Specifically, our universal set consists of patterns using only 2 qubits. From it we obtain a 3-qubit realization of the Rz rotations and a 14-qubit realization for the controlled-U family: a significant reduction over the hitherto known implementations. We then introduce a calculus of local equations over patterns that exploits some special algebraic properties of the entanglement, measurement, and correction operators. More precisely, we use the fact that 1-qubit measurements are closed under conjugation by Pauli operators and the entanglement command belongs to the normalizer of the Pauli group. We show that this calculus is sound in that it preserves the interpretation of patterns. Most importantly, we derive from it a simple algorithm by which any general pattern can be put into a standard form where entanglement is done first, then measurements, then corrections. We call this standardization. The consequences of the existence of such a procedure are far-reaching. Since entangling comes first, one can prepare the entire entangled state needed during the computation right at the start: one never has to do “on the fly” entanglements. Furthermore, the rewriting of a pattern to standard form reveals parallelism in the pattern computation. In a general pattern, one is forced to compute sequentially and to strictly obey the command sequence, whereas, after standardization, the dependency structure is relaxed, resulting in lower computational depth complexity (Broadbent and Kashefi 2009). Last, the existence of a standard form for any pattern also has interesting corollaries beyond implementation and complexity matters, as it follows from it that patterns using no dependencies, or using only the restricted class of Pauli measurements, can only realize a unitary belonging to the Clifford group and hence can be efficiently simulated by a classical computer (Gottesman 1997). As we have noted before, there are other methods for measurement-based quantum computing: the teleportation technique based on two-qubit measurements (Bennett et al. 1993; Gottesman and Chuang 1999) and the state-transfer approach based on single qubit measurements and incomplete two-qubit measurements
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
239
(Perdrix 2003, 2007). We analyze both models and their relations to the one-way model. We show how our calculus can be smoothly extended to cover these cases as well as other generalizations of the one-way model. We get several benefits from our treatment through a workable syntax for handling the dependencies of operators on previous measurement outcomes just by mimicking the one obtained in the one-way model. This has never been done before for the teleportation or state transform models. Furthermore, we can use these embeddings to obtain a standardization procedure for these models. Finally the extended calculi can be compositionally embedded back in the original one-way model. This clarifies the relation between different measurement-based models and shows that the one-way model of Raussendorf and Briegel is the canonical one. Having obtained the rigorous mathematical model underlying the measurementbased quantum computing, we explore whether this model may suggest new techniques for designing quantum algorithms and protocols. We start with the observation that one-way patterns implicitly define a particular decomposition of unitary maps into a preparation map enlarging the input space, a diagonal map with unit coefficients, and a restriction map contracting the space back to the output space, which we call a phase map decomposition (de Beaudrap et al. 2006, 2008). However this decomposition does not directly correspond to any physical procedure leading to the definition of projection-based quantum computing. In other words, a projection-based pattern encapsulates most of the nonadaptive aspects of a measurement-based computation. We then demonstrate how phase map decomposition can be used to implement unitary maps directly into the projection-based model for quantum computing (de Beaudrap et al. 2006, 2008). A natural step to take from there is to investigate how to transform a projectionbased pattern specification to a measurement-based implementation. This is the basis of our next structural result that goes some way to explain another key property of MBQC, namely that although quantum measurements are inherently not deterministic, one can sometimes ensure the global determinism of the computation using suitable dependencies between measurements (Danos and Kashefi 2006; Browne et al. 2007). The result asserts that under a graph-theoretic condition on the entanglement underlying a given computation, namely the existence of a flow, it is possible to construct such dependencies. This is significant progress in the direct understanding of the specifics of measurement-based information processing. Building on this criterion and the well-known stabilizer formalism, we then present a characterization of both the quantum and classical MBQC information flow (Browne et al. 2007). An efficient algorithm for finding optimal flow is also presented (Mhalla and Perdrix 2008). Finally we conclude by demonstrating how tools obtained from the MBQC formalism can be used in the traditional quantum circuit model. Indeed, we present a procedure for translating a given circuit into an MBQC computation that is no longer based on a gate-by-gate translation (Broadbent and Kashefi 2009). With this in place, the measurement calculus leads to a rewriting system for quantum
P1: SBT CUUS834-07
cuus834-gay
240
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
circuits that decreases computation depth, this being an important issue in relation to decoherence time.
7.2 MBQC: Syntax We first develop a notation for 1-qubit measurement-based computations. The basic commands one can use in a pattern are: • • • •
1-qubit auxiliary preparation Ni 2-qubit entanglement operators E i j 1-qubit measurements Miα 1-qubit Pauli operators corrections X i and Z i
The indices i, j represent the qubits on which each of these operations apply, and α is a parameter in [0, 2π ]. Expressions involving angles are always evaluated modulo 2π . These types of command are referred to as N , E, M and C. Sequences of such commands, together with two distinguished – possibly overlapping – sets of qubits corresponding to inputs and outputs, will be called measurement patterns or simply patterns. These patterns can be combined by composition and tensor product. Importantly, corrections and measurements are allowed to depend on previous measurement outcomes. We prove later that patterns without these classical dependencies can only realize unitaries that are in the Clifford group. Thus, dependencies are crucial if one wants to define a universal computing model – that is to say, a model where all unitaries over ⊗n C2 can be realized. It is also crucial to develop a notation that will handle these dependencies. This is what we do now. Preparation Ni prepares qubit i in state |+i . The entanglement commands are defined as E i j := ∧Z i j (controlled-Z ), while the correction commands are the Pauli operators X i and Z i . Measurement Miα is defined by orthogonal projections on |+α := |−α :=
√1 (|0 2 √1 (|0 2
+ eiα |1) − eiα |1)
followed by a trace-out operator. The parameter α ∈ [0, 2π ] is called the angle of the measurement. For α = 0, α = π2 , one obtains the X and Y Pauli measurements. Operationally, measurements are understood as destructive measurements, consuming their qubit. The outcome of a measurement done at qubit i is denoted by si ∈ Z2 . Since one only deals here with patterns where qubits are measured at most once (see condition (D1) below), this is unambiguous. We take the specific convention that si = 0 if under the corresponding measurement the state collapses to |+α , and si = 1 if to |−α . Outcomes can be summed together resulting in expressions of the form s = i∈I si that we call signals and where the summation is understood as being done in Z2 . We define the domain of a signal as the set of qubits on which it depends.
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
S := 0, 1, si , S + S A := Ni Ei j t [Miα ]s X is , Z is
15:10
241
Signals Preparations Entanglements Measurements Corrections
Figure 7.1. 1-qubit based measurement language syntax
As we have said before, both corrections and measurements may depend on signals. Dependent corrections are written X is and Z is and dependent measurements are written t [Miα ]s , where s, t ∈ Z2 and α ∈ [0, 2π ]. The meaning of dependencies for corrections is straightforward: X i0 = Z i0 = I , no correction is applied, while X i1 = X i and Z i1 = Z i . In the case of dependent measurements, the measurement angle depends on s, t and α as follows: t
(−1)s α+tπ
[Miα ]s := Mi
(7.1)
so that, depending on the parities of s and t, one may have to modify the α to one of −α, α + π and −α + π. These modifications correspond to conjugations of measurements under X and Z : X i Miα X i = Mi−α Z i Miα Z i
=
Miα+π.
(7.2) (7.3)
Accordingly, we will refer to them as the X and Z -actions. Note that these two actions commute, since −α + π = −α − π up to 2π , and hence the order in which one applies them does not matter. As we see later, relations (7.2) and (7.3) are key to the propagation of dependent corrections and to obtaining patterns in the standard entanglement, measurement, and correction form. Since the measurements considered here are destructive, the foregoing equations actually simplify to Miα X i = Mi−α Miα Z i
=
Miα−π .
(7.4) (7.5)
Another point worth noticing is that the domain of the signals of a dependent command, be it a measurement or a correction, represents the set of measurements that one has to make before one can determine the actual value of the command. We have completed our catalog of basic commands, including dependent ones, and we turn now to the definition of measurement patterns. For convenient reference, the language syntax is summarized in Figure 7.1. We proceed now with the formal definition of a measurement pattern. Definition 7.2.1. Patterns consists of three finite sets V , I , O, together with two injective maps ι : I → V and o : O → V and a finite sequence of commands An . . . A1 , read from right to left, applying to qubits in V in that order, i.e. A1 first and An last, such that:
P1: SBT CUUS834-07
cuus834-gay
242
(D0) (D1) (D2) (D3)
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
no command depends on an outcome not yet measured; no command acts on a qubit already measured; no command acts on a qubit not yet prepared, unless it is an input qubit; a qubit i is measured if and only if i is not an output.
The set V is called the pattern computation space, and we write HV for the associated quantum state space ⊗i∈V C2 . To ease notation, we omit the maps ι and o and write simply I , O instead of ι(I ) and o(O). Note, however, that these maps are useful to define classical manipulations of the quantum states, such as permutations of the qubits. The sets I , O are called respectively the pattern inputs and outputs, and we write H I , and H O for the associated quantum state spaces. The sequence An . . . A1 is called the pattern command sequence, while the triple (V, I, O) is called the pattern type. To run a pattern, one prepares the input qubits in some input state ψ ∈ H I , while the noninput qubits are all set to the |+ state, then the commands are executed in sequence, and finally the result of the pattern computation is read back from outputs as some φ ∈ H O . Clearly, for this procedure to succeed, we had to impose the (D0), (D1), (D2) and (D3) conditions. Indeed if (D0) fails, then at some point of the computation, one will want to execute a command that depends on outcomes that are not yet known. Likewise, if (D1) fails, one will try to apply a command on a qubit that has been consumed by a measurement (recall that we use destructive measurements). Similarly, if (D2) fails, one will try to apply a command on a nonexistent qubit. Condition (D3) is there to make sure that the final state belongs to the output space H O , i.e., that all nonoutput qubits, and only nonoutput qubits, will have been consumed by a measurement when the computation ends. We write (D) for the conjunction of our definiteness conditions (D0), (D1), (D2) and (D3). Whether a given pattern satisfies (D) or not is statically verifiable on the pattern command sequence. We could have imposed a simple type system to enforce these constraints but, in the interests of notational simplicity, we chose not to do so. Here is a concrete example: H := ({1, 2}, {1}, {2}, X 2s1 M10 E 12 N2 ) with computation space {1, 2}, inputs {1}, and outputs {2}. To run H, one first prepares the first qubit in some input state ψ, and the second qubit in state |+; then these are entangled to obtain ∧Z 12 (ψ1 ⊗ |+2 ). Once this is done, the first qubit is measured in the |+, |− basis. Finally an X correction is applied on the output qubit, if the measurement outcome was s1 = 1. We do this calculation in detail later and prove that this pattern implements the Hadamard operator H . In general, a given pattern may use auxiliary qubits that are neither input nor output qubits. Usually one tries to use as few such qubits as possible, since these contribute to the space complexity of the computation. A last thing to note is that one does not require inputs and outputs to be disjoint subsets of V . This, seemingly innocuous, additional flexibility is actually quite
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
243
useful to give parsimonious implementations of unitaries (Danos et al. 2005). While the restriction to disjoint inputs and outputs is unnecessary, it has been discussed whether imposing it results in patterns that are easier to realise physically. Recent work (Hein et al. 2004; Browne and Rudolph 2005; Clark et al. 2005) however, seems to indicate that this is not the case. We are interested in how one can combine patterns in order to obtain bigger ones. The first way to combine patterns is by composing them. Two patterns P1 and P2 may be composed if V1 ∩ V2 = O1 = I2 . Provided that P1 has as many outputs as P2 has inputs, by renaming the pattern qubits, one can always make them composable. Definition 7.2.2. The composite pattern P2 P1 is defined as: • V := V1 ∪ V2 , I = I1 , O = O2 , • Commands are concatenated. The other way of combining patterns is to tensor them. Two patterns P1 and P2 may be tensored if V1 ∩ V2 = ∅. Again one can always meet this condition by renaming qubits in such a way that these sets are made disjoint. Definition 7.2.3. The tensor pattern P1 ⊗ P2 is defined as: • V = V1 ∪ V2 , I = I1 ∪ I2 , and O = O1 ∪ O2 , • Commands are concatenated. In contrast to the composition case, all the unions involved here are disjoint. Therefore commands from distinct patterns freely commute, since they apply to disjoint qubits, and when we say that commands have to be concatenated, this is only for definiteness. It is routine to verify that the definiteness conditions (D) are preserved under composition and tensor product. Before turning to this matter, we need a clean definition of what it means for a pattern to implement or to realize a unitary operator, together with a proof that the way one can combine patterns is reflected in their interpretations. This is key to our proof of universality.
7.3 MBQC: Semantics In this section we give a formal operational semantics for the pattern language as a probabilistic labeled transition system. We define deterministic patterns and thereafter concentrate on them. We show that deterministic patterns compose. We give a denotational semantics of deterministic patterns; from the construction it will be clear that these two semantics are equivalent. Besides quantum states, which are nonzero vectors in some Hilbert space HV , one needs a classical state recording the outcomes of the successive measurements one does in a pattern. If we let V stand for the finite set of qubits that are still active (i.e., not yet measured) and W stands for the set of qubits that have been measured
P1: SBT CUUS834-07
cuus834-gay
244
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
(i.e., they are now just classical bits recording the measurement outcomes), it is natural to define the computation state space as: S :=
V,W HV
× Z2W .
In other words the computation states form a V, W -indexed family of pairs q, , where q is a quantum state from HV and is a map from some W to the outcome space Z2 . We call this classical component an outcome map and denote by ∅ the empty outcome map in Z∅ 2 . We treat these states as pairs unless it becomes important to show how V and W are altered during a computation, as happens during a measurement.
7.3.1 Operational Semantics We need some preliminary notation. For any signal s and classical state ∈ Z2W , such that the domain of s is included in W , we take s to be the value of s given by the outcome map . That is to say, if s = I si , then s := I (i) where the sum is taken in Z2 . Also if ∈ Z2W , and x ∈ Z2 , we define [x/i](i) = x, [x/i]( j) = ( j) for j = i, W ∪{i}
which is a map in Z2 . We may now view each of our commands as acting on the state space S; we have suppressed V and W in the first four commands: Ni
q,
−→ q ⊗ |+i ,
q,
−→ ∧Z i j q,
q,
−→ X is q,
q,
−→ Z is q,
Ei j X is Z is
t
[Miα ]s
t
[Miα ]s
V ∪ {i}, W, q, −→ V, W ∪ {i}, +α |i q, [0/i] V ∪ {i}, W, q, −→ V, W ∪ {i}, −α |i q, [1/i] where α = (−1)s α + t π following Equation (7.1). Note how the measurement moves an index from V to W ; a qubit once measured cannot be measured again. Suppose q ∈ HV , for the foregoing relations to be defined, one needs the indices i, j on which the various command apply to be in V . One also needs to contain the domains of s and t, so that s and t are well defined. This will always be the case during the run of a pattern because of condition (D). All commands except measurements are deterministic and modify only the quantum part of the state. The measurement actions on S are not deterministic, so that these are actually binary relations on S and modify both the quantum and classical parts of the state. The usual convention has it that when one does a measurement the resulting state is renormalized and the probabilities are associated with the transition. We do not adhere to this convention here; instead we leave the states unnormalized. The reason for this choice of convention is that this way,
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus
245
the probability of reaching a given state can be read off its norm, and the overall treatment is simpler. As we show later, all the patterns implementing unitary operators have the same probability for all the branches and hence we do not need to carry these probabilities explicitly. We introduce an additional command called signal shifting: Sis
q, −→ q, [(i) + s /i] It consists in shifting the measurement outcome at i by the amount s . Note that the Z -action leaves measurements globally invariant, in the sense that |+α+π , |−α+π = |−α , |+α . Thus changing α to α + π amounts to swapping the outcomes of the measurements, and one has t
[Miα ]s = Sit 0 [Miα ]s
(7.6)
and signal shifting allows to dispose of the Z action of a measurement, resulting sometimes in convenient optimizations of standard forms.
7.3.2 Denotational Semantics Let P be a pattern with computation space V , inputs I , outputs O, and command sequence An . . . A1 . To execute a pattern, one starts with some input state q in H I , together with the empty outcome map ∅. The input state q is then tensored with as many |+s as there are noninputs in V (the N commands), so as to obtain a state in the full space HV . Then E, M and C commands in P are applied in sequence from right to left. We can summarize the situation as follows: / HO O
HI H I × Z∅ 2
pr ep
/ HV × Z∅ 2
A1 ... An
/ H O × ZV O 2
If m is the number of measurements, which is also the number of nonoutputs, then the run may follow 2m different branches. Each branch is associated with a unique binary string s of length m, representing the classical outcomes of the measurements along that branch, and a unique branch map As representing the linear transformation from H I to H O along that branch. This map is obtained from the operational semantics via the sequence (qi , i ) with 1 ≤ i ≤ n + 1, such that q1 , 1 = q ⊗ |+ . . . +, ∅ qn+1 = q = 0 Ai
and for all i ≤ n : qi , i −→ qi+1 , i+1 . Definition A pattern P realizes a map on density matrices ρ given by 7.3.1. † ρ → s As (ρ) As . We write [[P]] for the map realized by P.
P1: SBT CUUS834-07
cuus834-gay
246
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
Proposition 7.3.2. Each pattern realizes a completely positive trace preserving map. Proof. Later on we will show that every pattern can be put in a semantically equivalent form where all the preparations and entanglements appear first, followed by a sequence of measurements and finally local Pauli corrections. Hence branch maps decompose as As = Cs s U , where Cs is a unitary map over H O collecting all corrections on outputs, s is a projection from HV to H O representing the particular measurements performed along the branch, and U is a unitary embedding from H I to HV collecting the branch preparations, and entanglements. Note that U is the same on all branches. Therefore, † † † † s A s A s = s U s C s C s s U † = s U † s s U = U † ( s s )U = U †U = I where we have used the fact that Cs is unitary, s is a projection, and U is independent of the branches and is also unitary. Therefore the map T (ρ) := † s As (ρ) As is a trace-preserving completely positive map (cptp-map), explicitly given as a Kraus decomposition. 2 Hence the denotational semantics of a pattern is a cptp-map. In our denotational semantics we view the pattern as defining a map from the input qubits to the output qubits. We do not explicitly represent the result of measuring the final qubits; these may be of interest in some cases. Techniques for dealing with classical output explicitly are given by Selinger (2004) and Unruh (2005). With our definitions in place, we will show that the denotational semantics is compositional. Theorem 7.3.3. For two patterns P1 and P2 we have [[P1 P2 ]] = [[P2 ]][[P1 ]] and [[P1 ⊗ P2 ]] = [[P2 ]] ⊗ [[P1 ]]. Proof. Recall that two patterns P1 , P2 may be combined by composition provided P1 has as many outputs as P2 has inputs. Suppose this is the case, and suppose further that P1 and P2 respectively realize some cptp-maps T1 and T2 . We need to show that the composite pattern P2 P1 realizes T2 T1 . Indeed, the two diagrams representing branches in P1 and P2 : / HO1 O
HI1
HI1 × Z∅ 2
p1
/ HV1 × Z∅ 2
/ HO2 O
HI2
HI2 × Z∅ 2
/ HO × ZV1 O1 1 2
p2
/ HV2 × Z∅ 2
/ HO × ZV2 O2 2 2
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
247
can be pasted together, since O1 = I2 , and H O1 = H I2 . But then, it is enough to notice (1) that preparation steps p2 in P2 commute with all actions in P1 since they apply on disjoint sets of qubits, and (2) that no action taken in P2 depends on the measurements outcomes in P1 . It follows that the pasted diagram describes the same branches as does the one associated to the composite P2 P1 . A similar argument applies to the case of a tensor combination, and one has that P2 ⊗ P1 realizes T2 ⊗ T1 . 2 If one wanted to give a categorical treatment, one can define a category where the objects are finite sets representing the input and output qubits and the morphisms are the patterns. This is clearly a monoidal category with our tensor operation as the monoidal structure. One can show that the denotational semantics gives a monoidal functor into the category of superoperators or into any suitably enriched strongly compact closed category (Abramsky and Coecke 2004) or dagger category (Selinger 2005a). It would be very interesting to explore exactly what additional categorical structures are required to interpret the measurement calculus presented below. Duncan (2005) has sketched a polycategorical presentation of our measurement calculus.
7.3.3 Determinism We conclude this section by presenting various notions of determinism that will be used later when we return to the question of transforming a projection-based pattern to a measurement-based pattern. A pattern is said to be deterministic if it realizes a cptp-map that sends pure states to pure states. This is equivalent to saying that for a deterministic pattern branch maps are proportional, that is to say, for all q ∈ H I and all s1 , s2 ∈ Zn2 , As1 (q) and As2 (q) differ only up to a scalar. The class of deterministic patterns include projections; see the example presented later. A more restricted class contains all the unitary and unitary embedding operators: a pattern is said to be strongly deterministic when branch maps are equal (up to a global phase), i.e., for all s1 , s2 ∈ Zn2 , As1 = eiφs1 ,s2 As2 . These are the patterns implementing quantum algorithms and hence understanding their structural properties is of particular interest. Proposition 7.3.4. If a pattern is strongly deterministic, then it realizes a unitary embedding. † Proof. Define T to be the map realized by the pattern. We have T = s As As . Since the pattern is strongly deterministic, all the branch maps are the same. Define A to be 2n/2 As ; then A must be a unitary embedding, because A† A = I . 2 An important subclass of deterministic patterns are robust under the changes of the angles: a pattern is said to be uniformly deterministic if it is deterministic for all values of its measurement angles. In other words, a uniformly deterministic pattern defines a class of quantum operators that can be performed given the same
P1: SBT CUUS834-07
cuus834-gay
248
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
initial entanglement resources. On the other hand it is known that if we fix the angle of measurements to be Pauli, the obtained operators are in a Clifford group (Danos et al. 2007). That means uniform determinism allow us to associate to a family of quantum operators a canonical pattern implementing a Clifford operator, a potentially valuable abstract reduction for the study of quantum operators. Finally a pattern is said to be stepwise deterministic if it is deterministic after performing each single measurement together with all the corrections depending on the result of that measurement. In other words, a pattern is stepwise deterministic if after each single measurements there exists a set of local corrections depending only on the result of this measurements to be performed on some or all of the nonmeasured qubits that will make the two branches equal (up to a global phase). We assume that all the noninput qubits are prepared in the state |+, and hence for simplicity we omit the preparation commands N I c . First we give a quick example of a deterministic pattern that has branches with different probabilities. Its type is V = {1, 2}, I = O = {1}, and its command sequence is M2α . Therefore, starting with input q, one gets two branches: M2α
q ⊗ |+, ∅ −→
1 2 (1 + e−iα )q, ∅[0/2] 1 2
(1 − e−iα )q, ∅[1/2]
Thus this pattern is indeed deterministic and implements the identity up to a global phase; and yet the two branches have respective probabilities (1 + cos α)/2 and (1 − cos α)/2, which are not equal in general, and hence this pattern is not strongly deterministic. There is an interesting variation on this first example. The pattern of interest, call it T , has the same type as before with command sequence X 1s2 M20 E 12 . Again, T is deterministic, but not strongly deterministic: the branches have different probabilities, as in the preceding example. Now, however, these probabilities may depend on the input. The associated transformation is a cptp-map, T (ρ) := Aρ A† + Bρ B † with A :=
1 0
0 0 , B := 0 0
1 . 0
One has A† A + B † B = I , so T is indeed a completely positive and tracepreserving linear map and T (|ψψ|) = ψ, ψ|00| and clearly for no unitary U does one have T (ρ) := UρU † . For our final example, we return to the pattern H, already defined above. Consider the pattern with the same qubit space {1, 2} and the same inputs and outputs I = {1}, O = {2}, as H, but with a shorter command sequence, namely M10 E 12 . Starting with input q = (a|0 + b|1)|+, one has two computation branches,
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus
249
branching at M10 : E 12
(a|0 + b|1)|+, ∅ −→ M10
−→
√1 (a|00 2
+ a|01 + b|10 − b|11), ∅
1 2 ((a + b)|0 + (a − b)|1), ∅[0/1] 1 2
((a − b)|0 + (a + b)|1), ∅[1/1]
and since 2a + b22 + 2a − b22 = 2(2a22 + 2b22 ), both transitions happen with equal probabilities 12 . Both branches end up with nonproportional outputs, so the pattern is not deterministic. However, if one applies the local correction X 2 on either of the branches’ ends, both outputs will be made to coincide. If we choose to let the correction apply to the second branch, we obtain the pattern H, already defined. We have just proved H = UH , that is to say, H realizes the Hadamard operator.
7.4 MBQC: Universality In this section we first introduce a simple parameterized family J (α) that generates all unitaries over C2 . By adding the unitary operator controlled-Z (∧Z ) defined over C2 ⊗ C2 , one then obtains a set of generators for all unitary maps over ⊗n C2 . Both J (α) and ∧Z have simple realizations in the one-way model, using only two qubits. As a consequence, one obtains an implementation of the controlledU (∧U ) family of unitaries, using only 14 qubits. Combining these as building blocks, any general unitary can be obtained by using relatively few auxiliary qubits (Danos et al. 2005). Furthermore, our building blocks have an interesting property, namely that their underlying entanglement graphs have no odd-length cycles, and such states have been shown to be robust against decoherence (D¨ur et al. 2003). Consider the following one-parameter family J (α): 1 eiα 1 √ J (α) := 2 . 1 −eiα We can see already that the Pauli spin matrices, phase, and Hadamard operators can be described using only J (α): X = J (π )J (0) Z = J (0)J (π )
P(α) = J (0)J (α) H = J (0)
We also use the following equations: =I J (0)2 J (α)J (0)J (β) = J (α + β) J (α)J (π )J (β) = eiα Z J (β − α).
P1: SBT CUUS834-07
cuus834-gay
250
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
The second and third equations are referred to as the additivity and subtractivity relations. Additivity gives another useful pair of equations: X J (α) = J (α + π) = J (α)Z .
(7.7)
Any unitary operator U on C can be written 2
U = eiα J (0)J (β)J (γ )J (δ) for some α, β, γ and δ in R. We refer to this as a J -decomposition of U . To prove this, note that all three Pauli rotations are expressible in terms of J (α): α
Rx (α) = e−i 2 J (α)J (0) π π α R y (α) = e−i 2 J (0)J ( )J (α)J (− ) 2 2 −i α2 Rz (α) = e J (0)J (α)
(7.8) (7.9) (7.10)
From the Z –X decomposition, we know that every 1-qubit unitary operator U can be written as U = eiα Rz (β)Rx (γ )Rz (δ) and using equations (7.10) and (7.8) we get U = eiα e−i
β+γ +δ 2
J (0)J (β)J (γ )J (δ)
We conclude in particular that J (α) generates all 1-qubit unitary operators. Next, we turn to the decomposition of ∧U in terms of J (α) and ∧Z . Subscripts to operators indicate the qubit to which they apply, and we sometimes abbreviate Ji (α) as Jiα . Suppose U has J -decomposition eiα J (0)J (β)J (γ )J (δ); then; ∧U can also be decomposed as follows:
β+π
∧U12 = J10 J1α J20 J2
− γ2
J2
− π2
J2
π
γ
−π−δ−β 2
J20 ∧Z 12 J22 J22 J2
−β+δ−π 2
J20 ∧Z 12 J2
with α = α + β+γ2 +δ . To prove the foregoing decomposition, we first define auxiliary unitary operators: A = J (0)J (β + π )J (− γ2 )J (− π2 )
B = J (0)J ( π2 )J ( γ2 )J ( −π−δ−β ) 2
C = J (0)J ( −β+δ−π ). 2
Then, using the additivity relation we obtain ABC = I . On the other hand, using both the subtractivity relation and equations (7.7), we get AX B XC = J (0)J (β + π )J (− γ2 )J (− π2 )J (π )J ( π2 )J ( γ2 )J ( −π−δ−β ) 2 J (π )J ( −β+δ−π ) 2 = e−i
δ+β+γ 2
Therefore one also has ei
J (0)J (β)J (γ )J (δ).
2α+β+γ +δ 2
AX B XC = U .
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus
251
Combining our two equations in A, B, C, we obtain ∧U12 = P1 (α ) A2 ∧X 12 B2 ∧X 12 C2 with α = α + β+γ2 +δ ; a decomposition that we can rewrite using our generating set P(α)1 = J10 J1α ∧X 12 = H2 ∧Z 12 H2 = J20 ∧Z 12 J20 to obtain the foregoing decomposition of ∧U . As we will see, this decomposition leads to an implementation for the ∧U operator using only 14 qubits. Using Y or Z in place of X in the preceding argument; one finds costlier decompositions using 15 and 16 qubits. No comparable decomposition was given previously. Having all unitaries U over C2 and all unitaries of the form ∧U over C2 ⊗ C2 , we can conclude that: Theorem 7.4.1 (Universality). The set {J (α), ∧Z } generates all unitaries. The following unitaries H = J (0), P( π4 ) = J (0)J ( π4 ), and ∧X = J (0) ∧Z J (0), are known to be approximately universal, in the sense that any unitary can be approximated within any precision by combining these (Nielsen and Chuang 2000). Therefore the set J (0), J ( π4 ) and ∧Z is also approximately universal. It is easy to verify that the following patterns implement our generators J (α) := X 2s1 M1−α E 12 ∧Z := E 12 where in the first pattern 1 is the only input and 2 is the only output, while in the second both 1 and 2 are inputs and outputs (note that we are allowing patterns to have overlapping inputs and outputs). Combining these two patterns, by composition and tensoring, will therefore generate patterns realizing all unitaries over ⊗n C2 . These patterns are indeed among the simplest possible. Remarkably, there is only one single dependency overall, which occurs in the correction phase of J (α). No set of patterns without any measurement could be a generating set, since those can only implement unitaries in the Clifford group as we prove later. Let us now examine the implementation of ∧U , based on the decomposition that we recall: β+π
∧U12 = J10 J1α J20 J2
− γ2
J2
− π2
J2
π
γ
−π−δ−β 2
J20 ∧Z 12 J22 J22 J2
−β+δ−π 2
J20 ∧Z 12 J2
with α = α + β+γ2 +δ . Replacing each of the generators in the preceding expression by the corresponding pattern, we get the following long equation that should be read from bottom to top and from right to left:
−β−π
X Cs B M B0 E BC X sBA M A−α E AB X k j M 0j E jk X sji Mi s
π
s
− π2
s
X hg Mg2 E gh X g f M 0f E f g E A f X sfe Me β−δ+π 2
E cd X csb Mb0 E bc E Ab X bsa Ma
E ab
s
γ
E i j X i h Mh2 E hi
−γ
π+δ+β 2
E e f X esd Md 2 E de X dsc Mc
P1: SBT CUUS834-07
cuus834-gay
252
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix A
C
a
k
Figure 7.2. Graph state for the ∧U pattern: input qubits A and a are boxed, output qubits are C and k, measured qubits are solid circles
with input qubits { A, a} and output qubits {C, k}. We have reserved uppercase (lowercase) letters for qubits used in implementing the J operators on control qubit A (target qubit a), and have indeed used a total number of 14 qubits. Figure 7.2 shows the corresponding entanglement graph, where vertices represent qubits and edges connect the qubits of an entangled pair. This graph has only one cycle of length 6. This graph also has a further interesting property, namely that all possible paths linking boundary vertices (inputs and outputs) are of even length (2, 6, 10 as it happens) as we can see in Figure 7.3. Say that a path is extreme in a graph with inputs and outputs, if it goes from the boundary to itself; say that a graph with inputs and outputs is even if all its extreme paths are of even length; say that a pattern is even if its entanglement graph is even. We may then rephrase the last observation by saying that the pattern for ∧U is even. Patterns with an empty command sequence – among which one finds those implementing permutations over ⊗n C2 – are even. Indeed, all their paths, therefore all their extreme paths, are of length zero, and zero is even. Furthermore, even patterns are closed under tensor product and composition. Indeed, the graph associated to the tensor product of two patterns is the juxtaposition of the components graphs and therefore has a path space which is the disjoint sum of the path spaces of its components. On the other hand any extreme path in a composite pattern is a product of extreme paths of the components and therefore has even length. This has a nice consequence: Theorem 7.4.2. Any unitary can be realized by a pattern with a 2-colorable underlying graph. Any unitary can be realized by a pattern obtained from the J -decomposition pattern, the ∧U pattern, and the permutation patterns, combined by tensor and 6
A
2
2,6
a
C 6,10
k 10
Figure 7.3. Extreme paths in ∧U pattern: numbers represent the length of paths; solid circles represent the pattern input and output qubits
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
253
composition. Any cycle in such a pattern is either a cycle internal to some basic pattern (which rules out J -decomposition and permutation patterns which have a linear entanglement graph), so living inside a ∧U pattern, therefore of length 6 and hence even, or the cycle is a product of extreme paths, therefore even, because all basic patterns are even, and by the above discussion, so is any combination of them. This completes the proof of the theorem. As said, 2-colorable entanglement graphs are interesting because purification protocols exist for their associated graph states, making them physically implementable in a way that is robust against decoherence (D¨ur et al. 2003). So it is good news that such robust implementations can be obtained in the one-way model for all unitary operators. It is important to note that a similar result was known for particular graph states, so-called cluster states (Raussendorf et al. 2003). The underlying graph of the cluster states are rectangular grids and hence 2-colorable. However, to realize an arbitrary unitary operator one needs to consume many qubits and perform many Pauli measurements to respect the underlying structure, whereas in our proposed implementation all the unnecessary measurements have been removed and yet a 2-colorable graph is obtained.
7.5 Measurement Calculus We turn now to our structural result on the one-way model asserting that the key factorization property, namely that entanglement can be done first and then local measurements, can be reduced to confluence properties of a simple algebraic rewriting system (Danos et al. 2007). The expressions appearing as commands are all linear operators on Hilbert space. At first glance, the appropriate equality between commands is equality as operators. For the deterministic commands, the equality that we consider is indeed equality as operators. This equality implies equality in the denotational semantics. However, for measurement commands one needs a stricter definition for equality in order to be able to apply them as rewriting rules. Essentially we have to take into the account the effect of different branches that might result from the measurement process. The precise definition follows. Definition 7.5.1. Given two patterns P and P , we define P = P if and only if for any branch s we have APs = APs , where APs and APs are the branch map As defined in Section 7.3. The first set of equations gives the means to propagate local Pauli corrections through the entangling operator E i j . E i j X is = X is Z sj E i j E i j X sj E i j Z is E i j Z sj
= = =
X sj Z is E i j Z is E i j Z sj E i j
(7.11) (7.12) (7.13) (7.14)
P1: SBT CUUS834-07
cuus834-gay
254
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
These equations are easy to verify and are natural since E i j belongs to the Clifford group, and therefore maps under conjugation the Pauli group to itself. Note that, despite the symmetry of the E i j operator qua operator, we have to consider all the cases, since the rewrite system defined later does not allow one to rewrite E i j to E ji . If we did allow this the rewrite process could loop forever. A second set of equations allows one to push corrections through measurements acting on the same qubit. Again there are two cases: t
[Miα ]s X ir = t [Miα ]s+r
(7.15)
t
[Miα ]s Z ir = t+r [Miα ]s
(7.16)
These equations follow easily from equations (7.4) and (7.5). They express the fact that the measurements Miα are closed under conjugation by the Pauli group, very much as Equations (7.11), (7.12), (7.13), and (7.14) express the fact that the Pauli group is closed under conjugation by the entanglements E i j . Define the following convenient abbreviations: [Miα ]s := 0 [Miα ]s
t
[Miα ] := t [Miα ]0
Mix := Mi0
Miα := 0 [Miα ]0 π
y
Mi := Mi 2 .
Particular cases of the equations above are Mix X is = Mix y y y y Mi X is = [Mi ]s = s [Mi ] = Mi Z is . The first equation follows from the fact that −0 = 0, so the X action on Mix is trivial; the second equation is because − π2 is equal π2 + π modulo 2π , and y therefore the X and Z actions coincide on Mi . So we obtain the following: t
[Mix ]s = t [Mix ]
t
[Mi ]s = s+t [Mi ]
y
(7.17) y
(7.18)
which we will use later to prove that patterns with measurements of the form M x and M y may only realize unitaries in the Clifford group. We now define a set of rewrite rules, obtained by orienting the equations above. Recall that patterns are executed from right to left: E i j X is E i j X sj E i j Z is E i j Z sj t [Miα ]s X ir t [Miα ]s Z ir
⇒ X is Z sj E i j ⇒ X sj Z is E i j ⇒ Z is E i j ⇒ Z sj E i j ⇒ t [Miα ]s+r ⇒ r +t [Miα ]s
EX EX EZ EZ MX MZ
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus
255
to which we need to add the free commutation rules, obtained when commands operate on disjoint sets of qubits: E i j Ak' ⇒ Ak' E i j Ak' X is ⇒ X is Ak' Ak' Z is ⇒ Z is Ak'
where A is not an entanglement where A is not a correction where A is not a correction
where k' represent the qubits acted upon by command A and are supposed to be distinct from i and j. Clearly these rules could be reversed since they hold as equations, but we are orienting them this way in order to obtain termination. Condition (D) is easily seen to be preserved under rewriting. Under rewriting, the computation space, inputs, and outputs remain the same, and so do the entanglement commands. Measurements might be modified, but there is still the same number of them, and they still act on the same qubits. The only induced modifications concern local corrections and dependencies. If there was no dependency at the start, none will be created in the rewriting process. In order to obtain rewrite rules, it was essential that the entangling command (∧Z ) belong to the normalizer of the Pauli group. The point is that the Pauli operators are the correction operators and they can be dependent; thus we can commute the entangling commands to the beginning without inheriting any dependency. Therefore the entanglement resource can indeed be prepared at the outset of the computation. Write P ⇒ P , respectively P ⇒ P , if both patterns have the same type, and one obtains the command sequence of P from the command sequence of P by applying one, respectively any number, of the rewrite rules of the previous section. We say that P is standard if for no P , P ⇒ P and the procedure of writing a pattern to standard form is called standardization. We use the word “standardization” instead of the more usual “normalization” in order not to cause terminological confusion with the physicists’ notion of normalization. One of the most important results about the rewrite system is that it has the desirable properties of determinacy (confluence) and termination (standardization). In other words, we will show that for all P, there exists a unique standard P , such that P ⇒ P . It is, of course, crucial that the standardization process leaves the semantics of patterns invariant. This is the subject of the next simple, but important, proposition. Proposition 7.5.2. Whenever P ⇒ P , [[P]] = [[P ]]. Proof. It is enough to prove it when P ⇒ P . The first group of rewrites has been proved to be sound in the preceding subsections, while the free commutation rules are obviously sound. 2 We now begin the main proof of this section. First, we prove termination. Theorem 7.5.3 (Termination). All rewriting sequences beginning with a pattern P terminate after finitely many steps. For our rewrite system, this implies that for all P there exist finitely many P such that P ⇒ P where the P are standard.
P1: SBT CUUS834-07
cuus834-gay
256
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
Proof. Suppose P has command sequence An . . . A1 , so the number of commands is n. Let e ≤ n be the number of E commands in P. As we have noted earlier, this number is invariant under ⇒. Moreover E commands in P can be ordered by increasing depth, read from right to left, and this order, written < E , is also invariant, since E E commutations are forbidden explicitly in the free commutation rules. Define the following depth function d on E and C commands in P: i if Ai = E jk d( Ai ) = n − i if Ai = C j . Define further the following sequence of length e, d E (P)(i) is the depth of the E-command of rank i according to < E . By construction this sequence is strictly increasing. Finally, we define the measure m(P) := (d E (P), dC (P)) with: dC (P) = C∈P d(C). We claim the measure we just defined decreases lexicographically under rewriting, in other words P ⇒ P implies m(P) > m(P ), where < is the lexicographic ordering on Ne+1 . To clarify these definitions, consider the following example. Suppose P’s command sequence is of the form E X Z E; then e = 2, d E (P) = (1, 4), and m(P) = (1, 4, 3). For the command sequence E E X we get that e = 2, d E (P) = (2, 3) and m(P) = (2, 3, 2). Now, if one considers the rewrite E E X ⇒ E X Z E, the measure of the left-hand side is (2, 3, 2), while the measure of the right-hand side, as said, is (1, 4, 3), and indeed (2, 3, 2) > (1, 4, 3). Intuitively the reason is clear: the Cs are being pushed to the left, thus decreasing the depths of Es and concomitantly, the value of d E . Let us now consider all cases starting with an EC rewrite. Suppose the E command under rewrite has depth d and rank i in the order < E . Then all Es of smaller rank have same depth in the right-hand side, while E has now depth d − 1 and still rank i. So the right-hand side has a strictly smaller measure. Note that when C = X , because of the creation of a Z (see the preceding example), the last element of m(P) may increase, and for the same reason all elements of index j > i in d E (P) may increase. This is why we are working with a lexicographical ordering. Suppose now one does an MC rewrite, then dC (P) strictly decreases, since one correction is absorbed, while all E commands have equal or smaller depths. Again the measure strictly decreases. Next, suppose one does an E A rewrite, and the E command under rewrite has depth d and rank i. Then it has depth d − 1 in the right-hand side, and all other E commands have invariant depths, since we forbade the case when A is itself an E. It follows that the measure strictly decreases. Finally, upon an AC rewrite, all E commands have invariant depth, except possibly one which has smaller depth in the case A = E, and dC (P) decreases strictly because we forbade the case where A = C. Again the claim follows.
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
257
So all rewrites decrease our ordinal measure, and therefore all sequences of rewrites are finite, and since the system is finitely branching (there are no more than n possible single step rewrites on a given sequence of length n), we get the statement of the theorem. 2 The next theorem establishes the important determinacy property and furthermore shows that the standard patterns have a certain canonical form that we call the NEMC form. The precise definition is: Definition 7.5.4. A pattern has a NEMC form if its commands occur in the order of N s first, then Es , then Ms, and finally Cs. We will usually just say “EMC” form since we can assume that all the auxiliary qubits are prepared in the |+ state and we usually just elide these N commands. Theorem 7.5.5 (Confluence). For all P, there exists a unique standard P , such that P ⇒ P , and P is in EMC form. Proof. Since the rewriting system is terminating, confluence follows from local confluence by Newman’s lemma; see, for example, Barendregt (1984). This means that whenever two rewrite rules can be applied to a term t yielding t1 and t2 , one can rewrite both t1 and t2 to a common third term t3 , possibly in many steps. Then the uniqueness of the standard form is an immediate consequence. In order to prove the local confluence we look for critical pairs, that is, occurrences of three successive commands where two rules can be applied simultaneously. One finds that there are only five types of critical pairs. Of these, three involve the N command and are of the form N MC, N EC and N E M; the remaining two are E i j Mk Ck with i, j, and k all distinct, and E i j Mk Cl with k and l distinct. In all cases local confluence is easily verified. Suppose now P does not satisfy the EMC form conditions. Then either there is a pattern E A with A not of type E, or there is a pattern AC with A not of type C. In the former case, E and A must operate on overlapping qubits, else one may apply a free commutation rule, and A may not be a C since in this case one may apply an EC rewrite. The only remaining case is when A is of type M, overlapping E’s qubits, but this is what condition (D1) forbids, and since (D1) is preserved under rewriting, this contradicts the assumption. The latter case is even simpler. 2 We have shown that under rewriting any pattern can be put in EMC form, which is what we wanted. We actually proved more, namely that the standard form obtained is unique. However, one has to be a bit careful about the significance of this additional piece of information. Note first that uniqueness is obtained because we dropped the CC and E E free commutations, thus having a rigid notion of command sequence. One cannot put them back as rewrite rules, since they obviously ruin termination and uniqueness of standard forms.
P1: SBT CUUS834-07
cuus834-gay
258
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
A reasonable thing to do would be to take this set of equations as generating an equivalence relation on command sequences, call it ≡, and hope to strengthen the results obtained so far by proving that all reachable standard forms are equivalent. But this is too naive a strategy, since E 12 X 1 X 2 ≡ E 12 X 2 X 1 , and E 12 X 1s X 2t ⇒ X 1s Z 2s X 2t Z 1t E 12 ≡ X 1s Z 1t Z 2s X 2t E 12 obtaining an expression that is not symmetric in 1 and 2. To conclude, one has to extend ≡ to include the additional equivalence X 1s Z 1t ≡ Z 1t X 1s , which fortunately is sound since these two operators are equal up to a global phase. Thus, these are all equivalent in our semantics of patterns. We summarize this discussion as follows. Definition 7.5.6. We define an equivalence relation ≡ on patterns by taking all the rewrite rules as equations and adding the equation X 1s Z 1t ≡ Z 1t X 1s and generating the smallest equivalence relation. With this definition we can state the following proposition. Proposition 7.5.7. All patterns that are equivalent by ≡ are equal in the denotational semantics. This ≡ relation preserves both the type (the (V, I, O) triple) and the underlying entanglement graph. So clearly semantic equality does not entail equality up to ≡. In fact, by composing teleportation patterns one obtains infinitely many patterns for the identity that are all different up to ≡. One may wonder whether two patterns with same semantics, type, and underlying entanglement graph are necessarily equal up to ≡. This is not true either. One has J (α)J (0)J (β) = J (α + β) = J (β)J (0)J (α) (where J (α) is defined in Section 7.4), and this readily gives a counter-example. We can now formally describe a simple standardization algorithm. Algorithm 7.5.8. Input: A pattern P on |V | = N qubits with command sequence A M · · · A1 . Output: An equivalent pattern P in NEMC form. (i) Commute all the preparation commands (new qubits) to the right side. (ii) Commute all the correction commands to the left side using the EC and MC rewriting rules. (iii) Commute all the entanglement commands to the right side after the preparation commands. Note that since each qubit can be entangled with at most N − 1 other qubits and can be measured or corrected only once, we have O(N 2 ) entanglement commands and O(N ) measurement commands. According to the definiteness condition, no command acts on a qubit not yet prepared; hence the first step of the foregoing algorithm is based on trivial commuting rules; the same is true for the last step,
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
259
as no entanglement command can act on a qubit that has been measured. Both steps can be done in O(N 2 ) time. The real complexity of the algorithm comes from the second step and the E X commuting rule. In the worst-case scenario, commuting an X correction to the left might create O(N 2 ) other Z corrections, each of which mustiBelf be commuted to the left. Thus one can have at most O(N 3 ) new corrections, each of which has to be commuted past O(N 2 ) measurement or entanglement commands. Therefore the second step, and hence the algorithm, has a worst-case complexity of O(N 5 ) time. We conclude this subsection by emphasizing the importance of the EMC form. Since the entanglement can always be done first, we can always derive the entanglement resource needed for the whole computation right at the beginning. After that only local operations will be performed. This will separate the analysis of entanglement resource requirements from the classical control. Furthermore, this makes it possible to extract the maximal parallelism for the execution of the pattern since the necessary dependecies are explicitly expressed; see the example in Section 7.6 for further discussion. Finally, the EMC form provides us with tools to prove general theorems about patterns, such as the fact that they always compute cptp-maps and the expressiveness theorems of Section 7.5.2.
7.5.1 Signal Shifting One can extend the calculus to include the signal shifting command Sit to dispose of dependencies induced by the Z -action (Danos et al. 2007) and obtain sometimes standard patterns with smaller computational depth complexity (Broadbent and Kashefi 2009): [Miα ]s X sj Sit Z sj Sit t [M αj ]s Sir Sis S tj
t
⇒ ⇒ ⇒ ⇒ ⇒
Sit [Miα ]s s[t+s /s ] Sit X j i i t s[t+si /si ] Si Z j Sir t[r +si /si ] [M αj ]s[r +si /si ] s[t+s j /s j ] S tj Si
where s[t/si ] denotes the substitution of si with t in s, s, t being signals. Note that when we write a t explicitly on the upper left of an M, we mean that t = 0. The first additional rewrite rule was already introduced as Equation (7.6), while the other ones merely propagate the signal shift. Clearly one can dispose of Sit when it hits the end of the pattern command sequence. We refer to this new set of rules as ⇒ S . Note that we always apply first the standardization rules and then signal shifting; hence we do not need any commutation rule for E and S commands. It is important to note that both Theorems 7.5.3 and 7.5.5 still hold for this extended rewriting system. In order to prove termination one can start with the EMC form and then adapt the proof of Theorem 7.5.3 by defining a depth function for a signal shift similar to the depth of a correction command. As with the correction, signal shifts can also be commuted to the left-hand side of a command
P1: SBT CUUS834-07
cuus834-gay
260
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
sequence. Now our measure can be modified to account for the new signal shifting terms and shown to be decreasing under each step of signal shifting. Confluence can be also proved from local confluence using again Newman’s lemma (Barendregt 1984). One typical critical pair is t [M αj ] Sis , where i appears in the domain of signal t and hence the signal shifting command Sis will have an effect on the measurement. Now there are two possible ways to rewrite this pair. First, commute the signal shifting command and then replace the left signal of the measurement with its own signal shifting command: t
[M αj ] Sis ⇒ Sis t+s [M αj ] M αj . ⇒ Sis S s+t j
The other way is to first replace the left signal of the measurement and then commute the signal shifting command: t
[M αj ] Sis ⇒ S tj M αj Sis ⇒ S tj Sis M αj .
Now one more step of rewriting on the last equation will give us the same result for both choices: S tj Sis M αj ⇒ Sis S s+t M αj . j All other critical terms can be dealt with similarly.
7.5.2 The No-Dependency Theorems From standardization we can also infer results related to dependencies (Danos et al. 2007). We start with a simple observation which is a direct consequence of standardization. In what follows the computational depth complexity is defined to be the number of measurement rounds plus one final correction round. More details on depth complexity can be found in Broadbent and Kashefi (2009). Lemma 7.5.9. Let P be a pattern implementing some cptp-maps T , and suppose P’s command sequence has measurements only of the M x and M y kind; then U has a standard implementation, having only independent measurements, all being of the M x and M y kind (therefore of computational depth complexity at most 2). Proof. Write P for the standard pattern associated to P. By Equations (7.17) and (7.18), the X -actions can be eliminated from P , and then Z -actions can be eliminated by using the extended calculus. The final pattern still implements T , no longer has any dependent measurements, and therefore has computational depth complexity at most 2. 2 Theorem 7.5.10. Let U be a unitary operator; then U is in the Clifford group iff there exists a pattern P implementing U , having measurements only of the M x and M y kind.
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
261
Proof. The “only if ” direction is easy, since we have seen in the example section standard patterns for ∧X , H , and P( π2 ) that had only independent M x and M y measurements. Hence any Clifford operator can be implemented by a combination of these patterns. By the preceding lemma, we know we can actually choose these patterns to be standard. For the “if ” direction, we prove that U belongs to the normalizer of the Pauli group, and hence by definition to the Clifford group. In order to do so we use the standard form of P written as P = CP MP E P which still implements U and has only M x and M y measurements. Recall that, because of Equations (7.17) and (7.18), these measurements are independent. Let i be an input qubit and consider the pattern P = P Ci , where Ci is either X i or Z i . Clearly P implements U Ci . First, one has: CP MP E P Ci ⇒EC CP MP C E P for some nondependent sequence of corrections C , which, up to free commutations can be written uniquely as C O C , where C O applies on output qubits and therefore commutes to MP , and C applies on non-output qubits (which are therefore all measured in MP ). So, by commuting C O both through MP and CP (up to a global phase), one gets: CP MP C E P ⇒ C O CP MP C E P Using Equations (7.17) and (7.18), and the extended calculus to eliminate the remaining Z -actions, one gets: MP C ⇒MC,S S MP for some product S = { j∈J } S 1j of constant shifts, applying to some subset J of the nonoutput qubits. Note that we have used the trivial equations Z ia+1 = Z i Z ia and X ia+1 = X i X ia . Therefore we have C O CP MP C E P ⇒MC,S ⇒
C O CP S MP E P C O C O CP MP E P
where C O is a further constant correction obtained by signal shifting CP with S. This proves that P also implements C O C O U , and therefore U Ci = C O C O U , which completes the proof, since C O C O is a nondependent correction. 2 The “only if ” part of this theorem already appears in previous work (Raussendorf et al. 2003, p. 18). The “if ” part can be construed as an internalization of the argument implicit in the proof of the Gottesman-Knill theorem (Nielsen and Chuang 2000, p. 464). We can further prove that dependencies are crucial for the universality of the model. Observe first that if a pattern has no measurements and hence no dependencies, then it follows from (D2) that V = O, i.e., all qubits are outputs.
P1: SBT CUUS834-07
cuus834-gay
262
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
Therefore computation steps involve only X , Z , and ∧Z , and it is not surprising that they compute a unitary that is in the Clifford group. The general argument essentially consists in showing that when there are measurements, but still no dependencies, then the measurements play no part in the result. Theorem 7.5.11. Let P be a pattern implementing some unitary U , and suppose P’s command sequence has no dependencies. Then U is in the Clifford group. Proof. Write P for the standard pattern associated to P. Since rewriting is sound, P still implements U , and since rewriting never creates any dependency, it still has no dependencies. In particular, the corrections one finds at the end of P , call them C, bear no dependencies. Erasing them from P results in a pattern P that is still standard, still deterministic, and implementing U := C † U . Now how does the pattern P run on some input φ ? First φ ⊗ |+ · · · + goes by the entanglement phase to some ψ ∈ HV and is then subjected to a sequence of independent 1-qubit measurements. Pick a basis B spanning the Hilbert space generated by the nonoutput qubits HV O and associated to this sequence of measurements. Since HV = H O ⊗ HV O and HV O = ⊕φb ∈B [φb ], where [φb ] is the linear subspace generated by φb , by distributivity, ψ uniquely decomposes as: ψ = φb ∈B xb ⊗ φb where φb ranges over B, and xb ∈ H O . Now since P is deterministic, there exists an x and scalars λb such that xb = λb x. Therefore ψ can be written x ⊗ ψ , for some ψ . It follows in particular that the output of the computation will still be x (up to a scalar), no matter what the actual measurements are. One can therefore choose them to be all of the M x kind, and by the preceding theorem U is in the Clifford group, and so is U = CU , since C is a Pauli operator. 2 From this section, we conclude in particular that any universal set of patterns has to include dependencies (by the preceding theorem) and also needs to use measurements M α where α = 0 modulo π2 (by the theorem before). This is indeed the case for the universal set J (α) and ∧Z.
7.6 MBQC: Examples In this section we develop some examples illustrating pattern composition, pattern standardization, and signal shifting. More examples can be found in the reference paper (Raussendorf et al. 2003). To combine patterns one needs to rename their qubits as we already noted. We use the following concrete notation: if P is a pattern over {1, . . . , n}, and f is an injection, we write P( f (1), . . . , f (n)) for the same pattern with qubits renamed according to f . We also write P2 ◦ P1 for pattern composition, in order to make it more readable.
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus
263
7.6.1 Teleportation Consider the composite pattern J (β)(2, 3) ◦ J (α)(1, 2) with computation space {1, 2, 3}, inputs {1}, and outputs {3}. We run our standardization procedure so as to obtain an equivalent standard pattern. In what follows boxes are used to indicate where rewriting occurs: J (β)(2, 3) ◦ J (α)(1, 2) =
−β
X 3s2 M2
E 23 X 2s1 M1−α E 12
−β
⇒ E X X 3s2 M2 X 2s1 Z 3s1 M1−α E 23 E 12 −β
⇒ M X X 3s2 Z 3s1 [M2 ]s1 M1−α E 23 E 12 . Let us call the pattern just obtained J (α, β). If we take as a special case α = β = 0, we get: X 3s2 Z 3s1 M2x M1x E 23 E 12 and since we know that J (0) implements H and H 2 = I , we conclude that this pattern implements the identity, or in other words it teleports qubit 1 to qubit 3. As it happens, this pattern obtained by self-composition, is the same as the one given in the reference paper (Raussendorf et al. 2003, p. 14).
7.6.2 x-rotation Here is the reference implementation of an x-rotation (Raussendorf et al. 2003, p. 17), Rx (α): X 3s2 Z 3s1 [M2−α ]s1 M1x E 23 E 12 with type {1, 2, 3}, {1}, and {3}. There is a natural question that one might call the recognition problem, namely how does one know this is implementing Rx (α)? Of course there is the brute-force answer to that, which we applied to compute our simpler patterns and which consists in computing down all the four possible branches generated by the measurements at qubits 1 and 2. Another possibility is to use the stabilizer formalism as explained in the reference paper (Raussendorf et al. 2003). Yet another possibility is to use pattern composition, as we did before, and this is what we are going to do. We know that Rx (α) = J (α)H up to a global phase; hence the composite pattern J (α)(2, 3) ◦ H(1, 2) implements Rx (α). Now we may standardize it: J (α)(2, 3) ◦ H(1, 2) =
X 3s2 M2−α E 23 X 2s1 M1x E 12
⇒ E X X 3s2 Z 3s1 M2−α X 2s1 M1x E 23 E 12 ⇒ M X X 3s2 Z 3s1 [M2−α ]s1 M1x E 23 E 12
obtaining exactly the previous implementation. Since our calculus preserves the semantics, we deduce that the implementation is correct.
P1: SBT CUUS834-07
cuus834-gay
264
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
7.6.3 z-rotation Now, we have a method here for synthesizing further implementations. Let us replay it with another rotation Rz (α). Again we know that Rz (α) = H Rx (α)H , and we already know how to implement both components H and Rx (α). So we start with the pattern H(4, 5) ◦ Rx (α)(2, 3, 4) ◦ H(1, 2) and standardize it: H(4, 5) ◦ Rx (α)(2, 3, 4) ◦ H(1, 2) =
H(4, 5)X 4s3 Z 4s2 [M3α ]1+s2 M2x E 34 E 23 X 2s1 M1x E 12
⇒E X
H(4, 5)X 4s3 Z 4s2 [M3α ]1+s2 M2x X 2s1 E 34 Z 3s1 M1x E 123
⇒E Z
H(4, 5)X 4s3 Z 4s2 [M3α ]1+s2 Z 3s1 M2x X 2s1 M1x E 1234
⇒M X
H(4, 5)X 4s3 Z 4s2 [M3α ]1+s2 Z 3s1 M2x M1x E 1234
⇒M Z
X 5s4 M4x E 45 X 4s3 Z 4s2 s1 [M3α ]1+s2 M2x M1x E 1234
⇒E X
X 5s4 Z 5s3 M4x X 4s3 Z 4s2 s1 [M3α ]1+s2 M2x M1x E 12345
⇒M X
X 5s4 Z 5s3 [M4x ]s3 Z 4s2
⇒M Z
s1 [M3α ]1+s2 M2x M1x E 12345 s4 s3 s2 x s3 s1 α 1+s2 X 5 Z 5 [M4 ] [M3 ] M2x M1x E 12345 .
To aid reading E 23 E 12 is shortened to E 123 , E 12 E 23 E 34 to E 1234 , and t [Miα ]1+s is used as shorthand for t [Mi−α ]s . Here for the first time, we see M Z rewritings, inducing the Z -action on measurements. The resulting standardized pattern can therefore be rewritten further using the extended calculus: ⇒S
X 5s4 Z 5s3 s2 [M4x ]s3 s1 [M3α ]1+s2 M2x M1x E 12345 X 5s2 +s4 Z 5s1 +s3 M4x [M3α ]1+s2 M2x M1x E 12345
obtaining the pattern given in the reference paper (Raussendorf et al. 2003, p. 5). However, just as in the case of the Rx rotation, we also have Rz (α) = H J (α) up to a global phase; hence the pattern H(2, 3)J (α)(1, 2) also implements Rz (α), and we may standardize it: X 3s2 M2x E 23 X 2s1 M1−α E 12
H(2, 3) ◦ J (α)(1, 2) =
X 3s2 Z 3s1 M2x X 2s1 M1−α E 123
⇒E X
X 3s2 Z 3s1 M2x M1−α E 123
⇒M X
obtaining a 3-qubit standard pattern for the z-rotation, which is simpler than the preceding one, because it is based on the J (α) generators. Since the z-rotation Rz (α) is the same as the phase operator P(α) =
1 0
0 eiα
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus
265
up to a global phase, we also obtain with the same pattern an implementation of the phase operator. In particular, if α = π2 , using the extended calculus, we get the y following pattern for P( π2 ): X 3s2 Z 3s1 +1 M2x M1 E 123 .
7.6.4 General Rotation The realization of a general rotation based on the Euler decomposition of rotations as Rx (γ )Rz (β)Rx (α) would results in a 7-qubit pattern. We get a 5-qubit implementation based on the J (α) decomposition (Danos et al. 2005): R(α, β, γ ) = J (0)J (−α)J (−β)J (−γ ). (The parameter angles are inverted to make the following computation more readable.) The extended standardization procedure yields: J (0)(4, 5)J (−α)(3, 4)J (−β)(2, 3)J (−γ )(1, 2) γ
β
=
X 5s4 M40 E 45 X 4s3 M3α E 34 X 3s2 M2 E 23 X 2s1 M1 E 12
⇒E X
X 5s4 M40 E 45 X 4s3 M3α E 34 X 3s2 M2 X 2s1 Z 3s1 M1 E 123
⇒M X
X 5s4 M40 E 45 X 4s3 M3α E 34 X 3s2 Z 3s1 [M2 ]s1 M1 E 123
⇒E X Z
X 5s4 M40 E 45 X 4s3 M3α X 3s2 Z 3s1 Z 4s2 [M2 ]s1 M1 E 1234
⇒M X Z
X 5s4 M40 E 45 X 4s3 Z 4s2
⇒E X Z
X 5s4 M40 X 4s3 Z 4s2 Z 5s3 s1 [M3α ]s2 [M2 ]s1 M1 E 12345
⇒M X Z ⇒S
X 5s4 Z 5s3 s2 [M40 ] s1 [M3α ]s2 [M2 ]s1 M1 E 12345 γ β X 5s2 +s4 Z 5s1 +s3 M40 [M3α ]s2 [M2 ]s1 M1 E 12345 .
γ
β
s1
β
γ
β
γ
β
γ
β
γ
[M3α ]s2 [M2 ]s1 M1 E 1234 β
γ
7.6.5 CNOT (∧X ) This is our first example with two inputs and two outputs. We use here the trivial pattern I with computation space {1}, inputs {1}, outputs {1}, and empty command sequence, which implements the identity over H1 . One has ∧X = (I ⊗ H ) ∧Z (I ⊗ H ), so we get a pattern using 4 qubits over {1, 2, 3, 4}, with inputs {1, 2}, and outputs {1, 4}, where one notices that inputs and outputs intersect on the control qubit {1}: (I(1) ⊗ (3, 4)) ∧Z(1, 3)(I(1) ⊗ (2, 3)) =
X 4s3 M3x E 34 E 13 X 3s2 M2x E 23
⇒E X
X 4s3 Z 1s2 M3x E 34 X 3s2 M2x E 13 E 23
⇒E X
X 4s3 Z 4s2 Z 1s2 M3x X 3s2 M2x E 13 E 23 E 34
⇒M X
X 4s3 Z 4s2 Z 1s2 M3x M2x E 13 E 23 E 34
Note that, in this case, we are not using the E 1234 abbreviation, because the underlying structure of entanglement is not a chain. This pattern was already described
P1: SBT CUUS834-07
cuus834-gay
266
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
in Aliferis and Leung’s paper (2004). In their original presentation the authors actually use an explicit identity pattern (using the teleportation pattern J (0, 0) presented earlier), but we know from the careful presentation of composition that this is not necessary.
7.6.6 GHZ We now present a family of patterns preparing the GHZ entangled states |0 . . . 0 + |1 . . . 1. One has: GHZ(n) = (Hn ∧Z n−1n . . . H2 ∧Z 12 )|+· · ·+ and by combining the patterns for ∧Z and H , we obtain a pattern with computation space {1, 2, 2 , . . . , n, n }, no inputs, outputs {1, 2 , . . . , n }, and the following command sequence: X nsn Mnx E nn E (n−1) n . . . X 2s2 M2x E 22 E 12 . With this form, the only way to run the pattern is to execute all commands in sequence. The situation changes completely, when we bring the pattern to extended standard form: X nsn Mnx E nn E (n−1) n . . . X 3s3 M3x E 33 E 2 3 X 2s2 M2x E 22 E 12 ⇒ X nsn X 2s2 Mnx E nn E (n−1) n . . . X 3s3 M3x Z 3s2 M2x E 33 E 2 3 E 22 E 12 ⇒ X nsn X 2s2 Mnx E nn E (n−1) n . . . X 3s3 s2 [M3x ] M2x E 33 E 2 3 E 22 E 12 ⇒ X nsn . . . X 3s3 X 2s2 sn−1 [Mnx ] . . . s2 [M3x ] M2x E nn E (n−1) n . . . E 33 E 2 3 E 22 E 12 ⇒ S X ns2 +s3 +···+sn . . . X 3s2 +s3 X 2s2 Mnx . . . M3x M2x E nn E (n−1) n . . . E 33 E 2 3 E 22 E 12 . All measurements are now independent of each other; it is therefore possible, after the entanglement phase, to do all of them in one round, and in a subsequent round to do all local corrections. In other words, the obtained pattern has constant computational depth complexity 2.
7.7 Other MBQC Models There are several other approaches to measurement-based computation, as we mentioned in the introduction. However, it is only for the one-way model that the importance of having all the entanglement in front has been emphasized. For example, Gottesman and Chuang describe computing with teleportation in the setting of the circuit model, and hence the computation is very sequential (Gottesman and Chuang 1999). What we do is to give a general treatment of a variety of measurement-based models in the setting of our calculus. More precisely, we would like to know other potential definitions for commands N , E, M, and
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus
267
C that lead to a model that still satisfies the properties of (i) being closed under composition; (ii) universality; and (iii) standardization. Moreover we are interested in obtaining a compositional embedding of these models into a single 1-qubit measurement-based model. The teleportation and state transfer models can indeed be embedded into the one-way model. There is, however, a new model, the Pauli model, which is motivated by considerations of fault tolerance (Raussendorf et al. 2004; Danos and Kashefi 2005; Danos et al. 2006). The Pauli model can be embedded into a slight generalization of the oneway model called the phase model (Danos et al. 2007). The one-way model will trivially embed in the phase model, so by composition all the measurement-based models will embed in the phase model. We could have done everything ab initio in terms of the phase model, but this would have made much of the presentation unnecessarily complicated at the outset. We recall the remark from the introduction that these embeddings have three advantages: first, we get a workable syntax for handling the dependencies of operators on previous measurement outcomes; second, one can use these embeddings to transfer the measurement calculus previously developed for the one-way model to obtain a calculus for the new model including, of course, a standardization procedure that we get automatically; last, one can embed the patterns from the phase model into the new models and vice versa. In essence, these compositional embeddings will allow us to exhibit the phase model as being a core calculus for measurement-based computation. However, different models are interesting from the point of view of implementation issues like fault-tolerance and ease of preparation of entanglement resources. Our embeddings allow one to move easily between these models and to concentrate on the one-way model for designing algorithms and proving general theorems. This section has been structured into several subsections, one for each model and its embedding.
7.7.1 Phase Model In the one-way model the auxiliary qubits are initialized to be in the |+ state. We extend the one-way model to allow the auxiliary qubits to be in a more general state. We define the extended preparation command Niα to be the preparation of the auxiliary qubit i in the state |+α . We also add a new correction command Z iα , called a phase correction to guarantee that we can obtain determinate patterns. The 1 0 α,s α,0 α,1 dependent phase correction is written as Z i with Z i = I and Z i = . 0 eiα Under conjugation, the phase correction defines a new action over measurement: β,s
β,s
(Z i )† Miα Z i
α−sβ
= Mi
β,s
α−sβ
and since the measurement is destructive, it simplifies to Miα Z i = Mi . This action does not commute with Pauli actions, and hence one cannot write a compact notation for dependent measurement, as we did before, and the computation of angle dependencies is a bit more complicated. Thereafter, a measurement
P1: SBT CUUS834-07
cuus834-gay
268
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
preceded by a sequence of corrections on the same qubit will be called a dependent measurement. Note that, by the absorption equations, this indeed can be seen as a measurement, where the angle depends on the outcomes of some other measurements made beforehand. To complete the extended calculus it remains to define the new rewrite rules: E i j Z iα,s ⇒ Z iα,s E i j (−1)s α
Miα X is ⇒ Mi Miα Z is ⇒ Miα−sπ β,s α−sβ Miα Z i ⇒ Mi
EP MX MZ M P.
The foregoing rules, together with the rewriting rules of the one-way model described in Section 7.5, lead to a standardization procedure for the model. It is trivial that the one-way model is a fragment of this generalized model and hence universality immediately follows. It is also easy to check that the model is closed under composition and all the semantical properties of the one-way model can be extended to this general model as well. The choice of extended preparations and its concomitant phase correction is actually quite delicate. One wishes to keep the standardizability of the calculus, which constrains what can be added, but one also wishes to have determinate patterns, which forces us to put in appropriate corrections. The phase model is only a slight extension of the original one-way model, but it allows a discussion of the next model, which is of great physical interest.
7.7.2 Pauli Model An interesting fragment of the phase model is defined by restricting the angles of measurements to {0, π2 , π, − π2 }, i.e., Pauli measurements and the angles of preparation to 0 and π4 . Also, the correction commands are restricted to Pauli π corrections X , Z and phase correction Z 8 . One readily sees that the subset of angles is closed under the actions of the corrections, and hence the Pauli model is closed under composition. Proposition 7.7.1. The Pauli model is approximately universal. Proof. We know that the set consisting of J (0) (which is H ), J ( π4 ), and ∧Z is approximately universal. Hence, to prove the approximate universality of Pauli model, it is enough to exhibit a pattern in the Pauli model for each of these three unitaries. We saw before that J (0) and ∧Z are computed by the following 2-qubit patterns: J (0) := X 2s1 M10 E 12 ∧Z := E 12
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
269
where both belong also to the Pauli model. The pattern for J π4 in the one-way model is expressed as follows: −π
J ( π4 ) := X 2s1 M1 4 E 12 π = X 2s1 M10 E 12 Z 14 . The preceding forms do not fit in the Pauli model, since the first one uses a π measurement with an angle π4 and the second uses Z 4 . However by teleporting π the input qubit and then applying the Z 4 and finally running the standardization procedure, we obtain the following pattern in the Pauli model for J ( π4 ): π
X 2s1 M10 E 12 Z 14
π
= X 4s3 M30 E 34 Z 34 Z 3s2 X 3s1 M20 M10 E 12 E 23 π
,s2
X 3s1 M20 M10 E 12 E 23 Z 34
π
,s2
X 3s1 M20 M10 E 12 E 23 Z 34
= X 4s3 M30 E 34 Z 3s2 Z 32 = X 4s3 M30 E 34 Z 3s2 Z 32
π
−(−1)s1 s2 π2
= X 4s3 +s2 Z 4s1 M3
π
π
M20 M10 E 12 E 23 E 34 N34 .
Approximate universality for the Pauli model is now immediate.
2
Note that we cannot really expect universality (as we had for the phase model) because the angles are restricted to a discrete set. On the other hand it is precisely this restriction that makes the Pauli model interesting from the point of view of implementation. The other particular interest behind this model, apart from its simple structure, is based on the existence of a novel fault-tolerant technique for computing within this framework (Bravyi and Kitaev 2005; Raussendorf et al. 2004; Danos et al. 2006).
7.7.3 Teleportation Another class of measurement-based models – older, in fact, than the one-way model – uses 2-qubit measurements. These are collectively referred to as teleportation models (Leung 2004). Several papers that are concerned with the relation and possible unification of these models (Childs et al. 2005; Aliferis and Leung 2004; Jorrand and Perdrix 2005) have already appeared. One aspect of these models that stands in the way of a complete understanding of this relation is that, whereas in the one-way model one has a clearly identified class of measurements, there is less agreement concerning which measurements are allowed in teleportation models. We propose here to take as our class of 2-qubit measurements a family obtained as the conjugate under the operator ∧Z of tensors of 1-qubit measurements. We show that the resulting teleportation model is universal. Moreover, almost by construction, it embeds into the one-way model and thus exposes completely the relation between the two models. Before embarking on the specifics of our family of 2-qubit measurements, we remark that the situation previously commented on is more general:
P1: SBT CUUS834-07
cuus834-gay
270
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
Lemma 7.7.2. Let A be an orthonormal basis in ⊗n C2 , with associated n-qubit measurement M A , and Ai with i = 1, . . . , n be orthonormal bases in C2 , with associated 1-qubit measurements MiAi . Then there exists a unique (up to a permutation) n-qubit unitary operator U such that A M1···n = U1···n (⊗i MiAi )U1···n .
Proof. Take U to map ⊗i Ai to A.
2
This simple lemma says that general n-qubit measurements can always be seen as conjugated 1-qubit measurements, provided one uses the appropriate unitary to do so. As an example consider the orthogonal graph basis G = ∧Z 12 {|± ⊗ |±}; G then the two-qubit graph basis measurements are defined as M12 = ∧Z 12 (M10 ⊗ G 0 M2 ) ∧Z 12 . It is now natural to extend our definition of M12 to obtain the family of 2-qubit measurements of interest: α,β
β
M12 := ∧Z 12 (M1α ⊗ M2 ) ∧Z 12
(7.19)
corresponding to projections on the basis Gα,β := ∧Z 12 (P1 (α) ⊗ P2 (β)) ({|± ⊗ |±}). This family of 2-qubit measurements together with the preparation, entanglement and corrections commands of the one-way model define the teleportation model. Before we carry on, a clarification about our choice of measurements in the teleportation model is necessary. The usual teleportation protocol uses Bell basis measurement defined with B = ∧X 12 {|± ⊗ |0/1} B M12 = ∧X 12 (M1z ⊗ M2z ) ∧X 12 where M z is the computational-basis measurement. Note how similar these equations are to the equations defining the graph basis measurements. This is a clear indication that everything that follows can be transferred to the case where X replaces Z and B replaces G. However, since the methodology we adopt is to embed the 2-qubit measurement based model in the one-way model, and the latter is based on ∧Z and G, we will work with the graph-basis measurements. Furthermore, since ∧Z is symmetric, whereas ∧X (also known as C-NOT) is not, the algebra is usually nicer to work with. Now we prove that the family of measurements in Equation (7.19) leads to a universal model that embeds nicely into the one-way model, but first we need to describe the important notion of dependent measurements. These will arise as a consequence of standardization; they were not considered in the existing teleportation models. In what follows we drop the subscripts on the ∧Z unless they are really necessary. We write (s(i), s( j)) ∈ Z2 × Z2 to represent outcome of a 2-qubit measurement, with the specific convention that (0, 0), (0, 1), (1, 0), and (1, 1) correspond respectively to the cases where the state collapses to ∧Z |+α |+α , ∧Z |+α |−α , ∧Z |−α |+α , and ∧Z |−α |−α .
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
271
We will use two types of dependencies for measurements associated with X -action and Z -action: α,β
(−1)s α,(−1)t β
[Mi j ](s,t) = Mi j α,β α+uπ,β+vπ (u,v) [Mi j ] = Mi j
where s, t, u and v are in Z2 . The two actions commute, so the preceding equations α,β define unambiguously the full dependent measurement (u,v) [Mi j ](s,t) . Here are some useful abbreviations: [M α,β ](s,t) := [M α,β ](s,t) [M α,β ](0,0) := (u,v) [M α,β ] (0,0) [M α,β ](0,0) := M α,β α,x M := M α,0 π M α,y := M α, 2 . (0,0)
(u,v)
As in the 1-qubit measurement case we obtain the following rewriting rules for the teleportation model: E i j X is E i j Z is α,β (u,v) [Mi j ](s,t) X ir α,β (u,v) [Mi j ](s,t) X rj α,β (u,v) [Mi j ](s,t) Z ir α,β (u,v) [Mi j ](s,t) Z rj
⇒ X is Z sj E i j ⇒ Z is E i j α,β ⇒ (u,v+r ) [Mi j ](s+r,t) α,β ⇒ (u+r,v) [Mi j ](s,t+r ) α,β ⇒ (u+r,v) [Mi j ](s,t) α,β ⇒ (u,v+r ) [Mi j ](s,t)
EX EZ MX MX MZ MZ
to which we add also the trivial commutation rewriting which are possible between commands that do not overlap (meaning, acting on disjoint sets of qubits). We now describe how to translate 2-qubit EMC patterns to 1-qubit patterns and vice versa. The following equation plays the central role in the translation: α,β
β
Mi j = E i j (Miα ⊗ M j )E i j .
(7.20)
Note that this immediately gives the denotational semantics of 2-qubit measurements as cptp-maps. Furthermore, all other commands in the teleportation model are the same as in the one-way model, so we have right away a denotational semantics for the entire teleportation model in terms of cptp-maps. We write P for the collection of patterns in the one-way model and T for the collection of patterns in the teleportation model. Theorem 7.7.3. There exist functions [·] f : P → T and [·]b : T → P such that (i) ∀P ∈ P : [[P]] = [[[P] f ]]; (ii) ∀T ∈ T : [[T ]] = [[[T ]b ]]; (iii) [·] f ◦ [·]b and [·]b ◦ [·] f are both identity maps. Proof. We first define the forward map [·] f in stages as follows for any patterns P = (V, I, O, An . . . A1 ):
P1: SBT CUUS834-07
cuus834-gay
272
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
(i) For any i ∈ V O (i.e., measured qubits) we add an auxiliary qubit i d called a dummy qubit to the space V . (ii) For any i ∈ V O we replace any occurrence of Miα with Miα Mixd . (iii) We then replace each of the newly created occurrences of Miα Mixd by Miiα,x E iid . d Now we show that the first condition stated in the theorem holds; we do this stagewise. The first two stages are clear because we are just adding qubits that have no effect on the pattern because they are not entangled with any pre-existing qubit, and no other command depends on a measurement applied to one of the dummy qubits. Furthermore, we add qubits in the state |+ and measure them in the |± basis. The invariance of the semantics under stage 3 is an immediate consequence of Equation (7.20) and the fact that all the measurements are destructive, and hence an entanglement command on qubits appearing after a measurement of any of those qubits can just be removed. The map [·]b is defined similarly except that there is no need to add dummy α,β β qubits. One only needs to replace any 2-qubit measurement Mi j with Miα M j E i j . Again, this clearly preserves the semantics of patterns because of Equation (7.20) and the foregoing remark about destructive measurements. Thus condition 2 of the theorem holds. The fact that the two maps are mutual inverses follows easily. As all the steps in the translations are local we can reason locally. Looking at the forward mapping followed by the backward mapping we get the following sequence of transformations: Miα ⇒stage 1,2 ⇒Equation 7.20 ⇒Equation 7.20 ⇒ ⇒
Miα Mixd Miiα,x E iid d Miα Mixd E iid E iid Miα Mixd Miα .
This shows that we have the third condition of the theorem.
2
Note that the translations are compositional because the denotational semantics is and also it follows immediately that the teleportation model is universal and admits a standardization procedure. Example. Consider the teleportation pattern in the teleportation model given by x,x the command sequence X 3s1 Z 3s2 M12 E 23 . We perform the foregoing steps: x,x X 3s1 Z 3s2 M12 E 23
⇒Equation (7.20)
X 3s1 Z 3s2 M1x M2x E 12 E 23 and hence obtain the teleportation pattern with 1-qubit measurements.
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus
273
Example. We saw before, the following EMC 1-qubit pattern for Rz (α) which can be embedded to an EMC 2-qubit pattern using the foregoing steps: X 3s2 Z 3s1 [M2x ]s1 M1−α E 12 E 23
⇒stage 1,2
X 3s2 Z 3s1 [M2x ]s1 M2xd M1−α M1xd E 12 E 23 ⇒Equation (7.20) and standardization x,x (s1 ,0) −α,x X 3s2 Z 3s1 [M22 ] M11d E 11d E 22d E 12 E 23 d
Note that we have explicit algorithmic translations between the models and not just illustrative examples. This is the main advantage of our approach in unifying these two models compared to the extant work (Childs et al. 2005; Aliferis and Leung 2004; Jorrand and Perdrix 2005).
7.7.4 State Transfer In this section we consider the state transfer model (Perdrix 2003, 2007), a measurement-based model of quantum computation where the initial entanglement is created by means of measurements instead of the 2-qubit unitary transformation Z . This model has been originally introduced for reducing the resources of the teleportation model. The creation of entanglement is done by means of 2-qubit measurements which are supposed to be nondestructive, i.e., qubits can be reused after their measurement. Moreover, contrary to the teleportation model, the 2-qubit measurements are partial, meaning that they are not projecting the state of the measured qubits on a vector, but on a plane. In this section, we consider partial measurement of the following form: α M12 := Z 12 M1α Z 12 . α M12 is a measurement on two qubits with only two possible classical outcomes 0 or 1. More generally, a partial measurement is defined by a collection of projectors with eigenspaces of dimension possibly larger than 1. An example of such a measurement is the 2-qubit parity measurement. The parity measurement consists of two projectors: one on the even subspace span(|00, |11) and another on the odd subspace span(|01 + |10). A state transfer pattern consists of the 1-qubit measurement and the correction commands of the measurement calculus, together with the nondestructive mea0 surement M12 and the |0-state preparation. We show that the resulting model is universal, and we present how this model embeds in the one-way model and vice versa. We use the command Miαj and NiZ for representing respectively the partial 2α qubit measurement M12 and the |0-initialization. We write si j ∈ Z2 to represent α the outcome of Mi, j . Mi,α j is supposed to be nondestructive; some commands may act on i or j after the application of Mi,α j . However, we assume that each pair of qubits is measured at most once in order to ensure that the use of the signal si j is not ambiguous. Notice that the 1-qubit measurements Miα are still supposed to be destructive.
P1: SBT CUUS834-07
cuus834-gay
274
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
The operational semantics of the commands Miαj and NiZ is: NiZ
V, W, q, −→ V ∪ {i}, W, |0i ⊗ q, t
[Miαj ]s
V, W, q, −→ V, W ∪ {si j }, Z i j |+α +α |i Z i j q, [0/si j ] t
[Miαj ]s
V, W, q, −→ V, W ∪ {si j }, Z i j |−α −α |i Z i j q, [1/si j ]. We are now defining rewriting rules for the state transfer model. First we notice −α α that M12 X 1 = X 1 M12 : α M12 X1 = = = = =
Z 12 M1α Z 12 X 1 Z 12 M1α X 1 Z 2 Z 12 Z 12 X 1 Z 2 M1−α Z 12 X 1 Z 12 M1−α Z 12 −α X 1 M12 .
α+π α+π α+π α α α Z 1 = Z 1 M12 , M12 X 2 = X 2 M12 , and M12 Z 2 = Z 2 M12 . As Moreover M12 a consequence, we obtain the following rewriting rules for the state transfer model, (−1)s α+tπ where t [Miαj ]s := Mi j :
[Miα ]s X ir t [Miα ]s Z ir t [Miαj ]s X ir t [Miαj ]s X rj t [Miαj ]s Z ir t [Miαj ]s Z rj t
⇒ t [Miα ]s+r ⇒ r +t [Miα ]s ⇒ X ir t [Miαj ]s+r ⇒ X rj t+r [Miαj ]s ⇒ Z ir t+r [Miαj ]s ⇒ Z rj t [Miαj ]s
MX MZ M X1 M X2 M Z1 M Z 2.
Lemma 7.7.4. The rewriting system ⇒ is terminating. Proof. Notice that the size of the pattern is not increasing when the rewriting rules are applied. Moreover, for every rewriting rule, the total distance of the measurements from the right-hand side of the term is strictly decreasing. It guarantees that the rewriting system is terminating. 2 Now we are considering examples of state transfer patterns. Here are the implementations in this model of a universal family of unitary transformations: • The following pattern is implementing the unitary transformation J (α): J (α) = ({i, j}, {i}, { j}, X sji Z j ji Mi−α M 0ji N jZ ). s
• The following pattern is implementing X : s
s
X = ({i, j, k}, {i, j}, {i, k}, X k j Z kk j s ji [M 0j ]Mk0j M 0ji N jZ ). We write S for the collection of patterns of this state transfer model.
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
275
Lemma 7.7.5. There exist functions [.] f : P → S and [.]b : S → P such that (i) ∀P ∈ P : [[P]] = [[[P] f ]]; (ii) ∀S ∈ S : [[S]] = [[[S]b ]]. Proof. The backward map [.]b consists in replacing each command NiZ by s Z i j M 0j E i j Ni N j = J (0)|+ and Miαj by E jk Z ksi Nk Mi0 E i j . This last term comes α from the decomposition of the partial measurement M12 = Z 12 M1α Z 12 . Since the 1-qubit measurements are destructive, an ancillary qubit k is added to replace the qubit i after the measurement, leading to the sequence of commands E jk Z ksi Nk Mi0 E i j . The forward map [.] f consists in replacing each coms mand Ni by Z j ji Mi0 M 0ji N jZ NiZ = J (0)|0, and E i j by J (0) j ◦ Xi j ◦ J (0) j , where the implementation of J (0) and X in the state transfer model is given previously. 2 Notice that neither [·] f ◦ [·]b nor [·]b ◦ [·] f is the identity. We can observe that contrary to Theorem 7.7.3 relating the teleportation and one-way model, the preceding backward translation [.]b requires more ingenuity, since one has to “unshare” the qbits of the state-transfer pattern. Regarding the forward translation [.] f , we can observe further that the translation of E i j is purely semantic: we know how to implement H = J (0) and X so we know how to implement Z . This leads to a 5-qubit pattern composed of 16 commands that works but does not seem particularly meaningful.
7.8 Projection-based Quantum Computing Based on measurements, a pattern has a probabilistic evolution, as it is illustrated by its semantics (see Section 7.3). However, the correction mechanism based on Pauli corrections enables globally deterministic behavior. In Section 7.3, definitions of deterministic and strongly deterministic patterns are given: a deterministic pattern has an evolution that maps pure states with pure states, and a strong deterministic pattern realizes a unitary embedding (or isometry.) The semantics of a strongly deterministic pattern is entirely characterised by its “zero” branch, i.e., the branch where all the classical outcomes, or signals, are 0. According to the definition of the measurement calculus, a “zero” branch is Pauli correction free. Thus, the corrections of a strongly deterministic pattern can be abstracted away, leading to a projective quantum computation where every measurement is replaced by its projector associated with the classical outcome 0. An arbitrary projective quantum computation based on unitary transformations and projections is not a priori a valid quantum evolution; however, some of them are specifications of strongly deterministic patterns of the measurement calculus. In this section, a formalism for representing projection-based quantum computations is introduced. The syntax and the semantics of the language are presented as well as the composition of projective terms. Moreover a general technique based on phase map decompositions is presented for translating unitary transformation into a projective quantum computation.
P1: SBT CUUS834-07
cuus834-gay
276
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
A projective quantum computation consists in: • Initializing some ancillary qubits in a |+ state; • Creating entanglement by means of entanglement operators; • Applying projections +α | = √12 (0| + e−iα 1|) on nonoutput qubits. The creation of entanglement, i.e., the first two steps, can be represented by an open graph (G, I, O), where I is the set of input qubits, O the set of output qubits, and G = (V, E), such that I, O ⊆ V , is an undirected simple graph. All the qubits in V I are prepared in the |+ state; then for any edge (u, v) ∈ E, the entanglement operator E u,v is applied on the corresponding qubits. Notice that since for any u, u , v, v ∈ V , E u,v commutes with E u ,v , the resulting state does not depend on the order chosen for enumerating the edges of G. The third step which consists in applying on every nonoutput qubit u ∈ V O a projector +αu | can be represented as a labeling α : V O → [0, 2π ). Notice that, contrary to the measurement calculus, there is no classical signal and thus no dependancy between the projections, and moreover the projectors act on individual qubits. As a consequence, for any u = v ∈ V O, +αu | and +αv | commute; thus the resulting state does not depend on the order chosen for enumerating the labels of the graph. Definition 7.8.1. A projective term is a labeled open graph (G, I, O, α) where G = (V, E) is a simple undirected graph, I, O ⊆ V are sets of input and output vertices, and α : V O → [0, 2π ) associates with any nonoutput vertex u an angle α(u). The sequential composition of two projective terms is defined as follows: Definition 7.8.2. Let (G 1 , I1 , O1 , α1 ) and (G 2 , I2 , O2 , α2 ) be two projective terms such that V1 ∩ V2 = O1 = I2 , (G 2 , I2 , O2 , α2 ) ◦ (G 1 , I1 , O1 , α1 ) = (G 2 G 1 , I1 , O2 , α) where G 1 G 2 := (G 1 ∪ G 2 ) (G 1 ∩ G 2 ) is the symmetric difference of G 1 and G 2 , and % α2 (u) if u ∈ V2 α : (V1 ∪ V2 ) O2 → [0, 2π ) = u → α1 (u) otherwise. The tensor of two projective terms is defined as follows: Definition 7.8.3. Let (G 1 , I1 , O1 , α1 ) and (G 2 , I2 , O2 , α2 ) be two projective terms (G 1 , I1 , O1 , α1 ) ⊗ (G 2 , I2 , O2 , α2 ) = (G 1 ∪ G 2 , I1 ∪ I2 , O1 ∪ O2 , α) where
% α : (V1 ∪ V2 ) (O1 ∪ O2 ) → [0, 2π ) = u →
α1 (u) if u ∈ V1
α2 (u) otherwise.
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
277
The denotational semantics of a projective term is a linear map that consists in creating ancillary qubits in the |+ state, then applying entanglement operators, and finally applying projectors on the nonoutput qubits: Definition 7.8.4. Let (G, I, O, α) be a projective term. Its denotational semantics (G, I, O, α) : H I → H O is: (G, I, O, α) : H I → H O = α(u)|u Z G |+ I c
u∈O c
where Z G = (u,v)∈G Z u,v . Note that Z G is well defined since for any u, u , v, v , Z u,v = Z v,u and Z v,u commutes with Z u ,v . It is easy to verify that the denotational semantics preserves the sequential and tensorial composition of projective terms: Lemma 7.8.5. (G 2 , I2 , O2 , α2 ) ◦ (G 1 , I1 , O1 , α1 ) = (G 2 , I2 , O2 , α2 ) ◦ (G 1 , I1 , O1 , α1 ) (G 1 , I1 , O1 , α1 ) ⊗ (G 2 , I2 , O2 , α2 ) = (G 1 , I1 , O1 , α1 ) ⊗ (G 2 , I2 , O2 , α2 )
7.8.1 From Unitary to PBQC We wish to explore whether measurement-based quantum computing suggests new techniques for designing quantum algorithms. Previously, one would typically start with an algorithm already implemented in the circuit model and replace each gate by a corresponding pattern. To transform the pattern to a standard form where all entangling operations are performed first, one could then use the by-product method (Raussendorf et al. 2003) or the more general standardization algorithm presented in Section 7.5. Here, we propose a direct method that is free from any reference to the circuit model and leads into a direct decomposition of a given unitary map into a projection-based pattern (de Beaudrap et al. 2006, 2008). Then in the next section we address the question of how to transform a projectionbased pattern to a one-way pattern. We start with the observation that the positive branch of a one-way pattern implicitly defines a particular decomposition of the corresponding unitary map into a preparation map enlarging the input space, a diagonal map with unit coefficients, and a restriction map contracting back the space to the output space, which we call a phase map decomposition. Note that this decomposition does not directly correspond to any physical procedure as it defines a projection-based pattern However, since the one-way model is universal, this alternative decomposition is also universal, and there is a straightforward procedure that allows us to determine a phase map decomposition for a unitary from a pattern implementing the same unitary. Remarkably, one can define a reverse procedure as well, which breaks into two steps. First, given a unitary map, one enumerates such phase map
P1: SBT CUUS834-07
cuus834-gay
278
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
decompositions by constructing the right set of coefficients in the middle diagonal map (Lemma 7.8.7 and Algorithm 7.8.8). Then for each such decomposition, one verifies whether there exists a matching projection-based pattern. This reduces to finding for any phase map decomposition a matching entangled graph state (with inputs) and choice of measurement angles (Algorithm 7.8.9). We now turn to the formulation of our decomposition. Various operators over H preserve the computational basis, up to phase: for example, Pauli maps, Z α (defined as Z α |0 = |0, and Z α |1 = eiα |1), and controlled Paulis. One-qubit measurements also map the standard basis of one space to those of another, up to a scalar factor. In particular, one has the following simple equations where |x is an n-qubit computational basis state and j is an index for a qubit in |x: ±α | ⊗ I ⊗n (|0|x) = 2−1/2 |x ±α | ⊗ I ⊗n (|1|x) = ±2−1/2 e−iα |x = |0|x ∧Z 1 j |0|x = Z j |1|x ∧Z 1 j |1|x We will call a map : HV → HV a phase map if it is diagonal in the computational basis and has only unit coefficients. The typical example of such a map is ∧Z . It is important to note that the foregoing definition depends on the choice of a basis. Following one-way model terminology we also define a preparation map PI →V : H I → HV that expands the input space by tensoring auxiliary qubits: |x → |x ⊗ | + · · · + I c and a restriction map RV →O : HV → H O that projects the space to the output space: |x → + · · · + | O c |x. It is easy to see that the restriction map is the adjoin of the preparation map. As we have seen, measurement and entangling commands in the one-way model define phase maps, and hence from the universality of the model we obtain the following decomposition: Theorem 7.8.6. For all unitary U : H I → H O , there exists a phase map : HV → HV such that U = RV →O ◦ ◦ PI →V . Proof. There exists a deterministic one-way pattern P implementing U where its positive branch can be written as c U = 2|O |/2 i∈ O +αi |i E G PI →V c = 2|O |/2 i∈ O +|i Z i−αi E G PI →V = RV →O i∈ O Z i−αi E G PI →V = RV →O V →V PI →V
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus
279
where = i∈ O Z i−αi i j∈E ∧Zi j is the phase map corresponding to the entanglement operations and measurement angles. 2 One can think of the preceding theorem as a special kind of diagonalization for unitaries where one is allowed to inflate the dimension of the underlying space. This will prove to be useful for direct programming in the one-way model. We present first a couple of examples, clarifying our first set of definitions and preparing the ground for a direct proof of the preceding theorem that does not invoke universality of the one-way model. The examples already hint at the construction behind the direct phase map decomposition algorithm. Example 1. Consider the unitary map Jα : H{1} → H{1} which decomposes in the computational basis as
Jα = 2−1/2
1 e−iα 1 −e−iα
=
1 0 0 1
e−iα 0
0 −e−iα
1 1 · 2−1/2 0 0
0 0 . 1 1
This decomposition is obtained from the one-way pattern X 2s1 M1α E 12 that implements Jα and has as positive branch the phase map 21/2 +α |1 ∧Z 12 : H{1,2} → H{2} . Factoring out the restriction operator gives the decomposition Jα =
1 0
0 1
1 0
1 0 0 · 1 0 0
0 0 1 0 0 e−iα 0 0
1 0 0 −1/2 1 ·2 0 0 −iα 0 −e
0 0 1 1
where the left matrix is the restriction R1 : H{1,2} → H{2} . The phase map here is Z 1−α ∧Z 12 , and the decomposition above can be rewritten: Jα = R1 (Z 1−α ∧Z 12 )P2 . Example 2. Example 1 uses only one auxiliary qubit and as such is a special case where the required number of auxiliary qubits is equal to the number of inputs. This is of course not always the case, and the general algorithm for phase map decomposition will take care of this. We will present exact bounds on how much one needs to expand the computational space to be able to obtain the decomposition; however, to realize a decomposition as a pattern we will need further restrictions. The following example demonstrates this case. The shortest known pattern for the Z α -rotation is X 3s2 Z 3s1 M20 M1−α E 12 E 23 with positive branch +|2 +−α |1 E 12 E 23
P1: SBT CUUS834-07
cuus834-gay
280
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
which induces the 3-qubit phase map |x yz = (−1)x y+yz eiαy |x yz (indeed a diagonal of units) and corresponds to the following decomposition of Z α : R12 D(1, 1, 1, −1, eiα , eiα , −eiα , eiα ) P23 where D is a diagonal matrix. Note that some permutations of the diagonal lead to other solutions, and most decompositions won’t correspond to a pattern. Also, if one uses only one additional qubit, one obtains another decomposition with middle map √ √ D( 2, 0, 0, 2eiα ) that is not a phase map since coefficients are not units. The natural question is whether it is possible to generate all such decompositions without using a pattern, and next find a pattern matching one of these decompositions.
7.8.2 Direct Decomposition Supposing one adds n auxiliary qubits to the input space I , a simple calculation shows that for each coefficient u in the the computational basis matrix representation of U , there will be 2|V |−|O| /2|I | = 2n−|I | “slots” to spread over the diagonal of the phase map (since U is a unitary |I | = |O|). Thus, finding a decomposition amounts in this case to finding complex numbers x (i) such that the following two conditions hold: u= x (i) (7.21) i≤2n−|I | n/2
2
|x (i) | = 1
(7.22)
The first equation says that the restriction map R will sum up all the x (i) s to give u, while the second one asks for unit diagonal elements (note that the preparation map of n auxiliary qubits introduces an overall factor of 2−n/2 ). Lemma 7.8.7. If n > |I | , Equations (7.21) and (7.22) have joint solutions iff |u| ≤ 2n/2−|I | . Proof. Each complex x (i) can be seen as a real plane vector of constant length 2−n/2 , and all one has to do is to choose their angles such that they will globally add up to u. If one aligns all x (i) s with u, the resulting sum is at least as long as u iff |u| ≤ 2n/2−|I | ; thus this inequality is necessary for Equations (7.21) and (7.22) to have joint solutions. If n > |I | , then 2n−|I | ≥ 2 , so there are at least two terms x (i) . We may pick any two of them and rotate them at opposite angles ±θ. If θ reaches π2 before the global sum matches u, then the corresponding two x (i) s contribute nothing, and we pick two additional terms to rotate. Clearly, at some stage, for some value of θ the sum will coincide with that of u. 2
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus
281
Due to unitarity of U , |u| ≤ 1 : so a safe choice of n is one such that 2n/2−|I | ≥ 1. Thus, n ≥ 2|I | is always sufficient for a phase map to exist. Another consequence of the foregoing lemma is that for any given unitary map U on |I | qubits, unless U is itself a phase map and also requires no auxiliary qubits, we have n > |I |: then a lower bound on the number of required qubits to implement it as a one-way pattern is 2|I |, if at least one coefficient of U is larger than 12 . For a unitary U , once we have fixed n, an output space O, and a choice of (i) x pq satisfying Equations (7.21) and (7.22) for the coefficients u pq = p|U |q, the following algorithm will enumerate all possible decompositions: Algorithm 7.8.8. Input: for sets V , I , and O and n = |I c | : — a unitary U on H I ; (i) 2n−|I | — complex numbers { x pq }i=1 satisfying Equations (7.21) and (7.22) for each u pq ; — a permutation σ over {1, · · · , 2n−|I | }. √ |V | (i) Output: diagonal elements {dkk }2k=1 , such that dkk = 2n x pq , where: — the binary representation of p agrees with that of k after restriction to O; — q ≡ k mod 2|I | ; — i = σ (3k/2|I | 4). n
The elements {dkk }2k=1 are the solutions of the linear equations R D P = U and due to the simple structure of matrices R and P we derive the preceding algorithm.
7.8.3 Pattern Synthesis Note that obtaining a decomposition is not sufficient for the existence of a projection-based pattern. To determine whether a phase map decomposition R P of a unitary U has a corresponding projection-based pattern, one wants a graph G E over V and angles α j for j ∈ O c such that −α j Zj ∧Z jk = j∈O c
jk∈E
That means for all x in the V -computational basis: dx x = e−i
Oc
αj xj
(−1)
jk∈E
x j xk
(7.23)
where dx x is the diagonal coefficient of the phase map corresponding to x basis. Based on this observation, we propose the following algorithm for the preceding graph-matching problem. Algorithm 7.8.9. Input: A phase map decomposition for U – i.e., the diagonal |V | elements {dx x }2x=1 from Algorithm 7.8.8. Output: either (i) a labeled open graph (G, I, O, α) defining a projection-based pattern or (ii) no matching graph exists.
P1: SBT CUUS834-07
cuus834-gay
282
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
1. For j ∈ {1, · · · , |O c |}, consider the |V |-bit string z j that only has a 1 at position j, and set α such that e−iα j = dz j z j . 2. For all j, k, consider the |V |-bit string z jk having a 1 only at positions j and k. Check whether dz jk z jk = ±e−i(α j +αk ) (the angles for the corresponding qubit in O is taken to be 0). — (i) if YES and the sign is −1, return E jk as an edge in G. — (ii) if NO, no matching graph exists. Although there are exponentially many elements on the diagonal of the phase map, testing for the existence of G will query the middle diagonal map only quadratically in |I | + n, to read off the measurement angles and the entanglement graph. Thus in practice could accelerate the detection of bad decompositions before obtaining all diagonal elements in the phase map. When the procedure fails, one backtracks by: (1) trying a different decomposition given by Algorithm 7.8.8, (2) trying another solution from Lemma 7.8.7, (3) revising the choice of outputs, and ultimately (4) further expanding the computational space. Without any additional constraints, it seems that there are many solutions to be checked. One might be able to infer additional constraints to Equations (7.21) and (7.22) from the requirement that there be a corresponding entanglement graph, reducing the set of phase maps that we consider. How this may be done is, however, an open question.
7.9 From Projection Specification to Measurement Implementation A projective term t has no physical meaning; however, it can be seen as a specification of a strongly deterministic measurement pattern P if t = P. Indeed, for a given strongly deterministic pattern P, the Pauli corrections can be abstracted away by considering only the projections of the “zero” branch of the computation, where no Pauli operators are applied. P is abstracted in tP = (G, I, O, α) such that P = tP , if P can be rewritten in the following NEMC form: ≺ αi s Mi E i, j Ni . P =C i∈V O
i, j∈G
i∈V I
In this section, we consider the problem of producing a strongly deterministic pattern from its specification given in terms of projective term. It turns out that there exist projective terms that have no physical implementation by means of measurement patterns. Thus, sufficient conditions for the existence of such implementations are presented in this section. They are based on the existence of a flow in the underlying open graph of the projective term. The implementation of projective terms plays a crucial role in the phase map decomposition. Indeed, a phase map decomposition produces a projective term from a unitary transformation (see Subsection 7.8.1), which can be implemented with a strongly deterministic pattern if the flow condition is satisfied.
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
283
Moreover, the use of projective terms permits us to address the key issue of the depth minimization of strongly deterministic measurement patterns. The depth of a measurement pattern depends on the corrections and the dependency between the measurements. Thus, finding an implementation of a projective term (in which all the projectors can be applied in parallel since they act on distinct qubits) in a deterministic measurement pattern of minimal depth is a crucial issue.
7.9.1 Causal Flow A variety of methods for constructing measurement patterns have been already proposed (Raussendorf et al. 2003; Hein et al. 2004; Childs et al. 2005) that guarantee determinism by construction. We introduce a direct condition on open graph states that guarantees a strong form of deterministic behavior for a class of one-way measurement patterns defined over them (Danos and Kashefi 2006). Remarkably, our condition bears only on the geometric structure of the entangled graph states. This condition singles out a class of patterns with flow, which is stable under sequential and parallel compositions and is large enough to realize all unitary and unitary embedding maps. Patterns with flow have interesting additional properties (Danos and Kashefi 2006). First, they are uniformly deterministic, in the sense that no matter what the measurement angles are, the obtained set of corrections, which depends only on the underlying geometry, will make the global behavior deterministic. Second, all computation branches have equal probabilities, which means in particular that these probabilities are independent of the inputs, and as a consequence, one can show that all such patterns implement unitary embeddings. Third, a more restricted class of patterns having both flow and reverse flow supports an operation of adjunction, corresponding to time-reversal of unitary operations. This smaller class implements all and only unitary transformations. Definition 7.9.1. ( f, ≺) is a causal flow of (G, I, O), where f : O c → I c and ≺ is a strict partial order over V , if and only if 1. i ≺ f (i) 2. if j ∈ NG ( f (i)) then j = i or i ≺ j 3. i ∈ NG ( f (i)). As one can see, a flow consists of two structures: a function f over vertices and a matching partial order over vertices. In order to obtain a deterministic pattern for an open graph state with flow, dependent corrections will be defined based on function f . The order of the execution of the commands is given by the partial order induced by the flow. The matching properties between the function f and the partial order ≺ will make the obtained pattern runnable. An example of causal flow is given in Figure 7.4. The existence of a causal flow is a sufficient condition for determinism. First we need the following simple lemma, which describes an essential property of graph state.
P1: SBT CUUS834-07
cuus834-gay
284
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
a0 a1
b1
a2
b2
b0
c0 c1 c2
Figure 7.4. Example of open graph – squared vertices represent inputs, white vertices represent outputs – that has a causal flow (g, ≺), where g(ai ) = bi , g(bi ) = ci and a0 ≺ a1 ≺ a2 ≺ {b0 , b1 , b2 } ≺ {c0 , c1 , c2 }
Lemma 7.9.2. For any open graph (G, I, O) and any i ∈ I c , E G N I c = X i Z NG (i) E G N I c . Proof. The proof is based on Equations (7.11) and (7.13) of the measurement calculus, and the additional equation X i Ni = Ni , that follows from the fact that Ni produces a qubit in the |+ state that is a fix point of X . EG NI c = EG Xi NI c
= E E Xi NI c k,l i, j (k,l)∈G,k=i,l=i j∈N (i)
G
= E Z E X NI c k,l i j i, j (k,l)∈G,k=i,l=i j∈NG (i) j∈NG (i)
= X i j∈NG (i) Z j E G N I c = X i Z NG (i) E G N I c
2
The operator K i := X i ( j∈NG (i) Z j ) is called graph stabilizer (Hein et al. 2004) at qubit i, and the preceding lemma proves K i E G N I c = E G N I c . Note that this equation is slightly more general than the common graph stabiliser (Hein et al. 2004) as it can be applied to open graph states where input qubits are prepared in arbitrary states. Theorem 7.9.3. For a given projective term (G, I, O, α), if open graph (G, I, O) has causal flow ( f, ≺), then the pattern
≺ si P f,G := i∈O X f (i) Z sNi G ( f (i)){i} Miαi E G N I c , c where the product follows the dependency order ≺, is strongly deterministic and realizes the unitary embedding P = t = i∈O c +αi |i E G N I c . Proof. The proof is based on anachronical patterns, i.e., patterns that do not satisfy the D0 condition (see Section 7.2) saying that no command depends on an outcome not yet measured. Indeed, in the anachronical pattern Miα Z isi , the command Z isi depends on the outcome si whereas the qubit i is not yet measured. However, by relaxing the D0 condition, we have the following equation: +α |i = Miα Z isi .
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
285
Indeed, if si = 0 the measurement realizes the projection +α |i , and if si = 1 the measurement realizes the projection −α |i = +α |i Z i . Thus, any correction-free pattern i∈O c Miαi E G N I c can be turned into an anachronical strongly deterministic pattern i∈O c Miαi Z isi E G N I c that realizes UG . The rest of the proof consists in transforming this anachronical pattern into a pattern that satisfies the D0 condition: αi i Nc i∈O c Mi Z si E G I
αi si = i∈O c Mi Z i X sfi (i) j∈NG ( f (i)) Z sji E G N I c
≺ si = i∈O X f (i) j∈NG ( f (i)){i} Z sji Miαi E G N I c . c Lemma 7.9.2 and condition 3 of the causal flow are used in the previous equation for eliminating the command Z si i , whereas conditions 1 and 2 ensure that the pattern satisfies the D0 condition. 2 The intuition of the proof is that entanglement between two qubits i and j converts an anachronical Z correction at i, given in the term Miα Z isi , into a pair of a “future” X correction on qubit j. It is easy to verify that Theorem 7.9.3 is also valid in the more generalized setting of the phase model, by replacing the Pauli X operator in Lemma 7.9.2 with X iα = Z iα X i Z i−α , which stabilizes the state |+α . This allows us to define the adjunction operator over the class of patterns with flow (Danos and Kashefi 2006). Say an open graph state (G, I, O) has bi-flow, if both (G, I, O) and its dual state (G, O, I ) have flow. Say a pattern has flow (bi-flow) if its underlying open graph state does. The class of patterns with flows (bi-flows) is closed under composition and tensorization. It is also universal, in the sense that all unitaries can be realized within this class. This follows from the existence of a set of generating patterns having bi-flow as we saw in Section 7.4. Patterns with bi-flows realize unitary operators. Indeed, a flow ( f, ≺) is one-to-one and therefore the orbits f n (i) for i ∈ I define an injection from I into O. In the case of a bi-flow, I and O are therefore in bijection, and since one knows already that patterns with flows realize unitary embeddings, it follows that patterns with bi-flow implement unitaries. Interestingly, one can define directly the adjoint of a pattern in the subcategory of patterns with bi-flows. Specifically, given ( f, ≺) a flow for (G, I, O), and angles {αi ; i ∈ I c } for preparations, and {β j ; j ∈ O c } for measurements, we write P f,G,'α,β' for the pattern obtained as in the extension to general preparations of Theorem 7.9.3. Suppose a reverse flow (g, ≺) is given on (G, O, I ); one can define P f,G,'α,β' † := Pg,G,β,' ' α. There are two things to note here: first, for this definition to make sense, one needs to have general preparations; second, this adjunction operation depends on the choice of a reverse flow (g, ≺). It is easy to see that P f,G,α,β † and P f,G,β,α realize adjoint unitaries.
P1: SBT CUUS834-07
cuus834-gay
286
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
≺i
i≺ x
x
x
x
x i x
x
x g(i) x
x
x
Figure 7.5. Graphical interpretation of a gflow (g, ≺): for a given vertex i all the vertices larger than i represent qubits that will be measured after the qubit i. The set g(i) has to be composed of qubits measured after i (i.e., in the right layer), and such that the following parity conditions are satisfied: there is an odd number of edges between g(i) and i and there is an even number of edges between g(i) and any vertex which is not larger than i (in the left layer.)
An example is the pattern H := X 2s1 M10 E 12 N2 with I = {1} and O = {2}. It has a unique bi-flow and is self-adjoint in the sense that H† = H; therefore it must realize a self-adjoint operator, and indeed it realizes the Hadamard transformation.
7.9.2 Generalized Flow The existence of the causal flow is only a sufficient condition for determinism. We now extend the construction and present a necessary and sufficient condition for the stepwise uniformly deterministic computation in this model (Browne et al. 2007). As we saw, a flow function f assigns to every single measured qubit i a unique correcting vertex f (i). A natural generalization is to consider a set of vertices as a correcting set. Hence instead of working with a function f : O c → I c c defining the correcting vertices, we will have a function g : O c → P I defining c the correcting sets of vertices, where P I denotes the power set of all the subsets of vertices in I c . We define the odd neighborhood of a set of vertices K to be the set Odd(K ) = {u , |NG (u) ∩ K | = 1 mod 2}, i.e., the set of vertices that have an odd number of neighbours in K . Definition 7.9.4 (gflow). (g, ≺) is a gflow of (G, I, O), where g : O c → ℘(I c ) and ≺ is a strict partial order over V , if and only if 1. if j ∈ g(i) then i ≺ j 2. if j ∈ Odd(g(i)) then j = i or i ≺ j 3. i ∈ Odd(g(i)) A graphical interpretation of the generalized flow is given in Figure 7.5. Notice that if an open graph has a causal flow ( f, ≺), then it has a gflow (g, ≺), where g : i → { f (i)}. Like the causal flow, the gflow is a sufficient condition for determinism:
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus
287
Theorem 7.9.5. For a given projective term t = (G, I, O, α), if (G, I, O) has gflow (g, ≺), then the pattern
≺ si si αi Pg,G := i∈O c j∈g(i) X j Z NG ( j){i} Mi E G N I c , where the product follows the dependency order ≺, is strongly deterministic and realizes the unitary embedding P = t = i∈O c +αi |i E G N I c . Proof. The proof is similar to the proof of Theorem 7.9.3, except that for each measured qubit i, Lemma 7.9.2 is applied for every element of g(i) so that it realizes an X on every qubit in g(i) and a Z on every qubit that has an odd number of neighbors in g(i). Those qubits that have an even number of neighbors in g(i) receive an even number of Z s, i.e., the identity. 2 Contrary to the causal flow, the existence of a gflow is necessary for a certain kind of determinism. Recall that a pattern P is said to be uniformly deterministic if it is deterministic for any measurement angles. Moreover, a pattern is said to be stepwise deterministic if it is deterministic after performing each single measurement together with all the corrections depending on the outcomes of that measurement. More formally: Definition 7.9.6. A pattern P is stepwise, uniformly, and strongly deterministic if P is uniformly and strongly deterministic and either is measurement-free or can be rewritten as (V, I, O, C sn Miαi A) such that C is composed of Pauli commands only and P = (V, I, O {n}, A) is stepwise, uniformly, and strongly deterministic. Theorems 7.9.3 and 7.9.5 can be extended to stepwise, uniform, and strong determinism. Theorem 7.9.7. If a pattern P is stepwise, uniformly, and strongly deterministic, then the underlying open graph (G, I, O) of P has a generalized flow and the pattern is an implementation of the projective term t = (G, I, O, α): P = t = i∈O c +αi |i E G N I c . The next lemma will be used in the proof of Theorem 7.9.7 and illustrates the role played by the uniformity condition. Lemma 7.9.8. Let U and V be two n-qubit unitary transformations. If for any angle α, +α |U = +α |V then U = V Proof. For a given angle α, and any n-qubit state |, U | and V | can be decomposed as follows: U | = |+α |φ+ + |−α |φ− ,
V | = |+α |ψ+ + |−α |ψ− .
P1: SBT CUUS834-07
cuus834-gay
288
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
Since +α |U | = +α |V |, |φ+ = |ψ+ . Moreover, since |+α+π = |−α , +α+π ||φ = +α+π ||ψ implies |φ− = |ψ− . Thus U | = V | for any |, so U = V . 2 The following lemma extends a well-known result of the stabilizer formalism to the measurement calculus: Lemma 7.9.9. For a given open graph (G, I, O) and a Pauli operator C, if C E G N I c = E G N I c then there exists S ⊆ I c such that C = u∈S X u Z NG (u) . Proof. Since C E G N I c = E G N I c , C E G N V = E G N V . The stateE G N V is stabilized by {X u Z NG (u) , u ∈ V }, thus there exists S ⊆ V such that C = u∈S X u Z NG (u) . The rest of the proof consists in proving that S ⊆ I c . By contradiction, let i ∈ S ∩ I , EG NI c = EG NI c Zi Zi = u∈S X u Z NG (u) E G N I c Z i Z i = X i Z NG (i) Z i u∈S{i} X u Z NG (u) E G N I c Z i = −Z i X i Z NG (i) u∈S{i} X u Z NG (u) E G N I c Z i = −Z i E G N I c Z i = −E G N I c .
2
Proof of Theorem 7.9.7. The proof is by induction on the number of measurements of P. If P is measurement-free then the proof is obvious. Otherwise, P can be rewritten as (V, I, O, C Dsn Mnαn A), where C D acts on qubits D ⊆ O. By induction, P = (V, I, O ∪ {n}, A) has a gflow (g , ≺ ) and it realizes U = i∈O c {n} +αi |i E G N I c . Thus P realizes +αn |U if sn = 0 and C D −αn |U . Since P is strongly deterministic and −αn | = +αn |Z n , +αi |i C D Z n E G N I c = +αi |i E G N I c . i∈O c {n}
i∈O c {n}
Thus, according to Lemma 7.9.8, C D Z n E G N I c = E G N I c , and thanks to Lemma 7.9.9, there exists S ⊆ I c s.t. C D = Z n u∈S X u Z NG (u) . Notice that S ⊆ D since X commands cannot be canceled out in C D . Moreover, for any v ∈ / D, an even number of Z s are applied on v such that they cancel out. As a consequence, v ∈ Odd(S) implies v ∈ D ⊆ O ∪ {n}. Let g : O c → I c s.t. g(i) := g (i) if i = n and g(n) := S. Let R be a relation s.t. (u, v) ∈ R if u ≺ v ∨ (u = n ∧ v ∈ S), and let ≺ be the transitive closure of R. (g, ≺) is then a gflow of (G, I, O). 2 The open graph state in Figure 7.6 has no flow (due to the cyclic connections), but it admits a generalized flow. This example demonstrates the fact that having flow is not a necessary condition for uniform determinism, contrary to the existence of the generalized flow.
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
a
d
b
e
c
f
15:10
289
Figure 7.6. A graph with generalized flow but no flow: g(a) = d, g(b) = e, g(c) = {d, f }. The solid arrows represent the flow edges, whereas the dashed arrow indicates a virtual flow edge (an edge that is not an edge of the graph state).
7.10 Finding Optimal Flow Efficiently In this section, efficient algorithms for finding causal flow and generalized flow of open graph state are presented (Mhalla and Perdrix 2008). These algorithms can be used for deciding whether a given open graph admits a deterministic pattern. Moreover, these algorithms produce flows of minimal depth such that they can be used for an automatic complexity depth optimization. First note that a flow (flow denotes a gflow or a causal flow), (g, ≺) of (G, I, O) induces a partition of the vertices of the open graph: Definition 7.10.1. For a given open graph (G, I, O) and a given flow (g, ≺) of (G, I, O), let % if k = 0 max≺ (V ) Vk≺ = ≺ max≺ (V L k−1 ) if k > 0 where max≺ (X ) = {u ∈ X s.t. ∀v ∈ X, ¬(u ≺ v)} is the set of the maximal ele≺ ≺ ments of X and L ≺ k = ∪i≤k Vi . The depth d of the flow is the smallest d such ≺ that Vd+1 = ∅. (Vk≺ )k=0...d ≺ is a partition of V into d ≺ + 1 layers. A causal flow or a gflow (g, ≺) of (G, I, O) leads to a correction strategy for the corresponding pattern P, which consists in measuring the non output qubits of each layer in parallel, from the layer Vd≺≺ to the layer V0≺ : ≺ P = V, I, O, R (0) R (1) . . . R (d ) E G N I c
αi X Z where R (k) := M . ≺ i N (i) G i∈Vk O j∈g(i) i The complexity depth of such a pattern is upperbounded by d ≺ + 1. Causal and generalized flows are not unique in general. In the following, a subfamily of flows are considered, the maximally delayed flows, which have an inductive structure (Lemmas 7.10.3, 7.10.4) and are of minimal depth (Theorem 7.10.5.) Definition 7.10.2. For a given open graph (G, I, O) and two given causal flows (resp. gflows) (g, ≺) and (g , ≺ ) of (G, I, O), (g, ≺) is more delayed than (g , ≺ ) ≺ if ∀k, |L ≺ k | ≥ |L k | and there exists a k such that the inequality is strict. A causal
P1: SBT CUUS834-07
cuus834-gay
290
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
flow (resp. gflow) (g, ≺) is maximally delayed if there exists no causal flow (resp. gflow) of the same open graph that is more delayed. For instance, the flow (g, ≺) described in Figure 7.4 is a maximally delayed causal flow. However, (g, ≺) is not a maximally delayed gflow since (g , ≺ ) is a more delayed gflow, where g (a0 ) = {b0 , b1 , b2 }, g (a1 ) = {b1 , b2 }, g (a2 ) = {b2 }, g (b0 ) = {c0 }, g (b1 ) = {c1 }, g (b2 ) = {b2 }, and {a0 , a1 , a2 } ≺ {b0 , b1 , b2 } ≺ {c0 , c1 , c2 }. One can prove that (g , ≺ ) is a maximally delayed gflow. Lemma 7.10.3. If (g, ≺) is a maximally delayed gflow of (G, I, O), then V0≺ = O ≺ ≺ ≺ Vk+1 = {u ∈ V L ≺ k , ∃K ⊆ L k I, Odd(K ) L k = {u}}. ≺ Proof. First, notice that for any gflow V0≺ ⊆ O and Vk+1 ⊆ {u ∈ V L ≺ k , ∃K ⊆ ≺ ≺ L k I, , Odd(K ) L k = {u}}. The rest of the proof consists in proving that these inclusions are saturated for maximally delayed gflows. Let ≺ :=≺ ((O V0≺ ) × V ). Notice that V0≺ = O. Moreover, (g, ≺ ) is a gflow of (G, I, O). Since (g, ≺ ) is not more delayed than (g, ≺), |V0≺ | ≥ |V0≺ | = |O|, so V0≺ = O. For the second inclusion, by contradiction, assume that there exist k, u 0 , and ≺ K ⊆ L≺ / Vk , u 0 ∈ V L ≺ k such that u 0 ∈ k , and Odd(K ) L k = {u}. Let (g , ≺ ) such that g (u) := g(u) if u = u 0 ; g (u 0 ) := K , u ≺ v if u = u 0 ∧ u ≺ v; and u 0 ≺ v if v ∈ K . It leads to a contradiction since (g , ≺ ) is a gflow of (G, I, O) that is more delayed than (g, ≺). 2
In a similar way, one can prove that: Lemma 7.10.4. If (g, ≺) is a maximally delayed causal flow of (G, I, O), then V0≺ = O ≺ ≺ ≺ Vk+1 = {u ∈ V L ≺ k , ∃v ∈ L k I, N G (v) L k = {u}}. Theorem 7.10.5. A maximally delayed causal flow (resp. gflow) is of minimal depth. Proof. Let (g, ≺) be a minimal depth causal flow (resp. gflow) of a given open graph. If (g, ≺) is a maximally delayed causal flow (resp. gflow), then let (g , ≺ ) := (g, ≺). Otherwise, let (g , ≺ ) be a maximally delayed causal flow (resp. gflow) which is more delayed than (g, ≺). (g , ≺ ) and (g, ≺) have the same depth. ≺ Indeed |L ≺ thus ∀k > d ≺ , Vk≺ = ∅, so d ≺ ≥ d ≺ . Since (g, ≺) is k | ≥ |L k | = |V |, of minimal depth d ≺ ≤ d ≺ , so d ≺ = d ≺ . As a consequence (g , ≺ ) is a minimal depth maximally delayed causal flow (resp. gflow). Moreover, even if a maximally delayed causal flow (resp. gflow) of a given open graph is not unique, one can prove, using Lemmas 7.10.3 and 7.10.4, that all the maximally delayed causal flows (resp. gflows) of a given open graph induce the same partition of the vertices and, as a consequence, have the same depth. Thus, the maximally delayed causal flow (resp. gflow) produced by the algorithm has the same depth as (g , ≺ ). 2
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
291
7.10.1 Generalized Flow Algorithm Theorem 7.10.6. There exists a polynomial time algorithm for deciding whether a given open graph has a gflow. Moreover, if the open graph has a gflow, then the algorithm outputs a gflow of minimal depth. Sketch of Proof. The algorithm and a complete proof are given in Mhalla and Perdrix (2008). Here we give the main ideas of the algorithm. This algorithm is searching for a maximally delayed gflow. As a consequence, if the open graph has a gflow, then the gflow produced by the algorithm is of minimal depth. This is a backward recursive algorithm based on the inductive structure of maximally delayed gflows (Lemma 7.10.3) At the first recursive call, the algorithm produces V0 := O. At the kth recursive call, the algorithm produces the set Vk+1 of vertices u ∈ V L k such that ∃K ⊆ L k I, Odd(K ) L k = {u}. Notice that for each u, there is a exponential number of candidates K ⊆ L, however an exponential slowdown is avoided by encoding this problem into a linear system over F2 : x1 V L k V L k ,L k I ... = I{u} x|L k I | where A,B := {γi, j }i∈A, j∈B is a | A| × |B|-sub-matrix of the adjacency matrix = {γi, j }i, j∈V of the graph G, and I BA stands for a |B|-dimensional vector defined by I BA (i) = 1 if i ∈ A and I BA (i) = 0 otherwise. If x1 , . . . , x|L k I | ∈ F2 is a solution to the system, then on can prove that the x1 set K ⊆ L k I such that I LKk I = ... satisfies Odd(K ) L k = {u}. 2 x|L k I |
7.10.2 Causal Flow Algorithm A first algorithm for finding a causal flow has been proposed by de Beaudrap (2008), and works only if the numbers of inputs and outputs are the same. The complexity of the algorithm is in O(nm), where n is the number of vertices and m the number of edges (more precisely O(km) where k is the number of inputs (outputs); Beaudrap, 2008). A more general and faster algorithm has been introduced by Mhalla and Perdrix (2008): Theorem 7.10.7 (Mhalla and Perdrix 2008). For a given open graph (G, I, O), finding a causal flow can be done in O(m) operations where m = |E(G)| is the number of edges of the graph G. Moreover, if the open graph has a gflow, then the algorithm outputs a gflow, of minimal depth. The proof is based on the recursive structure of maximally delayed causal flow and is presented by Mhalla and Perdrix (2008). Notice that some specific data
P1: SBT CUUS834-07
cuus834-gay
292
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
structures are used for optimizing the complexity of the algorithm and obtaining a linear algorithm.
7.11 Extended Measurement Calculus The measurements considered until now are (X, Y )-measurements, i.e., measurements defined by orthogonal projections on (X,Y )
:=
(X,Y )
:=
|+α |−α
√1 (|0 2 √1 (|0 2
+ eiα |1) − eiα |1).
In this section the measurement calculus is extended to measurements on (X, Z ) and (Y, Z ) planes (Perdrix 2006; Browne et al. 2007). Such an extension increases the expressive power of the formalism, allowing for instance the representation of one-way quantum computations based on (X, Z ) measurements, while the computational power is unchanged (Perdrix 2006). The extended measurement calculus consists in allowing (X, Y )-, (Y, Z )-, and (X, Z )-measurements on noninput qubits: • • • •
1-qubit auxiliary preparation Ni 2-qubit entanglement operators E i j 1-qubit measurements Miλ,α , with λ ∈ {(X, Y ), (Y, Z ), (X, Z )} 1-qubit Pauli operators corrections X i and Z i
(Y, Z )- and (X, Z )-measurements are defined by orthogonal projections on respectively, (Y,Z )
|+α := cos(α/2)|0 + i sin(α/2)|1 (Y,Z ) |−α := sin(α/2)|0 − i cos(α/2)|1 and (X,Z )
|+α := cos(α/2)|0 + sin(α/2)|1 (X,Z ) |−α := sin(α/2)|0 − cos(α/2)|1. Pauli operators X and Z can be pushed through the measurements (X,Y ),α
Mi
(X,Y ),−α
(7.24)
(X,Y ),α−π Mi (X,Z ),−α Mi (X,Z ),−α+π Mi (Y,Z ),α−π Mi (Y,Z ),−α+π Mi .
(7.25)
X i = Mi
(X,Y ),α Zi Mi (X,Z ),α Xi Mi (X,Z ),α Zi Mi (Y,Z ),α Xi Mi (Y,Z ),α Zi Mi
= = = = =
(7.26) (7.27) (7.28) (7.29)
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus
293
The semantics of the patterns is extended to the measurements in (X, Z ) and (Y, Z ) planes, as follows: t
[Miλ,α ]s
t
[Miλ,α ]s
V ∪ {i}, W, q, −→ V, W ∪ {i}, +λα |i q, [0/i] V ∪ {i}, W, q, −→ V, W ∪ {i}, −λα |i q, [1/i]. Theorem 7.11.1. For any extended pattern P of size n, there exists a pattern P of size O(n) composed of (X, Y )-measurements only, such that [[P]] = [[P ]]. Proof. The proof consists in replacing in P all occurrences of (X, Z ) and (Y, Z ) measurements by (X, Y ) measurements, using the following equations of projectors: (X,Z )
+α | = +α |J (−π/2)J (0) (X,Z ) −α | = −α |J (−π/2)J (0) (Y,Z )
+α | = +α |J (−π/2)J (−π/2) (Y,Z ) −α | = −α |J (−π/2)J (−π/2). Thus, we define the following set of rewrite rules: (X,Z ),α
(X,Y ),α
⇒ X Y Mk ◦ J (−π/2)( j, k) ◦ J (0)(i, j) Mi (Y,Z ),α (X,Y ),α Mi ⇒ X Y Mk ◦ J (−π/2)( j, k) ◦ J (−π/2)(i, j). This rewriting system terminates, and the size of the resulting pattern is linear in the size of the original pattern. Moreover, the rewrite rules preserve the semantics of the patterns. 2 An extended open graph (or open graph for short) is a quadruplet (G, I, O, λ), where λ : O c → {(X, Y ), (Y, Z ), (X, Z )} is a labeling function that associates with any measurement, the plane in which this measurement is performed. A correction-free extended pattern is of the following form: λ(i),αi P = (V, I, O, Mi E i j N V I ). i∈V O
(i, j)∈G
In the context of the extended measurement calculus, the extended gflow (or gflow for short) is defined as follows (Browne et al. 2007); see also Figure 7.7. Definition 7.11.2 (Extended gflow). (g, ≺) is an extended gflow of (G, I, O, λ), where g : O c → ℘(I c ) and ≺ is a strict partial order over V , if and only if (i) j ∈ g(i) ∨ j ∈ Odd(g(i)) =⇒ j = i ∨ i ≺ j (ii) i ∈ Odd(g(i)) =⇒ λ(i) ∈ {(X, Y ), (X, Z )} (iii) i ∈ g(i) =⇒ λ(i) ∈ {(Y, Z ), (X, Z )}. Theorem 7.11.3. A measurement-free extended pattern P = (G, I, O, i∈O c λ(i),αi Mi E G N I c ) can be completed with Pauli corrections into a stepwise uniformly and strongly deterministic pattern if and only if (G, I, O, λ) has a gflow.
P1: SBT CUUS834-07
cuus834-gay
294
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
≺i x N (i) x
x
x
x
even
i≺ x
i odd x
x
x g(i) x
even
x
(X, Y )-plane ≺i x N (i) x
x
x
x
odd
i≺ x
i odd x
x
x g(i) x
even
x
(X, Z )-plane ≺i x N (i) x
x
x
x
odd
i≺ x
i even x
even
x
x g(i) x x
(Y, Z )-plane Figure 7.7. The pictorial presentation of the extended flow conditions for different measurement planes. The straight lines stand for multiple edges in the entanglement graph, where the labels give the parity of the number of these connections. The qubit i denotes the qubit to be measured, its correcting set g(i) lies in the i ≺ layer. The ≺ i layer of vertices j ≺ i is split into two sets: the neighbors of i labeled with N (i) and the other vertices.
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
295
Proof. The proof is similar to those of Theorems 7.9.5 and 7.9.7. In particular, it is based on the following anachronical corrections: (X,Y ),α
(X,Y )
Mi Z isi = +αi | (Y,Z ),α si (Y,Z ) Mi Xi = +αi | (X,Z ),α si si (X,Z ) Mi X i Z i = +αi |. According to Lemma 7.9.2, for any i ∈ I c , E G N I c = C E G N I c , with C = ±Z Odd(g(i)) X g(i) . Thanks to condition 1 of the extended gflow, C does not act on already-measured qubits. Moreover, according to condition 2 and 3, the action of C on qubit i is Z if λ(i) = (X, Y ); X if λ(i) = (Y, Z ); and Z X if λ(i) = (X, Z ). So the action of C on i is exactly the action required for transforming an anachronical pattern into a valid one. 2 Finally, the algorithm for finding optimal gflow efficiently can also be adapted to the case of the extended gflow.
Pauli Measurements Pauli measurements play a central role in one-way quantum computing. In particular, it is known that the action of such a measurement on a graph state is to leave the remaining qubits in a graph state (up to a local Clifford-group correction) (Hein et al. 2004). Definition 7.11.2 provides conditions for determinism when single qubits at any angle in specified Bloch-sphere planes are allowed. The special properties of Pauli measurements (for example, that they simultaneously lie in two measurement planes) mean that if one restricts the measurement of certain qubits to certain specific Pauli measurements, one must extend the generalized flow conditions in order to account for these extra properties. In this section, we introduce such an extension (Browne et al. 2007). We will use the convention that the labeling function λ(i) for any nonoutput qubit i, is either a plane – (X, Y ), (X, Z ), or (Y, Z ) – or a vector – X , Y , or Z (i.e., Pauli measurements). First, notice that a Pauli measurement, say X , can be interpreted as an (X, Y ) or (X, Z ) measurement, and thus it may satisfy the conditions of either an (X, Y ) or an (X, Z ) measurement. Second, when a qubit is measured according to a Pauli operator, say X , then, after the measurement, the state of this qubit takes ±X as its stabilizer. We use this property to allow already-measured qubits to be included in a correcting set. Finally, the following relation between Pauli correction and Pauli measurements will be used for the Pauli flow construction: MX X = MX
(7.30)
M Y =M
(7.31)
Y
Y
M Z =M . Z
Z
(7.32)
Definition 7.11.4. An open graph state (G, I, O, λ) has Pauli flow if there exists c a map p : O c → P I (from measured qubits to a subset of prepared qubits) and a partial order < over V such that for all i ∈ O c ,
P1: SBT CUUS834-07
cuus834-gay
296
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
— (P1) if j ∈ p(i), i = j, and λ( j) ∈ / {X, Y } then i < j, — (P2) if j ≤ i, i = j, and λ( j) ∈ / {Y, Z } then j ∈ / Odd( p(i)), — (P3) if j ≤ i, j ∈ p(i) and λ( j) = Y then j ∈ Odd( p(i)), — (P4) if λ(i) = (X, Y ) then i ∈ / p(i) and i ∈ Odd( p(i)), — (P5) if λ(i) = (X, Z ) then i ∈ p(i) and i ∈ Odd( p(i)), — (P6) if λ(i) = (Y, Z ) then i ∈ p(i) and i ∈ / Odd( p(i)), — (P7) if λ(i) = X then i ∈ Odd( p(i)), — (P8) if λ(i) = Z then i ∈ p(i), — (P9) if λ(i) = Y then either: i ∈ / p(i) & i ∈ Odd( p(i)) or i ∈ p(i) & i ∈ / Odd( p(i)). Theorem 7.11.5. Suppose the open graph state (G, I, O, λ) has Pauli flow (g, >); then the pattern:
> si λ(i),αi si Pg,G := i∈O X g(i)∩{ j , j>i} Z Odd(g(i))∩{ EG NI c c j, j>i} Mi where the product follows the dependency order >, is deterministic and realizes the unitary embedding UG := i∈O c +λ(i),αi |i E G N I c . Proof. The proof is similar to the proof of Theorem 7.11.3. In (P1), if λ( j) ∈ {X, Y }, j may be in the p(i) even if j ≤ i since MiX X i = MiX and MiY X i Z i = MiY . Notice that if λ( j) = Y , j ≤ i and j ∈ p(i) then j must be in Odd( p(i)) – (P3) – because of the Z i command in MiY X i Z i = MiY . In (P2), if λ( j) = Z , then j may be in Odd( p(i)) even if j ≤ i, since MiZ Z i = Mi Z . The condition λ( j) = Y in (P2) is necessary because of (P3). Finally, (P7), (P8), and (P9) are obtained from (P4), (P5), and (P6) since a X measurement is both an (X, Y ) and an (X, Z ) measurement, and so on. 2
7.12 MBQC versus Circuit In this final section we present a novel automated technique for parallelizing quantum circuits via the forward and backward translation to measurement-based quantum computing patterns and analyze the trade-off in terms of depth and space complexity (Broadbent and Kashefi 2009). The development of parallel quantum circuits seems almost essential if we wish to implement quantum algorithms in the near future with the available technology. Due to decoherence, qubits have a tendency to spontaneously change their state; hence we can only operate on them for a very short period of time. Parallel circuits could maximize the use of these fragile qubits. As for theoretical motivation, the study of parallel quantum algorithms could lead to new results in complexity theory. For instance, one interesting open question is whether the class of decision problems solvable in polynomial time, P, is included in the class of decision problems solvable in polylogarithmic depth, NC. Let QNC be the class of decision problems solvable in
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
297
polylogarithmic depth with a quantum computer; one can ask similarly whether P is included in QNC. Finally, Richard Jozsa conjectured that: Jozsa Conjecture (Jozsa 2005). Any polynomial-time quantum algorithm can be implemented with only O(log(n)) quantum layers interspersed with polynomialtime classical computations. We first introduce a few definitions and recall that the size of a circuit is the number of gates and its depth is the largest number of gates on any input-output path. Equivalently, the depth is the number of layers that are required for the parallel execution of the circuit, where a qubit can be involved in at most one interaction per layer. Here we adopt the model according to which at any given timestep, a single qubit can be involved in at most one interaction. This differs from the concurrency viewpoint, according to which all interactions for commuting operations can be done simultaneously. Naturally the depth of a standard one-way pattern is the sum of the depths of the preparation (minimum numbers of layers required for the parallel preparation of the entanglement graph) and computation parts (the longest chain of adaptive measurements). Here, we consider only standard patterns; this is justified due to the existence of the universal standardization procedure and the result in Broadbent and Kashefi (2009), which proved that the procedure of standardization will decrease the depth of a pattern. Lemma 7.12.1. The preparation depth for a given entanglement graph G is either (G) or (G) + 1. Proof. At each timestep, a given qubit can interact with at most one other qubit. In terms of the entanglement graph, this means that at each timestep, a given node can interact with at most one of its neighbors. Assign a color to each timestep and color the edge in the entanglement graph G accordingly. With this view, the entire preparation corresponds to an edge coloring of the entanglement graph. By Vizing’s theorem (Diestel 2005), the edge-chromatic number of G, χ (G) satisfies (G) ≤ χ (G) ≤ (G) + 1. 2 For the purpose of parallelizing quantum circuits, it is enough to consider only standard patterns with flow as any quantum circuit will corresponds to such a pattern. This will allow us to obtain an upper bound on the depth of a pattern based on the depth of its flow, based on the important notion of influencing walks for open graph states with flow (Broadbent and Kashefi 2009). Definition 7.12.2. Let ( f, .) be the flow of a geometry (G, I, O). Any inputoutput walk in G that starts with a flow edge, has no two consecutive non-flow edges, and traverses flow edges in the forward direction is called an influencing walk. Proposition 7.12.3. Let a and b be two qubits in a standard pattern with flow. If b depends on a, then a appears before b on a common influencing walk, and this holds both before and after signal shifting.
P1: SBT CUUS834-07
cuus834-gay
298
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
k
l
i
j
Figure 7.8. Part of an influencing walk where two sequence of consecutive flow edges are connected with a nonflow edge.
Proof. This is a consequence of the flow theorem. Recall that before signal shifting, a measurement at a qubit j is X -dependent on the result of a measurement at another qubit i if and only if j = f (i), that is, a flow edge between qubits i and j. Also, a measurement at a qubit k is Z -dependent on the result of a measurement at another qubit i if and only if j = f (i) and k is connected to j, that is, a nonflow edge between qubits j and k connected to a flow edge between qubits i and j. Therefore signal shifting creates new dependencies only through influencing walks. Hence if qubit b depends on qubit a, it is either via a direct X or Z dependency or due to a sequence of dependencies after signal shifting; in all the cases a and b must be on a common influencing walk. 2 Proposition 7.12.3 tells us that in order to compute the quantum depth of a standard pattern with flow (to which we either have or have not applied signal shifting), it suffices to consider the depth along influencing walks. Furthermore, it is not hard to see that if a geometry has a flow, all of its influencing walks are of finite length. Note that after signal shifting, Z -dependencies coming from the nonflow edges on an influencing walk no longer contribute to the pattern depth, as the dependencies that they represent are pushed to the final correction on an output qubit. On the other hand, signal shifting can create new X -dependencies. The following proposition presents an upper bound on the effect of signal shifting on the pattern depth. Proposition 7.12.4. Let P be a pattern with flow where standardization and signal shifting have been performed. Then the maximum number of flow edges, minus the number of the nonflow edges on such a walk (maximum taken over all possible influencing walks), plus 1 is an upper bound for the depth of the pattern. Proof. We show that for any influencing walk, its number of flow edges minus the non-flow edges gives an upper bound on its depth. Then, by Proposition 7.12.3, it suffices to find the largest number of flow edges along any influencing walk in order to have an upper bound on the depth. We add 1 to this depth, since the depth is the number of vertices of such a walk and not the number of edges. Consider an influencing walk I . The flow edges represent X -dependencies. Hence each flow edge in a sequence of consecutive flow edges contributes to the depth along I . Now, consider a configuration with a non-flow edge as shown in Figure 7.8. Before signal shifting, the dependent measurements on qubits i, j, k and # are given as follows where A, B and C stand for general signals not
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
299
including si , s j , sk and s# : α
. . . D [M#α# ]sk C+si [Mkαk ] B A [M j j ]si . . . and after signal shifting we have · · · D [M#α# ]sk ⇒ ···
D
C+
si
[M#α# ]sk Sksi
C
α
[Mkαk ] B A [M j j ]si · · · α
[Mkαk ] B A [M j j ]si · · · α
⇒ · · · Sksi D [M#α# ]sk +si C [Mkαk ] B A [M j j ]si · · · . Therefore qubits j and # are in the same layer. In other words, after signal shifting, the first flow edge after every nonflow edge does not contribute to the depth of the pattern. Also, any new X -dependency created with signal shifting will not increase the depth. Hence from the total number of flow edges on an influencing walk, we need to subtract the number of nonflow edges. 2 So far we have not taken into account the information about the angles, which is why our bounds are not tight. We first describe the effect of the Pauli measurements on depth. The following identities are useful: π
π
Mi 2 X is = Mi 2 Z is Mi0 X is
=
Mi0 .
(7.33) (7.34)
According to Equation (7.33), when a qubit i is measured with angle π2 (Pauli Y measurement), then any X -dependency on this qubit is the same as a Z -dependency. But after signal shifting, this Z -dependency does not directly contribute to the depth, and hence we might obtain a smaller depth. Furthermore, there exists a special case where if qubit i is not an input qubit and also not the flow image of any other vertex (∀ j : i = f ( j)) and qubit i is measured with π2 , then one can permit, in the flow theorem, having f (i) = i, and hence we will have one less flow edge (Danos and Kashefi 2006). This allows an influencing walk to have a loop edge on this particular vertex measured with Pauli Y , and hence the influencing walk will not start with an input qubit. We will consider only this extended notion of influencing walk that takes into account the angles of measurement. When we want to emphasize this extended definition, we will refer to Pauli influencing walks. According to Equation (7.34), another special case is when qubit i is measured with angle 0 (Pauli X measurement). Then any X -correction on qubit i can be ignored, and in fact qubit i can be put at the first level of measurement. Consequently, again the flow depth can become smaller. By adding Equations (7.33) and (7.34) to the flow theorem, the proof still works (Danos and Kashefi 2006), and we get a potential improvement in the depth complexity. We refer to this procedure as Pauli simplification. Another way of realizing these special cases is that after signal shifting, the Pauli measurements become independent measurements and hence can all be performed at the first level of the partial order. Hence in
P1: SBT CUUS834-07
cuus834-gay
300
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
computing the depth of a pattern with flow after signal shifting is performed, one should disregard the Pauli measurements: Proposition 7.12.5. Let P be a pattern with flow where standardization, Pauli simplification, and signal shifting have been performed. Let Ii be a Pauli influencing walk of P, and denote by ei the number of the flow edges, by n i the number of nonflow edges, by pi the number of flow edges pointing to a qubit to be measured with a Pauli measurement, and by #i the number of loop edges (#i ∈ {0, 1}). Then the depth of the pattern, call it DP , satisfies the following formula: DP ≤ max Ii ei − (n i + pi + #i ) + 1 . Proof. Along any Pauli influencing walk, any flow edge pointing to a qubit to be measured by a Pauli X will not require a separate layer (Equation 7.34) and for the Pauli Y case, such a flow edge is converted to a Z -dependency (Equation 7.33), to be signal shifted as in Proposition 7.12.4. Also if the influencing walk starts with a Y measurement followed by a non-Pauli measurement, we have a loop edge, and hence the immediate following non-Pauli measurement can also be put in the first layer; hence we subtract the loop edge from the total depth for this influencing walk. 2
7.12.1 From Circuits to Patterns The original universality proof for MBQC already contained a method to translate a quantum circuit containing arbitrary 1-qubit rotations and control-not gates to a pattern (Raussendorf and Briegel 2001). Here, we give an alternate method for the translation of a given circuit to a standard pattern in the MBQC to attempt to reduce the quantum depth. We give the exact tradeoff in terms of the number of auxiliary qubits and depth. Recall that ∧Z is self-inverse and symmetric; hence any circuit that contains consecutive ∧Z gates acting on the same qubits can be simplified. In what follows, we suppose that this simplification has been performed. Definition 7.12.6. Let C be a circuit of ∧Z and J gates on n logical qubits. The corresponding standard pattern P is obtained by replacing each gate in C with its corresponding pattern, and then performing standardization and signal shifting. To present the exact tradeoff for the preceding translation, in particular to prove that the quantum depth cannot increase, we construct directly the underlying geometry of a given circuit. Following the literature, we refer to the circuit qubits as logical qubits. Other qubits that are added during construction of the entanglement graph will be referred to as auxiliary qubits. Definition 7.12.7. Let C be a circuit of ∧Z and J gates on n logical qubits. The entanglement graph G C is constructed as a layer that is initially built on top of the circuit C by the following steps (see also the example of Figure 7.9):
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
301
Figure 7.9. A quantum circuit with ∧Z and J (α) gates, together with the two-step construction of the corresponding entanglement graph. In the final step, an input qubit is represented by a boxed vertex and an output qubit with a white vertex. The black vertices will be measured with angles α, β, and γ , as shown in the figure.
1. Replace each ∧Z gate on logical qubits i and j with a vertical edge between two vertices: one on the ith wire and one on the jth wire. Label both vertices Input/Output. Replace each J gate on a logical qubit i with an horizontal edge between two vertices on the ith wire, label the left vertex Input and the right vertex Output. 2. To connect the foregoing components, on each wire, start from the left and contract consecutive nonadjacent vertices as follows (the contraction of vertices v1 and v2 of a graph G is obtained by replacing v1 and v2 by a single vertex v, which is adjacent to all the former neighbours of v1 and v2 ): • Two vertices labeled Input/Output are contracted as one vertex with Input/Output label; • A vertex labeled Input/Output and a vertex labeled Input are contracted as one vertex with Input label; • A vertex labeled Output and a vertex labeled Input/Output are contracted as one vertex with Output label; • Two vertices labeled Output and Input are contracted as one vertex with auxiliary label.
P1: SBT CUUS834-07
cuus834-gay
302
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
It is easy to verify the following proposition that justifies the preceding construction. Proposition 7.12.8. The graph G C obtained from Definition 7.12.7 is the entanglement graph for the measurement pattern that is obtained from Definition 7.12.6. Furthermore, input-output paths of vertices sitting on the same wire define the flow of G C . Proof. Standardization does not change the underlying entanglement graph; hence it follows that G C is indeed the entanglement graph for the measurement pattern. From de Beaudrap (2008), for the case that |I | = |O|, a collection of vertexdisjoint I − O paths in G C define the successor function f in its flow. Therefore, input-output paths of vertices sitting on the same wire define the flow of G C . 2 In order to obtain a full pattern corresponding to the circuit C, one needs to add measurement commands with angles being the same angles of the J (α) gates. These angles are assigned to the qubits labeled Input in step 1 of the construction of Definition 7.12.7. The dependency structure is the one obtained from the flow theorem. Proposition 7.12.9. Let C be a quantum circuit on n logical qubits with only ∧Z and J gates. Let G 2 be the number of J gates and D(n) the circuit depth. The corresponding pattern P given by Definition 7.12.6 has n + G 2 qubits, G 2 measurement commands, n corrections commands, and depth smaller than or equal to D(n). Proof. The proof is based on construction of Definition 7.12.7, which is obtained from replacing the patterns J (α) := X 2s1 M1−α E 12 ∧Z := E 12 for J and ∧Z gates and then performing the standardization procedure. It is clear from the construction that we start with n qubits corresponding to each wire; then any ∧Z connects the existing qubits (wires) and hence will not add to the total number of qubits. On the other hand any J gate extends the wire by adding a new qubit. This leads to the total number of n + G 2 qubits for the pattern. There are G 2 measurement commands since all but n qubits are measured. Since C has depth D(n), any influencing walk in P has at most D(n) flow edges. Hence the theorem is obtained from Proposition 7.12.4 after performing signal shifting on the corresponding pattern. 2 Alternatively, for a given circuit, one can use another construction to obtain a corresponding pattern with cluster geometry, hence to achieve constant depth for the entanglement graph preparation stage. Naturally, the price is to have more qubits. First note that the following pattern implements teleportation from input
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus In
303
Out
Figure 7.10. The geometry of the teleportation pattern given in Equation (7.35) with one input, one auxiliary, and one output qubit.
qubit i to output qubit k that is simply the identity map (see Figure 7.10): s
X k j Z ksi M 0j Mi0 E jk E i j
(7.35)
Now, if before step 2 of the construction of Definition 7.12.7, we insert the teleportation pattern between any two consecutive ∧Z acting on a common wire, then the degree of each vertex remains less than 4 as desired. We will refer to this graph as the cluster graph, GC C . In order to compute the number of qubits for the pattern obtained from this new construction, consider the positions in the circuit where two ∧Z appear after each other. These are the places where we need to apply the above teleportation pattern to keep the degree less than 4. With this construction, the depth of the pattern does not increase by more than a multiplicative constant. Therefore we have: Lemma 7.12.10. Let C be a quantum circuit on n qubits with only ∧Z and J gates. Let G 2 be the number of J gates, s the size of C, and m the number of positions in C where two ∧Z appear after each other. Then the pattern P with the cluster graph construction (obtained as in Proposition 7.12.8 with the addition of the teleportation pattern just shown) has n + G 2 + m ∈ O(n + s) qubits and depth in O(D(n)). In what follows, we always assume the cluster geometry for patterns corresponding to a circuit and hence the preparation depth is 4.
7.12.2 From Patterns to Circuits The construction of Definition 7.12.7 can be also used in reverse order to transfer a pattern with flow to a corresponding circuit, where all the auxiliary qubits will be removed and hence the quantum depth might increase. However, we now show how to obtain another transformation from patterns to circuits where one keeps all the auxiliary qubits. This construction is simply based on the well-known method of coherently implementing a measurement. Recall that a controlled-unitary operator where the control qubit is measured in the computational basis {|0, |1} can be written as a classical controlled unitary by pushing the measurement before the controlled-unitary operator (Griffiths and Niu 1996); see Figure 7.11. Given a pattern in the standard form, we use the preceding scheme in the reverse order to convert the classically dependent measurements and corrections, and then push all the independent measurements to the end of the pattern. However since the scheme works only for the computational basis measurement, we have to first simplify all the arbitrary measurements M α . Let Z (α) be the phase gate and H the
P1: SBT CUUS834-07
cuus834-gay
304
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
Z
Z
U
U
Figure 7.11. A classically controlled implementation of a controlled-unitary gate. The computational basis measurement operator is represented by the half-circle box with Z label. After pushing the measurement to the beginning of the wire, the unitary U is only classically dependent (dotted line) on the first wire.
Hadamard gate, and let M Z be the computational basis measurement (i.e., Pauli Z measurement). Then we have †
M α = M {|+α ,|−α } = M H Z (−α) {|0,|1} = M Z H Z (−α) .
(7.36)
Additionally, we replace any classical X - and Z -dependencies of measurements and any dependent corrections with a sequence of ∧X and ∧Z , which might create a quantum depth linear in the number of the dependencies, as shown in Figure 7.12. However to reduce this linear depth, we can use the following result on parallelizing a circuit with only controlled-Pauli gates to logarithmic depth: Proposition 7.12.11. (Moore and Nilsson 2002) Circuits on n qubits consisting of controlled-Pauli gates and the Hadamard gate can be parallelized to a circuit with O(log n) depth and O(n 2 ) auxiliary qubits. We can now formalize the above translation of patterns to circuits. Definition 7.12.12. Let P be a standard pattern with computational space (V, I, O), underlying geometry (G, I, O) (where G has a constant maximum degree) and command sequence (after signal shifting): · · · C j j · · · [Miαi ] Ai · · · E G C
where Ai is the set of qubits that the measurement of qubit i depends on, and C j is the set of qubits that the correction of qubit j depends on. Note that due to the signal shifting, we only have X dependencies. The corresponding coherent circuit C with |I | logical qubits and |V I | auxiliary qubits is constructed in the following steps (see also Figure 7.12): (i) Apply individual Hadamard gates on all the auxiliary qubits. (ii) Apply a sequence of ∧Z gates according to the edges of G. (iii) Replace any dependent measurement [Miαi ] Ai with MiZ Hi Z i (−α) ∧ Ai ,i X where ∧ A,i X is a sequence of controlled-not with control qubits in A and target qubit i. Note that since the M Z is independent and can be pushed to the end of the corresponding wire, it can be discarded.
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:10
7 Extended Measurement Calculus
305
Figure 7.12. Implementing coherently the sequence of dependent measurements in a pattern. An arbitrary measurement M α is represented by a half-circle labeled with its angle. The Hadamard and phase gates are shown with square boxes with the labels being H or the angle of the phase gate. The dotted arcs represent X -dependencies. Equation (7.36) is used to simplify the measurements. After replacing the X -dependencies by ∧X gates, we obtain a quantum depth linear in the number of dependencies. C
C
(iv) Replace any dependent correction X j j with ∧Ci ,i X and Z j j with ∧Ci ,i Z . (v) Replace the joint sequence of added ∧X and ∧Z in steps 3 and 4 with the parallel form obtained from Proposition 7.12.11. Lemma 7.12.13. Let P be a standard pattern with computational space (V, I, O) and underlying geometry (G, I, O) (where G has a constant maximum degree). Let t = |V O| be the number of measured qubits and let d be the quantum computation depth of P. Then the corresponding coherent circuit C obtained from Definition 7.12.12 has |I | logical qubits, O(t 3 ) auxiliary qubits, and depth in O(d log t). Proof. We examine the cost at each step of the construction of Definition 7.12.12. Steps 3 and 2 add a constant to the depth of C. At step 3, each measurement has as most t dependencies, which in step 5 translates to O(log t) depth with O(t 2 ) auxiliary qubits. At step 4, each output qubit has at most t dependencies, which again in step 5 translates to O(log t) depth with O(t 2 ) auxiliary qubits. Since the depth of P is d, the total depth of C is in O(d log t), with O(t 3 ) auxiliary qubits. 2 Note that the logarithmic increase in the depth of C is due to the fact that the circuit model does not exploit any classical dependencies. Thus the classical
P1: SBT CUUS834-07
cuus834-gay
306
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
computation of the measurement angles and corrections in P contributes to the quantum depth in C. One can combine the forward and backward construction from circuit to patterns to obtain an automated rewriting system for the circuit that can decrease the depth by adding auxiliary qubits. The following theorem gives the tradeoff. Theorem 7.12.14. Let C be a quantum circuit on n qubits with only ∧Z and J gates. Suppose C has size s and depth D. Assume further that P is the corresponding pattern obtained from the forward translation as in Lemma 7.12.10 and that P has quantum depth D (we know that D ≤ D). Then circuit C constructed from P by Definition 7.12.12 has O(s 3 + n) qubits, and depth in O(D log s). Proof. The first step is to translate C to a pattern P using Lemma 7.12.10. The resulting pattern P has O(s + n) qubits, and quantum depth in O(D). Then we translate the pattern back to a circuit C using Definition 7.12.12. By Lemma 7.12.13, the new circuit has O(s 3 ) auxiliary qubits and depth in O(D log s). 2 At first glance it seems like applying Theorem 7.12.14 to a quantum circuit would not necessarily be beneficial, since the number of auxiliary qubits and the depth seem to increase. But note that we have given only upper bounds. However, taking into account Pauli simplification and signal shifting can give a significant improvement (Broadbent and Kashefi 2009).
7.13 Conclusion In this chapter we have presented the mathematical model underlying measurement-based quantum computing and the algebra of pattern composition. More importantly, we have developed a rewrite system for patterns that preserves the semantics. We have shown further that our calculus defines a polynomialtime standardization algorithm transforming any pattern to a standard form where entanglement is done first, then measurements, then local corrections. We have inferred from this procedure that the denotational semantics of any pattern is a cptp-map and also proved that patterns with no dependencies, or using only Pauli measurements, may only implement unitaries in the Clifford group. In addition we introduced some variations of the one-way and teleportation models and presented compositional back-and-forth embeddings of these models into the one-way model. This allows one to carry forward all the theory we have developed: semantics, rewrite rules, standardization, no-dependency theorems, and universality. This shows the generality of our formalism: we expect that any yet-to-be-discovered measurement-based computation frameworks can be treated in the same way. Perhaps the most important aspect of standardization is the fact that now we can make patterns maximally parallel and distributed because all the entanglement operators, i.e., nonlocal operators, can be performed at the beginning of the computation. Then from the dependency structure that can be obtained from the standard form of a pattern, the measurements can be organized to be as parallel
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
307
as possible. This is the essence of the difference between measurement-based computation and the quantum circuit model or the quantum Turing machine. We further presented a method for projection-based pattern synthesis by exploring the phase map decomposition of unitary maps into three successive operations P, , and R. The first one represents the familiar preparation map and expands the computation space by introducing auxiliary qubits; the second one is diagonal in the computational basis and has only unit coefficients; and the last is a restriction map that contracts back the computational space into the chosen output space. It is important to emphasize that both R and P have a very simple structure, and hence the decomposition suggests that the whole quantum computing part of an algorithm is encoded in the phase map operator. Next, we addressed the fundamental question of how to transform the specification given by a projection-based pattern to an actual physical implementation as a measurement-based pattern. Indeed, what makes the measurement-based quantum computing special is the fact that one can employ probabilistic measurement operators and yet perform a deterministic computation by imposing a causal dependent structure over the measurements sequence. On the other hand the MBQC highlights the role of entanglement as a resource for quantum computing. Hence a full understanding of the MBQC depends on gaining insight into the interplay of these two ingredients. To this end we demonstrated the notion of flow on the geometry of the entanglement graph and a full characterization of stepwise uniformly deterministic computation in the one-way model independent of any reference to the circuit model together with efficient algorithm for finding the optimal depth flow. One interesting consequence of patterns with generalized flow (but no flow) is that they can admit very compact implementations of a given unitaries. In particular, the generalized flow admits a great deal of flexibility in the causal structure of the corrections that can have have little in common with the structure of the associated quantum circuit. Further investigation of such features will be a line of future research. Finally we demonstrated how forward and backward transformation between circuits and measurement patterns leads to an automated procedure of parallelization. A simple way of observing the advantages of the MBQC over the quantum circuit can be seen via the tradeoff between space and depth complexity as the transformation from a circuit to MBQC adds some auxiliary qubits and hence decreases the depth. On the other hand, one can also argue that the advantage is due to a clear separation of the types of depths that are involved in a computation: the preparation, quantum computation, and classical depths. In other words, in the circuit model, all operations are done “quantumly” whereas in a pattern, some part of the computation can be performed via classical processing.
Acknowledgments We would like to thank our collaborators and coauthors in the series of papers that this chapter is based on: Niel de Beaudrap, Anne Broadbent, Daniel Browne, Mehdi Mhalla, and Martin Roetteler.
P1: SBT CUUS834-07
cuus834-gay
308
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
Bibliography Abramsky, S., and Coecke, B. (2004) A categorical semantics of quantum protocols. In Press, I. C. S., editor, Proceedings of the 19th Annual IEEE Symposium on Logic in Computer Science (LiCS). Quant-ph/0402130. Aliferis, P., and Leung, D. W. (2004) Computation by measurements: a unifying picture. Physical Review A 70. Quant-ph/0404082. Barendregt, H. P. (1984) The Lambda Calculus, Its Syntax and Semantics. Studies in Logic. North-Holland. Benjamin, S., Eisert, J., and Stace, T. M. (2005) Optical generation of matter qubit graph states. New Journal of Physics 7. Quant-ph/0506110. Benjamin, S. C., Browne, D. E., Fitzsimons, J., and Morton, J. J. L. (2006) Brokered graph state quantum computing. New Journal of Physics 8. Quant-ph/0509209. Bennett, C., Brassard, G., Crepeau, C., Jozsa, R., Peres, A., and Wootters, W. (1993) Teleporting an unknown quantum state via dual classical and EPR channels. Physical Review Letters. Bernstein, E., and Vazirani, U. (1997) Quantum complexity theory. SIAM Journal of Computing 5(26). Bravyi, S., and Kitaev, A. (2005) Universal quantum computation with ideal clifford gates and noisy ancillas. Physical Review A 71. Quant-ph/0403025. Broadbent, A., and Kashefi, E. (2009) On parallelizing quantum circuits. Theoretical Computer Science. Browne, D., Kashefi, E., Mhalla, M., and Perdrix, S. (2007) Generalized flow and determinism in measurement-based quantum computation. New Journal of Physics 9. Browne, D. E., and Rudolph, T. (2005) Resource-efficient linear optical quantum computation. Physical Review Letters 95. Quant-ph/0405157. Chen, Q., Cheng, J., Wang, K. L., and Du, J. (2006) Efficient construction of two-dimensional cluster states with probabilistic quantum gates. Physical Review A 73. Quant-ph/0507066. Childs, A. M., Leung, D. W., and Nielsen, M. A. (2005) Unified derivations of measurementbased schemes for quantum computation. Physical Review A 71. Quant-ph/0404132. Clark, S. R., Alves, C. M., and Jaksch, D. (2005) Efficient generation of graph states for quantum computation. New Journal of Physics 7. Quant-ph/0406150. Danos, V., and Kashefi, E. (2005) Pauli measurements are universal. In Selinger (2005b). Danos, V., and Kashefi, E. (2006) Determinism in the one-way model. Physical Review A. Danos, V., Kashefi, E., Olivier, H., and Silva, M. (2006) A direct approach to fault-tolerance in measurement-based quantum computation via teleportation. New Journal of Physics. Quantph/0611273. Danos, V., Kashefi, E., and Panangaden, P. (2005) Parsimonious and robust realizations of unitary maps in the one-way model. Physical Review A 72. Danos, V., Kashefi, E., and Panangaden, P. (2007) The measurement calculus. Journal of ACM. Dawson, C. M., Haselgrove, H. L., and Nielsen, M. A. (2006) Noise thresholds for optical cluster-state quantum computation. Physical Review A 73. Quant-ph/0601066. de Beaudrap, N. (2008) Finding flows in the one-way measurement model. Physical Review A 77. de Beaudrap, N., Danos, V., and Kashefi, E. (2006) Phase map decomposition for unitaries. Quant-ph/0603266. de Beaudrap, N., Danos, V., Kashefi, E., and Roetteler, M. (2008) Quadratic form expansions for unitaries. In Theory of Quantum Computation, Communication, and Cryptography Third Workshop, TQC 2008 Tokyo, Japan, number 5106 in Lecture Notes in Computer Science. den Nest, M. V., Dehaene, J., and Moor, B. D. (2004a) An efficient algorithm to recognize local clifford equivalence of graph states. Physical Review A 70. Quant-ph/0405023. den Nest, M. V., Dehaene, J., and Moor, B. D. (2004b) Graphical description of the action of local clifford transformations on graph states. Physical Review A 69. Quant-ph/0308151. Deutsch, D. (1985) Quantum theory, the Church-Turing principle and the universal quantum computer. In Proceedings of the Royal Society of London, volume A400.
P1: SBT CUUS834-07
cuus834-gay
978 0 521 51374 6
October 31, 2009
7 Extended Measurement Calculus
15:10
309
Deutsch, D. (1989) Quantum computational networks. Proccedings of the Royal Society of London A 425. Diestel, R. (2005) Graph Theory. Springer-Verlag. Duncan, R. (2005) An abstract approach to entanglement. Mathematical Structures In Quantum Informatics, QDay II. D¨ur, W., Aschauer, H., and Briegel, H. J. (2003) Multiparticle entanglement purification for graph state. Physical Review Letters 91. Quant-ph/0303087. D¨urr, C., and Santha, M. (1996) A decision procedure for unitary linear quantum cellular automata. In Proceedings of FOCS’96 – Symposium on Foundations of Computer Science. LNCS. Quant-ph/9604007. Gilbert, G., Hamrick, M., and Weinstein, Y. S. (2005) Efficient construction of photonic quantum computational clusters. Quant-ph/0512110. Gottesman, D., and Chuang, I. L. (1999) Quantum teleportation is a universal computational primitive. Nature 402. Gottesman, D. (1997) Stabilizer codes and quantum error correction. Ph.D. thesis, California Institute of Technology. Griffiths, R., and Niu, C. (1996) Semiclassical Fourier transform for quantum computation. Physical Review Letters 76:3228–3231. Hartmann, L., D¨ur, W., and Briegel, H. J. (2005) Steady state entanglement in open and noisy quantum systems at high temperature. Quant-ph/0512219. Hein, M., Eisert, J., and Briegel, H. J. (2004) Multi-party entanglement in graph states. Physical Review A 69. Quant-ph/0307130. Jorrand, P., and Perdrix, S. (2005) Unifying quantum computation with projective measurements only and one-way quantum computation. In Ozhigov, Y. I., editor, Quantum Informatics 2004, volume 5833 of SPIE Proceedings. Quant-ph/0404125. Jozsa, R. (2005) An introduction to measurement based quantum computation. Quantph/0508124. Kay, A., Pachos, J. K., and Adams, C. S. (2006) Graph-state preparation and quantum computation with global addressing of optical lattices. Physical Review A 73. Leung, D. W. (2004) Quantum computation by measurements. International Journal of Quantum Information 2(1). Quant-ph/0310189. Mhalla, M., and Perdrix, S. (2004) Complexity of graph state preparation. Quant-ph/0412071. Mhalla, M., and Perdrix, S. (2008) Finding optimal flows efficiently. In Proceedings of 35th International Colloquium on Automata, Languages and Programming. Moore, C., and Nilsson, M. (2002) Parallel quantum computation and quantum codes. SIAM Journal on Computing 31. Nielsen, M. A. (2003) Universal quantum computation using only projective measurement, quantum memory, and preparation of the 0 state. Physical Review A 308. Nielsen, M. A. (2004) Optical quantum computation using cluster states. Physical Review Letters 93. Quant-ph/0402005. Nielsen, M. A., and Chuang, I. L. (2000) Quantum Computation and Quantum Information. Cambridge University Press. Perdrix, S. (2003) State transfer instead of teleportation in measurement-based quantum computation. International Journal of Quantum Information 3(1). Quant-ph/0402204. Perdrix, S. (2006) Formal models of quantum computation: resources, abstract machines and measurement-based quantum computation. Ph.D. thesis, Institut National Polytechnique de Grenoble, Laboratoire Leibniz. Perdrix, S. (2007) Towards minimal resources of measurement-based quantum computation. New Journal of Physics 9. Perdrix, S., and Jorrand, P. (2004) Measurement-based quantum turing machines and their universality. Quant-ph/0404146. Raussendorf, R., Anders, S., and Briegel, H. J. (2004) Fault-tolerant quantum computation using graph states. Communication to the Quantum Information and Quantum Control Conference, Fields Institute, Toronto. http://atlas-conferences.com/c/a/n/n/80.htm.
P1: SBT CUUS834-07
cuus834-gay
310
978 0 521 51374 6
October 31, 2009
15:10
Vincent Danos, Elham Kashefi, Prakash Panangaden, and Simon Perdrix
Raussendorf, R., and Briegel, H. J. (2001) A one-way quantum computer. Physical Review Letters 86. Raussendorf, R., and Briegel, H. J. (2002) Computational model underlying the one-way quantum computer. Quantum Information & Computation 2. Quant-ph/0108067. Raussendorf, R., Browne, D. E., and Briegel, H. J. (2003) Measurement-based quantum computation on cluster states. Physical Review A 68. Schlingemann, D. (2003) Cluster states, algorithms and graphs. Quant-ph/0305170. Schumacher, B., and Werner, R. F. (2004) Reversible quantum cellular automata. Quantph/0405174. Selinger, P. (2004) Towards a quantum programming language. Mathematical Structures in Computer Science 14(4). Selinger, P. (2005a) Dagger compact closed categories and completely positive maps. In Selinger (2005b). Selinger, P., editor (2005b) Proceedings of the 3nd International Workshop on Quantum Programming Languages, Electronic Notes in Theoretical Computer Science. Tame, M. S., Paternostro, M., Kim, M. S., and Vedral, V. (2004) Toward a more economical cluster state quantum computation. Quant-ph/0412156. Tame, M. S., Paternostro, M., Kim, M. S., and Vedral, V. (2006) Natural three-qubit interactions in one-way quantum computing. Physical Review A 73. Quant-ph/0507173. Unruh, D. (2005) Quantum programs with classical output streams. In Selinger (2005b). van Dam, W. (1996) Quantum cellular automata. Master’s thesis, Computer Science, Nijmegen. Walther, P., k. J. Resch, Rudolph, T., Schenck, E., Weinfurter, H., Vedral, V., Aspelmeyer, M., and Zeilinger, A. (2005) Experimental one-way quantum computing. Nature 434. Quantph/0503126. Watrous, J. (1995) On one-dimensional quantum cellular automata. In Proceedings of FOCS’95 – Symposium on Foundations of Computer Science. LNCS.
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
October 31, 2009
17:17
8 Predicate Transformer Semantics of Quantum Programs Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
Abstract This chapter presents a systematic exposition of predicate transformer semantics for quantum programs. It is divided into two parts: The first part reviews the state transformer (forward) semantics of quantum programs according to Selinger’s suggestion of representing quantum programs by superoperators and elucidates D’Hondt-Panangaden’s theory of quantum weakest preconditions in detail. In the second part, we develop a quite complete predicate transformer semantics of quantum programs based on Birkhoff–von Neumann quantum logic by considering only quantum predicates expressed by projection operators. In particular, the universal conjunctivity and termination law of quantum programs are proved, and Hoare’s induction rule is established in the quantum setting.
8.1 Introduction In the mid-1990s Shor and Grover discovered, respectively, the famous quantum factoring and searching algorithms. Their discoveries indicated that in principle quantum computers offer a way to accomplish certain computational tasks much more efficiently than classical computers, and thus stimulated an intensive investigation in quantum computation. Since then a substantial effort has been made to develop the theory of quantum computation, to find new quantum algorithms, and to exploit the physical techniques needed in building functional quantum computers, including in particular fault tolerance techniques. Currently, quantum algorithms are expressed mainly at the very low level of quantum circuits. In the history of classical computation, however, it was realized long time ago that programming languages provide a technique that allows us to think about a problem that we intend to solve in a high-level, conceptual way, rather than the details of implementation. Recently, in order to offer a similar technique in quantum computation, people began to study the principles, design and semantics of quantum programming languages; for excellent surveys see Gay (2006) and Selinger (2004). 311
P1: SBT CUUS834-08
cuus834-gay
312
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
Since it provides a goal-directed program development strategy and nondeterminacy can be accommodated well in it (Dijkstra 1976; Hesselink 1992), predicate transformer semantics has a very wide influence in classical programming methodology. With the prospect of goal-directed quantum programming, two approaches to predicate transformer semantics of quantum programs have been proposed in the literature. The first approach is to treat an observation (a measurement) procedure as a probabilistic choice. Thus, a quantum computation is naturally reduced to a probabilistic computation, and predicate transformer semantics developed for probabilistic programs (Kozen 1981; Morgan et al. 1996) can be conveniently used for quantum programs. For example, Butler and Hartel (1999) used the probabilistic weakest precondition calculus (Morgan et al. 1996) to model and reason about Grover’s algorithm. In particular, Sanders and Zuliani (2000) designed a quantum extension qGCL of the guarded-command language GCL and established a refinement calculus supporting verification and derivation of quantum programs. The second approach was proposed by D’Hondt and Panangaden (2006), where the notion of predicate is directly taken from quantum mechanics; that is, a quantum predicate is defined to be an observable (a Hermitian operator) with eigenvalues within the unit interval. In this approach, forward operational semantics of quantum programs is described by superoperators, as suggested by Selinger (2004), and an elegant Stone-type duality between the state-transformer (forward) semantics and the predicate-transformer (backward) semantics of quantum programs can be established by employing the Kraus representation theorem for superoperators. A further development of the second approach requires us to tackle some problems that would not arise in the realm of classical and probabilistic programming. One of such problems is to well define various logical operations of quantum predicates, since they will be needed to combine different quantum weakest preconditions in reasoning about complicated quantum programs. For example, conjunction and disjunction are two of the most frequently used logical operations, and it is natural to define conjunction and disjunction of quantum predicates as the greatest lower bound and the least upper bound of them, respectively, according to the L¨owner order. Unfortunately, it is known that the set of quantum predicates is not a lattice, and thus the greatest lower bound and the least upper bound of certain quantum predicates do not exist, except in the trivial case of one-dimensional state spaces (Kadison 1951). Moreover, the problem of finding necessary and sufficient conditions for the existence of the greatest lower bound and the least upper bound of quantum predicates is still unsolved for state spaces with dimension greater than 3 (Gudder 1996). Only some sufficient conditions have been discovered, and most of them are related to commutativity of quantum predicates (for a more general exposition on commutativity required in defining operations of quantum predicates, see Varadarajan 1985, Section 7.3.6). As noticed in Ying et al. (2007), however, the weakest preconditions of two commutative quantum predicates do not necessarily commute. This is an obvious obstacle in the further development of predicate transformer semantics for quantum programs, and it seems to be very difficult to overcome in the general setting.
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
313
A way to avoid the preceding difficulty is to focus our attention on a special class of quantum predicates, namely projection operators. There are at least two further reasons for choosing to consider only projectors as quantum predicates: • The first one is conceptual, and it comes from the following observation: The quantum predicates dealt with in D’Hondt and Panangaden (2006) are Hermitian operators whose eigenvalues are within the unit interval, and in a sense, they can be envisaged as quantization of probabilistic predicates. On the other hand, projection operators are Hermitian operators with 0 or 1 as their eigenvalues, and they should be thought of as quantization of classical (Boolean) predicates. Physically, the simplest type of measuring instrument is one performing so-called yes-no measurement. Only a single change may be triggered on such an instrument, and it is often called an effect by physicists. Indeed, Kraus (1983) presented an elegant reformulation of quantum mechanics in terms of effects, which are represented by projection operators. • The second reason is technical: Projection operators in a Hilbert space correspond one-onto-one to closed subspaces of this space, and the L¨owner order restricted on projection operators coincides with the inclusion between the corresponding subspaces. The set of closed subspaces of a Hilbert space was recognized by Birkhoff and von Neumann (1936) as (the algebraic counterpart of) the logic of quantum mechanics, and its structure has been thoroughly investigated in the development of quantum logic for over 70 years. Thus, we are able to exploit the power of quantum logic in our research on predicate transformer semantics of quantum logic. In particular, the greatest lower bound and least upper bound of projection operators always exist no matter whether they commute or not. This chapter presents a systematic exposition of the second approach to predicate transformer semantics of quantum programs, and in particular, we try to build a mathematical foundation for it. The chapter is organized as follows: Section 8.2 reviews the state transformer (forwards) semantics of quantum programs according to Selinger’s suggestion (Selinger 2004) of representing quantum programs by super-operators. D’Hondt-Panangaden’s theory (D’Hondt and Panangaden 2006) of quantum weakest preconditions is elucidated in detail in Section 8.3, where the problem of commutativity of quantum weakest preconditions is also examined based on the authors’ previous work (Ying et al. 2007). In Section 8.4, we develop a quite complete predicate transformer semantics of quantum programs based on Birkhoff–von Neumann quantum logic by considering only quantum predicates expressed by projection operators. More concretely, we define the notion of projective (quantum) predicate transformer and introduce various healthiness conditions for quantum programs in Subsection 8.4.3. In Subsection 8.4.4, the notion of projective weakest precondition is proposed, and Subsection 8.4.5 is devoted to examining the relationship between the D’Hondt-Panangaden quantum predicate transformer semantics and projective predicate transformer semantics. The
P1: SBT CUUS834-08
cuus834-gay
314
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
syntax and semantics of quantum commands are then presented in Subsections 8.4.6 and 8.4.8. The universal conjunctivity and termination law of quantum programs are proved in Subsection 8.4.9. The termination law is one of the main results of the present paper, and its proof requires essential applications of mathematical tools developed in quantum logic, in particular, Takeuti’s technique of strong commutator (Takeuti 1981). In Subsection 8.4.10, Hoare’s induction rule is established in the quantum setting. The main results of Section 8.4 have not been published before. We draw a brief conclusion and point out some topics for further studies in Section 8.5. To make the chapter as self-contained as possible, we briefly present preliminaries when needed.
8.2 Quantum State Transformers We recall that in the state transformer semantics of a classical imperative language a state space is simply assumed to be a nonempty set of states. Then a command in the language is interpreted as a state transformer that is a mapping from the state space into itself. To define the state transformer semantics of a quantum programming language, we need to introduce the notion of quantum state space and to give suitable interpretations of the quantum commands in the language.
8.2.1 Quantum States According to a basic postulate of quantum mechanics, the state space of an isolated quantum system is a Hilbert space. For convenience of the reader, we briefly recall some basic notions from Hilbert space theory. We write C for the set of complex numbers. For each complex number λ ∈ C, λ∗ stands for the conjugate of λ. A (complex) vector space is a nonempty set H together with two operations: vector addition + : H × H → H and scalar multiplication · : C × H → H, satisfying the following conditions: (i) (ii) (iii) (iv) (v)
(H, +) is an Abelian group, its zero element 0 is called the zero vector; 1|ϕ = |ϕ; λ(µ|ϕ) = λµ|ϕ; (λ + µ)|ϕ = λ|ϕ + µ|ϕ; and λ(|ϕ + |ψ) = λ|ϕ + λ|ψ
for any λ, µ ∈ C and |ϕ, |ψ ∈ H. An inner product over a vector space H is a mapping ·|· : H × H → C satisfying the following properties: (i) ϕ|ϕ ≥ 0 with equality if and only if |ϕ = 0; (ii) ϕ|ψ = ψ|ϕ∗ ; and (iii) ϕ|λ1 ψ1 + λ2 ψ2 = λ1 ϕ|ψ1 + λ2 ϕ|ψ2 for any |ϕ, |ψ, |ψ1 , |ψ2 ∈ H and for any λ1 , λ2 ∈ C. Sometimes, we also write (|ϕ, |ψ) for the inner product ϕ|ψ of |ϕ and |ψ. Two vectors |ϕ, |ψ in H
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
315
are said to be orthogonal and we write |ϕ ⊥ |ψ if ϕ|ψ = 0. For any vector √ |ψ in H, its length ||ψ|| is defined to be ψ|ψ. A vector |ψ is called a unit vector if ||ψ|| = 1. Let H be an inner product space, {|ψn } a sequence of vectors in H, and |ψ ∈ H. If for any > 0 there exists a positive integer N such that ||ψm − ψn || < for all m, n ≥ N , then {|ψn } is called a Cauchy sequence. If for any > 0 there exists a positive integer N such that ||ψn − ψ|| < for all n ≥ N , then |ψ is called a limit of {|ψn } and we write |ψ = limn→∞ |ψn . A family {|ψi }i∈I of vectors in H is summable with the sum |ψ and we write |ψ = i∈I |ψi if for any > 0 there is a finite subset J of I such that ψi || < ||ψ − i∈K
for every finite subset K of I containing J . A family {|ψi }i∈I of unit vectors is called an orthonormal basis of H if (i) |ψi ⊥ |ψ j for any i, j ∈ I with i = j; and (ii) |ψ = i∈I ψi |ψ|ψi for each |ψ ∈ H. A Hilbert space is a complete inner product space; that is, an inner product space in which each Cauchy sequence of vectors has a limit. Let X be a subset of Hilbert space H. If for any |ψ ∈ H and any > 0, there exists |ϕ ∈ X such that ||ψ − ϕ|| < , then we say that X is dense in H. A Hilbert space H is said to be separable if it has a countable subset dense in H. Each orthonormal basis of a separable Hilbert space must be countable. In this chapter, we consider only separable Hilbert spaces. If a Hilbert space H is the state space of a quantum system, then a pure state of the system is described by a unit vector in H. A (linear) operator on a Hilbert space H is a mapping A : H → H satisfying the following conditions: (i) A(|ϕ + |ψ) = A|ϕ + A|ψ; (ii) A(λ|ψ) = λ A|ψ for all |ϕ, |ψ ∈ H and λ ∈ C. If {|ψi } is an orthonormal basis of H, then an operator A is uniquely determined by {A|ψi }. An operator A on H is said to be bounded if there is a constant C ≥ 0 such that 2A|ψ2 ≤ C · 2ψ2 for all |ψ ∈ H. We write L(H) for the set of bounded operators on H. In this chapter we consider only bounded operators. The zero operator that maps every vector in H to the zero vector is in L(H). It is obvious that A, B ∈ L(H) implies the composition AB ∈ L(H). Moreover, L(H) is a vector space in which vector addition and scalar multiplication are defined as follows: Let A, B ∈ L(H) and λ ∈ C. Then (A + B)|ψ = A|ψ + B|ψ (λ A)|ψ = λ A|ψ
P1: SBT CUUS834-08
cuus834-gay
316
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
for each |ψ ∈ H. For any operator A ∈ L(H), there exists a unique linear operator A† on H such that (|ϕ, A|ψ) = ( A† |ψ, |ϕ) for all |ϕ, |ψ ∈ H. The operator A† is called the adjoint of A. Let A, At ∈ L(H) for all real numbers t. If lim 2(At − A)|ψ2 = 0
t→t0 +
for all |ψ ∈ H, then A is called a (strong) limit of {At } for t → t0 + and we write A = limt→t0 + At . Similarly, we can define limt→−∞ At , limt→+∞ At , and limn→∞ An for a sequence {An } of operators. The norm of a bounded operator A on H is defined to be 2A|ψ2 2A2 = sup . |ψ=0 2ψ2 To describe a quantum system whose state is not completely known, we need the notion of density operator. An operator A on a Hilbert space H is said to be positive if ψ|A|ψ ≥ 0 for all states |ψ ∈ H. An operator A is said to be a trace operator if {ψi |A|ψi }i∈I is summable for any orthonormal basis {|ψi }i∈I of H; in this case, the trace tr ( A) of A is defined to be tr ( A) = ψi | A|ψi i
where {|ψi } is an orthonormal basis of H. It can be shown that tr ( A) is independent of the choice of {|ψi }. A density operator ρ on a Hilbert space H is defined to be a positive operator with tr (ρ) = 1. Then a mixed state of a quantum system with state space H is described by a density operator on H. We shall take a slightly generalized notion of density operator in the sequel: A partial density operator ρ is a positive with tr (ρ) ≤ 1. In particular, the zero operator is a partial density operator. We can define a partial order between operators, called the L¨owner partial order: Let A, B ∈ L(H). Then A 1 B if B − A is a positive operator. Recall that a4complete partial order (CPO for short) is a partially ordered set (L , ≤) such that ∞ n=0 x n ∈ L for any increasing sequence {x n } in L. Proposition 8.2.1 (Selinger 2004, Proposition 3.6). The set of partial density operators on H, denoted by D(H), with the L¨owner partial order is a CPO, with the zero density operator as its least element. Selinger (2004) gave a proof of the preceding proposition in the case of finitedimensional H. Here we present a proof for the general case, which is essentially a modification of the proof of Theorem III.6.2 in Prugove˘cki (1981). To this end, we need the notion of square root of a positive operator, which in turn requires the spectral decomposition theorem for Hermitian operators. An operator M ∈ L(H) is said to be Hermitian if M † = M. Hermitian operators are used to
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
317
represent observables in quantum mechanics. Projectors are a special class of Hermitian operators. Let X ⊆ H. If we have |ϕ + |ψ ∈ X and λ|ϕ ∈ X for any |ϕ, |ψ ∈ X and λ ∈ C, then X is called a subspace of H. For each X ⊆ H, the closure X of X is defined to be the set of limits limn→∞ |ψn of sequences {|ψn } in X . A subspace X of a Hilbert space H is said to be closed if X = X . Let X be a closed subspace of H and |ψ ∈ H. Then there exist uniquely |ψ0 ∈ X and |ψ1 ∈ X ⊥ such that |ψ = |ψ0 + |ψ1 . The vector |ψ0 is called the projection of |ψ onto X and written |ψ0 = PX |ψ. Thus, an operator PX on H is defined and it is called the projector onto X . A spectral family on H is a family {E λ }−∞<λ<+∞ of projectors on H satisfying the following conditions: (i) E λ1 1 E λ2 whenever λ1 ≤ λ2 ; (ii) E λ = limµ→λ+ E µ for each λ; and (iii) limλ→−∞ E λ = 0H and limλ→+∞ E λ = I dH . Theorem 8.2.2 (Prugove˘cki 1981, Theorem III.6.3) (Spectral decomposition). If M is a Hermitian operator with spec(M) ⊆ [a, b], then there is a spectral family {E λ } such that b M= λd E λ , a
where the integral in the right-hand side is defined to be an operator satisfying the following condition: for any > 0, there exists δ > 0 such that for any n ≥ 1 and x0 , x1 , ..., xn−1 , xn , y1 , ..., yn−1 , yn with a = x0 ≤ y1 ≤ x1 ≤ ... ≤ yn−1 ≤ xn−1 ≤ yn ≤ xn = b, it holds that b n 2 λd E λ − yi (E xi − E xi−1 )2 < a
whenever
n (xi maxi=1
i=1
− xi−1 ) < δ.
Now we are able to define the square root of a positive operator A. Since A is a Hermitian operator, it enjoys a spectral decomposition: A = λd E λ . Then its square root is defined to be √
A=
√ λd E λ .
With these preliminaries, we can give: Proof of Proposition 8.2.1. For any positive operator A, we get: √ √ |ϕ|A|ψ|2 = |( A|ϕ, A|ψ)|2 ≤ ϕ| A|ϕψ| A|ψ by the Cauchy-Schwarz inequality.
(8.1)
P1: SBT CUUS834-08
cuus834-gay
318
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
Let {ρn } be an increasing sequence in D(H, 1). For any |ψ ∈ H, let A = ρn − ρm and |ϕ = A|ψ. Then ψ| A|ψ ≤ ψ|ρn |ψ ≤ 2ψ22 · tr (ρn ) ≤ 2ψ22 , and similarly we have ϕ|A|ϕ ≤ 2ϕ22 . Thus, it follows from Equation (8.1) that |ϕ|A|ψ|2 ≤ 2ψ22 · 2ϕ22 . Furthermore, we obtain: 2A|ψ24 4 |ψ=0 2ψ2
2A24 = sup
ϕ| A|ψ2 2ψ24 |ψ=0
= sup
2ϕ22 2 |ψ=0 2ψ2
≤ sup
2A|ψ22 = 2A22 2 |ψ=0 2ψ2
= sup and 2A2 ≤ 1. This leads to
√ √ ϕ| A|ϕ = (A A|ψ, A A|ψ) √ = 2A A|ψ22 √ ≤ 2A22 2 A|ψ22 √ √ = ( A|ψ, A|ψ) = ψ| A|ψ. Using Equation (8.1) once again we get: 2ρn |ψ − ρm |ψ24 = |ϕ| A|ψ|2 ≤ ψ| A|ψ2 = |ψ|ρn |ψ − ψ|ρm |ψ|2 . (8.2) Note that {ψ|ρn |ψ} is an increasing sequence of real numbers bounded by 2ψ22 , and thus it is a Cauchy sequence. This together with Equation (8.2) implies that {ρn |ψ} is a Cauchy sequence in H. So, we can define: ( lim ρn )|ψ = lim ρn |ψ. n→∞
n→∞
For any λ1 , λ2 ∈ C and |ψ1 , |ψ2 ∈ H, it holds that ( lim ρn )(λ1 |ψ1 + λ2 |ψ2 ) = lim ρn (λ1 |ψ1 + λ2 |ψ2 ) n→∞
n→∞
= lim (λ1 ρn |ψ1 + λ2 ρn |ψ2 ) n→∞
= λ1 lim ρn |ψ1 + λ2 lim ρn |ψ2 n→∞
n→∞
= λ1 ( lim ρn )|ψ1 + λ2 ( lim ρn )|ψ2 , n→∞
n→∞
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
319
and limn→∞ ρn is a linear operator. For any |ψ ∈ H, we have: ψ| lim ρn |ψ = (|ψ, lim ρn |ψ) = lim ψ|ρn |ψ ≥ 0. n→∞
n→∞
n→∞
Thus, limn→∞ ρn is positive. Let {|ψi } be an orthonormal basis of H. Then ψi | lim ρn |ψi tr ( lim ρn ) = n→∞
n→∞
i
(|ψi , lim ρn |ψi ) = n→∞
i
ψi |ρn |ψi = lim n→∞
i
= lim tr (ρn ) ≤ 1, n→∞
4 and limn→∞ ρn ∈ D(H). So, it suffices to show that limn→∞ ρn = ∞ n=0 ρn ; that is, (i) ρm 1 limn→∞ ρn for all m ≥ 0; and (ii) if ρm 1 ρ for all m ≥ 0, then limn→∞ ρn 1 ρ. Note that for any positive operators B and C, B 1 C if and only if ψ|B|ψ ≤ ψ|C|ψ for all |ψ ∈ H. Then both (i) and (ii) follow immediately from ψ| limn→∞ ρn |ψ = limn→∞ ψ|ρn |ψ. Intuitively, each ρ ∈ D(H) may be interpreted as a partially computed result, and thus 1 − tr (ρ) is the probability that the result is still not computed at the stage represented by ρ. Note that if ρ1 1 ρ2 then tr (ρ1 ) ≤ tr (ρ2 ). This fact fits Scott’s interpretation (Scott 1970) of the partial order in a computational domain very well: ρ1 1 ρ2 means that more computation might improve ρ1 to a possibly better-computed result ρ2 .
8.2.2 Unitary Transformations We now turn to consider interpretations of quantum commands. There are two classes of basic quantum commands: unitary transformations and quantum measurements. An operator U on H is called a unitary transformation if U † U = I dH , where I dH is the identity operator on H; that is, I dH |ψ = |ψ for all |ψ ∈ H. The basic postulate of quantum mechanics about evolution of systems may be stated as follows: Suppose that the states of a closed quantum system at times t0 and t are |ψ0 and |ψ, respectively. Then they are related to each other by a unitary operator U that depends only on the times t0 and t, |ψ = U |ψ0 . This postulate can be reformulated in the language of density operators as follows: The state ρ of a closed quantum system at time t is related to its state ρ0 at time t0 by a unitary operator U that depends only on the times t and t0 , ρ = Uρ0 U † .
P1: SBT CUUS834-08
cuus834-gay
320
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
8.2.3 Quantum Measurements A quantum measurement on a system with state space H is described by a collection {Mm } of operators on H satisfying Mm† Mm = I dH , m
where Mm are called measurement operators, and the index m stands for the measurement outcomes that may occur in the experiment. If the state of a quantum system is |ψ immediately before the measurement, then the probability that result m occurs is p(m) = ψ|Mm† Mm |ψ and the state of the system after the measurement is Mm |ψ |ψm = 5 . p(m) We can also formulate the quantum measurement postulate in the language of density operators. If the state of a quantum system was ρ immediately before measurement {Mm } is performed on it, then the probability that result m occur is p(m) = tr (Mm† Mm ρ), and the state of the system after the measurement is †
ρm =
Mm ρ Mm . p(m)
8.2.4 Superoperators Unitary transformations are suited to describe the dynamics of closed quantum systems. For open quantum systems, however, one of the key mathematical formalisms for the description of their state transformations is the notion of superoperator. To define this notion, we need to introduce tensor product of Hilbert spaces. Let H be a Hilbert space with orthonormal basis {|ϕi } and K a Hilbert space with orthonormal basis {|ψ j }. Then their tensor product is defined to be H⊗K ={
i, j
αi j |ϕi ψ j : αi j ∈ C with
|αi j |2 < ∞}.
i, j
Vector addition, scalar multiplication, and inner product are defined on H ⊗ K in a natural way: Let | = i, j αi j |ϕi ψ j , | = i, j βi j |ϕi ψ j ∈ H ⊗ K and
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
λ ∈ C. Then | + | =
321
(αi j + βi j )|ϕi ψ j ,
i, j
λ| =
λαi j |ϕi ψ j ,
i, j
| =
αi∗j βi j .
i, j
It is easy to show thatH ⊗ K is a Hilbert space with {|ϕi ψ j } as an orthonormal basis. For any |ϕ = i αi |ϕi ∈ H and |ψ = j β j |ψ j ∈ K, we define: αi β j |ϕi ψ j . |ϕ ⊗ |ψ = i, j
If A ∈ L(H) and B ∈ L(K), then A ⊗ B ∈ L(H ⊗ K) is defined by ( A ⊗ B)|ϕi ψ j = A|ϕi ⊗ B|ψ j for all i, j. Suppose that E is an operator on L(H) and F an operator on L(K). Then E ⊗ F is defined to be an operator on L(H ⊗ K) and it is given as follows: For each C ∈ L(H ⊗ K), we can write: C= αk ( Ak ⊗ Bk ) k
where Ak ∈ L(H) and Bk ∈ L(K) for all k, and we define: αk (E( Ak ) ⊗ F(Bk )). (E ⊗ F)(C) = k
By linearity we may assert that E ⊗ F is well defined; that is, (E ⊗ F)(C) is independent of the choice of Ak and Bk . A superoperator on H is a linear operator E from the space L(H) into itself that satisfies the following two conditions: (i) tr [E(ρ)] ≤ tr (ρ) for each ρ ∈ D(H); (ii) (Complete positivity) For any extra Hilbert space H R , (I R ⊗ E)(A) is positive provided A is a positive operator on H R ⊗ H, where I R is the identity operator on L(H R ); that is, I R ( A) = A for each operator A on H R . We write SO(H) for the set of superoperators on H. The Kraus theorem gives some useful representations of superoperators. Theorem 8.2.3 (Kraus 1983, Theorems 3.1 and 5.2; Nielsen and Chuang 2000, Section 8.2.3, Theorem 8.1). The following statements are equivalent: (i) E is a superoperator on H; (ii) (System-environment model) There are an environment system E with state space H E and a unitary transformation U on H ⊗ H E and a projector P
P1: SBT CUUS834-08
cuus834-gay
322
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
onto some closed subspace of H ⊗ H E such that E(ρ) = tr E [PU (ρ ⊗ |e0 e0 |)U † P]
(8.3)
for any ρ ∈ D(H), where |e0 is a fixed state in H E . (iii) (Operator-sum representation) There exists a finite or countably infinite † set of operators {E i } on H such that i E i E i 1 I and † E(ρ) = Ei ρ Ei (8.4) i
for all density operators ρ ∈ D(H). We often say that E is represented by the set {E i } of operators, or {E i } are operation elements giving rise to E when E is given by Equation (8.4). The proof of the foregoing theorem is omitted here, and the reader can find it in Kraus (1983), Chapters 3 and 5, or Nielsen and Chuang (2000), Chapter 8. A basic principle of Scott’s theory of computation (Scott 1970) is that computable functions on domains are continuous. Let (L , ≤) be a CPO. Then a function f from L into itself is said to be continuous if 6 6 f ( xn ) = f (xn ) n
n
for any increasing sequence {xn } in L. Proposition 8.2.4 Each superoperator is a continuous function from (D(H), 1) into itself. Proof. Suppose that E is a superoperator whose operation elements are {E i }, and {ρn } is an increasing sequence in D(H). Then by Proposition 8.2.1 we obtain: 6 E( ρn ) = E( lim ρn ) n→∞
n
=
i
= lim
†
E i ( lim ρn )E i
n→∞
n→∞
†
E i ρn E i
i
= lim E(ρn ) n→∞ 6 E(ρn ). = n
The preceding lemma guarantees that it is reasonable to interpret a program as a superoperator in the state transformer (forward) semantics of a quantum programming language. For any real number λ ≥ 0, and E, F ∈ SO(H), λE and E + F are completely positive, but they may not be superoperators because they do not necessarily satisfy the first condition in the definition of superoperator. On the other hand, it is easy
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
323
to see that E ◦ F is a superoperator. The L¨owner partial order induces a partial order between superoperators in a natural way: Let E, F ∈ SO(H). Then E 1 F if E(ρ) 1 F(ρ) for all ρ ∈ D(H). Proposition 8.2.5 (Selinger 2004, Lemma 6.4) . The set (SO(H), 1) of superoperators on H is a CPO. Proof. Let {En } be an increasing sequence in (SO(H), 1). Then for any ρ ∈ D(H), {En (ρ)} is an increasing sequence in (D(H), 1). With Proposition 8.2.1 we can define: 6 6 ( En )(ρ) = En (ρ) = lim En (ρ), n
and it holds that tr ((
6
n→∞
n
En )(ρ)) = tr ( lim En (ρ)) = lim tr (En (ρ)) ≤ 1 n→∞
n
n→∞
4 because tr (·) is continuous. Furthermore, 4n En can be defined on 4 the whole of L(H) by linearity. The defining equation of n En implies: (i) Em 1 n En for all 4 m ≥ 0; and (ii) if Em 1 F for all m ≥ 0 then n En 1 F. So, it suffices to show 4 that n En is completely positive. Suppose that H R is an extra Hilbert space. For any C ∈ L(H R ) and D ∈ L(H), we have: 6 6 (I R ⊗ En )(C ⊗ D) = C ⊗ ( En )(D) n
n
= C ⊗ lim En (D) n→∞
= lim (C ⊗ En (D)) n→∞
= lim (I R ⊗ En )(C ⊗ D). n→∞
Then for any A ∈ L(H R ⊗ H) we get: 6 (I R ⊗ En )(A) = lim (I R ⊗ En )(A) n
n→∞
by linearity. Thus, if A is positive, then (I R ⊗ En )(A) is positive for all n, and 4 (I R ⊗ n En )(A) is positive. The preceding proposition allows us to introduce recursion in the setting of superoperators. Let F be a continuous function from (SO(H), 1) into itself. Then we define: µX .F(X ) =
∞ 6
F(n) (0);
n=0
that is, µX .F(X ) is the least fixed point of F, where 0 is the zero superoperator, which maps all elements of D(H) to the zero density operator and corresponds to the divergent program, F(0) = 0, and F(n+1) (0) = F(F(n) (0)) for all n ≥ 0.
P1: SBT CUUS834-08
cuus834-gay
324
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
8.3 Quantum Weakest Preconditions: D’Hondt-Panangaden Approach 8.3.1 Hermitian Operators as Quantum Predicates The first step to present predicate transformer semantics of a quantum programming language is to define the notion of quantum predicate. By a careful analysis and comparison with the classical and probabilistic cases, D’Hondt and Panangaden (2006) argued that quantum predicates should be physical observables. Their approach was originally presented in the setting of finite-dimensional state spaces, but it can be easily generalized to the case of infinite-dimensional state spaces. To motivate the definition of quantum predicate in an easier way, we first consider a finite-dimensional Hilbert space H. According to a basic postulate, an observable of a quantum system is described by a Hermitian operator on its state space. An eigenvector of an operator A on H is a nonzero vector |ψ ∈ H such that A|ψ = λ|ψ for some λ ∈ C, where λ is called the eigenvalue of A corresponding to |ψ. It is easy to see that all eigenvalues of a Hermitian operator are real numbers. The set of eigenvalues of A is called the (point) spectrum of A and denoted spec( A). For each eigenvalue λ of an operator A, the set {|ψ ∈ H : A|ψ = λ|ψ} is a closed subspace of H and it is called the eigenspace corresponding to λ. It is well known that an observable (a Hermitian operator) M determines a so-called projective measurement {Pm }, where m ranges over spec(M), and Pm is the projector onto the eigenspace of M corresponding to m for each eigenvalue m. The eigenvalues m stand for the possible outcomes of the measurement. As to quantum predicates, their eigenvalues should be understood as the truth values of certain propositions about quantum systems. Note that the truth value of a classical proposition is either 0 (false) or 1 (true), and the truth value of a probabilistic proposition is given as a real number between 0 and 1. This observation leads to the following: Definition 8.3.1 (D’Hondt and Panangaden 2006, Definition 2.2). A (quantum) predicate on H is a Hermitian operator M on H with all its eigenvalues lying within the unit interval [0, 1]. The set of predicates on H is denoted P(H). The state space H in the foregoing definition and the following development can be infinite-dimensional unless it is explicitly stated to be finite-dimensional. For any M ∈ P(H), we have 0H 1 M 1 I dH , where 0H is the zero operator on H; that is, 0H |ψ = 0 for all |ψ ∈ H. Recall that tr (Mρ) is the expectation value of measurement outcomes when a quantum system is in the mixed state ρ and we perform the projective measurement determined by observable M on it. Thus, if M is a quantum predicate, then tr (Mρ) may be interpreted as the degree to which quantum state ρ satisfies quantum predicate M, or more precisely the average truth value of the proposition represented by M in a quantum system of the state ρ. The reasonableness of
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
325
the preceding definition is further indicated by the following fact: A Hermitian operator M is a quantum predicate if and only if 0 ≤ tr (Mρ) ≤ 1 for all ρ ∈ D(H). The following proposition examines the structure of quantum predicates with respect to the L¨owner partial order. Proposition 8.3.2 (Selinger 2004, Proposition 3.6; D’Hondt and Panangaden 2006, Proposition 2.3) . The set (P(H), 1) of quantum predicates with the L¨owner partial order is a CPO. Proof. Similar to the proof of Proposition 8.2.1.
As mentioned in the introduction, (P(H), 1) is not a lattice except in the trivial case of one-dimensional state space; that is, the greatest lower bound and least upper bound of elements in (P(H), 1) are not always defined.
8.3.2 Quantum Weakest Preconditions: Definitions and Representations Now we are ready to define the two key notions in this section, i.e., quantum generalization of Hoare assertion and quantum weakest precondition. Definition 8.3.3 (D’Hondt and Panangaden 2006, Definition 3.1). For any quantum predicates M, N ∈ P(H), and for any quantum program E ∈ SO(H), M is called a precondition of N with respect to E, written M{E}N , if tr (Mρ) ≤ tr (N E(ρ))
(8.5)
for all density operators ρ ∈ D(H). The intuitive meaning of condition (8.5) comes immediately from the interpretation of satisfaction relation between quantum states and quantum predicates: if state ρ satisfies predicate M then the state after transformation E from ρ satisfies predicate N . Definition 8.3.4 (D’Hondt and Panangaden 2006, Definition 3.2) . Let M ∈ P(H) be a quantum predicate and E ∈ SO(H) a quantum program. Then the weakest precondition of M with respect to E is a quantum predicate wp(E)(M) satisfying the following conditions: (i) wp(E)(M){E}M; (ii) for all quantum predicates N , N {E}M implies N 1 wp(E)(M). For each E ∈ SO(H), the foregoing definition gives a quantum predicate transformer wp(E) : P(H) → P(H). An operator-sum representation of wp(E) was found in D’Hondt and Panangaden (2006) by exploiting a Stone-type duality bet-
P1: SBT CUUS834-08
cuus834-gay
326
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
ween forward state transformers and backward predicate transformers when E is given in the form of operator-sum. Proposition 8.3.5 (D’Hondt and Panangaden 2006, Proposition 3.3). Suppose that program E ∈ SO(H) is represented by the set {E i } of operators. Then for each predicate M ∈ P(H), we have: † wp(E)(M) = Ei M Ei . (8.6) i
Proof. We see from Definition 8.3.4 that weakest precondition wp(E)(M) is unique when it exists. Then we only need to check that wp(E)(M) given by Equation (8.6) satisfies the two conditions in Definition 8.3.4. (i) Since tr ( AB) = tr (B A) for any A, B ∈ L(H), we have: † tr (wp(E)(M)ρ) = tr (( E i M E i )ρ) =
i †
tr (E i M E i ρ)
i
=
†
tr (M E i ρ E i )
i
= tr (M(
(8.7)
†
E i ρ E i ))
i
= tr (ME(ρ)) for each ρ ∈ D(H). Thus, wp(E)(M){E}M. (ii) It is easy to show that for any M, N ∈ P(H), M 1 N if and only if tr (Mρ) ≤ tr (Nρ) for all ρ ∈ D(H). Thus, if N {E}M, then for any ρ ∈ D(H) we have tr (Nρ) ≤ tr (ME(ρ)) = tr (wp(E)(M)ρ). Therefore, it follows immediately that N 1 wp(E)(M). We can also give an intrinsic characterization of wp(E) in the case that E is given by a system-environment model. Proposition 8.3.6 (Ying et al. 2007, Proposition 2.2). If E is given by Equation (8.3), then we have: wp(E)(M) = e0 |U † P(M ⊗ I E )PU |e0 for each M ∈ P(H), where I E is the identity operator in the environment system. Proof. Let {|ek } be an orthonormal basis of H E . Then E(ρ) = ek |PU |e0 ρe0 |U † P|ek , k
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
327
and using Proposition 8.3.5 we obtain: wp(E)(M) = e0 |U † P|ek Mek |PU |e0 k
= e0 |U † P(
|ek Mek |)PU |e0 .
k
Note that k |ek Mek | = M ⊗ I E because {|ek } is an orthonormal basis of Hk . This completes the proof. To conclude this section, we collect basic algebraic properties of quantum weakest preconditions in the following proposition. Proposition 8.3.7 Let λ ≥ 0 and E, F ∈ SO(H), and let {En } be an increasing sequence in SO(H). Then (i) wp(λE) = λwp(E) provided λE ∈ SO(H); (ii) wp(E + F) = wp(E) + wp(F ) provided E + F ∈ SO(H); (iii) wp(E ) ◦ wp(E); 4◦ F) = wp(F 4∞ (iv) wp( ∞ n=0 En ) = n=0 wp(En ), where (
∞ 6
de f
wp(En ))(M) =
n=0
∞ 6
wp(En )(M)
n=0
for any M ∈ P(H). Proof. (i) and (ii) are immediately from Proposition 8.3.5. (iii) It is easy to see that L{E}M{F}N implies L{E ◦ F}N . Thus, we have wp(E)(wp(F )(M)){E ◦ F}M. On the other hand, we need to show that N 1 wp(E)(wp(F )(M)) whenever N {E ◦ F}M. In fact, for any ρ ∈ D(H), it follows from Equation (8.7) that tr (Nρ) ≤ tr (M(E ◦ F)(ρ)) = tr (MF(E(ρ))) = tr (wp(F )(M)E(ρ)) = tr (wp(E)(wp(F )(M))ρ). Therefore, we obtain wp(E ◦ F)(M) = wp(E)(wp(F )(M)) = (wp(F ) ◦ wp(E))(M). (iv) We note that the following two equalities follow immediately from the proof of Proposition 8.2.1: ∞ ∞ 6 6 M( Mn ) = M Mn , n=0
tr (
∞ 6 n=0
n=0
Mn ) =
∞ 6 n=0
tr (Mn ).
P1: SBT CUUS834-08
cuus834-gay
328
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
First, we prove that D(H), we have: tr (
∞ 6
4∞ n=0
wp(En )(M){
wp(En )(M)ρ) =
n=0
4∞ n=0
∞ 6 n=0 ∞ 6
≤
En }M. Indeed, for any ρ ∈
tr (wp(En )(M)ρ) tr (MEn (ρ))
n=0
= tr (
∞ 6
MEn (ρ))
n=0
= tr (M(
∞ 6
En )(ρ)).
n=0
4 4∞ Second, we show that N { ∞ n=0 En }M implies N 1 n=0 wp(En )(M). It suffices to note that ∞ 6 tr (Nρ) ≤ tr (M( En )(ρ)) n=0
= tr (
∞ 6
MEn (ρ))
n=0
= =
∞ 6 n=0 ∞ 6
tr (MEn (ρ)) tr (wp(En )(M)ρ)
n=0
= tr ((
∞ 6
wp(En ))(M)ρ)
n=0
4∞
for all ρ ∈ D(H). Thus, it holds that wp( wp(En )(M).
n=0
En )(M) =
4∞ n=0
Corollary 8.3.8. Let F be a continuous function from (SO(H), 1) into itself. Then wp(µX .F(X )) =
∞ 6
wp(F(n) (0)).
n=0
Proof. Immediate from Proposition 8.3.7(iv).
8.3.3 Commutativity of Quantum Weakest Preconditions Quantum predicate transformer semantics is not a simple generalization of predicate transformer semantics for classical and probabilistic programs. It has to answer some important problems that would not arise in the realm of classical and probabilistic programming. One such problem is commutativity of quantum
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
329
weakest preconditions. The significance of this problem comes from the following observation: Quantum weakest preconditions are quantum predicates and in turn they are observables on the state space. Thus, their physical simultaneous verifiability depends on commutativity between them according to the Heisenberg uncertainty principle (see Nielsen and Chuang 2000, page 89). The aim of this subsection is to find some conditions under which quantum weakest preconditions commute. Recall that for any two operators A and B on H, it is said that A and B commute if AB = B A. What concerns us in this subsection is the following: Question 8.3.9. Given a quantum program E ∈ SO(H). When do wp(E)(M) and wp(E)(N ) commute? This question seems very difficult to answer for a general superoperator E. We first see a simple example from quantum communication. Example 8.3.10 (Nielsen and Chuang 2000, Section 8.3) (Bit flip and phase flip channels). A qubit is a quantum state of the form |ψ = α0 |0 + α1 |1, where |0 and |1 are two basis states, and α0 and α1 are complex numbers with |α0 |2 + |α1 |2 = 1. Thus, the state space of qubits is the 2-dimensional Hilbert space H2 = C2 , and linear operators on H2 can be represented by 2 × 2 matrices. Bit flip and phase flip are quantum operations on a single qubit, and they are widely used in the theory of quantum error-correction. We write the Pauli matrices: 1 0 0 1 I = , X= , 0 1 1 0 Y =
0 i
−i 0
, Z=
1 0
0 . −1
Then the bit flip is defined by †
†
(8.8) E(ρ) = E 0 ρ E 0 + E 1 ρ E 1 , √ √ where E 0 = p I and E 1 = 1 − p X. It is easy to see that E(M) and E(N ) commute when M N = N M and M X N = N X M. √ √ If E 1 in Equation (8.8) is replaced by 1 − p Z (resp. 1 − pY ), then E is the phase flip (resp. bit-phase flip), and E(M) and E(N ) commute when M N = N M and M Z N = N Z M (resp. MY N = N Y M). Now we consider the simplest superoperators: unitary transformations and projective measurements. Proposition 8.3.11. (i) Let E ∈ SO(H) be a unitary transformation, i.e., E(ρ) = UρU † for any ρ ∈ D(H), where UU † = U † U = I dH . Then wp(E)(M) and wp(E)(N ) commute if and only if M and N commute.
P1: SBT CUUS834-08
cuus834-gay
330
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
(ii) Let {Pk } be a projective measurement, i.e., Pk1 Pk2 = δk1 k2 Pk1 and I dH , where % 1, if k1 = k2 , δk1 k2 = 0, otherwise.
k
Pk =
If E is given by this measurement, with the result of the measurement unknown, i.e., E(ρ) = Pk ρ Pk k
for each ρ ∈ D(H), then wp(E)(M) and wp(E)(N ) commute if and only if Pk M Pk and Pk N Pk commute for all k. In particular, let {|i} be an orthonormal basis of H. If E is given by the measurement in the basis {|i}, i.e., E(ρ) = Pi ρ Pi , i
where Pi = |ii| for each i, then wp(E)(M) and wp(E)(N ) commute for any M, N ∈ P(H). Proof. (i) From Proposition 8.3.5 we obtain: wp(E)(M)wp(E)(N ) = U † MUU † N U = U † M N U. Then M N = U wp(E)(M)wp(E)(N )U † , and the conclusion follows. (ii) We first obtain: wp(E)(M)wp(E)(N ) = Pk M Pk Pl N Pl = Pk M Pk N Pk . k,l
k
Similarly, it holds that wp(E)(N )wp(E)(M) =
Pk N Pk M Pk .
k
It is clear that wp(E)(M)wp(E)(N ) = wp(E)(N )wp(E)(M) if Pk M Pk and Pk N Pk commute. Conversely, if wp(E)(M)wp(E)(N ) = wp(E)(N )wp(E)(M), then by multiplying Pk in the both sides we obtain: Pl M Pl N Pl ) = Pk ( Pl N Pl M Pl ) = Pk N Pk M Pk . Pk M Pk N Pk = Pk ( l
l
For the case of Pi = |ii| for each i, it holds that Pi M Pi N Pi = |ii|M|ii|N |ii|. Note that i|M|i and i|M|i are complex numbers, and they commute. Thus, Pi M Pi N Pi = Pi N Pi M Pi always holds.
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
331
For a general superoperator E, we are only able to give some sufficient conditions for commutativity of wp(E)(M) and wp(E)(N ). We first consider the case where E is given in a operator-sum form. Proposition 8.3.12. Suppose that H is finite-dimensional. Let M, N ∈ P(H) and they commute, i.e., there exists an orthonormal basis {|ψi } of H such that M= λi |ψi ψi |, N = µi |ψi ψi | i
i
where λi , µi are reals for each i (Nielsen and Chuang 2000, Theorem 2.2), and let E ∈ SO(H) be represented by the set {E i } of operators. If for any i, j, k, l, we have either λk µl = λl µk or ψk |E i |ψm ψl |E j |ψm = 0, m
then wp(E)(M) and wp(E)(N ) commute. Proof. We consider the matrix representations of the involved operators with respect to the basis {|ψi }. For any i, j, a routine calculation leads to †
†
M E i E j N = (λk µl ekl )k,l and N E i E j M = (µk λl ekl )k,l , where ekl =
† ψk |E i |ψm ψm |E j |ψl m †
for all k, l. Then the condition given in this proposition implies M E i E j N = † N E i E j M.
It follows from Proposition 8.3.5 that † † † † E i M E i )( Ei N Ei ) = Ei M Ei E j N E j , wp(E)(M) · wp(E)(N ) = ( i
i
and wp(E)(M)wp(E)(N ) = wp(E)(N )wp(E)(M).
i, j
(8.9)
To present another sufficient condition for commutativity of quantum weakest preconditions, we need to introduce commutativity between a quantum program and a quantum predicate. Definition 8.3.13. Let E ∈ SO(H) be represented by the set {E i } of operators, and let M ∈ P(H). Then we say that quantum predicate M and quantum program E commute if M and E i commute for each i. It seems that in the foregoing definition commutativity between quantum predicate M and quantum program E depends on the choice of operators E i in the Kraus representation of E. Thus, one may wonder if this definition is intrinsic because such operators are not unique. To address this problem, we need the following: Lemma 8.3.14 (Nielsen and Chuang 2000, Theorem 8.2) (Unitary freedom in the operator-sum representation). Suppose that {E i } and {F j } are operation elements
P1: SBT CUUS834-08
cuus834-gay
332
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
giving rise to quantum operations E and F, respectively. By appending zero operators to the shortest list of operation elements we may ensure that the numbers of E i and F j are the same. Then E = F if and only if there exist complex numbers u i j such that Ei =
ui j F j
j
for all i, and U = (u i j ) is (the matrix representation of) a unitary operator. As a simple corollary, we can see that commutativity between M and E is irrelevant to the choice of the Kraus representation operators of E. Lemma 8.3.15. The notion of commutativity between observables and quantum operations is well-defined. More precisely, suppose that E is represented by both {E i } and {F j }. Then M and E i commute for all i if and only if M and F j commute for all j.
Proof. Immediate from Lemma 8.3.14.
Commutativity between observables and quantum operations is preserved by composition of quantum operations. Proposition 8.3.16. Let M ∈ P(H) be a quantum predicate, and let E1 , E2 ∈ SO(H) be two quantum programs. If M and Ei commute for i = 1, 2, then M commutes with the composition E1 ◦ E2 of E1 and E2 . Proof. Suppose that E1 is represented by {E i } and E2 is represented by {F j }. Then for any ρ ∈ D(H), we have: † † (E1 ◦ E2 )(ρ) = E2 (E1 (ρ)) = F j Ei ρ Ei F j . i, j
With Lemma 8.3.15 it suffices to note that M(F j E i ) = F j M E i = (F j E i )M for all i, j. The following proposition gives another sufficient condition for commutativity of wp(E)(M) and wp(E)(N ). Proposition 8.3.17. Let M, N ∈ P(H) be two quantum predicates, and let E ∈ SO(H) be a quantum program. If M and N commute, M and E commute, and N and E commute, then wp(E)(M) and wp(E)(N ) commute. Proof. Since M and E i commute, N and E j commute for all i, j, and N is Hermitian, i.e., N † = N , we have: †
†
M E i E j N = E i M E j N † = E i M(N E j )† †
†
= E i M(E j N )† = E i M N † E j = E i M N E j
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
and from Equation (8.9) we obtain: wp(E)(M) · wp(E)(N ) =
†
†
†
†
333
Ei Ei M N E j E j .
i, j
Similarly, it holds that wp(E)(N ) · wp(E)(M) =
Ei Ei N M E j E j .
i, j
Then commutativity between M and N implies wp(E)(M) · wp(E)(N ) = wp(E)(N ) · wp(E)(M). It is easy to see from Proposition 8.3.11 that the condition for commutativity of wp(E)(M) and wp(E)(N ) given in Proposition 8.3.17 is not necessary. Now we turn to consider the system-environment model of superoperator. To this end, we need two generalized notions of commutativity between linear operators. Definition 8.3.18. Let M, N , A, B, C ∈ L(H). (i) If AM B N C = AN B MC, then we say that M and N ( A, B, C)-commute. In particular, it is simply said that M and N A-commute when M and N (A, A, A)-commute; (ii) If AB † = B A† , then we say that A and B conjugate-commute. Obviously, commutativity is exactly I dH -commutativity. The next two propositions presents several conditions for commutativity of quantum weakest preconditions when quantum programs are given in the systemenvironment model. Proposition 8.3.19. Let E be given by Equation (8.3), and we write A = PU |e0 . (i) wp(E)(M) and wp(E)(N ) commute if and only if M ⊗ I E and N ⊗ I E ( A† , A A† , A)−commute; (ii) If (M ⊗ I E ) A and (N ⊗ I E ) A conjugate-commute, then wp(E)(M) and wp(E)(N ) commute.
Proof. Immediate from Proposition 8.3.6.
Proposition 8.3.20. Suppose that H is finite-dimensional. Let E be given by Equation (8.3), and let M, N ∈ P(H) and they commute, i.e., there exists an orthonormal basis {|ψi } of H such that λi |ψi ψi |, N = µi |ψi ψi | M= i
i
where λi , µi are reals for each i. If for any i, j, k, l, we have λi µ j = λ j µi or e0 |U † P|ψi ek ⊥e0 |U † P|ψ j el , then wp(E)(M) and wp(E)(N ) commute.
P1: SBT CUUS834-08
cuus834-gay
334
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
Proof. For any i, j, k, l, it holds that ψi ek |(M ⊗ I E )PU |e0 e0 |U † P(N ⊗ I E )|ψ j el = λi µ j ψi ek |PU |e0 e0 |U † P|ψ j el . If λi µ j = λ j µi or e0 |U † P|ψi ek ⊥e0 |U † P|ψ j el , i.e., ψi ei |U P|e0 e0 |U † P|ψ j el = 0, then we have: ψi ek |(M ⊗ I E )PU |e0 e0 |U † P(N ⊗ I E )|ψ j el = ψi ek |(N ⊗ I E )PU |e0 e0 |U † P(M ⊗ I E )|ψ j el . This means that (M ⊗ I E )PU |e0 e0 |U † P(N ⊗ I E ) = (N ⊗ I E )PU |e0 e0 |U † P(M ⊗ I E ). Thus, the conclusion follows immediately from Proposition 8.3.19.
To conclude this section, we would like to point out that some sufficient conditions for commutativity of quantum weakest preconditions have been presented here, but the problem of finding a sufficient and necessary condition for this commutativity for a general quantum program is still open and seems very difficult. A even more general topic for further studies would be: Question 8.3.21. How to characterize [wp(E)(M), wp(N )(N )] in terms of [M, N ], where for any operators X and Y , [X, Y ] stands for their commutator, i.e., [X, Y ] = X Y − Y X ? The foregoing question might interest mathematicians working in the area of operator algebras (Putnam 1967).
8.4 Quantum Predicate Transformers: Projection Operators = Predicates The last section was devoted to an exposition of the D’Hondt-Panangaden approach to quantum weakest preconditions where quantum predicates are represented by Hermitian operators with their eigenvalues in the unit interval. This broad definition of quantum predicates allows us to establish an elegant duality between the state-transformer (forward) semantics and the predicate-transformer (backward) semantics of quantum programs. However, it also causes certain difficulties in the further development of quantum predicate-transformer semantics; for example, some logical operations of quantum predicates are not always well defined. To avoid these obstacles, we choose to consider a special class of quantum predicates, namely projection operators, in this section. Since the notion of projection operator is equivalent to that of closed subspace in a Hilbert space, we do not distinguish a closed subspace from the projector onto it, and for the most part we directly deal with closed subspaces in the sequel for simplicity of presentation.
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
335
8.4.1 Orthomodular Lattices To describe the algebraic structure of the set of closed subspaces of a Hilbert space, we briefly recall some basic notions from the theory of orthomodular lattices; for more details we refer to Bruns and Harding (2000) and Kalmbach (1983). A complete ortholattice is a 5-tuple L = L , ≤, ∧, ∨, ⊥, where: (i) L , ≤, ∧, ∨ is a7 complete 4 lattice. Here, ≤ is the partial ordering on L , and for any M ⊆ L , M and M stand for the greatest lower bound and the least upper bound of M, respectively. We use 0, 1 to denote the least and greatest elements of L , respectively. (ii) ⊥ is a unary operation on L , called orthocomplement, and required to satisfy the following conditions: (a) a ∧ a ⊥ = 0, a ∨ a ⊥ = 1; (b) a ⊥⊥ = a; and (c) a ≤ b implies b⊥ ≤ a ⊥ for any a, b ∈ L. It is easy to see that the condition (ii)(c) is equivalent to one of the De Morgan laws: (a ∧ b)⊥ = a ⊥ ∨ b⊥ and (a ∨ b)⊥ = a ⊥ ∧ b⊥ for any a, b ∈ L. A complete orthomodular lattice is a complete ortholattice L = L , ≤, ∧, ∨, ⊥ satisfying the orthomodular law: a ≤ b implies a ∨ (a ⊥ ∧ b) = b for all a, b ∈ L. The orthomodular law can be replaced by the following equation: a ∨ (a ⊥ ∧ (a ∨ b)) = a ∨ b for any a, b ∈ L . A complete Boolean algebra is a complete ortholattice L = L , ≤, ∧, ∨, ⊥ fulfilling the distributive law of join over meet: a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c) for all a, b, c ∈ L. With the De Morgan law it is easy to know that this condition is equivalent to the distributive law of meet over join: a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c) for any a, b, c ∈ L. Obviously, the distributive law implies the orthomodular law, and so a complete Boolean algebra is a complete orthomodular lattice. A central notion in the theory of orthomodular lattices is commutativity of elements. Let L = L , ≤, ∧, ∨, ⊥ be a complete ortholattice, and let a, b ∈ L. We say that a commutes with b, in symbols aCb, if we have: a = (a ∧ b) ∨ (a ∧ b⊥ ). The following lemma indicates that commutativity is preserved by lattice-theoretic operations. Lemma 8.4.1 (Bruns and Harding 2000). Let L = L , ≤, ∧, ∨, ⊥ be an orthomodular lattice, and let a ∈ L and bi ∈ L (i ∈ I ). If aCbi for all i ∈ I , then 7 4 7 4 aC( i∈I bi ) and aC( i∈I bi ) provided i∈I bi and i∈I bi exist.
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
336
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
The major difference between a Boolean algebra and an orthomodular lattice is that in general distributivity is not valid in the latter. However, a local distributivity can be recovered for orthomodular lattices by attaching commutativity. Lemma 8.4.2 (Bruns and Harding 2000) . Let L = L , ≤, ∧, ∨, ⊥ be an orthomodular lattice. For any a ∈ L and bi ∈ L (i ∈ I ), if aCbi for all i ∈ I , then 6 6 a ∧ ( bi ) = (a ∧ bi ), i∈I
a∨( provided
7 i∈I
bi and
i∈I
bi ) =
i∈I
4 i∈I
(a ∨ bi ) i∈I
bi exist.
Furthermore, the foregoing lemma can be generalized considerably by introducing the notion of commutator. Let L = L , ≤, ∧, ∨, ⊥ be an orthomodular lattice, and let A ⊆ L. The strong commutator ( A) of A is defined by 6 ( A) = {b : aCb for all a ∈ A, and (a1 ∧ b)C(a2 ∧ b) for all a1 , a2 ∈ A}. If A is finite, then the commutator γ ( A) of A is defined by 6 γ (A) = { a f (a) : f : A → {1, −1} is a mapping}, a∈A
where a 1 denotes a itself and a −1 denotes a ⊥ . The relation between commutator and strong commutator is clarified by the following lemma. In addition, the third item of the following lemma shows that commutator is a relativization of the notion of commutativity. Lemma 8.4.3 (Takeuti 1981). Let L = L , ≤, ∧, ∨, ⊥ be an orthomodular lattice and let A ⊆ L. Then (i) (A) ≤ γ ( A). (ii) If A is finite, then ( A) = γ ( A). (iii) γ ( A) = 1 if and only if all the members of A are mutually commutable. The following is a generalization of Lemma 8.4.2 given in terms of strong commutator. Lemma 8.4.4 (Takeuti 1981) . Let L = L , ≤, ∧, ∨, ⊥ be an orthomodular lattice and let A ⊆ L. Then 6 6 ( A) ∧ (a ∧ bi ) ≤ (a ∧ bi ), i∈I
( A) ∧
i∈I
(a ∨ bi ) ≤ a ∨ bi i∈I
for any a ∈ A and bi ∈ A (i ∈ I ).
i∈I
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
337
We shall need the following lemma, which was proved by the author in Ying (2005) and extensively used in automata theory based on quantum logic (Ying 2000, 2005, 2007). Lemma 8.4.5 (Ying 2005) . Let L = L , ≤, ∧, ∨, ⊥ be an orthomodular lattice and let A ⊆ L. Then for any B ⊆ [ A] we have ( A) ≤ (B), where [A] stands for the subalgebra of L generated by A.
8.4.2 Subspaces of a Hilbert Space We now are ready to examine the algebraic structure of closed subspaces of a Hilbert space. Let H be a Hilbert space. For any X ⊆ H, we write: 8 span(X ) = {Y : X ⊆ Y is a subspace of H}. Then span (X) is the smallest subspace of H containing X , and it is called the subspace of H generated by X . It is obvious that span(X) is the set of linear combinations of vectors in X ; that is, n span(X ) = { λi |ϕi : n ≥ 1, λi ∈ C and |ϕi ∈ X for all 1 ≤ i ≤ n}. i=1
The set of closed subspaces of H is denoted by S(H). If we identify each closed subspace X of H with the projector PX , then S(H) can be seen as a subset of P(H). Moreover, the inclusion relation coincides with the L¨owner partial order in S(H): for any X, Y ∈ S(H), X ⊆ Y if and only if PX 1 PY . For any X, Y ⊆ H, if |ϕ⊥|ψ for all |ϕ ∈ X and |ψ ∈ Y , then X and Y are said to be orthogonal, and we write X ⊥Y ; in particular we simply write |ϕ⊥Y if X is the singleton {|ϕ}. The orthocomplement of X is defined to be X ⊥ = {|ϕ ∈ H : |ϕ⊥X }. The following theorem clarifies algebraic structures of the set of closed subspaces of a Hilbert space. Theorem 8.4.6 (Sasaki) (Kalmbach 1983) . (S(H), ⊆, ∧, ∨, ⊥) is a complete orthomodular lattice, where the partial order ⊆ is the set inclusion, the smallest element is the 0-dimensional subspace {0}, the largest element is H, and for any M ⊆ S(H), we have:
8 M= X, 6
X ∈M
8 3 M= {Y ∈ S(H) : X ⊆ Y for all X ∈ M} = span( M).
8.4.3 Projective Predicate Transformers With the preliminaries given in the previous subsections, we are able to deal with the special class of quantum predicate transformers where only projection
P1: SBT CUUS834-08
cuus834-gay
338
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
operators are considered as quantum predicates. Assume that H is a Hilbert space. Then a closed subspace of H is called a projective predicate on H. A projective predicate transformer on H is a mapping from the set S(H) of projective predicates into itself. The set of projective predicate transformers on H is denoted by QPT (H), i.e., de f
QPT (H) = S(H)S(H) . We may introduce a partial order on QPT (H) in a pointwise way: for any quantum predicate transformers f, g ∈ QPT (H), f ⊆ g if f (X ) ⊆ g(X ) for all X ∈ S(H). The next lemma follows immediately from Theorem 8.4.6. Lemma 8.4.7. The set (QPT (H), ⊆) of quantum predicate transformers on H is a complete orthomodular lattice. (i) Its smallest and largest elements are denoted by 0, 1, respectively, and they are defined by 0(X ) = {0} (the 0-dimensional subspace of H), and 1(X ) = H for each X ∈ S(H). (ii) For any F ⊆ QPT (H) and X ∈ S(H), we have:
( F)(X ) = f (X ), 6
(
f ∈F
F)(X ) =
6
f (X ).
f ∈F
A reward of focusing our attention on projection operators is that quantum predicates constitute a lattice in a natural way. Thus, various healthiness conditions (Dijkstra 1976; Hesselink 1992) can be easily generalized to the case of quantum predicate transformers. Definition 8.4.8. Let f be a projective predicate transformer on H. Then (i) f is said to be monotone if X ⊆ Y implies f (X ) ⊆ f (Y ) for any X, Y ∈ S(H); (ii) f is said to be finitely conjunctive if f (X ∧ Y ) = f (X ) ∧ f (Y ) for any X, Y ∈ S(H); (iii) f is said to be positively conjunctive if
f ( M) = f (X ) (8.10) X ∈M
for any nonempty M ⊆ S(H); (iv) f is said to be universally conjunctive if it is positively conjunctive and f (H) = H; (v) f is said to be finitely disjunctive if f (X ∨ Y ) = f (X ) ∨ f (Y ) for any X, Y ∈ S(H);
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
(vi) f is said to be positively disjunctive if 6 6 f (X ) f ( M) =
339
(8.11)
X ∈M
for any nonempty M ⊆ S(H); (vii) f is said to be universally disjunctive if it is positively disjunctive and f ({0}) = {0}; (viii) f is said to be upper-continuous if Equation (8.10) holds whenever ∅ = M ⊆ S(H) is a chain, i.e., it always holds that X ⊆ Y or Y ⊆ X for any X, Y ∈ M; (ix) f is said to be lower-continuous if Equation (8.11) holds whenever ∅ = M ⊆ S(H) is a chain. We write QMT (H), QMC(H), QMP(H), and QMU(H) for the sets of monotone, finitely conjunctive, positively conjunctive, and universally conjunctive projective predicate transformers on H, respectively. In addition, we write QMD(H), QU C(H), QLC(H), QPD(H), and QU D(H) for the sets of finitely disjunctive, upper-continuous, lower-continuous, positively disjunctive, and universally disjunctive projective predicate transformers on H, respectively. Obviously, we have: • QMU(H) ⊆ QMP(H) ⊆ QMC(H); • QUD(H) ⊆ QPD(H) ⊆ QMD(H), QU C(H); and • QMC(H), QMD(H), QU C(H), QLC(H) ⊆ QMT (H) ⊆ QPT (H). The following lemma clarifies further the relationship among the preceding spaces of projective predicate transformers. Lemma 8.4.9. (i) QMT (H) is a complete sublattice of QPT (H). (ii) QMC(H), QMP(H), QLC(H) and QMU(H) are all inf-closed in QPT (H). (iii) QMD(H), QPD(H), QU C(H) and QU D(H) are all sup-closed in QPT (H). We now present a simple example to illustrate the notions previously introduced. Example 8.4.10. Let A : H → H be a bounded linear operator. We define mapping A−1 : S(H) → S(H) by A−1 (X ) = {|ϕ ∈ H : A|ϕ ∈ X } for each X ∈ S(H). For any X ∈ S(H), it is easy to check that A−1 (X ) is a subspace of H, and closeness of A−1 (X ) follows immediately from continuity of A. Thus, A−1 is a projective predicate transformer. It is easy to see that A−1 is
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
340
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
universally conjunctive. At the same time, A−1 is universally disjunctive, i.e., 6 6 A−1 ( X i ) = A−1 (X i ) i
i
for any X i ∈ S(H). In fact, 6 3 A−1 ( X i ) = A−1 ( {Y ∈ S(H) : X i ⊆ Y for all i}) i
=
3
{ A−1 (Y ) : X i ⊆ Y ∈ S(H) for all i}.
Note that Y ∈ S(H) implies A−1 (Y ) ∈ S(H), and X i ⊆ Y implies A−1 (X i ) ⊆ A−1 (Y ). Thus, we have: 6 3 6 A−1 ( X i ) ⊆ {Z ∈ S(H) : A−1 (X i ) ⊆ Z for all i} = A−1 (X i ). i
i
(i) For any unitary operator U , we have: U −1 (X ) = {U −1 |ϕ : |ϕ ∈ X }. In particular, we consider some single qubit gates. Let H2 be the 2dimensional Hilbert space. Then S(H2 ) = {{0}, H2 } ∪ {H1 (α, β) : α, β ∈ C} where H1 (α, β) = {γ (α|0 + β|1) : γ ∈ C} is a 1-dimensional subspace of H2 for each α, β. We first look at the most frequently used single qubit gates, Pauli matrices X, Y , and Z , the Hadamard gate: 1 1 1 H=√ , 2 1 −1 the phase gate:
S=
and the
π 8
1 0
0 , i
1 0
0 iπ e4
gate: T =
.
The predicate transformers X −1 , Y −1 , Z −1 , H −1 , S −1 and T −1 are given by X −1 (H1 (α, β)) = X (H1 (α, β)) = H1 (β, α), Y −1 (H1 (α, β)) = Y (H1 (α, β)) = H1 (−β, α), Z −1 (H1 (α, β)) = Z (H1 (α, β)) = H1 (α, −β), S −1 (H1 (α, β)) = H1 (α, −iβ), T −1 (H1 (α, β)) = H1 (α, e− 4 β) iπ
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
341
for all α, β. In general, each unitary operation on a single qubit can be written in the form of U = eiλ Rz (µ)R y (ν)Rz (δ), where λ, µ, ν, and δ are real numbers, iθ cos θ2 − sin θ2 0 e− 2 R y (θ ) = , Rz (θ ) = iθ 0 e2 sin θ2 cos θ2 are the rotation operators about y and z axes, respectively (Nielsen and Chuang 2000). Then the predicate transformer U −1 is given by ν ν ν ν U −1 (H1 (α, β)) = H1 (α cos + βeiµ sin , βei(δ+µ) cos − αeiδ sin ). 2 2 2 2 (ii) For any quantum measurement {Mm }, if X ∈ S(H), then Mm−1 (X ) = {|ψ ∈ H : |ψm ∈ X } is the set of quantum states such that the postmeasurement states will lie in X whenever we perform measurement {Mm } on them and the outcome m is reported. In particular, we consider the computational basis measurement {P0 = |00|, P1 = |11|} on the first qubit of a 2-qubit system. For i = 0, 1, if we hope that the measurement outcome is i and the postmeasurement state is in the 1dimensional space H1 (α, β), then the state of the system before the measurement should be in Pi−1 (H1 (α, β)) = {γ (α|i0 + β|i1) : γ ∈ C}.
8.4.4 Projective Weakest Preconditions In Section 8.3 the forward semantics of quantum programs is given in terms of superoperators. The backward semantics of a quantum program is defined to be a mapping from the set of Hermitian operators bounded by 0H and IH into itself. In particular, it follows from Proposition 8.3.5 that the weakest precondition semantics of a quantum program is also a superoperator. In the present section, we decided to consider only projective predicates, and then backward semantics of quantum programs is represented by mappings from the set of closed subspaces of the state space into itself. What is the corresponding forward semantics of quantum programs? Quantum programs are constructed from two kinds of quantum commands: unitary transformations and quantum measurements. A unitary transformation is a bijection from the state space onto itself. On the other hand, a quantum measurement introduces certain probabilism. Roughly speaking, a quantum measurement transforms a quantum state to a set of quantum states, namely the postmeasurement states. Thus, a measurement can be seen as a oneto-many mapping from the state space into itself if the vectors used to represent the postmeasurement states are allowed to be not normalized and the probabilities of measurement outcomes are encoded into the lengths of these vectors. Furthermore, nondeterminate choice is a basic program constructor, and we hope it can
P1: SBT CUUS834-08
cuus834-gay
342
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
be accommodated well in the forward semantics of quantum programs. Again, nondeterminate choice leads us to consider one-to-many mappings from the state space into itself. Note that a one-to-many mapping from a set X into itself can be equivalently treated as a mapping from the power set of X into itself. This, together with the consideration of preserving algebraic and topological structures in the state space, motivates us to define (the forward semantics of) a quantum program as a mapping from the set of closed subspaces of the state space into itself. Definition 8.4.11. A mapping t from S(H) into itself is called a quantum program if it is lower-continuous, i.e., for any increasing sequences {X n }∞ n=0 of closed subspaces of H, t(
∞ 6
n=0
Xn) =
∞ 6
t(X n ).
n=0
At first glance, the foregoing definition coincides with the definition of lowercontinuous projective predicate transformer (see Definition 8.4.8(ix)). However, an essential difference exists between them: a quantum program in Definition 8.4.11 is forward, whereas a projective predicate transformer is backward. More precisely, let H0 = H1 = H. Then a mapping t : S(H0 ) → S(H1 ) is seen as a quantum program from H0 to H1 , but a mapping f : S(H0 ) → S(H1 ) is treated as a predicate transformer from H1 to H0 . This is similar to the case of classical programs. The notions of Hoare assertion and weakest precondition can be defined in the setting of projective predicates in a familiar way. Definition 8.4.12. Let t be a mapping from S(H) into itself. (i) For any X, Y ∈ S(H), we write X {t}Y if t(X ) ⊆ Y . (ii) For any X ∈ S(H), the weakest precondition of X with respect to t is defined to be a closed subspace wp(t)(X ) of H satisfying the following conditions: (a) wp(t)(X ){t}X ; (b) for any Y ∈ S(H), Y {t}X implies Y ⊆ wp(t)(X ).
8.4.5 The D’Hondt-Panangaden Weakest Preconditions versus Projective Weakest Preconditions In this subsection we deviate from the right path to examine the relationship between projective weakest preconditions and the D’Hondt and Panangaden weakest preconditions defined in Section 8.3. We first consider a special class of quantum programs that are represented by superoperators preserving projectors. Definition 8.4.13. (i) Let E ∈ SO(H). If for any X ∈ S(H), there exists Y ∈ S(H) such that E(PX ) = λPY for some 0 < λ ≤ 1, then we say that E preserves projectors. (ii) Let E ∈ SO(H) preserves projectors. Then the restriction tE of E on S(H) is defined as follows: For each X ∈ S(H), if E(PX ) = λPY , then tE (X ) = Y .
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
343
We note that if E(PX ) = λPY and E(PX ) = µPZ then Y = Z . So, tE is welldefined. To simplify the presentation, we introduce an auxiliary notion. For any X, Y ∈ S(H), we define the cosine of the angle between X and Y as follows: 9 :dim X dim Y : cosX, Y = ; |ϕi |ψ j |2 , i=1
j=1
dim H is an orthonormal basis of H such that |ϕi ∈ X for all i ≤ dim X where {|ϕi }i=1 H and |ϕi ∈ X ⊥ for all i > dim X , and {|ψ j }dim j=1 is an orthonormal basis of H such that |ψ j ∈ Y for all j ≤ dim Y and |ψ j ∈ Y ⊥ for all j > dim Y. It is easy
to show that cosX, Y does not depend on the choices of {|ϕi } and {|ψ j }. The following two technical lemmas will be used in the proofs of the main results in this subsection. Lemma 8.4.14. Let X, X 1 , X 2 , Y 5 ∈ S(H). Then we have: (i) cosX, Y = cosY, X = tr (PX · PY ). (ii) X 1 ⊆ X 2 implies cosX ≤ cosX 2 , Y . √ 1, Y √ √ (iii) cosX, Y ≤ min( dim X , dim Y ), and cosX, Y = dim X if and only if X ⊆ Y .
Proof. Suppose that both {|ϕi } and {|ψ j } are orthonormal bases of H, |ϕi ∈ X for all i ≤ dim X , |ϕi ∈ X ⊥ for all i > dim X , |ψ j ∈ Y for all j ≤ dim Y , and |ψ j ∈ Y ⊥ for all j > dim Y. Then tr (PX PY ) = tr (
dim X
|ϕi ϕi | ·
i=1
=
dim X dim Y i=1
=
|ψ j ψ j |)
j=1
tr (|ϕi ϕi |ψ j ψ j |)
j=1
dim X dim Y i=1
dim Y
|ϕi |ψ j |2
j=1
= cosX, Y 2 ≤
dim X dim H i=1
=
dim X
|ϕi |ψ j |2
j=1
||ϕi ||2
i=1
= dim X.
If cosX, Y =
√ dim X , then
dim Y
|ϕi |ψ j |2 = 1
j=1
for all i ≤ dim X . This implies |ϕi ∈ Y for all i ≤ dim X , and X ⊆ Y .
P1: SBT CUUS834-08
cuus834-gay
344
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
Lemma 8.4.15. Let E ∈ SO(H) preserve projectors, let X, Y ∈ S(H), and let X be finite-dimensional. If for all ρ ∈ D(H), we have: tr (PX ρ) ≤ tr (PY E(ρ)), then tE (X ) ⊆ Y . Proof. (⇐) Suppose that E(PX ) = λPZ . Since X is a finite-dimensional subspace of H, we have: 1 PX ∈ D(H), dim(X ) where dim(X ) is the dimension of X . Then we obtain: tr (
λ 1 1 PZ ) = tr (E( PX )) ≤ tr ( PX ) = 1 dim(X ) dim(X ) dim(X )
from the definition of superoperator. This implies that Z is finite-dimensional. Thus, it follows that λ dim(Z ) λ = tr ( PZ ) ≤ 1 dim(X ) dim(X ) and λ≤
dim(X ) . dim(Z )
Putting ρ=
1 PX , dim(X )
we get: 1 tr (PX ) dim(X ) 1 = tr (PX PX ) dim(X ) = tr (PX ρ)
1=
≤ tr (PY E(ρ)) 1 tr (PX E(PX )) = dim(X ) λ tr (PY PZ ) = dim(X ) 1 ≤ tr (PY PZ ) dim(Z ) and dim(Z ) ≤ tr (PY PZ ). Therefore, using Lemma 8.4.14 we obtain tE (X ) = Z ⊆ Y.
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
345
Suppose that E ∈ SO(H) is a quantum program preserving projectors. Of course, the D’Hondt-Panangaden weakest precondition wp(E) of E can be defined in (P(H), 1) according to Definition 8.3.4. On the other hand, the weakest precondition wp(tE ) can be defined in (S(H), ⊆) according to Definition 8.4.12. An interesting problem is to compare the restriction of wp(E) on S(H) with wp(tE ). Proposition 8.4.16. Let E ∈ SO(H) preserve projectors. (i) For any X ∈ S(H), if Z is a finite-dimensional subspace of H, and PZ 1 wp(E)(PX ), then Z ⊆ wp(tE )(X ) provided wp(tE )(X ) is defined. (ii) If E satisfies the condition: ρ 1 wp(E)(E(ρ)) for all ρ ∈ D(H), then for any X ∈ S(H), we have: Pwp(tE )(X ) 1 wp(E)(PX ). Proof. (i) For any ρ ∈ D(H), we have: tr (PZ ρ) ≤ tr (wp(E)(PX )ρ) ≤ tr (PX E(ρ)). Then it follows from Lemma 8.4.15 that tE (Z ) ⊆ X , and by definition we obtain Z ⊆ wp(tE )(X ). (ii) Assume that Y = wp(tE )(X ). Then tE (Y ) ⊆ X , i.e., E(PY ) = λPZ for some λ and Z with 0 < λ ≤ 1 and X ⊇ Z ∈ S(H). Now for any ρ ∈ D(H), by Proposition 8.3.5 we obtain: tr (PY ρ) ≤ tr (PY wp(E)(E(ρ))) † † Ei E j ρ E j Ei ) = tr (PY · =
i, j †
†
tr (PY E i E j ρ E j E i )
i, j
=
i, j
†
†
tr (E i PY E i E j ρ E j )
= tr (
†
E i PY E i ·
i
†
E jρE j)
j
= tr (E(PY )E(ρ)) ≤ tr (PZ E(ρ)) ≤ tr (PX E(ρ)). Therefore, it holds that PY {E}PX , and PY 1 wp(E)(PX ) follows.
Now we consider a partial inverse of the problem dealt with in the above proposition. Let t be a mapping from S(H) into itself satisfying the upper continuity: 8 8 Eµ) = t(E µ ) t( λ<µ
λ<µ
P1: SBT CUUS834-08
cuus834-gay
346
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
for any family {E µ }λ<µ of closed subspaces of H with E µ1 ⊆ E µ2 whenever µ1 ≤ µ2 . Then t induces an operator Et on L(H) in the following way: Each bounded positive operator A can be written in the form of b A= λd E λ 0
by the spectral decomposition theorem, where b ≥ 0, and E λ ∈ S(H) for any 0 ≤ λ ≤ b. Then it follows from the upper continuity of t that {t(E λ )} is a spectral family, and we can define b Et ( A) = λdt(E λ ). 0
Furthermore, Et ( A) can be defined for all A ∈ L(H) by linearity. It is easy to check that Et is a superoperator if dim(t(X )) ≤ dim(X) for any X ∈ S(H). On the other hand, if f ∈ QU C(H) is a upper-continuous projective predicate transformer, then we can define the extension f ∗ : P(H) → P(H) of f in a similar way: for any M ∈ P(H), 1 f ∗ (M) = λd f (Fλ ) (8.12) when M =
<1 0
0
λd Fλ is the spectral decomposition of M.
Proposition 8.4.17. Let t be a mapping from S(H) into itself satisfying the upper continuity and preserving the cosine of the angle between two closed subspaces of H: cosX, Y ≤ cost(X ), t(Y ) for any X, Y ∈ S(H). Then we have wp(t)∗ 1 wp(Et ), where wp(·) in the left-hand side and wp(·) in the right-hand side are given according to Definitions 8.4.12 and 8.3.4, respectively, and the extension ∗ in the left-hand side is defined according to Equation (8.12). Proof (Outline). The theory of spectral measures and integrals (see Prugove˘cki 1981, Chapter III.5) can be generalized to the case of positive operator-valued measures and integrals (Diestel and Uhl 1977) so that λd Aλ is well defined, where {Aλ } is a family of positive operators. Furthermore, we have: A · ( λd Aλ ) = λd( A Aλ ), (8.13) ( λd Aλ ) · A = λd( Aλ A), tr (
(8.14)
λd Aλ ) =
λdtr ( Aλ ),
(8.15)
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
347
where A is a positive operator, and the right-hand side of Equation (8.15) is the Lebesgue-Stieltjes integral. Now for any M ∈ P(H), we show that wp(t)∗ (M) 1 wp(Et )(M). To this end, we only need to prove that wp(t)∗ (M){Et }M, i.e., tr (wp(t)∗ (M)ρ) ≤ tr (MEt (ρ)) for all ρ ∈ D(H). Suppose that M=
1
1
λd E λ , ρ =
0
µd Fµ
0
are the spectral decompositions of M and ρ, respectively. Then with Equations (8.13) and (8.14) we obtain: 1 ∗ wp(t) (M)ρ = [ λdwp(t)(E λ )] · ρ 0 1
=
λd[wp(t)(E λ ) · ρ]
0
1
=
λd[wp(t)(E λ ) ·
0
1
= Similarly, we have:
MEt (ρ) =
µd Fµ ]
0
1
λd{
0
1
µd[wp(t)(E λ ) · Fµ ]}.
0
1
1
λd{
0
µd[E λ · t(Fµ )]}.
0
Therefore, it follows from Equation (8.15) that 1 1 tr (wp(t)∗ (M)ρ) = λd{ µd[tr (wp(t)(E λ ) · Fµ )]}, 0
tr (MEt (ρ)) =
1
0 1
λd{
0
µd[tr (E λ · t(Fµ ))]}.
0
Consequently, it suffices to show that tr (wp(t)(E λ ) · Fµ ) ≤ tr (E λ · t(Fµ )). In fact, since wp(t)(E λ ){t}E λ , we have t(wp(t)(E λ )) ⊆ E λ . Then by Lemma 8.4.14 and the assumption that t preserves the cosine of the angle between closed subspaces of H, we obtain: tr (wp(t)(E λ ) · Fµ ) = coswp(t)(E λ ), Fµ 2 ≤ cost(wp(t)(E λ )), t(Fµ )2 ≤ cosE λ , t(Fµ )2 ≤ tr (E λ · t(Fµ )).
P1: SBT CUUS834-08
cuus834-gay
348
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
8.4.6 Quantum Commands The remaining part of this section is mainly devoted to defining the semantics of recursive procedures in the setting of projective predicates and to establish some of the fundamental properties of recursive procedures. We adopt the abstract syntax of commands with procedures and unbounded choices used in Hesselink (1992). The results obtained in the following subsections generalize the main results in Hesselink (1992) to the case of quantum programs by replacing classical predicates with projective predicates in the semantics of commands. This can be clearly seen from a comparison between the results presented later and the corresponding ones in Hesselink (1992). Following Hesselink (1992), let S and H be two sets of symbols. It is required that S ∩ H = ∅. The elements of S are called simple commands, and the elements of H are called procedure names. Put A = S ∪ H and assume that A does not contain the symbol and “;”. The set of strings over A is denoted by A∗ . We shall use to denote the empty string, and concatenation of strings will be expressed by the infix operator “;”. Intuitively, the concatenation “;” is used to denote sequential composition of commands. Furthermore, we write A8 for the set of nonempty subsets of A∗ , i.e., A8 = P( A∗ ) − {∅}, where P(·) stands for power set. The elements of A8 are called commands. A command C ∈ A8 stands for the choice among the elements of C, which are also commands, whenever C contains more than one elements. The recursive procedures are declared by a function body : H → A8 . For each procedure name h ∈ H , the body function body associates it to its body body(h), which is a command expression that may contain occurrences of h or other procedure names. Intuitively, the behavior of procedure h is given by the defining equation h = body(h). It is worth noting that recursive calls may happen because h is allowed to appear in body(h). We can define two operations of commands. The sequential composition of two commands C, D ∈ A8 is defined to be C; D = {s; t : s ∈ C and t ∈ D}, and the (unbounded) choice of a nonempty family C ⊆ A8 of commands is defined to be = 3 ( C ∈ C :: C) = C. C∈C
Semantics of commands is given in terms of homomorphisms from commands to quantum predicate transformers. Definition 8.4.18. A homomorphism is a mapping ϕ : A8 → QPT (H) satisfying the following conditions:
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
349
(i) ϕ() = I d S(H) (the identity mapping on S(H)); (ii) ϕ(C; > D) = ϕ(C) ◦ ϕ(D); 7 (iii) ϕ( C ∈ C : C) = C∈C ϕ(C) for any C, D ∈ A8 and C ⊆ A8 . A homomorphism can be obtained by extending a mapping from simple commands and procedure names to projective predicate transformers in a natural way. Definition 8.4.19. Let v : A → QPT (H) be a mapping. Then: (i) The extension v ∗ of v on A∗ is defined inductively as follows: v ∗ () = I d S(H) , and v ∗ (a; s) = v(a) ◦ v ∗ (s) for each a ∈ A and s ∈ A∗ . (ii) The extension v 8 of v on A8 is defined by
v 8 (C) = v ∗ (s) s∈C
for any C ∈ A8 . Some basic properties of the preceding extension are presented in the following lemma, and their routine proofs are omitted. Lemma 8.4.20. (i) If range(v) ⊆ QMT (H), then range(v 8 ) ⊆ QMT (H). The same holds for QMC(H), QMP(H) and QMU (H). (ii) If range(v) ⊆ QMU(H), then v 8 is a homomorphism.
8.4.7 Knaster-Tarski Fixed Point Theorem To define semantics of quantum procedures, we need the Knaster-Tarski fixed point theorem. For convenience of the reader, we briefly review it in this subsection. Let L be a lattice and D a mapping from L into itself. If D(U ) = {D(w) : w ∈ U } ⊆ U ; then U is said to be D-invariant. Theorem 8.4.21 (Knaster-Tarski) (Hesselink 1992). Let L be a complete lattice, and let D : L → L be a monotone function. Then (i) D has a least fixed point lfp(D) and a greatest fixed point g f p(D). (ii) For any D-invariant subset U of L, we 4 have: (a) lfp(D) ∈ U if U is sup-closed, i.e., 7 V ∈ U for all V ⊆ U ; (b) gfp(D) ∈ U if U is inf -closed, i.e., V ∈ U for all V ⊆ U . The upper and lower ordinal powers of a mapping D : L → L are defined as follows:
P1: SBT CUUS834-08
cuus834-gay
350
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
• D ↑ 0 = 0, D ↓ 0 = 1; • D ↑ (α + 1) = D(D ↑ α), D ↓ (α + 1) = D(D ↓ α) for each ordinal number α; and4 7 • D ↑ α = {D ↑ β : β < α}, D ↓ α = {D ↓ β : β < α} if α is a limit ordinal number. The next proposition gives an explicit representation of fixed points in terms of ordinal powers. Proposition 8.4.22 (Lloyd 1987). Let L be a complete lattice, and let D : L → L be monotone. Then (i) D ↑ α ≤ lfp(D) and gfp(D) ≤ D ↓ α for any ordinal number α; (ii) There exist ordinal numbers α0 and α1 such that D ↑ α = lfp(D) for all α ≥ α0 , and D ↓ α = gfp(D) for all α ≥ α1 . The following proposition will be used in proving the termination law of quantum programs. Proposition 8.4.23 (Hesselink 1992). Let L be a complete lattice and K a complete sublattice of L, let f, g : L → L be monotone mappings, and let f |K be the restriction of f on K . Then (i) (a) lfp( f |K ) = lfp( f ) if lfp( f ) ∈ K ; (b) gfp( f |K ) = gfp( f ) if gfp( f ) ∈ K . (ii) lfp( f ) ≤ lfp(g), gfp( f ) ≤ gfp(g) if f ≤ g, i.e., f (a) ≤ g(a) for all a ∈ L.
8.4.8 Semantics of Recursive Quantum Commands Now we are able to define semantics of recursion expressed by procedure names and their declarations. Let w : S → QPT (H) and u : H → QPT (H). Then their merging w ∪ u : A → QPT (H) is defined by % w(a) if a ∈ S, (w ∪ u)(a) = u(a) if a ∈ H. Note that w ∪ u is well defined because it was assumed that S ∩ H = ∅. As an immediate corollary of Lemma 8.4.20(i), we have: Lemma 8.4.24. If for any a ∈ S, w(a) is universally conjunctive, and for any a ∈ H , u(a) is universally conjunctive, then for any C ∈ A8 , (w ∪ u)8 (C) is universally conjunctive. For each mapping w : S → QMT (H), it induces a mapping D[w] from QMT (H) H into itself as follows: D[w](u) = (w ∪ u)8 ◦ body for any u : H → QMT (H). It follows directly from the definition of w ∪ u and Lemma 8.4.20(i) that D[w](u)(h) ∈ QMT (H) for every h ∈ H . Then we are ready to present the key definition of this section.
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
351
Definition 8.4.25. Let w : S → QMT (H). Then: (i) The weakest precondition function generated by w is defined to be wp[w] = (w ∪ lfp(D[w]))8 . (ii) The weakest liberal precondition function generated by w is defined to be wlp[w] = (w ∪ gfp(D[w]))8 , where lfp(D[w]) and gfp(D[w]) stand for the least and greatest fixed points of D[w], respectively. It is easy to see that D[w] is monotone. Then we know that lfp(D[w]) and glp(D[w]) always exist from Lemma 8.4.9(i) and Theorem 8.4.21(i), and wp[w] and wlp[w] are well defined. Lemma 8.4.26. For any w : S → QMT (H) and h ∈ H , we have: (i) wp[w](h) = wp[w](body(h)) and wlp[w](h) = wlp[w](body(h)); (ii) If range(w) ⊆ QMU(H), then wlp[w] is a homomorphism. Proof. (i) is obvious from the definition of D[w] and Definition 8.4.25. (ii) It follows from Lemma 8.4.9(ii) that QMU(H) H is inf-closed. On the other hand, we see that D[w] is QMU(H) H −invariant by a routine calculation. Then we have gfp(D[w]) ∈ QMU(H) H by Theorem 8.4.21(ii), and it follows from Definition 8.4.25(ii) and Lemma 8.4.20(ii) that wlp[w] is a homomorphism.
8.4.9 Healthiness Laws for Quantum Commands Healthiness conditions were first introduced by Dijkstra (1976) and then thoroughly investigated by Dijkstra and Scholten (1990) among others, and they prescribe certain properties of predicate transformers. The aim of this section is to establish the quantum generalizations of some healthiness laws. Universal conjunctivity is one of the most important healthiness laws for predicate transformers, and it asserts that the predicate transformers under consideration preserve arbitrary meets of predicates. Universal conjunctivity of classical weakest liberal preconditions can be generalized to the quantum case in a straightforward way. Theorem 8.4.27 (Universal conjunctivity of weakest liberal precondition). If w(a) is universally conjunctive for all a ∈ S, then wlp[w](C) is universally conjunctive for each C ∈ A8 . Proof. We see that gfp(D[w]) ∈ QMU(H) H from the proof of Lemma 8.4.26(ii). Thus, it immediately follows from Lemma 8.4.24 and Definition 8.4.25(ii) that wlp[w] (C) ∈ QMU(H) for all C ∈ A8 .
P1: SBT CUUS834-08
cuus834-gay
352
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
Another important healthiness condition is termination law, which asserts that the total correctness of a program is the conjunction of the termination and the partial correctness of the program. It has been widely used in reasoning about total correctness of classical programs. The quantum version of termination law is not a straightforward generalization of the classical termination law. It requires some new insights from quantum logic, and its proof is much more skillful than that for classical programs (Hesselink 1992). To establish the quantum termination law, we first need to give two technical lemmas: Lemma 8.4.28. Let X ∈ S(H), and let w : S → QMT (H) and u : H → QMT (H). If for all a ∈ S and h ∈ H , we have X ⊆ w(a)(X ) and X ⊆ u(h)(X ), then for all C ∈ A8 , it holds that X ⊆ (w ∪ u)8 (C)(X ). Proof. We proceed by induction on the structure of C. For the case of C = a ∈ A, it is obvious. If C = a; s, where a ∈ A and s ∈ A∗ , then we obtain: (w ∪ u)8 (C)(X ) = (w ∪ u)∗ (a; s)(X ) = (w ∪ u)(a)((w ∪ u)∗ (s)(X )) ⊇ (w ∪ u)(a)(X ) ⊇X from the induction hypothesis: X ⊆ (w ∪ u)8 (s)(X ). In general, it follows that
(w ∪ u)8 (C)(X ) = (w ∪ u)∗ (s)(X ) ⊇ X s∈C
from the induction hypothesis that X ⊆ (w ∪ u)8 (s)(X ) for all s ∈ A∗ .
Lemma 8.4.29. Let X ∈ S(H). If X ⊆ w(a)(X ) for all a ∈ S, then for all a ∈ A we have: X ⊆ wlp[w](a)(X ). Proof. From Definition 8.4.25 we obtain: wlp[w](a)(X ) = (w ∪ gfp(D[w]))(a)(X ) % w(a)(X ) if a ∈ S, = gfp(D[w])(a)(X ) if a ∈ H. Therefore, it suffices to show that X ⊆ gfp(D[w])(h)(X ). By Theorem 8.4.27, we only need to prove X ⊆ (D[w] ↓ α)(h)(X ) for all ordinal numbers α, where D[w] ↓ α is an ordinal power of D[w]. We proceed by transfinite induction on α. If α = 0, then (D[w] ↓ α)(h)(X ) = H
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
353
and the conclusion holds. Now assume that X ⊆ (D[w] ↓ α)(h)(X ). Then (D[w] ↓ (α + 1))(h)(X ) = D[w](D[w] ↓ α)(h)(X ) = (w ∪ (D[w] ↓ α))8 (body(h))(X ) and it follows from Lemma 8.4.28 that X ⊆ (D[w] ↓ (α + 1))(h)(X ). Finally, if α is a limit ordinal and X ⊆ (D[w] ↓ β)(h)(X ) for all β < α, then
(D[w] ↓ β)(h)(X ) = (D[w] ↓ α)(h)(X ). X⊆ β<α
To present the quantum termination law in a compact way, we need to introduce an auxiliary notation. For any w : S → QMT (H), we write: 3 Range(w) = {w(a)(X ) : X ∈ S(H)}. a∈S
Theorem 8.4.30 (Termination law). Suppose that w1 , w2 : S → QMT (H) satisfy the following condition: w1 (a)(X ) = w1 (a)(H) ∧ w2 (a)(X ) for any a ∈ S and X ∈ S(H). Then (i) For any C ∈ A8 and X ∈ S(H), we have: wp[w1 ](C)(X ) ⊆ wp[w1 ](C)(H) ∧ wlp[w2 ](C)(X ). (ii) Let M ⊆ S(H). If (a) Range(w1 ), Range(w2 ) ⊆ M, (b) (M) ⊆ w2 (a)((M)) for all a ∈ S, and (c) w2 (a) is universally conjunctive for all a ∈ S, then we have: wp[w1 ](C)(H) ∧ wlp[w2 ](C)(X ) ∧ (M) ⊆ wp[w1 ](C)(X ), where (M) stands for the strong commutator of M. Note that if all the elements of M commute mutually then (M) = H, and condition (ii)(b) becomes a part of condition (ii)(c). Furthermore, we have: wp[w1 ](C)(H) ∧ wlp[w2 ](C)(X ) = wp[w1 ](C)(X ) by combining the two parts of the theorem. Proof. (i) It is obvious that wp[w1 ](C)(X ) ⊆ wp[w1 ](C)(H). So, we only need to show that wp[w1 ](C)(X ) ⊆ wlp[w2 ](C)(X ).
P1: SBT CUUS834-08
cuus834-gay
354
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
Since w1 ⊆ w2 , we have D[w1 ] ⊆ D[w2 ]. Then we obtain: lfp(D[w1 ]) ⊆ gfp(D[w1 ]) ⊆ gfp(D[w2 ]) by Proposition 8.4.23, and it follows that wp[w1 ] = (w1 ∪ lfp(D[w1 ]))8 ⊆ (w2 ∪ gfp(D[w2 ]))8 = wlp[w2 ]. (ii) The proof of part (ii) consists of five claims. First, we write [M] for the complete sublattice of S(H) generated by M. Put W = {u ∈ QMT (H) H : u(h)(X ) ∈ [M] for all h ∈ H and X ∈ S(H)}. It is easy to see that W is a complete sublattice of QMT (H) H . • Claim 1. D[w1 ] ↑ α, D[w2 ] ↓ α ∈ W for all ordinal numbers α, where D[w1 ] ↑ α, D[w2 ] ↓ α are ordinal powers of D[w1 ] and D[w2 ], respectively. The proof of this claim can be carried out by transfinite induction on α, and it is routine and so omitted here. We only need to note that here the condition Range(w1 ), Range(w2 ) ⊆ M is required. Let lfp(D[w1 ]) and Lfp(D[w1 ]) stand for the least fixed points of D[w1 ] in QMT (H) H and W, respectively. In addition, let gfp(D[w2 ]) and Gfp(D[w2 ]) be the greatest fixed points of D[w2 ] in QMT (H) H and W, respectively. Then we have: • Claim 2. lfp(D[w1 ]) = Lfp(D[w1 ]) and gfp(D[w2 ]) = Gfp(D[w2 ]). In fact, we see that lfp(D[w1 ]), gfp(D[w2 ]) ∈ W by combining claim 1 and Proposition 8.4.22. Then claim 2 follows immediately from Proposition 8.4.23. Now we set U = {u ∈ W : u(h)(H)∧wlp[w2 ](h)(X ) ∧ (M) ⊆ u(h)(X )for all h ∈ H and X ∈ S(H)}. • Claim 3. For each u ∈ U, we have: (w1 ∪ u)8 (C)(H) ∧ wlp[w2 ](C)(X ) ∧ (M) ⊆ (w1 ∪ u)8 (C)(X ) for all C ∈ A8 and X ∈ S(H). The proof of this claim is carried out by induction on the structure of C. • Case 1. C = a ∈ S. Then we have: (w1 ∪ u)8 (C)(X ) = w1 (a)(X ), (w1 ∪ u)8 (C)(H) = w1 (a)(H), wlp[w2 ](C)(X ) = (w2 ∪ gfp(D[w2 ]))8 (C)(X ) = w2 (a)(X ). Thus, claim 3 follows from the assumption about w1 and w2 .
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
355
• Case 2. C = h ∈ H . Then (w1 ∪ u)8 (C)(H) = u(h)(H), (w1 ∪ u)8 (C)(X ) = u(h)(X ), and claim 3 follows from the fact that u ∈ U. • Case 3. C = a; s, where a ∈ A and s ∈ A∗ . For simplicity, We write: L H S = (w1 ∪ u)8 (C)(H) ∧ wlp[w2 ](C)(X ) ∧ (M). Then we obtain: L H S = (w1 ∪ u)(a)((w1 ∪ u)∗ (s)(H)) ∧ wlp[w2 ](a)(wlp[w2 ](s)(X )) ∧ (M) ⊆ (w1 ∪ u)(a)(H) ∧ wlp[w2 ](a)((w1 ∪ u)∗ (s)(H)) ∧ wlp[w2 ](a)(wlp[w2 ](s)(X )) ∧ (M). Using Lemma 8.4.29 we assert that (M) ⊆ wlp[w2 ](a)((M)), and it follows that L H S ⊆ (w1 ∪ u)(a)(H) ∧ wlp[w2 ](a)((w1 ∪ u)∗ (s)(H)) ∧ wlp[w2 ](a)(wlp[w2 ](s)(X )) ∧ wlp[w2 ]((M)) ∧ (M). Since w2 (a) is universally conjunctive, we have: L H S ⊆ (w1 ∪ u)(a)(H) ∧ wlp[w2 ](a)((w1 ∪ u)∗ (s)(H) ∧ wlp[w2 ](s)(X ) ∧ (M)) ∧ (M) ⊆ (w1 ∪ u)(a)(H) ∧ wlp[w2 ](a)((w1 ∪ u)∗ (s)(X )) ∧ (M) ⊆ (w1 ∪ u)(a)((w1 ∪ u)∗ (s)(X )) = (w1 ∪ u)∗ (a; s)(X ) = (w1 ∪ u)8 (C)(X ) by using Theorem 8.4.27 and the induction hypothesis on s and a. In general, the induction hypothesis on s ∈ A∗ leads to
LHS = (w1 ∪ u)∗ (s)(H) ∧ wlp[w2 ](s)(X ) ∧ (M) s∈C
=
s∈C ∗
[(w1 ∪ u) (s)(H) ∧ wlp[w2 ](s)(X ) ∧ (M)]
s∈C
⊆
(w1 ∪ u)∗ (s)(X )
s∈C
= (w1 ∪ u)8 (C)(X ) and this completes the proof of claim 3. • claim 4. U is D[w1 ]-invariant.
P1: SBT CUUS834-08
cuus834-gay
356
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
In fact, for any u ∈ U, claim 3, together with Lemma 8.4.26, yields: D[w1 ](u)(h)(H) ∧ wlp[w2 ](h)(X ) ∧ (M) = (w1 ∪ u)8 (body(h))(H) ∧ wlp[w2 ](body(h))(X ) ∧ (M) ≤ (w1 ∪ u)8 (body(h))(X ) ≤ D[w1 ](u)(h)(X ). This means D[w1 ](u) ∈ U. • Claim 5. U is sup-closed. It follows from Theorem 8.4.27 that wlp[w2 ] = (w2 ∪ gfp(D[w2 ]))8 ◦ body = (w2 ∪ (D[w2 ] ↓ α))8 ◦ body for some ordinal number α. Then claim 1 implies wlp[w2 ](h)(X ) ∈ [M] for all h ∈ H and X ∈ S(H). For any u i ∈ U (i ∈ I ), we obtain: 6 ( u i )(h)(H) ∧ wlp[w2 ](h)(X ) ∧ (M) i∈I
6
=(
u i (h)(H)) ∧ wlp[w2 ](h)(X ) ∧ (M)
i∈I
⊆
6
(u i (h)(H) ∧ wlp[w2 ](h)(X ) ∧ (M))
i∈I
⊆
6
u i (h)(X )
i∈I
6
=(
u i )(h)(X )
i∈I
4 by Lemmas 8.4.4 and 8.4.5. Thus, i∈I u i ∈ U. Finally, combining claims 3, 4 and 5 and Theorem 8.4.27 we assert that lfp(D[w1 ]) = Lfp(D[w1 ]) ∈ U, and we complete the proof by using Claim 3 once again and by noting that wp[w1 ] = (w1 ∪ lfp(D[w1 ]))8 . A weak version of universal conjunctivity of quantum weakest preconditions can be derived from universal conjunctivity of quantum weakest liberal preconditions and termination law. Corollary 8.4.31. Let w1 , w2 and M be as in Theorem 8.4.30. Then for each C ∈ A8 we have: 7 7 (i) wp[w](C)( i∈I X i ) ⊆ i∈I wp[w](C)(X i ).
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
357
(ii) If I = ∅ then it holds that
wp[w](C)(X i ) ∧ (M) ⊆ wp[w](C)( X i ). i∈I
i∈I
8.4.10 Induction Rules Hoare’s induction rule (Hoare 1971) is a basic tool of establishing partial correctness of recursive procedures. It may be easily generalized to quantum programs with the projective predicate transformer semantics. Theorem 8.4.32 (Hoare’s induction rule). Let h i ∈ H (i ∈ I ), let w : S → QMT (H), and let X i , Yi ∈ S(H) (i ∈ I ). Suppose that for all homomorphisms ϕ with ϕ|S = w, X i ⊆ ϕ(h i )(Yi ) for every i ∈ I implies X i ⊆ ϕ(body(h i ))(Yi ) for every i ∈ I. Then X i ⊆ wlp[w](h i )(Yi ) for every i ∈ I . Proof. Put U = {u : QMT (H) H : X i ⊆ u(h i )(Yi ) for all i ∈ I }. It is obvious that U is inf-closed. For any u ∈ U, we see from Lemma 8.4.20 that (w ∪ u)8 is a homomorphism. In addition, we have: (w ∪ u)8 (h i )(Yi ) = u(h i )(Yi ) ⊇ X i for all i ∈ I , and (w ∪ u)8 |S = w. Then the assumption yields: D[w](u)(h i )(Yi ) = (w ∪ u)8 (body(h i ))(Yi ) ⊇ X i for all i ∈ I . Hence, U is D[w]−invariant. With Theorem 8.4.21 we obtain gfp(D[w]) ∈ U; that is, wlp[wi ](h i )(Yi ) = gfp(D[w])(h i )(Yi ) ⊇ X i for all i ∈ I.
Similarly, we are able to prove the following quantum generalization of Hesselink’s necessity rule, which is useful for proving that a recursive procedure does not satisfy a specification (see Hesselink 1992, Section 2.7). Theorem 8.4.33 (Hesselink’s necessity rule). Let h i ∈ H (i ∈ I ), let w : S → QMT (H), and let X i , Yi ∈ S(H) (i ∈ I ). Suppose that for all homomorphisms ϕ with ϕ|S = w, ϕ(h i )(Yi ) ⊆ X i for every i ∈ I
P1: SBT CUUS834-08
cuus834-gay
358
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
implies ϕ(body(h i ))(Yi ) ⊆ X i for every i ∈ I. Then wp[w](h i )(Yi ) ⊆ X i for every i ∈ I .
8.5 Conclusion This chapter presents a systematic exposition of predicate transformer semantics of quantum programs. The chapter is divided to two main parts. The first part is devoted into a thorough review of the D’Hondt-Panangaden approach to quantum predicate transformer semantics where quantum predicates are treated as observables with their eigenvalues within the unit interval. In the second part, we choose to deal with a special class of quantum predicates, namely projection operators. This allows us to establish a quite complete predicate transformer semantics for quantum programs by employing some powerful mathematical tools from Birkhoff–von Neumann quantum logic. In particular, various healthiness conditions are introduced, and the universal conjunctivity, termination law, and Hoare’s induction rule are generalized into the quantum setting. The relationship between projective weakest preconditions and the D’Hondt-Panangaden quantum weakest preconditions are carefully examined. An interesting topic for further studies would be to establish a link between quantum predicate transformer semantics and Kozen’s probabilistic predicate transformer semantics (Kozen 1981) through the Gleason theorem (Dvureˇcenskij 1993). This chapter focuses on establishing a mathematical foundation of quantum predicate transformer semantics. So, a more important topic for further studies would be to apply the abstract mechanism developed in the present chapter to quantum program verification or development. In fact, D’Hondt and Panangaden (2006) used their approach to give a semantics of Selinger’s QPL (Selinger 2004), and the D’Hondt-Panangaden approach to quantum predicate transformer semantics was also used by the authors of the present chapter (Feng et al. 2007) to give proof rules for the correctness of programs written in a simple language fragment that may describe the quantum part of a future quantum computer in Knill’s architecture (Knill 1996). In a forthcoming paper, we will systematically use the projective predicate transformer semantics developed in the second part of this chapter in reasoning about programs written in the existing quantum ¨ ¨ programming languages, e.g., Omer’s QCL (Omer 2003), Sander and Zuliani’s qGCL (Sanders and Zuliani 2000), and Selinger’s QPL (Selinger 2004), as well as quantum loops defined in Ying and Feng (2006). In Zuliani (2004), Zuliani initiated a study of nondeterministic quantum programming. In the future studies, we hope to define the notion of refinement relation between quantum programs based on quantum predicate transformer semantics and eventually build a refinement calculus for supporting stepwise refinement strategy in quantum programs development by combining the work reported in this chapter with that of Zuliani (2004).
P1: SBT CUUS834-08
cuus834-gay
978 0 521 51374 6
8
October 31, 2009
17:17
Predicate Transformer Semantics of Quantum Programs
359
Furthermore, we believe that quantum backward semantic techniques and quantum refinement calculus will even find their applications in quantum engineering design, an area much wider than quantum programming.
Acknowledgment The authors are very grateful to the anonymous referees for their invaluable comments and suggestions, which helped to improve considerably the presentation of this paper. The first three authors would also like to express their sincere thanks to Professor Chengqi Zhang, Director of the Center of Quantum Computation and Intelligent Systems, University of Technology, Sydney, for providing the excellent working environment. This work was partly supported by the National Foundation of Natural Sciences of China (Grant No: 60736011, 60621062) and the National Key Project for Fundamental Research of China (Grant No: 2007CB807901).
Bibliography Birkhoff, G., and von Neumann, J. (1936) The logic of quantum mechanics. Annals of Mathematics 37:823–843. Bruns, G., and Harding, J. (2000) Algebraic aspects of orthomodular lattices. In Coecke, B., Moore, D., and Wilce, A., editors, Current Research in Operational Quantum Logic: Algebras, Categories, Languages, pages 37–65. Kluwer. Butler, M. J., and Hartel, P. H. (1999) Reasoning about grover’s quantum search algorithms using probabilistic wp. ACM Transactions on Programming Languages and Systems 21:417–430. D’Hondt, E., and Panangaden, P. (2006) Quantum weakest preconditions. Mathematical Structures in Computer Science 16:429–451. Diestel, J., and Uhl, J. J. Jr., (1977) Vector Measures. American Mathematical Society. Dijkstra, E. W. (1976) A Discipline of Programming. Prentice-Hall. Dijkstra, E. W., and Scholten, C. S. (1990) Predicate Calculus and Program Semantics. SpringerVerlag. Dvureˇcenskij, A. (1993) Gleason’s Theorem and Its Applications. Kluwer. Feng, Y., Duan, R. Y., Ji, Z. F., and Ying, M. S. (2007) Proof rules for correctness of quantum programs. Theoretical Computer Science 386:151–166. Gay, S. J. (2006) Quantum programming languages: survey and bibliography. Mathematical Structures in Computer Science 16:581–600. Gudder, S. (1996) Lattice properties of quantum effects. Journal of Mathematical Physics 37:2637–2642. Hesselink, W. H. (1992) Programs, Recursion and Unbounded Choice: Predicate-Transformation Semantics and Transformation Rules. Cambridge University Press. Hoare, C. A. R. (1971) Procedures and parameters: an axiomatic approach. In Engeler, E., editor, Symposium on Semantics of Algorithmic Languages, pages 102–116. Lecture Notes in Mathematics 188, Springer-Verlag. Kadison, R. (1951) Order properties of bounded self-adjoint operators. Proceedings of American Mathical Society 34:505–510. Kalmbach, G. (1983) Orthomodular Lattices. Academic Press. Knill, E. (1996) Conventions for quantum pseudocode. Technical Report LAUR-96-2724, Los Alamos National Laboratory. Kozen, D. (1981) Semantics of probabilistic programs. Journal of Computer and System Sciences 22:328–350.
P1: SBT CUUS834-08
cuus834-gay
360
978 0 521 51374 6
October 31, 2009
17:17
Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji
Kraus, K. (1983) States, Effects and Operations: Fundamental Notions of Quantum Theory. Springer-Verlag. Lloyd, J. W. (1987) Foundations of Logic Programming. Springer-Verlag. Morgan, C. C., McIver, A. K., and Seidel, K. (1996) Probabilistic predicate transformers. ACM Transactions on Programming Languages and Systems 18:325–353. Nielsen, M. A., and Chuang, I. L. (2000) Quantum Computation and Quantum Information. Cambridge University Press. ¨ Omer, B. (2003) Structured Quantum Programming. Ph.D. thesis, Technicla Unviersity of Vienna. Prugove˘cki, E. (1981) Quantum Mechanics in Hilbert Space. Academic Press. Putnam, C. R. (1967) Commutation Properties of Hilbert Space Operators and Related Topics. Springer-Verlag. Sanders, J. W., and Zuliani, P. (2000) Quantum programming. In Proceedings of Mathematics of Program Construction 2000, pages 80–99. LNCS 1837. Scott, D. S. (1970) Outline of a mathematical theory of computation. In Proceedings of 4th Annual Princeton Conference on Information Sciences and Systems, pages 169–176. Selinger, P. (2004) Towards a quantum programming language. Mathematical Structures in Computer Science 14:527–586. Takeuti, G. (1981) Quantum set theory. In Beltrametti, E., and Fraassen, B. C. v., editors, Current Issues in Quantum Logics, pages 303–322. Plenum. Varadarajan, V. S. (1985) Geometry of Quantum Theory. Springer-Verlag. Ying, M. S. (2000) Automata theory based on quantum logic (i), (ii). International Journal of Theoretical Physics 39:985–995; 2545–2557. Ying, M. S. (2005) A theory of computation based on quantum logic (i). Theoretical Computer Science 344:134–207. Ying, M. S. (2007) Quantum logic and automata theory. In Engesser, K., Gabbay, D., and Lehmann, D., editors, Handbook of Quantum Logic and Quantum Structures, pages 619–754. Elsevier. Ying, M. S., Chen, J. X., Feng, Y., and Duan, R. Y. (2007) Commputativity of quantum weakest preconditions. Information Processing Letters 104:152–158. Ying, M. S., and Feng, Y. (2006) Quantum loop programs. http://arxiv.org/abs/quant-ph/ 0605218. Zuliani, P. (2004) Non-deterministic quantum programming. In Selinger, P., editor, Proceedings of the 2nd International Workshop on Quantum Programming Languages, pages 179–195. TUCS General Publication No 33, Turku Centre for Computer Science, Turku, Finland.
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
October 31, 2009
15:46
9 The Structure of Partial Isometries Peter Hines and Samuel L. Braunstein
Abstract It is well known that the “quantum logic” approach to the foundations of quantum mechanics is based on the subspace ordering of projectors on a Hilbert space. In this paper, we show that this is a special case of an ordering on partial isometries, introduced by Halmos and McLaughlin. Partial isometries have a natural physical interpretation, however, they are notoriously not closed under composition. In order to take a categorical approach, we demonstrate that the Halmos-McLaughlin partial ordering, together with tools from both categorical logic and inverse categories, allows us to form a category of partial isometries. This category can reasonably be considered a “categorification” of quantum logic – we therefore compare this category with Abramsky and Coecke’s “compact closed categories” approach to foundations and with the “monoidal closed categories” view of categorical logic. This comparison illustrates a fundamental incompatibility between these two distinct approaches to the foundations of quantum mechanics.
9.1 Introduction As early as 1936, von Neumann and Birkhoff proposed treating projectors on Hilbert space as propositions about quantum systems (Birkhoff and von Neumann 1936), by direct analogy with classical order-theoretic approaches to logic. Boolean lattices arise as the Lindenbaum-Tarski algebras of propositional logics, and as the set of all projectors on a Hilbert space also forms an orthocomplemented lattice, the operations meet, join, and complement were analogously interpreted as the logical connectives conjunction, disjunction, and negation. However, the lattice of projectors is not a Boolean lattice, so this interpretation requires modifications to the rules of propositional logic (notably the distributive law, A ∧ (B ∨ C) = (A ∧ B) ∨ (A ∧ C) fails and is replaced by the weaker condition A ≤ C ⇒ A ∧ ( A⊥ ∨ C) = C). The resulting system of orthomodular lattices has become known as quantum logic, and a number of authors (Finkelstein 361
P1: SBT CUUS834-09
cuus834-gay
362
978 0 521 51374 6
October 31, 2009
15:46
Peter Hines and Samuel L. Braunstein
1962; Putnam 1969) have suggested that the nonclassical behavior of quantum systems simply results from the fact that orthomodular lattices, rather than Boolean lattices, provide the “natural logic” of such systems. This paper does not take a position on this claim, although we do discuss arguments for and against a logical interpretation of orthomodular lattices. Instead, we consider a natural order-theoretic generalization, where the dynamics of quantum systems may also be viewed in order-theoretic terms. The lattice of projectors on a Hilbert space is an inherently static view of a quantum system. In the usual treatment, the dynamics of a system is interpreted in terms of operations on this lattice – for example, a unitary map induces an automorphism of the orthomodular lattice of projectors. However, a specific subspace may be considered as providing partial information about a quantum system, whereas an automorphism is an inherently global operation. Thus the “static” view provided by quantum logic is based on partial information, whereas the “dynamics” is based on a global view. In this paper we study combinations of dynamical processes (considered as unitary maps) and measurements (considered as projectors), from both an ordertheoretic and category-theoretic viewpoint. To this end, we study partial isometries. These generalize both projectors and unitaries in a natural way, and we demonstrate in Corollary 9.3.7 that partial isometries on a finite-dimensional space may be characterized as the composite of a unitary map and a projector (the infinite-dimensional case is, not unexpectedly, more complex). Partial isometries also have a natural partial order introduced by Halmos and McLaughlin (1963), and when restricted to projectors this is exactly the partial order of the orthomodular lattice of “quantum propositions.” Using this partial order, we study partial isometries from a category-theoretic point of view. It is well known (Erdelyi 1968) that the composite of two partial isometries is not, in general, a partial isometry. However, there is a natural associative composition (based on the conjunction of quantum logic and closely related to the treatment of partial isometries in inverse semigroup theory) that allows us to define a category of partial isometries. The resulting category is shown to be an inverse category. Inverse categories also have a natural partial order on their hom-sets – this is exactly the Halmos-McLaughlin partial order and hence, when restricted to projectors, the orthomodular lattice ordering of quantum logic. Given this “categorification” of quantum logic, a natural question is then: what are the similarities and differences between the resulting categorical structures, and Abramsky and Coecke’s “categorical foundations” program for quantum mechanics (Abramsky and Coecke 2004)? We demonstrate that superficially there is a good case to be made for agreement between the two categorical approaches, but despite this, detailed calculations shows that they are incompatible. However, the reason for this incompatibility is somewhat unsatisfactory; the categorical foundations approach is based on compact closure, as an abstract version of postselected teleportation. However, a treatment of this cannot be given in the category of partial isometries, due
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
9
October 31, 2009
15:46
The Structure of Partial Isometries
363
to its inability to express postselection. We further demonstrate that no possible agreement can be found; as an application of general categorical principles we show that the category of partial isometries is not closed, never mind compact closed. From a categorical logic point of view, this is the statement that this categorification of quantum logic cannot be made to fit within the “monoidal closed categories” approach to categorical logic.
9.2 The Order Theory of Projectors and “Quantum Logic” The order theory of projectors on Hilbert space is the foundation of the “quantum logic” of Birkhoff/von Neumann (Birkhoff and von Neumann 1936). The partial order on projectors is defined as follows: Definition 9.2.1 (The lattice of projectors on a Hilbert space). Let E, F : H → H be projectors (i.e., self-adjoint idempotents) on a Hilbert space H . We say that E is below F, written E ≤ F when E F = E. Note that this implies E F = F E. It is straightforward to check that ≤ is a partial order, and the set of all projectors on H forms a lattice, with top element the identity map = 1 H and bottom element the zero map ⊥ = 0 H . The meet and join of this lattice may be given explicitly: Proposition 9.2.2 (Partial orders and meets on projectors). Let E, F be projectors on some Hilbert space, corresponding to the subspaces HE , HF respectively. Then (i) The join E ∨ F is defined by E ∨ F = I n f {G : E ≤ G and F ≤ G} and is simply the projector onto the smallest subspace containing both HE and HF . (ii) The meet E ∧ F is defined by E ∧ F = Sup{G : G ≤ E and G ≤ F} and is the projector onto the largest subspace contained within both HE and HF . It may be given given explicitly by E ∧ F = lim N →∞ (E F) N = lim n→∞ (F E) N . Proof. We refer to Jauch (1986) for these results, and Shimony (1970) for a proposed physical interpretation of the meet operation. We illustrate the preceding characterization of the meet, with two one-dimensional subspaces P, Q, in Figure 9.1. Lattices of projectors on Hilbert space are shown in Piron (1976) to be orthomodular lattices, defined as follows: Definition 9.2.3 (Orthomodular lattices, orthocomplemented lattices). Let L , ≤ be a complete lattice. We say that it is orthocomplemented when there exists an
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
364
October 31, 2009
15:46
Peter Hines and Samuel L. Braunstein
P R2 (x,y)
Q
Figure 9.1. The meet of two projectors, in R2
involution ( )⊥ : L → L that satisfies (i) A ∨ A⊥ = . (ii) A ∧ A⊥ = ⊥. (iii) A ≤ B if and only if B ⊥ ≤ A⊥ . An orthocomplemented lattice L is called orthomodular if it satisfies the additional condition (iv) A ≤ B implies B = A ∨ ( A⊥ ∧ B) The canonical example of an orthomodular lattice is the lattice of projectors on a Hilbert space (in fact, we refer to Gleason, 1957, for a stronger statement). The orthocomplement of the projector onto a subspace S ≤ H is simply the projector onto the orthogonal complement S ⊥ = {h ∈ H : s|h = 0 , ∀ s ∈ S}. Orthomodular lattices as logics. Following a long-established tradition in order theory, “quantum logic” treats the elements of a lattice of projectors as propositions, and meet and join as conjunction and disjunction respectively (although note the failure of the distributive law described in Section 9.1). The involution is interpreted as negation and satisfies analogues of de Morgan’s laws (P ∧ Q)⊥ = P ⊥ ∨ Q ⊥ . At this point, readers familiar with mathematical logic will naturally wonder about implication. By analogy with order-theoretic approaches to classical logic, there are five distinct candidates for an implication. The most commonly studied is the Sasaki hook, which may be defined in terms of conjunction, disjunction, and S
negation as P → Q = P ⊥ ∨ (P ∧ Q). As we will discuss in Section 9.7.1, it is controversial whether this should be accepted as a genuine implication. We refer to Hellman (1981) for properties of the Sasaki hook and a strong defense of this connective as a form of implication. Quantum logic and foundations of quantum mechanics. We emphasize that we are not taking a position on “quantum logic” as a foundation for quantum mechanics. Rather, we consider a natural order-theoretic generalization that introduces a notion of partial dynamics as an intrinsic part of this order theory, in order to study
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
9
October 31, 2009
The Structure of Partial Isometries
15:46
365
quantum logic from a categorical viewpoint. For an introduction to quantum mechanics via quantum logic, we refer to Hughes (1989) for an excellent exposition. We also refer to Griffiths (2002) for the related, but conflicting, “consistent histories” approach to foundations, and to Vickers (1989) and Abramsky (1991) for connections between order theory, logic, and computation in the classical world.
9.3 Partial Isometries As stated in the introduction, the objective of this paper is to introduce a notion of partial dynamics to the lattice of projectors on Hilbert spaces. We do this by considering both the order theory and category theory of partial isometries. We first present the definitions and various simple properties. The following definitions are taken from Halmos and McLaughlin (1963). Definition 9.3.1 (Partial isometries, initial and final subspaces, isometries). Let L : H1 → H2 be a linear map of Hilbert spaces, and denote its adjoint by L ∗ : H2 → H1 . Then L is a partial isometry when L ∗ L : H1 → H1 is a projector, and hence (or equivalently) L L ∗ : H2 → H2 is a projector. The projectors E L = L ∗ L : H1 → H1 and FL = L L ∗ : H2 → H2 are called the initial and final projectors of L, and the corresponding subspaces are the initial and final subspaces. When the initial subspace is the whole of H1 , then L is called an isometry. There is no standard terminology for the adjoint of an isometry, where the final subspace is the whole of H2 . Given a partial isometry L, it is immediate that L ∗ is also a partial isometry and the initial projector of L is the final projector of L ∗ . Both unitary maps and projectors are trivially partial isometries. The initial and final projectors of a unitary map are the global identities on its source and target space, and a projector is its own initial and final projector.
9.3.1 Basic Properties We establish some basic algebraic results on partial isometries: Proposition 9.3.2 (Standard results on partial isometries). Given partial isometries L : H1 → H2 , M : H2 → H3 , N : K 1 → K 2 , then: (i) L is a unitary map between its initial and final subspaces. (ii) L L ∗ L = L and L ∗ L L ∗ = L ∗ . (iii) When the initial and final projectors of L : H1 → H2 are the global identities of H1 and H2 respectively, then L is a unitary map. (iv) M L : H1 → H3 is a partial isometry exactly when the initial projector of M commutes with the final projector of L, so E M FL = FL E M . (v) L ⊕ N : H1 ⊕ K 1 → H2 ⊕ K 2 is a partial isometry. (vi) L ⊗ N : H1 ⊗ K 1 → H2 ⊗ K 2 is a partial isometry. Proof. Results (i)–(iv) are taken from Erdelyi (1968), and results (v) and (vi) are a simple consequence of linearity. Note that (ii) states that the adjoint ( )∗
P1: SBT CUUS834-09
cuus834-gay
366
978 0 521 51374 6
October 31, 2009
15:46
Peter Hines and Samuel L. Braunstein
is a generalized inverse (in the sense of semigroup theory; Lawson, 1998) on partial isometries. However, the set of all partial isometries on a Hilbert space H is neither a regular nor an inverse semigroup, since by (iv), it is not closed under composition. Corollary 9.3.3. The composite of a unitary and a partial isometry is always a partial isometry. Proof. The initial and final projectors of a unitary map U : H → K are the global identities on H, K respectively. The result then follows trivially from (iv) of Proposition 9.3.2.
9.3.2 The Halmos-McLaughlin Partial Order We now show that the partial order on projectors given in Section 9.2 is a special case of the partial order on partial isometries given by Halmos and McLaughlin (1963): Definition 9.3.4 (The Halmos-McLaughlin partial order). The partial order on partial isometries is defined in Halmos and McLaughlin (1963) by L K ⇔ L = K EL or equivalently, L K ⇔ L = FL K i.e., K , when restricted to the initial subspace of L, or corestricted to the final subspace of L, is exactly L. It is then immediate that , when restricted to projectors, is exactly the orthomodular lattice partial ordering of Definition 9.2.1. We refer to as the Halmos-McLaughlin partial order, or HML partial order. The projectors on a space H may be characterized as partial isometries beneath the identity 1 H . From the physical interpretation as composites of unitaries and projectors, we also have a particular interest in partial isometries that are beneath unitary maps: Definition 9.3.5 (Physical partial isometries). Given a partial isometry L : H → H satisfying L U for some unitary map U : H → H , we refer to L as a physical partial isometry. Proposition 9.3.6. Let L : H → H be a partial isometry. When the codimension of the initial subspace is equal to the codimension of the final subspace, then L is a physical partial isometry. Proof. Denote the initial subspace of L : H → H by S, and the terminal subspace by T , so S ⊕ S ⊥ = H = T ⊕ T ⊥ . By definition of partial isometries dim(S) = dim(T ), and the condition on the codimensions gives that dim(S ⊥ ) = dim(T ⊥ ), and so S ⊥ ∼ = T ⊥ . Given a (not necessarily unique) uni ⊥ ⊥ tary L : S → T exhibiting this isomorphism, we may construct a unitary
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
9
0 0 U =L+ 0 L tion that L U .
October 31, 2009
15:46
The Structure of Partial Isometries
367
: S ⊕ S ⊥ → T ⊕ T ⊥ , and it is immediate from the defini
Corollary 9.3.7. All partial isometries on finite-dimensional spaces are physical isometries. Proof. The condition on codimensions from Proposition 9.3.6 is trivially satisfied for partial isometries between finite-dimensional spaces. Counterexamples on infinite-dimensional spaces include the Cuntz-Krieger algebras of Cuntz and Krieger (1980) and the Shift operator of Guyker (1976). Interpretation. Note that the definition of a physical partial isometry is restricted to the case where the source and target space are the same. In this case, a physical partial isometry is simply one that may be “completed” to a unitary map. In general, we may often give a physical interpretation to partial isometries where the source and target space differ; as a simple example, for a norm-1 vector φ ∈ H , the bra and ket operators φ| : H → C and |φ : C → H are both partial isometries. These simple examples become important when considering the structure of the category of partial isometries, in Section 9.8.
9.4 The Interaction of Partial Isometries and Projectors We now introduce a useful technique for dealing with the interaction of partial isometries and projectors. This is strongly based on a technique from inverse semigroup theory (see, for example, Howie, 1995), although the partial isometries on a space H do not form a semigroup. Proposition 9.4.1 (“Pushing a projector through a partial isometry”). Let L : H1 → H2 be a partial isometry, and let G : H1 → H1 and D : H2 → H2 be projectors satisfying G ≤ E L and D ≤ FL . Then: (i) There exists a unique projector G ≤ FL such that LG = G L. (ii) There exists a unique projector D ≤ E L such that DL = L D . Proof. (i) Define G : H2 → H2 by G = LG L ∗ . Then (G )∗ = (LG L ∗ )∗ = LG L ∗ , so G is self-adjoint. Similarly, G G = LG L ∗ LG L ∗ = LG E L G L ∗ = LGG L ∗ = LG L ∗ = G so G is idempotent, and hence it is a projector. Now note G L = LG L ∗ L = LG E = L E G = L L ∗ LG = LG as required. To show that G ≤ L F , note that G F = G L L ∗ = LG L ∗ L L ∗ = LG E L ∗ = L E L ∗ = L L ∗ L L ∗ = F 2 = F.
P1: SBT CUUS834-09
cuus834-gay
368
978 0 521 51374 6
October 31, 2009
15:46
Peter Hines and Samuel L. Braunstein
Uniqueness follows since L is a unitary when restricted to its initial / final subspaces. (ii) Defining D : H1 → H1 by D = L ∗ DL, this result follows by sym metry. This “pushing a projector through a partial isometry” operation is order-preserving, as shown: Lemma 9.4.2. Let L : H1 → H2 be a partial isometry, and let P, Q : H2 → H2 be projectors below FL . Then the unique projectors P , Q ≤ E L satisfying P L = L P , Q L = L Q satisfy P ≤ Q ⇔ P ≤ Q . Proof. (⇒) Assume P ≤ Q, so P Q = Q P = P. By construction P = L ∗ P L and Q = L ∗ Q L so P Q = L ∗ P L L ∗ Q L = L ∗ L L ∗ P Q L = L ∗ P Q L = L ∗ P L = P and hence P ≤ Q . (⇐) This proof is almost identical to (⇒) previously shown.
The technique of “pushing a projector through a partial isometry” allows us to establish a connection between partial isometries and block matrices, as follows: Proposition 9.4.3. Let U : H → K be a unitary map, let H = H1 ⊕ . . . ⊕ Ha and K = K 1 ⊕ . . . ⊕ K b be direct sum decompositions of the source and target space. We may then write U as a (b × a) block matrix U11 . . . U1a .. .. U = ... . . Ub1
. . . Uba
where Ui j : H j → K i for all 1 ≤ i ≤ a and 1 ≤ j ≤ b. For fixed i, j, the submatrix 0 ... 0 .. Bi j = ... U . ij
0
...
0
is given by Bi j = QUP where Q = 0 ⊕ 1 K i ⊕ 0 : K → K and P = 0 ⊕ 1 H j ⊕ 0 : H → H . This is then a partial isometry exactly when Q P = PQ or equivalently, Q P = P Q where Q = U −1 QU and P = UPU−1 are given by “passing the projector P (resp. Q) through the unitary U ,” as in Proposition 9.4.1. Proof. Given Bi j = QUP : H → K , then since U is unitary, FU = 1 K , and Q
FU . Therefore, by Proposition 9.4.1, QU = U Q , and this is a partial isometry with initial projector Q . Hence, by Proposition 9.3.2, QUP = U Q P is a partial
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
9
October 31, 2009
The Structure of Partial Isometries
15:46
369
isometry exactly when Q P = P Q , as required. The equivalent condition Q P = P Q follows either algebraically (by conjugation by U ), or by duality. Interpretation. We may consider a quantum computation that consists of a finite series of operations – either unitary maps or measurements1 on certain subspaces. A natural question would be whether this is equivalent to a series of unitaries (and by composition, a single unitary map) followed by a measurement. However, a unitary followed by a projector is a partial isometry, whereas a series of unitaries and projectors is not, in general. Proposition 9.4.3 gives conditions for a projector, followed by a unitary, followed by a projector to be a partial isometry (i.e., equivalent to a unitary followed by a projector), and this is easily generalized to a series of unitaries and measurements.
9.5 A Category of Partial Isometries From Proposition 9.3.2, the class of partial isometries is not closed under the usual composition of linear maps. However, with a modified composition (that we demonstrate is equivalent to a construction of Lawson, 1998), partial isometries not only are closed under composition but form an inverse category. Definition 9.5.1 (Inverse categories, generalized inverses). Inverse categories are the natural extension of inverse monoids to the many-object case (Lawson 1998). A category C is inverse when for every arrow f ∈ C(X, Y ), there exists a unique generalized inverse f −1 ∈ C(Y, X ) satisfying f f −1 f = f and f −1 f f −1 = f −1 . We emphasize that this axiom does not imply f −1 f = 1 X or f f −1 = 1Y . Generalized inverses that satisfy these additional conditions are called left and right global inverses respectively. Interpretation. The usual computer science interpretation of inverse categories is strictly stronger than simply requiring reversibility. Rather, inverse categories are used (as in Hines 1997; Haghverdi 2000; Abramsky et al. 2002; Hines and Scott 2009) to model resource-sensitive systems, where copying and deleting are either forbidden, or strictly controlled (such as the Linear Logic of Girard, 1987). When modeling quantum information, we would also expect similar structures, due to the no-cloning and no-deleting theorems (Wootters and Zurek 1982; Pati and Braunstein 2000). In order to define a category of partial isometries, we give a binary operation on partial isometries that we then prove is the composition in a category: 1
For simplicity, we assume that these measurements are postselected – if the desired measurement outcome is not observed, we abandon the experiment and start again.
P1: SBT CUUS834-09
cuus834-gay
370
978 0 521 51374 6
October 31, 2009
15:46
Peter Hines and Samuel L. Braunstein
Definition 9.5.2. Given partial isometries L : H1 → H2 and M : H2 → H3 , we define M ◦ L = lim n→∞ [(M L)(M L)∗ ]n (M L) = lim n→∞ (M L) [(M L)∗ (M L)]n For readers familiar with J.-Y. Girard’s Geometry of Interaction system, (Girard 1989, 1988), this definition is clearly motivated by the execution formula.2 However, it has an even closer connection with the conjunction in quantum logic: Lemma 9.5.3. Given partial isometries M : H2 → H3 , L : H1 → H2 , as before, then M ◦ L = M(E M ∧ FL )L : H1 → H3 where E M and FL are the final and initial projectors of M and L respectively. Hence M ◦ L exists for arbitrary partial isometries L : H1 → H2 and M : H2 → H3 , and is a partial isometry. Also, when E M FL = FL E M , then M ◦ L is simply M L, the usual composition of M and L as linear maps. Proof. From Proposition 9.2.2, E M ∧ FL = lim n→∞ (E M FL )n = lim n→∞ (FL E M )n . For arbitrary n ≥ 1, [(M L)(M L)∗ ]n (M L) = (M L L ∗ M ∗ )n M L, and rebracketing gives [(M L)(M L)∗ ]n (M L) = M(L L ∗ M ∗ M)n L = M(FL E M )n L . Hence lim n→∞ [(M L)(M L)∗ ]n (M L) = lim n→∞ M(FL E M )n L = M(E M ∧ FL )L . As E M ∧ FL is a projector that commutes with both E M and FL , it follows from Proposition 9.3.2 that: (i) (E M ∧ FL )L : H1 → H2 is a partial isometry, (ii) M(E M ∧ FL ) : H1 → H2 is a partial isometry, (iii) and hence M(E M ∧ FL )L : H1 → H3 is a partial isometry. Finally, when E M FL = FL E M , then E M ∧ FL = E M FL = FL E M , and so M ◦ L = M L. Theorem 9.5.4. Partial isometries, with the composition given previously, form an inverse category. 2
As a historical note, the original Geometry of Interaction system was presented in terms of partial isometries acting on infinite-dimensional Hilbert spaces. However – as noted by many authors (Abramsky 1996; Abramsky et al. 2002; Haghverdi 2000; Hines 1997) – the partial isometries used were of a very special form. Precisely, all the action takes place within the image of Barr’s injective functor (Barr 1992) from partial injections into Hilbert spaces, l2 : pInjop → Hilb. Thus, although partial isometries were used, all initial and all final projectors commute. This is clearly a very restricted case, and in that sense the framework of Hilbert spaces and partial isometries can be considered as “useless superstructure.”
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
9
October 31, 2009
15:46
The Structure of Partial Isometries
371
Proof. It is shown in Lawson (1998) that the set of all partial isometries acting on a single space together with this composition is an inverse monoid. The extension to the many-object case is immediate. Notation. We denote the category of partial isometries with the foregoing composition by pIsom. By contrast, we denote the category of continuous linear maps on Hilbert spaces (with the usual composition) by Hilb. We use the notation ◦ for the composition in pIsom and simply use concatenation to denote the composition in Hilb. In both cases, we have a particular interest in the case where we restrict to finite-dimensional spaces. We denote these restrictions by HilbFD and pIsom F D . Not only is the category pIsom closed under the composition ◦, but there is a very strong sense in which the composition M ◦ L can be thought of as a supremum within the HML partial ordering, as follows: Proposition 9.5.5. Let M : H2 → H3 and L : H1 → H2 be partial isometries, and let P : H2 → H2 be a projector such that M P : H2 → H3 and P L : H1 → H2 and M P L : H1 → H3 are all partial isometries. Then M P L M ◦ L, where is the HalmosMcLaughlin partial order of Definition 9.3.4. Proof. Since M P and P L are partial isometries, from Proposition 9.3.2, P E M = E M P and P FL = FL P. Hence Q = E M P FL is a projector satisfying M P L = M Q L. We now work with this projector Q. By construction, Q ≤ E M and Q ≤ FL , so by definition Q ≤ (E M ∧ FL ). Now consider the unique projectors Q , R : H1 → H1 satisfying M Q L = M L Q and M(E M ∧ FL )L = M L R given as in Proposition 9.4.1. From Lemma 9.4.2, we deduce Q ≤ R, so Q R = Q , and so M L R Q = M L Q . However, by definition of the Halmos-McLaughlin partial order, M P L = M Q L = M L Q M L R = M(E M ∧ FL )L as required.
It is then straightforward to write down the initial and final projectors of M ◦ L. These are closely related to the notion of “pushing a projector through a partial isometry” as given in Proposition 9.4.1. Corollary 9.5.6. Let L : H1 → H2 and M : H2 → H3 be as before. Then (i) The initial projector of M ◦ L is the unique projector P ≤ E L satisfying (E M ∧ FL )L = L P, as in Proposition 9.4.1. (ii) The final projector of M ◦ L is the unique projector Q ≤ FM satisfying Q M = M(E M ∧ FL ), as in Proposition 9.4.1. Proof. The initial projector P of M(E M ∧ FL )L may be given explicitly by P = L ∗ (E M ∧ FL )M ∗ M(E M ∧ FL )L = L ∗ (E M ∧ FL )E M (E M ∧ FL )L .
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
372
October 31, 2009
15:46
Peter Hines and Samuel L. Braunstein
Figure 9.2. The composition M ◦ L of partial isometries
However, (E M ∧ FL ) ≤ E M and (E M ∧ FL )2 = E M ∧ FL , so P = L ∗ (E M ∧ FL )L. The final projector Q may similarly be shown to be Q = M(E M ∧ FL )M ∗ . Results (i) and (ii) then follow by comparing these explicit forms with Proposition 9.4.1.
9.6 The Inverse Structure of pIsom From the characterization of the composition given in Proposition 9.5.3 and the inverse category-theoretic result of Theorem 9.5.4, there is a simple graphical representation of the composition ◦, as shown in Figure 9.2. We now consider the consequences of the inverse structure on partial isometries. An immediate corollary is the commutativity of projectors, as follows: Corollary 9.6.1. (i) The idempotents of pIsom are exactly the projectors of Hilb. (ii) All projectors (at the same object) commute, so E ◦ F = F ◦ E. (iii) Given projectors E, F : H → H , then E ◦ F = E ∧ F. Proof. (i) Consider an idempotent L ◦ L = L in pIsom. Then L = L(E L ∧ FL )L, and hence E L ≤ FL and FL ≤ E L . Therefore, E L = FL , and so L ◦ L = L L, and L is thus idempotent in the category Hilb. Hence, as L is a partial isometry it is Hermitian, and so L is a projector. (ii) The commutativity of idempotents follows from the uniqueness of generalized inverses, as standard result of inverse semigroup theory (Munn and Penrose 1955). (iii) This is immediate from the definition of the composition ◦.
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
9
October 31, 2009
The Structure of Partial Isometries
15:46
373
Commutativity of projectors. The commutativity of projectors in pIsom follows from the existence and uniqueness of generalized inverses, and therefore is an essential feature of this category. We note the strong distinction with the “matrix mechanics” formulation of quantum mechanics and the behavior of projectors in the category Hilb, where the noncommutativity of projectors captures the “nonclassical” behavior of observations (Mehra and Rechenberg 1982).
9.6.1 Partial Orders and Inverse Structures So far, we have seen that the Halmos-McLaughlin partial order generalizes the “quantum logic” ordering of projectors on Hilbert space (Definition 9.3.4) and have used the conjunction operation of quantum logic to define a composition on partial isometries (Definition 9.5.2 and Lemma 9.5.3). This composition is then exactly the calculation of a supremum within the HML partial order (Proposition 9.5.5) and allows us to define an inverse category of partial isometries (Theorem 9.5.4). However, every inverse semigroup has a partial order defined on its elements, as in Lawson (1998), and this has an immediate generalization to the hom-sets of inverse categories: Definition 9.6.2 (The natural partial order of an inverse category). Let S be an inverse semigroup. The natural partial order on S is defined by s t ⇔ ∃ e2 = e s = te. We refer to Lawson (1998) for proof that this is indeed a partial order and its properties. The generalization of this notion to inverse categories is immediate. Let C be an inverse category, and consider f, g ∈ C(X, Y ). We extend the preceding definition in the obvious way, so f g ⇔ ∃ e2 = e ∈ C(X, X ) f = ge and this makes the hom-set C(X, Y ) into a partial order. Theorem 9.6.3. The Halmos-McLaughlin partial order is exactly the natural partial order on the inverse category pIsom. Proof. Consider L , M ∈ pIsom(H, K ). • (⇒) Assume L K . Then by definition, L = M E L . Hence, as M E L is a partial isometry, M E L = M(E M ∧ E L ) = M ◦ E L , so L M. • (⇐) Assume L M, so there exists some G 2 = G ∈ pIsom(H, H ) such that L = M ◦ G. Therefore, L ◦ G = M ◦ G ◦ G = M ◦ G = L, and the initial subspace of L is a subspace of the initial subspace of M. Hence L M, as required.
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
374
October 31, 2009
15:46
Peter Hines and Samuel L. Braunstein
The natural partial order and the generalized inverse. Although there is a close connection between the generalized inverse and the natural partial order of an inverse category, we emphasize that the generalized inverse is not an orthocomplement. In particular, given f g ∈ C(X, Y ), then f −1 g −1 ∈ C(Y, X ). Not only is the generalized inverse not an orthocomplement, but pIsom(H, H ) cannot in general be orthocomplemented since in general L 1 H , so we do not even have a lattice structure.3 We refer to Lawson (1998) for a comprehensive list of properties of from a semigroup-theoretic point of view.
9.7 Category-Theoretic Structures and “Quantum Logic” Now that we have established the structure of the category of partial isometries, we make an explicit comparison with the categorical structures used in the “categorical foundations” program for quantum mechanics. We base this comparison on the logical interpretations in both cases. We first summarize – without taking a position ourselves – various criticisms of the Birkhoff–von Neumann quantum logic program. This demonstrates that the controversial features (the treatment of the tensor product, and interpretation of implication) are exactly the elements taken as primitive in categorical logic generally. We then give a very brief summary of the categorical approach to logic, via closed categories, and describe the connections between a particular form of categorical closure called compact closure and the quantum properties of entanglement and teleportation, which is the basis of the categorical foundations program (Abramsky and Coecke 2004). Finally, we consider whether the category of partial isometries is compact closed, or indeed closed at all. This is in order to establish either a close connection or an irreconcilable difference between the logical foundations in terms of orthomodular lattices and the logical foundations in terms of compact closed categories.
9.7.1 Criticisms of Birkhoff/von Neumann’s Logical Interpretations As a general principle, the meet and the join of a lattice have a natural intuitive interpretation as conjunction and disjunction. This is the basis of interpretation of projectors as propositions in Birkhoff–von Neumann quantum logic. However, the treatment of implication is more controversial. Implication in an orthomodular lattice is often defined in terms of the Sasaki S
hook, P → Q = P ⊥ ∨ (P ∧ Q), as an analogue of how implication may be 3
This raises the natural question of what sort of order-theoretic structures are involved in the study of partial isometries. We briefly discuss this in Section 9.10. However, the emphasis here is on the categorical properties.
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
9
October 31, 2009
15:46
The Structure of Partial Isometries
375
defined in classical order-theoretic terms. The intuitive interpretation as a statement about “quantum propositions” is not straightforward – we refer to Hellman (1981), Smets (2001), and Hardegree (1979) for various proposals. More seriously, several authors (Holdsworth and Hooker 1983; Hellman 1981) have questioned whether it should be considered as an implication at all. This criticism is often based on the failure of the “deduction theorem” of classical logic: (a ∧ b) ≤ c iff a ≤ (b → c). This property is equivalent to distributivity in a lattice, and distributivity is exactly the point at which quantum logic diverges from classical logic – no connective on the lattice of projectors can satisfy this property (Malinowski 1990). Moreover, as described in Hellman (1981), failure of the deduction theorem has serious implications, among which is the failure of transitivity (that is, ( A ⇒ B) and (B ⇒ C) together imply A ⇒ C). Another criticism of the orthomodular lattices approach is that the tensor product has no natural, purely order-theoretic, definition. Although we may certainly form the tensor product of two Hilbert spaces H, K and interpret the lattice projections in the resulting space H ⊗ K as propositions about some compound system, there is no natural way of taking the lattice of projectors of H , and the lattice of projectors of K , and producing the lattice of projectors of H ⊗ K . In order to use the tensor product (and hence reason about compound systems), we need to step outside lattice theory, use Hilbert space operations, and interpret the resulting lattice of projectors. This is a drawback in the program of providing foundations for quantum mechanics purely in lattice-theoretic, or logical, terms. We now consider an alternative approach to logic generally, where implication is primitive and the conjunction (interpreted as a categorical tensor) may be defined in terms of its relationship to the implication. “Even the crows on the roofs caw about the nature of conditionals.” – Callimachus, Librarian of Alexandria, 300 .. (Kneale and Kneale 1971).
9.7.2 Logic, Category-Theoretically In the order-theoretic approach to logic, implication is defined in terms of meet and join, interpreted as conjunction and disjunction. In stark contrast (although see the end of this section), many approaches to categorical logic take the notion of implication or deduction as primitive. For example, in a categorical setting for intuitionistic logic (such as Lambek and Scott, 1986), an arrow f : A → B is treated, as per the Brouwer-Heyting-Kolmogorov interpretation (Sørensen and Urzyczyn 1998), as a proof of proposition B from the assumption of proposition A. The closure property of logic (that a proof of B from the assumption of A is equivalent to a proof of A ⇒ B) is taken as primitive and modeled by categorical closure – a hom-set of arrows C(A, B) is itself an object of C, denoted [A → B] ∈ Ob(C), and the operation [ → ] : C op × C → C is a functor (the internal hom functor) that satisfies various natural coherence conditions (LaPlaza 1977). This notion of closure describes the properties of implication, with no additional assumptions or connectives. It models logics where the only connective is an
P1: SBT CUUS834-09
cuus834-gay
376
978 0 521 51374 6
October 31, 2009
15:46
Peter Hines and Samuel L. Braunstein
implication (such as Mints, 1981), and under the Curry-Howard isomorphism (Sørensen and Urzyczyn 1998), it is used to model purely applicative structures such as combinatory logic – see Lambek and Scott (1986) for a good overview. However, it is more common to consider monoidal closed, rather than simply closed categories. In a monoidal closed category, the internal hom [ → ] : C op × C → C is related to the monoidal tensor ⊗ : C × C → C by the adjunction C( A ⊗ B, C) ∼ = C(B, [A → C]). The natural interpretation of the tensor in this setting is thus conjunction, and (up to commutativity of conjunction) there is the immediate logical interpretation of ( A ∧ B) ⇒ C is equivalent to B ⇒ (A ⇒ C). Finally, we observe that the adjunction between the monoidal tensor and the internal hom often means that one may be defined in terms of the other. In Mac Lane (1998), the fact that Abelian groups form a closed category is used along with the adjoint functor theorem to give a tensor product, and hence a monoidal closed category of Abelian groups. A similar technique is used to demonstrate the existence of a tensor product for partial commutative monoids in Hines and Scott (2009). In LaPlaza (1977), it is also shown that closed categories may always be embedded into monoidal closed categories. Thus, from a categorical point of view, there is a strong connection between the two distinct controversial areas of quantum logic – the tensor product and the implication. Relating order-theoretic and categorical approaches to logic. Although we have presented order theory and category theory as two competing, opposed approaches to logic, the reality is more subtle. Relating order-theoretic and categorytheoretic approaches has been a very fruitful area of study and has shed light on order theory, category theory, logic and theoretical computing. We refer to Lawvere (1973), Abramsky (1991), and Lambek and Scott (1986) for several examples of a large field.
9.7.3 Compact Closed Categories Compact closed categories are symmetric monoidal closed categories where the categorical closure is of a particularly well-behaved form. We refer to Kelly and Laplaza (1980) for details on compact closed categories, including a coherence theorem; Abramsky (1996) and Joyal et al. (1996) for their construction from traced monoidal categories; Abramsky (1996), Hines (1997), Abramsky et al. (2002), and Hines (2004) for logical and computational interpretations; and Hines (1999) for one-object, or untyped, compact closed categories. Definition 9.7.1 (Compact closed categories, dual on objects, dual on arrows). Let C, ⊗ be a symmetric monoidal category, with unit object I . The category C
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
9
October 31, 2009
15:46
The Structure of Partial Isometries
377
/A
A
·−→I
=
A∗
A
id A
/A
I −→·
A
/A and dually,
A∗
/ A∗
I −→·
=
A
A∗
id A∗
/ A∗
·−→I
A∗
/ A∗ Figure 9.3. Axioms for compact closure
is called compact closed when, for every object A ∈ Ob(C), there exists a dual object A∗ , together with distinguished arrows • The unit arrow A : A ⊗ A∗ → I • The counit arrow η A : I → A∗ ⊗ A that satisfy ( A ⊗ 1 A )(1 A ⊗ η A ) = 1 A and dually, (1 A∗ ⊗ A )(η A ⊗ 1 A∗ ) = 1 A∗ Using the diagrammatic notation introduced in Joyal and Street (1991) and Joyal et al. (1996), this may be drawn as in Figure 9.3. The dual operation on objects ( )∗ , together with the unit and counit arrows, may be used to define the dual on arrows. Given f ∈ C( A, B), then f ∗ ∈ C(B ∗ , A∗ ) is defined by f ∗ = (1 A∗ ⊗ B )(1 A∗ ⊗ f ⊗ 1 B ∗ )(η A ⊗ 1 B ∗ ) : B ∗ → A∗ . Diagrammatically, this is as shown in Figure 9.4. The internal hom is particularly easy to define, given by [X → Y ] = X ∗ ⊗ Y ∈ Ob(C). The details of the adjunction are then straightforward (although note that the symmetry isomorphism A ⊗ B ∼ = B ⊗ A, or similar condition, is required).
9.7.4 The Categorical Foundations Program In the categorical foundations of quantum mechanics (Abramsky and Coecke 2004; Abramsky and Duncan 2006), the teleportation protocol (Bennett et al. 1993), and the notion of teleportation as computation Brassard et al. (1998);
P1: SBT CUUS834-09
cuus834-gay
378
978 0 521 51374 6
October 31, 2009
15:46
Peter Hines and Samuel L. Braunstein 1 A∗
A∗
/ A∗
I −→·
A
f
/B ·−→I
B∗
1B∗
/ B∗
Figure 9.4. The dual operation on arrows
Braunstein et al. (2000) are taken as primitive. For physical interpretations, we refer to Bennett et al. (1993) for the standard description, and Braunstein (1996) for an alternative setting without irreversible measurements. The interpretation is based on a compact closed category (with additional structure), where the dual operation is the identity on objects, so H ∗ = H . The axioms for compact closure shown in Figure 9.3 reduce to the axiom illustrated in Figure 9.5. The monoidal tensor is interpreted as the formation of a composite system (as with the usual tensor product of Hilbert space), and the trivial object I is a one-dimensional space, so I ⊗ H ∼ =H∼ = H ⊗ I. The counit arrow η H : I → H ⊗ H is interpreted as the creation of a maximally entangled Bell state |Bell and its dual H : H ⊗ H → I is a (postselected) measurement against the same maximally entangled state. The requirement that the composite shown on the l.h.s. of Figure 9.5 is exactly the identity gives the teleportation protocol (postselected) of Bennett et al. (1993). In the concrete monoidal category (Hilb F D , ⊗) of finite-dimensional Hilbert spaces, consider an n-dimensional space H , with orthonormal basis {e1 , e2 , . . . , en }. The maximally entangled Bell state is given by Bell = n √1 j=1 e j ⊗ e j , so the corresponding unit and counit maps are Bell| : H → C n and |Bell : C → H . Direct calculation gives that this is the identity, scaled by the appropriate renormalization required for the postselection of measurement outcome.
9.7.5 Logical Interpretations Although the foundations for quantum mechanics of Section 9.7.4 are presented categorically, rather than logically, the fact that a monoidal closed (in fact, compact closed) category is key to this system leaves it open to a logical interpretation. An explicit logical interpretation is given in Duncan (2004), Abramsky and Duncan (2006), and Duncan (2007) by analogy with the connectives and structure of linear logic. The application of compact closure to logical systems arose from analyses of Girard’s Geometry of Interaction system (Girard 1989, 1988), a representation of linear logic (Girard 1987). We refer to Blute et al. (2000) for a good historical
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
9
H
October 31, 2009
15:46
The Structure of Partial Isometries
379
/H ·−→I
=
H
H
id H
/H
I −→·
H
/H
Figure 9.5. Compact closure with self-dual objects
overview. The categorical interpretation of Linear Logic as a whole is in terms of ∗-autonomous categories. However, the Geometry of Interaction system gave a representation of a restricted fragment (the multiplicatives). It was also degenerate in many ways, including the identification of the conjunction and disjunction (a case is made in Abramsky et al., 2002, that the correct interpretation of the geometry of interaction system is as a combinatory logic). The logical interpretation of the categorical analysis of Section 9.7.4 is even more degenerate, in that all objects are self-dual. In ∗-autonomous and compact closed categories, the dual ∗ is interpreted as the logical negation. However, there remains a monoidal tensor and (via the monoidal closure) an internal hom functor that satisfy the required properties for a logical system. We refer to Duncan (2004) and Abramsky and Duncan (2006) for more details.
9.8 Compact Closure, Teleportation, and Partial Isometries The category of partial isometries can reasonably be considered as a categorification of von Neumann–Birkhoff quantum logic. However, from Section 9.6.1 and the interpretation of Lemma 9.4.2, we do not expect to be able to describe all quantum operations within the category of partial isometries. In order to consider whether the category of partial isometries, as a categorification of von Neumann–Birkhoff quantum logic, fits into the general “categorical foundations” framework, we consider whether a (postselected version of) the teleportation protocol (Bennett et al. 1993) can be expressed in the category (pIsom F D , ⊗).
9.8.1 Is (pIsom F D , ⊗) Compact Closed? Before answering the preceding question, we need to explain why (apart from wishful thinking) we might think that (pIsom F D , ⊗) should be compact closed – at least, in the finite-dimensional case. A suggestive, but incorrect, train of thought is as follows: Nontheorem 9.8.1. The category (pIsom F D , ⊗) is compact closed, with self-dual objects. Nonproof. Consider the defining identity of compact closure (in the self-dual case): λ( A ⊗ 1 A )(1 A ⊗ η A )ρ −1 = 1 A .
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
380
October 31, 2009
15:46
Peter Hines and Samuel L. Braunstein
If, as in the categorical foundations described in Section 9.7.4, we interpret the counit η H and unit H as the bra and ket |Bell : C → H ⊗ H and Bell| : H ⊗ H → C, we observe that these are partial isometries. Hence, as partial isometries are closed under the tensor product, ( A ⊗ 1 A ) and (1 A ⊗ η A ) are both partial isometries. The identity isomorphisms ρ −1 : H ∼ = H ⊗ C and λ : C ⊗ H ∼ =H are trivially unitary, and so (by Corollary 9.3.3) the linear maps T ele = λ( A ⊗ 1 A ) and Por t = (1 A ⊗ η A )ρ −1 are both partial isometries. Based on the categorical foundations, we wish to claim that the composite T elePor t : H → H is the identity map (again, a partial isometry). From Theorem 9.3.2, the composite K L of two partial isometries is itself a partial isometry exactly when the final projector of L commutes with the initial projector of K , in which case (by Lemma 9.5.3) K ◦ L = K L. We thus wish to conclude that the initial projector of T ele commutes with the final projector of Por t, and so T ele ◦ Por t = T elePor t = 1 H . End of Nonproof To see that this reasoning is incorrect, we explicitly exhibit the final projector of Por t and the initial projector of T ele and show that these do not commute. Lemma 9.8.2. Consider the partial isometries T ele and Por t, defined in Nontheorem 9.8.1. Then the initial and final projectors E T ele and FPor t do not commute, so T ele ◦ Por t = T elePor t. Proof. Consider a complex N-dimensional space H with orthonormal basis {e1 , e2 , . . . , e N }. The maximally entangled Bell state is given by Bell = N √1 j=1 ei ⊗ ei , so the unit and counit maps are N N N 1 1 |e j e j and √ ek ek | √ N j=1 N k=1
respectively. From this, the partial isometries T ele : H ⊗ H ⊗ H → H and Por t : H → H ⊗ H ⊗ H may be given explicitly by N N 1 1 T ele = √ |ea eb eb ea | and Por t = √ |ei e j e j ei |. N a,b=1 N i, j=1
Thus, the final projector of Por t may be given by ∗ N N 1 1 FPor t = √ |ei e j e j ei | √ |ek el el ek | N i, j=1 N k,l=1 =
1 N
N i, j,k,l=1
|ei e j e j δik ek el el | =
N 1 |ei e j e j ei el el |. N i, j,l=1
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
9
October 31, 2009
15:46
The Structure of Partial Isometries
381
Similarly, the initial projector of T ele is given by N N 1 1 |ed ed ec ec | √ |ea eb eb ea | E T ele = √ N c,d=1 N a,b=1 1 = N
N
N 1 |ed ed ec δac eb eb ea | = |ed ed ea eb eb ea |. N a,b,d=1 a,b,c,d=1
Direct calculation verifies that E T ele FPor t = FPor t E T ele and so by Proposition 9.3.2, T ele ◦ Por t = T elePor t. What, then, has gone wrong in the reasoning in Nontheorem 9.8.1? Our claim is that the renormalization, or implicit postselection, in Section 9.7.4 is incompatible with a study of teleportation via partial isometries, as follows: Theorem 9.8.3. Consider the partial isometries T ele : H → H ⊗ H ⊗ H and Por t : H ⊗ H ⊗ H → H of Non-Theorem 9.8.1. Their composite, as linear maps, is T elePor t = N1 1 H and therefore their composite in the category pIsom F D is T ele ◦ Por t = 0 H . Proof. By direct calculation, T elePor t = =
1 N
N
1 N
N
|ea eb eb ea |ei e j e j ei |
a,b,i, j=1
|ea δbi δbj δa j ei | =
a,b,i, j=1
N 1 1 |ea ea | = I d H N a=1 N
Using the original definition of composition in pIsom, T ele ◦ Por t = lim K →∞ [(T elePor t)(T elePor t)∗ ] K T elePor t As T elePor t =
1 N
I d H is self-adjoint,
T ele ◦ Por t = lim K →∞
,
1 I dH N2
-K
1 I dH = 0H N
Why teleportation cannot be expressed in (pIsomFD , ⊗). A direct calculation has given that, as a straightforward composite of linear maps, T elePor t = N1 I d H . This extraneous factor of N1 occurs simply because the probability of observing this particular experimental outcome (i.e., the Bell state Bell = √1N Nj=1 e j ⊗ e j ) is exactly N1 . In the categorical foundations approach, postselection of measurement outcomes is used to eliminate this scaling factor, and hence give compact closure. In pIsom, we cannot simply introduce a scaling factor of N at some point to account
P1: SBT CUUS834-09
cuus834-gay
382
978 0 521 51374 6
October 31, 2009
15:46
Peter Hines and Samuel L. Braunstein
for postselection; all partial isometries (except the zero map) have operator norm of 1, and such a “scaled” unit/counit pair would no longer be members of the category.
9.8.2 Modifying pIsomFD : Rays and Renormalization Given the foregoing interpretation of why teleportation cannot be expressed in (pIsom F D , ⊗), a natural question is to wonder whether this may be “fixed” by either introducing a sufficient number of scalars (categorically, endomorphisms of the unit object; Abransky, 2005) or simply working with rays (i.e., one-dimensional subspaces) rather than norm-1 states. Partial isometries and rays. We may eliminate any notion of magnitude by working with a system based on rays, so partial isometries are characterized by their actions on one-dimensional subspaces rather than on vectors. The notion of a projector, as a self-adjoint idempotent, remains, and so we may still define partial isometries in this weaker setting. The lattice ordering of projectors also remains (albeit without Shimony’s explicit form for the meet, Proposition 9.2.2), as does the Halmos-McLaughlin partial order. However, having eliminated any notion of magnitude, the composition of Definition 9.5.2 is inapplicable, and we must use the lattice-theoretic characterization of composition given in Lemma 9.5.3, as M ◦ L = M(E M ∧ FL )L. When applied to the preceding analysis of teleportation, working with a magnitude-free system based on rays may be seen to change nothing: regardless of scaling, the initial space of Por t and the final space of T ele are both one-dimensional subspaces, and their meet is the zero-dimensional subspace, as shown in Figure 9.1. Partial isometries and abstract scalars. Alternatively, let us expand the category of partial isometries to include some natural family of abstract scalars4 {s H : H → H } H ∈Ob(pIsom) , satisfying P ◦ s H = s K ◦ P, for all P ∈ pIsom(H, K ). We further assume that (R+ , ×) ∼ = {s H } ⊆ pIsomFD (H, H ), so we have a representation of the multiplicative structure of the positive reals. Although such an extension of pIsomFD is possible, the problem is that the foregoing naturality condition relates to the composition ◦ of pIsom, rather than the usual scalar multiplication of a linear map in Hilb. Therefore, such “abstract scalars” cannot coincide with the usual “scalars” (i.e., the underlying field) of Hilb F D . Given partial isometries L ∈ pIsom F D (H, K ) and M ∈ pIsom F D (K , H ) such that M ◦ L = 0 H ∈ pIsom F D (H, H ), it is often easy to find scalars r1 , r2 ∈ C such that r2 M ◦ r1 L = lim n→∞ [(r2 Mr1 L)(r2 Mr1 L)∗ ]n (r2 Mr1 L) = 0 H . 4
In order to consider a wide range of cases, including those that may seem categorically unnatural, we do not assume that these are defined in terms of endomorphisms of the unit object as in Abramsky (2005).
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
9
October 31, 2009
15:46
The Structure of Partial Isometries
383
However, given arbitrary abstract scalars s2 , s1 , the naturality condition immediately implies that (s2 ◦ M) ◦ (s1 ◦ L) = (s2 ◦ s1 ) ◦ (M ◦ L) = s2 ◦ s1 ◦ 0 H = 0 H .
9.9 Is (pIsom F D , ⊗) Closed? So far, we have not proved that (pIsom F D , ⊗) is not compact closed. Rather we have shown that the usual way of demonstrating compact closure (as postselected teleportation) does not hold in (pIsom F D , ⊗). We now demonstrate that (pIsom F D , ⊗) cannot be monoidal closed at all (and therefore is certainly not compact closed). To demonstrate that (pIsom F D , ⊗) is not monoidal closed, we use an alternative characterization of monoidal closure, from Mac Lane (1998), equivalent to that of Section 9.7.2. This proof may be thought of as a more abstractly categorical version of the calculations of Section 9.8. Definition 9.9.1 (Monoidal closed categories, evaluation maps). Let C, ⊗ be a symmetric monoidal category. It is monoidal closed when, for all objects A, B ∈ Ob(C), there exists an internal hom object [A, B] together with an evaluation map eval A,B ∈ C( A ⊗ [A, B], B) such that, for all f ∈ C( A ⊗ X, B), there exists unique h f ∈ C(X, [ A, B]) making the following diagram commute: 1 A ⊗h f
A ⊗ XF FF FF F f FFF "
B
/ A ⊗ [A, B] tt tt tteval A,B t t tz t
Using this alternative characterization of monoidal closed categories, we demonstrate that no such evaluation map can exist within the category of finitedimensional partial isometries. Theorem 9.9.2. (pIsom F D , ⊗) is not monoidal closed. Proof. Let us assume that (pIsom F D , ⊗) is monoidal closed, so the diagram of Definition 9.9.1 commutes. Let us now consider the special case where X is the identity object for the monoidal structure and f is some unitary U : H → H . H ⊗ FI FF FF F U FFF "
1 H ⊗h U
H
/ H ⊗ [H, H ] s ss ss s ss eval H,H sy s
(For simplicity of notation, we elide the left and right units isomorphism for the monoidal structure.) As this diagram commutes, we may deduce that the final projector of the map eval H,H ∈ pIsom F D (H ⊗ [H, H ], H ) is the whole of H . Thus, the initial
P1: SBT CUUS834-09
cuus834-gay
384
978 0 521 51374 6
October 31, 2009
15:46
Peter Hines and Samuel L. Braunstein
subspace of eval H,H is a subspace of H ⊗ [H, H ] isomorphic to H itself, and so there exists some embedding embed : H $→ H ⊗ [H, H ] such that, for all U : H → H , there exists some unique kU : H → H such that the following diagram commutes: kU /H H⊗I S SSSS S 1 H ⊗h USS U embed SSS ) H ⊗ [H, H ] H o eval H,H
In the diagram, both embed ∈ pIsom F D (H, H ⊗ [H, H ]) and eval ∈ pIsom F D (H ⊗ [H, H ]) are independent of U ∈ pIsom F D (H, H ). Therefore, the subspace of h U must be some subspace of H ⊗ [H, H ] isomorphic to H . By the commutativity of the upper right triangle of this diagram, and the fact that kU must itself be unitary, the final subspace of h U is also independent of U . This then implies that, as h U has a one-dimensional initial and final subspace, for any pair of unitary maps U, U : H → H completing the diagram will demonstrate that they differ by at most some complex phase factor. As this is certainly not the case, we deduce that no such evaluation map may exist, and therefore (pIsom F D , ⊗) is not monoidal closed. The adjoint functor theorem, and orthomodularity. The usual method of proving or disproving that a complete category is monoidal closed is via an application of Freyd’s adjoint functor theorem (Mac Lane 1998) to the description of categorical closure as an adjunction. It is sometimes claimed that this theorem can be used to demonstrate that no closed structure can be built upon orthomodular lattices. However, it is also possible to use the adjoint functor theorem to demonstrate that the category of Hilbert spaces and linear maps is not closed. Recall that it is only the category of finite-dimensional Hilbert spaces that is compact closed (Abramsky et al. 1998). When working in the finite-dimensional case, the resulting categories (whether based on linear maps, partial isometries, or orthomodular lattice morphisms), are no longer complete categories – and therefore the adjoint functor theorem is inapplicable.
9.9.1 Global and Local Closure In this chapter, we have studied and emphasized the “global” form of closure provided by monoidal closed categories. This is in order to compare the “categorical foundations” program, which is based on categorical closure, with the “quantum logic program,” based on order theory. An alternative, which sits more easily with the order-theoretic approach of Birkhoff-von Neumann quantum logic, is to consider local Galois adjunctions, as in Coecke et al. (2001) and Faure et al. (1995). Such an approach, while not leading to the global form of closure associated with categorical logic, may lead to natural interpretations for quantum logic connectives – the Sasaki hook in particular is amenable to such a treatment (Coecke and Smets 2001).
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
9
October 31, 2009
The Structure of Partial Isometries
15:46
385
The authors of this chapter are not, therefore, taking a position on whether or not “quantum logic” is a valid logical system.
9.10 Future Directions We have established that, far from being the “monstrosities” of Girard (1989), partial isometries do in fact have a rich categorical structure, closely related to Birkhoff/von Neumann quantum logic. This categorical structure has also let us see that there does not appear to be a natural overlap between the “categorical foundations” and “orthomodular lattices” approaches to foundations of quantum mechanics. Although this may be unsurprising to researchers in both fields, it is hoped that this paper has also provided a new perspective on why these foundational approaches appear to be incompatible. There remain several unanswered questions. One of the most pressing is: what sort of partially ordered structure is provided by the Halmos-McLaughlin partial order? Although we have concentrated here on the category theory of partial isometries, we will demonstrate in a future paper that (pIsom(H, K ), ) is in fact a complete partial order (CPO), where the down-closure of each maximal element is an orthomodular lattice. Whether or not it has more structure (e.g., whether it is a Scott domain) is at present an open question. There also remains to consider the monoidal structure of pIsom, with respect to the direct sum, rather than the tensor product. This is closely related to both the partial ordering, and the inverse category structure. It is demonstrated in Hines (2007) that all inverse categories satisfying very light requirements (including pIsom) have a categorical trace. However, this is a trace on the direct sum structure, rather than the tensor product structure, and so does not have the usual natural interpretation in terms of composite systems. There is also the question of whether the usual partial summation on hom-sets of inverse categories coincides with the partial summation provided by the linear structure.
Acknowledgments The authors wish to thank S. Abramsky, B. Coecke, and R. Duncan for discussions on both the categorical foundations program and its logical interpretations, and traditional quantum logic. Thanks are also due to K. Martin for discussions on order and domain theory, and P. Scott for discussions on the adjoint functor theorem and other ways of characterizing monoidal closed categories. The first author was supported by EU FP6 grant: QICS.
Bibliography Abramsky, S. (1991) Domain theory in logical form. Annals of Pure and Applied Logic 51:1–77. Abramsky, S. (1996) Retracing some paths in process algebra. In Montanari, U. and Sassone, V., editors, Proceedings of CONCUR ‘96, volume 1119 of Lecture Notes in Computer Science, pages 1–17. Springer-Verlag.
P1: SBT CUUS834-09
cuus834-gay
386
978 0 521 51374 6
October 31, 2009
15:46
Peter Hines and Samuel L. Braunstein
Abramsky, S. (2005) Abstract scalars, loops, and free traced and strongly compact closed categories. In Fiadeiro, J. L., Harman, N., Roggenbach, M., and Rutten, J. J. M. M., editors, CALCO, volume 3629 of Lecture Notes in Computer Science, pages 1–29. Springer. Abramsky, S., Blute, R., and Panangaden, P. (1998) Nuclear and trace ideals in tensor ∗-categories. Journal of Pure and Applied Algebra 1(43):3–47. Abramsky, S., and Coecke, B. (2004) A categorical semantics of quantum protocols. In Proceedings of the 19th Annual IEEE Symposium on Logic in Computer Science, pages 415–425. IEEE Computer Society Press. quant-ph/0402130. Abramsky, S., and Duncan, R. (2006) A categorical quantum logic. Mathematical Structures in Computer Science 16(3):469–489. Abramsky, S., Haghverdi, E., and Scott, P. J. (2002) Geometry of interaction and linear combinatory algebras. Mathematical Structures in Computer Science 12(5):625–665. Barr, M. (1992) Algebraically compact functors. Journal of Pure and Applied Algebra 82:211– 231. Bennett, C. H., Brassard, G., Cr´epeau, C., Jozsa, R., Peres, A., and Wootters, W. K. (1993) Teleporting an unknown quantum state via dual classical and Einstein-Podolsky-Rosen channels. Physical Review Letters 70:1895–1899. Birkhoff, G., and von Neumann, J. (1936) The logic of quantum mechanics. Annals of Mathematics 37(823). Blute, R., Cockett, R., and Seely, R. (2000) Feedback for linearly distributive categories: traces and fixed-points. Journal of Pure and Applied Algebra 154(1–3):27–69. Brassard, G., Braunstein, S. L., and Cleve, R. (1998) Teleportation as a quantum computation. Physica D 120:43–47. Braunstein, S. L. (1996) Quantum teleportation without irreversible detection. Physical Review A 53(3):1900–1902. Braunstein, S. L., D’Arianco, G. M., Milburn, G. J., and Sacchi, M. F. (2000) Universal teleportation with a twist. Physical Review Letters 84:3486–3489. Coecke, B., Moore, D., and Stubbe, I. (2001) Quantaloids describing causation and propagation of physical properties. Foundations of Physics Letters 14:133–145. Coecke, B., and Smets, S. (2001) The Sasaki hook is not a [static] implicative connective but induces a backward [in time] dynamic one that assigns causes. ArXiv:quant-ph/0111076v2. Cuntz, J., and Krieger, W. (1980) A class of C ∗ algebras and topological Markov chains. Inventiones Mathematicae 56:251–268. Duncan, R. (2004) Believe it or not, Bell states are a model of multiplicative linear logic. Computing Laboratory Research Report PRG-RR-04-18, Oxford University. Duncan, R. (2007) Types for Quantum Computation. Ph.D. thesis, Oxford. Erdelyi, I. (1968) Partial isometries closed under multiplication on Hilbert spaces. Journal of Mathematical Analysis and Applications 22:546–551. Faure, C.-A., Moore, D., and Piron, C. (1995) Deterministic evolutions and Schr¨odinger flows. Helvetica Physica Acta 68:150–157. Finkelstein, D. (1962) The logic of quantum physics. Transactions of the New York Academy of Sciences 25(2):621–637. Girard, J.-Y. (1987) Linear Logic. Theoretical Computer Science 50(1):1–102. Girard, J.-Y. (1988) Geometry of interaction 2: Deadlock-free algorithms. In Martin-L¨of, P., and Mints, G., editors, International Conference on Computer Logic, COLOG 88, volume 417 of Lecture Notes in Computer Science, pages 76–93. Springer-Verlag. Girard, J.-Y. (1989) Geometry of Interaction I: Interpretation of System F. In Ferro, R., editor, Logic Colloquium ’88, pages 221–260. North-Holland. Gleason, A. (1957) Measures on the closed subspaces of a Hilbert space. Journal of Mathematics and Mechanics 6:885–893. Griffiths, R. (2002) Consistent Quantum Theory. Cambridge University Press. Guyker, J. (1976) On partial isometries with no isometric part. Pacific Journal of Mathematics 62(2):419–433.
P1: SBT CUUS834-09
cuus834-gay
978 0 521 51374 6
9
October 31, 2009
The Structure of Partial Isometries
15:46
387
Haghverdi, E. (2000) Categorical Approach to Linear Logic, Geometry of Proofs and Full Completeness. Ph.D. thesis, Univ. Ottawa. Halmos, P. R., and McLaughlin, J. E. (1963) Partial isometries. Pacific Journal of Mathematics 13(2):585–596. Hardegree, G. M. (1979) The conditional in abstract and concrete quantum logic. In Hooker, C., editor, The Logico-Algebraic Approach to Quantum Mechanics, volume 2. D. Reidel Publishing Company, Dordrecht. Hellman, G. (1981) Quantum logic and the projection postulate. Philosophy of Science 48(3): 469–486. Hines, P. (1997) The Theory of Self-similarity and Its Applications. Ph.D. thesis, University of Wales. Hines, P. (1999) The categorical theory of self-similarity. Theory and Applications of Categories, Special edition in honour of Max Kelly 6:33–46. Hines, P. (2004) A categorical framework for finite state machines. Mathematical Structures in Computer Science. Hines, P. (2007) The inverse and the trace. Invited talk, Workshop on Traces and Feedback, LICS 2007, available at: http://www.peterhines.net/downloads/talks/LICS2007.pdf. Hines, P., and Scott, P. (2009) Conditional quantum iteration from categorical traces. In progress. Holdsworth, D., and Hooker, C. (1983) A critical survey of quantum logic. Logic in the 20th Century, Scientia Special Issue, Scientia, Milan, pages 127–246. Howie, J. (1995) Fundamentals of Semigroup Theory. Clarendon Press Oxford. Hughes, R. I. G. (1989) The structure and interpretation of quantum mechanics. Harvard University Press. Jauch, J. (1986) Foundations of Quantum Mechanics. Addison Wesley Longman. Joyal, A., and Street, R. (1991) The geometry of tensor calculus i. Advances in Mathematics 88(1):55–112. Joyal, A., Street, R., and Verity, D. (1996) Traced monoidal categories. Mathematical Proceedings of the Cambridge Philosophical Society, pages 425–446. Kelly, G., and Laplaza, M. (1980) Coherence for compact closed categories. Journal of Pure and Applied Algebra 19:193–213. Kneale, W., and Kneale, M. (1971) The Development of Logic. Oxford University Press. Lambek, J., and Scott, P. J. (1986) Introduction to Higher Order Categorical Logic. Cambridge Studies in Advanced Mathematics Vol. 7. Cambridge University Press. LaPlaza, M. (1977) Coherence in nonmonoidal categories. Transactions of the American Mathematical Society 230. Lawson, M. V. (1998) Inverse Semigroups: The Theory of Partial Symmetries. World Scientific. Lawvere, F. W. (1973) Metric spaces, generalized logic, and closed categories. Rendiconti del seminario mat´ematico e fisico di Milano, XLIII pages 135–166. Also available as Reprints in Theory and Applications of Categories, No. 1, year= 2002, pp 1–37. Mac Lane, S. (1998) Categories for the Working Mathematician. Graduate Texts in Mathematics. Springer-Verlag, Berlin, second edition. Malinowski, J. (1990) The deduction theorem for quantum logic - some negative results. The Journal of Symbolic Logic 55:615–625. Mehra, J., and Rechenberg, H. (1982) The Historical Development of Quantum Theory III: The Formulation of Matrix Mechanics and Its Modifications 1925–1926. Springer-Verlag New York. Mints, G. (1981) Closed categories and the theory of proofs. Journal of Mathematical Sciences 15(1):45–62. Munn, W., and Penrose, R. (1955) A note on inverse semigroups. Proceeding of the Cambridge Philosophical Society 51:396–399. Pati, A. K., and Braunstein, S. L. (2000) Impossibility of deleting an unknown quantum state. Nature 404:164–165. Piron, C. (1976) Foundations of Quantum Physics. W. A. Benjamin.
P1: SBT CUUS834-09
cuus834-gay
388
978 0 521 51374 6
October 31, 2009
15:46
Peter Hines and Samuel L. Braunstein
Putnam, H. (1969) Is logic empirical? In Cohen, R., and Wartofsky, M., editors, Boston Studies in the Philosophy of Science, volume 5, pages 181–206. D. Reidel. Shimony, A. (1970) Filters with infinitely many components. Foundations of Physics 1(4):325– 328. Smets, S. (2001) On causation and a counterfactual in quantum logic: the Sasaki hook. Logique et Analyse 44(173–175):307–325. Sørensen, M. H. B., and Urzyczyn, P. (1998) Lectures on the Curry-Howard isomorphism. Technical report, University of Copenhagen. Vickers, S. (1989) Topology via logic. Cambridge University Press. Wootters, W., and Zurek, W. (1982) A single quantum cannot be cloned. Nature 299:802–803.
P1: SBT CUUS834-10
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:1
10 Temporal Logics for Reasoning about Quantum Systems Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas
Abstract Reasoning about quantum systems has gained prominence due to a big potential in applications such as information processing, security, distributed systems, and randomized algorithms. This fact has attracted research in formal reasoning about quantum states, programs, and processes. On the other hand, temporal logics have proved to be successful in the verification of classical distributed systems and security protocols. In this chapter we extend exogenous quantum propositional logic with temporal modalities, considering both linear and branching time. We provide a weakly complete Hilbert calculi for the proposed quantum temporal logics and study their SAT and model-checking problems.
10.1 Introduction Reasoning about quantum systems has gained prominence due to their potential applications in information processing, security, distributed systems and randomized algorithms. This has attracted research in formal reasoning about quantum states (see for instance van der Meyden and Patra 2003b,a; Mateus and Sernadas 2006; Chadha et al. 2009; Caleiro et al. 2006) and quantum programs (cf. Knill 1996; Sanders and Zuliani 2000; Abramsky and Coecke 2004; D’Hondt and Panangaden 2004; Altenkirch and Grattage 2005; Selinger and Valiron 2005; Baltag and Smets 2006; Baltazar et al. 2007; Chadha et al. 2006, 2007; Baltazar et al. 2008). On the other hand, formal methods have proved to be successful in design and verification of classical distributed systems and security protocols (e.g., Clarke and Wing 1996; Meadows 2003). Herein, we present branching and linear temporal logics for reasoning about evolution of quantum systems composed of a fixed finite set of qubits. Our starting point is the logic dEQPL for reasoning about quantum states presented in Mateus and Sernadas (2006) and Chadha et al. (2009). The logic dEQPL is an exogenous logic (Mateus et al. 2005) and is designed around the 389
P1: SBT CUUS834-10
cuus834-gay
390
978 0 521 51374 6
October 31, 2009
16:1
Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas
first two postulates of quantum mechanics. The first postulate says that a quantum state is a unit vector in a complex Hilbert space and the second one says that the quantum state composed of two independent quantum states is the tensor product of the composing states. Herein, we consider just a restricted sublogic of dEQPL based on the first postulate. The models of this logic are basically the quantum states of the finite qubit system. This simplification was initially proposed by Baltazar et al. (2008). We present a sound and complete axiomatization of this state logic. The completeness proof, which is inspired by Chadha et al. (2009) and Fagin et al. (1990), suggests a decision procedure for the SAT problem, and we compute the complexity of the decision procedure assuming that all basic integer operations (addition, subtraction, multiplication, and comparison) take unit time. Furthermore, assuming a floating-point representation of complex numbers and assuming that basic floating-point operations take unit time, we compute the complexity of the modelchecking algorithm. Next, we present quantum computational tree logic (QCTL) by replacing the state formulas in the standard computational tree logic (CTL) (Clarke and Emerson 1981) by dEQPL formulas. The standard CTL is interpreted over classical states and transition relations among these states. QCTL is interpreted over quantum states and transition relations. We give a sound and complete axiomatization of QCTL capitalizing on the complete axiomatization of dEQPL and CTL. The proof of completeness follows the techniques introduced in Caleiro et al. (1999) and Baltazar and Mateus (2009). We combine the standard CTL SAT and modelchecking algorithm with those from dEQPL to obtain a SAT and a model-checking algorithm for QCTL. Some of the results in this section were presented in Baltazar et al. (2008). Finally, we replicate the effort of obtaining a complete proof system, a SAT, and a model-checking algorithm for quantum linear temporal logic (QLTL).
10.2 Exogenous Quantum Propositional Logic We discuss here briefly the restricted state logic dEQPL as introduced by Baltazar et al. (2008). The logic is designed around the first postulate of quantum mechanics, which states that each quantum system is a unit vector in a complex Hilbert space. For our purposes, we deal only with a finite-dimensional Hilbert space composed of a finite set of qubits. We thus assume a fixed finite set of qubit symbols, qB, which represent these qubits. A quantum state |ψ therefore is a unit vector in HqB = H(2qB ), the Hilbert space generated by the set of valuations 2qB . Please note that these valuations constitute what is commonly called the standard computational basis. Assuming that qB has n elements, the vector |ψ is then specified by 2n complex numbers {v|ψ | v ⊆ qB}. The complex number v|ψ gives the projection of the unit vector |ψ on the basis vectors |v. We shall have terms in our language representing the real and complex parts of these 2n complex numbers. Furthermore, please
P1: SBT CUUS834-10
cuus834-gay
978 0 521 51374 6
10
October 31, 2009
16:1
Temporal Logics for Reasoning about Quantum Systems
391
Table 10.1. Language dEQPL Classical formulas α := ⊥ qb (α ⇒ α) Term language (with the proviso m ∈ Z and A ⊆ qB) < t := x m (t + t) (t t) Re(| A ) Im(| A ) ( α) Quantum formulas γ := (t ≤ t) ⊥ ⊥ (γ γ )
also note that there is a natural bijection between the subsets of qB and the set of valuations over qB: a set A corresponds to a valuation v A which valuates to true if qb ∈ A and valuates to false if qb ∈ / A. We also have terms in our logic that represent the probability of outcomes if all the qubits in qB were to be measured in the standard computational basis. We are now ready to discuss the syntax and semantics of dEQPL.
10.2.1 Language and semantics Syntax. The terms in dEQPL denote elements from R, the set of real numbers. The formulas of dEQPL, henceforth called quantum formulas, are constructed from comparison formulas (formulas that compare terms) using propositional connectives. We present language of dEQPL in Table 10.1 using an abstract version of BNF notation (Naur 1963) for a compact presentation of inductive definitions and discuss the language in detail hereafter. The first syntactic category is that of classical formulas. Please recall that we fixed a finite set of qubit symbols qB. Classical formulas are built from qubit symbols in qB using the classical disjunctive connectives, falsum ⊥ and implication ⇒. As usual, other classical connectives like ¬, ∧, ∨, ⇔, and are introduced as abbreviations. For the term language, we pick a denumerable set of variables X = {xk : k ∈ N} interpreted over the reals. We also have a copy of integers in the set of terms. The terms Re(| A ) and Im(| A ) denote the real and complex parts of the logical amplitude v A |ψ, where ψ is a quantum state over qB and v A< is the (unique) valuation corresponding to the set A. The probability term ( α) denotes the probability that the classical formula α holds for an outcome of measuring all the qubits (in qB) in the standard basis. As usual, we may define the notion of occurrence of a term t1 in a term t, and the notion of replacing zero or more occurrences of terms t1 in t by t2 . If x' and 't are sequences of variables and terms respectively, we write t{|'x /'t |} to mean the real term obtained by substituting all occurrences of xi by ti . The quantum formulas are built from comparison formulas (t ≤ t) using the connectives ⊥ ⊥ and . The set of comparison formulas shall henceforth be called qAtom, and we use δ, δ to range over this set. Please note that quantum bottom
P1: SBT CUUS834-10
cuus834-gay
392
978 0 521 51374 6
October 31, 2009
16:1
Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas
Table 10.2. Semantics of dEQPL Denotation of terms [[x]] < |ψρ [[( α)]]|ψρ [[Re(| A )]]|ψρ [[Im(| A )]]|ψρ
= = = =
ρ(x) µ|ψ (|α|) Re(v A |ψ) Im(v A |ψ)
Satisfaction of quantum formulas |ψρ dEQPL (t1 ≤ t2 ) iff [[t1 ]]|ψρ ≤ [[t2 ]]|ψρ |ψρ dEQPL ⊥ ⊥ |ψρ dEQPL (γ1 γ2 ) iff |ψρ dEQPL γ1 or |ψρ dEQPL γ2
⊥ ⊥ and quantum implication should not be confused with their classical counterparts. For clarity’s sake, we often drop parentheses in formulas and terms if it does not lead to ambiguity. Semantics. The language is interpreted over a unit vector |ψ on the Hilbert space HqB spanned by all valuations over qB. For interpreting the variables, we also need the concept of an assignment. An assignment ρ is a map from X , the set of variables, to the real numbers R. Given a classical formula α and a valuation v over qB, we also assume the definition of satisfaction
For the probability terms, we also need the extent of classical formulas defined as: |α| = {v ∈ ℘(qB) : v c α}. The terms Re(| A ) and Im(| A ) are interpreted as the real and complex parts of the logical amplitude v A |ψ where v A is the valuation corresponding to the set A. Given a quantum state ψ and an assignment ρ, the denotation of terms and satisfaction of quantum formulas at |ψ and ρ is inductively defined in Table 10.2 (omitting the obvious ones). Please note that the assignment ρ is sufficient to interpret a useful sublanguage of our quantum formulas defined as: a := x m (a + a) (a a) κ := (a ≤ a) (⊥ ⊥) (κ κ) Henceforth, the terms of this sublanguage are called analytical terms and the formulas are called analytical formulas. Abbreviations. As anticipated, the proposed quantum language with the foregoing semantics is rich enough to express interesting properties of quantum systems. To this end, it is quite useful to introduce other operations, connectives and modalities through abbreviations. We start with some additional quantum connectives:
P1: SBT CUUS834-10
cuus834-gay
978 0 521 51374 6
10
October 31, 2009
16:1
Temporal Logics for Reasoning about Quantum Systems
|100 ww w w ww ww |000
|110 ww w w ww ww |010
|101
|111 w w ww ww ww |011
|001
393
Figure 10.1. Hypercube of dimension 3
• • • •
Quantum negation: ( γ ) for (γ ⊥ ⊥); Quantum disjunction: (γ1 γ2 ) for (( γ1 ) γ2 ); Quantum conjunction: (γ1 γ2 ) for ( (( γ1 ) ( γ2 ))); Quantum equivalence: (γ1 ≡ γ2 ) for ((γ1 γ2 ) (γ2 γ1 )).
It is also useful to introduce some additional comparison formulas: • (t1 < t2 ) for ((t1 ≤ t2 ) ( (t2 ≤ t1 ))); • (t1 = t2 ) for ((t1 ≤ t2 ) (t2 ≤ t1 )). Given A ⊆ qB, the following abbreviation will also be useful: • (∧ A) for ((∧qbk ∈A qbk ) ∧ (∧qbk ∈A / (¬ qbk ))). The preceding formula represents the valuation v A in the language. The following abbreviation denotes the square of the absolute value of v A |ψ: • || A |2 for ((Re(| A ))2 + (Im(| A ))2 ). The following abbreviation is also useful: < • (α) for ( α) = 1. Intuitively, the formula (α) means that the probability α being true of the outcome of measuring all the qubits in the standard computational basis is 1. Example. Consider a quantum walk over a hypercube of dimension n. The vertices of the hypercube are represented precisely with n bits (see Figure 10.1 for a hypercube of dimension 3 – a cube). A state of a quantum walk over an hypercube of dimension n is a superposition in H(qB) where qB = {qb1 . . . qbn }. So, for the case of dimension 3, the state √12 |000 + √12 |001 can be specified by the formula Re(|∅ ) = x Re(|{qb1 } ) = x x × x = 2 x > 0.
10.2.2 Axiomatization We need two new concepts for the axiomatization, one of quantum tautology and a second of valid analytical formula.
P1: SBT CUUS834-10
cuus834-gay
394
978 0 521 51374 6
October 31, 2009
16:1
Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas
Table 10.3. Axioms for dEQPL Axioms [QTaut] [RCF]
dEQPL dEQPL
[Unit] [CTaut] [Meas∅] [FAdd]
dEQPL dEQPL dEQPL dEQPL
[Mon] [Prob]
dEQPL dEQPL
γ for each quantum tautology γ κ{|'x /'t |} where κ is a valid analytical formula, x' and 't are sequences of variables and terms (( A⊆qB || A |2 ) = 1) (α) for each classical tautology α < (( ⊥) = 0) < ((( (α1 ∧ α2 )) = 0) < < < (( α1 ∨ α2 ) = ( α1 ) + ( α2 ))) < < < ((( (α1 ⇒ α2 ))) (( α1 ) ≤ ( α2 ))) < (( ∧A) = || A |2 )
Inference rules [QMP] γ1 , (γ1 γ2 ) dEQPL γ2
Consider propositional formulas built from a countable set of propositional symbols Q using the classical connectives ⇒ and ⊥. A quantum formula γ is said to be a quantum tautology if there is a propositional tautology β over Q and a map σ from Q to the set of quantum formulas such that βσ coincides with γ where βσ is the quantum formula obtained from β by replacing all occurrences of ⊥ by ⊥ ⊥, ⇒ by , and q ∈ Q by σ (q). For instance, the expected formula ((y1 y2 ) (y1 y2 )) is tautological (obtained, for example, from the propositional tautology q ⇒ q). Please recall that an assignment is enough to interpret analytical formulas. We say that an analytical formula κ is a valid analytical formula if it holds for any assignment. It is a well-known fact from the theory of real closed fields (Basu et al. 2003) that the set of valid analytical formulas so defined is decidable. However, we do not go into details on this result and focus our attention on reasoning about quantum aspects only. The axioms and inference rules of dEQPL are listed in Table 10.3. The only inference rule is modus ponens for quantum implication QMP. The axiom QTaut says that a quantum tautology is an axiom. Since the set of quantum tautologies is recursive, there is no need for spelling out details of tautological reasoning. The axiom RCF says that if κ is a valid analytical formula, then any formula obtained by replacing variables with the terms of dEQPL is a tautology. Since the set of valid analytical formulas is recursive, we refrain from spelling out the details. The axiom Unit says that a quantum state is a unit vector. < The axioms CTaut, Meas∅, FAdd, and Mon reason about probability terms ( α). These axioms are basically the axioms (or minor variations of) the axioms of the probability logics in literature (Fagin et al. 1990). Hence, the probability logics in Fagin et al. (1990) can be seen as a sublogic of dEQPL.
P1: SBT CUUS834-10
cuus834-gay
978 0 521 51374 6
10
October 31, 2009
16:1
Temporal Logics for Reasoning about Quantum Systems
395
Finally, the axiom Prob relates probabilities and amplitudes. This axiom says that for any A ⊆ qB, the probability of observing the valuation v A when all qubits are measured is the square of the amplitude | A . The axiomatization just presented is sound and weakly complete. The proof of weak completeness presented hereafter follows the lines of the proof in Fagin et al. (1990) and Chadha et al. (2009). The proof of completeness also suggests an algorithm for deciding whether a formula is a theorem of dEQPL or not. The central result in the completeness proof is the model existence lemma, namely, if γ is consistent then there is a quantum state ψ and an assignment ρ such that |ψρ dEQPL γ . A quantum formula γ is said to be consistent if dEQPL ( γ ). A quantum formula γ is a theorem if and only if ( γ ) is inconsistent. Theorem 10.2.1 (Model existence theorem). If the quantum formula γ is consistent, then there is a unit vector |ψ and a ρ such that |ψρ dEQPL γ . Proof. Given a classical state formula α, we can show using the axioms CTaut, Meas∅, FAdd, and Mon that < < dEQPL (( α) = { A⊆qB | v A c α} ( ∧A)). < The axiom Prob then gives us that ( α) = { A⊆qB | v A c α} || A |2 . Hence, given a quantum formula γ , we can find an equivalent quantum formula that does not contain any probability terms. de f Given a formula γ free of probability terms, consider the formula γ † = (γ 2 † ( A⊆qB || A | = 1)). Please note that γ is consistent iff γ is consistent. Now, for each A ⊆ qB, pick two fresh variables x A and y A . Consider the formula γ †† obtained from γ † by replacing each term Re(| A ) by x A and Im(| A ) by y A . Now, by axiom RCF, γ † is consistent if and only if γ †† is consistent over the reals. Observe that γ †† is a purely analytical formula. Therefore there is an assignment, say ρ , that satisfies γ †† or otherwise dEQPL γ †† by RCF, and γ †† would not be consistent and neither would γ † , which is a contradiction. We conclude that there is such an assignment ρ , and from this assignment we can construct |ψ and ρ that satisfies γ as required.
10.2.3 SAT Problem As there is an algorithm for deciding the consistency of analytical formulas (Basu et al. 2003), the proof of the model existence lemma suggests an algorithm for deciding the consistency of quantum formulas. We now compute the complexity of one such algorithm. We need a few definitions for this. A term t of the dEQPL is said to be a polynomial in variables x1 , . . . , xk if t is of the form ( m n 1 ,...,n k x1n 1 . . . xkn k ). The degree of a polynomial term is defined as expected. We also assume for the rest of this chapter that each polynomial is in a n n normal form: for any two summands x1n 1 . . . xkn k and x1 1 . . . xk k there is some j such that n j = n j . Now, given a set of classical formulas A = {α1 , . . . , αm }, a set of
P1: SBT CUUS834-10
cuus834-gay
396
978 0 521 51374 6
October 31, 2009
16:1
Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas
variables V = {x1 , . . . xk , z α , . . . , z αm }, and a set of polynomials P = { p1 , . . . , ps } with variables in the set V, we say that a comparison formula (t ≤ t ) is an (A, V, P)-atom if t is 0 and there is some polynomial term p ∈ P such that < replacing all occurrences of the variables z αi by ( αi ) for each (1 ≤ i ≤ m) yields t. A dEQPL formula γ is said to be a (A, V, P)-formula if each comparison formula occurring in γ is an (A, V, P)-atom. We have: Theorem 10.2.2. Let the set qB have n elements. Let A = {α1 , . . . , αm } be a set of classical formulas, V = {x1 , . . . xk , z α , . . . , z αm } be a set of variables, and P = { p1 , . . . , ps } be a set of polynomials with variables in V. Let the degree of each polynomial in P be bounded by d and let r = 2n+1 + k + m. Then, assuming that all basic integer operations take unit time, there is an O(|γ |(s + m + 1)r (max(d, 2))O(r ) ) algorithm to decide whether an (A, V, P)-formula γ is a theorem or not. Proof. For each αi ∈ V compute the set Bi = { A ⊆ qB |v A dEQPL αi }. Computation of each Bi takes at most O(2n |αi |) steps, where |αi | is the length of αi . Since the sum ( 1≤im |αi |) is less than |γ |, this whole computation takes at most O(2n |γ |) steps. Please note that (2n |γ |) is bounded by |γ |(s + m + 1)r (max(d, 2))O(r ) . Given a (A, V, P)-formula γ , let γ1 be the formula obtained from γ by replacing < all probability terms ( αi ) by z αi . Now, for each A ⊆ qB, pick two fresh variables, x A and y A and consider the formula γ † = (z α2 i − (x 2A + y 2A ) = 0)) (( x 2A + y 2A ) − 1 = 0). γ1 ( 1≤i≤m
A∈Bi
A⊆qB
We make a few observations here: • γ is consistent iff and only if γ † is. • γ † is purely analytical. • γ † is built from comparison formulas of the form ( p ≤ 0) or ( p = 0) where each p is a polynomial in the set P = P ∪ {(z α2 i − A∈Bi (x 2A + y 2A ))|1 ≤ i ≤ m} ∪ {( A⊆qB x 2A + y 2A ) − 1}. • P has (s + m + 1) polynomials. The degree of each polynomial is bounded by max(d, 2) and is built from r = 2n+1 + k + m variables. • The length of γ † is O(|γ | + m(max(d, 2)O(r ) )). Assuming that integer operations take unit time, the results of Basu et al. (2003) give an O(|γ |(s + m + 1)r (max(d, 2))O(r ) ) algorithm to decide consistency of γ † , which concludes the proof of the corollary.
10.2.4 Model-checking Problem For the model-checking procedure, we consider only closed formulas, i.e., formulas without variables. We assume that a quantum state |ψ over qB is modeled by
P1: SBT CUUS834-10
cuus834-gay
978 0 521 51374 6
10
October 31, 2009
16:1
Temporal Logics for Reasoning about Quantum Systems
397
a 2n -array of pairs of real numbers, with n = |qB|. We also assume that the basic arithmetical operations take O(1) time. We also assume the definition of the length of a classical formula α or a quantum formula γ as the number of symbols required to write the formula. The length of a formula ξ (classical or quantum) is represented by |ξ |. Given a quantum state |ψ and a quantum formula γ , the < first step is to evaluate all the terms occurring in γ . For the probability terms α, the evaluation takes 2n |α| steps as we have to compute the set of valuations ℘(qB) that satisfy α. Once the terms are evaluated, the model checking algorithm is straightforward. Theorem 10.2.3. Assuming that all basic arithmetical operations take unit time, there is an algorithm O(|γ |.2n ) to decide if a quantum state |ψ over qB satisfies γ with |qB| = n. Proof. First notice that the terms that consume more time to evaluate are those < of the type ( α) (both the terms Re(| A ) and Im(| B ) can be accessed in O(1) time, since they are elements of the array). The number of terms of type < ( α) is bounded by |γ |. To evaluate one of these terms we require O(2n ) time corresponding to traveling throughout all the valuations satisfying α, computing the square of the < real and imaginary part, and summing all these values. So, computing all ( α) terms takes O(|γ |.2n ) time. After these values are obtained, the remaining computation (comparing terms, negating a Boolean value, and making implications between Boolean values) takes at most O(|γ |) time. Hence, the total time to decide if a quantum state |ψ satisfies γ is O(|γ |.2n + |γ |) = O(|γ |.2n ).
10.3 Quantum Computational Tree Logic We now introduce a temporal version of dEQPL by adopting the temporal modalities of CTL (Clarke and Emerson 1981). The logic is interpreted over a transition system in which the states are quantum states and the transitions are unitary operators. We also provide a sound and complete proof system by enriching the usual CTL proof system with the axioms of the quantum state logic. We start by briefly recalling the syntax, semantics, and proof system of CTL.
10.3.1 Computational Tree Logic Syntax. We shall assume that there is a countable set of propositional symbols . Assuming the set , the formulas of a CTL are given in BNF notation as θ :=⊥ ⊥ p (θ θ) EXθ AFθ E[θ Uθ ] where p ∈ . Semantics. The semantics of the temporal logic CTL is given using a Kripke structure
P1: SBT CUUS834-10
cuus834-gay
398
978 0 521 51374 6
October 31, 2009
16:1
Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas
Table 10.4. Semantics of CTL K, s K, s K, s K, s K, s
CTL ⊥ ⊥; CTL p CTL (θ1 θ2 ) CTL EXθ CTL AFθ
iff iff iff iff
K, s CTL E[θ1 Uθ2 ]
iff
p ∈ L(s); K, s CTL θ1 or K, s CTL θ2 K, s CTL θ for some (s, s ) ∈ R; for all paths s1 s2 . . . with s = s1 there is some i ≥ 1 such that K, si CTL θ; there is a path s1 s2 . . . with s = s1 such that for some i ≥ 1 K, s1 CTL θ2 and K, s j CTL θ1 for 1 ≤ j < i.
Definition 10.3.1 (Kripke structure). A Kripke structure over a set of propositions is a tuple K = (S, R, L) where: • S is a set, elements of which are called states. • R ⊆ S × S is a said to be the accessibility relation and it is assumed that for every s ∈ S there exists s ∈ S such that (s, s ) ∈ R . • L : S → ℘() is said to be a labeling function. Given a Kripke structure, K = (S, R, L), an infinite sequence of states s1 s2 . . . is said to be a computation path if (si , si+1 ) ∈ R for all i ≥ 1. The semantics of CTL is defined in terms of a Kripke structure K and a state s of the Kripke structure. Intuitively, the modalities are composed by two symbols where the first one is chosen between E or A and the second one among X, F, G, and the bimodality U. The second symbol is used for temporal reasoning: X stands for next; F for sometime in the future; G for always in the future; and U for until. The first symbol quantifies over computation paths: an existential (E – for there exists) path or a universal (A – for all) paths. The combination of the two symbols can be easily guessed. For example, the formula EXθ holds in a state s if there exists a next state s (that is, (s, s ) ∈ R) that satisfies θ . Given a Kripke structure K, a state s of the Kripke structure, and a CTL formula θ, the formal semantics is defined inductively in terms of a relation K, s CTL θ and is given in Table 10.4. Axiomatization. The temporal logic CTL enjoys a sound and complete axiomatization (Clarke and Schlingloff 2001). In order to give the axiomatization, we need to introduce some useful abbreviations: • • • • •
(AXθ ) for EX( θ); (EFθ ) for (E[( ⊥ ⊥)Uθ ]); (AGθ ) for (EF( θ)); (EGθ) for (AF( θ)); A[θ1 Uθ2 ] for (E[( θ2 )U( θ1 θ2 )]) ( (EG( θ2 ))).
The proof system H CCTL of CTL is given in Table 10.5. The following result is proved in Clarke and Schlingloff (2001).
P1: SBT CUUS834-10
cuus834-gay
978 0 521 51374 6
10
October 31, 2009
16:1
Temporal Logics for Reasoning about Quantum Systems
399
Table 10.5. H CCTL : complete calculus for CTL Axioms [Taut] [EX] [X] [EU] [AU] [AG1] [AG2] [AG3]
All propositional tautologies with propositional symbols substituted by CTL formulas; CTL CTL CTL CTL CTL CTL CTL
EX(θ1 θ2 ) ≡ EXθ1 EXθ2 AX( ⊥ ⊥) EX( ⊥ ⊥) E[θ1 Uθ2 ] ≡ θ2 (θ1 EX(E[θ1 Uθ2 ])) A[θ1 Uθ2 ] ≡ θ2 (θ1 AX(A[θ1 Uθ2 ])) AG(θ3 (( θ2 ) EXθ3 )) (θ3 ( A[θ1 Uθ2 ])) AG(θ3 (( θ2 ) (θ1 AXθ3 ))) (θ3 ( E[θ1 Uθ2 ])) AG(θ1 θ2 ) (EXθ1 EXθ2 )
Inference rules [MP] θ1 , (θ1 θ2 ) CTL θ2 [AGen] θ1 CTL AGθ1
Table 10.6. Language of QCTL QCTL formulas θ := γ (θ θ ) EXθ AFθ E[θUθ ] where γ is a dEQPL formula.
Theorem 10.3.2. The proof system HCCTL is sound and weakly complete with respect to Kripke structures.
10.3.2 QCTL: Syntax and Semantics Syntax. Please recall that given the state logic dEQPL (see Section 10.2) describes quantum states over a finite set of qubits qB and is interpreted over unit vectors in the Hilbert space HqB and assignments ρ : X → R where X is a countable set of variables. The formulas of quantum computation tree logic (QCTL) are obtained by enriching the quantum formulas with CTL modalities and are depicted in Table 10.6. As in the case of CTL formulas, other temporal modalities AXθ , EFθ , AGθ , EGθ , and A[θ1 Uθ2 ] are introduced as abbreviations. The intuitive semantics of the temporal modalities is similar to those in classical CTL. Semantics. In order to provide semantics to the logic, we introduce a very simple notion of quantum Kripke structure. Definition 10.3.3 (Quantum Kripke structure). A finite quantum Kripke structure over the set of qubits qB and variables X is a pair T = (S, R ) where: • S ⊂ HqB × RX is a set of pairs (|ψ, ρ) such that |ψ is a unit vector in HqB and ρ is an assignment; and • R ⊆ S × S is a relation such that for any (|ψ, ρ) ∈ S, there is an (|ψ , ρ ) ∈ S such that ((|ψ, ρ), (|ψ , ρ )) ∈ R.
P1: SBT CUUS834-10
cuus834-gay
400
978 0 521 51374 6
October 31, 2009
16:1
Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas
Table 10.7. Semantics of QCTL T , |ψρ QCTL γ T , |ψρ QCTL (θ1 θ2 ) T , |ψρ QCTL EXθ
iff iff iff
T , |ψρ QCTL AFθ
iff
T , |ψρ QCTL E[θ1 Uθ2 ]
iff
|ψρ dEQPL γ ; T , |ψρ QCTL θ1 or T , |ψρ QCTL θ2 T , |ψ ρ QCTL θ for some |ψ ρ ∈ S such that (|ψρ, |ψ ρ ) ∈ R; for all paths |ψ1 ρ1 |ψ2 ρ2 . . . with |ψ1 = |ψ, ρ1 = ρ there is a i ≥ 1 such that T , |ψi ρi QCTL θ; there is a path |ψ1 ρ1 |ψ2 ρ2 . . . with ψ1 = ψ, ρ1 = ρ such that for some i ≥ 1 T , |ψi ρi QCTL θ2 and T , |ψ j ρ j QCTL θ1 for 1 ≤ j < i.
If S is finite then T is said to be finite and |S|, the number of elements of S, is said to be the size of T . For the sake of brevity, we often write the pair (|ψ, ρ) as |ψρ. As usual, a computation path is a infinite sequence |ψ1 ρ1 |ψ2 ρ2 . . . such that for any i ≥ 1, we have (|ψ1 ρ1 , |ψ2 ρ2 ) ∈ R. Given a quantum Kripke structure T = (S, R), a pair (|ψ, ρ) ∈ S, and a QCTL formula θ , the semantics of QCTL is defined in terms of a relation T , |ψρ QCTL γ given in Table 10.7. It is easy to see that for closed formulas we can drop the assignment in the interpretation side of the satisfaction relation. A quantum Kripke structure T is said to satisfy a temporal formula θ , which we denote by T QCTL θ , if T , |ψρ QCTL θ for all |ψρ ∈ S. Please note that we are not considering generalized measurements. However, we can reason about protocols where measurements in the standard computational< basis are performed at the end of the protocol, thanks to the probability terms α in the state logic. Moreover, it is possible to rewrite any protocol in such a way that at the end we only need to make measurements in the computational basis. Similarly, classical states (bits) can be simulated by quantum states (qubits) that remain in the computational basis throughout the transitions. Example. As an example of a quantum Kripke structure we consider the random walk search algorithm over the hypercube of dimension n proposed in Shenvi et al. (2003). The algorithm needs n qubits to represent the position of the particle and ;log(n)< qubits to represent the state of the coin (these qubits represent a direction on the hypercube). Thus, each state can be described by a bit string x' specifying the position on the hypercube, and a direction d specifying the state of the coin. The unitary evolution U of the walk is described by two operators, one describing the shift of the particle and one describing the coin evolution. The shift operator, S, maps a state |d, x' onto the state |d, x' ⊕ e'd where e'd is the dth basis vector on the hypercube, that is, e'1 = (1, 0, . . . , 0), e'2 = (0, 1, 0, . . . , 0), . . . , and e'n = (0, . . . , 0, 1). The coin operator C is equal is equal to (G ⊗ I ) − (I ⊗ |0, . . . , 00, . . . 0|) where G is the Grover’s diffusion operator defined over the
P1: SBT CUUS834-10
cuus834-gay
978 0 521 51374 6
10
October 31, 2009
16:1
Temporal Logics for Reasoning about Quantum Systems
401
Table 10.8. H CQCTL calculus for QCTL Axioms [QTeo] [CTLTaut] Inference rules [QMP] [AGen]
All dEQPL theorems; All CTL tautologies with propositional symbols substituted by QCTL formulas; θ1 , (θ1 θ2 ) QCTL θ2 θ1 QCTL AGθ1
coin qubits, that is, G = |sd sd | with |sd = √1n nd=1 |d. The operator C tosses a fair quantum coin uniformly in all directions, except if the particle is at |0, . . . , 0, where it multiplies the phase by −1. This quantum walk induces a quantum Kripke structure where each world (|ϕ, ρ) accesses the world (U |ϕ, ρ). To make the Kripke structure more interesting, we will assume that each world can also see itself, that is, that the the accessibility relation is reflexive. We give some examples of interesting properties to verify with this quantum Kripke structure in Section 10.3.5.
10.3.3 Axiomatization A weakly complete axiomatization of QCTL capitalizing on the complete CTL calculus H CCTL is given in Table 10.8. Please note that the proof of completeness is subtle. This is because the connectives ⊥ ⊥ and are shared between dEQPL and CTL logics that may create new theorems that will not be obtained by just adding the dEQPL axioms to the CTL axioms. It is straightforward to check the soundness of the calculus; for this reason we omit here the lengthy exercise of verifying that all axioms and inference rules are sound. Theorem 10.3.4 (Soundness). The axiomatization H CQCTL is sound. The completeness of the calculus is established by following a technique introduced in Caleiro et al. (1999) and Baltazar and Mateus (2009). Towards this end, it is useful to translate QCTL formulas and models to the CTL framework. Consider first the subset of atomic dEQPL formulas qAtom (i.e., the set constituted by comparison formulas (t1 ≤ t2 )). Let be the countable set of propositional symbols used to write CTL formulas. Given a fixed bijective map λ : qAtom → (that translates each global atom to a CTL propositional symbol), we can translate each dEQPL formula θ to a CTL formula λ(θ ) by extending inductively λ on the structure of the formula θ (and preserving all connectives). For simplicity, we denote λ(θ ) just by ? θ. The map λ can also be used to translate a quantum Kripke structure T = (S, R) to the CTL model T? = (S, R, L), where p ∈ L(|ψρ) if |ψρ dEQPL λ−1 ( p).
P1: SBT CUUS834-10
cuus834-gay
402
978 0 521 51374 6
October 31, 2009
16:1
Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas
Lemma 10.3.5. Let T be a quantum Kripke structure. Then, T , |ψρ QCTL θ
iff
T?, |ψρ CTL ? θ.
Proof. The proof follows by straightforward induction on the structure of θ . θ by • Base: If θ is ⊥ ⊥ or (t1 ≤ t2 ) then T , |ψρ QCTL θ iff T?, |ψρ CTL ? definition. • Step: For the sake of simplicity, we just consider the case when θ is EXθ 1 . The other cases can be similarly handled. Now, if T , |ψρ QCTL EXθ 1 then there is a |ψ ρ such that (|ψρ, |ψ ρ ) ∈ R and T , |ψ ρ QCTL EXθ 1 . By induction, T , |ψ ρ CTL EXθ 1 iff T?, |ψ ρ CTL ? θ1 . Thus, by definition T?, |ψρ CTL ? θ . The other direction can be similarly proved. QCTL incorporates both CTL and dEQPL reasoning as stated in the following result. Lemma 10.3.6. For any QCTL formula θ : θ then QCTL θ ; • CTL ? • dEQPL γ then QCTL γ if γ is a dEQPL formula. Proof. Follows directly from axioms CTLTaut and QTeo.
Indeed, if we restrict ourselves just to dEQPL formulas, QCTL reasoning coincides with that of dEQPL. Lemma 10.3.7 (Conservative extension). Let γ be an dEQPL formula. Then QCTL γ
iff
dEQPL γ .
Proof. In light of Lemma 10.3.6, it suffices to show that if QCTL γ then dEQPL γ . Suppose QCTL γ . Then QCTL γ by soundness of QCTL. Let |ψ be an arbitrary unit vector in HqB and ρ an arbitrary assignment. Consider the the quantum Kripke structure T = ({|ψρ}, {(|ψρ, |ψρ)}). We have that T , |ψρ QCTL γ . By definition, we get |ψρ dEQPL γ . Since ψ and ρ are arbitrary, we get dEQPL γ . By completeness of dEQPL, we get dEQPL γ . The following lemma is crucial to the proof of completeness. Lemma 10.3.8. Let θ be an QCTL formula such that QCTL θ . Then there is a dEQPL formula γθ such that γθ ? θ). QCTL γθ and CTL (AG? Proof. Let at = {γ1 , . . . , γk } be the set of atomic dEQPL formulas that are atoms of θ . Now for each k-vector i ∈ {0, 1}k , consider the dEQPL formula k if j-th bit of i is 1 γj ϕj where ϕj = δi = ( γ j ) otherwise j=1
P1: SBT CUUS834-10
cuus834-gay
978 0 521 51374 6
10
October 31, 2009
16:1
Temporal Logics for Reasoning about Quantum Systems
403
Let K ⊆ {0, 1}k be such that δi is a dEQPL consistent formula and let γθ = > i∈K δi . Clearly, dEQPL γθ and therefore by Lemma 10.3.7, QCTL γθ . Also please note for any quantum state |ψ and assignment ρ, |ψρ δi for exactly one i ∈ K . We prove CTL (AG? γθ ? θ ) by contradiction. Suppose that K = (S, R, L) is a CTL model such that K, s CTL (AG? γθ ? θ) for some s ∈ S. Then K, s CTL ? AG? γθ . and K, s CTL θ . Let S = {s ∈ S : s is reachable from s} (by “reachable” we mean reachable using the accessibility relation R). Pick s ∈ S and fix it. Since K, s CTL AG? γθ , we get that K, s CTL ? γθ . Hence, there is some i s ∈ K such that K, s CTL δ@ i s . Since δi s is consistent dEQPL formula, there is a unit vector |ψs and an assignment ρs such that |ψs ρs dEQPL δis . For each s fix on such |ψs and ρs ensuring that ρs1 = ρs2 (this can be ensured by modifying the assignments on real variables not occurring in θ ). Consider the set Sθ = {(|ψs , ρs ) : s ∈ S } and the QCTL model T = (Sθ , Rθ ), where (|ψs ρs , |ψs ρs ) ∈ Rθ iff (s , s ) ∈ R. Using the fact that K, s ? θ, it follows from Lemma 10.3.5 T , |ψs ρs θ , which contradicts QCTL γθ . We are now able to show the completeness of H CQCTL . Theorem 10.3.9. The axiomatization H CQCTL is weakly complete. Proof. Let QCTL θ be a valid QCTL formula. Let γθ be as in Lemma 10.3.8; then, CTL (AG? γθ ? θ ). Using CTL completeness we have CTL (AG? γθ ? θ ). Now, from Lemma 10.3.6 we get QCTL (AGγθ θ). Hence, we are able do the following derivation in QCTL: (1) QCTL (2) QCTL (3) QCTL (4) QCTL
γθ (AGγθ ) (AGγ θ θ) θ
Tautology Rule AGen Lemma 10.3.8, Lemma 10.3.6 Modus ponens 2, 3
Therefore, H CQCTL is complete.
10.3.4 SAT Problem The completeness proof suggests a SAT algorithm for QCTL. Let θ be the QCTL formula that we want to test for satisfiability and at = {γ1 , . . . , γk } be the set of atomic dEQPL formulas that are atoms of θ. Now for each k-vector i ∈ {0, 1}k , consider the dEQPL formula k if jth bit of i is 1 γj δi = ϕj where ϕj = ( γ j ) otherwise. j=1
k Let > K ⊆ {0, 1} be such that δi is a dEQPL consistent formula and let γθ = i∈K δi . Observe that dEQPL γθ and that for each |ψ, ρ there exists a unique i ∈ K such that |ψ, ρ dEQPL δi . Given a CTL model K = (S, R, L) of (AG(? γθ ) ? θ) and a state s ∈ S, we denote by (|ψs , ρs ) a dEQPL model that satisfies δi whenever
P1: SBT CUUS834-10
cuus834-gay
404
978 0 521 51374 6
October 31, 2009
16:1
Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas
Table 10.9. Algorithm to determine Sat(θ ) (1) Generate δi for all i ∈ 2k where k is the number of atomic dEQPL formulas that are atoms of θ . (2) Using the SAT algorithm for dEQPL compute the set of indexes K such that i ∈ K iff δi is a consistent dEQPL formula, in this case store the dEQPL model output by the SAT algorithm and call it (|ψi , ρi ). (3) Find a model K for (AG(? γθ ) ? θ) using the CTL SAT algorithm. (4) Construct TK from the models stored in (2).
K, s CTL ? δi . Moreover, choose (|ψs , ρs ) = (|ψs , ρs ) whenever s = s (this can be done just by changing the assignments of variables not occurring in θ ). Finally, we denote by TK the quantum Kripke structure (SK , R K ) where {(|ψs , ρs ) : s ∈ S} and ((|ψs , ρs ), (|ψs , ρs )) ∈ R K iff (s, s ) ∈ R. The following theorem is crucial to obtain the QCTL SAT algorithm. Theorem 10.3.10. Let θ be a QCTL formula. Then, (AG(? γθ ) ? θ) is CTL-satisfiable iff θ is QCTL-satisfiable. Moreover, K, s CTL (AG(? γθ ) ? θ ) iff TK , |ψs ρs QCTL θ . Proof. ⇐) Follows directly from Lemma 10.3.5 and from the fact that dEQPL γθ . @ Concerning the second assertion, it follows by noticing that T K is equal to K up to relabeling of states. @ ⇒) For this direction, it is sufficient to show the second assertion. Since T K is equal to K up to relabeling of states, by Lemma 10.3.5 we have that TK , |ψs ρs QCTL AG(γθ ) θ and therefore TK , |ψs ρs QCTL θ . The SAT algorithm is now easily obtained from the CTL SAT algorithm, and is shown in Table 10.9.
10.3.5 Model-Checking Problem We now address the problem of model-checking a closed temporal formula. Following the usual model-checking technique for CTL, the goal is to compute the set SatT (θ ) := {|ψ ∈ S : T , |ψ QCTL θ } for a given finite quantum Kripke structure T = (S, R) and closed formula θ (please note that assignments play no part in the entailment relation for closed formulas). This is called the global model-checking problem. The (global) modelchecking algorithm is given in Table 10.10. Clearly, quantum Kripke structures require, in general, exponential space (over the number of qubits) to simulate with classical computers due to the exponential number of possible state superpositions. For this reason, the model-checking
P1: SBT CUUS834-10
cuus834-gay
978 0 521 51374 6
10
October 31, 2009
16:1
Temporal Logics for Reasoning about Quantum Systems
405
Table 10.10. Algorithm to determine SatT (θ ) (1) (2) (3) (4) (5)
SatT (γ ) SatT (θ1 θ2 ) SatT EXθ SatT AFθ SatT (E[θ1 Uθ2 ])
= = = = =
{|ψ ∈ S : |ψ dEQPL γ }; (S \ SatT (θ1 )) ∪ SatT (θ2 ) {|ψ ∈ S : R(|ψ) ∩ SatT (θ) = ∅};
FixedPoint[λX.{R −1 X } X, SatT (θ )]; A FixedPoint[λX.{R −1 X SatT (θ1 )}, SatT (θ2 )];
where R −1 X = {ψ ∈ S | ∃ψ ∈ X, ρ, ρ s.t. (|ψρ, |ψ ρ ) ∈ R}.
algorithm takes exponential time on the number of qubits, but it is polynomial on the size of the transition system and the complexity of the formula. Theorem 10.3.11. Assuming that all basic arithmetical operations take unit time, the algorithm in Table 10.10 takes O(|θ |2 .|ST |2 .2n ) time. Proof. The CTL model-checking algorithm takes O(|θ |.|ST |2 ) (see Clarke and Emerson 1981 for a detailed analysis). So, if we consider each quantum atom to be a propositional symbol, the time complexity of the algorithm would be O(|θ |.|ST |2 ). Finally, since checking if a quantum atom is satisfied by a quantum state takes O(|θ |.2n ) (c.f. Theorem 10.2.3) we derive the desired upper bound. Recall that we consider all arithmetic computations to be O(1) by using floatingpoint representation for the real numbers. Example. Recall the the quantum walk example presented in Section 10.3.2. In Shenvi et al. (2003) it is shown that the algorithm reaches the state |0, . . . , 0 √ with probability p = 1/2 + O(1/n) after π/2 2n steps, when starting from the uniform quantum state. For a fixed n, generate the quantum Kripke structure, as described in the example of Section 10.3.2, where √ the unitary operation U is iterated a bounded number of times, larger than π/2 2n . An interesting property that one can verify with a model-checking algorithm for QCTL for this example is that < EF(( (¬ qb1 ∧ · · · ∧ ¬ qbn )) > p − ε).
10.4 Quantum Linear Time Logic 10.4.1 Linear Time Logic Syntax. Like in the case of CTL, we assume that there is a countable set of propositional symbols . Assuming the set , the formulas of linear time logic (LTL) are given in BNF notation as θ :=⊥ ⊥ p (θ θ ) Xθ θ Uθ where p ∈ . Semantics. The semantics of the temporal logic LTL is also given using a Kripke structure. The semantics of LTL is defined in terms of a Kripke structure K and a
P1: SBT CUUS834-10
cuus834-gay
406
978 0 521 51374 6
October 31, 2009
16:1
Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas
Table 10.11. Semantics of LTL K, π LTL ⊥ ⊥; K, π LTL p K, π LTL (θ1 θ2 ) K, π LTL Xθ K, s LTL (θ1 Uθ2 )
iff iff iff iff
p ∈ L(s1 ) with π = s1 , . . . ; K, π LTL θ1 or K, π LTL θ2 ; K, π 2 LTL θ; there is some i ≥ 1 such that K, π i LTL θ2 and K, π j LTL θ1 for 1 ≤ j < i.
Table 10.12. H CLTL : complete calculus for LTL Axioms [Taut] [X1] [X2] [G] [U1] [U2]
All propositional tautologies with propositional symbols substituted by LTL formulas LTL LTL LTL LTL LTL
( Xθ1 ) ≡ (X θ1 ) (X(θ1 θ2 )) (Xθ1 Xθ2 ) (Gθ1 ) (θ1 (XGθ1 )) (θ1 Uθ2 ) (Fθ2 ) (θ1 Uθ2 ) ≡ (θ2 (θ1 X(θ1 Uθ2 )))
Inference rules [MP] θ1 , (θ1 θ2 ) LTL θ2 [XGen] θ1 LTL (Xθ1 ) [Ind] (θ1 θ2 ), (θ1 (Xθ1 )) LTL (θ1 (Gθ2 ))
computation path π = s1 , s2 . . . Given that the computation path is fixed, the LTL modalities contain only the symbols for temporal reasoning: X stands for next; and U for until. The remaining temporal modalities, F and G, are easily obtained by abbreviation: (F p) for (( ⊥ ⊥)U p); and (G p) for ( F( p)). In terms of expressiveness, LTL and CTL are incomparable. For instance, the LTL formula FG p has no CTL translation. Likewise, the CTL formula AGEF p has no LTL counterpart. LTL has the advantage that it is able to express fairness constrains, which are important in reasoning about distributed/parallel systems. On the other hand, the complexity of model-checking LTL formulas is PSPACEcomplete (Sistla and Clarke 1985), whereas CTL formulas can be checked in polynomial time (Clarke and Emerson 1981). Given a Kripke structure K, a computation path π = s1 . . . of the Kripke structure, and an LTL formula θ, the formal semantics is defined inductively in terms of a relation K, π θ and is given in Table 10.11. We denote by π i the ith suffix of π, that is, the path si , si+1 . . . Axiomatization. The temporal logic LTL enjoys a sound and complete axiomatization. The proof system H CLTL of LTL is given in Table 10.12. The following result is proved in Gabbay et al. (1980). Theorem 10.4.1. The proof system H CLTL is sound and weakly complete with respect to Kripke structures.
P1: SBT CUUS834-10
cuus834-gay
978 0 521 51374 6
10
October 31, 2009
16:1
Temporal Logics for Reasoning about Quantum Systems
407
Table 10.13. Language of QLTL QLTL formulas θ := γ (θ θ) (Xθ) (θUθ) where γ is a dEQPL formula.
Table 10.14. Semantics of QLTL T ,π T ,π T ,π T ,π
QLTL QLTL QLTL QLTL
γ (θ1 θ2 ) (Xθ) (θ1 Uθ2 )
iff iff iff iff
|ψ1 ρ1 dEQPL γ ; T , π QLTL θ1 or T , π QLTL θ2 ; T , π 2 QLTL θ; there is some i ≥ 1 such that T , π i QLTL θ2 and T , π j QLTL θ1 for 1 ≤ j < i.
Table 10.15. H CQLTL calculus for QLTL Axioms [QTeo] [LTLTaut] Inference rules [QMP] [Gen]
All dEQPL theorems; All LTL tautologies with propositional symbols substituted by QLTL formulas; θ1 , (θ1 θ2 ) QLTL θ2 θ1 LTL Gθ1
10.4.2 QLTL: Syntax and Semantics Syntax. Similarly to QCTL, the formulas of quantum linear time logic (QLTL) are obtained by enriching the quantum formulas with LTL modalities and are depicted in Table 10.13. The temporal modalities Fθ and Gθ are introduced as abbreviations. Semantics. We now provide a semantics for QLTL based on quantum Kripke structures. A computation path is a infinite sequence π = |ψ1 ρ1 , |ψ2 ρ2 . . . such that for any i ≥ 1, we have (|ψi ρi , |ψi+1 ρ2 ) ∈ R. Given a quantum Kripke structure T = (S, R), a computational path π in T , and a QLTL formula θ , the semantics of QLTL is defined in terms of a relation T , π QLTL γ given in Table 10.14. A quantum Kripke structure T is said to satisfy a QLTL formula θ , which we denote by T QLTL θ , if T , π QLTL θ for all computational paths π in T .
10.4.3 Axiomatization As in the case of QCTL, we are able to provide a weakly complete axiomatization of QLTL capitalizing on the complete LTL calculus H CCTL that is given in Table 10.15.
P1: SBT CUUS834-10
cuus834-gay
408
978 0 521 51374 6
October 31, 2009
16:1
Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas
It is straightforward to check the soundness of the calculus; for this reason we omit here the lengthy exercise of verifying that all axioms and inference rules are sound. Theorem 10.4.2 (Soundness). The axiomatization H CQLTL is sound. The completeness of the calculus is established by the same technique of QCTL, that is, by translating quantum atoms into propositional symbols. Consider the subset of atomic dEQPL formulas qAtom (i.e., the set constituted by comparison formulas (t1 ≤ t2 )). Let be the countable set of propositional symbols used to write LTL formulas. Given a fixed bijective map λ : qAtom → (that translates each global atom to an LTL propositional symbol) we can translate each dEQPL formula θ to an LTL formula λ(θ ) by extending inductively λ on the structure of the formula θ (and preserving all connectives). For simplicity, we denote λ(θ ) just by ? θ. The map λ can also be used to translate a quantum Kripke structure T = (S, R) to the LTL model T? = (S, R, L), where p ∈ L(|ψρ) if |ψρ dEQPL λ−1 ( p). Lemma 10.4.3. Let T be a quantum Kripke structure. Then, T , π QLTL θ
iff
T?, π LTL ? θ.
Proof. The proof follows by straightforward induction on the structure of θ. • Base: If θ is ⊥ ⊥ or (t1 ≤ t2 ) then T , π QLTL θ iff |ψ1 ρ1 dEQPL θ iff T?, π LTL ? θ by definition. • Step: For the sake of simplicity, we just consider the case when θ is Xθ 1 . The other cases can be similarly handled. Now, T , π QLTL Xθ1 iff T , π 2 QLTL θ1 iff, by induction, T?, π 2 LTL ? θ1 iff, by definition, T?, π LTL ? θ1 iff T?, π LTL X? θ. Similarly to QCTL, QLTL is an extension of both LTL and dEQPL, as shown in the following result. Lemma 10.4.4. For any QLTL formula θ θ then QLTL θ ; • LTL ? • dEQPL γ then QLTL γ if γ is a dEQPL formula. Proof. Follows directly from axioms LTLTaut and QTeo.
If we restrict ourselves just to dEQPL formulas, QLTL reasoning coincides with that of dEQPL. Lemma 10.4.5 (Conservative extension). Let γ be an dEQPL formula. Then QLTL γ
iff
dEQPL γ .
Proof. Thanks to Lemma 10.4.4 it suffices to show that if QLTL γ , then dEQPL γ . Suppose QLTL γ . Then QLTL γ by soundness of QLTL. Let |ψ be an arbitrary unit vector in HqB and ρ an arbitrary assignment. Consider the quantum Kripke structure T = ({|ψρ}, {(|ψρ, |ψρ)}) and π its unique path. We have
P1: SBT CUUS834-10
cuus834-gay
978 0 521 51374 6
10
October 31, 2009
16:1
Temporal Logics for Reasoning about Quantum Systems
409
that T , π QLTL γ . By definition, we get |ψρ dEQPL γ . Since ψ and ρ are arbitrary, we get dEQPL γ . By completeness of dEQPL, we get dEQPL γ . The following lemma is crucial to the proof of completeness. Lemma 10.4.6. Let θ be an QLTL formula such that QLTL θ. Then there is a dEQPL formula γθ such that γθ ? θ). QLTL γθ and LTL (G? Proof. Let at = {γ1 , . . . , γk } be the set of atomic dEQPL formulas that are atoms of θ . Now for each k-vector i ∈ {0, 1}k , consider the dEQPL formula δi =
k
ϕj
where
j=1
ϕj =
if j-th bit of i is 1 γj ( γ j ) otherwise.
Let K ⊆ {0, 1}k be such that δi is a dEQPLconsistent formula and let γθ = > i∈K δi . Clearly, dEQPL γθ and therefore by Lemma 10.4.5, QLTL γθ . Also please note for any quantum state |ψ and assignment ρ, |ψρ δi for exactly one i ∈ K . We prove LTL (G? γθ ? θ) by contradiction. Suppose that K = (S, R, L) is a CTL model such that K, π LTL (G? γθ ? θ) for some s ∈ S. Then K, π LTL G? γθ and K, π LTL ? θ. Let S = {s ∈ S : s occurs in π }. Since K, π LTL G? γθ , we get that K, π LTL ? γθ . Hence, there is some i s1 ∈ K such that K, π LTL δ@ . Since δ is a consistent dEQPL formula, there is i s1 i s1 a unit vector |ψs1 and an assignment ρs1 such that |ψs1 ρs1 dEQPL δis1 . For each s j fix on such |ψs j and ρs j ensuring that ρs j = ρsk whenever j = k (this can be ensured by modifying the assignments on real variables not occurring in θ). Consider the set Sθ = {(|ψs , ρs ) : s ∈ S } and the QLTL model T = (Sθ , Rθ ), where (|ψs ρs , |ψs ρs ) ∈ Rθ iff (s , s ) ∈ R. Denote by π the path |ψs1 ρs1 , |ψs2 ρs2 . . . Using the fact that K, π ? θ, it follows from Lemma 10.4.3 T , π θ which contradicts QLTL γθ . We are now able to show the completeness of H CQLTL . Theorem 10.4.7. The axiomatization H CQLTL is weakly complete. Proof. Let QLTL θ be a valid QLTL formula. With γθ as in Lemma 10.4.6 we have that LTL (G? γθ ? θ ). Using LTL completeness we have LTL (G? γθ ? θ ). Now, from Lemma 10.4.4 we get QLTL (Gγθ θ). Hence, we are able do the following derivation in QLTL: (1) (2) (3) (4)
QLTL QLTL QLTL QLTL
γθ Tautology (Gγθ ) Rule Gen (Gγθ θ) Lemma 10.4.6, Lemma 10.4.4 θ Modus Ponens 2, 3
Therefore, H CQLTL is complete.
P1: SBT CUUS834-10
cuus834-gay
410
978 0 521 51374 6
October 31, 2009
16:1
Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas
Table 10.16. Algorithm to determine Sat(θ) (1) Generate δi for all i ∈ 2k where k is the number of atomic dEQPL formulas that are atoms of θ . (2) Using the SAT algorithm for dEQPL compute the set of indexes K such that i ∈ K iff δi is a consistent dEQPL formula, in this case store the dEQPL model output by the SAT algorithm and call it (|ψi , ρi ). θ ) using the LTL SAT algorithm. (3) Find a model K for (G(? γθ ) ? (4) Construct TK from the models stored in (2).
10.4.4 SAT Problem The SAT algorithm for QLTL is obtained similarly to the QCTL SAT algorithm. For the sake of completeness we present the details herein. Let θ be the QLTL formula that we want to test for satisfiability and at = {γ1 , . . . , γk } be the set of atomic dEQPL formulas that are atoms of θ . Now for each k-vector i ∈ {0, 1}k , consider the dEQPL formula k if jth bit of i is 1 γj δi = ϕj where ϕj = ( γ j ) otherwise. j=1
Let K>⊆ {0, 1}k be such that δi is a dEQPL consistent formula and let γθ = i∈K δi . Observe that dEQPL γθ and that for each |ψ, ρ there exists a unique i ∈ K such that |ψ, ρ dEQPL δi . Given an LTL model K = (S, R, L) of (G(? γθ ) ? θ) and a path π starting at s ∈ S, we denote by (|ψs , ρs ) a dEQPL model that satisfies δi whenever K, π CTL ? δi . Moreover, choose (|ψs , ρs ) = (|ψs , ρs ) whenever s = s (this can be done just by changing the assignments of variables not occurring in θ ). We denote by TK the quantum Kripke structure (SK , RK ) where SK = {(|ψs , ρs ) : s ∈ S} and ((|ψs , ρs ), (|ψs , ρs )) ∈ RK iff (s, s ) ∈ R. Finally, given a computation path π = s1 , . . . in K we denote by π K the computation path (|ψs1 , ρs1 ), . . . in TK . The following theorem is the kernel of the QLTL SAT algorithm. θ ) is LTL-satisfiable Theorem 10.4.8. Let θ be a QLTL formula. Then, (G(? γθ ) ? ? iff θ is QLTL-satisfiable. Moreover, K, π CTL (G(? γθ ) θ ) iff TK , πK QLTL θ. Proof. ⇐) Follows directly from Lemma 10.4.3 and from the fact that dEQPL γθ . @ Concerning the second assertion, it follows by noticing that T K is equal to K up to relabeling of states. @ ⇒) For this direction, it is sufficient to show the second assertion. Since T K is equal to K up to relabeling of states, by Lemma 10.4.3 we have that TK , πK QLTL G(γθ ) θ and therefore TK , πK QLTL θ . We are now able to show the SAT algorithm for QLTL (Table 10.16).
P1: SBT CUUS834-10
cuus834-gay
978 0 521 51374 6
10
October 31, 2009
16:1
Temporal Logics for Reasoning about Quantum Systems
411
Table 10.17. Algorithm to determine SatT (θ ) (1) Construct T? by checking whether the quantum states in T satisfy or not the quantum atoms in θ. (2) Model-check T? against ? θ using a LTL model-checker.
10.4.5 Model-checking Problem In contrast to the case of QCTL, we will give a model-checking algorithm for QLTL that uses directly the PSPACE model-checking algorithm for LTL. This make the problem more or less trivial thanks to Lemma 10.4.3. Given the QLTL formula θ and a quantum Kripke structure T , we start by transforming T into a classical Kripke structure T? by checking whether the quantum states in T satisfy the quantum atoms in θ. Then, it remains to model-check T? against ? θ. Clearly, the model-checking procedure is still in PSPACE, since the translation of T into T? can be done in polynomial space. The algorithm is sketched in Table 10.17. Example. Recall the quantum walk example presented in Section 10.3.2 and assume that the quantum Kripke structure is constituted by all states reachable from the uniform quantum state. This example satisfies that it is always possible (that is, with positive probability) to collapse into the state |0 . . . 0. This fact can be specified in QLTL with < GF(( (¬ qb1 ∧ · · · ∧ ¬ qbn )) > 0) and checked on the quantum Kripke structure, for a particular n.
10.5 Conclusions We presented temporal quantum logics combining the quantum state logic given in Chadha et al. (2009) with the computational tree logic CTL and linear temporal logic LTL. We were able to obtain a complete calculus and provide a SAT and model-checking algorithm. The main idea behind the temporalization of dEQPL was to replace the propositional symbols of the temporal logics by the atomic formulas of dEQPL. This approach is expressive enough to reason about quantum protocols (see for instance Baltazar et al. 2007) and has the great advantage of being endowed with a complete Hilbert calculus. On the other hand, the SAT algorithms of the temporal quantum logics have prohibitive complexity. For the case of QCTL, we need to apply the CTL Exptime SAT algorithm to a CTL formula that has grown exponentially, obtaining therefore a double-exponential time upper bound. In the case of LTL, from the PSPACE SAT algorithm of LTL, we obtain a EXPSPACE upper bound. Moreover, in both cases we also need to apply an exponential number of times the SAT algorithm for EPPL, for which we gave a double-exponential time upper bound over the number of qubits. For all these reasons, the SAT results presented here have more
P1: SBT CUUS834-10
cuus834-gay
412
978 0 521 51374 6
October 31, 2009
16:1
Paulo Mateus, Jaime Ramos, Am´ılcar Sernadas, and Cristina Sernadas
a theoretical value than a practical one. It is possible to find better upper bounds for the algorithms by exploring the particularities of quantum Kripke structures, but the authors believe that the improved algorithms alone would never be usable in practice. Concerning model checking, the results are more positive. Actually, if one considers floating-point representation, the complexity upper bounds obtained for QCTL and QLTL are precisely the same as those for CTL and LTL, respectively. Thus, the model-checking algorithms can be used in practice. There is still much work to be done along this research line. From the state logic point of view, an interesting improvement would be to consider density operators instead of unit vectors, thus giving a global phase independent semantics. In what concerns temporalization, it would be interesting to have a quantum version of the full branching time logic CTL∗ and of the µ-calculus. Finally, and from the semantics point of view, it would be interesting to have a more refined notion of quantum Kripke structure, one that would mimic more closely the evolution of a quantum system.
Acknowledgments This work was partially supported by FCT and EU FEDER, namely via CLC POCTI (Research Unit 1-601), QuantLog project POCI/MAT/55796/2004, SQIG IT, QSEC project PTDC/EIA/67661/2006 and KLOG project PTDC/MAT/68723/2006.
Bibliography Abramsky, S., and Coecke, B. (2004) A categorical semantics of quantum protocols. In Proceedings of the 19th Annual IEEE Symposium on Logic in Computer Science (LICS 2004), pages 415–425. IEEE Computer Society. Altenkirch, T., and Grattage, J. (2005) A functional quantum programming language. In Proceedings of the 20th Annual IEEE Symposium on Logic in Computer Science (LICS), pages 249–258. IEEE Computer Society. Baltag, A., and Smets, S. (2006) LQP: The dynamic logic of quantum information. Mathematical Structures in Computer Science 16(3):491–525. Baltazar, P., Chadha, R., and Mateus, P. (2008) Quantum computation tree logic – model checking and complete calculus. International Journal of Quantum Information 6(2):219–236. Baltazar, P., Chadha, R., Mateus, P., and Sernadas, A. (2007) Towards model-checking quantum security protocols. In Dini, P., editor, Proceedings of the First Workshop on Quantum Security: QSec’07, page 0014. IEEE Press. Joint e-proceedings with Quantum, Nano, and Micro Technologies: ICQNM ’07. 6 pages. Baltazar, P., and Mateus, P. (2009) Temporalization of probabilistic propositional logic. In Logical Foundations of Computer Science 2009, volume 5407 of Lecture Notes in Computer Science, pages 46–60. Springer. Basu, S., Pollack, R., and Roy, M.-F. (2003) Algorithms in Real Algebraic Geometry. Springer. Caleiro, C., Mateus, P., Sernadas, A., and Sernadas, C. (2006) Quantum institutions. In Futatsugi, K., Jouannaud, J.-P., and Meseguer, J., editors, Algebra, Meaning, and Computation – Essays Dedicated to Joseph A. Goguen on the Occasion of His 65th Birthday, volume 4060 of Lecture Notes in Computer Science, pages 50–64. Springer-Verlag.
P1: SBT CUUS834-10
cuus834-gay
978 0 521 51374 6
10
October 31, 2009
16:1
Temporal Logics for Reasoning about Quantum Systems
413
Caleiro, C., Sernadas, C., and Sernadas, A. (1999) Parameterisation of logics. In Fiadeiro, J., editor, Recent Trends in Algebraic Development Techniques – Selected Papers, volume 1589 of Lecture Notes in Computer Science, pages 48–62. Springer-Verlag. Chadha, R., Cruz-Filipe, L., Mateus, P., and Sernadas, A. (2007) Reasoning about probabilistic sequential programs. Theoretical Computer Science 379(1–2):142–165. Chadha, R., Mateus, P., and Sernadas, A. (2006) Reasoning about quantum imperative programs. Electronic Notes in Theoretical Computer Science 158:19–40. Invited talk at the Twentysecond Conference on the Mathematical Foundations of Programming Semantics. Chadha, R., Mateus, P., Sernadas, A., and Sernadas, C. (2009) Extending classical logic for reasoning about quantum systems. In Engesser, K., Gabbay, D. M., and Lehmann, D., editors, Handbook of Quantum Logic and Quantum Structures: Quantum Logic, pages 325–372. Elsevier. Clarke, E. M., and Emerson, E. A. (1981) Design and synthesis of synchronization skeletons using branching time temporal logics. In Proceeding of the Workshop on Logics of Programs, volume 131 of LNCS. Springer-Verlag. Clarke, E. M., and Schlingloff, B.-H. (2001) Model checking. In Handbook of Automated Reasoning, pages 1635–1790. Clarke, E. M., and Wing, J. M. (1996) Formal methods: state of the art and future directions. ACM Computing Surveys 28(4):626–643. D’Hondt, E., and Panangaden, P. (2004) Quantum weakest preconditions. In Selinger, P., editor, Proceedings of the 2nd International Workshop on Quantum Programming Languages, number 33 in TUCS General Publications, pages 75–90. Turku Centre for Computer Science. Fagin, R., Halpern, J. Y., and Megiddo, N. (1990) A logic for reasoning about probabilities. Information and Computation 87(1–2):78–128. Gabbay, D., Pnueli, A., Shelah, S., and Stavi, J. (1980) The temporal analysis of fairness. In Proceedings 7th Symposium on Principles of Programming Languages, POPL’80, pages 163– 173. ACM. Knill, E. (1996) Conventions for quantum pseudocode. Technical Report LAUR-96-2724, Los Alamos National Laboratory. Mateus, P., and Sernadas, A. (2006) Weakly complete axiomatization of exogenous quantum propositional logic. Information and Computation 204(5):771–794. Mateus, P., Sernadas, A., and Sernadas, C. (2005) Exogenous semantics approach to enriching logics. In Sica, G., editor, Essays on the Foundations of Mathematics and Logic, volume 1 of Advanced Studies in Mathematics and Logic, pages 165–194. Polimetrica. Meadows, C. (2003) Formal methods for cryptographic protocol analysis: emerging issues and trends. IEEE Journal on Selected Areas in Communications 21(1):44–54. Naur, P. (1963) Revised report on the algorithmic language Algol 60. The Computer Journal 5:349–367. Sanders, J. W., and Zuliani, P. (2000) Quantum programming. In Mathematics of Program Construction, volume 1837 of Lecture Notes in Computer Science, pages 80–99. Springer. Selinger, P., and Valiron, B. (2005) A lambda calculus for quantum computation with classical control. In Proceedings of the 7th International Conference on Typed Lambda Calculi and Applications (TLCA), volume 3461 of Lecture Notes in Computer Science, pages 354–368. Springer. Shenvi, N., Kempe, J., and Whaley, K. B. (2003) Quantum random-walk search algorithm. Physical Review A 67(5):052307. Sistla, A. P., and Clarke, E. M. (1985) The complexity of propositional linear temporal logics. Journal of ACM 32(3):733–749. van der Meyden, R., and Patra, M. (2003a) Knowledge in quantum systems. In Tennenholtz, M., editor, Theoretical Aspects of Rationality and Knowledge, pages 104–117. ACM. van der Meyden, R., and Patra, M. (2003b) A logic for probability in quantum systems. In Baaz, M., and Makowsky, J. A., editors, Computer Science Logic, volume 2803 of Lecture Notes in Computer Science, pages 427–440. Springer-Verlag.
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
Abstract We describe model-checking techniques for protocols arising in quantum information theory and quantum cryptography. We discuss the theory and implementation of a practical model checker, QMC, for quantum protocols. In our framework, we assume that the quantum operations performed in a protocol are restricted to those within the stabilizer formalism; while this particular set of operations is not universal for quantum computation, it allows us to develop models of several useful protocols as well as of systems involving both classical and quantum information processing. We discuss the modeling language of QMC, the logic used for verification, and the verification algorithms that have been implemented in the tool. We demonstrate our techniques with applications to a number of case studies, including quantum teleportation and the BB84 quantum coin-flipping protocol.
11.1 Introduction Model–checking is a method of computer-aided verification used widely in both academia and industry for the analysis of software and communication systems. The method essentially consists of three phases: (1) modeling the system of interest at a suitable level of abstraction, usually by describing it in a formal specification language; (2) specifying the properties that the system must satisfy – these properties are typically expressed with reference to the system model, using a logic designed specially for this purpose (e.g., linear or branching time temporal logic); and (3) supplying the model and the properties to a model-checking tool, which automatically constructs the state space of the model and checks whether or not the given properties are satisfied (and if not, usually providing a counterexample). The process of model checking involves exploring all possible behaviors arising from the model and, as such, is an exhaustive method of analysis. The benefit of this is that all combinatorial possibilities are considered, and often particular 414
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
415
scenarios are discovered that may not have been foreseen by a human user; this is especially true of larger models, which are too complex for analysis by hand. The technique of model checking has been used to discover flaws in various industrial systems and protocols. For instance, the SPIN model checker was originally used to detect and correct signaling issues in telecommunications relays and switches at AT&T (Holzmann 1991, 2003). Similar tools have been used for the analysis of larger systems, ranging from flight software to processor chips (see the discussion by Huth and Ryan (2004)). Further applications of model checking are found in the area of security; subtle flaws in cryptographic protocols can easily compromise privacy (and influence other security properties). For example, Lowe used the FDR model checker to detect a flaw in the Needham-Schr¨oder PKCS protocol (see Ryan et al. 2001); this is often heralded as one of the greatest successes of the technique, since it brought to the fore an issue with a protocol in widespread use. Our aim is to bring the benefits of model-checking techniques to the growing discipline of quantum computation and quantum information, which has led to the discovery of communication and cryptographic protocols with no classical analogue; these protocols exhibit and exploit the phenomena of quantum physics, such as superposition, entanglement, nonlocality, and probabilistic measurement. These phenomena are noted for their applications in cryptography. The unconditional security proof (Mayers 2001) for quantum key distribution (Bennett and Brassard 1984; Ekert 1991), which states that the security of this particular protocol relies only on the correctness of the laws of quantum mechanics, is a prime example. The security proof is of great significance, but in its present form it involves a combination of mathematical techniques from diverse fields and may be difficult to generalize to other quantum protocols. We hope that algorithms and tools can be developed to automate such proofs. It is worth emphasizing that the eventual emergence of large-scale quantum computers poses a threat to classical cryptosystems, but quantum cryptographic protocols will not be threatened by this eventuality. The unconditional security proof for quantum key distribution ensures the correctness of a particular protocol, but not that of systems implementing it; our techniques are mainly developed with a view to assisting in the analysis of actual implementations. Of course, a fully fledged automated proof for a quantum key distribution system is a longerterm goal. We are currently focusing on smaller systems combining quantum and classical communications. We are interested in analyzing systems that combine classical and quantum information processing. Since any realistic quantum communication system will inevitably interact with classical components, it is necessary to account for the storage and manipulation of classical data and quantum states. Measurements of quantum states produce classical data, and often such data affects the subsequent course of a quantum protocol. Certain protocols, such as quantum key distribution (Bennett and Brassard 1984), have a substantial classical processing phase that needs to be modeled explicitly if an analysis is to be complete.
P1: SBT CUUS834-11
cuus834-gay
416
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
Since model checking is exhaustive, an analysis of any large protocol, quantum or classical, will tend to produce a huge number of possible behaviors. For a quantum protocol the problem is exacerbated by the fact that the size of the representation of the quantum state grows exponentially with the number of qubits used. One solution to this problem is to restrict the types of possible quantum states that are permitted to arise in a protocol. In particular, it is possible to confine attention to those protocols which operate within a well-defined subspace of the overall quantum state space; then it is only necessary to be able to represent the states in this subspace. On the downside, one cannot then model an arbitrary quantum protocol, or model a system that uses a universal set of quantum gates. We enter into this later. In this chapter, we discuss aspects of the quantum model checker QMC, a tool that is designed for the analysis of protocols that combine classical information processing with a nonuniversal set of operations on a finite set of qubits. We focus on the stabilizer formalism, which describes a large and interesting class of quantum protocols. We discuss the issue of going beyond the scope of this formalism and the complexity of verifying various types of property. The syntax and semantics of QMC’s modeling language are presented, as well as the logic QCTL that we use for specifying protocol properties. The implementation and functionality of QMC is central to this paper, as are the case studies that demonstrate the tool’s capabilities.
11.1.1 Previous and Related Work In earlier work we considered the use of existing model-checking tools for the analysis of quantum protocols: Concurrency Workbench of the New Century (CWBNC) (Cleaveland et al. 1993) and PRISM (Kwiatkowska et al. 2004). Directly related to this was the design of the quantum process algebra Communicating Quantum Processes (CQP) (Gay and Nagarajan 2005). Using the classical process algebra CCS (Milner 1989), the first two authors developed a partial formal description of the BB84 protocol (Bennett and Brassard 1984) and verified a correctness property using CWB-NC. This tool was used to prove the trace equivalence of the protocol with its specification. Later, we used the probabilistic model checker PRISM to develop and analyze models of protocols that explicitly accounted for the probabilism arising from quantum measurements. In Papanikolaou (2005b), PRISM was used to show the correctness of part of BB84, while in Gay et al. (2005) we described techniques for adapting PRISM to handle a specific set of quantum operations in a more direct fashion. The development of QMC (Gay et al. 2008) was motivated by the large size of the resulting models (even for relatively small protocols) and the need to specify properties specific to quantum systems. The process algebra CQP (Gay and Nagarajan 2005) was designed to provide a formal, high-level language for modeling quantum communicating systems, including protocols. CQP has a formal semantics and a type system.
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
417
Related to this work is the design of quantum programming languages, and there ¨ have been many proposals for such languages to date: QCL (Omer 1998, 2000), QPL (Selinger 2004), qGCL (Sanders and Zuliani 2000), the quantum λ-calculus of van Tonder (2004), and the quantum process algebra QPAlg (Jorrand and Lalire 2005, 2004), to name but a few. See the survey by Gay (2006) for an overview. Abramsky and Coecke (Abramsky 2004; Coecke 2004a,b; Abramsky and Coecke 2003, 2004, 2005) have developed a category-theoretic formulation of the axioms of quantum mechanics, in the setting of strongly compact closed categories with biproducts. A substantial application of their work is a study of information flow in quantum protocols, and especially the information flow enabled by the use of entangled states; they are able to prove correctness of a teleportation protocol within a categorical semantics. Also related to this work is the development of logics for reasoning about quantum systems. An early survey was given by Papanikolaou (2005a). Of relevance to us here are the logics developed by Mateus, Sernadas et al. (Mateus and Sernadas 2004a,b, 2006; Baltazar et al. 2008). Baltazar et al. (2008) have discussed model-checking algorithms for QCTL and analyzed their complexity. They have done this for the most general possible setting, namely, for arbitrary quantum states; the implementation of these algorithms in QMC is restricted to stabilizer states and takes advantage of the properties of such states in order to achieve some efficiency improvements, especially with regard to propositional formulae. Perdrix (2008) has used abstract interpretation techniques to analyze entanglement properties of states, while Prost and Zerrari (2008) use logical techniques for the same purpose; their methods might be used to contribute to the efficiency of model checking. Other logics for the specification of quantum systems exist; D’Hondt and Panangaden (2005) have proposed an epistemic logic for distributed quantum systems, and Danos and D’Hondt (2008) have proposed a temporal epistemic logic for reasoning about quantum protocols. Sadrzadeh (2006) has considered the use of epistemic logics for the analysis of quantum cryptographic schemes.
11.2 Background In this section we review the quantum stabilizer formalism and present a well– known protocol, quantum teleportation (Bennett et al. 1993).
11.2.1 The Stabilizer Formalism The stabilizer formalism arises when we start to identify quantum states by the unitary operators that fix, or stabilize, them. For example, we can uniquely identify the EPR state + = √1 (|00 + |11) 2
P1: SBT CUUS834-11
cuus834-gay
418
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
by the set of operators {X ⊗ X, Z ⊗ Z }. This set (Nielsen of operators is unique and Chuang 2000) for the quantum state + ; we can also regard + as the +1-eigenvector of these operators, since (X ⊗ X ) + = + + + (Z ⊗ Z ) = We can characterize not only specific states, but entire subspaces of the Hilbert space Hn by specifying the set of operators that stabilize elements of those subspaces. This has proved to be very useful in the design of quantum error-correcting codes (Bacon 2006; Nielsen and Chuang 2000; Gottesman 1999, 2002). In order for quantum error-correction to succeed, errors have to be easily distinguishable (the formal criterion for distinguishability of codewords is given in the works previously cited). Using the concept of stabilizer operators, it is possible to systematically construct good quantum error-correction codes. In particular, one can design codes such that a single error will map +1-eigenvectors of a chosen operator to −1-eigenvectors. This is detailed in the notes by Bacon (2006). The unitary operators that characterize uniquely a subspace of Hn are elements of the Pauli group of dimension n, denoted Pn . The Pauli group of dimension 1 is the group formed by the Pauli operators {X, Y, Z } and the identity operator I , along with constant multiplicative factors of ±1 and ±i, under the operation of matrix multiplication. The multiplication table, or Cayley table, for this group P1 is partially shown here: × I X Y Z
I I X Y Z
X X I −i Z iY
Y Y iZ I −i X
Z Z −iY iX I
The Pauli group of dimension n is formally defined using the tensor product: n 2 Pn = A j where A j ∈ P1 , j = 1, 2, . . . n j=1
A subgroup of Pn that stabilizes the states in a certain subspace of Hn (this being known as the stabilizer subspace) is known as a stabilizer group. We can uniquely characterize a stabilizer group of interest by its generators or its generating set. The generating set of any group is defined as a set whose elements can be combined under the group operation to form the elements of the full group. It is a well-known fact of group theory that a finite group G has a generating set of length at most log2 |G|; the stabilizer group of an n-qubit state will thus have a generating set of length log2 2n = n. Therefore only n Pauli operators are needed to uniquely specify the stabilizer group of a particular state. The most important aspect of the stabilizer formalism is the way in which certain unitary operators (namely the CNot gate (Ca,b ), the Hadamard (H ) gate,
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
419
and the Phase (S) gate) act on stabilizer groups. In particular, these operators are a generating set of the Clifford group in Hn . The Clifford group is the normalizer of the Pauli group. Thus, if S is a Clifford operator (i.e., a member of the Clifford group) and P is any Pauli operator, S P S† = P where P is also a Pauli operator and † denotes adjunction (conjugate–transpose). If we confine attention to stabilizer states and Clifford group operations, then we say that we are operating within the stabilizer formalism. Further details of operations, as well as measurements within the stabilizer formalism, are to be found in the standard references (Bacon 2006; Nielsen and Chuang 2000; Gottesman 2002, 1999). The Gottesman-Knill theorem (Gottesman 1999, 2002; Aaronson and Gottesman 2004) essentially states that the computations within the stabilizer formalism can be efficiently simulated by a classical computer. This theorem may be stated as follows. Theorem 11.2.1 (Gottesman-Knill). There is a restricted class of n-qubit quantum states in Hilbert space Hn , such that each state |ψ in this class satisfies the following: • |ψ can be obtained from |0⊗n by CNot, Hadamard, and phase operators only. • |ψ can be obtained from |0⊗n by CNot, Hadamard, and phase and measurement operators only. • |ψ is stabilized by exactly 2n Pauli operators. • |ψ is uniquely determined by the stabilizer group S(|ψ) = Stab(|ψ) ∩ Pn (i.e., the group of Pauli operators that stabilize |ψ) • The total number of classical bits needed to specify |ψ is n(2n + 1), and these bits can be updated in polynomial time after a CNot, Hadamard, phase, or measurement operation is applied to |ψ. Any quantum circuit consisting entirely of CNot, Hadamard, phase, and measurement operators is referred to as a stabilizer circuit, and any state arising by applying a stabilizer circuit to |0⊗n is a stabilizer state. The existence of a restricted class of quantum operations whose effect can be efficiently simulated classically is extremely important for our purposes, since this result makes it clear which quantum protocols we can effectively analyze/verify using current technology. However, this restricted class of operations falls short of the full power of quantum computation, and there are certainly protocols and attacks that cannot be expressed using only these.
P1: SBT CUUS834-11
cuus834-gay
420
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou ψ 0
• H
H
•
• • σi
0
ψ
Figure 11.1. Quantum circuit diagram for the teleportation protocol
11.2.2 Quantum Teleportation The quantum teleportation protocol (Bennett et al. 1993) involves a series of operations on a 3-qubit system. The quantum circuit for teleportation is shown in Figure 11.1. Teleportation is a process that allows two users who share an entangled pair of particles to exchange an unknown qubit state by communicating only two classical values, namely, the outcomes of two measurements. The protocol is described hereafter. Alice wishes to send Bob the qubit state |ψ = α |0 + β |1; we shall call this particle “1.” To begin with, a pair of particles (labeled “2” and “3”) is placed in the quantum state 1 | = √ (|00 + |11) 2 Particle 2 is given to Alice and particle 3 is given to Bob. Since | is an entangled state, any measurement performed on the one particle will affect the state of the other particle irreversibly. (For instance, if Alice were to measure particle 2 with respect to the standard basis, she would collapse the state of particles 2 and 3 2 to either |00 or |11 at random with equal probability √12 = 0.5.) So we have a system of three particles described by the overall quantum state |ψ ⊗ | . Then the protocol proceeds as follows: (i) Alice performs the CNot operation with qubit |ψ as control and qubit 2 as target. (ii) Alice performs the Hadamard (H ) operation on qubit 2. After steps 1 and 2, qubit 2 is entangled with qubit |ψ. (iii) Alice measures qubit |ψ in the standard basis and records the outcome, c1 . (iv) Alice measures qubit 2 in the standard basis and records the outcome, c2 . (v) Alice transmits the values of c1 and c2 over a classical communication channel. (vi) Bob applies the Pauli operator σc to qubit 3, where c = c2 + c1 (2 + (−1)c2 ), with the convention that σ0 ≡ I, σ1 ≡ X, σ2 ≡ Y, σ3 ≡ Z . Bob’s qubit, i.e., qubit 3, is now in the state in which |ψ was originally. This example shows some typical characteristics of a quantum protocol. This particular protocol is quite simple, as it involves only two users and just a handful of operations and measurements. As such, it is amenable to analysis by hand
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
421
and can easily be shown to be correct. However, large systems (such as quantum key distribution networks) would typically include the teleportation protocol as a primitive and would combine it with other computations and transmissions, both quantum and classical. Note the style in which the protocol is presented. Presentations of quantum protocols in the physics literature tend to be rather informal and often mix lowlevel implementation details (e.g., how to prepare a particular state in a physical device) with structural aspects (the ordering of operations, measurements, and transmissions). Larger systems tend to combine various quantum computations with classical procedures for processing and transmitting bit values arising from measurements.
11.3 A Specification Language for Quantum Protocols Various programming and specification formalisms have been proposed in order to address the shortcomings of the quantum circuit model when describing quantum protocols. These include quantum programming languages and quantum process algebras and have been surveyed by Gay (2006). We have built an imperative-style concurrent specification language, QMCLang, which is intended to be used as an input language for the Quantum Model Checker (QMC) (Section 11.5). We now discuss this specification language, explaining its formal syntax and semantics. The language allows the description of systems with classical data and communication as well as manipulation and transmission of a finite number of qubits. A QMCLang model consists of: (1) a set of process declarations, and (2) a set of global (channel) variable declarations. Each process defines the behavior of a system component and has its own local variables (classical variables of integer, real, or Boolean type, and qubit variables) as well as access to all global variables (which represent channels of communication between processes). The minimal QMCLang program consists of a single process with no actions: program Minimal; process SingleProcess; begin end; endprogram. Classical variables are declared and used just as in conventional programming languages such as Pascal (Wirth 1971); the language includes assignment statements and simple expressions (e.g., a:=b+2; is a valid statement assuming a, b are suitably declared). Qubit variables store references to qubits in the global quantum state and are used in four ways (assuming a, q have been declared as qubit variables): • The statement q:=newqubit; allocates a new qubit in the global quantum state and sets the value of q to represent the index of that qubit. Before such
P1: SBT CUUS834-11
cuus834-gay
422
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
program SendReceive; var ch: channel of integer; process Sender; var a: integer; begin a := 2; ch!a; end; process Receiver; var b: integer; begin ch?b; end; endprogram. Figure 11.2. An example with sending and receiving of variables
a statement is issued, although a qubit variable q may have been declared it does not stand for an actual qubit in the quantum state. • The statement a:=savequbit q; stores the global quantum state at that point in execution. The ability to create history variables such as a is a special feature of the language that is useful for property verification. • In statements that apply quantum operators (H , CNot, S, X , Y , Z ) to particular qubits, the corresponding qubit variables are used, e.g., had q; cnot a q;. • Measurements of qubits in the standard basis are performed using expressions of the form meas q. Normally these expressions are assigned to an integer value, so that the measurement outcome (0 or 1 for a single-qubit measurement) is recorded. Apart from assignments and the statements of the forms discussed previously, processes are able to send and receive the values of variables on channels. The sample program in Figure 11.2 demonstrates this feature of the language. The syntax for sending and receiving is similar to the formalism CSP (Hoare 1985). This example also demonstrates two other characteristics of the language: parallelism and executability. The SendReceive system model declares one channel variable and two parallel processes Sender and Receiver. All processes in a QMCLang program are supposed to be executed in parallel, leading to several possible interleavings. However, the action ch?b cannot be executed before the channel ch has received a value, so there is only one possible execution of this particular program. There is no explicit parallelism operator for processes (which is common in other specification languages), as it is implicit. Simple statements can be combined together to form blocks, which are executed in a single step. A block is simply a sequence of statements enclosed in braces
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
423
process Looping; var a: integer; q: qubit; begin q := newqubit; do :: a:=0; had q; :: a:=1; X q; od end; Figure 11.3. An example with looping
(“{” and “}”). The semantics of the language is such that one step in the execution of a process consists of either a single statement by itself or a block. QMCLang models can include nondeterministic choices and loops. In particular, a process can perform a choice between several sequences of statements, and such a choice can be performed repeatedly. Figure 11.3 shows an example of a process involving a loop (this loop is repeated up to a maximum number of times, which is implementation-dependent). The Looping process repeatedly chooses either to set a to 0 and then apply the H gate to q, or to set a to 1 and then apply the X gate to q. The first statement in an option (an option is a sequence of statements preceded by the symbol “” – in ASCII form this is represented by ‘::’) can be an expression stating a condition; this condition is used to determine whether the option is executable or not. These conventions are habitual in guarded-command languages and are inspired by a proposal of Dijkstra (1976). We now define the formal syntax and operational semantics of QMCLang.
11.3.1 Syntax The concrete syntax of QMCLang is given in Figure 11.4. The actual parser for the language uses a slight variation of the grammar shown, which also takes into account the precedence of arithmetic operators. The grammar defines the four base types for variables and the channel type (T ), expressions (E), statements (S), sequences of statements (Q), nondeterministic choices (H ), guarded commands (G), commands (C), variable declarations (V and D), processes (P), and programs (M).
11.3.2 Operational Semantics The semantics is defined over the internal syntax of the language, given in Figure 11.5. The mapping from concrete to internal syntax should be intuitively clear (note that declarations of variables have been omitted and that certain additional notations for operators have been introduced). The metavariables used in
P1: SBT CUUS834-11
cuus834-gay
424
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
T ::= integer | bool | real | qubit | channel of T E ::= n | r | x | E 1 + E 2 | E 1 − E 2 | E 1 ∗ E 2 | E 1 /E 2 | true | false | not E | E 1 and E 2 | E 1 or E 2 | E 1 = E 2 | E 1 < E 2 | E 1 > E 2 | meas x | newqubit S ::= E | x := E | x1 !x2 | x1 ?x2 | cnot x1 x2 | had x | ph x | X x | Y x | Z x Q ::= S; Q | S H ::= Q H | Q G ::= if H fi | do H od C ::= S C | G C | V ::= var D | D ::= x : T ; D | P ::= process p V begin C end P | M ::= program p V begin P end Figure 11.4. Concrete syntax of QMCLang
op ::= + | − | ∗ | /
op ∈ Op
bop ::= ∧ | ∨
bop ∈ BOp
qop ::= had | ph | X | Y | Z
qop ∈ QOp
rel ::= > | < | =
rel ∈ Rel
E ::= n | r | x | x | E 1 op E 2 | E 1 bop E 2 | E 1 rel E 2 true | false | ¬ E
E ∈ Exp
S ::= E | x := E | x := measure x1 , . . . , xk | x := newqubitc!x | c?x | cnot x1 x2 | qop x
S ∈ Stmt
Q ::= S | S; Q |
Q ∈ Seq
H ::= Q | QH |
H ∈ Choice
G ::= H | do(H ) |
G ∈ GCom
C ::= S; C | G; C |
C ∈ Com
P ::= C || P |
P ∈ Program
Figure 11.5. Internal syntax of QMCLang
the different productions belong to the following syntactic categories: n ∈ Num, r ∈ Real, x ∈ Var, c ∈ Chan. The semantics does not use mixed states, because QMC analyzes every possible outcome of measurements separately; each outcome has a pure state. The semantics is the semantics of QMCLang as used by QMC, rather than as a quantum programming language.
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
425
−→ E : Exp × Store × H $→ ValueSet × H −→ S : Stmt × ChanStore × Store × H $→ ChanStore × Store × H −→ Q : Seq×ChanStore×Store×H $→ Seq × ChanStore × Store × H −→ H : Choice × ChanStore × Store × H $→ Choice × ChanStore × Store × H −→G : GCom × ChanStore × Store × H × N $→ Com × ChanStore × Store × H × N −→C : Com × ChanStore × Store × H × N $→ Com × ChanStore × Store × H × N −→ N : Choice × ChanStore × Store × H $→ Choice × ChanStore × Store × H −→ P : Program × ChanStore × StoreSet × H $→ Program × ChanStore × StoreSet × H Figure 11.6. Transition relations for the operational semantics
Definition 11.3.1 (Values). The set of possible values that arise in the language is ValueSet = R ∪ B ∪ {null} ∪ Q where Q = {qb1 , qb2 , . . .}, B = {true, false}, and the values qb1 , qb2 , . . . represent each of the qubits. The special value null is used as the content of an empty channel variable. Definition 11.3.2 (Store). A store is a partial mapping from variables to values (similarly a channel store): Store = { f : Var ∪ QVar $→ ValueSet} ChanStore = { f : Chan $→ ValueSet}. A process store represents the local state of an individual process; we denote by StoreSet a set of stores: StoreSet = Store × Store × · · · We can now define the transition relations that give the operational semantics of the language. The types of these relations are given in Figure 11.6. In rules we use σ ∈ Store, ∈ StoreSet, κ ∈ ChanStore. Definition 11.3.3 (State). The overall state at any time during a computation is given by an element of the set State = H × StoreSet × ChanStore.
P1: SBT CUUS834-11
cuus834-gay
426
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
Definition 11.3.4 (Substitution). Substitution of variables is as follows: % v if y = x σ [x → v](y) = σ (y) otherwise. We require some auxiliary functions in the definitions of the semantics of expressions. In particular, we require: f A : Op × R × R → R f B : BOp × B × B → B f R : Rel × R × R → B, which are defined as follows: a1 + a2 if op = + a − a if op = − 1 2 f A (op, a1 , a2 ) = a · a if op = ∗ 1 2 a ÷ a if op = / 1 2 % b1 ∧ b2 if bop = ∧ f B (bop, b1 , b2 ) = b1 ∨ b2 if bop = ∨ true if a1 > a2 , false otherwise f R (rel , a1 , a2 ) = true if a1 < a2 , false otherwise true if a1 = a2 , false otherwise
when rel is > when rel is < when rel is = .
Let TR : Stmt × State → Choice denote a syntactic translation function with TR(x := measure x1 , . . . , xk , s) = (x := α1 x := α2 · · · x := αm ) (11.1) so that the nondeterministic choice construct produced by this function reflects all possible outcomes {αi | 0 ≤ αi ≤ 2k−1 } of the measurement, from the current state s ∈ State, of the qubits represented by variables x1 , . . . , xk (see also Section 11.5.2).
11.3.2.1 Expressions The semantics of expressions is quite straightforward. Base values include integers (n), real numbers (r ), and the Boolean values true and false. Qubit values are not explicitly represented in the language, so that it is not possible to assign an explicit value to a qubit variable. Variables of all types are stored in the process stores, and transition relations such as −→ E take into account the store σ of the process currently being executed. Transition relation −→ E is defined inductively over all expressions in Figure 11.7.
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
427
(n, σ, |ψ) −→ E (n, |ψ)
(-)
(r, σ, |ψ) −→ E (r, |ψ)
(-)
(x, σ, |ψ) −→ E (σ (x), |ψ)
(-)
(true, σ, |ψ) −→ E (true, |ψ)
(-)
(false, σ, |ψ) −→ E (false, |ψ) (E, σ, |ψ) −→ E (true, |ψ) (¬E, σ, |ψ) −→ E (false, |ψ) (E, σ, |ψ) −→ E (false, |ψ) (¬E, σ, |ψ) −→ E (true, |ψ) (E 1 , σ, |ψ) −→ E (v1 , |ψ) (E 2 , σ, |ψ) −→ E (v2 , |ψ) (E 1 op E 2 , σ, |ψ) −→ E ( f A (op, v1 , v2 ), |ψ) (E 1 , σ, |ψ) −→ E (v1 , |ψ) (E 2 , σ, |ψ) −→ E (v2 , |ψ) (E 1 bop E 2 , σ, |ψ) −→ E ( f B (bop, v1 , v2 ), |ψ) (E 1 , σ, |ψ) −→ E (v1 , |ψ) (E 2 , σ, |ψ) −→ E (v2 , |ψ) (E 1 rel E 2 , σ, |ψ) −→ E ( f R (rel , v1 , v2 ), |ψ)
(-) (-1 ) (-2 ) (-) (-) (-)
Figure 11.7. Transition relation −→ E
(E, κ, σ, |ψ) −→ S (κ, σ, |ψ) (E, σ ) −→ E v (x := E, κ, σ, |ψ) −→ S (κ, σ [x → v], |ψ) L ∈ Q is fresh (x := newqubit, κ, σ, |ψ) −→ S (κ, σ [x → L], (|ψ ⊗ |0)) (x, σ ) −→ E v (c!x, κ, σ, |ψ) −→ S (κ[c → v], σ [x → null], |ψ) (x, σ ) −→ E v (c?x, κ, σ, |ψ) −→ S (κ[c → null], σ [x → v], |ψ) (cnot x1 x2 , κ, σ, |ψ) −→ S (κ, σ, Cσ (x1 ),σ (x2 ) |ψ) (qop x, κ, σ, |ψ) −→ S (κ, σ, Uqop |ψ)
(-) (-) (-) (-) (-) (-) (-)
Figure 11.8. Transition relation −→ S
11.3.2.2 Statements The semantics of statements is given by transition relation −→ S , defined in Figure 11.8. An isolated expression is treated as a statement; such a statement can control the flow of execution as it may or may not be executable from the current state, as we shall see, but it has no effect on the state, as shown in rule -. An assignment statement is defined as having the effect of substituting the value of a variable in the process store. Allocating a new qubit enlarges the overall quantum state and introduces a new internal reference L, which indexes it. Sending (c!x) and receiving (c?x) are similar to assignment, but they are specific to channel
P1: SBT CUUS834-11
cuus834-gay
428
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
(S, κ, σ, |ψ) −→ S (κ , σ , ψ ) (S, κ, σ, |ψ) −→ Q (, κ , σ , |ψ ) (S, κ, σ, |ψ) −→ S (κ , σ , ψ ) (S; Q, κ, σ, |ψ) −→ Q (Q, κ , σ , |ψ ) (Q, κ, σ, |ψ) −→ Q (Q , κ , σ , ψ ) (Q, κ, σ, |ψ) −→ H (Q , κ , σ , |ψ ) (Q, κ, σ, |ψ) −→ Q (Q , κ , σ , ψ ) (QH, κ, σ, |ψ) −→ H (Q , κ , σ , |ψ ) (QH, κ, σ, |ψ) −→ H (H, κ, σ, |ψ) (Q, κ, σ, |ψ) −→ Q (, κ , σ , ψ ) (Q, κ, σ, |ψ) −→ H (, κ , σ , |ψ )
(-1 ) (-2 ) (-1 ) (-2 ) (-3 ) (-4 )
Figure 11.9. Transition relations −→ Q and −→ H
variables; an empty channel has the special value null. Applying the unitary operators (cnot, H, ph, X , Y , Z) involves multiplying the global quantum state by a suitably dimensioned unitary matrix, and measurement is treated as a source of nondeterministic choice, where the outcome is stored. Note that Pv1 ,...,vk denotes the projection operator corresponding to the computational basis measurement of the k qubits.
11.3.2.3 Sequences and Non-deterministic Choices Transition relations −→ Q and −→ H are defined in Figure 11.9. The first expresses the effect of sequencing of statements and should require no further explanation. Nondeterministic choices contain several sequences of statements, one of which may be selected for execution. Once the choice has been made, the chosen sequence must be executed to completion. One step of the transition relation −→ H is designed to correspond to the execution of a choice (and the first step thereof).
11.3.2.4 Guarded Commands A guarded command is either an explicit nondeterministic choice (the case if . . . fi) or a loop (enclosed in do . . . od). The rules for guarded commands, defined in Figure 11.10, reduce the former into an instance of the relation −→ H and provide the steps for executing a loop. Note that a loop is simply a repetition of a nondeterministic choice, and that executing a loop means transforming it into a command sequence consisting of the nondeterministic choice by itself, followed by another iteration of the whole loop (see rule -2 ). There is an upper bound i MAX on the number of repetitions of a loop, which is implementation dependent. Future extensions to the language might include
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
429
(H, κ, σ, |ψ) −→ N (H , κ, σ, |ψ) −→ H (H , κ , σ , ψ ) (-1 ) (H, κ, σ, |ψ , i) −→G (H , κ , σ , |ψ , i) (H, κ, σ, |ψ) −→ N (H , κ, σ, |ψ) −→ H (H , κ , σ , ψ ) (-2 ) (do(H ), κ, σ, |ψ , i) −→G (H ; do(H ), κ , σ , |ψ , i) i < i MAX (H, κ, σ, |ψ) −→ N (H , κ, σ, |ψ) −→ H (, κ , σ , ψ ) (do(H ), κ, σ, |ψ , i) −→G (, κ , σ , |ψ , i + 1) (-3 ) i = i MAX (-4 ) (do(H ), κ, σ, |ψ , i) −→G (, κ, σ, |ψ , 0) Figure 11.10. Transition relation −→G
ExeS (S, κ, σ, |ψ) = true (S, κ, σ, |ψ) −→ S (κ , σ , ψ ) (S; C, κ, σ, |ψ , i) −→C (C, κ , σ , |ψ , i) (G, κ, σ, |ψ , i) −→G (G , κ , σ , ψ , i ) (G; C, κ, σ, |ψ , i) −→C (G ; C, κ , σ , |ψ , i ) (G, κ, σ, |ψ , i) −→G (, κ , σ , ψ , i ) (G; C, κ, σ, |ψ , i) −→C (C, κ , σ , |ψ , i )
(-1 ) (-2 ) (-3 )
where n is initialised to 0 in the first application of -2 . Figure 11.11. Transition relation −→C
an explicit mechanism for terminating such loops early; there are constructs for this purpose, e.g., in the language Promela (Holzmann 2003) (the syntax and functionality of guarded commands used here is inspired by that language and its implementation in the SPIN model checker). Note that we use a transition relation −→ N to reduce a choice H to another choice H before performing a step. This is defined and explained in Section 11.3.3.
11.3.2.5 Processes A process C is simply a sequence of commands, including guarded commands and single statements. (Note that we ignore variable declarations and process names here for simplicity.) Executing a step of a process means executing the next statement available. The transition relation −→C expresses the meaning of a process step and is defined in Figure 11.11.
11.3.2.6 Programs A single step of a program corresponds to a single process transition. At each time instant, there are many possible process choices, i.e., many possible process transitions. Transition relation −→ P , defined in Figure 11.12, expresses the execution of a single program step.
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
430
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
(C, κ, σ, |ψ , i) −→C (C , κ , σ , ψ , i ) (C || P, κ, , |ψ) −→ P (C || P, κ , , |ψ , i ) (C , κ, σ, |ψ , i) −→C (C , κ , σ , ψ , i ) (C || P, κ, , |ψ) −→ P (C || P , κ , , |ψ , i ) where σ ∈
, σ ∈
(-1 ) (-2 )
, P = · · · || C || · · · and P = · · · || C || · · · .
Figure 11.12. Transition relation −→ P
eval (n, κ, σ, |ψ) := true eval (r, κ, σ, |ψ) := true % true if σ (x) > 0 or σ (x) = true eval (x, κ, σ, |ψ) := false otherwise eval (E 1 op E 2 , κ, σ, |ψ) := true eval (E 1 bop E 2 , κ, σ, |ψ) := f B (eval (E 1 , κ, σ, |ψ), eval (E 2 , κ, σ, |ψ)) eval (E 1 rel E 2 , κ, σ, |ψ) := f R (eval (E 1 , κ, σ, |ψ), eval (E 2 , κ, σ, |ψ)) eval (true, κ, σ, |ψ) := true eval (false, κ, σ, |ψ) := false % true if eval (E, κ, σ, |ψ) = false eval (¬E, κ, σ, |ψ) := false if eval (E, κ, σ, |ψ) = true Figure 11.13. Definition of an evaluation function for expressions. This is used for defining executability of expression statements
Definition 11.3.5 (Complete program run). Given an empty initial state (κ0 , 0 , 1) (where κ0 = 0 = ∅ and 1 is a unit vector of H ) and a program P, we define a complete program run as a sequence of transitions (P, κ0 ,
0 , 1)
−→∗P (, κ, , |ψ).
A run of a QMCLang program may terminate prematurely if all remaining statements are nonexecutable (this means that a run of a program may end in a state where the original program P has not been reduced completely to the empty string as before). The concept of executability is introduced in the following section.
11.3.3 The Executability Predicate At each step during execution of a QMCLang program, there are several possibilities caused by the interleaving of processes. As we have seen, a single execution step comprises a single statement. However, execution can only occur if the statement in question (and, by extension, the process containing it) is executable.
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
431
ExeS : Stmt × State → {true, false} ExeS (E, κ, σ, |ψ) := eval (E, κ, σ, |ψ) ExeS (x := E, κ, σ, |ψ) := true ExeS (x := newqubit, κ, σ, |ψ) := true ExeS (x := measure x1 , . . . , xk , κ, σ, |ψ) := ∀i ∈ {1, . . . , k}.σ (xi ) = null ExeS (c!x, κ, σ, |ψ) := κ(c) = null ExeS (c?x, κ, σ, |ψ) := κ(c) = null ExeS (cnot x1 x2 , κ, σ, |ψ) := σ (x1 ) = null and σ (x2 ) = null ExeS (qop x, κ, σ, |ψ) := σ (x) = null ExeQ : Seq × State → {true, false} ExeQ (S, κ, σ, |ψ) := ExeS (S, κ, σ, |ψ) ExeQ (S; Q, κ, σ, |ψ) := ExeS κ, σ, |ψ (S, κ, σ, |ψ) ExeH : Choice × State → {true, false} ExeH (Q, κ, σ, |ψ) := ExeQ (Q, κ, σ, |ψ) % ExeQ (Q, κ, σ, |ψ) ExeH (Q H, κ, σ, |ψ) := or ∃Q ∈ H.ExeQ (Q , κ, σ, |ψ) ExeG : GCom × State → {true, false} ExeG (H, κ, σ, |ψ) := ExeH (H, κ, σ, |ψ) ExeG (do(H ), κ, σ, |ψ) := ExeH (H, κ, σ, |ψ) ExeC : Com × State → {true, false} ExeC (S; C, κ, σ, |ψ) := ExeS (S, κ, σ, |ψ) ExeC (G; C, κ, σ, |ψ) := ExeG (G, κ, σ, |ψ) Figure 11.14. Executability predicates
Executability is defined formally using a predicate ExeS for statements. Similar predicates can be defined for the other constructs in the language; the definitions are given in Figures 11.13 and 11.14. Note that we have used the executability predicates here in the semantic rules. Communication actions (sending and receiving of variables) can be used to control the synchronization of processes, since these are performed with statements that are only executable if a condition is satisfied (e.g., a “receive” statement cannot be executed if the channel from which a value is being retrieved is empty).
P1: SBT CUUS834-11
cuus834-gay
432
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
Note that in QMCLang there exist expression statements, namely, statements consisting of a single expression that is simply evaluated. This feature, inspired by the language Promela, may not seem useful at first, but turns out to be a very helpful mechanism for controlling the interleaving of processes. A Boolean expression statement that is false is simply not executable. In practice this means that one can introduce an arbitrary condition inside a process that blocks that process until the condition is satisfied. One must be careful not to misconstrue expression statements with expressions that are inside an assignment statement; an assignment is always executable. Notation 11.3.6 (Definitions). We use the symbol := instead of the equality symbol = to denote a definition, namely that the expression on the left-hand side of this symbol can be replaced by the expression on the right-hand side. Executability is the mechanism by which conditions in programs are checked, since conditions are simply written as expression statements that are placed at suitable points in the text of a process. A guarded command comprises a nondeterministic choice between a number of options; each option consists of a sequence of statements that may or may not be executable at a given point during execution. We define the set of enabled options inside a choice H as follows. Enabled (H ) = {Q | Q is an option in H such that ExeQ (Q)}
(11.2)
Definition 11.3.7 (Enabled Options). If Enabled (H ) = {Q 1 , . . . , Q k } then we define H to be the corresponding syntactic element: H := Q 1 · · · Q k . This symbol is used to represent the piece of program text consisting only of the enabled options in H . In order to execute a step inside a nondeterministic choice, the enabledness of the options inside the choice must be checked; this is performed via a simple transition relation −→ N that reduces a choice H to a choice H between enabled options. (H, κ, σ, |ψ) −→ N (H , κ, σ, |ψ)
(-)
11.3.4 Type System The type system for QMCLang is given by the rules detailed next. QMCLang is a statically typed language. The presentation of the type system is in the style of Cardelli (2004). We assume that the reader is familiar with the concepts of typing judgment and type environment. In the type system there are two main kinds of judgment, one for expressions and types, and one for statements. We write )
(11.3)
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
433
to express the fact that is a well-formed environment. A judgment of the form E:T
(11.4)
states that the expression E is of type T in environment . Finally, a judgment of the form S
(11.5)
states that the statement S is well-typed in environment . The base rules for the type system define how environments are constructed. The form , x : T denotes an environment that is extended with the declaration of the variable x of type T . ∅)
T x ∈ dom() , x : T )
1 , x : T, 2 ) 1 , x : T, 2 x : T (-,-,-)
Given a well-formed environment , the admissible types are integers, Booleans, real numbers, qubits, and channels containing values of these types. ) ) ) integer bool real ) T ) qubit channel of T
(-,-,-) (-,-)
The following rules give the types of simple expressions. ) ) n : integer r : real ) ) true : bool false : bool
(-1 ,-2 ) E : bool ¬E : bool (-3 ,-4 ,-5 )
Rules -6 to -8 give the types of composite expressions. E 1 : integer E 2 : integer E 1 op E 2 : integer E 1 : bool E 2 : bool E 1 bop E 2 : bool E 1 : integer E 2 : integer E 1 rel E 2 : bool
(-6 ) (-7 ) (-8 )
Well-typed statements are defined by rules -1 to -7 . x : qubit x := newqubit
x : qubit Op x
(-1 ,-2 )
P1: SBT CUUS834-11
cuus834-gay
434
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
x1 : qubit x2 : qubit cnot x1 x2 x : integer xi : qubit for all i x := measure x1 , . . . , xk E:T x := E T c : channel of T x : T c!x T c : channel of T x : T c?x
(-3 ) (-4 ) (-5 ) (-6 ) (-7 )
The rules of the type system restrict the set of valid QMCLang programs as defined by the grammar in Figure 11.5. The types of all variables in a QMCLang program must be explicitly declared, although we have omitted type declarations from the abstract syntax for simplicity. The semantics of type declarations are subsumed by the static typing rules -, -, and - given in this section. We have not stated results relating the type system and the semantics, for example type safety properties, which are not usually emphasized in the modelchecking literature. We expect type safety properties of the usual kind to hold.
11.4 The EQPL and QCTL Specification Logics The properties of quantum protocols that we are interested in reasoning about are specific to quantum states (e.g., which qubits are “active” in a given state, which qubits are entangled). We are also interested in outcomes of different measurements, and the way in which the values of classical variables evolve. For this purpose we have chosen to use exogenous quantum propositional logic (EQPL) (Mateus and Sernadas 2004b,a, 2006) and its temporal extension, quantum computation tree logic (QCTL) (Baltazar et al. 2008). Although EQPL is a subset of QCTL, several variants of EQPL have been presented in the literature. We present here the syntax and semantics of EQPL as defined by Mateus and Sernadas (2004a), giving a satisfaction relation for the logic while relating it to the semantics of our modeling language. The syntax and semantics of QCTL are presented in Section 11.4.2. With the modeling language and specification logic formally defined, we have an elegant framework with which to produce uniform descriptions of quantum protocols and their properties.
11.4.1 EQPL: Exogenous Quantum Propositional Logic EQPL was designed to enable reasoning about systems comprising a finite set of qubits as well as a classical state. The main novelty of this logic is that it uses combinations of classical valuations (which provide the semantics of classical
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
435
α := pk | ⊥ | (α ⇒ α) t := x | r | (∫ α) | (t + t) | (t t) | Re(u) | Im(u) | arg(u) | |u| u := z | | F A | (t + it) | teit | u | (u + u) | (u u) | (α ? u; u) γ := α | (t ≤ t) | [F] | (γ γ ) Figure 11.15. The syntax of EQPL (Mateus and Sernadas 2006)
propositional logic) to give semantics to “quantum formulae.” In other words, propositional logic is extended to produce quantum propositional logic by taking combinations of models of the former to build models of the latter; the authors call this the exogenous approach to enriching logics. Mateus and Sernadas (2004b) first generalize classical propositional logic to incorporate probability, leading to the logic EPPL, and then further generalize (by defining mathematical structures embodying the postulates of quantum mechanics) to EQPL, which we now describe. The formulae of EQPL (Mateus and Sernadas 2006) allow one to reason about the state of individual qubits and involve usual logical connectives such as negation and implication. There are two levels of formulae: classical formulae, which hold only if all valuations in a state satisfy them, and quantum formulae, which are essentially logical combinations of classical formulae. The syntax of EQPL is given in Figure 11.15. The starting point for defining the semantics of EQPL is the establishment of a denumerable set of propositional constants qB = {pk : k ∈ N}, where we associate each pk to a single qubit in the protocol under consideration. A classical valuation v is a truth value assignment for all propositional constants, i.e., a mapping v : qB → {0, 1}. Given a set V of classical valuations, we construct a Hilbert space H = H (V ) of which the v ∈ V constitute an orthonormal basis. In the definition of EQPL, a set of admissible valuations V is established, and the Hilbert space H (V ) is constructed by making each vector v ∈ V into a basis vector of H (V ); in other words, H (V ) is spanned by the vectors in V . For our purposes we take V to consist of all 2n valuations for the n propositional symbols; each of these valuations corresponds to a computational basis vector of the Hilbert space associated with an n-qubit system. A quantum valuation is a unit vector of H . A quantum state |ψ is none other than a quantum valuation and so can be expressed as a linear combination of classical valuations (which are computational basis states). An n-qubit state |ψis specified by 2n complex numbers { v|ψ | v ∈ 2qB }. The complex number v|ψ (termed a “logical amplitude”) is the projection of the unit vector ψ on the basis vectors |v. Example 11.4.1. For a 2-qubit system we have four possible valuations for the two propositional constants p0 and p1 . These valuations correspond to the four
P1: SBT CUUS834-11
cuus834-gay
436
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
computational basis vectors |00, |01, |10, |11. We have the set V = {v00 , v01 , v10 , v11 } where: v00 : p0 → 0, p1 → 0
(11.6)
v01 : p0 → 0, p1 → 1
(11.7)
v10 : p0 → 1, p1 → 0
(11.8)
v11 : p0 → 1, p1 → 1.
(11.9)
The semantics of EQPL is defined in terms of a quantum interpretation structure (Mateus and Sernadas 2004b). Definition 11.4.2. A quantum interpretation structure is a tuple w = (V, S , |ψ , ν) where: • V is a nonempty subset of 2qB (for our purposes we take V = 2qB ) • S is a finite partition of qB (this is actually an entanglement partition, containing those qubits that are not entangled with the rest of the state) • |ψ = {|ψ[R] } R∈ S where each |ψ[R] is a unit vector of H[R] and such that: (i) (ii) (iii) (iv)
|ψ[∅] = exp(i0) |ψ[R] = S∈S ,S⊆R |ψ[S] for each nonempty R ∈ S |ψ[S] is non–factorisable for each S ∈ S v|ψ[qB] = 0 if v ∈ V
• ν : {ν F A } F⊆ f in qB,A⊆F where each ν F A ∈ C and ν F A = v AF |ψ[F] if F ∈
S.
Definition 11.4.3. The denotations of EQPL terms are defined by [[x]]w,ρ = ρ(x) [[r<]]w,ρ = r [[ α ]]w,ρ = µw (|α|V ) [[z]]w,ρ = ρ(z) [[|G,A ]]w,ρ = νG,A % [[u 1 ]]w,ρ if |α|V = V [[(α ? u; u)]]w,ρ = [[u 2 ]]w,ρ otherwise [[t1 + it2 ]]w,ρ = [[t1 ]]w,ρ + δ[[t2 ]]w,ρ Satisfaction of quantum formulae is defined by w, ρ w, ρ w, ρ w, ρ
α iff v α for every v ∈ V (t1 ≤ t2 ) iff [[t1 ]]w,ρ ≤ [[t2 ]]w,ρ [F] iff F ∈ S (γ1 ⊃ γ2 ) iff w, ρ γ1 or w, ρ γ2
Note that a quantum interpretation structure consists of a quantum state as well as additional information about its structure, including the entanglement partition
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
437
S and the coefficients ν. In addition to this, a probability space is defined and is used to assign meaning to terms in the logic representing measurement of a set F of qubits; it suffices to say here that this space comprises a probability measure µwF , as this symbol is used in the definition of the satisfaction relation for the logic. Given a set S of qubit symbols and a set V of valuations, the extent at V of a classical formula α over S is defined as |α|VS = {v ∈ V[S] : v α}. The satisfaction relation for the logic also makes use of the concept of an assignment ρ, which is simply a store defined for all variables of interest (where x denotes a real variable and z a complex variable), so that ρ(x) ∈ R, ρ(z) ∈ C. A classical formula α evaluates to true if and only if α is true for every valuation corresponding to a basis vector that appears in the quantum state with a nonzero coefficient. For example, if the quantum state is √12 (|00 + |11) then q0 ⇔ q1 is true but q0 ∧ q1 is false. Note that commonly encountered connectives such as ⇔ and ∧ can be defined (at both the classical and quantum level) in terms of falsum (⊥) and implication (⇒ and respectively). A quantum formula γ is the constant ⊥, a comparison formula t1 ≤ t2 , a formula involving a quantum connective such as γ1 γ2 , a classical formula α, or an entanglement formula [qi , qj , . . .]. The formula t1 ≤ t2 is evaluated by evaluating t1 and t2 to real values. Quantum connectives are defined by the usual truth tables for Boolean operators applied to the values of the operands.
11.4.2 QCTL: Quantum Computation Tree Logic We have implemented quantum computation tree logic (QCTL) (Baltazar et al. 2008) in the QMC model checker; QCTL adds the usual temporal connectives (AF, EF, EU) of computation tree logic (CTL) (Emerson 1990) to EQPL. The syntax of temporal formulae is given by θ ::= γ | θ θ | (EXθ) | ([θ EU θ ]) | (AFθ ).
(11.10)
The temporal operators EX, EU, AF allow us to build formulae that express, with reference to the tree of all possible program executions, in which paths and in which states a quantum formula should hold: • EX θ expresses the notion “there exists a path (i.e., a run of the program) in which, if θ holds in a state of this path, it also holds in the immediately following state (the next state).” • [θ1 EU θ2 ] expresses the fact that “there exists a path (i.e., a run of the program) in which θ1 holds for a sequence of states, and immediately after θ2 holds until the end of the run.” • AF θ expresses the fact that “for all runs of the program, there is a future state in which θ is satisfied.” Other common CTL operators, such as EF, can be expressed as combinations of the preceding operators (Baltazar et al. 2008). The semantics of QCTL is defined in terms of a quantum Kripke structure.
P1: SBT CUUS834-11
cuus834-gay
438
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
Definition 11.4.4. A finite quantum Kripke structure over the set of qubits qB and variables X is a pair T = (S, R) where: • S ⊂ HqB × RX is a set of pairs (ψ, ρ) such that ψ is a unit vector in HqB and ρ is an assignment, and • R ⊆ S × S is a relation such that for any (ψ, ρ) ∈ S, there is a (ψ , ρ ) ∈ S such that ((ψ, ρ), (ψ , ρ )) ∈ R. If S is finite then T is said to be finite, and |S|, which is the number of elements in S, is said to be the size of T . Definition 11.4.5. The semantics of QCTL formulae is defined by T , w, ρ QCTL γ iff w, ρ γ T , w, ρ QCTL (θ1 ⊃ θ2 ) iff T , w, ρ QCTL θ1 or T , w, ρ QCTL θ2 T , w, ρ QCTL EXθ iff T , w , ρ QCTL θ for some (w, ρ) ∈ S such that ((w, ρ), (w , ρ )) ∈ R T , w, ρ QCTL AFθ iff for all paths (w1 , ρ1 ), (w2 , ρ2 ), . . . with w1 = w and ρ1 = ρ there is a i ≥ 1 such that T , wi , ρi QCTL θ T , w, ρ QCTL E[θ1 Uθ2 ] iff there is a path (w1 , ρ1 ), (w2 , ρ2 ), . . . with w1 = w and ρ1 = ρ such that for some i ≥ 1, T , w, ρ QCTL θ2 and T , w j , ρ j QCTL θ1 for 1 ≤ j < i.
11.4.3 Interpreting QCTL Formulas over QMC Models The key ingredients for evaluating EQPL formulae are the quantum state |ψand the classical assignment function ρ for variables. Entanglement information about the quantum state is also needed (the sets V and S in the EQPL paper, Mateus and Sernadas 2004a), but as we shall see, this information can be extracted from the quantum state directly, at least in the cases of interest. The classical assignment ρ corresponds to the union of all classical stores σ ∈ in our setting. We consider the graph that results from joining all possible runs of a QMCLang program, referred to as the program tree or execution tree, and use it in place of the quantum Kripke structure that the authors of QCTL have defined. The elements of the program tree T corresponding to a QMCLang program P are states (|ψ , , κ) (see Definition 11.3.3) linked by a relation ⇒, such that: For all transitions (P, κ, , |ψ) −→ P (P , κ , , ψ ) (11.11) (|ψ , , κ) ⇒ (|ψ , , κ ) We are able to evaluate QCTL formulae over a QMCLang program tree T computationally, as detailed in the next section. Since a program tree contains all possible runs of a program, our method is exhaustive and corresponds essentially to an explicit model-checking procedure.
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols PROGRAM TREE
Interpreter
Scheduler
439
RESULT
Checker
Formula Parser
Parser
Figure 11.16. QMC’s overall structure
11.5 The QMC Model Checker QMC is a tool that automatically explores all possible behaviors arising from a protocol description expressed in QMCLang and enables QCTL properties to be checked over the resulting structure. A protocol model consists of definitions of one or more processes. The commands performed by these processes are interleaved, in order to simulate concurrent execution. Nondeterministic choices are resolved in all possible ways, producing a tree of all possible executions of the protocol. The QMC tool has three main components: (1) a process scheduler, (2) a language interpreter, and (3) a model checker. The role of component (1) is essentially to perform the tasks described in the previous paragraph. The language interpreter handles the execution of individual commands and keeps track of the overall classical and quantum state at each step. Finally, the verifier is responsible for evaluating QCTL formulae over the structure generated by (1) and (2). This structure is depicted in Figure 11.16. QMC has a graphical user interface that includes a user-friendly editor for models and properties (see Figure 11.17). Given a model and a QCTL formula for verification, QMC outputs the following: • A summary of the files provided as input and basic feedback on the model provided, including the number of states and the total number of runs, • A verification result for the formula provided, • A list of states (if any) that serve as counterexamples to the formula, • A prompt that allows the user to track individual states and trace runs of interest, as well as to verify further formulae.
P1: SBT CUUS834-11
cuus834-gay
440
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
Figure 11.17. The graphical user interface of QMC
QMC also enables the program execution tree to be displayed, by providing interfaces to the DOT graph layout tool (Gansner and North 2000) and the ZGRViewer application (Pietriga 2005). The remainder of this chapter describes various implementation aspects, and the specific algorithms used in each of the components of QMC as presented in Figure 11.16.
11.5.1 Parser Implementation The inputs to QMC are QMCLang source files and property description files consisting of EQPL/QCTL formulae and various instructions. These inputs are passed to suitable parsers, one for QMCLang models and one for formulae. Both parsers have been implemented using SableCC (Gagnon 1998), which is an (1) parser generator. The benefit of SableCC is the flexibility to write many different “tree-walker” classes (in Java) to traverse of the parse tree of an input program. QMC includes a tree-walker for interpreting each step in a QMCLang program, a separate treewalker for evaluating state formulae (indeed, several of these, one for each class of formula in EQPL), and another for evaluating temporal formulae. The grammar for QMCLang presented in Section 11.3 is ambiguous. This ambiguity has been resolved by using suitable transformations in the parser grammar.
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
441
11.5.2 Scheduler Implementation The purpose of the scheduler in QMC is to simulate the interleaving of all executable processes in a given input model, at each step of the simulation. The result of the scheduler-interpreter interaction is the generation of an execution tree (see Section 11.4.3) that is passed to the model checker. The scheduler needs to store and update several variables as execution of a model proceeds: • The “program counter” for each process, i.e., the current command (a guarded command, a single statement or atomic block) to be executed, • The current state of all variables and the current state of the tableau, • The current position in the execution tree so as to store the result of the next execution, • The current option and current statement within that option if executing a non–deterministic choice, • The index of the current loop iteration, which is at most i MAX , an implementation-dependent upper bound (see rules -3 and 4 in Section 11.3), • The number of processes that have completed, • The number of processes that are blocked (nonexecutable), • The total number of processes. The implementation of the scheduler is lengthy and complex, as it has to handle a large number of possibilities, including explicit and implicit non–determinism in models. As we have seen in Section 11.3, we treat indeterminate quantum measurements as being equivalent to a nondeterministic choice between measurement outcomes (see also Equation 11.1).
11.5.3 Interpreter Implementation The purpose of the interpreter is to perform the computational steps corresponding to the execution of a QMCLang statement. The interpreter is invoked by the scheduler as execution proceeds and is responsible for invoking the AaronsonGottesman algorithm (explained next) whenever a quantum operation or measurement is performed.
11.5.3.1 Simulation Algorithm During execution of a model, QMC stores (ψ, σ, γ1 , . . . , γn ) (for all n processes) where |ψ is the overall quantum state. The quantum state |ψ is represented internally in an implicit way: rather than storing the so-called state vector representation of |ψ (which grows exponentially in length as a function of the total number of qubits in |ψ), we use the stabilizer array representation, which is a binary representation of the set of Pauli operators that fix (or stabilize) |ψ.
P1: SBT CUUS834-11
cuus834-gay
442
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
Using the stabilizer array representation, we gain significant computational benefits in terms of both space and time when simulating a given protocol, given that simulation of stabilizer circuits is performed using a polynomial time algorithm (Aaronson and Gottesman 2004), and the representation of the state grows polynomially with the number of total qubits. Using this approach, the application of each unitary operator or measurement involves updating the stabilizer array by applying suitable row or column operations. Consider the 5-qubit basis state |ψ1 = |00000. The operators Z I I I I , I Z I I I , I I Z I I , I I I Z I , I I I I Z all stabilize |ψ1 since Z |0 = |0: (Z ⊗ I ⊗ I ⊗ I ⊗ I ) |00000 = |00000 (I ⊗ Z ⊗ I ⊗ I ⊗ I ) |00000 = |00000 (I ⊗ I ⊗ Z ⊗ I ⊗ I ) |00000 = |00000 (I ⊗ I ⊗ I ⊗ Z ⊗ I ) |00000 = |00000 (I ⊗ I ⊗ I ⊗ I ⊗ Z ) |00000 = |00000 . We can represent the state |ψ1 uniquely by writing the list of these particular operators, which generate its stabilizer group. To store the generators of a stabilizer group in a computer program we use a check matrix (Nielsen and Chuang 2000). Each line of the check matrix is a Boolean array {ti } of length 2n + 1 that represents one generator. To represent the stabilizer operator P=
n 2
Pi = P1 ⊗ · · · ⊗ Pn , where Pi ∈ {I, X, Y, Z }
(11.12)
i=1
we set the values of ti as follows: ti ← 0 and yi+n ← 0 if Pi = I ti ← 1 and yi+n ← 0 if Pi = X ti ← 1 and yi+n ← 1 if Pi = Y ti ← 0 and yi+n ← 1 if Pi = Z . The value of the last entry, t2n+1 , is set to 1 to represent a positive overall sign or to 0 to represent a negative overall sign. In practice the last entry is actually a pair of bits, as there are four possible global phases (+1, −1, +i and −i). Thus, for example, the generating set of the stabilizer group of |ψ1 above is represented using the following check matrix: 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 (11.13) M1 = 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 Aaronson and Gottesman (2004) use a generalized version of the check matrix that they refer to as a tableau. A tableau corresponding to a stabilizer state is
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
T1,1
. . . Tn,1 Tn+1,1 . . . T2n,1 T2n+1,1
···
T1,n
T1,n+1
.. . . · · · Tn,n · · · Tn+1,n
.. .
..
···
T1,2n
.. . . · · · Tn,2n · · · Tn+1,2n ..
Tn,n+1 Tn+1,n+1
.. .. .. .. . . . . . · · · T2n,n T2n,n+1 · · · T2n,2n · · · T2n+1,n T2n+1,n+1 · · · T2n+1,2n ..
443
.. Destab. . Tn,2n+1 Tn+1,2n+1 .. . Stab. T2n,2n+1 T2n+1,2n+1 Scratch T1,2n+1
X-part (n columns) Z-part (n columns)
phase
Figure 11.18. The binary tableau representation of a quantum state
an augmented check matrix containing a set of destabilizer generators atop the stabilizer generators. The stabilizer generators for a quantum state |ψ ∈ H n generate a subset of the Pauli group P n ; when these are taken together with the corresponding destabilizer generators, they generate no longer a subset but the full Pauli group P n . The destabilizer generators are necessary in the simulation algorithm to enable more efficient computation of the effect of a measurement on the quantum state. Thus the representation of a quantum state that is used by the simulation algorithm is a matrix T = [Ti, j ] of the following form.
T1,1
. . . Tn,1 Tn+1,1 . . . T2n,1 T2n+1,1
···
T1,n
T1,n+1
..
.. .
.. .
Tn,n Tn+1,n
Tn,n+1 Tn+1,n+1
. ··· ···
.. .. . . . · · · T2n,n T2n,n+1 · · · T2n+1,n T2n+1,n+1 ..
n columns
Destabilizer Rows (n)
Stabilizer Rows (n) Scratch Row
(11.14)
phase
Each row in the matrix of (11.14) corresponds to a Pauli operator of dimension n. In particular, Ti, j ∈ {X, Y, Z , I } and the operator in row i is the tensor product of the row entries (with the overall phase factor in front): Op i := Ti,n+1 · Ti,1 ⊗ · · · ⊗ Ti,n The binary representation of T is a matrix T = [Ti, j ] that takes the form shown in Figure 11.18.
P1: SBT CUUS834-11
cuus834-gay
444
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
Algorithm -(T , operation, arguments) 1. for all rows 1 ≤ i ≤ 2n do 2. if applying the CNot gate from qubit a to qubit b then 3. Set Ti,(2n+1) ← Ti,(2n+1) ⊕ Ti,a · Ti,(n+b) · (Ti,b ⊕ Ti,(n+a) ⊕ 1). 4. Set Ti,b ← Ti,b ⊕ Ti,a . 5. Set Ti,(n+a) ← Ti,(n+a) ⊕ Ti,(n+b) . 6. else if applying the Hadamard gate to qubit a then 7. Set Ti,(2n+1) ← Ti,(2n+1) ⊕ Ti,a · Ti,(n+a) . 8. Swap Ti,a and Ti,(n+a) . 9. else if applying the Phase ( π4 ) gate to qubit a then 10. Set Ti,(2n+1) ← Ti,(2n+1) ⊕ Ti,a · Ti,(n+a) . 11. Set Ti,(n+a) ← Ti,(n+a) ⊕ Ti,a . 12. if measuring qubit a in the standard basis then 13. if there exists a stabilizer row p ∈ {n + 1, . . . , 2n} such that T p,a = 1 then 14. for all rows i such that i = p and Ti,a = 1 do 15. Multiply row i by row p (using the Pauli group operation). 16. Set the ( p − n)th row equal to row p. 17. Set the pth row to 0 (which corresponds to the identity operator). 18. Set the phase of the pth row, T p,2n+1 ← 0 or T p,2n+1 ← 1 with equal probability. 19. Set T p,n+a ← 1. 20. return T p,2n+1 as measurement outcome. 21. else 22. Set the 2n + 1th row to 0. 23. for all rows 1 ≤ j ≤ n such that T j,a = 1 do 24. Multiply row 2n + 1 by row j + n. 25. return T p,2n+1 as measurement outcome. Figure 11.19. The Aaronson-Gottesman simulation algorithm for applying Clifford operations to the tableau representation of a quantum stabilizer state
The Clifford group gates, which are the only operations we will allow in protocol models, can be expressed as Boolean functions of the entries in the check matrix. We assume that the check matrix is T = [Ti, j ], where Ti, j represents the entry in row i, column j. We denote the bitwise exclusive OR by ⊕ and conjunction by ·. Using our notation for the binary tableau, the Aaronson-Gottesman simulation algorithm may be stated as shown in Figure 11.19. Note that we have used a single symbol Ti, j to denote all matrix elements, while Aaronson and Gottesman denote the “X part” of the tableau (i.e., elements T1,1 to T2n,n ) by xi, j , the “Z part” of
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
445
the tableau (i.e., T1,n to T2n,2n ) by z i, j , and the phase elements T1,2n+1 to T2n,2n+1 by ri . The Pauli group operation is implemented by rowsum(h,i) which multiplies row i onto row h while taking into account the overall phase factor. This function is defined by Aaronson and Gottesman (2004).
11.5.3.2 Complexity of Simulating Stabilizer Circuits Aaronson and Gottesman (2004) show that the problem of simulating stabilizer circuits is complete for the classical complexity class ⊕L (parity-L). Here we provide the formal definition of this complexity class and its superclass (Aaronson 2004). Definition 11.5.1 (Complexity class ⊕L: Parity L). Has the same relation to L as ⊕P does to P. Solving a linear system over Z2 is complete for ⊕L. Definition 11.5.2 (Complexity class L: Logarithmic Space). The class of decision problems solvable by a Turing machine restricted to use an amount of memory logarithmic in the size of the input, n. (The input itself is not counted as part of the memory.) L contains N C1 and is contained in generalizations including N L, L/ poly, S L, R L, ⊕L, and Modk L. It is important to note that the efficiency of the simulation is due to the compactness of the binary representation of the tableau, and the ability to express quantum operators and measurements as simple binary operations on the tableau. In our work it is often necessary to convert the tableau representation to the explicit state vector representation of quantum states. The procedure to perform this conversion is implemented in Aaronson and Gottesman’s CHP simulator and has also been used in QMC, but it involves a maximum of 2n iterations for an n-qubit state vector. In other words the conversion of an n-qubit tableau into the corresponding quantum state vector has a cost that is exponential in n. Unfortunately this conversion becomes necessary when checking several classes of EQPL formula, although there is the notable exception of entanglement partitions, which we describe later.
11.5.3.3 Optimizing the Implementation of the Simulation Algorithm There is actually scope for optimizing the implementation of the simulation algorithm, notably by using low-level binary operations and by packing the stabilizer array representation into 32-bit registers, as Aaronson and Gottesman (2004) did in the final implementation of their CHP simulator. The current version of QMC uses binary operations on entire integer registers, where every register corresponds to a bit in the stabilizer array; the Java language does not provide modifiers such as short and unsigned (which are used in C), which would have helped to make
P1: SBT CUUS834-11
cuus834-gay
446
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
Algorithm -(γ ): 1. if γ is of the form α then 2. return -(α) 3. else if γ is of the form t1 ≤ t2 then 4. r1 ← (t1 ) 5. r2 ← (t2 ) 6. return r1 ≤ r2 7. else if γ is of the form [F] then 8. Call C N F P(F) to transform tableau into normal form 9. Search for matching X Z pairs in the two portions of the tableau 10. if such pairs are found then 11. return true 12. else 13. return false 14. else if γ is of the form γ1 γ2 then 15. b1 ← -(γ1 ) 16. b2 ← -(γ2 ) 17. return (b1 ⇒ b2 ) { where ⇒ denotes logical implication. } Algorithm -(α) := 1. Compute all the valuations (basis vectors) in the quantum state, i.e. the full state vector |ψ. 2. if α is of the form q B then 3. for all valuations v in |ψ do 4. acc ← acc ∧ v(q B) 5. return acc 6. else if α is of the form ⊥ then 7. return false 8. else if α is of the form α1 ⇒ α2 then 9. for all valuations v in |ψ do 10. b1 ← -(α1 ) 11. b2 ← -(α2 ) 12. acc ← acc ∧ (b1 =⇒ b2 ) Figure 11.20. EQPL verification algorithm: quantum and classical formulae
the representation more space-efficient. However, a more efficient implementation of the binary representation of stabilizer generators is likely to be possible using Java’s BitSet class (Sun Microsystems, Inc. 2006).
11.5.4 Model-Checker Implementation We now discuss the algorithms that QMC uses for the verification of properties of models. The core requirement is to evaluate quantum formulae γ of EQPL on states of the model and to use this as a component of the model-checking algorithm for QCTL. The algorithms are defined in Figures 11.20–11.22.
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
447
Algorithm (t): 1. if t is of the form x then 2. return σ (x) 3. else if t is of the form r then 4. return r 5. else if t is of the form (∫ α) then 6. Search for all valuations satisfying α. Call this S. 7. if S = ∅ then 8. return 0 9. total ← 0 10. for all valuations v ∈ S do 11. c ← coefficient of v 12. amp ← amplitude of c 13. total ← total + amp 2 14. return total. 15. else if t is of the form t1 + t2 then 16. m 1 ← (t1 ) 17. m 2 ← (t2 ) 18. return (m 1 + m 2 ) 19. else if t is of the form t1 t2 then 20. m 1 ← (t1 ) 21. m 2 ← (t2 ) 22. return (m 1 · m 2 ) 23. else if t is of the form Re(u) then 24. m ← (u) 25. return Re{m} 26. else if t is of the form Im(u) then 27. m ← (u) 28. return Im{m} 29. else if t is of the form arg(u) then 30. m ← (u) 31. return arg {m} 32. else if t is of the form |u| then 33. m ← (u) 34. return ||m|| Figure 11.21. EQPL verification algorithm: real terms
11.5.4.1 EQPL Verification Algorithms and Complexity The reader is reminded that the semantics of EQPL is defined by Mateus and Sernadas (2006) in terms of a quantum interpretation structure, which includes a quantum state |ψ, a classical state ρ, and a means of specifying entanglement partitions of |ψ. In our setting ρ includes the global classical state, and we omit
P1: SBT CUUS834-11
cuus834-gay
448
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
Algorithm -(u): 1. if u is of the form z then 2. return σ (z) 3. else if u is of the form |α F A then 4. if state is not F-factorisable then 5. return 0 6. Search for valuations which satisfy α. Call this set S. 7. if S = ∅ then 8. return 0 9. Search in S for a valuation which verifies (maps to ) all q ∈ A. { If such a valuation exists, it will be unique. } 10. if no such valuation is found then 11. return 0 12. return the coefficient of the valuation found { this will be one of ±1, ±i, ± √1k , ±i √1k where k is the number of basis vectors arising in the state vector expansion } 13. else if u is of the form t1 + it2 then 14. m 1 ← (t1 ) 15. m 2 ← (t2 ) 16. return (m 1 + i · m 2 ) 17. else if u is of the form t1 eit2 then 18. m 1 ← (t1 ) 19. m 2 ← (t2 ) 20. return (m 1 · exp(i · m 2 ) 21. else if u is of the form u then 22. c ← -(u) 23. return complex conjugate of c 24. else if u is of the form (u 1 + u 2 ) then 25. c1 ← -(u 1 ) 26. c2 ← -(u 2 ) 27. return (c1 + c2 ) 28. else if u is of the form (u 1 u 2 ) then 29. c1 ← -(u 1 ) 30. c2 ← -(u 2 ) 31. return (c1 · c2 ) 32. else if u is of the form (α ? u; u) then 33. if b = true then 34. return -(u 1 ) 35. else 36. return -(u 2 ) Figure 11.22. EQPL verification algorithm: complex terms
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
449
the explicit representation of entanglement partitions, instead calculating them on demand. Note that in QMC we have implemented the full EQPL as described by Mateus and Sernadas (2006) and in Figure 11.15, not just the fragment of EQPL (“efficient EQPL”) that is contained in QCTL (Baltazar et al. 2008). The differences between the two are that: (i) full EQPL treats classical formulae (α) as a special case of quantum formulae whereas “efficient EQPL” allows classical formulae only in probability terms (∫ α), (ii) full EQPL includes complex-valued terms (u), and (iii) full EQPL includes entanglement partition terms ([F]). This is significant as it affects the complexity of model checking QCTL formulae, because there are more cases in which a conversion from the tableau representation to the state vector representation of quantum states is necessary. Evaluating EQPL formulae over any state |ψ arising from the simulation of a protocol model requires being able to determine all the valuations in that state, so that the truth value of any propositional constant (e.g., qbi where 0 ≤ i ≤ N for an N -qubit system – this constant corresponds to the state of the ith qubit in the quantum state) can be computed. What this means in more practical terms is that, in order to determine whether a given qubit has valuation true (1) or false (0) in the current state, it is necessary to extract all the basis vectors that are present in the state vector expansion of |ψ. The process of extracting all the basis vectors requires converting from the space-efficient stabilizer array representation to the state vector corresponding to |ψ, and this conversion can take up to a maximum of 2 N steps if all the 2 N basis vectors appear in |ψ (as mentioned in Section 11.5.3.2). Even when |ψ is a stabilizer state, it may contain all of the basis vectors with nonzero coefficients. Therefore in general, evaluating a classical formula requires solving a SAT problem, and of course this is NP-complete. This observation seems rather discouraging given that the process of verifying a state formula requires us to lose the efficient state representation that is used during simulation. A useful direction for future work would be to integrate an off-the-shelf SAT solver into QMC. However, there are cases for which we can avoid the conversion from stabilizer array to state vector; for certain classes of formula we can extract the necessary valuation information by processing the stabilizer array directly. We have observed that certain classical EQPL formulae, which do not involve the conjunction operator ∧, may be checkable on a given state |ψ by just examining the contents of those columns in the stabilizer array corresponding to the qubits in the formula. We are still investigating optimizations and heuristics such as this, bearing in mind that the most general EQPL formulae still require performing a state vector conversion. It is also worth noting that the algorithm for checking qubit equality does not require extracting the full expansion of the quantum state, but can be checked by operating on the internal stabilizer representation in an efficient way. Checking whether a given set of qubits constitutes a partition of a stabilizer state |ψ is possible using the polynomial time algorithm of Audenaert and Plenio
P1: SBT CUUS834-11
cuus834-gay
450
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
(2005) for the so-called “bipartite Clifford Normal Form (CNFP),” which works directly with the stabilizer array. This algorithm is discussed in Section 11.5.4.3.
11.5.4.2 Complexity We now formalise the complexity of model checking EQPL formulae. For this calculation we consider only closed formulae (i.e., formulae without variables), following Baltazar et al. (2008). We assume that basic arithmetic operations take O(1) time, and we use |φ| to denote the length of a formula φ, namely, the number of symbols required to write it. In general, EQPL formulae are evaluated over the explicit state vector representation of a quantum state |ψ on n qubits, which is a 2n array of complex numbers. To evaluate a quantum formula γ over a quantum state |ψ, we need to evaluate all the terms in γ . Evaluating a classical formula α (which is a special case of γ ) takes 2n · |α| steps as we need to traverse the set of all valuations in |ψ to determine which ones satisfy α. However, in our setting there is the additional computational cost of computing the set of all valuations from the tableau representation of the quantum state, which has a worst-case complexity of 2n based on the algorithm used in CHP (Aaronson and Gottesman 2004). So evaluating a classical EQPL formula over a stabilizer quantum state represented using a tableau has a worst-case complexity of 2n · 2n · |α| = 22n · |α| = O(2n · |α|). Theorem 11.5.3 (based on Baltazar et al. 2008). Assuming that all basic arithmetical operations take O(1) time, there is an algorithm O(2n · |γ |) to decide if an n-qubit stabilizer quantum state |ψ(represented using a tableau) satisfies a quantum formula γ . Proof. Observe that the logical terms that take longer to evaluate are the forms α, ∫ α, | F A (we ignore the form [F] here because it can be evaluated in polynomial time for stabilizer states using the algorithms described in Section 11.5.4.3). The number of terms in the preceding forms appearing in a formula γ is bounded above by |γ |, and each of these requires traveling through the set of all valuations and checking a classical formula. For the forms ∫ α and | F A we accumulate intermediate results during evaluation (summing amplitudes or squares of amplitudes of those terms satisfying a classical formula), but these are just arithmetic operations. As we have seen, the time complexity of evaluating these terms is exponential in the number of qubits n and linear in the length of the formula. The remaining computations needed for arithmetic operations on real and complex values take at most O(|γ |) time, so that the total time needed to decide if a quantum state |ψ satisfies a quantum formula γ is O(2n · |γ | + |γ |) = O(2n · |γ |).
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
451
11.5.4.3 Computation of Bipartite Entanglement Normal Form The most interesting class of quantum state formulae for which an efficient implementation exists (thus avoiding the expensive state vector conversion) were those of the form [F] where F is a list of qubit symbols, i.e., entanglement partition formulae. Such a formula is true in the quantum state |ψ if all the qubits indexed within the square brackets may be separated from all the other qubits in the state (that is to say, if qubits qi , qj , . . . ∈ F are disentangled from the rest). We refer to a list of qubits F = {qi , qj , . . .} as a partition of the state |ψ if the formula [qi , qj , . . .] is satisfied by |ψ. We can evaluate such a formula on a stabilizer state by making use of the following theorem of Audenaert and Plenio (2005). Theorem 11.5.4 (Bipartite normal form). Consider a system of n qubits, separated into two parties, A and B, containing N A and N B qubits, respectively. Consider a stabilizer state described by an array of k independent, commuting generators. • By applying a suitable sequence of elementary row operations and local elementary column (qubit) operations, the stabilizer array can be brought into the following normal form: X I ··· I I ··· I X I ··· I I ··· I Z I ··· I I ··· I Z I ··· I I ··· I I X ··· I I ··· I I X ··· I I ··· I I Z ··· I I ··· I I Z ··· I I ··· I . . . .. .. . . ... ... . . . ... ... ... . . . ... ... . . . ... I I ··· X I ··· I I I ··· X I ··· I (11.15) I I ··· Z I ··· I I I ··· Z I ··· I I I ··· I ∗ ··· ∗ I I ··· I ∗ ··· ∗ . . . .. .. . . ... ∗ · · · ∗ ... ... . . . ... ∗ · · · ∗ I I ··· I ∗ ··· ∗ I I ··· I ∗ ··· ∗
party A
party B
Here, the asterisk (∗) stands for either I or X . • Every pair of rows containing the X Z combinations corresponds to two qubits (one from each party) being in a pure maximally entangled EPR state and completely disentangled from the other qubits. The rows in the lower blocks of the normal form, containing only I and X operators, correspond to the remaining qubits being in a (general, mixed) separable state. • The stabilizer state described by the stabilizer array is locally equivalent to a tensor product of a certain number p of EPR pairs with a separable state. For any additive entanglement measure E, the entanglement of the stabilizer
P1: SBT CUUS834-11
cuus834-gay
452
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
state is p E(). An upper bound on p is given by p ≤ min(3k/24, n A , n B ). Equality is obtained if and only k = 2n a = 2n b . If we treat the qubits listed in the partition F of the formula [F] of interest as party A in the bipartite normal form shown, then it follows from part (ii) of the theorem that the existence of matching X Z pairs in parties A and B will indicate the presence of entanglement between the qubits represented by the corresponding columns. We omit the presentation of the CNFP algorithm here, as it is thoroughly detailed, along with a proof of correctness of Theorem 11.5.4, by Audenaert and Plenio (2005).
11.5.4.4 Complexity The CNFP algorithm involves a sequence of row and column operations on a stabilizer array with k rows and n columns. For our purposes we always use k = n (since n generators are required to represent a unique n-qubit stabilizer state), and the tableau representation has an additional k = n rows representing destabilizer generators. (In the QMC implementation, the CNFP algorithm is modified to update not only the stabilizer generators, but also the destabilizers.) The computational cost of a row operation is O(n) since all elements of a row are traversed, and similarly for column operations. Since the entire stabilizer array is traversed (including the phase column) during a run of the CNFP algorithm, there is a time complexity of O(n 2 ). In the tableau representation that was described in Figure 11.18, there are 2n rows and 2n + 2 columns overall; the CNFP algorithm ignores the last (scratch) row. So in total the algorithm goes through all of the 4n 2 + 2n elements, and the time taken for this is O(4n 2 + 2n) = O(n 2 ). To summarize, it takes polynomial time in n, the number of qubits, to bring the tableau representation of a stabilizer state into a form which allows EQPL formulae of the form [F] to be evaluated. This is in contrast to other formulae, which in general require time exponential in n.
11.5.4.5 QCTL Verification Algorithms and Complexity The temporal connectives of QCTL are implemented as an extension to the evaluator for EQPL formulae, and involve the usual labeling algorithms for computation tree logic (B´erard et al. 1999), which are applied to the tree structure generated by QMC. The propositional fragment of the logic is just EQPL, so the QCTL algorithm necessarily invokes Algorithm -. The top-level algorithm for checking QCTL formulae, Algorithm -, is shown at the top of Figure 11.23. The crux of the algorithm is the function (θ, T ), which will mark those states of the program tree which satisfy the formula θ . At any one time, this function will need to initialize and refer to several different labelings, until the final labeling for the formula is produced (the
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
453
Algorithm -(θ, T ): 1. (θ, T ) 2. return currentlabelling [0] { The formula θ holds if the initial state of the execution tree T has been marked as true at the end of the algorithm. } Algorithm (θ, T ): 1. if θ is of the form γ then 2. Clear currentlabelling 3. for all states q in the execution tree T do 4. if -(γ ) = true then 5. currentlabelling[q] ← true { this is the case when q γ } 6. else 7. currentlabelling[q] ← false { this is the case when q γ } 8. return currentlabelling 9. else if θ is of the form θ1 θ2 then 10. currentlabelling ← new labelling 1 11. (θ1 , T ) 12. currentlabelling ← new labelling 2 13. (θ2 , T ) 14. currentlabelling ← new labelling 3 15. for all states q in the execution tree T do 16. labelling 3 [q] ← (labelling 1 [q] =⇒ labelling 2 [q]) 17. return labelling 3 18. else if θ is of the form (EXθ) then 19. currentlabelling ← new labelling 1 20. (θ, T ) 21. currentlabelling ← new labelling 2 22. for all transitions (q, q ) in T do 23. if labelling 1 (q ) = true then 24. labelling 2 (q) ← true 25. return labelling 2 Figure 11.23. The QCTL model-checking algorithm (continues in Figure 11.24)
variable currentlabelling is a pointer to the current labeling). The final result of evaluating θ is the value of the labeling for the root of the program tree, which is denoted by currentlabelling[0] in -. We assume here that the variable currentlabelling has initialized prior to running -. The presentation of the QCTL model checking algorithms in Figures 11.23 and 11.24 is very close to the style in which they have been implemented in QMC. The presentation of model-checking algorithms for CTL and its variants (of which QCTL is but one) is more usually given using fixed points. We give such a description of the QCTL model-checking algorithm in Figure 11.25.
P1: SBT CUUS834-11
cuus834-gay
454
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
Algorithm (θ, T ) continued: 26. if θ is of the form E[θ1 Uθ2 ] then 27. currentlabelling ← new labelling 1 28. (θ1 ) 29. currentlabelling ← new labelling 2 30. (θ2 ) 31. currentlabelling ← new labelling 3 32. for all states q in the execution tree T do 33. currentlabelling(q) ← false 34. seenbefore(q) ← false 35. if labelling 2 (q) = then 36. Add q to the set L of states to process 37. while L is nonempty do 38. Draw a state q from L 39. currentlabelling(q) ← true 40. for all predecessors q of q in T do 41. if seenbefore(q ) = false then 42. seenbefore(q ) ← true 43. if labelling 1 (q ) = true then 44. Add q to the set L of states to process 45. return labelling 3 46. else if θ is of the form (AFθ ) then 47. currentlabelling ← new labelling 1 48. (θ ) 49. currentlabelling ← new labelling 2 50. for all states q in the execution tree T do 51. if labelling 1 (q) = true then 52. Add q to the set L of states to process 53. while L is nonempty do 54. Draw a state q from L 55. currentlabelling(q) ← true 56. if seenbefore(q ) = false then 57. seenbefore(q ) ← true { where q is the predecessor of q} 58. if labelling 1 (q ) = true then 59. Add q to the set L of states to process 60. return labelling 2 Figure 11.24. The QCTL model-checking algorithm (continued from Figure 11.23)
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
455
SatT (γ ) = { |ψ ∈ S : |ψ γ }
(11.19)
SatT (θ1 θ2 ) = (S\SatT (θ1 )) ∪ SatT (θ2 ))
(11.20)
SatT (EXθ ) = { |ψ ∈ S : R(|ψ) ∩ SatT (θ ) = ∅} SatT (AFθ ) = FixedPoint[λX.{R
−1
X } ∩ X, SatT (θ )]
(11.21) (11.22)
SatT (E[θ1 Uθ2 ]) = FixedPoint[λX.{R −1 X ∩ SatT (θ1 )}, SatT (θ2 )] (11.23) Figure 11.25. Fixed-point model-checking algorithm for QCTL
Let S denote the set of all states in the program tree T . We denote by SatT (θ ) the set of states in T that satisfy θ : SatT (θ ) := { |ψ ∈ S : T , |ψ QC T L θ}
(11.16)
Let R denote a relation over the states in S such that, for all q, q ∈ S: R(q, q ) if and only if q ⇒ q
(11.17)
In the fixed-point version of the algorithm, we use the relation R −1 defined thus: R −1 X = {q ∈ S | ∃q ∈ X, R(q, q )}
(11.18)
11.5.4.6 Complexity The temporal connectives of QCTL are implemented in exactly the same fashion as for the original logic CTL. For a transition system T of size ST the complexity 2 of verifying a CTL formula φ has been shown to be O(|φ|2 · ST ). This extends naturally to QCTL, with the essential distinction that the computational cost of evaluating a propositional (EQPL) formula is now O(2n · |φ|). Theorem 11.5.5. Assuming that basic arithmetic operations take O(1) time, the algorithm -(θ, T ) for model checking a QCTL formula θ over a program 2 tree T takes O(|θ |2 · ST · 2n ) time. 2 Proof. The propositional CTL model-checking algorithm takes O(|θ |2 · ST ) time. If a quantum formula is treated as a propositional constant, then that would have been the complexity for QCTL. However, a quantum formula must be evaluated for each quantum state in the program tree, and we have found that checking a quantum formula on a quantum state |ψ in our setting requires time O(2n · |γ |) for a quantum formula γ . The theorem follows directly.
11.5.5 Special Extensions We have implemented two special extensions to the state logic in the implementation of QMC that have proved useful in the development of examples and case studies. Their importance is demonstrated in the case studies and discussed further in Section 11.6. We use the keyword history prior to a variable name to indicate to QMC that we are referring to the history variable of that name, rather than the value of
P1: SBT CUUS834-11
cuus834-gay
456
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
that variable in the current state. This is an extension to the original syntax of the logic. While EQPL was originally intended to enable reasoning about individual quantum states, this extension enables us to reason about the quantum states that arise at different stages during a particular execution (run) of the protocol. We have introduced an equality operator for qubits. We use it to compare the state of a qubit at a particular point during a run of the protocol (after the overall quantum state |ψ has been explicitly saved) with the state of a different qubit at the end of the kth run of the protocol (when the overall quantum state is, say, ψk , for all values of k). The equality of qubits in two different quantum states is well defined only if the qubits in question are disentangled from the other qubits in the respective states; otherwise these qubits do not have an individual state that can be used in a comparison. Thus a qubit equality formula implicitly incorporates a specification of entanglement properties. Note that this notion of equality is an extension to the EQPL logic that we have implemented in QMC, and its semantics is different from the notion of “qubit equivalence” (denoted by ⇔ in standard EQPL). Finally, we distinguish the qubit equality operator “==” from the standard equality symbol “=” that we use in QMC for comparing classical variables (integers, Booleans, reals).
11.6 Case Studies We now illustrate our modeling language, specification logic and model–checking system by presenting several case studies.
11.6.1 Quantum Teleportation The first case study is the quantum teleportation protocol (Bennett et al. 1993) discussed in Section 11.2.2. In QMC’s specification language, the protocol may be expressed as shown in Figure 11.26. This model teleports an arbitrarily chosen input state representable in the stabilizer formalism, i.e., one of |0, |1, √12 (|0 ± |1), √12 (|0 ± i |1). Because model checking is exhaustive, the behavior of the protocol for all of these input states is automatically checked. In our setting, we allow for global variables (such as epr1, epr2), typed communication channels (such as epr_to_A) that are always global, and local (private) variables for each process (such as a, b, c, d, q). Communication is asynchronous, with executability rules restricting the way in which the interleaving of process is performed. For instance, the process Bob cannot start unless channel epr_to_B is filled with a value. Note that the curly braces (“{” and “}”) are used to group together a sequence of statements that must be executed in one step. The model just shown describes a system of three communicating processes EPRSource, Alice, and Bob. The process EPRSource represents a device that produces pairs of quantum bits in the entangled state | and sends the first of these to Alice (through a channel epr_to_A) and the second to Bob (through a channel epr_to_B). Note that the process Alice may begin independently of
P1: SBT CUUS834-11
cuus834-gay
2
978 0 521 51374 6
October 31, 2009
program Teleportation; var epr_to_A, epr_to_B: channel of qubit; A_to_B: channel of integer;
4
6
8
10
process EPRSource; var q1,q2: qubit; begin { q1 := newqubit; q2 := newqubit; } { had q1; cnot q1 q2; } epr_to_A ! q1; epr_to_B ! q2; end;
12
14
16
18
20
22
24
26
28
30
process Alice; var q, ancilla, epr1: qubit; a,b: integer; begin q := newqubit; if :: break; :: X q; :: had q; :: { X q; had q; } :: { had q; ph q; } :: { X q; had q; ph q; } fi savequbit q; epr_to_A ? epr1; { cnot q epr1; had q; a := meas q; b := meas epr1; } A_to_B ! a; A_to_B ! b; end;
32
34
36
38
40
42
44
46
process Bob; var epr2: qubit; c,d: integer; begin epr_to_B ? epr2; A_to_B ? c; A_to_B ? d; if :: ((c=0) and (d=0)) →break; :: ((c=0) and (d=1)) →X epr2; :: ((c=1) and (d=0)) →Z epr2; :: ((c=1) and (d=1)) →{ Z epr2; X epr2; } fi end; endprogram. Figure 11.26. A model of quantum teleportation
457
16:40
P1: SBT CUUS834-11
cuus834-gay
458
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
EPRSource; its first task is to create a qubit q and to place it in one of the six possible states (there are only six since we are restricting the possible operations to those within the stabilizer formalism); however, we can express the fact that any one of these possible states can be prepared by Alice, through a nondeterministic choice in lines 16–23. On line 24, the qubit state that has been prepared is saved for later reference; thus we obtain a history variable that will be used for the specification of the property of the protocol. In line 25, Alice receives a qubit from the EPRSource process, and immediately after she performs the operations that transform this qubit so that teleportation can occur. By performing the operations on lines 26–27, Alice influences the entangled state (and hence the qubit that Bob receives on line 34). The idea is that measuring one qubit in an entangled state will affect the state of the other qubit. When Bob receives the other qubit in the entangled state (line 34), he can transform it into the original state |ψ depending on the outcomes of Alice’s measurements (the values of variables c and d).
11.6.1.1 The Teleportation Property The requirement for the teleportation protocol described in Section 11.6.1 is that, at the end of the protocol, whatever the measurement outcomes, the third qubit will be in the same state as the first qubit was to begin with. To express this property, we need to compare the final state of the qubit Bob.epr2 with the state of qubit Alice.q. What is important to note, however, is the state of Alice.q evolves during the protocol (so it will not remain in the prepared state |ψ). We actually need to refer to the state of this qubit just before the operations on lines 28–29 of the model are performed. This justifies the need for the statement on line 26, which “freezes” the state of qubit Alice.q and the overall internal state at that particular step in the execution. We can then refer to the state of this variable at that step using the history variable history Alice.q. The property we need to express must be stated thus: history Alice.q = = Bob.epr2
(11.24)
Refer to Section 11.4 for an explanation of history variables and the equality operator for qubits, which we are using here.
11.6.1.2 Verifying Teleportation The model presented in Section 11.6.1 and the property in Section 11.6.1.1 may be supplied to QMC for verification directly. The teleportation model produces a transition system with 369,667 states in a total of 141,108 runs. It takes 110 seconds for QMC to construct this structure from the description of the protocol on a machine with a 3.0-GHz Intel Core Duo
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
459
processor and 2GB of memory. The EQPL formula in (11.24) is shown to be true in all runs of the protocol.
11.6.2 Quantum Coin-Flipping We have built a QMC model for the quantum coin-flipping protocol due to Bennett and Brassard (1984). Quantum coin-flipping enables two users, Alice and Bob, to establish a common random bit x through the transmission of a single qubit q and its measurement. The protocol relies on the principle that, if Alice and Bob use compatible bases for preparation and for measurement of this qubit, their bit values will be guaranteed to match by the laws of quantum mechanics. Incompatible bases will produce a matching bit value only with probability 12 , although in this case the protocol is repeated and the bit discarded. There are various possible attacks that may be performed by an enemy, which would enable him or her to compromise the final bit value. It is such attacks that we would like to investigate using the QMC tool on this and related quantum protocols. The basic property that needs to be checked at the end of the protocol is that the bit values of Alice and Bob do indeed match, and this is only true if the measurement basis bˆ chosen by Bob matches the preparation basis b of Alice. Also, if Alice’s and Bob’s bits and bases are in agreement, the protocol should not abort.
11.6.2.1 QMC Model of the Quantum Coin-Flipping Protocol We model the quantum coin-flipping protocol in QMC as a system of two processes Alice and Bob. A qubit is prepared by Alice by making a random choice among one of the four states: |0, |1, √12 (|0 + |1), √12 (|0 − |1). The preparation of these states involves the application of the H and X operators. The detailed steps of the protocol are as follows: (i) Alice selects b, x uniformly at random and sends ψb,x to Bob. (ii) Alice selects bit g uniformly at random and sends it to Bob. (iii) Bob selects b; he measures with respect to basis bˆ and obtains measurement result xˆ . (iv) Alice sends b, x to Bob. (v) If b = bˆ and x = xˆ , Bob aborts the protocol because Alice has cheated. If b = bˆ then the protocol is restarted. (vi) The final common bit is c = b ⊕ g, where ⊕ denotes the exclusive-OR binary operator. The QMC model of this protocol is shown in Figure 11.27.
11.6.2.2 Verifying the Quantum Coin-Flipping Protocol Upon successful completion, the quantum coin-flipping protocol must ensure that Alice’s and Bob’s bit values, x and xˆ , are equal. Thus a successful run of the
P1: SBT CUUS834-11
cuus834-gay
2
978 0 521 51374 6
October 31, 2009
16:40
program QuantumCoinFlipping; var AtoB, BtoA: channel of qubit; A2B, B2A: channel of bool;
4
6
8
10
12
14
16
18
process Alice; var x, b, g, result: bool; q: qubit; begin q := newqubit; /*Choose one of the four BB84 states and prepare qubit q*/ if :: true →x:=false; b:=false; :: true →x:=false; b:=true; had q; :: true →x:=true; b:=false; X q; :: true →x:=true; b:=true; X q; had q; fi AtoB!q; B2A?g; A2B!b; A2B!x; result := ((not (b and g)) and (b or g)); end;
20
22
24
26
28
30
32
34
36
38
40
42
44
46
process Bob; var g, x_hat, b_hat, x, b, result: bool; rq: qubit; abort: bool; /*Bob aborts the protocol*/ dontknow: bool; /*Bob cannot determine Alice’s honesty*/ begin AtoB?rq; if :: true →g:=false; B2A!g; :: true →g:=true; B2A!g; fi /*Select random measurement basis and measure*/ if :: true →b_hat:=false; :: true →b_hat:=true; had rq; fi x_hat:=meas rq; /*Receive original b and x*/ A2B?b; A2B?x; /*Compare bases and bits*/ if :: ((b=b_hat) and (not (x=x_hat))) →abort:=true; :: (not (b=b_hat)) →dontknow:=true; fi result := ((not (b and g)) and (b or g)); end; endprogram. Figure 11.27. A model of quantum coin-flipping
460
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
461
protocol will satisfy the formula: Alice.result = Bob.result
(11.25)
Note that the protocol doesn’t always succeed (as there is a possibility that ˆ in this case the protocol must Alice and Bob make different basis choices, b = b; be aborted and restarted later). However, if Alice and Bob make compatible basis choices, the protocol should not abort. This is expressed thus: AG (((b=b_hat) ∧ (x=x_hat)) =⇒ (abort = ⊥))
(11.26)
When the coin-flipping model is supplied to QMC, it builds a transition system of 4,742 states. The foregoing properties are satisfied as expected.
11.6.2.3 Breaking the Quantum Coin-Flipping Protocol The properties discussed previously are merely correctness properties; it is far more desirable to reason about the security of the protocol, and we are developing an extension of QMC that will be able to detect certain types of attack. This particular protocol can be systematically subverted by using the properties of entanglement. In particular, if Alice uses an entangled state, she can influence Bob’s measurement so that the final common bit is the one she chooses. (i) Suppose that Alice sends a qubit in an entangled state in step 1, e.g., of √1 (|01 − |10). 2 (ii) After she receives the value of g, she measures her half of the state with basis b = a ⊕ g. Let x be the outcome. (iii) She knows that Bob’s measurement will produce a totally anticorrelated value xˆ = 1 ⊕ x if he uses basis b. Thus Alice can influence the outcome of the protocol to have value a by sending Bob the values b and x ⊕ 1.
11.6.3 Quantum Key Distribution In this section we consider a model of a system consisting of the quantum key distribution protocol BB84 (Bennett and Brassard 1984). We discuss the protocol and explain the structure of a QMC model for this system. Then we turn to the verification of this model using the tool. Quantum key distribution enables two users, Alice and Bob, to establish a common cryptographic key that is secure in the presence of eavesdropping. The two users are assumed to be linked by a quantum channel (such as an optical fiber, through which qubits can be transmitted in the form of polarized light bursts), and they also can communicate over a public, authenticated, classical channel. The attacker has full access to the quantum channel, but can only monitor the classical channel passively. Quantum key distribution has been proven unconditionally secure against all attacks permitted by the laws of quantum mechanics (Mayers 2001), and implementations of this technology already exist,
P1: SBT CUUS834-11
cuus834-gay
462
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
in both academic (Bouwmeester et al. 2000) and commercial settings (see, e.g., http://www.idquantique.com). We consider a simplified version of the BB84 protocol for quantum key distribution here, omitting some classical postprocessing steps (esp. secret-key reconciliation and privacy amplification; see Nielsen and Chuang 2000 for details) that the users must perform after the quantum transmission is complete. A single round of the BB84 protocol consists of the following steps: (i) Alice prepares a new qubit in one of the four states: |0 , |1 , H |0 = √1 (|0 + |1), H |1 = √1 (|0 − |1). The first two form the so-called 2 2 rectilinear basis; the other two constitute the diagonal basis. Each of these states represents a classical bit with respect to the chosen basis (e.g., a 0 is represented by |0 in the rectilinear basis and by H |0 in the diagonal basis). She sends the qubit to Bob over the quantum channel and keeps record of her choice of basis and bit. (ii) Bob receives the qubit; not knowing which basis Alice used to prepare the state, he chooses one of the two bases and measures it. If his choice of measurement basis is compatible with Alice’s (i.e., if he has chosen the same basis that was used to prepare the state), then the laws of quantum mechanics guarantee that his measurement result will match Alice’s original bit; otherwise his measurement result will be either 0 or 1 with equal probability, and the state of the qubit will become one of the two states of the basis used for measurement. (iii) After Alice reveals to Bob which basis she used to prepare the qubit; if his choice of basis is correct, then both users keep the corresponding bit value and use it as part of the final key. Otherwise the corresponding bit is discarded by both users. The preceding steps must be repeated several times in order for a key to be established; a common key bit is generated every time Bob makes a compatible basis choice for his measurement. We model one round of the protocol here. A simple attempt to attack this protocol is the following: • The attacker, Eve, intercepts the qubit that Alice has sent (note that it is impossible to copy the qubit due to the no-cloning theorem of quantum mechanics; Wootters and Zurek 1982), chooses a measurement basis of her own, and measures the qubit to obtain a (possibly correct) bit value. She then sends the measured qubit to Bob. It is not difficult to see that an incorrect choice of measurement basis by Eve would disturb the qubit that Alice originally sent, placing it in a different basis state. It is possible for Alice and Bob to detect this disturbance by exchanging a few of their bits, but we will not include this step in our model. A QMCLang model of BB84 is shown in Figure 11.28. Notice how Alice uses the X and H gates to prepare the different qubit states in each case. Applying the H gate essentially transforms a rectilinear basis state into a diagonal basis state.
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
2
program BB84; var q: qubit; ch: channel of qubit;
4
6
8
10
12
14
16
18
20
22
24
26
process Alice; var bit,basis:integer; begin q := newqubit; if :: basis:=0; bit:=0; :: basis:=0; bit:=1; X q; :: basis:=1; bit:=0; had q; :: basis:=1; bit:=1; X q; had q; fi ch!q; end; process Bob; var bbit,bbasis:integer; begin ch?q; if :: bbasis:=0; :: bbasis:=1; had q; fi bbit := meas q; end;
28
30
32
34
36
38
40
process Eve; var ebit,ebasis:integer; begin ch?q; if :: ebasis:=0; :: ebasis:=1; had q; fi bbit := meas q; ch!q; end; endprogram. Figure 11.28. A model of BB84
463
P1: SBT CUUS834-11
cuus834-gay
464
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
The processes describing the actions of Eve and Bob are similar to each other, as both involve a basis choice and a measurement.
11.6.3.1 Properties for Verification The model of a quantum key distribution system is quite realistic, given that we are taking into account the possibility of a direct attack on the protocol. A larger system for quantum key distribution might also involve quantum teleportation, so that a qubit is transferred not via a direct quantum channel but through the use of entangled quantum states. We discussed the quantum teleportation protocol in Section 11.2.2 separately. A number of combinatorial possibilities arise during quantum key distribution. Depending on the choices of basis made by Alice, Bob, and Eve, it may or may not be possible to detect Eve’s presence. For instance, a compatible choice of basis by all three users implies that Eve’s measurement of the transmitted qubit does not cause a disturbance to its state. There will be cases when the outcome of Bob’s measurement matches the choice of bit originally made by Alice, cases in which Eve’s measurement is correct, and so on. QMC explores all possibilities automatically and constructs the correct tree structure for the model described. We can verify different QCTL formulae expressing success or failure of the protocol. For instance, the BB84 protocol normally succeeds in producing a key bit if Alice and Bob use compatible basis choices, i.e., when the following state formula is satisfied (bbasis and bbit are the variables corresponding to Bob’s chosen basis and bit value): ((basis=bbasis) =⇒ (bit=bbit)) In the full BB84 protocol, Alice and Bob compare some of the bits for which they used compatible basis choices; if any of these bits do not agree, then Eve has been detected. By using enough rounds of the protocol, and comparing enough bits, the probability of an undetected attack can be made arbitrarily small. We have not modeled this aspect of the protocol.
11.6.4 A Quantum Error Correcting Network Data networks implemented using quantum protocols are likely to be a practical setting for secure communication in the future. Such systems are easily expressible in QMCLang, and these are ideal targets for verification with QMC. In this section we consider an example of a system consisting of a number of users in a network; the network is modeled by a set of channels between the users, and we assume that these channels are binary symmetric, so that with specified probability p (for our purposes we assume p = 12 ), the channels in the network will corrupt the bits, and with probability 1 − p they will transmit the bits without error. The users perform quantum error correction to recover the correct bits in this system.
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
2
4
6
8
465
process Network; var q : qubit; begin do :: ch_alice_net?q; X q; ch_bob_net!q; :: ch_alice_net?q; ch_bob_net!q; od end; Figure 11.29. A model of a noisy channel
2
4
6
8
10
12
14
process Source; var q : qubit; begin q := newqubit; if :: Z q; // 20> :: X q; // 21> :: had q; // 1/sqrt2 (20> + :: {X q; had q;} // 1/sqrt2 (20> :: {had q; ph q;} // 1/sqrt2 (20> + :: {X q; had q; ph q;} // 1/sqrt2 (20> fi ch_source!q; end;
21>) 21>) i21>) - i21>)
Figure 11.30. A model of a qubit source
We begin by considering how to model a (quantum) binary symmetric channel (with p = 12 , where we use a nondeterministic choice between two options to model equiprobable events). The model is shown in Figure 11.29. We call the process Network as it represents the communication network between users. Specifically there will be two users, Alice and Bob, each with a QMC channel connected to the network. The network repeatedly receives and then resends qubits and may apply a bit-flip (X) operation on the way. In the complete model, a source (shown in Figure 11.30) prepares a qubit in any one of the six possible states permitted in the stabilizer formalism and passes it to Alice, who encodes it into a 3-qubit state as described later. Alice sends the three bits through the network, where they are independently either transmitted faithfully or bit-flipped. Bob receives the qubits and performs error correction using the quantum error-correcting code described by Steane (2000) (the quantum bit-flip code). The code requires each individual qubit prepared by Alice to be redundantly encoded into a 3-qubit system, so that the state |0 is transmitted as |000, and |1 is transmitted as |111 . We assume that the quantum channel may induce a bit-flip error on any one of the three qubits that are used in this code; for instance, the
P1: SBT CUUS834-11
cuus834-gay
466
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou ψ
•
•
•
0
ψ
• •
0
Xi •
0
•
0
•
Figure 11.31. Quantum circuit diagram for the qubit bit-flip code
channel might transform the state 1 √ (|000 + |111) into 2
1 √ (|010 + |101). 2
In this case, the second qubit has been disturbed by the channel. In order to detect such an error, two additional qubits are used; they are known as ancillas. By applying a sequence of operations and measurements to the ancillas, the so-called error syndrome is obtained, which determines the location of the error. Then, the X operator is applied to the erroneous qubit, thus restoring the initial quantum state of the 3-qubit system (i.e., √12 (|000 + |111) in the preceding example). The quantum circuit for the bit-flip code is given in Figure 11.31. In order to account for the error correction in the model of the protocol we have been describing, we need to introduce: (1) two qubits q1 and q2 that are used to encode the original state as a 3-qubit state, and (2) two qubits q3 and q4 corresponding to the ancillas that are used to detect the location of the error in the 3-qubit state. The QMC process for Alice needs to include the additional commands cnot q q1; cnot q q2; just before the transmission ch!q, thus encoding the state of qubit q across the three qubits. The complete model is shown in Figure 11.32. Remark. A sequence of statements enclosed in braces (“{” and “}”) is treated by QMC as a single execution step. In other words, braces enrich QMCLang with what is known as an atomic construct.
11.6.5 Property for Verification The correctness property for the quantum error-correction network is formulated as: history Alice.saved == Bob.q
(11.27)
Note the use of a history variable; we are specifying here that the state of the original qubit (which Alice “saves” using the savequbit keyword prior to encoding) must be the one Bob receives at the end of the exchange. QMC shows that the model of the quantum error-correcting network does indeed satisfy this property.
P1: SBT CUUS834-11
cuus834-gay
2
4
978 0 521 51374 6
October 31, 2009
program QECC; var ch_source, ch_alice_net, ch_bob_net : channel of qubit; process Source; // include Source here
6
8
10
12
14
16
18
20
process Network; // include Network here process Alice; var q, q1, q2, saved: qubit; begin ch_source?q; // input qubit 0 saved := savequbit q; { q1:= newqubit; // prepare qubit 1 q2:= newqubit; } // prepare qubit 2 { cnot q q1; cnot q q2; } ch_alice_net!q; ch_alice_net!q1; ch_alice_net!q2; end;
22
24
26
28
30
32
34
36
38
40
42
44
16:40
process Bob; var q, q1, q2, q3, q4 : qubit; a, b: integer; begin ch_bob_net?q; ch_bob_net?q1; ch_bob_net?q2; q3:= newqubit; // ancilla 1 q4:= newqubit; // ancilla 2 cnot q q3; cnot q1 q3; cnot q q4; cnot q2 q4; a:=meas q3; b:=meas q4; if :: ((a=1) and (b=1)); X q; :: ((a=1) and (b=0)); X q1; :: ((a=0) and (b=1)); X q2; :: ((a=0) and (b=0)); fi {cnot q q1; cnot q q2;} end;
46
endprogram. Figure 11.32. A model of an error-correcting network
467
P1: SBT CUUS834-11
cuus834-gay
468
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
11.7 Summary and Conclusions We have described QMC, which as far as we know is the first automated verification tool targeted specifically at protocols for quantum communication. We presented examples of the tool’s use based on quantum teleportation, quantum coin-flipping, and a system combining quantum key distribution and quantum error correction, illustrating the use of the logic EQPL to specify correctness. Although the teleportation example is simple, it is an important building block for practical long-distance quantum communication and cryptographic systems. In contrast to pen-and-paper proofs of correctness of teleportation, our verification explicitly models the protocol as a distributed system and could be extended to a larger system within the same framework. The other examples are more substantial. QMC is restricted to modeling quantum operations within the stabilizer formalism. Although this set of operations is not universal for quantum computation, it supports many interesting protocols, including some that make use of highly entangled states. Importantly for automated analysis, stabilizer operations can be efficiently simulated on a classical computer. We would like to extend QMC to handle more general quantum states, for example by using techniques suggested by Aaronson and Gottesman (2004) when only a limited number of nonstabilizer operations occur in the system. It will also be important to investigate improved techniques for evaluating EQPL formulae, using generic SAT solvers or other heuristics. The examples that we have presented here do not use the full power of the logic EQPL and its temporal extension. In most cases we have only checked properties of the final state, and those properties are either classical formulae over classical variables or simple equality tests between qubits. Remember, however, that the equality test between qubits (used in the teleportation and error-correction examples) implicitly makes use of an EQPL entanglement formula. Of course we will have to carry out many more case studies in order to evaluate which features of the logic are the most important. But one conclusion that we can already draw is that interesting analysis is possible within the fragment of EQPL that can be efficiently checked; none of our examples require calculating the explicit basisvector representation of a quantum state in order to evaluate a quantum formula. Our long-term objective is to build a model checker that would be able to model and analyze any protocol with quantum and classical components. However, it is worth noting that, in contrast to classical systems, the protocols that are currently in prevalence in the quantum setting are few in number. We envisage that our tool, at least in the near term, would be used to analyze existing protocols and systems based on them. This means we can focus on developing techniques to handle these existing protocols, and we feel that the NP-completeness of the modelchecking procedure is not a major obstacle at this point. For the same reason, working within the stabilizer formalism is also not a significant limitation, as we propose to extend our techniques to verify nearly all protocols of current interest. For example, we should be able to model-check protocols that fall outside the
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
469
stabilizer formalism efficiently, as long as the number of non-Clifford gates used in the particular protocol is small and they are applied to only a limited number of qubits (Aaronson and Gottesman 2004). Complementary directions for future work include adding new analysis modes to the system. For example, many quantum protocols and algorithms are probabilistic, so it would be useful to be able to calculate the probability of success of a system. This would require extending EQPL and the temporal logic QCTL with probabilities, along the lines of probabilistic logics such as PCTL. QMC currently supports models of systems that include asynchronous communication channels. In order to model a wide range of real communication systems, it is desirable to allow for noisy channels in system descriptions, for both classical and quantum data. We intend to incorporate this capability in QMC in the near future. We will also develop a graphical user interface for the tool, providing access to the internals of system models and visualizations of runs. In later work, we plan to use a more expressive modeling language with QMC, such as the quantum process calculus CQP (Gay and Nagarajan 2005). Computing the probability that a formula is satisfied, for all runs of a protocol, is a feature to be added. It will be useful to experiment with models of larger systems, combining many subprotocols with both classical and quantum data. We also plan to develop metrics to characterize the performance of our tool on various case studies. We hope that QMC will develop into a useful tool for designers of quantum communication systems.
Acknowledgments Simon Gay was partially supported by EPSRC grants EP/E00623X/1 (Semantics of Quantum Computation) and EP/F004184/1 (Quantum Computation: Foundations, Security, Cryptography and Group Theory) and, during a visit to Lisbon, the Security and Quantum Information Group (SQIG), Instituto de Telecomunicac¸o˜ es, Lisbon. Rajagopal Nagarajan and Nikolaos Papanikolaou were partially supported by the EU Sixth Framework Programme (Project SecoQC: Development of a Global Network for Secure Communication based on Quantum Cryptography) and EPSRC grant EP/E00623X/1 (Semantics of Quantum Computation). During a visit to SQIG, Rajagopal Nagarajan was partially supported by FCT project QSec and EU FEDER PTDC/EIA/67661/2006. We would like to thank Paulo Mateus and Pedro Baltazar (SQIG) for valuable discussions of the syntax and semantics of the logics EQPL and QCTL.
Bibliography Aaronson, S. (2004) The complexity zoo. http://qwiki.caltech.edu/wiki/Complexity_Zoo. Aaronson, S., and Gottesman, D. (2004) Improved simulation of stabilizer circuits. Physical Review A 70:52328.
P1: SBT CUUS834-11
cuus834-gay
470
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
Abramsky, S. (2004) High-level methods for quantum computation and information. In Proceedings of the 19th Annual IEEE Symposium on Logic in Computer Science (LICS). IEEE Computer Society. Abramsky, S., and Coecke, B. (2003) Physical traces: Quantum vs. classical information processing. Electronic Notes in Theoretical Computer Science 69:1–22. Also arXiv:cs/0207057v2 [cs.CG]. Abramsky, S., and Coecke, B. (2004) A categorical semantics of quantum protocols. In Proceedings of the 19th Annual IEEE Symposium on Logic in Computer Science (LICS). IEEE Computer Society. Also arXiv:quant-ph/0402130v5. Abramsky, S., and Coecke, B. (2005) Abstract physical traces. Theory and Applications of Categories 14(6):111–124. Audenaert, K. M. R., and Plenio, M. B. (2005) Entanglement on mixed stabiliser states: Normal forms and reduction procedures. New Journal of Physics 7:170. Bacon, D. (2006) Stabilizer quantum error correcting codes. Lecture Notes for course CSE 599d (Quantum Computing), University of Washington. Baltazar, P., Chadha, R., and Mateus, P. (2008) Quantum computation tree logic – model checking and complete calculus. International Journal of Quantum Information 6(2):219–236. Bennett, C. H., and Brassard, G. (1984) Quantum cryptography: Public key distribution and coin tossing. In Proceedings of International Conference on Computers, Systems and Signal Processing. Bennett, C. H., Brassard, G., Cr´epeau, C., Jozsa, R., Peres, A., and Wootters, W. K. (1993) Teleporting an unknown quantum state via dual classical and Einstein-Podolsky-Rosen channels. Physical Review Letters 70:1895–1899. B´erard, B., Bidoit, M., Finkel, A., Laroussinie, F., Petit, A., Petrucci, L., Schnoebelen, P., and McKenzie, P. (1999) Systems and Software Verification: Model-Checking Techniques and Tools. Springer. Bouwmeester, D., Ekert, A., and Zeilinger, A., editors (2000) The Physics of Quantum Information. Springer. Cardelli, L. (2004) Type systems. In CRC Handbook of Computer Science and Engineering, chapter 97. CRC Press, second edition. Cleaveland, R., Parrow, J., and Steffen, B. (1993) The concurrency workbench: A semanticsbased tool for the verification of finite-state systems. Coecke, B. (2004a) The logic of entanglement. arXiv:quant-ph/0402014v2. Coecke, B. (2004b) Quantum information-flow, concretely, abstractly. In Selinger, P., editor, Proceedings of the 2nd International Workshop on Quantum Programming Languages. Turku Centre for Computer Science. Danos, V., and D’Hondt, E. (2008) Classical knowledge for quantum cryptographic reasoning. Electronic Notes in Theoretical Computer Science 192(3):39–58. D’Hondt, E., and Panangaden, P. (2005) Reasoning about quantum knowledge. In Ramanujam, R., and Sen, S., editors, Proceedings of the 25th Conference on Foundations of Software Technology and Theoretical Computer Science, volume 3821 of Lecture Notes in Computer Science, pages 553–564. Springer. Dijkstra, E. W. (1976) A Discipline of Programming. Prentice-Hall. Ekert, A. (1991) Quantum cryptography based on Bell’s theorem. Physical Review Letters 67(6):661–663. Emerson, E. A. (1990) Temporal and modal logic. In Handbook of Theoretical Computer Science Volume B: Formal Models and Semantics, pages 995–1072. MIT Press. Gagnon, E. (1998) SableCC, An Object–Oriented Compiler Framework. Master’s thesis, School of Computer Science, McGill University, Montr´eal. Gansner, E. R., and North, S. C. (2000) An open graph visualization system and its applications to software engineering. Software Practice and Experience 30(11):1203–1233. Gay, S. J. (2006) Quantum programming languages: survey and bibliography. Mathematical Structures in Computer Science 16(4):581–600.
P1: SBT CUUS834-11
cuus834-gay
978 0 521 51374 6
October 31, 2009
16:40
11 Specification and Verification of Quantum Protocols
471
Gay, S. J., and Nagarajan, R. (2005) Communicating quantum processes. In Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 145–157. ACM Press. Gay, S. J., Nagarajan, R., and Papanikolaou, N. (2005) Probabilistic model-checking of quantum protocols. arXiv:quant-ph/0504007v2. Gay, S. J., Nagarajan, R., and Papanikolaou, N. (2008) QMC: A model checker for quantum systems. In Proceedings of the 20th International Conference on Computer Aided Verification, volume 5123 of Lecture Notes in Computer Science, pages 543–547. Springer. Gottesman, D. (1999) The Heisenberg representation of quantum computers. In Corney, S. P., Delbourgo, R. and Jarvis, P. D., editors, Group22: Proceedings of the XXII International Colloquium on Group Theoretical Methods in Physics. International Press. Gottesman, D. (2002) An introduction to quantum error correction. In Lomonaco, Jr., S. J., editor, Quantum Computation: A Grand Mathematical Challenge for the Twenty-First Century and the Millennium. American Mathematical Society. Hoare, C. A. R. (1985) Communicating Sequential Processes. Prentice-Hall. Holzmann, G. (1991) The Design and Validation of Computer Protocols. Prentice-Hall. Holzmann, G. (2003) The SPIN Model Checker: Primer and Reference Manual. Pearson Education. Huth, M. R. A., and Ryan, M. D. (2004) Logic in Computer Science: Modeling and Reasoning about Systems. Cambridge University Press, second edition. Jorrand, P., and Lalire, M. (2004) Toward a quantum process algebra. In Proceedings of the 1st ACM Conference on Computing Frontiers. ACM Press. Also arXiv:quant-ph/0312067v1. Jorrand, P., and Lalire, M. (2005) From quantum physics to programming languages: A process algebraic approach. In Unconventional Programming Paradigms: Revised Selected and Invited Papers from the International Workshop UPP 2004, volume 3566 of Lecture Notes in Computer Science. Springer. Kwiatkowska, M., Norman, G., and Parker, D. (2004) Probabilistic symbolic model checking with PRISM: a hybrid approach. International Journal on Software Tools for Technology Transfer (STTT) 6(2):128–142. Mateus, P., and Sernadas, A. (2004a) Exogenous quantum logic. In Carnielli, W. A., Dion´ısio, F. M., and Mateus, P., editors, Proceedings of CombLog’04 – Workshop on Combination of Logics: Theory and Applications, pages 141–150. IST Press, Lisbon. Mateus, P., and Sernadas, A. (2004b) Reasoning about quantum systems. In Proceedings of Ninth European Conference on Logics in Artificial Intelligence, pages 239–251. Springer. Mateus, P., and Sernadas, A. (2006) Weakly complete axiomatization of exogenous quantum propositional logic. Information and Computation 204(5):771–794. Mayers, D. (2001) Unconditional security in quantum cryptography. Journal of the ACM 48(3):351–406. Milner, R. (1989) Communication and Concurrency. Prentice-Hall. Nielsen, M. A., and Chuang, I. L. (2000) Quantum Computation and Quantum Information. Cambridge University Press. ¨ Omer, B. (1998) A Procedural Formalism for Quantum Computing. Master’s thesis, Department of Theoretical Physics, University of Vienna. ¨ Omer, B. (2000) Quantum Programming in QCL. Master’s thesis, Institute of Information Systems, Technical University of Vienna. Papanikolaou, N. (2005a) Reasoning formally about quantum systems: an overview. ACM SIGACT News 36(3):51–66. Papanikolaou, N. (2005b) Techniques for Design and Validation of Quantum Protocols. Master’s thesis, Department of Computer Science, University of Warwick. Also available as Research Report CS-RT-413. Perdrix, S. (2008) Quantum entanglement analysis based on abstract interpretation. In Proceedings of the 15th International Static Analysis Symposium, volume 5079 of Lecture Notes in Computer Science, pages 270–282. Springer. Also arXiv:0801.4230v1 [cs.LO].
P1: SBT CUUS834-11
cuus834-gay
472
978 0 521 51374 6
October 31, 2009
16:40
Simon J. Gay, Rajagopal Nagarajan, and Nikolaos Papanikolaou
Pietriga, E. (2005) A toolkit for addressing HCI issues in visual language environments. In Proceedings of the IEEE Symposium on Visual Languages and Human-Centric Computing, pages 145–152. IEEE Computer Society. Prost, F., and Zerrari, C. (2008) A logical analysis of entanglement and separability in quantum higher-order functions. arXiv:0801.0649v1 [cs.LO]. Ryan, P., Schneider, S., Goldsmith, M., Lowe, G., and Roscoe, B. (2001) Modelling and Analysis of Security Protocols. Pearson Education. Sadrzadeh, M. (2006) Actions and Resources in Epistemic Logic. Ph.D. thesis, Universit´e du Qu´ebec, Montr´eal, Canada. Sanders, J., and Zuliani, P. (2000) Quantum programming. In Mathematics of Program Construction, pages 80–99. Volume 1837 of Lecture Notes in Computer Science. Springer. Selinger, P. (2004) Towards a quantum programming language. Mathematical Structures in Computer Science 14(4):527–586. Steane, A. M. (2000) Quantum computing and error correction. In Gonis, A., and Turchi, P., editors, Proceedings of the NATO Advanced Research Workshop, pages 284–298. IOS Press. Sun Microsystems, Inc. (2006) Java platform standard edition 6 sdk. http://java.sun.com/javase/6/docs/. van Tonder, A. (2004) A lambda calculus for quantum computation. SIAM Journal on Computing 33(5):1109–1135. Also arXiv:quant-ph/0307150v5. Wirth, N. (1971) The programming language Pascal. Acta Informatica 1:35–63. Wootters, W. K., and Zurek, W. H. (1982) A single quantum cannot be cloned. Nature 299:802– 803.
P1: SBT cuus834-ind
cuus834-gay
978 0 521 51374 6
October 30, 2009 18:0
Index
J -decomposition, 250 x-rotation, 263 z-rotation, 264 dEQPL, 390 2-colorable underlying graph, 252 Aaronson-Gottesman algorithm, 441 abstract domain, 228 abstract interpretation, 207 abstract semantics, 208 denotational, 229 soundness, 209 abstraction function, 223 adequacy, 217 adjoint functor theorem, 384 Audenaert-Plenio algorithm, 450 auxiliary qubits, 173 axioms of PdEQPL, 394 basis structure, 30 BB84 quantum coin-flipping protocol, 459 quantum key distribution protocol, 415, 416, 461 Bell pair, 237 Bell state, 2, 15–17, 32, 75 Bell’s experiment, 138 Bell’s theorem, 16 bicategory, 33, 35, 45 cartesian bicategory of relations, 46 dagger cartesian bicategory of relations, 46, 47 bipartite normal form, 450, 451 bit flip, 329 Boolean lattice, 361 box, 111
bra-vector, 211 broadcasting, 67 call-by-value reduction, 153 cartesian closed category, 72 categorical logic, see logic, categorical quantum mechanics, 1, 6–18, 29 category ∗-autonomous, 5, 8, 26, 72 cartesian closed, 2–5, 24 compact, see category, compact closed compact closed, 9–12, 14, 19, 24, 26, 31, 33, 376 dagger, 11, 247 dagger compact, 11, 12, 20, 26, 33 dagger symmetric monoidal, 11, 12, 31 indexed, 29, 61 inverse, 370 Kleisli, 29, 51–53, 57 monoidal, 6, 7, 18 monoidal closed, 376 of circuits, 94 of commutative monoids, 99 of finite-dimensional vector spaces, 9 of generalized proof-nets, 122 of matrices, 100 of relations, 7, 9 symmetric monoidal, 7–9, 11–13, 18, 21, 31 total, 29, 61 traced monoidal, 87 Cauchy sequence, 315 causal flow, 283 circuit model, 236 classical interface, 30, 56, 60 classical structure, 30, 33–41, 45, 46, 48, 50, 53, 57
473
P1: SBT cuus834-ind
cuus834-gay
978 0 521 51374 6
474
Index
Clifford group, 419, 444 normal form, 450 operator, 419 Clifford group, 238 cloning, 154 axiomatization, 18 uniform, 19, 25, 26 cloning collapse theorem, 19, 25 CNOT, 265 combinatory logic, 376 communicating quantum processes, see CQP comonad, 165 compact closed category, 84 compact closure, 9 compact structure, 32 compact symmetric polycategory, 72, 91 comparison formulae, 391 complete lattice, 335 computation as patterns, 238 computational depth complexity, 260 coname, 10, 14, 17, 86 partial, 86 concrete semantics, 209 controlled mixed quantum evolution, 60 mixed quantum state, 60 operation, 57 pure quantum evolution, 57 pure quantum measurement, 57 pure quantum state, 57 convex closure, 54 convex combination, see mixture convex combining, see mixing convolution monoid, 42 copoint, 86 correcting set, 286 correction commands, 240 counit, 9, 12, 14, 85 CQP (communicating quantum processes), 416, 469 cryptographic protocols, 206 CTL, computational tree logic, 397 Curry-Howard correspondence, 72 currying, 86, 176 cut-elimination, 71, 106 dagger category, see category, dagger De Morgan law, 335 deleting uniform, 26, 34 denotational model, 71
October 30, 2009 18:0
determinism, 247 Deutsch’s algorithm, 189 Deutsch’s problem, xi Deutsch-Jozsa algorithm, 137, 145 diagonal morphism, 7, 19, 20, 24, 25 diagrammatic calculus, see graphical calculus dimension, 33, 89 Dirac notation, 13 direct decomposition, 280 directed complete partial order (DCPO), 214 domain of signal, 240 domain theory, 213 dualizing object, 5 enrichment over commutative monoids, 99 entangled functions, 135 entanglement, 2, 15, 21, 25, 226, 236 quantum information theory, 227 entanglement analysis, 225 entanglement commands, 240 EPR paradox, 225 EPR state, 15 EQPL (exogenous quantum propositional logic) complexity of model checking, 450 extensions, 455 semantics, 435 syntax, 435 verification algorithms, 447 error states, 150 exogenous logic, 390 exponential, 141 finite-dimensional Hilbert space, 73 flow causal, 291 generalized, 286 graphical interpretation, 286 maximally delayed, 289 optimal, 289 formal methods, 389 formal specification quantum coin-flipping, see quantum coin-flipping protocol, model checking quantum error correction, see quantum error-correction protocol, model checking quantum key distribution, see quantum key distribution protocol, model checking quantum teleportation, see quantum teleportation protocol, model checking formal verification quantum coin-flipping, see quantum coin-flipping protocol, model checking
P1: SBT cuus834-ind
cuus834-gay
978 0 521 51374 6
October 30, 2009 18:0
Index quantum error correction, see quantum error-correction protocol, model checking quantum key distribution, see quantum key distribution protocol, model checking quantum teleportation, see quantum teleportation protocol, model checking free category, 72 free compact closed category, 89 Frobenius algebra, 34, 49 commutative, 34, 51 special, 34 special commutative, 33, 34 special dagger, 30 condition, 34, 35 dagger structure, 25 functor monoidal, 18 generalized flow algorithm, 291 generalized proof-nets, 108 geometry of interaction, 378 GHZ, 266 Gottesman-Knill theorem, 419 graphical calculus, 16, 20, 31, 33, 35 Grothendieck construction, 29, 61 Hadamard operator, 242, 249 Hadamard transformation, 184 Haskell, 135, 173 Hermitian operators quantum predicates, 324 hierarchy of quantum semantics, 224 Hilbert space, 315, 361 lattice of projectors, 363 subspace, 337 incompatible observables, 36 induction rules, 357 influencing walks, 297 Pauli, 299 interval analysis, 209 iniverse category, 369 involution, 90 Joyal’s lemma, 4, 5, 24 Jozsa conjecture, 297 ket-vector, 211 Kleisli adjunction, 52 Kleisli category, see category, Kleisli, 164 Knaster-Tarski fixed point theorem, 349
475
Kraus decomposition, 246 Kraus representation theorem, 221 Kripke structure, 398 L¨owner partial order, 316 lambda calculus, 71, 135 linear, 72 quantum, 139 lazy evaluation, 175 limits of quantum computation, 236 Lindenbaum-Tarski algebras, 361 linear exponential comonad, 165 linear logic, 141, 151 LISP, 135 logic categorical, 2 category-theoretic, 375 classical, 4 epistemic, 417 exogenous, 390 exogenous quantum propositional, see EQPL intuitionistic, 3–5, 71 intuitionistic multiplicative linear, 72 linear, 71, 379 multiplicative linear, 5, 9 quantum computation tree, see QCTL temporal, 397, 414 loop, 90, 103 majorization, 50 MBQC denotational semantics, 245 operational semantics, 244 semantics, 243 syntax, 240 universality, 249 versus circuit, 296 measurement, 236 measurement-based quantum computation, see MBQC measurement calculus, 253 confluence, 257 extended, 292 termination, 255 measurement pattern, 240, 241 mixed state, 38, 77 mixing, 54 mixture, 54 ML, 135 model checking, 411, 414–416 modularity, 214 moinoidal tensor, 376 monads, 178 monoidal category, 82, 161
P1: SBT cuus834-ind
cuus834-gay
978 0 521 51374 6
476 monoidal comonad (symmetric), 165 monoids, 178 monotonic, 214 morphism classical, 37 completely positive, 38 decoherent, 40 doubly stochastic, 50 positive, 37 real, 41 stochastic, 50 name, 10, 14, 17, 86 partial, 86 natural deduction, 71 natural transformation monoidal, 18, 19, 26 Newman’s lemma, 260 no-broadcasting theorem, 1 no-cloning theorem, 1, 19, 34 no-cloning theorem, 141 no-deleting theorem, 1, 26, 34 no-go theorem, 2, 25 NP-completeness, 449, 468 one-way model, 237 open graph extended, 293 labelled, 276 operational semantics, 146 QMCLang, see QMCLang, semantics orthomodular lattice, 361, 363 orthomodular lattices, 335 orthomodular law, 335 orthonormal basis, 270 parity analysis, 208 partial isometry, 362, 365 category, 369 physical, 366 partial order, 366 path extreme, 252 pattern circuits, 300 computation space, 242 stepwise deterministic, 248 synthesis, 281 tensor, 243 type, 242 patterns, see measurement patterns Pauli group, 418, 443 measurements, 295
October 30, 2009 18:0
Index model, 268 operator, 78, 238, 418, 441, 443 spin matrices, 249 permutation, 49 phase flip, 329 phase map decomposition, 239 phase model, 267 picture calculus, see graphical calculus point, 86 polycategorical, 247 polycategory, 72 polymorphic functions, 175 predicate transformers projective, 337 preorder, 213 PRISM model checker, 416 projection-based quantum computing, 275 projective weakest preconditions, 341 proof-net, 77 proof-nets local confluence, 118 subject reduction, 117 termination of reduction, 118 proof-slice, 109 pure quantum evolution, 55 pure quantum measurement, 56 pure quantum state, 55, 77 purely functional approach, 174 QCTL (quantum computation tree logic), 397 complexity of model checking, 455 interpretation over QMC models, 438 semantics, 437 syntax, 437 verification algorithms, 452 QIL, 212 program, 212 QIO monad, 183 QMC (quantum model checker), 416, 439 case studies, 456–466 complexity, 445 graphical user interface, 439 interpreter, 441 model-checking algorithms, 446 modeling language, see QMCLang parser, 440 scheduler, 441 simulation algorithm, 441 QMCLang semantics, 423 syntax, 423 type system, 432 quantum categorical semantics, 31 quantum cellular automata, 236
P1: SBT cuus834-ind
cuus834-gay
978 0 521 51374 6
October 30, 2009 18:0
Index quantum closure, 147 quantum coin-flipping protocol model checking, 459 quantum commands, 348 quantum error-correction model checking, 464 quantum Fourier transform, 157, 196 quantum imperative language, see QIL quantum information flow, 15–17 quantum information processing, 206 quantum IO monad, 173 quantum key distribution protocol model checking, 461 quantum Kripke structure, 399 quantum lambda calculus, 139 quantum logic, 70, 361 quantum measurements, 320 quantum mechanics, xi quantum parallelism, 185 quantum programming language, xii, 212 quantum programming languages, 311 quantum state entangled, 75 quantum state transformers, 314 quantum states, 314 quantum system (in categorical quantum mechanics), 33, 75 quantum teleportation, 190 quantum teleportation protocol, 77 description, 16, 420 in categorical quantum mechanics, 17, 57, 58 model checking, 456 quantum Turing machines, 236 quantum walk, 393 quantum weakest preconditions, 324, 325 commutativity, 328 reachability relation, 151 relation, 43 reversible arithmetic, 192 reversible let, 173 rotation general, 265 Sasaki hook, 364 SAT problem, 395 scalar, 7, 13, 88 scheme, 135 semantics abstract, 228 admissible, 221, 223 constructive, 173
477
hierarchy, 213 observable, 218 predicate transformer, 312 probabilistic, 214 pure, 216 semantics of dEQPL, 392 semiadditive category, 100 semiadditive functor, 100 shift operator, 367 Shor’s algorithm, 194 signal shifting, 245, 259 specification formal, see formal specification spectral decomposition, 317 spider, 35 stabilizer formalism, 416, 417, 468 Aaronson-Gottesman simulation algorithm, 441 complexity, 445 efficient simulation, 419 entanglement, 450 group, 418 standardization, 238, 255 state transfer, 273 state-transfer approach, 238 stochastic state, 54 strength (of endofunctor), 51 strict compact closed category, 85 strict monoidal category, 84 strictness, 214 strong normalization of proof-nets, 82 subject reduction, 152 substitution, 151 subtype, 142 subtyping relation, 142 superoperators, 320 symmetric monoidal category, 83 syntax of dEQPL, 391 teleportation, 206, 263, 269 abstract semantics, 230 teleportation algorithm, 145 teleportation procedure, 137 teleportation protocol, 237 teleportation technique, 238 temporal logic, 397 tensor product of Hilbert spaces, 15 structure in a category, 6, 7 tensor-sum logic, 103 syntax, 103 tensor-sum proof-nets, 108 topological space, 214
P1: SBT cuus834-ind
cuus834-gay
978 0 521 51374 6
478 trace in a compact closed category, 87 in a symmetric monoidal category, 12 of a linear map, 12 transpose endofunctor, 33 Turing machine, 135 type inference, 155 type isomorphism, 154 type safety, 152 type theory, 173 type classes, 175 typing context, 143 typing judgment, 143
October 30, 2009 18:0
Index uncurrying, 86 uniformity of data, 153 unit, 6, 7, 9, 12, 14, 85 unitary embedding, 247 unitary transformations, 319 universal quantum computing, 237 universality, 251 approximate, 251 verification formal, see formal verification zero object, 95