Slowly finishing my preparations for my last exam this summer term...
seen from Sweden

seen from United States

seen from Türkiye

seen from Russia

seen from United States

seen from United States
seen from Türkiye
seen from United States
seen from United States
seen from Italy
seen from T1

seen from United Kingdom
seen from United Kingdom
seen from United States

seen from United States

seen from Malaysia
seen from China

seen from Kyrgyzstan
seen from United States
seen from Türkiye
Slowly finishing my preparations for my last exam this summer term...
ZX Calculus - Another Perspective on Quantum Circuits. Part I
Recently, stumbled across a tensor network-type framework which was completely new to me - the ZX Calculus. The ZX Calculus is not only a neat way of representing possibly complicated mathematical equations, it also gives explicit rules to alter and simplify those expressions. The ZX Calculus is particularly suited to describe matters in quantum information, which is why I'd like to provide a neat example of how to use this framework. As you might already know, quantum circuits can be fully analysed and understood with the help of tensor networks (actually, they are tensor networks) [1]. However, the ZX Calculus is a specific framework which gives a very illustrative graphical way of understanding quantum circuits, while the typical tensor network approaches are mostly tailored for many body problems. All of the following is taken from [2], a very comprehensive introduction to the ZX Calculus and I fully recommend to go through this paper if the following glimpse into the topic made you curious.
In the following we will set up the very basic set of definitions and rules in order to understand how to evaluate the outcome of the well-known Bell circuit which creates a maximally entangled Bell state:
Basic Definitions: Spiders and Vectors
The most fundamental definition in the ZX Calculus is the spider. The Z-Spider has n inputs and m outputs and is defined as follows:
Thus, such a spider is simply a way of representing a specific kind of 2^n x 2^m matrices. Here, the |0> and |1> denote the basis states of the Pauli Z operator. Similarily, an X-Spider can be defined in terms of another basis, the eigenstates of the Pauli X operator, |+> and |- >:
Thus, the color of the dot encodes information about the basis. The usage of the basis states of both Pauli X and Pauli Z is eponymous for the ZX Calculus. One could have chosen the Pauli Y basis as well, however the choice of X and Z results in nice symmetry properties [2, p.22]. From this, we can already conclude the first identity which we will need to evaluate the Bell circuit: Set n=m=1 as well as α=0. With these parameters, the spides become plain 2x2 identity matrices (just look at the definitions!). While α=0 is denoted with an empty dot, this observation can be represented as:
Thus, as soon as we encounter single, plain dots with one incoming and one outgoing leg, we can remove them. Additionally, we will need to know, how to represent simple basis vectors in this diagrammatic language. This is simply done by using dots with a single leg and the following simple consideration according to the definitions of the spiders:
Of course, one can also describe |- > and |1> states, just apply α=π respectively. Note that we omit global phases here; thus using a simple equality sign is actually a delicate matter.
The Hadamard Gate
The Hadamard gate is a unitary gate which simply transforms between the X and Z basis; e.g. applying the Hadamard gate to a |0> state will result in |+>. Its graphical representation is just a plain box with one outcoming and one incoming leg - its action on the basis vectors is as follows:
Actually, this is one special case of the more general rule, that the application of Hadamards changes colors as follows:
This of course also holds if the colors are inversed. In general, all ZX rules hold under coherent exchange of colors.
The CNOT Gate
Another central gate in quantum computing is the CNOT gate, which is a controlled NOT gate, i.e. the target qubit is only flipped if the control qubit is |1>, otherwise nothing happens. This 2-qubit-gate can be represented as
The equality sign should be taken with care as well, because the left is in the quantum circuit notation, while the right is in ZX calculus notation. Its construction is explicitly explained in [2, pp. 11]. Since it is a bit lengthy to go through it by representing the diagrams as matrices, I leave it to you to check it in the reference in case you are interested.
The Fusion Rule
In general, it is possible to "fuse" dots of the same color, while adding their phases. Note that it is addition mod 2π because α and β are the exponents of e.
Later, we will only use a special case of this, namely that we can fuse dots of the same color which are connected by one line.
Now, we have finally settled the rough framework for analyzing the Bell circuit, which will do in the next part!
--- References: The ZX graphics were created with tikzit.github.io. Furthermore, you can find a lot of valuable information on zxcalculus.com. [1] Tensor Networks in a Nutshell - Biamonte, Bergholm. 2017. arXiv:1708.00006 [2] ZX-calculus for the working quantum computer scientist - Wetering. 2020. arXiv:2012.13966
ZX Calculus - Another Perspective on Quantum Circuits. Part II
Last time we introduced basic definitions and a small set of rules of the ZX calculus. While our aim is to analyze the Bell circuit in terms of this framework, you can find more sophisticated examples in [2, pp. 28]. For the Bell circuit we only need one further ingredient:
Cups and Caps
Cups and Caps are the ZX-type representations of the Bell State |Φ^+>. As you surely know, this state "lives" in a four dimensional Hilbert space, and can be represented as a vector with four entries - and in the ZX calculus this means:
In more complicated circuits it is neat to know that this Bell state actually acts as a bended piece of wire, which introduces a lot of flexibility in one's modifications of an expression. The cups and caps are merely vectorizations of the 2x2 identity matrix.
Application to the Bell Circuit
A brief reminder about the Bell circuit: It just applies a Hadamard and a CNOT on the input qubits. The outcome is supposed to be the Bell state |Φ^+>, i.e. a cup, as desribed above.
First, start by translating the circuit into ZX-language, by using the definitions we found in the previous entry. The circuit becomes:
Here, we simply expressed the |0> vectors as grey dots on the left, then applied a Hadamard on the first and afterwards a CNOT. Application of the Fusion rule on the two grey dots on the bottom yields:
Then, we apply the Hadamard on the grey dot (|0>) which changes its color:
Thus, we can again fuse two dots, in this case the two white dots above:
Then, we know that dots with a single income and outcome leg are actually just identities! As a result, our expression simplifies:
And this is exactly the cup we desired! Translating the circuit into ZX-language and applying the rules led us to the result that we have a Bell state in the end. Of course one could have evaluated this circuit easily by hand with the help of the matrix representations of the gates - nevertheless, I think it is a neat example to see the simplicity and beauty of the ZX-calculus. Check out [1] for more sophisticated examples!
Conclusion
Similar as tensor networks in general, the ZX calculus is a neat and beautiful framework which gives rise to a rich variety of applications - even though they resemble a lot, both are specifically tailored for different applications. A nice property of the ZX calculus is that it is universal: it can represent all 2^n x 2^m matrices and simultaneously it is a very intuitive and pictorial description [1, p.18]. As a final note: If you're familiar with condensed matter and tensor networks, you know that the AKLT state is of particular importance. It can also be described with the help of ZX Calculus and the framework is able to reveal its interesting properties as e.g. the string order [2].
--- References: The ZX graphics were created with tikzit.github.io. Furthermore, you can find a lot of valuable information on zxcalculus.com. [1] ZX-calculus for the working quantum computer scientist - Wetering. 2020. arXiv:2012.13966 [2] AKLT-States as ZX-Diagrams: Diagrammatic Reasoning for Quantum States - East, Wetering, Chancellor, Grushin. 2021. doi.org/10.1103/PRXQuantum.3.010302
‘What is space-time?’ sounds like a completely philosophical question,” Van Raamsdonk said. “To actually have some answer to that, one that is concrete and allows you to calculate space-time, is kind of amazing.
Tensor Networks and Entanglement | Quanta Magazine