Document Open Access Logo

Fast and Effective Techniques for T-Count Reduction via Spider Nest Identities

Authors Niel de Beaudrap , Xiaoning Bian, Quanlong Wang

Thumbnail PDF


  • Filesize: 0.74 MB
  • 23 pages

Document Identifiers

Author Details

Niel de Beaudrap
  • Department of Computer Science, University of Oxford, United Kingdom
Xiaoning Bian
  • Department of Mathematics & Statistics, Dalhousie University, Halifax, Canada
Quanlong Wang
  • Department of Computer Science, University of Oxford, United Kingdom
  • Cambridge Quantum Computing Ltd., Cambridge, United Kingdom


We thank Earl Campbell, Luke Heyfron, Alexander Cowtan, Aleks Kissinger, and John van de Wetering for helpful discussions. We extend a very special thanks to Matthew Amy, who wrote a small extension of feynver [Matthew Amy, 2018] to allow verification of procedures which post-select the |+> state, for the express purpose of helping us to independently verify the correctness of reductions such as appear in this work and in Ref. [Niel de Beaudrap et al., 2019]. X. Bian would like to thank his Ph.D. supervisor Peter Selinger for his support.

Cite AsGet BibTex

Niel de Beaudrap, Xiaoning Bian, and Quanlong Wang. Fast and Effective Techniques for T-Count Reduction via Spider Nest Identities. In 15th Conference on the Theory of Quantum Computation, Communication and Cryptography (TQC 2020). Leibniz International Proceedings in Informatics (LIPIcs), Volume 158, pp. 11:1-11:23, Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2020)


In fault-tolerant quantum computing systems, realising (approximately) universal quantum computation is usually described in terms of realising Clifford+T operations, which is to say a circuit of CNOT, Hadamard, and π/2-phase rotations, together with T operations (π/4-phase rotations). For many error correcting codes, fault-tolerant realisations of Clifford operations are significantly less resource-intensive than those of T gates, which motivates finding ways to realise the same transformation involving T-count (the number of T gates involved) which is as low as possible. Investigations into this problem [Matthew Amy et al., 2013; Gosset et al., 2014; Matthew Amy et al., 2014; Matthew Amy et al., 2018; Earl T. Campbell and Mark Howard, 2017; Matthew Amy and Michele Mosca, 2019] has led to observations that this problem is closely related to NP-hard tensor decomposition problems [Luke E. Heyfron and Earl T. Campbell, 2018] and is tantamount to the difficult problem of decoding exponentially long Reed-Muller codes [Matthew Amy and Michele Mosca, 2019]. This problem then presents itself as one for which must be content in practise with approximate optimisation, in which one develops an array of tactics to be deployed through some pragmatic strategy. In this vein, we describe techniques to reduce the T-count, based on the effective application of "spider nest identities": easily recognised products of parity-phase operations which are equivalent to the identity operation. We demonstrate the effectiveness of such techniques by obtaining improvements in the T-counts of a number of circuits, in run-times which are typically less than the time required to make a fresh cup of coffee.

Subject Classification

ACM Subject Classification
  • Computer systems organization → Quantum computing
  • T-count
  • Parity-phase operations
  • Phase gadgets
  • Clifford hierarchy
  • ZX calculus


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


  1. S. Aaronson and D. Gottesman. Improved simulation of stabilizer circuits. Phys. Rev. A, 70:052328, 2004. URL:
  2. Matthew Amy. Towards large-scale functional verification of universal quantum circuits. In Proceedings of QPL 2018, pages 1-21, 2018. [arXiv:1901.09476]; see also []. URL:
  3. Matthew Amy, Jianxin Chen, and Neil J. Ross. A finite presentation of cnot-dihedral operators. Electronic Proceedings in Theoretical Computer Science, 266:84-97, 2018. [arXiv:1701.00140]. URL:
  4. Matthew Amy, Dmitri Maslov, and Michele Mosca. Polynomial-time T-depth optimization of Clifford+T circuits via matroid partitioning. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 33(10):1476-1489, 2014. [arXiv:1303.2042]. URL:
  5. Matthew Amy, Dmitri Maslov, Michele Mosca, and Martin Roetteler. A meet-in-the-middle algorithm for fast synthesis of depth-optimal quantum circuits. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 32(6):818-830, 2013. [arXiv:1206.0758]. URL:
  6. Matthew Amy and Michele Mosca. T-count optimization and Reed-Muller codes. IEEE Transactions on Information Theory, 65(8):4771-4784, 2019. [arXiv:1601.07363]. URL:
  7. Xiaoning Bian. "stomp-code" github. URL:
  8. Sergey Bravyi, Dan Browne, Padraic Calpin, Earl Campbell, David Gosset, and Mark Howard. Simulation of quantum circuits by low-rank stabilizer decompositions. Quantum, 3:181, September 2019. [arXiv:1808.00128]. URL:
  9. Sergey Bravyi and David Gosset. Improved classical simulation of quantum circuits dominated by Clifford gates. Physical Review Letters, 116:250501, 2016. [arXiv:1601.07601]. URL:
  10. Earl T. Campbell and Mark Howard. A unified framework for magic state distillation and multi-qubit gate-synthesis with reduced resource cost. Physical Review A, 95:022316, 2017. [arXiv:1606.01904]. URL:
  11. Dalhousie University Mathstat Cluster. URL:
  12. Bob Coecke and Ross Duncan. Interacting quantum observables: categorical algebra and diagrammatics. New Journal of Physics, 13:043016, 2011. [arXiv:0906.4725]. URL:
  13. Bob Coecke and Aleks Kissinger. Picturing Quantum Processes: A First Course in Quantum Theory and Diagrammatic Reasoning. Cambridge University Press, 2017. URL:
  14. Niel de Beaudrap, Xiaoning Bian, and Quanlong Wang. Techniques to reduce π/4 -parity phase circuits, motivated by the zx calculus. In to appear in Proceedings of QPL 2019, 2019. [arXiv:1911.09039]. Google Scholar
  15. Niel de Beaudrap, Ross Duncan, Dominic Horsman, and Simon Perdrix. Pauli fusion: a computational model to realise quantum transformations from zx terms. In Proceedings of QPL 2019, page to appear, 2019. [arXiv:1904.12817]. Google Scholar
  16. Niel de Beaudrap and Dominic Horsman. The zx calculus is a language for surface code lattice surgery. Quantum, 4:218, 2020. [arXiv:1704.08670]. URL:
  17. Ross Duncan, Aleks Kissinger, Simon Perdrix, and John van de Wetering. Graph-theoretic simplification of quantum circuits with the zx-calculus. [arXiv:1902.03178], 2019. Google Scholar
  18. Ross Duncan and Simon Perdrix. Rewriting measurement-based quantum computations with generalised flow. In Samson Abramsky, Cyril Gavoille, Claude Kirchner, Friedhelm Meyer auf der Heide, and Paul G. Spirakis, editors, Automata, Languages and Programming, pages 285-296, Berlin, Heidelberg, 2010. Springer Berlin Heidelberg. URL:
  19. Simon Perdrix Emmanuel Jeandel and Renaud Vilmart. Completeness of the zx-calculus. [arXiv:1903.06035], 2019. Google Scholar
  20. Craig Gidney. Halving the cost of quantum addition. Quantum, 2:74, 2018. [arXiv:1709.06648]. URL:
  21. David Gosset, Vadym Kliuchnikov, Michele Mosca, and Vincent Russo. An algorithm for the t-count. Quantum Info. Comput., 14(15-16):1261-1276, November 2014. [arXiv:1308.4134]. Google Scholar
  22. D. Gottesman. Stabilizer codes and quantum error correction. 1997. Ph.D thesis. URL:
  23. Luke E. Heyfron and Earl T. Campbell. An efficient quantum compiler that reduces t count. Quantum Science and Technology, 4(1):015004, 2018. [arXiv:1712.01557]. URL:
  24. C. Horsman, A. G Fowler, S. Devitt, and R. Van Meter. Surface code quantum computing by lattice surgery. New Journal of Physics, 14(12):123011, 2012. [arXiv:1111.4022]. Google Scholar
  25. Cody Jones. Low-overhead constructions for the fault-tolerant toffoli gate. Phys. Rev. A, 87:022328, February 2013. [arXiv:1212.5069]. URL:
  26. Aleks Kissinger and John van de Wetering. Reducing t-count with the zx-calculus. [arXiv:1903.10477], 2019. Google Scholar
  27. Daniel Litinski. A Game of Surface Codes: Large-scale quantum computing with lattice surgery. Quantum, 3:128, 2019. [arXiv:1808.02892]. URL:
  28. Dmitri Maslov. Reversible Logic Synthesis Benchmarks page. Accessed February 2020. URL:
  29. Giulia Meuli, Mathias Soeken, Earl Campbell, Martin Roetteler, and Giovanni De Micheli. The role of multiplicative complexity in compiling low T-count oracle circuits. [arXiv:1908.01609], 2019. Google Scholar
  30. Yunseong Nam, Neil J. Ross, Yuan Su, Andrew M. Childs, and Dmitri Maslov. "optimiser" github. URL:
  31. Yunseong Nam, Neil J. Ross, Yuan Su, Andrew M. Childs, and Dmitri Maslov. Automated optimization of large quantum circuits with continuous parameters. npj Quantum Information, 4(1):23, 2018. [arXiv:1710.07345]. URL:
  32. Michael A Nielsen and Isaac Chuang. Quantum computation and quantum information. Cambridge University Press, Cambridge UK, 2000. Google Scholar
  33. Renaud Vilmart. A Near-Optimal Axiomatisation of ZX-Calculus for Pure Qubit Quantum Mechanics. In 34th Annual ACM/IEEE Symposium on Logic in Computer Science, pages 1-10, 2019. [arXiv:1812.09114]. URL:
  34. Fang Zhang and Jianxin Chen. Optimizing t gates in clifford+t circuit as π/4 rotations around paulis. [arXiv:1903.12456], 2019. Google Scholar
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