Qirella – The ZX-Calculus

Additionally to the quantum circuit simulation, which is currently still work in progress, Qirella also allows creating, viewing and editing ZX-diagrams as well as applying the rewrite rules of the ZX-Calculus in real-time. You can test it here: https://qirella.geosearchef.de/

The ZX-Calculus is a graphical notation for representing linear maps and a collection of rewrite rules for transforming those diagrams into other diagrams representing the same linear map. As quantum circuits are essentially unitary maps, ZX-diagrams represent a superset of them.

A quantum circuit swapping two qubits using CNOTs
A quantum circuit swapping the first and second qubit (after preparing a superposition on the first one)

Thus, every quantum circuit can be transformed into a ZX-diagram representing the same map, and some ZX-diagrams can be converted back to quantum circuits.

A ZX diagram swapping two qubits using CNOTs
The same linear map represented as a ZX-diagram

The ZX-calculus can therefore be used to optimize quantum circuits and reduce their gate count by first converting them to their ZX representation, using the rewrite rules to optimize them and afterwards extracting a circuit from the diagram.

Proving the diagram shown above actually just swaps the two qubits
Proving the Hopf law itself using the other rules of the calculus
Proving that the Hadamard gate is self inverse using the ZX-Calculus