skip to main content
research-article
Open access

A verified optimizer for Quantum circuits

Published: 04 January 2021 Publication History

Abstract

We present VOQC, the first fully verified optimizer for quantum circuits, written using the Coq proof assistant. Quantum circuits are expressed as programs in a simple, low-level language called SQIR, a simple quantum intermediate representation, which is deeply embedded in Coq. Optimizations and other transformations are expressed as Coq functions, which are proved correct with respect to a semantics of SQIR programs. SQIR uses a semantics of matrices of complex numbers, which is the standard for quantum computation, but treats matrices symbolically in order to reason about programs that use an arbitrary number of quantum bits. SQIR's careful design and our provided automation make it possible to write and verify a broad range of optimizations in VOQC, including full-circuit transformations from cutting-edge optimizers.

References

[1]
Samson Abramsky and Bob Coecke. 2009. Categorical quantum mechanics. Handbook of quantum logic and quantum structures 2 ( 2009 ), 261-325.
[2]
Matthew Amy. 2018. Towards large-scale functional verification of universal quantum circuits. https://www.mathstat.dal. ca/qpl2018/papers/QPL_2018_paper_30.pdf. Presented at QPL 2018.
[3]
Matthew Amy. 2019. Sized types for low-level quantum metaprogramming. In Reversible Computation, Michael Kirkedal Thomsen and Mathias Soeken (Eds.). Springer International Publishing, Cham, 87-107. https://doi.org/10.1007/978-3-030-21500-2_6
[4]
Matthew Amy, Parsiad Azimzadeh, and Michele Mosca. 2018. On the controlled-NOT complexity of controlled-NOT-phase circuits. Quantum Science and Technology 4, 1 ( 2018 ).
[5]
Matthew Amy, Dmitri Maslov, and Michele Mosca. 2013. Polynomial-time T-depth optimization of Cliford+T circuits via matroid partitioning. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems 33 (03 2013 ). https://doi.org/10.1109/TCAD. 2014.2341953
[6]
Matthew Amy, Martin Roetteler, and Krysta M. Svore. 2017. Verified compilation of space-eficient reversible circuits. In Proceedings of the 28th International Conference on Computer Aided Verification (CAV 2017 ). Springer. https://www. microsoft.com/en-us/research/publication/verified-compilation-of-space-eficient-reversible-circuits/
[7]
Charles H Bennett and Gilles Brassard. 2020. Quantum cryptography: Public key distribution and coin tossing. arXiv preprint arXiv: 2003. 06557 ( 2020 ).
[8]
Benjamin Bichsel, Maximilian Baader, Timon Gehr, and Martin Vechev. 2020. Silq: A high-level quantum language with safe uncomputation and intuitive semantics. In Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2020 ). Association for Computing Machinery, New York, NY, USA. https: //doi.org/10.1145/3385412.3386007
[9]
Jaap Boender, Florian Kammüller, and Rajagopal Nagarajan. 2015. Formalization of quantum protocols using Coq. In Proceedings of the 12th International Workshop on Quantum Physics and Logic, Oxford, U.K., July 15-17, 2015 (Electronic Proceedings in Theoretical Computer Science, Vol. 195 ), Chris Heunen, Peter Selinger, and Jamie Vicary (Eds.). Open Publishing Association, 71-83. https://doi.org/10.4204/EPTCS.195.6
[10]
Cambridge Quantum Computing Ltd. 2019. pytket. https://cqcl.github.io/pytket/build/html/index.html
[11]
Christophe Chareton, Sébastien Bardin, François Bobot, Valentin Perrelle, and Benoit Valiron. 2020. Toward certified quantum programming. arXiv e-prints ( 2020 ). arXiv: 2003. 05841 [cs.PL]
[12]
Bob Coecke and Ross Duncan. 2009. Interacting quantum observables: Categorical algebra and diagrammatics. New Journal of Physics 13 ( 06 2009 ). https://doi.org/10.1088/ 1367-2630/13/4/043016
[13]
The Coq Development Team. 2019. The Coq proof assistant, version 8.10.0. https://doi.org/10.5281/zenodo.3476303
[14]
Andrew W. Cross, Lev S. Bishop, John A. Smolin, and Jay M. Gambetta. 2017. Open quantum assembly language. arXiv e-prints ( Jul 2017 ). arXiv: 1707.03429 [quant-ph]
[15]
Andrew Fagan and Ross Duncan. 2018. Optimising Cliford circuits with Quantomatic. In Proceedings of the 15th International Conference on Quantum Physics and Logic, QPL 2018, Halifax, Nova Scotia, 3-7 June 2018. https://doi.org/10.4204/EPTCS. 287.5
[16]
Jean-Christophe Filliâtre and Andrei Paskevich. 2013. Why3-Where programs meet provers. In Proceedings of the 22nd European Symposium on Programming (Lecture Notes in Computer Science).
[17]
Daniel Gottesman. 2010. An introduction to quantum error correction and fault-tolerant quantum computation. In Quantum information science and its contributions to mathematics, Proceedings of Symposia in Applied Mathematics, Vol. 68. 13-58.
[18]
Alexander Green, Peter LeFanu Lumsdaine, Neil J. Ross, Peter Selinger, and Benoît Valiron. 2013. Quipper: A scalable quantum programming language. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2013 ). 333-342. https://doi.org/10.1145/2491956.2462177
[19]
Alexander S Green. 2010. Towards a formally verified functional quantum programming language. Ph.D. Dissertation. University of Nottingham.
[20]
Daniel M. Greenberger, Michael A. Horne, and Anton Zeilinger. 1989. Going beyond Bell's Theorem. Springer Netherlands, Dordrecht, 69-72. https://doi.org/10.1007/ 978-94-017-0849-4_10
[21]
Lov K Grover. 1996. A fast quantum mechanical algorithm for database search. In Proceedings of the twenty-eighth annual ACM Symposium on Theory of Computing. 212-219.
[22]
Luke Heyfron and Earl T. Campbell. 2018. An eficient quantum compiler that reduces T count. Quantum Science and Technology 4 ( 2018 ). https://doi.org/10.1088/2058-9565/aad604
[23]
Kesha Hietala, Robert Rand, Shih-Han Hung, Liyi Li, and Michael Hicks. 2020a. Proving Quantum Programs Correct. arXiv: 2010. 01240 [cs.PL]
[24]
Kesha Hietala, Robert Rand, Shih-Han Hung, Xiaodi Wu, and Michael Hicks. 2020b. A Verified Optimizer for Quantum Circuits. arXiv: 1912. 02250 [cs.PL]
[25]
IBM. [n.d.]. IBM Q5 Tenerife V1.x.x version log. https://github.com/Qiskit/ibmq-device-information/blob/master/backends/ tenerife/V1/version_log.md
[26]
IBM Research Editorial Staf. 2018. We have winners!... of the IBM Qiskit developer challenge. https://www.ibm.com/ blogs/research/2018/08/winners-qiskit-developer-challenge/
[27]
Ali Javadi-Abhari, Shruti Patil, Daniel Kudrow, Jef Heckey, Alexey Lvov, Frederic T. Chong, and Margaret Martonosi. 2014. ScafCC: A framework for compilation and analysis of quantum computing programs. In Proceedings of the 11th ACM Conference on Computing Frontiers (Cagliari, Italy) (CF '14). ACM, New York, NY, USA, Article 1, 10 pages. https://doi.org/10.1145/2597917.2597939
[28]
Emmanuel Jeandel, Simon Perdrix, and Renaud Vilmart. 2018. A complete axiomatisation of the ZX-calculus for Cliford+ T quantum mechanics. In Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science. ACM, 559-568. https://doi.org/10.1145/3209108.3209131
[29]
Jacques-Henri Jourdan, François Pottier, and Xavier Leroy. 2012. Validating LR(1) parsers. In Programming Languages and Systems, Helmut Seidl (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 397-416.
[30]
Aleks Kissinger and John van de Wetering. 2019. Reducing T-count with the ZX-calculus. arXiv e-prints ( 2019 ). arXiv: 1903.10477 [quant-ph]
[31]
Aleks Kissinger and John van de Wetering. 2020. PyZX: Large scale automated diagrammatic reasoning. Electronic Proceedings in Theoretical Computer Science 318 ( 04 2020 ), 230-242. https://doi.org/10.4204/EPTCS.318.14
[32]
Aleks Kissinger and Vladimir Zamdzhiev. 2015. Quantomatic: A proof assistant for diagrammatic reasoning. In Automated Deduction-CADE-25, Amy P. Felty and Aart Middeldorp (Eds.). Springer International Publishing, Cham, 326-336.
[33]
Emmanuel Knill. 1996. Conventions for quantum pseudocode. Technical Report. Los Alamos National Lab., NM (United States).
[34]
Xavier Leroy. 2009. Formal verification of a realistic compiler. Commun. ACM 52, 7 ( July 2009 ), 107-115. https://doi.org/10/ c9sb7q
[35]
Margaret Martonosi and Martin Roetteler. 2019. Next steps in quantum computing: computer science's role. arXiv: 1903. 10541 [cs.ET]
[36]
Guillaume Melquiond. 2020. Interval package for Coq. https://gitlab.inria.fr/coqinterval/interval
[37]
D. M. Miller and M. A. Thornton. 2006. QMDD: A decision diagram structure for reversible and quantum circuits. In 36th International Symposium on Multiple-Valued Logic (ISMVL'06). 30-30. https://doi.org/10.1109/ISMVL. 2006.35
[38]
Yunseong Nam, Neil J. Ross, Yuan Su, Andrew M. Childs, and Dmitri Maslov. 2018. Automated optimization of large quantum circuits with continuous parameters. npj Quantum Information 4, 1 ( 2018 ), 23. https://doi.org/10.1038/s41534-018-0072-4
[39]
Adam Paetznick and Krysta M Svore. 2014. Repeat-until-success: non-deterministic decomposition of single-qubit unitaries. Quantum Information & Computation 14, 15-16 ( 2014 ), 1277-1301.
[40]
Jennifer Paykin, Robert Rand, and Steve Zdancewic. 2017. QWIRE: A core language for quantum circuits. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (Paris, France) (POPL 2017 ). ACM, New York, NY, USA, 846-858. https://doi.org/10.1145/3009837.3009894
[41]
Frank Pfenning and Conal Elliott. 1988. Higher-order abstract syntax. In Proceedings of the ACM SIGPLAN 1988 Conference on Programming Language Design and Implementation (Atlanta, Georgia, USA) ( PLDI '88). ACM, New York, NY, USA, 199-208. https://doi.org/10.1145/53990.54010
[42]
Robert Rand. 2018. Formally verified quantum programming. Ph.D. Dissertation. University of Pennsylvania.
[43]
Robert Rand, Jennifer Paykin, Dong-Ho Lee, and Steve Zdancewic. 2018b. ReQWIRE: Reasoning about reversible quantum circuits. In Proceedings of the 15th International Conference on Quantum Physics and Logic, QPL 2018, Halifax, Nova Scotia, 3-7 June 2018. https://doi.org/10.4204/EPTCS.287.17
[44]
Robert Rand, Jennifer Paykin, and Steve Zdancewic. 2017. QWIRE practice: Formal verification of quantum circuits in Coq. In Proceedings 14th International Conference on Quantum Physics and Logic, QPL 2017, Nijmegen, The Netherlands, 3-7 July 2017. 119-132. https://doi.org/10.4204/EPTCS.266.8
[45]
Robert Rand, Jennifer Paykin, and Steve Zdancewic. 2018a. Phantom types for quantum programs. The Fourth International Workshop on Coq for Programming Languages.
[46]
Rigetti Computing. 2019a. Pyquil documentation. http://pyquil.readthedocs.io/en/latest/
[47]
Rigetti Computing. 2019b. The @rigetti optimizing Quil compiler. https://github.com/rigetti/quilc
[48]
Mehdi Saeedi, Robert Wille, and Rolf Drechsler. 2011. Synthesis of quantum circuits for linear nearest neighbor architectures. Quantum Information Processing 10, 3 ( 01 Jun 2011 ), 355-377. https://doi.org/10.1007/s11128-010-0201-2
[49]
Peter Selinger. 2004. Towards a quantum programming language. Mathematical Structures in Computer Science 14, 4 (Aug. 2004 ), 527-586. https://doi.org/10.1017/S0960129504004256
[50]
Yunong Shi, Xupeng Li, Runzhou Tao, Ali Javadi-Abhari, Andrew W. Cross, Frederic T. Chong, and Ronghui Gu. 2019. Contract-based verification of a realistic quantum compiler. arXiv e-prints ( Aug 2019 ). arXiv: 1908.08963 [quant-ph]
[51]
P. W. Shor. 1994. Algorithms for quantum computation: Discrete logarithms and factoring. In Proceedings 35th Annual Symposium on Foundations of Computer Science (FOCS '94).
[52]
DR Simon. 1994. On the power of quantum computation. In Proceedings of the 35th Annual Symposium on Foundations of Computer Science. 116-123.
[53]
Kartik Singhal, Robert Rand, and Michael Hicks. 2020. Verified translation between low-level quantum languages. The First International Workshop on Programming Languages for Quantum Computing.
[54]
Kaitlin N. Smith and Mitchell A. Thornton. 2019. A quantum computational compiler and design tool for technology-specific targets. In Proceedings of the 46th International Symposium on Computer Architecture (ISCA '19). https://doi.org/10.1145/ 3307650.3322262
[55]
Robert S. Smith, Michael J. Curtis, and William J. Zeng. 2016. A practical quantum instruction set architecture. arXiv e-prints (Aug 2016 ). arXiv: 1608.03355 [quant-ph]
[56]
Damian S. Steiger, Thomas Häner, and Matthias Troyer. 2018. ProjectQ: An open source software framework for quantum computing. Quantum 2 ( 2018 ), 49. https://doi.org/10.22331/q-2018-01-31-49
[57]
Swamit S. Tannu and Moinuddin K. Qureshi. 2019. Not all qubits are created equal: A case for variability-aware policies for NISQ-era quantum computers. In Proceedings of the Twenty-Fourth International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS '19). https://doi.org/10.1145/3297858.3304007
[58]
The Cirq Developers. 2019. Cirq: A python library for NISQ circuits. https://cirq.readthedocs.io/en/stable/
[59]
Mingsheng Ying. 2011. Floyd-hoare logic for quantum programs. ACM Transactions on Programming Languages and Systems (TOPLAS) 33, 6 ( 2011 ), 19. https://doi.org/10.1145/2049706.2049708
[60]
Vladimir Zamdzhiev. 2016. Quantum computing: The good, the bad, and the (not so) ugly! Invited talk, Tulane University.
[61]
Alwin Zulehner, Alexandru Paler, and Robert Wille. 2017. An eficient methodology for mapping quantum circuits to the IBM QX architectures. arXiv e-prints ( Dec 2017 ). arXiv: 1712.04722 [quant-ph]

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Programming Languages
Proceedings of the ACM on Programming Languages  Volume 5, Issue POPL
January 2021
1789 pages
EISSN:2475-1421
DOI:10.1145/3445980
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution International 4.0 License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 04 January 2021
Published in PACMPL Volume 5, Issue POPL

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. Certified Compilation
  2. Circuit Optimization
  3. Formal Verification
  4. Programming Languages
  5. Quantum Computing

Qualifiers

  • Research-article

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)536
  • Downloads (Last 6 weeks)76
Reflects downloads up to 29 Jan 2025

Other Metrics

Citations

Cited By

View all

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media