ZX-calculus
{{Short description|Graphical language for quantum processes}}
The ZX-calculus is a rigorous graphical language for reasoning about linear maps between qubits, which are represented as string diagrams called ZX-diagrams. A ZX-diagram consists of a set of generators called spiders that represent specific tensors. These are connected together to form a tensor network similar to Penrose graphical notation. Due to the symmetries of the spiders and the properties of the underlying category, topologically deforming a ZX-diagram (i.e. moving the generators without changing their connections) does not affect the linear map it represents. In addition to the equalities between ZX-diagrams that are generated by topological deformations, the calculus also has a set of graphical rewrite rules for transforming diagrams into one another. The ZX-calculus is universal in the sense that any linear map between qubits can be represented as a diagram, and different sets of graphical rewrite rules are complete for different families of linear maps. ZX-diagrams can be seen as a generalisation of quantum circuit notation, and they form a strict subset of [https://arxiv.org/abs/2011.12127 tensor networks] which represent general fusion categories and wavefunctions of quantum spin systems.
History
The ZX-calculus was first introduced by Bob Coecke and Ross Duncan in 2008 as an extension of the categorical quantum mechanics school of reasoning. They introduced the fundamental concepts of spiders, strong complementarity and most of the standard rewrite rules.{{Citation|last1=Coecke|first1=Bob|chapter=Interacting Quantum Observables|pages=298–310|publisher=Springer Berlin Heidelberg|isbn=9783540705826|last2=Duncan|first2=Ross|doi=10.1007/978-3-540-70583-3_25|title=Automata, Languages and Programming|volume=5126|series=Lecture Notes in Computer Science|year=2008|citeseerx=10.1.1.381.2573}}{{Cite journal|last1=Coecke|first1=Bob|last2=Duncan|first2=Ross|date=2011-04-14|title=Interacting quantum observables: categorical algebra and diagrammatics|journal=New Journal of Physics|volume=13|issue=4|pages=043016|doi=10.1088/1367-2630/13/4/043016|issn=1367-2630|arxiv=0906.4725|bibcode=2011NJPh...13d3016C|s2cid=14259278}}
In 2009 Duncan and Perdrix found the additional Euler decomposition rule for the Hadamard gate,{{Cite book|last1=Duncan|first1=Ross|last2=Perdrix|first2=Simon|chapter=Graph States and the Necessity of Euler Decomposition|date=2009|title=Mathematical Theory and Computational Practice|pages=167–177|publisher=Springer Berlin Heidelberg|isbn=9783642030727|series=Lecture Notes in Computer Science|volume=5635|doi=10.1007/978-3-642-03073-4_18|arxiv=0902.0500}} which was used by Backens in 2013 to establish the first completeness result for the ZX-calculus.{{Cite journal|last=Backens|first=Miriam|date=2014-09-17|title=The ZX-calculus is complete for stabilizer quantum mechanics|journal=New Journal of Physics|volume=16|issue=9|pages=093021|doi=10.1088/1367-2630/16/9/093021|issn=1367-2630|arxiv=1307.7025|bibcode=2014NJPh...16i3021B|s2cid=27558474}} Namely that there exists a set of rewrite rules that suffice to prove all equalities between stabilizer ZX-diagrams, where phases are multiples of , up to global scalars. This result was later refined to completeness including scalar factors.{{Cite journal|last=Backens|first=Miriam|date=2015-11-04|title=Making the stabilizer ZX-calculus complete for scalars|journal=Electronic Proceedings in Theoretical Computer Science|volume=195|pages=17–32|doi=10.4204/eptcs.195.2|issn=2075-2180|bibcode=2015arXiv150703854B|arxiv=1507.03854|s2cid=14084597}}
Following an incompleteness result,{{Cite journal |last1=de Witt |first1=Christian Schröder |last2=Zamdzhiev |first2=Vladimir |date=2014-12-28 |title=The ZX-calculus is incomplete for quantum mechanics |journal=Electronic Proceedings in Theoretical Computer Science |volume=172 |pages=285–292 |doi=10.4204/EPTCS.172.20 |arxiv=1404.3633 |s2cid=18968166 |issn=2075-2180}} in 2017, a completion of the ZX-calculus for the approximately universal fragment was found,{{Cite book|last1=Jeandel|first1=Emmanuel|last2=Perdrix|first2=Simon|last3=Vilmart|first3=Renaud|title=Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science |chapter=A Complete Axiomatisation of the ZX-Calculus for Clifford+T Quantum Mechanics |date=2018|pages=559–568|location=New York, New York, USA|publisher=ACM Press|doi=10.1145/3209108.3209131|isbn=9781450355834|arxiv=1705.11151|s2cid=42195704}} in addition to two different completeness results for the universal ZX-calculus (where phases are allowed to take any real value).{{cite book |last1=Hadzihasanovic |first1=Amar |last2=Ng |first2=Kang Feng |last3=Wang |first3=Quanlong |title=Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science |chapter=Two complete axiomatisations of pure-state qubit quantum computing |series=Lics '18 |date=2018 |pages=502–511 |doi=10.1145/3209108.3209128 |chapter-url=https://dl.acm.org/citation.cfm?id=3209128 |access-date=21 May 2019 |publisher=ACM|isbn=9781450355834 |s2cid=195347007 }}{{Cite book|last1=Jeandel|first1=Emmanuel|last2=Perdrix|first2=Simon|last3=Vilmart|first3=Renaud|title=Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science |chapter=Diagrammatic Reasoning beyond Clifford+T Quantum Mechanics |date=2018|pages=569–578|location=New York, New York, USA|publisher=ACM Press|doi=10.1145/3209108.3209139|isbn=9781450355834|arxiv=1801.10142|bibcode=2018arXiv180110142J|s2cid=118959228}}
Also in 2017 the book Picturing Quantum Processes was released, that builds quantum theory from the ground up, using the ZX-calculus.{{Cite book|title=Picturing Quantum Processes|last1=Coecke|first1=Bob|last2=Kissinger|first2=Aleks|date=2017|publisher=Cambridge University Press|isbn=9781316219317|location=Cambridge|doi = 10.1017/9781316219317}} See also the 2019 book Categories for Quantum Theory.{{Cite book|title=Categories for Quantum Theory|last1=Heunen|first1=Chris|last2=Vicary|first2=Jamie|date=2019|publisher=Oxford University Press|isbn=9780198739616|doi=10.1093/oso/9780198739623.001.0001}}
Informal introduction
ZX-diagrams consist of green and red nodes called spiders, which are connected by wires. Wires may curve and cross, arbitrarily many wires may connect to the same spider, and multiple wires can go between the same pair of nodes. There are also Hadamard nodes, usually denoted by a yellow box, which always connect to exactly two wires.
ZX-diagrams represent linear maps between qubits, similar to the way in which quantum circuits represent unitary maps between qubits. ZX-diagrams differ from quantum circuits in two main ways. The first is that ZX-diagrams do not have to conform to the rigid topological structure of circuits, and hence can be deformed arbitrarily. The second is that ZX-diagrams come equipped with a set of rewrite rules, collectively referred to as the ZX-calculus. Using these rules, calculations can be performed in the graphical language itself.
= Generators =
The building blocks or generators of the ZX-calculus are graphical representations of specific states, unitary operators, linear isometries, and projections in the computational basis and the Hadamard-transformed basis
= Composition =
The generators can be composed in two ways:
- sequentially, by connecting the output wires of one generator to the input wires of another;
- in parallel, by stacking two generators vertically.
These laws correspond to the composition and tensor product of linear maps.
Any diagram written by composing generators in this way is called a ZX-diagram. ZX-diagrams are closed under both composition laws: connecting an output of one ZX-diagram to an input of another creates a valid ZX-diagram, and vertically stacking two ZX-diagrams creates a valid ZX-diagram.
= Only topology matters =
Two diagrams represent the same linear operator if they consist of the same generators connected in the same ways. In other words, whenever two ZX-diagrams can be transformed into one another by topological deformation, then they represent the same linear map. Thus, the controlled-NOT gate can be represented as follows:
= Diagram rewriting =
The following example of a quantum circuit constructs a GHZ-state. By translating it into a ZX-diagram, using the rules that "adjacent spiders of the same color merge", "Hadamard changes the color of spiders", and "parity-2 spiders are identities", it can be graphically reduced to a GHZ-state:
File:GHZ circuit as ZX-diagram.svg
Any linear map between qubits can be represented as a ZX-diagram, i.e. ZX-diagrams are universal. A given ZX-diagram can be transformed into another ZX-diagram using the rewrite rules of the ZX-calculus if and only if the two diagrams represent the same linear map, i.e. the ZX-calculus is sound and complete.
Formal definition
The category of ZX-diagrams is a dagger compact category, which means that it has symmetric monoidal structure (a tensor product), is compact closed (it has cups and caps) and comes equipped with a dagger, such that all these structures suitably interact. The objects of the category are the natural numbers, with the tensor product given by addition (the category is a PROP). The morphisms of this category are ZX-diagrams. Two ZX-diagrams compose by juxtaposing them horizontally and connecting the outputs of the left-hand diagram to the inputs of the right-hand diagram. The monoidal product of two diagrams is represented by placing one diagram above the other.
Indeed, all ZX-diagrams are built freely from a set of generators via composition and monoidal product, modulo the equalities induced by the compact structure and the rules of the ZX-calculus given below. For instance, the identity of the object
The following table gives the generators together with their standard interpretations as linear maps, expressed in Dirac notation. The computational basis states are denoted by
The
class="wikitable"
|+ !Name !Diagram !Type !Linear map it represents |
empty diagram
|File:Categorical quantum mechanics empty diagram.svg | |1 |
wire/identity
|{{center| | | |
Bell state
|File:Categorical quantum mechanics cup.svg | | |
Bell effect
|File:Categorical quantum mechanics cap.svg | | |
swap
|File:Symmetric monoidal category swap.svg | | |
Z spider
|File:Zx-calculus green phase spider with n inputs and m outputs.svg | | |
X spider
|File:Zx-calculus red phase spider with n inputs and m outputs.svg | | |
Hadamard
|File:Zx-calculus yellow Hadamard gate.svg | | |
There are many different versions of the ZX-calculus, using different systems of rewrite rules as axioms. All share the meta rule "only the topology matters", which means that two diagrams are equal if they consist of the same generators connected in the same way, no matter how these generators are arranged in the diagram.
The following are some of the core set of rewrite rules, here given "up to scalar factor": i.e. two diagrams are considered to be equal if their interpretations as linear maps differ by a non-zero complex factor.
class="wikitable"
!Rule name !Rule !Description |
Z-spider fusion
|Whenever two Z-spider touch, they can fuse together, and their phases add. This rule corresponds to the fact that the Z-spider represents an orthonormal basis - the computational basis. |
X-spider fusion
|See Z-spider fusion. |
Identity rule
|File:ZX-calculus red and green identity rules.svg |A phaseless arity 2 Z- or X-spider is equal to the identity. This rule states that the Bell-state is the same whether expressed in the computational basis or the Hadamard-transformed basis. In category-theoretic terms it says that the compact structure induced by the Z- and X-spider coincide. |
Color change
|File:ZX-calculus colour change rule.svg |The Hadamard-gate changes the color of spiders. This expresses the property that the Hadamard gate maps between the computational basis and the Hadamard-transformed basis. |
Copy rule
|File:ZX-calculus 2 output red-green copy rule.svg |A Z-spider copies arity-1 X-spiders. This expresses the fact that an arity-1 X-spider is proportional to a computational basis state (in this case |
Bialgebra rule
|A 2-cycle of Z- and X-spiders simplifies. This expresses the property that the computational basis and the Hadamard-transformed basis are strongly complementary. |
|A NOT-gate (an arity-2 X-spider with a |
Euler decomposition
|A Hadamard-gate can be expanded into three rotations around the Bloch sphere (corresponding to its Euler angles). Sometimes this rule is taken as the definition of the Hadamard generator, in which case the only generators of ZX-diagrams are the Z- and X-spider. |
Applications
The ZX-calculus has been used in a variety of quantum information and computation tasks.
- It has been used to describe measurement-based quantum computation and graph states.{{Citation|last1=Duncan|first1=Ross|title=Rewriting Measurement-Based Quantum Computations with Generalised Flow|date=2010|work=Automata, Languages and Programming|pages=285–296|publisher=Springer Berlin Heidelberg|isbn=9783642141614|last2=Perdrix|first2=Simon|s2cid=34644953|doi=10.1007/978-3-642-14162-1_24|citeseerx=10.1.1.708.1968}}{{Cite journal|last1=Kissinger|first1=Aleks|last2=van de Wetering|first2=John|date=2019-04-26|title=Universal MBQC with generalised parity-phase interactions and Pauli measurements|journal=Quantum|volume=3|pages=134|doi=10.22331/q-2019-04-26-134|bibcode=2019Quant...3..134K |issn=2521-327X|doi-access=free|arxiv=1704.06504}}
- The ZX-calculus is a language for lattice surgery on surface codes.{{Cite arXiv|last1=Horsman|first1=Dominic|last2=de Beaudrap|first2=Niel|date=2017-04-27|title=The ZX calculus is a language for surface code lattice surgery|language=en|eprint=1704.08670v1|class=quant-ph}}{{Cite arXiv|last1=Perdrix|first1=Simon|last2=Horsman|first2=Dominic|last3=Duncan|first3=Ross|last4=de Beaudrap|first4=Niel|date=2019-04-29|title=Pauli Fusion: a computational model to realise quantum transformations from ZX terms|language=en|eprint=1904.12817v1|class=quant-ph}}
- It has been used to find and verify correctness of quantum error correcting codes.{{Cite arXiv|last1=Horsman|first1=Dominic|last2=Zohren|first2=Stefan|last3=Roffe|first3=Joschka|last4=Kissinger|first4=Aleks|last5=Chancellor|first5=Nicholas|date=2016-11-23|title=Graphical Structures for Design and Verification of Quantum Error Correction|language=en|eprint=1611.08012v3|class=quant-ph}}{{Cite journal|last1=Duncan|first1=Ross|last2=Lucas|first2=Maxime|date=2014-12-27|title=Verifying the Steane code with Quantomatic|journal=Electronic Proceedings in Theoretical Computer Science|volume=171|pages=33–49|doi=10.4204/eptcs.171.4|issn=2075-2180|doi-access=free|arxiv=1306.4532}}{{Cite journal|last1=Garvie|first1=Liam|last2=Duncan|first2=Ross|date=2018-02-27|title=Verifying the Smallest Interesting Colour Code with Quantomatic|journal=Electronic Proceedings in Theoretical Computer Science|volume=266|pages=147–163|doi=10.4204/eptcs.266.10|issn=2075-2180|doi-access=free|arxiv=1706.02717}}
- It has been used to optimize quantum circuits.{{Cite journal|last1=Fagan|first1=Andrew|last2=Duncan|first2=Ross|date=2019-01-31|title=Optimising Clifford Circuits with Quantomatic|journal=Electronic Proceedings in Theoretical Computer Science|volume=287|pages=85–105|doi=10.4204/eptcs.287.5|issn=2075-2180|bibcode=2019arXiv190110114F|arxiv=1901.10114|s2cid=53979936}}
Tools
The rewrite rules of the ZX-calculus can be implemented formally as an instance of double-pushout rewriting. This has been used in the software Quantomatic to allow automated rewriting of ZX-diagrams (or more general string diagrams).{{Citation|last1=Kissinger|first1=Aleks|title=Quantomatic: A Proof Assistant for Diagrammatic Reasoning|date=2015|work=Automated Deduction - CADE-25|pages=326–336|publisher=Springer International Publishing|isbn=9783319214009|last2=Zamdzhiev|first2=Vladimir|doi=10.1007/978-3-319-21401-6_22|bibcode=2015arXiv150301034K|arxiv=1503.01034|s2cid=13292311}} In order to formalise the usage of the "dots" to denote any number of wires, such as used in the spider fusion rule, this software uses bang-box notation{{Cite arXiv|last1=Quick|first1=David|last2=Kissinger|first2=Aleks|date=2015-05-02|title=A first-order logic for string diagrams|language=en|eprint=1505.00343v1|class=math.CT}} to implement rewrite rules where the spiders can have any number of inputs or outputs.
A more recent project to handle ZX-diagrams is PyZX, which is primarily focused on circuit optimisation.{{Cite arXiv|last1=van de Wetering|first1=John|last2=Kissinger|first2=Aleks|date=2019-04-09|title=PyZX: Large Scale Automated Diagrammatic Reasoning|language=en|eprint=1904.04735v1|class=quant-ph}}
A LaTeX package zx-calculus can be used to typeset ZX-diagrams. Many authors also use the software [https://tikzit.github.io/ TikZiT] as a GUI to help typeset diagrams.
Related graphical languages
The ZX-calculus is only one of several graphical languages for describing linear maps between qubits. The ZW-calculus was developed alongside the ZX-calculus, and can naturally describe the W-state and Fermionic quantum computing.{{Cite book|last1=Coecke|first1=Bob|chapter=The Compositional Structure of Multipartite Quantum Entanglement|date=2010|title=Automata, Languages and Programming|pages=297–308|publisher=Springer Berlin Heidelberg|isbn=9783642141614|last2=Kissinger|first2=Aleks|series=Lecture Notes in Computer Science|volume=6199|doi=10.1007/978-3-642-14162-1_25|bibcode=2010arXiv1002.2540C|arxiv=1002.2540|s2cid=18928433}}{{Cite book |doi=10.1109/lics.2015.59|isbn=9781479988754|arxiv=1501.07082|chapter=A Diagrammatic Axiomatisation for Qubit Entanglement|title=2015 30th Annual ACM/IEEE Symposium on Logic in Computer Science|pages=573–584|year=2015|last1=Hadzihasanovic|first1=Amar|last2=Duncan|first2=Ross|s2cid=14091451}} It was the first graphical language which had a complete rule-set for an approximately universal set of linear maps between qubits, and the early completeness results of the ZX-calculus use a reduction to the ZW-calculus.
A more recent language is the ZH-calculus. This adds the H-box as a generator, that generalizes the Hadamard gate from the ZX-calculus. It can naturally describe quantum circuits involving Toffoli gates.{{Cite journal|last1=Backens|first1=Miriam|last2=Kissinger|first2=Aleks|date=2019-01-31|title=ZH: A Complete Graphical Calculus for Quantum Computations Involving Classical Non-linearity|journal=Electronic Proceedings in Theoretical Computer Science|volume=287|pages=23–42|doi=10.4204/eptcs.287.2|issn=2075-2180|doi-access=free|hdl=2066/204509|hdl-access=free}}
Related algebraic concepts
Up to scalars, the phase-free ZX-calculus, generated by
See also
References
External links
- [http://zxcalculus.com zxcalculus.com]
- [http://quantomatic.github.io Quantomatic]