Unifying flavors of fault tolerance with the ZX calculus

There are several models of quantum computation which exhibit shared fundamental fault-tolerance properties. This article makes commonalities explicit by presenting these different models in a unifying framework based on the ZX calculus. We focus on models of topological fault tolerance - specifically surface codes - including circuit-based, measurement-based and fusion-based quantum computation, as well as the recently introduced model of Floquet codes. We find that all of these models can be viewed as different flavors of the same underlying stabilizer fault-tolerance structure, and sustain this through a set of local equivalence transformations which allow mapping between flavors. We anticipate that this unifying perspective will pave the way to transferring progress among the different views of stabilizer fault-tolerance and help researchers familiar with one model easily understand others.


Introduction
The introduction of Kitaev's toric code in 1996 [1] has spurred a host of research in fault-tolerant quantum computation and topological condensed-matter physics.Whereas a quantum error-correcting code describes how information is protected at a given instant (snapshot), fault-tolerant computing describes an interactive process through which classical control can repeatedly operate on encoded quantum information without ever leaving relevant observables unprotected.In this article, we compare the description of quantum memory, the simplest fault-tolerant primitive, as described in the following four models: 1. Circuit-based quantum computation (CBQC).In this model [2], the quantum computer is an array of physical qubits, often arranged on a 2D grid.It is possible to perform single-qubit gates and measurements, as well as entangling two-qubit gates, usually between nearest neighbors in the grid.A quantum memory is implemented by using these operations to repeatedly measure the surface-code stabilizer operators.The measurement outcomes are used to detect and correct errors corrupting the physical qubits, as well as errors in the measurement outcomes.In the absence of noise and errors, all stabilizer measurement outcomes involved in fault tolerance have predetermined outcomes, i.e. there is no intrinsic randomness in the outcomes.

2.
Measurement-based quantum computation (MBQC).In this model [3][4][5], a quantum computation consists of two steps.First, a large initial entangled state is prepared.Roughly speaking, the number of physical qubits in this model corresponds to a product of the number of physical qubits in the circuit model multiplied by the number of circuit time steps for which they are present.The initial entangled state, usually referred to as the cluster state, can be prepared from a product state by a constant-depth Clifford circuit which is, to a large extent, independent of the target computation.In the second step, qubits are consumed by single-qubit measurements as the computation progresses.Measurement outcomes in fault-tolerant MBQC are used to diagnose errors in both preparation and measurement.A feature which distinguishes MBQC from CBQC is that individual measurement outcomes are intrinsically random, even in a noiseless setting.
3. Fusion-based quantum computation (FBQC) [6].Here, a quantum computer is thought of as a collection of resource-state generators that repeatedly produce copies of small few-qubit entangled states (resource states).The size of these resource states is constant and does not depend on the quantum algorithm or the code distance.In contrast, the total number of resource states will scale with the size of the computation.Complementary to resource-state generation is resource-state consumption, referred to as fusion, which consists of entangling two-qubit (or multi-qubit) measurements between two (or more) such resource states.This can be used to successively teleport the encoded logical state into fresh resource states and advance the computation.As with teleportation, many of the measurement outcomes are expected to be individually random.Characteristic to this approach is that qubits are dynamically created and destroyed throughout the computation by resource state generation and by fusion measurements respectively.This is naturally suited to photonic qubits which are destroyed after measurement.
4. Floquet-based quantum computation (FloBQC).This is a relatively recent development also referred to as pair-measurement codes [7][8][9][10][11][12].As in CBQC, the base model assumes a fixed set of physical qubits which evolve in time with the aid of projective parity measurements on qubit pairs.However, as in FBQC, these schemes yield measurement outcomes which are random when viewed independently and only two-qubit measurements are present.This model of computation is motivated by the elusive Majorana qubits [13], on which researchers expect joint parity measurement, rather than entangling unitary gates, to be natural operations.
In this manuscript we clarify how the stated collection of protocols are part of the same happy family of topolog- ical stabilizer fault tolerance, even though the four models of computation feature completely different physical operations.A key aspect of our viewpoint is the importance of thinking of fault tolerance holistically in space-time, rather than simply as operations on a code.This viewpoint is prominently advocated for in, e.g., Refs.[14,15].In this view, checks are characterized by the classical outcomes they are derived from and by the errors which can flip them.After providing a self-contained introduction to ZX diagrams with some small additions for the purposes of fault tolerance, we apply these tools to the four different models of computation.

ZX tensor network diagrams
In order to identify the commonalities between these faulttolerant protocols, it is necessary to use a shared language to describe them.Tensor networks provide a convenient common language for this.As is common in tensor network diagrams, edges between tensor nodes represent contraction.The specific notation of ZX diagrams [16][17][18][19] provides a concise way to graphically represent not just the tensor signature, but also the tensor content.While ZX diagrams have an extremely limited number of elementary building blocks, these can be combined (contracted) to represent arbitrary composite qubit tensors [20,21].As we will see, for many relevant tensors on qubits these representations can be remarkably succinct, a point which has already been made in the context of surface code lattice surgery [19].Moreover, small diagram equalities can be used as graphical rewriting rules to transform ZX diagrams into equivalent representa-tions.This sections provides a brief self-contained summary of the ZX diagram features used, a topic for which there already exists good comprehensive documentation [18,22].
Elementary ZX tensor nodes.The main protagonists (elementary tensors or linear maps) of ZX tensor network diagrams are X-spiders (usually colored red or sometimes gray) and Z-spiders (usually colored green or sometimes white), and are shown in Fig. 1a.These are both denoted by circular nodes and may have an arbitrary number of legs corresponding to qubit ports attached to them.Spider nodes are parameterized by a phase α which is assumed to be zero unless explicitly labeled on the node.A third commonly used tensor is the Hadamard unitary tensor H = |0⟩⟨+| + |1⟩⟨−|, which has exactly two ports and is represented by a square node (usually colored yellow) with one port on each side.
States, projections and unitary gates.Figure 1b enumerates all single-qubit stabilizer states (Pauli eigenstates) and projections (also referred to as effects) with their corresponding ZX-diagramatic representation.Many unitary gates also admit a simple description as ZX diagrams.The Hadamard gate is already included as an elementary ZX tensor.Arbitrary phase gates in the computational basis Z α := e iα/2 • e −iαZ/2 can also be represented through a single tensor node, as shown in Fig. 1c.Similarly, a red spider with angle α and one input and output port corresponds to the operator X α .Arbitrary single-qubit unitary gates can be constructed as products of these elementary gates.The two-qubit entangling gates CX (also controlled-NOT or CNOT) in Fig. 1c and CZ in Fig. 2b provide illustrative examples of combining elementary ZX elements into known gates.One may verify that the specified tensor contractions lead to operators which are proportional to the known twoqubit gates.Each of the indices in a tensor can be reoriented from left to right (bra to ket) by contracting with the unnormalized reference state |Ω⟩ := |00⟩ + |11⟩ (respectively ⟨Ω| := ⟨00|+⟨11|); this is equivalent to partial matrix transposition.The reader may complain that vertical contractions as in Figs.1c and 2b are not well-defined as they do not specify which version of the tensors is used (i.e. a (2,1) spider or a (1,2) spider).It turns out that in the case of ZX diagrams, any internal ambiguity in these options is irrelevant, which is a feature discussed in Appendix A.
ZX instruments.It is not possible to describe fault tolerance without some amount of classical information being extracted from the quantum system.At a high level, fault tolerance is the act of extracting the entropy introduced by noise out of the system by means of measurement (before it compromises logical degrees of freedom).States and unitaries alone cannot describe this, as they lack a classical output.We introduce an extension to the ZX-diagrammatic language to include quantum instruments (i.e., measurements and classical outcome generation) which provides enough expressive power to accurately represent stabilizer fault tolerance.We add classical outputs to spiders denoted by thick black lines, as shown in Fig. 1d.Each classical output is a bit b (0 or 1) which determines whether the phase of the spider is α or α + π.As shown in Fig. 1e, this can be used to express single-qubit measurements in terms of ZX instruments.This amounts to projecting onto either one of two orthogo-nal stabilizer states in an outcome-dependent way.In other words, for any fixed outcome configuration, we recover a plain vanilla ZX network.
Note that the instrument notation we use here differs from bastard spiders considered in Refs.[18].We elaborate on this difference in Appendix B.
Some ZX-diagrammatic equations.We provide a list of ZX-diagrammatic identities which we frequently find ourselves using when reasoning about circuits and faulttolerance protocols in Fig. 2a.We mostly use equations in a directed manner, which allows translating diagrams into a canonical form.This reflects our current goal of verifying the equivalence between different flavors of stabilizer fault tolerance.Rigorous and general approaches to equivalence checking of ZX circuits exist [23] but are beyond our scope.The identities shown in Fig. 2a are: • Split and merge: Two simply connected (via a single direct contraction) like-colored spiders with phases α and β can be merged into a single like-colored spider with the same set of outer ports and a phase α + β.
• Duality: A red α-spider is equivalent to a ZX network with a single green α-spider with the same port signature and a Hadamard operator attached to each port.
• Identity: A spider (green or red) with two ports and α = 0 (no phase annotation) is equivalent to a direct connector.This is the identity 1 as an operator, or |Ω⟩ as a state or ⟨Ω| as a projector.Consecutive pairs of Hadamard operators also equal the identity.
Importantly, apart from the identity rule, these rules also work with the proposed extension to ZX instrument networks.The duality rule works by ignoring the classical output when attaching Hadamards.The merge rule can also be generalized to the situation where one of the two likecolored spiders is an instrument.In this case, the resulting merged spider is itself a spider instrument with a single classical outcome.If two like-colored spider instruments are simply contracted, some care needs to be taken in order to apply the merge rule.A merge is possible, as long as only the joint parity of the outcomes is relevant for the composite instrument.In this case, the merge will result in a single logical outcome bit which is the joint parity b 1 ⊕ b 2 (the XOR of original outcome bits b 1 and b 2 ).As we are typically only concerned with the joint parity of the outcomes, the merge reduction summarizes the outcome information in exactly the right way.
Canonical form.All red spiders can be removed and replaced by green spiders with the duality rule.The remaining rules can then be applied repeatedly to reduce the number of overall tensor nodes.In this way, any ZX network can be recast in a unique canonical form. 1 This canonical form will have the following properties: There are no red spiders, no consecutive H operators, no direct connections between green spiders (although they can be indirectly connected via an H), and all green spider have a degree different to 2 (unless α ̸ = 0).
Examples.The example in Fig. 2b shows how a controlled-Z gate can be expressed using two green spiders by applying the duality rule.Figure 2c shows the example of a non-destructive two-qubit Z ⊗ Z measurement.In the circuit model, this can be expressed via an ancilla qubit initialized in the |0⟩ state, two CNOT gates and a single-qubit Z measurement.By expressing this as a ZX diagram and applying the transformation rules, we can reduce it to a diagram with three spiders.Finally, Fig. 2d shows a destructive Bell-basis measurement, i.e., a two-qubit measurement of the Pauli operators Z ⊗ Z and X ⊗ X.There are two bits of classical information b XX and b ZZ which are extracted in a Bell measurement, such that, once the classical outputs are fixed, the ZX instrument in Fig. 2d represents one of four different ZX diagrams.Note that, while later examples will make use of the canonical form, those in Fig. 2 are not in canonical form.
1 By this, we do not mean that any two networks representing an equivalent tensor will reduce to the same representation, but rather, that given a starting ZX network, all reduction sequences which terminate will lead to the same final ZX network.This is the property known as confluence in abstract rewriting systems.

Pauli webs
Conveniently, spider nodes with α = 0 (phaseless) suffice to express most of stabilizer fault-tolerance.This is because all resulting ZX instrument networks represent stabilizer instruments.The entirety of a network can be efficiently described via a stabilizer representation (in addition to the instrument / tensor-network representation [14]).
We develop Pauli webs as a graphical overlay notation to identify the checks and stabilizers of ZX network diagrams.Note that a similar notation has recently been used in Ref. [24].We associate phaseless n-port spider nodes with n stabilizer generators, n − 1 of which are two-body stabilizer generators (Z i Z i+1 for green spiders and X i X i+1 for red spiders), and one additional n-body stabilizer generator (X ⊗n for green spiders and Z ⊗n for red spiders).Spiders with α = π or α = ±π/2 are also captured by the stabilizer formalism.Specifically, green spiders with α = π have a −X ⊗n stabilizer instead of a +X ⊗n , and red spiders −Z ⊗n instead of +Z ⊗n .In the context of Pauli webs, π spiders will support the same web structure as 0-phase spiders apart from specific stabilizer presenting opposite sign.In the context of stabilizer fault-tolerance, many of these signs will be determined at run-time based on actual measurement outcomes.We will use a red and green highlight annotation, to emphasize the contraction/simplification of Z-type (red) and X-type (green) stabilizers.Figure 3a shows how this notation is used to highlight the stabilizer generators of single 5-port spiders.
Similar to how a single n-port spider is associated with n stabilizer generators, a ZX tensor network containing multiple spiders and a total of m unconnected ports (outer ports) is associated with m stabilizer generators.These stabilizer generators can be found via overlay annotations that we refer to as Pauli webs.In order to be consistent with the ZX network they are highlighting, valid Pauli webs need to have the following properties: • An even number of ports are highlighted red for any green spider.
• An even number of ports are highlighted green for any red spider.
• Either all ports or no ports are highlighted green (red) for any green (red) spider.
• For spider instruments, if the classical outcome port is highlighted, then it must be highlight in the color of the spider.
• A Hadamard port is highlighted green if and only if its other port is highlighted red.
These properties are designed to track the stabilizer nature of the ZX tensors.Edges that are highlighted in both red and green are allowed by these rules.The combination of two Pauli webs is also a valid Pauli web, where two overlapping highlights of the same color cancel.If a valid Pauli web of a ZX network has highlighted outer ports, then the highlight for the outer ports represents a stabilizer of the network.In fact, in any phase-free diagram with n outer ports, there are n independent Pauli webs with support on outer ports corresponding to n stabilizer generators.There may be additional independent Pauli webs without support on outer ports corresponding to checks, as described later.
If a network contains π-phases and instrument outcomes, these may be required in order to identify the sign of the resulting network stabilizer.The sign of the stabilizer is set by the parity of the number of π-phase spiders for which the n-body stabilizer is used.If ZX instruments are involved, the sign is further corrected by the parity of the highlighted classical outcomes.Pauli webs allow us to use ZX diagrams to graphically reason about stabilizer states, Clifford gates, Pauli measurements and error-detecting checks, as we illus-trate in the following examples.
Stabilizer states.If a ZX network is representing a state, the outer signature of Pauli webs describes the stabilizers of the state.The example in Fig. 3b shows a circuit for the preparation of a 3-qubit GHZ state (|000⟩ + |111⟩)/ √ 2, which can be reduced to a single green 3-port spider.Since it has three ports, there are three independent Pauli webs, i.e., the single-spider Pauli webs specified in Fig. 3a.These correspond to three independent stabilizer generators Z ⊗Z ⊗1, 1 ⊗ Z ⊗ Z and X ⊗ X ⊗ X of a GHZ state.The second example in Fig. 3c shows the preparation circuit of a 6-qubit ring-shaped graph state, i.e., a 6-ring.The canonical form of the ZX diagram consists of 6 spiders, each contributing one outer port, so 6 independent Pauli webs can be found.The figure shows one of these Pauli webs tracking a ZX network transformation.This highlights the natural one-to-one mapping between Pauli webs in ZX networks that are equivalent up to the transformations described in Fig. 2a.For the 6-ring, the Pauli webs correspond to stabilizer generators of the form Z j−1 ⊗ X j ⊗ Z j+1 where the labeling of qubits follows cyclic ordering.
A general prescription for representing a graph state |G⟩ corresponding to a graph G uses the structure of the graph G as a network.Vertices in G become green spider nodes with one more port than the degree of the corresponding vertex.Edges of G become Hadamard mediated tensor contractions among the corresponding nodes.The prescription provided can be straightforwardly derived from the circuit construction of graph states by applying one CZ gate per edge of G on the state |+⟩ ⊗|G| .
Clifford gates.If a ZX network is representing a unitary Clifford gate U , the outer signature of Pauli webs specifies the gate as follows.If a Pauli web for U is supported with a Pauli operator P in on the input ports and P out on the output ports, this implies a map U P in U † = P out , i.e.P in → P out .The example in Fig. 3d shows the four generating Pauli webs of the ZX diagram of the CNOT gate (since it has four outer ports).If we label the ports as control (c) and target (t), as well as input (in) and output (out), then the four shown Pauli webs correspond to the stabilizers which is precisely the action of a CNOT gate.
Pauli measurements.If a ZX network is representing a projection, the outer signature of Pauli webs describes the Pauli basis of the projection.If these Pauli webs also include classical outputs, then they can be thought of as multiqubit Pauli measurements.The example in Fig. 3e shows the two-qubit measurements XX, Y Y and ZZ, where the Pauli webs associated with the measurements are highlighted.Note that the Pauli web for the Y Y measurement contains edges that are highlighted in both red and green.In Fig. 3f, constructions for the four-qubit XXXX and ZZZZ mea-surements are shown, with the corresponding Pauli webs highlighted.
General Clifford operators.Stabilizer states, Clifford unitaries and stabilizer projections can be generalized to Clifford operators (see Appendix A of Ref. [14]).These are operators C which are specified by Pauli stabilizer equations of the form P out CP in = C (up to a scalar).Contrary to Clifford unitaries, general Clifford operators do not need to be unitary and may also include projections and isometries (such as an encoding circuit), as well as the examples mentioned earlier.
Checks.Finally, a ZX network may also contain Pauli webs that are not supported on any outer ports, i.e., have no outer signature and are completely internal.A non-trivial Pauli web involving instrument outcomes corresponds to a check.They impose parity constraints on the outcome bits in the absence of errors.In fault tolerance, checks are used to diagnose the presence and nature of errors in a physical implementation.A simple example is the measurement of an error-detecting check in a two-qubit repetition code, as shown in Fig. 4a.Here, two ZZ measurements (as in Fig. 2c) in succession give rise to a check, as they must yield the same outcome in the absence of errors.This check can be identified by a Pauli web in the corresponding ZX instrument network, as highlighted in Fig. 4a.In this example, Pauli webs do not teach us anything we did not already know.However, we have found them to be quite a useful bookkeeping tool to understand more complex stabilizer computations.
The fact that the constituent tensors themselves are elementary stabilizer tensors brings the added benefit of Pauli frame symmetry.Namely, the insertion of a π spider node, either as an intentional operation or to represent an error, will not change the stabilizer structure of the network.It will only flip the signs for a well defined set of check generators and network stabilizers.Similarly, the post-selection upon any valid (compatible with checks) outcome configuration for ZX instruments, will lead to the same stabilizer structure (up to sign flips on a subset of generators).This is precisely the effect that Pauli errors (or Pauli faults) have on a network.While we generally depict the fault-free representation of a quantum instrument network, it is possible to represent certain Pauli faults as the insertion of X, Y or Z operators at existing edges of the network (see Fig. 4b).This is a great modeling advantage of the network representation, which permits representing many error mechanisms which are physically motivated.The role of checks in fault tolerance is to make us aware of undesired faults in our physical implementation of a protocol.Some of these faults can be represented by Pauli operator insertions within the edges of a network.The examples in Fig. 4c-e represent how different faults/errors could give rise (or not) to a nontrivial check outcome (syndrome).Figure 4c shows that the insertion of an X error in the circuit will be detected by the check, as the π phase flips the product of measurement outcomes.In fact, the insertion of a red π spider at any location along the red Pauli web will be detected, including measurement errors as shown in the bottom panel of Fig. 4c.The same is true for Y errors, as shown in Fig. 4d.However, Z errors will not be detected, as green π spiders have no effect on red Pauli webs, as shown in Fig. 4e.This is not surprising, since the repetition code is a classical error-correcting code, so it is only capable of detecting bit-flip errors, but not phase-flip errors.Note that the per-edge error model implicit in the ZX network generally does not have a one-to-one correspondence to a circuit-level error model.
The example makes clear how only an odd number of detectable Pauli fault insertions will give rise to a non-trivial check syndrome.This allows us to understand precisely what kind of errors each check is capturing and design them accordingly to maximize their usefulness.As we will see in the following section, a quantum error-correcting protocol such as the surface code is capable of detecting any lowweight combination of Pauli faults inserted in the ZX network, not just Pauli faults in one basis.

Expressing fault-tolerance as ZX instrument networks
We have set up the ZX notation and reduction rules to express the equivalence of the different models of quantum computation.In this section, we present (and simplify) each of the paradigms of stabilizer fault tolerance using the extended diagrammatic ZX notation.We focus on the example of surface codes.
Circuit-based quantum computing (CBQC).Having previously discussed the example of a two-qubit repetition code, we repeat the same analysis for a four-qubit surface code in Fig. 5.This code has three stabilizers ZZZZ, XX11 and 11XX, as shown in Fig. 5a.The ZX diagram corresponding to a circuit containing three rounds of stabilizer measurements is shown in Fig. 5b, which consists of the two-body XX measurements shown in Fig. 3e and fourbody ZZZZ measurements in Fig. 3f.We can identify Z checks as internal Pauli webs consisting of pairs of consecutive measurement outcomes, see Figs. 5c and d.However, in contrast to repetition codes, we now also find green internal Pauli webs as X checks, as shown in Fig. 5e.The check structure implies that any single-edge Pauli error inserted into the network can be detected by the checks, as each edge contributes a red segment to at least one internal Pauli web and a green segment to at least one other internal Pauli web.
Next, we consider a distance-5 surface-code patch consisting of 25 physical data qubits in Fig. 6.Since the qubits are arranged on a 2D square grid, and stabilizer measurements are local operations, it is convenient to draw the circuit as a three-dimensional object.If we straightforwardly translate the circuit corresponding to two rounds of stabilizer measurements into a ZX diagram, we obtain the 3D diagram shown in Fig. 6a, where the time direction goes from Figure 7: A common realization of fault-tolerant measurement-based quantum computing using a 3D cluster state.(a) This lattice is obtained by applying the duality rule to the lattice in Fig. 6a.(b) It can be interpreted as the preparation of an RHG cluster state followed by single-qubit X measurements.In other words, each green spider is replaced by a qubit initialized in the |+⟩ state, followed by CZ gates between connected qubits and a single-qubit X measurement.(c) The Z checks now contain six measurement outcomes.(d) X checks have the same structure as Z checks, but are located in different layers.
bottom to top, rather than left to right as in previous circuit diagrams.The first layer in this diagram contains 12 twobody and four-body Z measurements, and the second layer 12 two-body and four-body X measurements.These measurements are repeated in the third and fourth layers.We can identify checks as internal Pauli webs that form threedimensional cells, one of which is highlighted in Fig. 6a.These checks have the structure shown in Fig. 6c, consisting of red Pauli webs containing pairs of consecutive measurement outcomes.Similarly, X checks consist of green Pauli webs, as shown in Fig. 6d.These are the checks that are used to detect and correct errors in a surface-code decoder.

Measurement-based quantum computing (MBQC).
We can construct different models of quantum computation by reinterpreting this three-dimensional ZX diagram.One interpretation is obtained by putting the diagram into its canonical form by applying the duality rule, as shown in Fig. 7a.The resulting diagram is a network of green spiders, where each spider in the bulk is connected to four other green spiders via a Hadamard gate.As shown in Fig. 7b, we can interpret each such spider as a qubit that is prepared in the |+⟩ state, participates in four CZ gates with its four neighbors, and is then measured in the X basis.The state that is prepared and then measured is an RHG cluster state [5] (or  7a.The thick lines partition the lattice into many copies of six-ring resource states.The ZX diagram can then be interpreted as the preparation of many copies of 6-ring resource states (c), followed by their fusion (e), i.e., the destructive two-qubit measurement of pairs of qubits from different resource states.(d) Each check contains 12 fusion outcome bits.
RBH state [26]), which is a graph state similar to the example shown in Fig. 3c.
The checks have a similar structure as in the CBQC protocol, but now consist of six measurement outcomes, as shown in Figs.7c and d.Note that Z checks and X checks have an identical structure, differing only in their location.The cells centered around every second layer are Z checks, whereas the cells centered around every other layer are X checks.Z and X checks are also referred to as primal and dual checks.
Interestingly, the resulting canonical form has no specific The FloBQC protocol which is obtained by applying a split transformation to the lattice in Fig. 6a.The thick black connections partition the lattice into individual chains, four of which are highlighted in red and its neighbors green, blue and purple.This is equivalent to the Floquet code presented in Refs.[25] and [12].(c) These chains can be interpreted as four qubits that undergo a cycle of six two-body measurements, alternating between XX and ZZ measurements and cycling through the three neighbors of each qubit.(d) The physical qubits form a hexagonal lattice when taking a time slice.Pair parity measurements of the same type and along the same orientation are preformed simultaneously.(e) The pair parity measurements alternate between ZZ and XX measurements and cycle along the three neighbors of each qubit leading to an overall cycle of six operations.The Z checks (f) and X checks (g) consist of six ZZ and XX measurement outcomes, respectively.
orientation which should naturally be associated to a timelike direction.By applying the merge rule to the circuit preparing the cluster state, we have compacted the time-like direction associated with the cluster-state preparation circuit.
It is nevertheless possible to reintroduce a time-like ordering (direction) to the diagram, which in a circuit interpretation allows reducing the number of physical qubits which need to be present at any given time.In other words, state preparation and consumption (measurement) may proceed concurrently on different parts of the resource state so long as preparation precedes measurement for any given part.
The ZX network thus described is locally bipartite (Hadamard nodes are not counted).This allows absorbing the Hadamard operators into the nodes in one part of the bi-partition and having them change color through the duality identity.The fact that we have a choice on which half of the spider instruments to swap color is a reminder that the separation into primal and dual checks is an arbitrary choice.Moreover, if the lattice is not bipartite but only locally bipartite then the network is not bicolorable and it is not possible to remove all Hadamard operators through the duality transformation.This implies that there is no locally consistent separation into primal and dual checks.A transparent boundary [14], which is where these labels swap, must be introduced along some cut interrupting all odd loops.
Other cluster-state geometries are possible following this recipe.For example, using the fault-tolerant cluster states of Ref. [27], which can be defined for any cell-complex (in any dimension), one can replace qubits residing on one type of cell with red spiders, and the other with green spiders, and connect them up appropriately.
Fusion-based quantum computing (FBQC).An illuminating way to view the concrete FBQC protocol presented in Ref. [6] is as a factorization of the canonical ZX network diagram into resource-state-sized tensor factors (disregarding the instrument nature of nodes).One possibility to do so is to apply a split to every spider node of the diagram in Fig. 7a, i.e., applying the transformation shown in Fig. 8b.This results in the diagram shown in Fig. 8a, where the new edges introduced via the split transformation are highlighted as thick black lines.Note that if the lattice is cut along these thick black lines, it is partitioned into individual pieces each containing six spiders in the bulk.These pieces form hexagonal rings, as shown in Fig. 8c.We can interpret these pieces as circuits preparing copies of 6-ring graph states, which we refer to as resource states.
Furthermore, we can interpret the thick black lines connecting pairs of different resource states as two-qubit Bell measurements, which we refer to as fusions, as shown in Fig. 8e.In an implementation with linear optics, it will, in practice, be a locally encoded fusion measurement, which is required in order to increase the entangling probability.These fusions produce two classical outcomes, which we will highlight as red and green Pauli webs around the thick black line.The internal Pauli webs corresponding to surfacecode checks have a similar structure as in previous examples, but now consist of 12 fusion outcomes, six of which are XX outcomes, and six ZZ outcomes (see Fig. 8d).Note that the ZX diagram does not specify the order in which resource states need to be generated and fused.They can be generated all at once for a fast but hardware-intensive computation, layer by layer, or, in the extreme case, completely sequentially via a technique referred to as interleaving [28].
As in the MBQC case, the ZX network is, strictly speaking, not equivalent to the CBQC network in Fig. 6a because there is a larger and different set of classical outcomes attached to the network.However, because the Bell measurement is composed of two-port spider instruments with-out phases, it just contributes an outcome-dependent Pauli frame.One can nevertheless identify the Pauli webs for check generators from FBQC with the check generators in the CBQC picture by applying the transformations onto the MBQC canonical form.
In general, there may also be more outcome bits which determine the Pauli frame correction associated to the resource state generation.This Pauli frame correction can be specified by using at most as many bits as the number of stabilizers.For graph states, it is conventional to take these bits in one to one correspondence with the sign correction of vertex stabilizers (which form a generating set).
A Floquet model (FloBQC).Floquet-flavor faulttolerance is adapted to a physical setting where the native instructions are non-destructive two-body measurements.Our initial CBQC diagram in Fig. 6a can also be used to obtain a Floquet flavor fault-tolerance protocol.We apply a split to each spider to obtain the lattice in Fig. 9a.Note that this split is different than in Fig. 8, since cuts along the thick black lines break the lattice into long disjoint chains rather than hexagons.Four of these chains are highlighted in red, green, blue and purple.The thick black lines connect each chain to three other chains, in this case the red chain to its three nearest neighbors, i.e., the green, blue and purple chains.We can interpret these chains as qubits in a circuit, and connections between chains as two-body XX or ZZ measurements, as shown in Fig. 9b.
In this case, we recover the FloBQC protocol from Refs.[25] and [12].Each chain is associated with a physical qubit.Each physical qubit has three neighbors and they are arranged in a honeycomb lattice.The fault tolerance protocol alternates between XX and ZZ measurements, cycling between the three neighbors, resulting in an overall cycle of six two-body measurements, as shown in Fig. 9. Checks are obtained as products of six measurement outcomes, as shown in Figs.9c and d.Note that only Pauli webs of one color (but not the other) are attached to classical outcomes on the thick black connections.
It is interesting to note, that both CBQC and FloBQC have a notion of physical qubits with identities persisting through time and subjected to a sequence of elementary operations dictated by the fault-tolerance protocol.However, the direction in which the strands representing such physical qubits propagate are different in the CBQC model and the FloBQC when mapped to the shared ZX-network (see Fig. 11)).This is consistent, as the logical correlator membranes can be deformed and reoriented and the true direction of encoded information flow is determined by the arrangement of boundary features.We have only cursorily introduced these for the circuit model, and leave the industrious reader to reinterpret boundary conditions in the context of the different flavors of fault-tolerance.Identifying the mapping through a common simplified ZX diagram is particularly useful for this.
It is also worth pointing out that, as with all ZX networks, the interpretation as a circuit-based protocol is only one of many possibilities.For instance, the same network can also be interpreted as an FBQC protocol with linear resource states.
Logical correlators.So far, our main focus was on describing checks as internal Pauli webs.The 3D ZX diagrams also contain Pauli webs with support on the outer ports.Some of these Pauli webs correspond to stabilizers that are local to each logical port, an example of which is shown in Fig. 10c.Other such Pauli webs correspond to logical correlators (also called logical membranes or correlation surfaces) which encode the correlation between logical input observables and logical output observables.The logical operations in our examples are simple idle operations, so the membranes connect the logical Z and X operators at the inputs to the logical Z and X operators at the outputs.An example of a logical Z correlator in the CBQC lattice is shown in Fig. 10a.The Pauli web is supported on the Z ⊗5 operators corresponding to representatives of the logical Z operator on the input and output.
Note that the Pauli webs of logical correlators in CBQC do not involve any classical outcomes.However, we still need to keep track of a Pauli frame in CBQC to account for Pauli errors on the edges of logical correlators.The locations of these errors are diagnosed by the decoder.In contrast, the logical X correlator in the FBQC lattice shown in Fig. 10b is given by a Pauli web which involves many different fusion outcomes.This is also the case for logical correlators in MBQC and FloBQC.In these models of computation, a Pauli frame is required even in a noiseless setting, as logical A resource state for the FBQC scheme presented in Ref. [6] is highlighted in purple.(c) A worldline for a FloBQC physical qubit is highlighted in blue and propagates in a different direction compared to a CBQC qubit.Note that, in this figure, each ZX spider is shared by two resource states in FBQC or by two qubits in FloBQC.In other words, a split transformation needs to be applied to obtain the networks in Figs. 8 and 9.
correlators contain intrinsically random measurement outcomes in addition to edges that may host Pauli errors.
Fault-tolerant logical operations.Using the equivalences provided by the ZX tensor networks, we have shown that the different models share a common structure.This provides a recipe for constructing fault-tolerant logical operations in different models of computation.In particular, one can use the prescriptions in Ref. [14] to construct topological features (boundaries, domain walls, symmetry defects) realizing fault-tolerant quantum instruments -called logical blocks -in the different models.

Conclusion
Throughout this article we have presented how the different paradigms of stabilizer fault tolerance share a common structure.Of course, saying that they are the same would be overly exaggerated.Each has its own set of outcomes produced in different ways and the error models adequate for describing each platform will differ.Nevertheless, the structure of checks and logical correlators is shared and the examples provided in this article illustrate how to translate between paradigms.
The models are equivalent in the sense that they can be reduced to a common canonical form via local ZX transformations which preserve the check structure, as illustrated in Fig. 11.In particular, the model of FloBQC that we present, while conceptually different, is ultimately based on the same underlying surface code.As such, one can define logical operations in the same manner as in other flavors of surfacecode quantum computation.
While this paper focuses on the bulk of the most basic topological protocol, it should be interpreted as a dictionary.We hope that fault-tolerance researchers will find it useful for the translation between paradigms beyond the previous examples.This may include different microscopic models (i.e., crystal structures [27,29]), features (boundary conditions, logical blocks [14], transversal gates, etc.), as well as different fault-tolerance protocols based on color codes [30,31], low-density parity check codes [32] or other Clifford encoders [33].We found the ZX calculus to be a versatile toolbox that can be used at all levels of fault tolerance, from the physical level of different models of quantum computation, to the structure of checks used in decoding [34], and the methodical construction of logical operations [35].
A Importance of permutation and partial transposition invariance in elementary ZX tensors A feature which makes ZX diagrams particularly lightweight and easy to use is that it is not necessary to distinguish ports in the elementary tensors of the diagram.This is because all elementary tensor definitions are invariant under index permutations and compatible with partial transposition.This allows the network to be interpreted in a way which only depends on the connectivity between nodes and where it does not matter if a port emerges in the forward direction (a ket) or in the backwards direction (a bra).For instance, the transpose of the Y operator is its negative (Y T = −Y ), as shown in Fig. 12b.Introducing any such tensor would require specifying its orientation in every diagram it is involved.This is the case in other tensor network diagrams; one needs to specify the signature of each tensor (how many kets and how many bra indices), and specify to which port it is being connected (if there is a tensor with multiple qubits).Avoiding this overhead makes ZX diagrams significantly lighter in notation while retaining rigorous meaning.
Note that the results of composite networks do not need to have permutation invariance or partial transposition invariance, but they will do so if the the diagram itself is invariant under permutations of outer ports.An example is the controlled Z gate shown in Fig. 12a, which is invariant under transposition and commutes with the SWAP operator.
The extension of ZX diagrams to instruments presented in the main text requires additional instrument nodes.We chose these instrument nodes such that the properties permutation and partial transposition invariance continue to hold the quantum ports in all elementary instruments.does not include classical outcome ports, as they are treated separately.

B discrepancy with literature
As pointed out to us by Bob Coecke, the notation for ZX instruments used in this article differs from the one established in existing literature.We interpret thick edges, introduced in Fig. 1d, as classical outcomes or control wires with further ad hoc uses in Figs. 8 and 9.In contrast, books such as Ref. [18] use unpaired simple wires to represent classical states and outcomes, whereas thick (or double) edges are used as a shorthand for doubled wires, which carry the bra and ket components of quantum states.Our notation can be interpreted as a shorthand for the standard notation, as shown in Fig. 13.In such a case, the identities involving quantum instruments in Fig. 2 may be derived from elementary ZX identities and do not need to be postulated.
While succinct, the notation we introduce is sufficient to represent stabilizer fault tolerance.Furthermore, having classical outcomes and inputs be explicitly represented as ports in the diagram provides a clear type signature for the classical control which should accompany the quantum com-puter, which we do not expect to represent through ZX diagrams.

Figure 1 :
Figure 1: (a) Z spiders, X spiders and Hadamards are the elementary building blocks of ZX diagrams.(b) Spider nodes with one leg can be used to describe Pauli eigenstates and their projections.(c) Unitary gates can also be expressed as ZX diagrams, as shown for the CNOT gate and a single-qubit Z rotation.(d) Classical outputs can be added to describe quantum instruments.The classical bit b determines whether the phase of the spider is α or α + π.(e) Such ZX instruments can be used to describe Pauli measurements.

Figure 2 :
Figure 2: (a) The most commonly used ZX-diagrammatic equations.These identities are also valid without classical outputs, i.e., by removing all outputs indicated by thick black lines.The transformation rules can be used to simplify (b) the CZ gate, (c) the circuit of a non-destructive ZZ measurement and (d) the circuit of a destructive two-qubit Bell measurement.

Figure 3 :
Figure 3: Pauli webs are a graphical overlay notation that allows us to reason about stabilizer states, Clifford gates and Pauli measurements.Pauli webs can describe the stabilizers of states, as shown for the example of a GHZ state (a/b) and a 6-ring graph state (c).They can also correspond to stabilizers of Clifford unitaries, as shown for the CNOT gate (d) and can specify Pauli projections and measurements, as shown for two-qubit (e) and four-qubit (f) Pauli measurements.

Figure 4 :
Figure 4: (a) Pauli webs that are completely internal (i.e., not supported on any output legs) describe checks, as shown for a repetition-code check.(b) Pauli errors can be described by inserting red and green spiders with a phase of π.(c) The repetition-code check can detect any odd number of X error inserted along the Pauli web.(d) The same is true for Y errors.(e) Z errors cannot be detected, as the green spider has no effect on the red Pauli web.

Figure 5 :
Figure 5: (a) A distance-2 surface code patch consisting of four physical qubits and three stabilizers.(b) ZX diagram of a circuit corresponding to three rounds of measurements of the three stabilizers.(c) Pauli web of a Z check.(d) Pauli web of the subsequent Z check.(e) Pauli web of an X check.

Figure 6 :
Figure 6: Circuit-based quantum computing.(a) Two rounds of the measurement of the 24 stabilizers shown in (b).Pauli webs of (c) Z checks and (d) X checks contain two measurement outcomes.

Figure 8 :
Figure 8: Fusion-based quantum computing.(a) This lattice is obtained by applying the split transformation to the lattice in Fig. 7a.The thick lines partition the lattice into many copies of six-ring resource states.The ZX diagram can then be interpreted as the preparation of many copies of 6-ring resource states (c), followed by their fusion (e), i.e., the destructive two-qubit measurement of pairs of qubits from different resource states.(d) Each check contains 12 fusion outcome bits.

Figure 9 :
Figure 9: Floquet surface code.(a) Local to this figure we take an ad hoc interpretation of thick black lines connecting like colored spiders as a pair parity measurement.(b)The FloBQC protocol which is obtained by applying a split transformation to the lattice in Fig.6a.The thick black connections partition the lattice into individual chains, four of which are highlighted in red and its neighbors green, blue and purple.This is equivalent to the Floquet code presented in Refs.[25] and[12].(c) These chains can be interpreted as four qubits that undergo a cycle of six two-body measurements, alternating between XX and ZZ measurements and cycling through the three neighbors of each qubit.(d) The physical qubits form a hexagonal lattice when taking a time slice.Pair parity measurements of the same type and along the same orientation are preformed simultaneously.(e) The pair parity measurements alternate between ZZ and XX measurements and cycle along the three neighbors of each qubit leading to an overall cycle of six operations.The Z checks (f) and X checks (g) consist of six ZZ and XX measurement outcomes, respectively.

Figure 10 :
Figure 10: (a) A logical Z correlator highlighted in the lattice of Fig. 6a.The Pauli web connects the logical Z operator on the inputs to the logical Z operator on the outputs.(b) A logical X correlator highlighted in the lattice of Fig. 8a, connecting the logical X operators on the inputs and outputs.(c) A Pauli web supported on outer ports corresponding to a local stabilizer instead of a logical correlator.This local stabilizer can be completed into a check by continuing the fault-tolerant protocol.

Figure 11 :
Figure 11: Different models of quantum computation shown in the same ZX network.Note that the canonical form of this network can be obtained by applying the duality rule to red spiders.It emphasizes the equivalence of all three Cartesian axes in the space-time picture.(a) A worldline for a physical qubit in the traditional circuit model is highlighted in red.(b)A resource state for the FBQC scheme presented in Ref.[6] is highlighted in purple.(c) A worldline for a FloBQC physical qubit is highlighted in blue and propagates in a different direction compared to a CBQC qubit.Note that, in this figure, each ZX spider is shared by two resource states in FBQC or by two qubits in FloBQC.In other words, a split transformation needs to be applied to obtain the networks in Figs.8 and 9.

Figure 12 :
Figure12:(a) Both spider tensor definitions and Hadamard are compatible with index permutation and partial/full transposition.This means that all topologically equivalent ways of presenting ZX networks are equivalent (up to identification of outer ports).This allows making sense of a vertical tensor contraction, as a slight reorientation of the contraction in either direction would give rise to the same result.(b) This feature requires all elementary tensors to be invariant under permutations and transpositions and is not valid if we, e.g., include Y or e iαY as an elementary tensor.Transposing contractions in a diagram containing Y operators may result in minus signs.

Figure 13 :
Figure 13: (a) A green spider instrument is presented in the notation of this article.(b) Without use of thick edges the doubling of bra and ket components is done explicitly.(c) The same instrument is now expanded in a notation where thick edges represent quantum wires (i.e.doubled wires) and double lined spiders represent pairs of spiders with opposite phase.