Document Open Access Logo

Compositionality of Planar Perfect Matchings: A Universal and Complete Fragment of ZW-Calculus

Authors Titouan Carette , Etienne Moutot , Thomas Perez, Renaud Vilmart

Thumbnail PDF


  • Filesize: 0.88 MB
  • 17 pages

Document Identifiers

Author Details

Titouan Carette
  • Centre for Quantum Computer Science, Faculty of Computing, University of Latvia, Riga, Latvia
Etienne Moutot
  • CNRS, I2M, Aix-Marseille Université, Marseille, France
Thomas Perez
  • Université de Lyon, ENS de Lyon, France
Renaud Vilmart
  • Université Paris-Saclay, ENS Paris-Saclay, Inria, CNRS, LMF, 91190, Gif-sur-Yvette, France

Cite AsGet BibTex

Titouan Carette, Etienne Moutot, Thomas Perez, and Renaud Vilmart. Compositionality of Planar Perfect Matchings: A Universal and Complete Fragment of ZW-Calculus. In 50th International Colloquium on Automata, Languages, and Programming (ICALP 2023). Leibniz International Proceedings in Informatics (LIPIcs), Volume 261, pp. 120:1-120:17, Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2023)


We exhibit a strong connection between the matchgate formalism introduced by Valiant and the ZW-calculus of Coecke and Kissinger. This connection provides a natural compositional framework for matchgate theory as well as a direct combinatorial interpretation of the diagrams of ZW-calculus through the perfect matchings of their underlying graphs. We identify a precise fragment of ZW-calculus, the planar W-calculus, that we prove to be complete and universal for matchgates, that are linear maps satisfying the matchgate identities. Computing scalars of the planar W-calculus corresponds to counting perfect matchings of planar graphs, and so can be carried in polynomial time using the FKT algorithm, making the planar W-calculus an efficiently simulable fragment of the ZW-calculus, in a similar way that the Clifford fragment is for ZX-calculus. This work opens new directions for the investigation of the combinatorial properties of ZW-calculus as well as the study of perfect matching counting through compositional diagrammatical technics.

Subject Classification

ACM Subject Classification
  • Theory of computation → Quantum computation theory
  • Theory of computation → Equational logic and rewriting
  • Mathematics of computing → Matchings and factors
  • Perfect Matchings Counting
  • Quantum Computing
  • Matchgates
  • ZW-Calculus
  • String Diagrams
  • Completeness


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. M Backens and A Kissinger. Zh: A complete graphical calculus for quantum computations involving classical non-linearity. Electronic Proceedings in Theoretical Computer Science, 287:23-42, 2019. Google Scholar
  2. Miriam Backens. A new holant dichotomy inspired by quantum computation. arXiv preprint, 2017. URL:
  3. Miriam Backens, Simon Perdrix, and Quanlong Wang. Towards a minimal stabilizer zx-calculus. Log. Methods Comput. Sci., 16(4), 2020. URL:
  4. Jin-yi Cai, Vinay Choudhary, and Pinyan Lu. On the theory of matchgate computations. Theory Comput. Syst., 45(1):108-132, 2009. URL:
  5. Jin-Yi Cai and Aaron Gorenstein. Matchgates revisited. Theory Comput., 10:167-197, 2014. URL:
  6. Titouan Carette. Wielding the ZX-calculus, Flexsymmetry, Mixed States, and Scalable Notations. (Manier le ZX-calcul, flexsymétrie, systèmes ouverts et limandes). PhD thesis, University of Lorraine, Nancy, France, 2021. URL:
  7. Bob Coecke and Ross Duncan. Interacting quantum observables. In Luca Aceto, Ivan Damgård, Leslie Ann Goldberg, Magnús M. Halldórsson, Anna Ingólfsdóttir, and Igor Walukiewicz, editors, Automata, Languages and Programming, 35th International Colloquium, ICALP 2008, Reykjavik, Iceland, July 7-11, 2008, Proceedings, Part II - Track B: Logic, Semantics, and Theory of Programming & Track C: Security and Cryptography Foundations, volume 5126 of Lecture Notes in Computer Science, pages 298-310. Springer, 2008. URL:
  8. Bob Coecke and Aleks Kissinger. The compositional structure of multipartite quantum entanglement. In Samson Abramsky, Cyril Gavoille, Claude Kirchner, Friedhelm Meyer auf der Heide, and Paul G. Spirakis, editors, Automata, Languages and Programming, 37th International Colloquium, ICALP 2010, Bordeaux, France, July 6-10, 2010, Proceedings, Part II, volume 6199 of Lecture Notes in Computer Science, pages 297-308. Springer, 2010. URL:
  9. Niel de Beaudrap, Aleks Kissinger, and Konstantinos Meichanetzidis. Tensor network rewriting strategies for satisfiability and counting. In Benoît Valiron, Shane Mansfield, Pablo Arrighi, and Prakash Panangaden, editors, Proceedings 17th International Conference on Quantum Physics and Logic, QPL 2020, Paris, France, June 2 - 6, 2020, volume 340 of EPTCS, pages 46-59, 2020. URL:
  10. Niel de Beaudrap, Aleks Kissinger, and John van de Wetering. Circuit extraction for zx-diagrams can be #p-hard. In Mikolaj Bojanczyk, Emanuela Merelli, and David P. Woodruff, editors, 49th International Colloquium on Automata, Languages, and Programming, ICALP 2022, July 4-8, 2022, Paris, France, volume 229 of LIPIcs, pages 119:1-119:19. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2022. URL:
  11. Giovanni de Felice, Amar Hadzihasanovic, and Kang Feng Ng. A diagrammatic calculus of fermionic quantum circuits. Log. Methods Comput. Sci., 15(3), 2019. URL:
  12. Amar Hadzihasanovic. A diagrammatic axiomatisation for qubit entanglement. In 30th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2015, Kyoto, Japan, July 6-10, 2015, pages 573-584. IEEE Computer Society, 2015. URL:
  13. Amar Hadzihasanovic, Kang Feng Ng, and Quanlong Wang. Two complete axiomatisations of pure-state qubit quantum computing. In Anuj Dawar and Erich Grädel, editors, Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2018, Oxford, UK, July 09-12, 2018, pages 502-511. ACM, 2018. URL:
  14. P. W. Kasteleyn. Graph theory and crystal physics. Graph Theory and Theoretical Physics, 1967. Google Scholar
  15. P.W. Kasteleyn. The statistics of dimers on a lattice: I. the number of dimer arrangements on a quadratic lattice. Physica, 27(12):1209-1225, 1961. URL:
  16. Aleks Kissinger, John van de Wetering, and Renaud Vilmart. Classical simulation of quantum circuits with partial and graphical stabiliser decompositions. In François Le Gall and Tomoyuki Morimae, editors, 17th Conference on the Theory of Quantum Computation, Communication and Cryptography, TQC 2022, July 11-15, 2022, Urbana Champaign, Illinois, USA, volume 232 of LIPIcs, pages 5:1-5:13. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2022. URL:
  17. Tuomas Laakkonen, Konstantinos Meichanetzidis, and John van de Wetering. A graphical #sat algorithm for formulae with small clause density. CoRR, abs/2212.08048, 2022. URL:
  18. Charles HC Little. An extension of kasteleyn’s method of enumerating the 1-factors of planar graphs. In Combinatorial Mathematics: Proceedings of the Second Australian Conference, pages 63-72. Springer, 1974. Google Scholar
  19. Michael A Nielsen and Isaac Chuang. Quantum computation and quantum information, 2002. Google Scholar
  20. Razin A Shaikh, Quanlong Wang, and Richie Yeung. How to sum and exponentiate hamiltonians in zxw calculus. arXiv preprint, 2022. URL:
  21. Simon Straub, Thomas Thierauf, and Fabian Wagner. Counting the number of perfect matchings in k5-free graphs. In IEEE 29th Conference on Computational Complexity, CCC 2014, Vancouver, BC, Canada, June 11-13, 2014, pages 66-77. IEEE Computer Society, 2014. URL:
  22. H. N. V. Temperley and Michael E. Fisher. Dimer problem in statistical mechanics-an exact result. The Philosophical Magazine: A Journal of Theoretical Experimental and Applied Physics, 6(68):1061-1063, 1961. URL:
  23. Leslie G. Valiant. The complexity of computing the permanent. Theoretical Computer Science, 8(2):189-201, 1979. URL:
  24. Leslie G. Valiant. Quantum circuits that can be simulated classically in polynomial time. SIAM J. Comput., 31(4):1229-1254, 2002. URL:
  25. Leslie G Valiant. Holographic algorithms. SIAM Journal on Computing, 37(5):1565-1594, 2008. Google Scholar
  26. John van de Wetering. Zx-calculus for the working quantum computer scientist. arXiv preprint, 2020. URL:
  27. Vijay V. Vazirani. NC algorithms for computing the number of perfect matchings in k3, 3-free graphs and related problems. In Rolf G. Karlsson and Andrzej Lingas, editors, SWAT 88, 1st Scandinavian Workshop on Algorithm Theory, Halmstad, Sweden, July 5-8, 1988, Proceedings, volume 318 of Lecture Notes in Computer Science, pages 233-242. Springer, 1988. URL:
  28. Quanlong Wang and Richie Yeung. Differentiating and integrating zx diagrams. arXiv preprint, 2022. URL:
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail