Source: /cirosantilli/zx-calculus

= ZX-calculus
{wiki}

As https://en.wikipedia.org/w/index.php?title=ZX-calculus&oldid=1071329204\#Diagram_rewriting tries to explain <ourbigbook com/Wikipedia>[but fails to deliver as usual] consider the <GHZ state> represented as a quantum circuit.

How can we easily prove that that quantum circuit equals the state:
$$
\frac{|000> + |111>}{\sqrt{2}}
$$
?

The naive way would be to just do the matrix multiplication as explained at <quantum computing is just matrix multiplication>{full}.

However, ZX-calculus provides a simpler way.

And even more importantly, sometimes it is the only way, because in a real circuit, we would not be able to do the matrix multiplication 

What we do in ZX-calculus is we first transform the original quantum circuit into a ZX graph.

This is always possible, because we can describe how to do the conversion simply for any of the <Clifford plus T> gates, which is a set of <universal quantum gates>.

Then, after we do this transformation, we can start applying further transformations that simplify the circuit.

It has already been proven that there is no efficient algorithm for this (TODO source, someone said P-sharp complete best case)

But it has been proven in 2017 that any possible equivalence between quantum circuits can be reached by modifying ZX-calculus circuits.

There are only 7 transformation rules that we need, and all others can be derived from those, universality.

So, we can apply those rules to do https://en.wikipedia.org/w/index.php?title=ZX-calculus&oldid=1071329204\#Diagram_rewriting[the transformation shown in Wikipedia]:

\Image[https://upload.wikimedia.org/wikipedia/commons/0/05/GHZ_circuit_as_ZX-diagram.svg]
{height=500}
{title=GHZ circuit as ZX-diagram}

and one of those rules finally tells us that that last graph means our desired state:
$$
\frac{|000> + |111>}{\sqrt{2}}
$$
because it is a Z spider with $m = 3$ and $n = 1$.

\Video[https://www.youtube.com/watch?v=JafI_LZts2g]
{title=Working with <PyZX> by Aleks Kissinger (2019)}
{description=
This video appears to give amazing motivation on why you should care about <ZX-calculus>, it mentions
* <quantum compilation>
* <quantum computer simulation>
}

Bibliography:
* https://quantumcomputing.stackexchange.com/questions/9774/what-are-some-applications-of-the-zx-calculus