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.12
In 2009 Duncan and Perdrix found the additional Euler decomposition rule for the Hadamard gate,3 which was used by Backens in 2013 to establish the first completeness result for the ZX-calculus.4 Namely that there exists a set of rewrite rules that suffice to prove all equalities between stabilizer ZX-diagrams, where phases are multiples of π / 2 {\displaystyle \pi /2} , up to global scalars. This result was later refined to completeness including scalar factors.5
Following an incompleteness result,6 in 2017, a completion of the ZX-calculus for the approximately universal π / 4 {\displaystyle \pi /4} fragment was found,7 in addition to two different completeness results for the universal ZX-calculus (where phases are allowed to take any real value).89
Also in 2017 the book Picturing Quantum Processes was released, that builds quantum theory from the ground up, using the ZX-calculus.10 See also the 2019 book Categories for Quantum Theory.11
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.
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 | 0 ⟩ , | 1 ⟩ {\displaystyle |0\rangle ,|1\rangle } and the Hadamard-transformed basis | + ⟩ = | 0 ⟩ + | 1 ⟩ 2 {\displaystyle |+\rangle ={\frac {|0\rangle +|1\rangle }{\sqrt {2}}}} and | − ⟩ = | 0 ⟩ − | 1 ⟩ 2 {\displaystyle |-\rangle ={\frac {|0\rangle -|1\rangle }{\sqrt {2}}}} . The colour green (or sometimes white) is used to represent the computational basis and the colour red (or sometimes grey) is used to represent the Hadamard-transformed basis. Each of these generators can furthermore be labelled by a phase, which is a real number from the interval [ 0 , 2 π ) {\displaystyle [0,2\pi )} . If the phase is zero it is usually not written.
The generators are:
The generators can be composed in two ways:
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.
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:
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:
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.
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 n {\displaystyle n} is depicted as n {\displaystyle n} parallel wires from left to right, with the special case n = 0 {\displaystyle n=0} being the empty diagram.
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 ∣ 0 ⟩ , | 1 ⟩ {\displaystyle \mid 0\rangle ,\vert 1\rangle } and the Hadamard-transformed basis states are ∣ ± ⟩ = 1 2 ( | 0 ⟩ ± | 1 ⟩ ) {\displaystyle \mid \pm \rangle ={\frac {1}{\sqrt {2}}}(\vert 0\rangle \pm \vert 1\rangle )} . The n {\displaystyle n} -fold tensor-product of the vector ∣ ψ ⟩ {\displaystyle \mid \psi \rangle } is denoted by ∣ ψ ⟩ ⊗ n {\displaystyle \mid \psi \rangle ^{\otimes n}} .
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.
The ZX-calculus has been used in a variety of quantum information and computation tasks.
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).28 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 notation29 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.30
A LaTeX package zx-calculus can be used to typeset ZX-diagrams. Many authors also use the software TikZiT as a GUI to help typeset diagrams.
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.3132 It was the first graphical language which had a complete rule-set for an approximately universal set of linear maps between qubits,33 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.34
Up to scalars, the phase-free ZX-calculus, generated by 0 {\displaystyle 0} -labelled spiders is equivalent to the dagger compact closed category of linear relations over the finite field F 2 {\displaystyle \mathbb {F} _{2}} . In other words, given a diagram with n {\displaystyle n} inputs and m {\displaystyle m} outputs in the phase-free ZX-calculus, its X stabilizers form a linear subspace of F 2 n ⊕ F 2 m {\displaystyle \mathbb {F} _{2}^{n}\oplus \mathbb {F} _{2}^{m}} , and the composition of phase-free ZX diagrams corresponds to relational composition of these subspaces. In particular, the Z comonoid (given by the Z spider with one input and two outputs, and the Z spider with one input and no outputs) and X monoid (given by the X spider with one output and two inputs, and the X spider with one output and no inputs) generate the symmetric monoidal category of matrices over F 2 {\displaystyle \mathbb {F} _{2}} with respect to the direct sum as the monoidal product.
Coecke, Bob; Duncan, Ross (2008), "Interacting Quantum Observables", Automata, Languages and Programming, Lecture Notes in Computer Science, vol. 5126, Springer Berlin Heidelberg, pp. 298–310, CiteSeerX 10.1.1.381.2573, doi:10.1007/978-3-540-70583-3_25, ISBN 9783540705826 9783540705826 ↩
Coecke, Bob; Duncan, Ross (2011-04-14). "Interacting quantum observables: categorical algebra and diagrammatics". New Journal of Physics. 13 (4): 043016. arXiv:0906.4725. Bibcode:2011NJPh...13d3016C. doi:10.1088/1367-2630/13/4/043016. ISSN 1367-2630. S2CID 14259278. /wiki/ArXiv_(identifier) ↩
Duncan, Ross; Perdrix, Simon (2009). "Graph States and the Necessity of Euler Decomposition". Mathematical Theory and Computational Practice. Lecture Notes in Computer Science. Vol. 5635. Springer Berlin Heidelberg. pp. 167–177. arXiv:0902.0500. doi:10.1007/978-3-642-03073-4_18. ISBN 9783642030727. 9783642030727 ↩
Backens, Miriam (2014-09-17). "The ZX-calculus is complete for stabilizer quantum mechanics". New Journal of Physics. 16 (9): 093021. arXiv:1307.7025. Bibcode:2014NJPh...16i3021B. doi:10.1088/1367-2630/16/9/093021. ISSN 1367-2630. S2CID 27558474. /wiki/ArXiv_(identifier) ↩
Backens, Miriam (2015-11-04). "Making the stabilizer ZX-calculus complete for scalars". Electronic Proceedings in Theoretical Computer Science. 195: 17–32. arXiv:1507.03854. Bibcode:2015arXiv150703854B. doi:10.4204/eptcs.195.2. ISSN 2075-2180. S2CID 14084597. /wiki/ArXiv_(identifier) ↩
de Witt, Christian Schröder; Zamdzhiev, Vladimir (2014-12-28). "The ZX-calculus is incomplete for quantum mechanics". Electronic Proceedings in Theoretical Computer Science. 172: 285–292. arXiv:1404.3633. doi:10.4204/EPTCS.172.20. ISSN 2075-2180. S2CID 18968166. /wiki/ArXiv_(identifier) ↩
Jeandel, Emmanuel; Perdrix, Simon; Vilmart, Renaud (2018). "A Complete Axiomatisation of the ZX-Calculus for Clifford+T Quantum Mechanics". Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science. New York, New York, USA: ACM Press. pp. 559–568. arXiv:1705.11151. doi:10.1145/3209108.3209131. ISBN 9781450355834. S2CID 42195704. 9781450355834 ↩
Hadzihasanovic, Amar; Ng, Kang Feng; Wang, Quanlong (2018). "Two complete axiomatisations of pure-state qubit quantum computing". Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science. Lics '18. ACM. pp. 502–511. doi:10.1145/3209108.3209128. ISBN 9781450355834. S2CID 195347007. Retrieved 21 May 2019. 9781450355834 ↩
Jeandel, Emmanuel; Perdrix, Simon; Vilmart, Renaud (2018). "Diagrammatic Reasoning beyond Clifford+T Quantum Mechanics". Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science. New York, New York, USA: ACM Press. pp. 569–578. arXiv:1801.10142. Bibcode:2018arXiv180110142J. doi:10.1145/3209108.3209139. ISBN 9781450355834. S2CID 118959228. 9781450355834 ↩
Coecke, Bob; Kissinger, Aleks (2017). Picturing Quantum Processes. Cambridge: Cambridge University Press. doi:10.1017/9781316219317. ISBN 9781316219317. 9781316219317 ↩
Heunen, Chris; Vicary, Jamie (2019). Categories for Quantum Theory. Oxford University Press. doi:10.1093/oso/9780198739623.001.0001. ISBN 9780198739616. 9780198739616 ↩
Bravyi, Sergey; Haah, Jeongwan (2012-11-27). "Magic-state distillation with low overhead". Physical Review A. 86 (5): 052329. arXiv:1209.2426. Bibcode:2012PhRvA..86e2329B. doi:10.1103/physreva.86.052329. ISSN 1050-2947. S2CID 4399674. /wiki/ArXiv_(identifier) ↩
Horsman, Dominic; de Beaudrap, Niel (2017-04-27). "The ZX calculus is a language for surface code lattice surgery". arXiv:1704.08670v2 [quant-ph]. /wiki/ArXiv_(identifier) ↩
Backens, Miriam; Perdrix, Simon; Wang, Quanlong (2017-01-01). "A Simplified Stabilizer ZX-calculus". Electronic Proceedings in Theoretical Computer Science. 236: 1–20. arXiv:1602.04744. doi:10.4204/eptcs.236.1. ISSN 2075-2180. https://doi.org/10.4204%2Feptcs.236.1 ↩
van de Wetering, John; Kissinger, Aleks (2019-04-09). "PyZX: Large Scale Automated Diagrammatic Reasoning". arXiv:1904.04735v1 [quant-ph]. /wiki/ArXiv_(identifier) ↩
Duncan, Ross; Perdrix, Simon (2010), "Rewriting Measurement-Based Quantum Computations with Generalised Flow", Automata, Languages and Programming, Springer Berlin Heidelberg, pp. 285–296, CiteSeerX 10.1.1.708.1968, doi:10.1007/978-3-642-14162-1_24, ISBN 9783642141614, S2CID 34644953 9783642141614 ↩
Kissinger, Aleks; van de Wetering, John (2019-04-26). "Universal MBQC with generalised parity-phase interactions and Pauli measurements". Quantum. 3: 134. arXiv:1704.06504. Bibcode:2019Quant...3..134K. doi:10.22331/q-2019-04-26-134. ISSN 2521-327X. https://doi.org/10.22331%2Fq-2019-04-26-134 ↩
Horsman, Dominic; de Beaudrap, Niel (2017-04-27). "The ZX calculus is a language for surface code lattice surgery". arXiv:1704.08670v1 [quant-ph]. /wiki/ArXiv_(identifier) ↩
Perdrix, Simon; Horsman, Dominic; Duncan, Ross; de Beaudrap, Niel (2019-04-29). "Pauli Fusion: a computational model to realise quantum transformations from ZX terms". arXiv:1904.12817v1 [quant-ph]. /wiki/ArXiv_(identifier) ↩
Horsman, Dominic; Zohren, Stefan; Roffe, Joschka; Kissinger, Aleks; Chancellor, Nicholas (2016-11-23). "Graphical Structures for Design and Verification of Quantum Error Correction". arXiv:1611.08012v3 [quant-ph]. /wiki/ArXiv_(identifier) ↩
Duncan, Ross; Lucas, Maxime (2014-12-27). "Verifying the Steane code with Quantomatic". Electronic Proceedings in Theoretical Computer Science. 171: 33–49. arXiv:1306.4532. doi:10.4204/eptcs.171.4. ISSN 2075-2180. https://doi.org/10.4204%2Feptcs.171.4 ↩
Garvie, Liam; Duncan, Ross (2018-02-27). "Verifying the Smallest Interesting Colour Code with Quantomatic". Electronic Proceedings in Theoretical Computer Science. 266: 147–163. arXiv:1706.02717. doi:10.4204/eptcs.266.10. ISSN 2075-2180. https://doi.org/10.4204%2Feptcs.266.10 ↩
Fagan, Andrew; Duncan, Ross (2019-01-31). "Optimising Clifford Circuits with Quantomatic". Electronic Proceedings in Theoretical Computer Science. 287: 85–105. arXiv:1901.10114. Bibcode:2019arXiv190110114F. doi:10.4204/eptcs.287.5. ISSN 2075-2180. S2CID 53979936. /wiki/ArXiv_(identifier) ↩
Kissinger, Aleks; Zamdzhiev, Vladimir (2015), "Quantomatic: A Proof Assistant for Diagrammatic Reasoning", Automated Deduction - CADE-25, Springer International Publishing, pp. 326–336, arXiv:1503.01034, Bibcode:2015arXiv150301034K, doi:10.1007/978-3-319-21401-6_22, ISBN 9783319214009, S2CID 13292311 9783319214009 ↩
Quick, David; Kissinger, Aleks (2015-05-02). "A first-order logic for string diagrams". arXiv:1505.00343v1 [math.CT]. /wiki/ArXiv_(identifier) ↩
Coecke, Bob; Kissinger, Aleks (2010). "The Compositional Structure of Multipartite Quantum Entanglement". Automata, Languages and Programming. Lecture Notes in Computer Science. Vol. 6199. Springer Berlin Heidelberg. pp. 297–308. arXiv:1002.2540. Bibcode:2010arXiv1002.2540C. doi:10.1007/978-3-642-14162-1_25. ISBN 9783642141614. S2CID 18928433. 9783642141614 ↩
Hadzihasanovic, Amar; Duncan, Ross (2015). "A Diagrammatic Axiomatisation for Qubit Entanglement". 2015 30th Annual ACM/IEEE Symposium on Logic in Computer Science. pp. 573–584. arXiv:1501.07082. doi:10.1109/lics.2015.59. ISBN 9781479988754. S2CID 14091451. 9781479988754 ↩
Backens, Miriam; Kissinger, Aleks (2019-01-31). "ZH: A Complete Graphical Calculus for Quantum Computations Involving Classical Non-linearity". Electronic Proceedings in Theoretical Computer Science. 287: 23–42. doi:10.4204/eptcs.287.2. hdl:2066/204509. ISSN 2075-2180. https://doi.org/10.4204%2Feptcs.287.2 ↩