{'fraction_non_alphanumeric': 0.03414436586809558, 'fraction_numerical': 0.00831801613757438, 'mean_word_length': 4.332225913621262, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Making the stabilizer ZX-calculus complete for scalars

The ZX-calculus is a graphical language for quantum processes with built-in rewrite rules. The rewrite rules allow equalities to be derived entirely graphically, leading to the question of completeness: can any equality that is derivable using matrices also be derived graphically? The ZX-calculus is known to be complete for scalar-free pure qubit stabilizer quantum mechanics, meaning any equality between two pure stabilizer operators that is true up to a non-zero scalar factor can be derived using the graphical rewrite rules. Here, we replace those scalar-free rewrite rules with correctly scaled ones and show that, by adding one new diagram element and a new rewrite rule, the calculus can be made complete for pure qubit stabilizer quantum mechanics with scalars. This completeness property allows amplitudes and probabilities to be calculated entirely graphically. We also explicitly consider stabilizer zero diagrams, i.e. diagrams that represent a zero matrix, and show that two new rewrite rules suffice to make the calculus complete for those.


Introduction
Graphical languages provide high-level and intuitive formalisms for quantum processes. The ZX-calculus is one such language for pure qubit quantum mechanics, based on category theory [4]. It has some features in common with quantum circuit notation, but unlike the former it also seamlessly integrates the representation of states and post-selected measurements. Furthermore, the ZX-calculus comes with a built-in set of rewrite rules that allow equalities to be derived graphically without the need to translate back to matrices.
The existence of rewrite rules for the ZX-calculus means that this graphical calculus can potentially be used to replace matrix-based formalisms entirely for certain classes of problems. However, this replacement is only possible without losing deductive power if the ZX-calculus is complete, i.e. if any equality that is derivable using matrices can also be derived graphically.
The overall ZX-calculus for pure state qubit quantum mechanics is incomplete, and it is not obvious how to complete it [11]. Yet the scalar-free ZX-calculus for pure qubit stabilizer quantum mechanics is known to be complete [2]. Stabilizer quantum mechanics is a fragment of quantum theory that exhibits many important quantum properties, like entanglement and non-locality. It is of central importance in areas such as quantum error correcting codes [8] and measurement-based quantum computation [9].
There is one class of diagrams that the completeness proof in [2] ignores completely: those representing scalars. In fact, some of the rewrite rules used in the proof are only true up to a non-zero scalar factor. The existing completeness proof also passes over the issue of zero diagrams, diagrams representing a zero matrix, relying implicitly on the fact that, within the stabilizer fragment of the ZX-calculus, such diagrams can be easily recognised.
Here, we put the scalars back into the ZX-calculus and show how to extend the completeness result to pure scalar diagrams as well as diagrams consisting of a scalar part and a non-scalar part. To do this, we introduce a new type of ZX-diagram element called the star node and a new rewrite rule relating the star node to existing ZX-calculus elements. The new completeness result enables the stabilizer ZX-calculus to be used to compute amplitudes and probabilities. We also show explicitly how to recognise stabilizer zero diagrams. The introduction of two new rewrite rules for zero diagrams allows the definition of a unique normal form for zero diagrams, and thus makes the ZX-calculus complete for stabilizer zero diagrams.
The background for the new completeness proofs is given in Section 2. This includes a quick introduction to the elements and rules of the ZX-calculus, as well as an overview of the original stabilizer completeness proof. Section 3 contains the definitions of new ZX-calculus components and rules. The new completeness results can be found in section 4. An example application for the new results is given in Section 5. Finally, we state some conclusions and ideas for further work in Section 6.

The stabilizer ZX-calculus
The ZX-calculus is a graphical language for pure state qubit quantum mechanics with post-selected measurements, introduced by Coecke and Duncan [4,5] and expanded by Duncan and Perdrix [6]. Here, we are considering only the ZX-calculus for stabilizer quantum mechanics [8], the fragment of pure qubit QM consisting of the following set of operations: • preparation of states in the computational basis • unitary Clifford operations, generated by the single-qubit Hadamard operator, H, and the phase operator, S, as well as the two-qubit controlled-NOT operator, • measurements in the computational basis.
In the following sections, we give a quick introduction to the elements of a stabilizer ZX-calculus diagram, their interpretations, and the rewrite rules. More details about the ZX-calculus can be found in [5,2].

Elements of the stabilizer ZX-calculus and the interpretation of diagrams
A stabilizer ZX-calculus diagram consists of different types of nodes connected by edges. There are three types of nodes: green nodes with arbitrary numbers of inputs and outputs and a phase label α ∈ {0, π/2, π, −π/2}, red nodes with arbitrary numbers of inputs and outputs and a phase label β ∈ {0, π/2, π, −π/2}, and yellow Hadamard nodes, which always have exactly one input and one output.
The matrix corresponding to a ZX-calculus diagram D is denoted by D . The basic nodes have the following interpretations: . . .    where |± = 1 √ 2 (|0 ± |1 ), and the zero-fold tensor product of any normalised bra or ket is taken to be the scalar 1.
Diagrams are read from bottom to top, i.e. edges connecting to a node or diagram at the bottom are inputs, edges connecting at the top are outputs. Zero phase angles are often left out, i.e. is the same as 0 . A diagram with no inputs and at least one output is a state, e.g. π or . Similarly, a diagram with neither inputs nor outputs is a scalar. Examples of scalar diagrams are −π/2 , π/2 π/2 π/2 π/2 , or A diagram with inputs but no outputs is an effect. Red or green nodes with exactly one input and one output are called phase shifts, e.g. −π/2 . Putting diagrams side by side corresponds to taking the tensor product of their matrix equivalents; connecting inputs and outputs corresponds to matrix multiplication. The Hermitian adjoint of a diagram can be found by flipping the original diagram upside-down and flipping the signs of all phase angles.

Rewrite Rules
The ZX-calculus was originally defined with rewrite rules that are true up to a complex phase e iφ for some φ ∈ [0, 2π) [5]. The normalising factors were later dropped, meaning that any equalities derived graphically hold up to some non-zero complex scalar factor.
The standard rewrite rules of the ZX-calculus include two implicit rules: "ignore all non-zero scalars" and "only the topology matters".
The former rule allows any non-zero scalar subdiagram to be replaced by the empty diagram; when we put the scalars back, in the later parts of this paper, we will obviously no longer be using this rule. The topology rule means that the interpretation of a diagram depends only on the elements and the structure of their connections: nodes can be moved around and edges can be bent or straightened without changing the meaning of the diagram. This rule remains valid in the scaled ZX-calculus. We now give the standard set of rewrite rules for the ZX-calculus, using the following two short-hand conventions: firstly, any rule also holds with the colours red and green swapped. Secondly, any rule also holds when flipped upside-down.
Spider rule, loop rule, and cup rule: Two nodes of the same colour can merge if they are connected by an edge, in that case their phases add. Self-loops can be removed. A node with two outputs and no inputs is the same as an edge bent into the shape of a cup.

=
Bialgebra rule, copy rule, and colour change rule: The bialgebra rule allows a certain pattern of two red and two green nodes to be replaced by just one red and green node. A node of one colour with one input and two outputs copies the zero phase state of the other colour. The Hadamard node swaps the colour of red and green nodes when it is applied to each input and output. π-copy rule, π-commutation rule, and Euler decomposition of the Hadamard operator: A π phase shift is copied by a node of the other colour. It can also be moved past any phase shift of the other colour, flipping the sign of that phase in the process. The Hadamard node can be replaced by three green and red nodes of alternating colours, each with phase π/2. = π . . . π . . . π α = π −α π π/2 H = π/2 π/2 Whenever a rule holds for any number of edges, that number may be zero. For example, the colour change rule with zero inputs and zero outputs implies that α = α for any α.
Further rewrite rules can be derived from the above, e.g. the fact that H is self-inverse.

The original stabilizer ZX-calculus completeness proof and two corollaries
By completeness, we mean the following concept.
Definition 1. The ZX-calculus is complete for a subtheory of pure qubit quantum mechanics if any equality that holds in the matrix formulation of that theory can also be derived graphically.
The scalar-free stabilizer ZX-calculus completeness proof [2] is based around a normal form for stabilizer state diagrams, i.e. diagrams that have outputs but no inputs. This normal form is not unique, but it is straightforward to derive any equalities between diagrams given in normal form. By map-state duality, the completeness result extends to diagrams that have inputs as well as, or instead of, outputs.
The original completeness proof drops any scalar subdiagrams by the "ignore all non-zero scalars" meta-rule. If we instead keep track of scalars, we can use the normal form proof to derive results about scalar diagrams via the following trick: rewrite any connected scalar diagram into the inner product between some (possibly complicated) one-qubit state and . The "state" part can then be normalised using the algorithms given in the completeness proof. This approach leads to the following results, which were implicit in [2] and are stated explicitly here. Proofs of the corollaries are given in Appendix A.
Corollary 1. Any stabilizer scalar diagram can be decomposed into disconnected segments containing at most two nodes each.
Corollary 2. When a stabilizer zero diagram, i.e. any stabilizer diagram that represents a zero matrix, is brought into normal form and all scalar subdiagrams are decomposed as in Corollary 1, the resulting diagram explicitly contains at least one of In the scalar-free ZX-calculus, it is straightforward to show that the four scalars given in (1) are all equal to each other. We will show in Section 4.3 that they can also be rewritten into each other in the scaled ZX-calculus.
Corollary 1 implies that in order to prove completeness for stabilizer scalar diagrams, it suffices to look only at diagrams made up of small disconnected segments. Corollary 2 shows that there is an algorithm for deciding whether a diagram in the stabilizer ZX-calculus is a zero diagram. This is necessary if we want to consider non-zero diagrams only, and has already been implicitly assumed in the scalar-free completeness proof.

Putting the scalars back in
Building on the scalar-free stabilizer ZX-calculus completeness proof, we now show how to "put the scalars back in" and make the stabilizer ZX-calculus complete for scalar diagrams and scaled operators, as well as for zero diagrams. To do this, we first modify the rewrite rules to be exactly true (not just up to scalar factor). We then argue that a new node is required to make the calculus complete for non-zero scalars. Introduction of this node and a new rewrite rule for it allows us to prove completeness for nonzero stabilizer scalars. Finally, we prove a normal form theorem for zero diagrams, based on a further two new rewrite rules specifically for diagrams containing the zero scalar.

Normalisation of scalar diagrams in the ZX-calculus
The basic states and effects in the ZX-calculus are not normalised to 1, e.g.: and similarly for nodes with more outputs. This normalisation was chosen to avoid having to include normalising factors in the spider law. As a result, inner products of a red state and green effect (or conversely) are either zero or have norm strictly greater than 1. For example: The node-free loop is also a scalar. By the cup rule and the loop rule:

Modified rewrite rules
Some of the rewrite rules for the ZX-calculus as given in section 2.2 are sound only when equality is taken up to a non-zero scalar factor. Other rewrite rules are already correctly scaled. We now give the corrected versions of those rewrite rules that need modification. For some cases, this means going back to the original form of the rewrite rules introduced in [5], before scalars were dropped. This applies to the bialgebra rule and the copy rule: as well as the Hopf law 1 : Two other rules are normalised, but require the introduction of a complex phase factor in order to hold exactly. These rules were originally introduced without any scalar factors. There is no unique way of making them exact: the complex phase could be put on one side of the equation, or the other, or even split between the two. We choose the convention of putting the complex phase on the right-hand side, resulting in the following rules: • the π-commutation law: • and the Euler decomposition of the Hadamard: Additional real scalars have been added to the left-hand side of the equations to preserve the normalisation, cf. (3). The other rules listed in section 2.2 are correctly scaled in the form given there. Both corollaries of the original stabilizer completeness proof continue to hold under the scaled rewrite rules, unless keeping track of scalars stops us from applying a rewrite rule whose unscaled counterpart does apply.
Example. Consider the following diagram: .
Using the scalar-free rewrite rules, this can be rewritten to . Yet using the scaled rewrite rules, the diagram cannot be rewritten, as the copy rule now requires a factor of .
If all scalars are invertible, this problem disappears: given an inverse for , we could just add both that scalar and the inverse to the diagram in (8) and then apply the copy rule, as in the following example.
Example. Suppose the scalar diagram s is the inverse of . Graphically, this is expressed as follows: since the empty diagram represents the scalar identity: = 1. Using (9) and the fact that any ZXcalculus diagram contains the empty diagram as a subdiagram, we can derive: The non-scalar part of the diagram has thus been transformed in the desired way.
As seen in section 3.1, no simple ZX-calculus diagram built from just a few of the existing nodes can be the inverse to . We will therefore introduce a new node type. To keep the number of rewrite rules small, it will be more convenient to define this new node as the inverse of rather than ; the inverse for the latter can then be derived. Definition 2. Let be a new node type called star node with no inputs or outputs. The star node is defined as the inverse of , i.e. it obeys the following rewrite rule, called star rule: Lemma 3. Definition 2 is consistent with the interpretation = 1 2 .
Lemma 4. The star node is also inverse to : = . (12) Proof. Using the star rule, loop rule, cup rule, spider rule, and Hopf rule, we have: Thus the desired equality follows directly from the star rule.
With and (12), application of the scaled bialgebra, copy, and Hopf rules can never fail because of normalisation problems. In the following section, we show that, given the star node and star rule, the scalars appearing in the π-commutation and Euler rules also have inverses. Thus the completeness proof for non-scalar diagrams and its corollaries still hold if we replace the original rewrite rules with the scaled versions and add and the star rule to the calculus.

A normal form for non-zero stabilizer scalars
In this section, whenever we talk about scalars, we mean non-zero stabilizer scalars. Using Corollary 1 and Lemma 3, it is straightforward to show the following.
We will define a normal form for scalar diagrams as follows: Pick one representative diagram for each s ∈ {0, 1, . . . , 7} from (14). Combine these with the smallest number of copies of and/or required to achieve the correct normalisation.
The simplest representative for s = 0 is the empty diagram.
Proof. Apply the interpretation map to each diagram in turn, ignoring normalisation.
Lemma 7. Let r be an integer. Then the scalar √ 2 r can be represented by one of the following ZXcalculus diagrams: • for r > 0, r copies of , • for r = 0, the empty diagram, • for r < 0 and r even, |r| /2 copies of , and Making the stabilizer ZX-calculus complete for scalars • for r < 0 and r odd, one copy of and (1 − r)/2 copies of .
Proof. It is straightforward to check the interpretations of the given diagrams.
In fact, any diagram consisting solely of copies of and can be brought into the normal form given in Lemma 7 by applying (12) as many times as possible.
We will now state and prove the normal form theorem for non-zero scalars. For ease of understanding, some parts of the proof are given as separate lemmas, which are stated after the main theorem. The proofs of those lemmas, as well as a full proof of the main theorem, can be found in Appendix B. Theorem 8. Any non-zero stabilizer scalar diagram in the ZX-calculus can be uniquely represented as a combination of one of the diagrams in (15) or the empty diagram with one of the diagrams listed in Lemma 7.
Proof (sketch, full proof in Appendix B). By Corollary 1 and Lemma 12, any scalar diagram can be written in terms of star nodes and diagrams of the form α β for some α, β ∈ {0, π/2, π, −π/2}. Using Lemmas 9 and 11, any scalar diagram can be further rewritten to a combination of elements of the following set: Any diagram built from these components can be brought into the desired normal form via Lemmas 10 and 13.
Lemma 9. The inner product between a red and a green node with phase angles α and β is defined only by the set {α, β }, it does not matter which label is assigned to the green and which to the red node, or whether it is a green state and red effect, or conversely. Diagrammatically: Lemma 10. For any pair of phase angles α and β , the complex phases resulting from the inner product of π with phased green effects can be combined into just one subdiagram and a normalising factor : Lemma 11. For any phase angle α, the inner product of a green effect of phase α with is equal to : Lemma 12. The states π/2 and −π/2 are equal up to a complex phase: Lemma 13. The scalar diagrams −π/2 −π/2 and π/2 π/2 are inverse to each other: −π/2 −π/2 π/2 π/2 = . (21)

Completeness for scaled operators
Given the completeness result for non-scalar stabilizer ZX-calculus diagrams [2] and the normal form for scalar diagrams derived in Theorem 8, we can now derive equalities between diagrams that have both scalar and non-scalar parts.
Theorem 14. The ZX-calculus with scaled rewrite rules, including and the star rule, is complete for non-zero scaled diagrams, i.e. diagrams that contain both scalar and non-scalar parts.
Proof. Given two scaled diagrams D and D , first apply the algorithm from the completeness proof for non-scalar diagrams, except rather than dropping the scalars, keep track of them. Use the invertibility of scalars to make sure that any rewrite rule required for this process can be applied. If the non-scalar parts of the diagrams are not equal, clearly the scaled diagrams are not equal. Otherwise, proceed by bringing the scalars into normal form as described in Theorem 8. This normalisation does not change the non-scalar part of the diagram. If the two resulting diagrams are equal, some of the rewrite steps can be inverted to find a series of rewrites transforming D into D (or conversely), thus proving that the two diagrams are equal according to the rules of the graphical calculus. Otherwise, the two diagrams must represent different operators, as multiplying the same operator by two different scalars yields two different operators.

Completeness for stabilizer zero diagrams
We have shown that the stabilizer ZX-calculus is complete for scaled diagrams as long as they are nonzero. By Corollary 2, any stabilizer zero diagram can be rewritten to explicitly contain one of the following scalar diagrams as a subdiagram: Of course the calculus does not actually contain four distinct representations of 0, as shown in the following lemma.
Lemma 15. Any diagram that contains one of the subdiagrams in (22) can be rewritten to contain π .
Given the set of rewrite rules listed so far, the stabilizer ZX-calculus cannot be complete for zero diagrams as there are no specific rewrite rules involving the zero scalar. The following new rewrite rule was suggested to resolve this issue [7]: This zero rule allows any zero diagram to be transformed into a completely disconnected diagram. In the scalar-free ZX-calculus, which was the original context for the introduction of the zero rule, that is sufficient to derive a normal form for zero diagrams. To make the scaled stabilizer ZX-calculus complete for zero diagrams, we will need to introduce an additional zero scalar rule: for any α.
Theorem 16. The scaled stabilizer ZX-calculus with , the star rule, the zero rule, and the zero scalar rule is complete for zero diagrams.
Proof. We will show that with the given rules any zero diagram with n inputs and m outputs can be rewritten into the following normal form: First, note that the normal form is clearly unique as a zero matrix, the interpretation of any zero diagram, is fully determined by its dimensions. Now, to rewrite a zero diagram into normal form, first apply the Euler decomposition rule to remove all Hadamard nodes. Apply the spider rule until all remaining edges are between one red and one green node. Then apply the zero rule (or its upside-down equivalent, depending on how the colours match up) to each edge, transforming the diagram into a completely disconnected graph where the only remaining edges are inputs and outputs of the diagram. Further applications of the zero rule (upside-down or not) can be used to change the colour of the nodes connected to inputs or outputs. Other than one copy of π , any disconnected red and green nodes can be removed using the zero scalar rule. Finally, any copies of can be removed by using the zero scalar rule to create a new copy of , and then applying the star rule. This leaves the diagram in the normal form (26).
As all rewrite rules are invertible, this implies that any two zero diagrams with the same numbers of inputs and outputs can be rewritten into each other. Therefore the ZX-calculus is complete for stabilizer zero diagrams.
Many of the results derived in this paper are not actually specific to stabilizer diagrams. In fact, given the zero and zero scalar rules, any diagram that explicitly contains π can be brought into the normal form given in (26). Nevertheless, Theorem 16 only holds for stabilizer zero diagrams, as, e.g. using the incompleteness example in [11], we can construct non-stabilizer zero diagrams which cannot be rewritten to contain π as a subdiagram, and without a copy of π the normalisation process described in the proof of Theorem 16 does not work.

Example: Quantum key distribution
Consider the BB84 protocol for quantum key distribution using a two-qubit Bell state [3]: Alice and Bob each hold one half of the entangled state, and they each randomly decide to measure their qubit in either the computational basis {|0 , |1 } or the Hadamard basis {|+ , |− }. They later compare their choice of basis over a classical communication channel, e.g. a telephone line. Assuming the Bell state is 1 √ 2 (|00 + |11 ), if they have picked the same basis, their results always agree and they have a key; if they have picked different bases, their results are uncorrelated. We are not interested in the security properties of this key distribution scheme here, instead we simply use it as motivation for some ZXcalculus derivations since all the states and operations required for the protocol are in the stabilizer formalism.
The Bell state given above is represented in the ZX-calculus as a "cup" with some normalising factors: Measurements in the ZX-calculus are post-selected, so we have to consider each pair of measurement outcomes in turn. Graphically, the normalised outcomes of computational and Hadamard basis measurements on single qubits are: First, assume Alice and Bob both measure in the computational basis. Can they both get outcome 0? Constructing the ZX-calculus diagram for the overlap between the Bell state and 00| and then simplifying it using (9), the topology rule, the spider rule, and the star rule, yields: which is non-zero, so this outcome is possible. The probability of this outcome can be found by multiplying this amplitude with its dagger, graphically: i.e. the probability of Alice and Bob both measuring 0 is = 1/2. Similarly, the overlap of the Bell state with the effect 11| is, graphically: so the probability of Alice and Bob both getting measurement outcome 1 is again 1/2. On the other hand, if we consider whether Alice can get 0 while Bob gets 1, we find the following: where the penultimate equality is by the zero rule and the last one by the star and colour change rules. As π = 0, that combination of outcomes is impossible.
If Alice measures in the computational basis and Bob in the Hadamard basis, the probability of Alice getting outcome θ and Bob getting φ for some fixed θ , φ ∈ {0, π} is: where the penultimate equality is by Lemmas 10 and 11. Thus if Alice and Bob choose different bases, their outcomes are random and uncorrelated: each of the four combinations of outcomes has probability = 1/4.

Conclusions
Completeness is the property of a graphical language for quantum processes of having the same deductive power as matrix mechanics. We show how the introduction of a new type of ZX-calculus element, called star node, along with a new rewrite rule relating the star node to existing ZX-calculus elements, allows the scalar-free stabilizer completeness proof to be extended to include non-zero scalars. The ZX-calculus can thus be used to compute amplitudes and probabilities. Furthermore, we show that, as implicitly assumed in the scalar-free completeness proof, it is straightforward to recognise stabilizer zero diagrams, and that two new rewrite rules suffice to derive a unique normal form for these zero diagrams.
These results allow any problem in pure stabilizer quantum mechanics to be analysed entirely graphically, including questions about inner products between pure states or probabilities associated with pure projective measurements. Thus, as a next step, procedures for solving such problems could be implemented in the automated graph rewriting system Quantomatic [1], which can rewrite ZX-calculus diagrams either fully independently or in a user-guided manner. It would also be interesting to see whether the completeness results can be extended to mixed states and completely positive operators, for example via the CPM construction [10]. Work is ongoing to prove completeness results for other fragments of pure state qubit quantum mechanics. Proof of Corollary 1. Take any connected component of the scalar diagram which contains more than two nodes. Rewrite it into the inner product between some (possibly complicated) state diagram and . This can be done for any connected scalar diagram by decomposing it into basic spiders. As is the only basic spider with no outputs, the scalar must contain at least one copy of (or a cap, which can be rewritten into spiders).
The state diagram part, which represents a single-qubit state, can then be brought into GS-LC form. Any scalar subdiagrams that "split off" the main part of the diagram in this rewriting process consist of disconnected segments containing at most two nodes each, as can easily be checked by looking at the rewrite rules and the proofs of Lemmas 8-12 in [2]. Up to scalar factor, the six single-qubit stabilizer states can be written as: , π/2 , π , −π/2 , , and π .
By the scalar-free stabilizer completeness result, any diagram representing a single-qubit state can be rewritten to one of the above single-node diagrams. This node combines with the green effect into a two-node diagram.
When the scaled rewrite rules are used instead of the scalar-free ones, Corollary 1 remains valid because the scalars appearing in the rewrite rules all consist of disconnected components with at most two nodes each.
Proof of Corollary 2. A GS-LC diagram in the scalar-free ZX-calculus cannot be zero as it consists of unitary operators -controlled-Z gates and single-qubit unitaries -applied to the state . . . . Therefore, a scaled GS-LC diagram is zero if and only if its scalar part is zero. Now, for any two scalar diagrams s and r , s r = s r , i.e. putting two scalar diagrams next to each other corresponds to taking the product of their values. Thus a scalar diagram is zero if and only if at least one of the disconnected components is zero. It is straightforward to check that out of all connected scalar diagrams containing at most two nodes, the diagrams given in (1) are exactly the ones that are zero. The result then follows from Corollary 1 and the fact that any stabilizer diagram can be brought into GS-LC form.

B Proofs of theorem and lemmas from Section 4
Proof of Theorem 8. By Corollary 1, we only need to consider diagrams made up of disconnected segments of at most two nodes each. Using Lemma 12, any disconnected single node α or β can be rewritten into a diagram that is made up of copies of and components consisting of exactly one red and one green node. Given this, Lemmas 9 and 11, and the fact that we are considering non-zero diagrams only, we can restrict our attention without loss of generality to diagrams built only from , , and the following two-node diagrams: π/2 π/2 , π/2 π , π π , −π/2 π , and −π/2 −π/2 .
These diagrams can easily be seen to also be in the set (15). Thus all that remains to show is that a diagram consisting of several of these elements can be rewritten to a diagram that consists of only one of the diagrams given in (15) (or the empty diagram) plus any number of copies of and . This rewriting can be done in a step-by-step fashion, so it suffices to look at pairs of diagrams from (35). The combination of any two diagrams that both contain π can be simplified using Lemma 10. The products π/2 π/2 −π/2 −π/2 , π/2 π π/2 π/2 , and −π/2 π −π/2 −π/2 are straightforward as well: the first diagram is shown to be simplifiable in Lemma 13, the latter two are elements of (15), so do not need to be simplified. For other combinations, note first that using the spider rule, the π-copy rule, and the π-commutation rule, we have: π = −π/2 π −π/2 −π/2 −π/2 = −π/2 −π/2 = −π/2 π/2 π −π/2 = π π/2 −π/2 π/2 .
Equalities similar to (36), (37), and (38) can be derived with all the signs flipped. This covers all the combinations of two diagrams from (35). More complicated diagrams can be dealt with step-by-step. Once the subdiagrams that involve complex phases are normalised, the real parts of the diagram can be brought into the normal form given in Lemma 7.
The resulting normal form for complex non-zero scalars can easily be seen to be unique.
Proof of Lemma 9. The first equality results from the topology meta rule. The equality between the second and third diagram follows from the colour change rule and the fact that the Hadamard node is self-inverse: The last equality is again by the topology meta rule.
Proof of Lemma 10. We have: using the copy rule, π-copy rule, and spider rule.