1 Introduction
The zx
calculus is a highlevel and intuitive graphical language for pure qubit quantum mechanics (QM), based on category theory
[CD11]. It comes with a set of rewrite rules that potentially allow this graphical calculus to be used to replace matrixbased formalisms entirely for certain classes of problems. However, this replacement is only possible without losing deductive power if the zxcalculus is complete for this class of problems, i.e. if any equality that is derivable using matrices can also be derived graphically.The first fragment of the zxcalculus shown to be complete was the stabilizer zxcalculus [Bac14a]. This fragment consists of the zxdiagrams involving angles which are multiples of only. The fragment of quantum theory that can be represented by stabilizer zxdiagrams is the socalled stabilizer quantum mechanics [Got97]. Stabilizer QM is a non trivial fragment of quantum mechanics which is in fact efficiently classically simulatable [Got98] but which nevertheless exhibits many important quantum properties, like entanglement and nonlocality. It is furthermore of central importance in areas such as quantum error correcting codes [NC10] and measurementbased quantum computation [RB01].
A subset of these rules is also complete for the singlequbit Clifford+T group [Bac14b]. Other fragments of the zxcalculus have recently been completed, these include the full Clifford+T fragment [JPV17a] as well as the full zxcalculus [NW17]. Nevertheless, we focus here on the stabilizer zxcalculus because it is the core of the overall language: all the fundamental structures – e.g. the axiomatisation of complementary bases [CD11] – are present in this fragment. The rule sets for larger parts of the formalism include the rules of the stabilizer zxcalculus.
Now that the question of completeness has been resolved, we turn our attention to simplifying the zxcalculus, removing unnecessary equations while keeping only the essential axioms, which potentially capture fundamental structures of quantum mechanics. This process also simplifies the development, and potentially the efficiency, of automated tools for quantum reasoning, e.g. Quantomatic [KMF].
In a preliminary version of this work [BPW17], we gave a set of axioms that is significantly smaller than the usual one, containing just nine explicit rewrite rules. Previous rule sets usually contained about a dozen explicit rules and used the convention that any rule also holds with the colours red and green swapped or with the diagrams flipped upsidedown, effectively nearly quadrupling the available set of rewrite rules^{2}^{2}2Some rules are symmetric under the operations of swapping the colours and/or flipping them upsidedown, hence the effective rule set is not quite four times the size of the explicitlygiven one.. We showed that the colour symmetric and upsidedown versions of the remaining rewrite rules can in fact be derived, so the convention is no longer required.
Here, we extend this work by showing that most of the remaining rules are indeed necessary, i.e. they cannot be derived from the other rules. Yet for two rules, the question of their necessity remains open; this includes the bialgebra rule which formalises the notion of complementary bases and thus plays core role in the language.
Having shown previously that metarules like ‘colour symmetry’ and ‘upsidedown symmetry’, which were considered as axioms in previous versions of the language, can in fact be derived, we now consider the ‘only the topology matters’ rule, which means that two diagrams represent the same matrix whenever one can be transformed into the other by moving components around without changing their connections. This metarule is an essential property of quantum diagrammatic reasoning, and refines the axioms of the ambient compact closed category. Indeed, the axioms of a compact closed category guarantee that two isomorphic diagrams are equivalent [Sel10]. Roughly speaking, the ‘only the topology matters’ metarule implies additionally that any two inputs or outputs of a generator can be freely exchanged. We show that a single additional explicit rewrite rule is sufficient to derive the metarule ‘only the topology matters’ from the simplified stabilizer zxcalculus together with the axioms of the ambient compact closed category (Section 4.1). More surprisingly, we show that a weaker ambient category is enough, namely a braided autonomous category (Section 4.2). Graphically, this means that 3dimensional isotopy is enough to derive the ‘only the topology matters’ metarule.
A preliminary version of this work has been published in the proceedings of the QPL’16 conference [BPW17]. Soundness and completeness of the simplified zxcalculus are proved in [BPW17], together with the minimality of the scalar axioms (IV) and (ZO). In the present extended version, we prove the necessity of (almost) all the other rules of the language (section 3), and we also consider the simplification of the ambient category (section 4).
2 A Simplified Stabilizer zxcalculus
The zxcalculus is a graphical language based on categorical quantum mechanics. The underlying category makes the diagrammatic notation rigorous.
Here, we focus on the stabilizer fragment of the zxcalculus, as that encompasses many important aspects of the full language while also being complete. We introduce first the simplified rule set that forms the core of this paper. The previous version of the calculus will be presented later.
2.1 Diagrams and standard interpretation
A diagram of the stabilizer zxcalculus with inputs and outputs is generated by:
scalarss//spideralpha  scalarss//spiderredalpha  

scalarss//Had4  scalarss//emptysquaresmall  
scalarss//swap  scalarss//Id  
scalarss//cup  scalarss//cap 
where , , and is denoted by an empty diagram. Because of their many ‘legs’, red and green dots are often called ‘spiders’.
These components can be combined using the following two operations:

Spacial composition: for any and , is constructed by placing and sidebyside, to the right of .

Sequential composition: for any and , is constructed by placing above , connecting the outputs of to the inputs of .
When equal to , the phase angles of the green and red dots may be omitted:
With natural numbers as objects and diagrams as morphisms, it is obvious that the underlying category of the stabilizer zxcalculus is a monoidal category.
The standard interpretation of the zxdiagrams associates with any diagram a linear map , where denotes the complex numbers. The interpretation is inductively defined as follows:
For green dots, , and when , is a matrix with columns and rows such that all entries are except the top left one which is and the bottom right one which is , e.g.:
For any , , where and for any , . E.g.,
For example, consider the following diagram:
Its standard interpretation can be found as follows:
The rules of the underlying category ensure that all the different decompositions of the diagram yield the same interpretation. In terms of category theory, the standard interpretation is a monoidal functor from the category of stabilizer zxdiagrams to the category of finite dimensional Hilbert spaces.
The linear maps that can be represented by stabilizer zxdiagrams correspond to the socalled stabilizer fragment of quantum mechanics [Got97]. Note that zxdiagrams with arbitrary angles (no longer necessarily multiples of ) are universal: for any and any linear map , there exists a diagram such that [CD11]. When restricted to angles that are multiples of , zxdiagrams are approximately universal, i.e. any linear map can approximated to arbitrary accuracy by such a zxdiagram. In this paper, we focus on the core of the zxcalculus formed by the stabilizer zxdiagrams.
2.2 The rewrite rules
scalars//spiderbis  (S1)  scalars//induced_compact_structure  (S3)  
scalars//b1s  (B1)  scalars//b2snew  (B2)  
scalars//HadaDecomSinglesprime  (EU)  scalars//h2  (H)  
scalars//dotinverse  (IV)  scalars//zo1prime  (ZO) 
The zxcalculus is not just a notation: it comes with a set of rewrite rules that allow equalities to be derived entirely graphically. We are considering the stabilizer zxcalculus here because it is the fragment with the smallest complete set of rewrite rules. Complete here means that any equality that can be derived using matrices can also be derived graphically using that set of rewrite rules [Bac14a, Bac15].
We introduce a new, simpler, set of rules for the stabilizer zxcalculus (Figure 1) which consist in 9 axioms, plus the ‘only topology matters’ axiom described below. The set of axioms of Figure 1 is significantly simpler and more compact than the previous versions of the stabilizer ZXcalculus. However we prove in the next section that the set of axioms is complete. In section 3 we prove that most of these axioms are necessary in the sense that they cannot be derived using the other axioms of the language.
In addition to those explicit rules there is also a metarule: ‘only the topology matters’ [CD11], which means that two diagrams represent the same matrix whenever one can be transformed into the other by moving components around without changing their connections. E.g.
This rule combines properties of the underlying category with symmetry properties of the diagram components: namely the fact that spiders are symmetric under interchange of any two legs, and that diagram components are invariant under (partial) transpose. The latter is graphically denoted by bending inputs into outputs, or conversely.
2.3 Soundness and completeness of the simplified stabilizer zxcalculus
The simplified rule set is shown to be sound and complete in [BPW17]. Both properties are proved by reference to the previous version of the language, shown in Figure 2. This version of the language was set out in [Bac15], where it was also shown to be complete. Its soundness follows from the soundness of the original language as well as the new rules [CD11, Bac15].
Some of the derivations only work within the stabilizer fragment, e.g. the rule (K2) is only derived for .
scalars/spiderbis  (S1)  scalars/spider2loop  (S1)  

scalars/induced_compact_structure2wire  (S3)  scalars/star_rule  (SR)  
scalars/b1s  (B1)  scalars/b2s  (B2)  
scalars/k1  (K1)  scalars/k2s  (K2)  
scalars/HadaDecomSingles  (EU)  scalars/h2  (H)  
scalars/zo1  (ZO)  scalars/zero_scalar  (ZS) 
3 On the necessity of the rewrite rules in the simplified set
Ideally, we would like to simplify the set of rewrite rules for the zxcalculus until each remaining rule is necessary, i.e. provably cannot be derived from the others. Yet, while we have necessity proofs for many of the rules in Figure 1, there are still some open questions in this area. Nevertheless, we do have a minimality proof for rules explicitly dealing with scalars.
3.1 Minimality of the scalar axioms
The previous version of the zxcalculus as given in Figure 2 had three rules explicitly dedicated to scalars: (SR), (ZO), and (ZS). The former contains no nonscalars, the latter are considered to be ‘about’ scalars because they formalise properties of the zero scalar scalarss//RZ00pi.
The simplified zxcalculus no longer contains the star node, and it only has two scalar rules: (IV) and (ZO). This set of rules is minimal for scalars in the sense that both of those axioms are necessary [BPW17]. Indeed, the inverse rule (IV) cannot be derived using the other rules of the simplified zxcalculus as it is the only rule which equates an empty diagram and a non empty diagram. The necessity of the zero rule (ZO) is proved using an alternative interpretation of the diagrams, which is sound for all the rules of the language except for the zero rule.
3.2 Necessity of other rules
As shown in [DP09, DP14], the Euler decomposition rule (EU) is not derivable from the other rules of the zxcalculus excluding the zero rule (ZO). This means that the Euler decomposition rule is necessary even in the presence of the zero rule: if there was some derivation for (EU) involving (ZO), then the zero scalar scalars//gnpi must appear in at least one diagram of (EU) as scalars//gnpi has no inverse and therefore cannot be cancelled. This argument for the necessity of (EU) also applies to (EU).
Lemma 1.
The copy rule (B1) is necessary.
Proof.
There is no other rewrite rule in Figure 1 that can transform a diagram with two connected outputs into one with two disconnected outputs. ∎
Lemma 2.
The colour change rule (H) is necessary.
Proof.
There is no other rewrite rule in Figure 1 that matches red dots of degree four or higher, or red spiders with nonzero phases. ∎
Lemma 3.
The spider rule (S1) is necessary.
Proof.
There is no other rewrite rule in Figure 1 that can transform a dot of degree four or higher into a diagram containing lowerdegree dots. (The rule (H) matches dots of high degree, but only transforms them to dots of the same degree.) ∎
Lemma 4.
The rule (S3L) is necessary.
Proof.
There is no other rewrite rule in Figure 1 that can transform a wire incident on a node (Hadamard, green dot, or red dot) to a wire not incident on any node. ∎
We have shown that rules (S1), (B1), (EU), (H), (IV), (S3L), and (ZO) are necessary. This leaves (S3R) and (B2). For those rules, we have no conclusive necessity proofs, though we do know that at least one of the two is necessary.
Lemma 5.
Either (B2) or (S3R) is necessary.
Proof.
Consider an alternative interpretation functor which acts like the usual interpretation functor on green dots, wires, and the empty diagram, but adds complex phases to red dots (depending on their degree) and to Hadamard nodes:
The effect of this interpretation is to add a complex phase to a diagram that depends on the sum of the degrees of the red dots minus the number of Hadamard nodes, all taken modulo 4. It is straightforward to check that most rules in Figure 1 are sound under this interpretation, the exceptions being (B2) and (S3R). ∎
The two parts of (S3) are very similar, so it is understandable that it would be difficult to determine whether they are independent of each other. It is more vexing not to be able to prove whether the bialgebra rule (B2) is necessary. Indeed the bialgebra rule (B2) plays a central role in the language: it is the cornerstone of the axiomatisation of complementary bases. Thus, it would be unexpected for the bialgebra rule to be derivable from the other rules. In fact, the rewrite rules can be modified to make (B2) the only rule that is not sound under , as detailed below in Section 3.3. Yet this comes at the cost of introducing additional scalars in several rules and as a consequence losing the necessity proof for (S3L).
While the bialgebra rule (B2) is at the heart of the characterisation of complementary bases, the interpretation of the (S3R) rule is that the two bases – one characterised by the green dots, the other by the red dots – are inducing the same compact structure. Indeed, each colour is inducing a compact structure, i.e. a pair of a ‘cup’ and a ‘cap’ that satisfy a ‘snake equation’ like in Figure 3. There is no a priori reason that those two compact structures should coincide. Thus, deciding whether (S3R) is necessary is exactly the question of deciding whether the other rules of the language force the compact structures induced by the green and the red dots, respectively, to coincide.
3.3 Modified rewrite rules in which the bialgebra law is necessary
The bialgebra rule (B2) can be made necessary while retaining soundness and completeness by modifying two of the other rewrite rules as follows.
Replace (S3) by (S3) and the following rule:
(1) 
Additionally, replace (IV) by:
(2) 
where the righthand side denotes an empty diagram.
In the resulting rule set, (B2) is the only rule that is not sound under .
4 Simplifying the ambient category
In the previous sections, we have shown how to simplify the explicit rewrite rules of the stabilizer zxcalculus and how to eliminate the colourswap and upsidedown symmetry metarules. There is one rule we have not touched, namely the metarule ‘only the topology matters’. We now consider how to replace this powerful meta rule with other sets of assumptions based on the graphical axioms for specific categories.
4.1 Compact closed category / Isomorphism
The standard route [CD11] for axiomatising graphical properties like ‘only the topology matters’ in a categorical framework is based on compact closed categories [Sel07, Sel10]. Assuming that we work with a compact closed category means assuming that the equations in Figure 3 are satisfied. It additionally implies that arbitrary maps can slide freely along either wire in a crossing. Graphically, this means that any two isomorphic diagrams are equal. It is straightforward to check that all of the above rules are sound for the zxcalculus with the topology rule.
At first sight, it seems like the compact closed structure is significantly less powerful than the topology rule: in particular, working in a compact closed category does not directly imply any symmetry properties for the nodes, like the ability to swap legs or bend inputs into outputs:
(3) 
Nevertheless, it is possible to derive all of these properties using just one more rewrite rule in addition to the ones given in Figure 1, namely:
(S2) 
Under the assumption that ‘only the topology matters’, this equation can be derived from (S3). We conjecture that, under the weaker assumption of a compact closed structure, those two rules are independent, although we do not have a proof of this.
Theorem 6.
Proof.
To prove completeness, we first derive all the rewrite rules in Figure 2 one by one. This has additional intricacies compared to the original completeness proof, due to the more restrictive underlying assumptions. The second part is a proof that the topology meta rule – and in particular, the symmetry properties of the nodes – follows from the assumptions. The constituent lemmas of those proofs can be found in Appendix A. ∎
4.2 Braided autonomous category / 3D isotopy
In this subsection, we take a less standard approach for making the topology meta rule rigorous: we work in an ambient category which implies only that diagrams which are 3Disotopic are equal (whereas a compact closed category implies that all isomorphic diagrams are equal). We show that, combined with the other rules of the zxcalculus, 3Disotopy is enough to recover the ‘only the topology matters’ metarule.
3Disotopy is a natural equivalence of diagrams which can be axiomatised using the Reidemeister moves [Rei32] (see Figure 4), the snake equations (see Figure 3), as well as the property that arbitrary maps can slide freely along either wire in a braiding. In a categorical setting, the Reidemeister move (R2) follows from the invertibility of a braiding, while (R3) follows from the coherence axioms of a braided monoidal category and the naturality of a braiding. Therefore, 3Disotopy is modelled by a braided autonomous category augmented with the loop axiom (R1) [Sel10], which appears so useful that it is exploited by several graphical languages for quantum information and computation [RV17, JLW16].
The following technicality arises: when the ambient category is braided rather than symmetric, one needs to specify which way the wires cross in each crossing. The only crossing occurring in the rules of the language is in the bialgebra rule (B2), which we transform into the following braided rule (the choice of how the wires cross is arbitrary):
(B2) 
Theorem 7.
Proof.
The idea is to prove that the braiding is self inverse, meaning the category we are working in is actually symmetric monoidal:
(4) 
The proof of this equation and its constituent lemmas are given in Appendix B.
Once we know we have a symmetric monoidal category, we can show commutativity of green copy and cocopy as well as their colourswapped versions by Lemmas 50, 51, 52, 53, and 54. Along with (S3), we obtain the symmetry of cap and cup. Therefore, we come back to the situation described in the previous subsection: working in a compact closed category. ∎
5 Conclusion and perspectives
The stabilizer zxcalculus has a complete set of rewrite rules, which allow any equality that can be derived using matrices to also be derived graphically. We introduce a simplified but still complete version of the stabilizer zxcalculus with significantly fewer rewrite rules. In particular, many rules obtained from others by swapping colours and/or flipping diagrams upsidedown are no longer assumed. Our aim is to minimise the axioms of the language in order to pinpoint the fundamental structures of quantum mechanics, and also simplify the development and the efficiency of automated tools for quantum reasoning, like Quantomatic [KMF].
Among the nine remaining rules of the language, only two are not proved to be necessary, although we know that at least one of them is. The problem of the minimality of the language is left as an open question and can essentially be phrased as follows: do the rules of the language (without the (S3R) rule) force the two compact structures, induced by the red and green generators respectively, to coincide?
The simplified stabilizer zxcalculus can also serve as a backbone for further developments, in particular concerning the full calculus (allowing arbitrary angles). Several rules we showed to be derivable in the stabilizer zxcalculus are also derivable in the full zxcalculus: e.g. (ZS), which is valid for arbitrary angles, and (K1). The derivation of (K2) on the other hand is valid for the stabilizer fragment only. Recently, new rules, including the socalled supplementarity, have been proved to be necessary for the (full) zxcalculus [PW16, JPVW17] and in particular for the fragment of the zxcalculus, which corresponds to the so called Clifford+T quantum mechanics. Even if supplementarity and (K2) rules can be derived in the stabilizer zxcalculus, a future project is to establish a simple, possibly minimal, set of axioms for the stabilizer zxcalculus which contains the rules known to be necessary for arbitrary angles (like supplementarity or (K2)), while avoiding rules which are in some sense specific to the fragment, e.g. (EU).
The fragment of zxcalculus made of the diagrams involving angles multiple of only, is known to be complete for the real stabilizer quantum mechanics [DP14], which is the basis of a full language for real quantum mechanics [JPV17b]. A perspective is to provide a simplified version of the real stabilizer zxcalculus, in particular considering the rules for which we fail to prove the necessity for the stabilizer zxcalculus.
We have also proved that the metarule ‘only the topology matters’ can be derived from the rules of the language together with 3Disotopy. The latter means that the ambient category is a braided autonomous category which additionally satisfies the Reidemeister rule (R1). We leave as an open question the necessity of the (R1) rule for deriving the topology metarule. The emergence of braided categories in this context opens new avenues for considering fermionic quantum mechanics [PP10, DR13].
Acknowledgements
The authors would like to thank Bob Coecke, Ross Duncan, Emmanuel Jeandel, Aleks Kissinger, and Renaud Vilmart for valuable discussions. This research was done while MB was at the School of Mathematics, University of Bristol. QW acknowledges funding from Région Lorraine. MB has received funding from EPSRC via grant EP/L021005/1 and from the European Research Council under the European Union’s Seventh Framework Programme (FP7/20072013) ERC grant agreement no. 334828. The paper reflects only the authors’ views and not the views of the ERC or the European Commission. The European Union is not liable for any use that may be made of the information contained therein. No new data were created during this study.
References
 [Bac14a] Miriam Backens. The ZXcalculus is complete for stabilizer quantum mechanics. New Journal of Physics, 16(9):093021, September 2014.
 [Bac14b] Miriam Backens. The ZXcalculus is complete for the singlequbit Clifford+T group. Electronic Proceedings in Theoretical Computer Science, 172:293–303, December 2014.
 [Bac15] Miriam Backens. Making the stabilizer ZXcalculus complete for scalars. Electronic Proceedings in Theoretical Computer Science, 195:17–32, November 2015.
 [BPW17] Miriam Backens, Simon Perdrix, and Quanlong Wang. A Simplified Stabilizer ZXcalculus. EPTCS, 236:1–20, January 2017.
 [CD11] Bob Coecke and Ross Duncan. Interacting quantum observables: categorical algebra and diagrammatics. New Journal of Physics, 13(4):043016, April 2011.
 [DP09] Ross Duncan and Simon Perdrix. Graph states and the necessity of Euler decomposition. In Mathematical Theory and Computational Practice, volume 5635, pages 167–177. Springer Berlin Heidelberg, 2009.
 [DP14] Ross Duncan and Simon Perdrix. Pivoting makes the ZXcalculus complete for real stabilizers. Electronic Proceedings in Theoretical Computer Science, 171:50–62, December 2014.
 [DR13] Alexei Davydov and Ingo Runkel. A braided monoidal category for symplectic fermions. Symmetries and Groups in Contemporary Physics, 11:399, 2013.
 [Got97] Daniel Gottesman. Stabilizer Codes and Quantum Error Correction. PhD thesis, Caltech, May 1997.
 [Got98] Daniel Gottesman. The Heisenberg representation of quantum computers. In Proceedings of the XXII International Colloquium on Group Theoretical Methods in Physics, July 1998. arXiv:quantph/9807006.
 [JLW16] Arthur Jaffe, Zhengwei Liu, and Alex Wozniakowski. Holographic software for quantum networks. arXiv preprint arXiv:1605.00127, 2016.
 [JPV17a] Emmanuel Jeandel, Simon Perdrix, and Renaud Vilmart. A Complete Axiomatisation of the ZXCalculus for Clifford+T Quantum Mechanics. arXiv:1705.11151 [quantph], May 2017.
 [JPV17b] Emmanuel Jeandel, Simon Perdrix, and Renaud Vilmart. Ycalculus: A language for real matrices derived from the ZXcalculus. The 14th International Conference on Quantum Physics and Logic, arXiv:1702.00934 [quantph], 2017.
 [JPVW17] Emmanuel Jeandel, Simon Perdrix, Renaud Vilmart, and Quanlong Wang. ZXcalculus: Cyclotomic supplementarity and incompleteness for Clifford+T quantum mechanics. 42nd International Symposium on Mathematical Foundations of Computer Science, arXiv preprint arXiv:1702.01945 [quantph], 2017.
 [KMF] Aleks Kissinger, Alex Merry, Ben Frot, Bob Coecke, David Quick, Lucas Dixon, Matvey Soloviev, Ross Duncan, and Vladimir Zamdzhiev. Quantomatic. https://quantomatic.github.io/. Accessed September 2017.
 [NC10] Michael A. Nielsen and Isaac L. Chuang. Quantum Computation and Quantum Information. Cambridge University Press, Cambridge, 2010.
 [NW17] Kang Feng Ng and Quanlong Wang. A universal completion of the ZXcalculus. arXiv:1706.09877 [quantph], June 2017.
 [PP10] Prakash Panangaden and Éric Oliver Paquette. A categorical presentation of quantum computation with anyons. In New structures for Physics, pages 983–1025. Springer, 2010.
 [PW16] Simon Perdrix and Quanlong Wang. Supplementarity is Necessary for Quantum Diagram Reasoning. In 41st International Symposium on Mathematical Foundations of Computer Science (MFCS 2016), volume 58 of LIPIcs, pages 76:1–76:14, 2016.
 [RB01] Robert Raussendorf and Hans J. Briegel. A oneway quantum computer. Physical Review Letters, 86(22):5188–5191, May 2001.
 [Rei32] Kurt Reidemeister. Knotentheorie. Number 1 in Ergebnisse der Mathematik und ihrer Grenzgebiete. Julius Springer, Berlin, 1932. English Translation: Knot Theory, B C S Associates (1983).
 [RV17] David Reutter and Jamie Vicary. Shaded tangles for the design and verification of quantum programs. arXiv preprint arXiv:1701.03309, 2017.
 [Sel07] Peter Selinger. Dagger Compact Closed Categories and Completely Positive Maps: (Extended Abstract). Electronic Notes in Theoretical Computer Science, 170(0):139–163, March 2007.
 [Sel10] Peter Selinger. A Survey of Graphical Languages for Monoidal Categories. In Bob Coecke, editor, New Structures for Physics, number 813 in Lecture Notes in Physics, pages 289–355. Springer Berlin Heidelberg, 2010.
Appendix A Completeness proof for the zxcalculus in a compact closed category
We prove completeness by showing that the rewrite rules of Figure 2 plus the topology meta rule can be derived from the new rule set, which now consists of the rules in Figure 1, (S2), and the axioms of a dagger compact closed category.
Under the assumption that ‘only the topology matters’, we get the upsidedown versions of all rewrite rules effectively free by simply applying cups or caps to all outputs or inputs. In a compact closed category, this is no longer the case, because we no longer have the symmetries of the ‘spiders’ given in (3). Nevertheless, as in [BPW17], we derive the rules in Figure 2 (minus (ZS) and with (SR) replaced by (IV), like in the original completeness proof there) onebyone, each together with its colourswapped and upsidedown variants, in the order: (H), (S1) & (S3), (B1), (IV), (B2), (S1), (K1), (EU), (K2), (ZO). Afterwards, we show that the symmetries of the ‘spiders’ – swapping or bending of ‘legs’ – can now be derived.
We begin by showing that the Hadamard node is selfinverse. To do this, we first need to derive the colourswapped version of (S2).
Lemma 8.
Proof.
By the compact structure, we have:
where we also used the rules (S1) and (S3). ∎
Equations (S2) and (5) together with (H) are sufficient to prove the following two lemmas: the selfinverse property of the Hadamard node and the colourswapped version of the colourchange rule. The proofs are analogous to those in [BPW17].
Lemma 9.
Lemma 10.
The upsidedown version of (H) is itself, and similarly for the upsidedown version when the colours in (H) are swapped.
Additionally, we can show that the Hadamard node is invariant under transpose.
Lemma 11.
Proof.
Lemma 12.
Proof.
Lemma 13.
Proof.
First note that by the rule (S1) we have:
Using these inductively, together with the compact structure, (S3) and (10), we obtain:
which is the desired result. ∎
Lemma 14.
Since the colourswapped version of (S3) already exists in (S3), we need only to prove the colourswapped upsidedown version.
Lemma 15.
Proof.
Apply (S2) and (12) to create red dots from the lefthand side of the above:
The result then follows by (S3) and the compact structure. ∎
Lemma 16.
Proof.
This follows from (S3) and the spider rules. ∎
A similar property holds for the inverse of the redgreen scalar. As a consequence of this, we do not need to worry about the orientation of scalars when deriving the upsidedown version of a rewrite rule. Since the upsidedown version of the scalar is also its colourswapped version, the same is true when colourswapping rewrite rules.
Lemma 17.
Proof.
Lemma 18.
Proof.
Lemma 19.
While the compact structure allows the removal of twists in cups and caps, it is not immediately clear what to do with a twist in an otherwise straight wire. The following lemma will therefore be useful.
Lemma 20.
Proof.
Using (S3), (S1), (13), (12), (B2), (16) and (10), we can now prove the Hopf law. Again, the proof is analogous to that in [BPW17].
Lemma 21 (Hopf law).
Furthermore, the following Lemmas 22, 23, and 24 follow. In each of these cases, the diagrams required for the proof are the ones given in [BPW17], though the arguments for why one diagram can be transformed into the next may be different, as we are now using the axioms of a compact closed category instead of the topology rule.
Lemma 22.
Lemma 23.
Lemma 24.
We now proceed with deriving colourswapped versions of known rules.
Lemma 25.
Flipping (B2) upsidedown has the same effect as swapping the colours, so there are only two versions of this rule. Additionally, (S1) can now be proved, along with its colourswapped version.
Lemma 26.
Lemma 27.
The upsidedown version of (S1) is (S1) itself, and the same holds for the colourswapped version. These results enable the derivation of Lemmas 28 and 29, as well as Corollaries 30 and 31. Where no proofs are given, the diagrams are the same as those in [BPW17].
Lemma 28.
Composing with the Hadamard node on both sides of (25), we get:
(26) 
Lemma 29.
Corollary 30.
Corollary 31.
Lemma 32.
Lemma 33.
Lemma 34.
Lemma 35.
Lemma 36.
Proof.
Lemma 37.
Lemma 38.
Lemma 39.
Lemma 40.
The upsidedown flipped version of (EU) is just itself.
With the Euler decomposition rule, we can now prove Lemma 41.
Lemma 41.
Lemma 42.
Lemma 43.
The last remaining rule is (ZO), which can now be derived as in [BPW17].
Lemma 44.
We have now proved all the explicitlystated rewrite rules of the zxcalculus as contained in Figure 2. It remains to show that the ‘only the topology matters’ metarule can be derived from our assumptions.
To do this, we first prove various symmetry properties of dots: they are commutative, i.e. invariant under swapping any two inputs or two outputs, and inputs can be bent into outputs, or conversely.
Lemma 45.
Proof.
The obvious rewrite rule for removing a wire crossing is (B2). We rewrite the diagram until that can be applied, using (S2), the spider rules, and the Hopf law (which is used twice, symmetrically). This covers the rewrite steps in the top row. The rule (B2) is applied over the line break.
We then use the spider rule, the Hopf law again, the upsidedown copy law, and (S2) to simplify the diagram again, thus completing the proof. ∎
Lemma 46.
Proof.
We have upsidedown versions of all the rules used in the proof of that the green cocopy map is commutative (Lemma 45). That proof can therefore be straightforwardly repeated upsidedown. ∎
The colourswapped versions of the above Lemmas also hold:
Lemma 47.
Proof.
We now show that the distinction between inputs and outputs of dots does not matter. By the spider rules, it suffices to consider ternary dots.
Lemma 48.
Proof.
Use (S3) and the spider rule:
(48) 
By commutativity of dots, it does not matter which input is bent. ∎
Similar arguments apply for bending inputs to the left rather than to the right, for bending outputs into inputs (in either direction), and for red rather than green dots.
Theorem 49.
Proof.
The topology rule states that two diagrams are equal if they are isomorphic, i.e. if it is possible to transform one into the other by moving components around while keeping their connections the same.
To show that the topology rule follows from the new set of rewrite rules and the assumption of a compact closed category, we thus need to show that none of the following matter for the interpretation of a diagram:

the position of nodes in the plane,

whether a wire is straight or curved,

whether a wire is an input or an output for a given node, and

the order in which wires are incident on a given node.
First, note that in graphical calculi for monoidal categories, horizontal distance does not carry information: only the order of components does. Still, using the naturality of the swap map, the horizontal order of internal nodes can be changed, e.g.:
(49) 
Similarly, the vertical distance of components does not matter as wires are identity maps and can therefore be arbitrarily long or short. The only situation in which changing the vertical position of a node could cause problems is the following: consider two nodes and and assume there is a wire that is an output of and an input of . That implies that must be further ‘up’ in the diagram than if the wire is to be drawn as a straight line. But by the snake rules, wires may curve, therefore the problem can be resolved as shown in the following example, where the green node is and the red one :
(50) 
Usually, inputs for the diagram as a whole are found at the top and outputs at the bottom. Additionally, the horizontal order of inputs (or outputs) is used to distinguish them. Nevertheless, if some other identifying decoration is added to input/output vertices, they too can be moved around without loss of information. Thus, the position of nodes in a diagram can be changed at will without changing the interpretation of the diagram, i.e. it is not relevant information.
Next we need to show that the only relevant information about wires is which nodes they connect. By commutativity of dots (Lemmas 45, 46, and 47), the order in which the wires are incident on a node does not matter. Because of the selftranspose property of the Hadamard node (Lemma 11) and the ability to bend inputs of dots into outputs or conversely (Lemma 48), it is not necessary to distinguish whether a wire is an input or an output for a given node. Finally, the snake rules allow curved wires to be straightened or conversely, so the shape of wires does not matter. The only remaining relevant piece of information about a wire is its end nodes.
Components in a diagram can therefore be moved around at will, and wires curved or straightened, without changing the interpretation: i.e. two diagrams that are isomorphic represent the same matrix. ∎
We have shown that all the rewrite rules in Figure 2 along with their colourswapped and/or upsidedown counterparts can be derived from the rules in Figure 1 together with (S2) and the axioms of a compact closed category. Furthermore, we have shown in Theorem 49 that the topology meta rule can also be derived. As the rules of Figure 2 together with the topology meta rule are known to be complete for the stabilizer zxcalculus, this implies that the rules in Figure 1 together with (S2) and the axioms of a compact closed category are also complete for the stabilizer zxcalculus, which is the claim of Theorem 6.
Appendix B Proofs for zxcalculus in braided autonomous category
First note that we still have the Hopf law (19) as long as we replace the twist and (B2) with their braided versions (R1) and (B2), respectively, in the proof of Lemma 21. Thus, we have a braided version of (B2) and its colourswapped version:
(51) 
Now we can prove the braided commutativity of green cocopy:
Lemma 50.
The green cocopy map is braided commutative:
(52) 
Proof.
The obvious rewrite rule for removing a wire crossing is the braided (B2), i.e, (51). We rewrite the diagram so that can be applied, using (S2), the spider rules, and the Hopf law (which is used twice, symmetrically). This covers the rewrite steps in the top row. (51) is applied over the line break.
We then use the spider rule, the Hopf law again, the upsidedown copy law, and (S2) to simplify the diagram again, thus completing the proof. ∎
Lemma 51.
The green copy map is braided commutative:
(53) 
Proof.
We have upsidedown versions of all the rules used in the proof of that the green cocopy map is braided commutative (Lemma 50). That proof can therefore be straightforwardly repeated upsidedown. ∎
The colourswapped versions of the above Lemmas also hold:
Lemma 52.
Both the red copy and cocopy maps are braided commutative:
(54) 
Proof.
Once we have the braided commutativity of green cocopy, the inversely braided commutativity can be obtained immediately:
Lemma 53.
The green cocopy map is inversely braided commutative:
(55) 
Proof.
Here we used the inverse property of the braiding and Lemma 50. ∎
As a consequence, we have inversely braided commutativity of green copy, red copy and cocopy.
Lemma 54.
The maps of green copy, red copy and cocopy are inversely braided commutative:
(56) 
With the 3D isotopy of diagrams in a braided autonomous category, we derive the inversely braided version of (B2).
Lemma 55.
The braided bialgebra rule holds with the inverse braiding:
(57) 
Proof.
Lemma 56.
The braiding is in fact symmetric.
Proof.
Begin by rewriting the diagram until the braided bialgebra rule can be applied, using the Hopf law and the spider rules:
We then apply the inversely braided bialgebra rule and reverse the initial rewrite steps. ∎
Comments
There are no comments yet.