Skip to main content
KetQat

Appearance

Theorem · intermediate

Spider fusion and the basic ZX rules

Two spiders of the same colour joined by at least one wire fuse into one spider whose phase is the sum of theirs; together with colour change, pi-copy and the bialgebra rule these identities, with explicit scalars, are the core rewrites of the ZX calculus.

Established resultMachine-checkedUpdated 2026-12-01 · last verified 2026-12-01

AI-assisted text, machine-checked, not yet reviewed by a person. Citations resolve and an automated pass compared the statements with the cited sources. That is not peer review; check the sources for anything you depend on.

Write Zαa,bZ^{a,b}_\alpha and Xαa,bX^{a,b}_\alpha for the interpretations of the spiders. Then:

  1. Fusion. If k≥1k \ge 1 outputs of Zαa1,b1+kZ^{a_1, b_1 + k}_\alpha are connected to kk inputs of Zβa2+k,b2Z^{a_2 + k, b_2}_\beta, the result is Zα+βa1+a2, b1+b2Z^{a_1 + a_2,\, b_1 + b_2}_{\alpha + \beta}. A wire joining a spider to itself can be deleted. The same holds for X spiders.
  2. Identity. Z01,1=X01,1=IZ^{1,1}_0 = X^{1,1}_0 = I.
  3. Colour change. Xαa,b=H⊗b Zαa,b H⊗aX^{a,b}_\alpha = H^{\otimes b}\, Z^{a,b}_\alpha\, H^{\otimes a}, and HH=IH H = I.
  4. π\pi-copy. Zα1,b Xπ1,1=eiα (Xπ1,1)⊗b Z−α1,bZ^{1,b}_\alpha\, X^{1,1}_\pi = e^{i\alpha}\, (X^{1,1}_\pi)^{\otimes b}\, Z^{1,b}_{-\alpha}, where Xπ1,1X^{1,1}_\pi is the Pauli XX.
  5. Copy. Z01,b∣0⟩=∣0⟩⊗bZ^{1,b}_0 \ket{0} = \ket{0}^{\otimes b}, Z01,b∣1⟩=∣1⟩⊗bZ^{1,b}_0 \ket{1} = \ket{1}^{\otimes b}, and X00,1=2 ∣0⟩X^{0,1}_0 = \sqrt{2}\,\ket{0}.
  6. Bialgebra. Z01,2 X02,1=2 (X02,1⊗X02,1) (I⊗SWAP⊗I) (Z01,2⊗Z01,2)Z^{1,2}_0\, X^{2,1}_0 = \sqrt{2}\, \big(X^{2,1}_0 \otimes X^{2,1}_0\big)\, (I \otimes \mathrm{SWAP} \otimes I)\, \big(Z^{1,2}_0 \otimes Z^{1,2}_0\big).

Rules 1, 3 and 6 (each up to scalars) are among the original axioms of Coecke and Duncan, and rule 4 follows from their two π\pi rules (K1, K2) together with fusion; the textbook treatment with scalars is Coecke and Kissinger. By colour change, every rule has a version with the colours swapped.

Holds when

  • Interpretation of ZX diagrams as linear maps with the unnormalised spiders defined there; scalars are stated exactly, not dropped.

Proof

Proof of spider fusion and the basic ZX rulesMachine-checked

Write Zαa,b=∑x∈{0,1}eiαx ∣x⟩⊗b⟨x∣⊗aZ^{a,b}_\alpha = \sum_{x \in \{0,1\}} e^{i\alpha x}\, \ket{x}^{\otimes b}\bra{x}^{\otimes a}.

1. Fusion. Contracting kk wires between the two spiders gives

∑x,yeiαxeiβy ⟨y∣x⟩k  ∣x⟩⊗b1∣y⟩⊗b2 ⟨x∣⊗a1⟨y∣⊗a2=∑xei(α+β)x ∣x⟩⊗(b1+b2)⟨x∣⊗(a1+a2),\sum_{x, y} e^{i\alpha x} e^{i\beta y}\, \braket{y}{x}^{k}\; \ket{x}^{\otimes b_1}\ket{y}^{\otimes b_2}\, \bra{x}^{\otimes a_1}\bra{y}^{\otimes a_2} = \sum_x e^{i(\alpha+\beta)x}\, \ket{x}^{\otimes (b_1+b_2)} \bra{x}^{\otimes (a_1+a_2)},

since ⟨y∣x⟩k=δxy\braket{y}{x}^k = \delta_{xy} for k≥1k \ge 1. A self-loop contracts an output with an input of the same term, contributing ⟨x∣x⟩=1\braket{x}{x} = 1, so it can be removed. For X spiders conjugate by Hadamards (rule 3), which commute with contraction because HH is real and symmetric, so ∑jHijHjk=δik\sum_j H_{ij} H_{jk} = \delta_{ik} along each internal wire.

2. Identity. Z01,1=∣0⟩⟨0∣+∣1⟩⟨1∣=IZ^{1,1}_0 = \ketbra{0}{0} + \ketbra{1}{1} = I, and X01,1=∣+⟩⟨+∣+∣−⟩⟨−∣=IX^{1,1}_0 = \ketbra{+}{+} + \ketbra{-}{-} = I.

3. Colour change. H∣x⟩=∣±⟩H\ket{x} = \ket{\pm} for x=0,1x = 0, 1, so H⊗bZαa,bH⊗a=∣+⟩⊗b⟨+∣⊗a+eiα∣−⟩⊗b⟨−∣⊗aH^{\otimes b} Z^{a,b}_\alpha H^{\otimes a} = \ket{+}^{\otimes b}\bra{+}^{\otimes a} + e^{i\alpha}\ket{-}^{\otimes b}\bra{-}^{\otimes a}, using H†=HH\dagg = H. And H2=IH^2 = I by multiplying the matrices.

4. π\pi-copy. Xπ1,1=∣+⟩⟨+∣−∣−⟩⟨−∣X^{1,1}_\pi = \ketbra{+}{+} - \ketbra{-}{-} is the Pauli XX, which maps ∣x⟩↦∣1−x⟩\ket{x} \mapsto \ket{1-x}. Hence Zα1,bX=∑xeiαx∣x⟩⊗b⟨1−x∣=∑yeiα(1−y)∣1−y⟩⊗b⟨y∣=eiα X⊗b∑ye−iαy∣y⟩⊗b⟨y∣=eiαX⊗bZ−α1,bZ^{1,b}_\alpha X = \sum_x e^{i\alpha x} \ket{x}^{\otimes b} \bra{1-x} = \sum_y e^{i\alpha(1-y)} \ket{1-y}^{\otimes b}\bra{y} = e^{i\alpha}\, X^{\otimes b} \sum_y e^{-i\alpha y} \ket{y}^{\otimes b}\bra{y} = e^{i\alpha} X^{\otimes b} Z^{1,b}_{-\alpha}.

5. Copy. The first two identities are immediate from the definition. For the last, X00,1=∣+⟩+∣−⟩=2∣0⟩X^{0,1}_0 = \ket{+} + \ket{-} = \sqrt{2}\ket{0}.

6. Bialgebra. Both sides are maps from two qubits to two qubits; compare them on basis states. First, X02,1=∣+⟩(⟨+∣⟨+∣)+∣−⟩(⟨−∣⟨−∣)X^{2,1}_0 = \ket{+}(\bra{+}\bra{+}) + \ket{-}(\bra{-}\bra{-}) sends ∣x1x2⟩↦12[(∣+⟩+(−1)x1+x2∣−⟩)]=12∣x1⊕x2⟩\ket{x_1 x_2} \mapsto \tfrac{1}{2}\big[(\ket{+} + (-1)^{x_1+x_2}\ket{-})\big] = \tfrac{1}{\sqrt{2}}\ket{x_1 \oplus x_2}, since ⟨−∣x⟩=(−1)x/2\braket{-}{x} = (-1)^x/\sqrt{2}. So the left side sends ∣x1x2⟩↦12∣x1⊕x2⟩∣x1⊕x2⟩\ket{x_1 x_2} \mapsto \tfrac{1}{\sqrt{2}}\ket{x_1 \oplus x_2}\ket{x_1 \oplus x_2}. On the right side, Z01,2⊗Z01,2Z^{1,2}_0 \otimes Z^{1,2}_0 sends ∣x1x2⟩↦∣x1x1x2x2⟩\ket{x_1 x_2} \mapsto \ket{x_1 x_1 x_2 x_2}, the middle swap reorders this to ∣x1x2x1x2⟩\ket{x_1 x_2 x_1 x_2}, and X02,1⊗X02,1X^{2,1}_0 \otimes X^{2,1}_0 gives 12∣x1⊕x2⟩∣x1⊕x2⟩\tfrac{1}{2}\ket{x_1 \oplus x_2}\ket{x_1 \oplus x_2}. Multiplying by 2\sqrt{2} matches the left side.

The same calculation shows 2 (Z01,2⊗I)\sqrt{2}\,(Z^{1,2}_0 \otimes I) followed by (I⊗X02,1)(I \otimes X^{2,1}_0) is the CNOT gate with the Z spider on the control, ∣x1x2⟩↦∣x1⟩∣x1⊕x2⟩\ket{x_1 x_2} \mapsto \ket{x_1}\ket{x_1 \oplus x_2}. These computations are the standard ones of Coecke and Kissinger.

Builds on
Part of
Stated in

Open in the knowledge graph

Contributions about this record

Nobody has published a contribution about it yet.

Publish a result, reproduction or commentPropose a correction to this page

References

  1. Bob Coecke, Ross Duncan (2011). Interacting quantum observables: categorical algebra and diagrammatics. New Journal of Physics 13, 043016. doi:10.1088/1367-2630/13/4/043016arXiv:0906.4725
  2. Bob Coecke, Aleks Kissinger (2017). Picturing Quantum Processes. Cambridge University Press. doi:10.1017/9781316219317

Contributors

  • KetQat maintainers · @ketqatConceptualization; Supervision (CRediT roles)
  • Claude (AI drafting assistant)Writing, original draft (CRediT roles)

Review history

  1. Automated source check · Pass with notes · 2026-12-01 · Independent automated verification pass (AI, not the drafting session)

    All six identities, with the stated scalars (sqrt 2 in copy and bialgebra, e^{i alpha} in pi-copy), checked numerically with numpy tensors (fusion with one and two connecting wires, pi-copy for b = 1..3, bialgebra, colour change for several arities); self-loop removal re-derived by hand. Attribution compared with Coecke and Duncan, arXiv 0906.4725, Figure 1 and Section 2.2 (rules S1, S2, B1, B2, K1, K2, C).

    The record said the pi-copy rule (rule 4) is one of Coecke and Duncan's original axioms; their axioms are K1 (pi commutes with the other colour's copy map) and K2 (pi inverts phases), from which rule 4 follows with fusion. Reworded that attribution.

Revision history

  1. 2026-12-01Content release 2.1.0: 35 more topics, an independent source check of every record, intake hardening (#17)80537b7e

Current revision 1e54f1b352d8163f. Source file knowledge/records/theorem/zx-spider-fusion.md in the content repository (readable there once it is public).