# ZX-Calculus: understand clifford+T/general ZX rules

This paper that proves the completeness of the ZX-Calculus introduces different gates:

and

However, they seem very cryptic to me (except maybe the rule E). What is the intuition (what they mean, and how they where obtained) behind these rules? I guess some of them (maybe the last one) has something to do with trigonometry, but it's not really trivial when looking at them.

And is there a way to "decompose" them to remember/understand them easily? I can indeed see some structures that appear in several places (like a red node with one or two attached nodes with same angles), but it's still a bit hard for me to make sense of this…

## 1 Answer

Since this paper, there have been several different axiomatisations, arguably simpler than this one. For instance in: https://arxiv.org/pdf/2007.13739.pdf and https://arxiv.org/pdf/1812.09114.pdf. In the last one, in particular, all these rules (except (E)) are replaced by:

where angles on one side of the equation are bound in a non-trivial way to those on the other side. This rule can be understood as a representation of Euler angles (https://en.wikipedia.org/wiki/Euler_angles).

If you are interested specifically in the axioms you mention, here are some remarks:

The supplementarity rule (SUP) was introduced in https://arxiv.org/pdf/1103.2811.pdf and proven necessary in https://arxiv.org/pdf/1506.03055.pdf. This is an equation that proves useful in the study of the $$|W\rangle$$ state, expressed as a ZX-diagram.

The rule (E) was introduced in https://arxiv.org/pdf/1702.01945.pdf. In a way, it comes from the fact that $$e^{i\frac\pi4}$$ can also be written as $$\frac{1+i}{\sqrt2}$$.

The meaning of rules (C) and (A) are discussed in the paper at Section 7 (p.31).

Up to yanking of the wires and simplification using the spider rules, (C) can be seen as commutation of two unitaries, one that is controlled by a qubit, and the other that is "anti-controlled" by the same qubit.

Decomposing rule (A) the appropriate way, it can be seen as an expression of the following equation : $$\begin{pmatrix}1&0&0&0\\0&1&1&0\end{pmatrix}\circ\left(\begin{pmatrix}1\\a\end{pmatrix}\otimes\begin{pmatrix}1\\b\end{pmatrix}\right) = \begin{pmatrix}1\\a+b\end{pmatrix}$$. You can find more detail in this Section 7 I mentionned.

Finally there's (BW). To understand this equation, we first need to realise that the diagram:

represents the shearing operator $$\begin{pmatrix}1&1\\0&1\end{pmatrix}$$. It so happens that we can decompose any 2D rotation as a sequence of 3 shear operations along the two canonical axes (see e.g. this link). Up to the usual ZX-rules for simplification, and up to rearranging of the shear operations, (BW) represents the special case of a rotation by $$-\pi/2$$:

$$\begin{pmatrix}0&1\\-1&0\end{pmatrix} = \begin{pmatrix}1&1\\0&1\end{pmatrix}\begin{pmatrix}1&0\\-1&1\end{pmatrix}\begin{pmatrix}1&1\\0&1\end{pmatrix}$$

• Thank you very much, also for pointing the simpler axiomatisatio (it also answered another question I had on Euler formulas), I'll read these links! I'm also curious to know if there is a systematic way to compute a (if possible simple) "normal form" of a circuit in general ZX for any diagram size. With matrices it is always possible to obtain such form (involving exponentially many operations), so I guess it may be possible to do the same thing in ZX (again with maybe exponentially many nodes). But I guess it is another question ^^ Jun 19, 2021 at 9:37
• @LéoColisson you're welcome. There indeed exist several normal forms for ZX-diagrams. Feel free to ask in a separate question if you have specific question about these. Jun 23, 2021 at 15:56
• Also, there is another interpretation of the BW rule - it is the direct translation of the BW rule of the Triangle-ZX calculus (also invented by Renaud), and it can be translated again into ZH-calculus, where it is represented with zero-labelled H-boxes. In this context, it can be understood as expressing the Boolean 'or' operation arithmetically as $a \lor b = 1 - (1 - a)(1 - b)$, and can be generalized for a multidimensional version of the shearing operator mentioned above. I admit this is not obviously intuitive, but there are more details in my upcoming master's thesis. Aug 19 at 21:19