P1: SBT cuus834-fm
cuus834-gay
978 0 521 51374 6
October 24, 2009 13:39
This page intentionally left blank
ii
P1...
44 downloads
1347 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 , 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 >=) :: 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 λ }−∞ 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( λ 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 :: 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