Scalable spider nests

(...or how to graphically grok transversal non-Clifford gates)

Aleks Kissinger & John van de Wetering

QPL 2024, Buenos Aires

         +

ZX-diagrams

...are the language of the ZX calculus.



They are made of spiders:

$:=\ \ |0...0\rangle\langle 0...0| + e^{i \alpha} |1...1\rangle\langle 1...1|$
$:=\ \ |{+}...{+}\rangle\langle {+}...{+}| + e^{i \alpha} |{-}...{-}\rangle\langle {-}...{-}|$

We love ZX diagrams because

  • They can represent any linear map $(\mathbb C^2)^{\otimes m} \to (\mathbb C^2)^{\otimes n}$
  • They readily encode universal gatesets, e.g.

    $\textit{CNOT} :=$     $\sqrt{X} :=$     $Z_\alpha :=$

  • Complete for circuit equality with only a few rules

...But there's a catch

Working with full-powered ZX diagrams is (exponentially) hard.

Clifford ZX calculus

A complete set of equations for qubit Clifford QC

efficient synthesis, equality checking, classical simulation, ...

"graphical stabiliser theory and stabiliser codes"

Phase-free ZX calculus

A complete set of equations for qubit phase-free QC

efficient synthesis, equality checking, classical simulation, ...

"graphical $\mathbb F_2$-linear algebra and CSS codes"

Phase-free ZX diagrams

...are made of spiders with $\alpha = 0$:

\[ :=\ \ |0...0\rangle\langle 0...0| + |1...1\rangle\langle 1...1| \]
\[ :=\ \ |{+}...{+}\rangle\langle {+}...{+}| + |{-}...{-}\rangle\langle {-}...{-}| \]
\[= \ \ N \sum_{\oplus_i b_i = 0} |b_1...b_n\rangle\langle b_{n+1}...b_{n+m}|\]

Simplification



  1. Apply (sp) and (id) as much as possible.
  2. Apply (sc) once where
    • is not an input and
    • is not an output.
  3. Repeat.

Normal forms

Phase-free ZX diagrams can be reduced efficiently to (pseudo-)normal form:

Special case: unitaries

Unitary $\implies$ $m = n ,\ \ j = k = 0$



$\overset{*}{\rightarrow}$
\[ U :: |\vec x \rangle \mapsto |L \vec x\rangle \qquad\qquad L := \begin{pmatrix} 1 & 0 & 1 & 1 \\ 1 & 1 & 1 & 1 \\ 1 & 1 & 0 & 1 \\ 0 & 0 & 1 & 1 \end{pmatrix} \]

Special case: isometries

Isometry $\quad \implies \quad m \leq n ,\ \ j = 0$
\[ V :: |\vec x \rangle \mapsto \sum_{\vec y} |L \vec x + S \vec y\rangle \qquad L := \begin{pmatrix} 1 & 0 \\ 1 & 1 \\ 1 & 1 \\ 0 & 0 \end{pmatrix} \qquad S := \begin{pmatrix} 1 & 1 \\ 1 & 1 \\ 0 & 1 \\ 1 & 1 \end{pmatrix} \]

Q: What structures are between "full-strength" ZX and efficient (Clifford/PP) ZX?



A: Diagonal non-Cliffords, which are all generated by phase gadgets:

$\ \ ::\ \ |x_1 \ldots x_n \rangle \mapsto e^{i \alpha \cdot x_1 \oplus \ldots \oplus x_n} |x_1 \ldots x_n\rangle$

Phase gadgets

  • $\frac\pi 4$ phase gadgets generate all diagonal gates on the 3rd level of the Clifford hierarchy $\mathcal D_3$, e.g.

    $\textit{T} \ = \ $         $\textit{CCZ} \ = \ $

  • simple T count optimisation using gadget fusion, which follows from Clifford rules:

For general $\alpha \in \mathbb R$, that's pretty much the whole story.

But for $\alpha = \pi/4$, there are (infinitely) many non-trivial rules, e.g.

These are called spider nest identities.

Q: Is there a nice way to classify all spider nests and work with them effectively?

A: Yes, but we need some new tools.

Scalable notation



\[ M :: |\vec x \rangle \mapsto |L \vec x\rangle \qquad\qquad L := \begin{pmatrix} 1 & 0 & 1 & 1 \\ 1 & 1 & 1 & 1 \\ 1 & 1 & 0 & 1 \end{pmatrix} \]

Scalable notation



\[ M :: |\vec x \rangle \mapsto |L \vec x\rangle \qquad\qquad L := \begin{pmatrix} 1 & 0 & 1 & 1 \\ 1 & 1 & 1 & 1 \\ 1 & 1 & 0 & 1 \end{pmatrix} \]

Scalable notation

       

Scalable notation

       

All spider nest identities

\[ M \textrm{ triorthogonal } := \begin{cases} \forall i: |M_i| = 0 \textrm{ mod } 8 \\ \forall i<j: M_i \cdot M_j = 0 \textrm{ mod } 4 \\ \forall i<j<k: M_i \cdot M_j \cdot M_k = 0 \textrm{ mod } 2 \end{cases} \]

All spider nest identities

Theorem. The Clifford ZX calculus plus the S4 rule:

is diagonally complete for Clifford+T ZX diagrams, i.e. any true equation of the form:

is provable.

All spider nest identities

...where:

Proof idea: S4 immediately implies:

for all $n > 4$.

All spider nest identities

Then:

...forms a generating set for all the spider nest rules, up to Cliffords.

(Uses equivalence between triorthonality and degree $\leq n-4$ polynomials/Reed-Muller codewords, cf. Nezami & Haah. Classification of small triorthogonal codes. 2022)

Quantum error correction

...is done by encoding some space of logical qubits into a bigger space of physical qubits:



  • $E$ (or just $\textrm{Im}(E)$) is called a quantum error correcting code
  • Stabiliser code $:= E$ is a Clifford ZX diagram
  • Calderbank-Shor-Steane code $:= E$ is a phase-free ZX diagram

\[ V :: |\vec x \rangle \mapsto \sum_{\vec y} |L \vec x + S \vec y\rangle \qquad L := \begin{pmatrix} 1 & 1 \\ 1 & 0 \\ 0 & 1 \\ 0 & 0 \end{pmatrix} \qquad S := \begin{pmatrix} 1 \\ 1 \\ 1 \\ 1 \end{pmatrix} \]
\[ X \text{ logical ops } := \{ X \otimes X \otimes I \otimes I, X \otimes I \otimes X \otimes I \} \] \[ X \text{ stabilisers } := \{ X \otimes X \otimes X \otimes X \} \]

\[ Z \text{ logical ops } := \{ I \otimes Z \otimes I \otimes Z, I \otimes I \otimes Z \otimes Z \} \] \[ Z \text{ stabilisers } := \{ Z \otimes Z \otimes Z \otimes Z \} \]

\[ V :: |\vec x \rangle \mapsto \sum_{\vec y} |L \vec x + S \vec y\rangle \qquad L := \begin{pmatrix} 1 & 1 \\ 1 & 0 \\ 0 & 1 \\ 0 & 0 \end{pmatrix} \qquad S := \begin{pmatrix} 1 \\ 1 \\ 1 \\ 1 \end{pmatrix} \]
\[ X \text{ logical ops } := \{ X \otimes X \otimes I \otimes I, X \otimes I \otimes X \otimes I \} \] \[ X \text{ stabilisers } := \{ X \otimes X \otimes X \otimes X \} \]

\[ V :: |\vec x \rangle \mapsto \sum_{\vec y} |L \vec x + S \vec y\rangle \]

Fault-tolerant computation

...is done by implementing logical operations $f$
with physical operations $F$:



Often, we want these to be transversal to avoid spreading errors:

Transversal diagonal gates



$\forall i . |P^i| = 1$

Transversal diagonal gates




$M = \begin{pmatrix} H & 0 \\ PL & PS \end{pmatrix}$

$D_M$ vanishes $\iff M$ is triorthogonal

Theorem. A CSS code with generator matrix $(L|S)$ admits a transversal implementation of a gate $D_H^\dagger \in \mathcal D_3$ if and only if there exists a matrix $P$ whose rows have Hamming weight $1$ such that the matrix

\[ M = \begin{pmatrix} H & 0 \\ PL & PS \end{pmatrix} \]

is triorthogonal.

Example

\[ M = \footnotesize \left( \begin{array}{c|ccccccccccccccc} 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ \hline 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 \\ 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \end{array} \right)^T \]
  • $(L|S)$ is a $[[15, 1, 3]]$ quantum Reed-Muller code
  • $P = I$, $D_P = T^{\otimes 15}$
  • $D_H^\dagger = T^\dagger$

Example

\[ M = \footnotesize \left( \begin{array}{cccccccc|cccccccc} 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 \\ 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\ \hline 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \end{array} \right)^T \]

Conclusions

  • Scalable notation tames the complexity of spider nests

    $\qquad \leadsto \qquad$

  • Scalable diagrams represent Clifford and non-Clifford parts together, allowing $\mathbb F_2$-linear structures to interact
  • Open Qs:
    • Can Clifford+S4 be completed?
    • Does this help with code search, distillation protocols, etc?
    • Application to other kinds of FT operations?
    • Beyond CSS/stabilser codes (e.g. Floquet codes)?