skip to main content

Projection-based runtime assertions for testing and debugging Quantum programs

Authors Info & Claims
Published:13 November 2020Publication History
Skip Abstract Section

Abstract

In this paper, we propose Proq, a runtime assertion scheme for testing and debugging quantum programs on a quantum computer. The predicates in Proq are represented by projections (or equivalently, closed subspaces of the state space), following Birkhoff-von Neumann quantum logic. The satisfaction of a projection by a quantum state can be directly checked upon a small number of projective measurements rather than a large number of repeated executions. On the theory side, we rigorously prove that checking projection-based assertions can help locate bugs or statistically assure that the semantic function of the tested program is close to what we expect, for both exact and approximate quantum programs. On the practice side, we consider hardware constraints and introduce several techniques to transform the assertions, making them directly executable on the measurement-restricted quantum computers. We also propose to achieve simplified assertion implementation using local projection technique with soundness guaranteed. We compare Proq with existing quantum program assertions and demonstrate the effectiveness and efficiency of Proq by its applications to assert two sophisticated quantum algorithms, the Harrow-Hassidim-Lloyd algorithm and Shor’s algorithm.

Skip Supplemental Material Section

Supplemental Material

Auxiliary Presentation Video

This is a presentation video of my talk at OOPSLA 2020 on our paper accepted in the research track. In this paper, we propose Proq, a runtime assertion for testing and debugging quantum programs on a quantum computer. The predicates in Proq are represented by projections and the satisfaction can be checked upon a small number of projective measurements without many repeated executions. In theory, we prove that checking Proq assertions can help locate bugs or statistically assure that the semantics of the tested program is close to what we expect. In practice, we consider hardware constraints and introduce several techniques to transform the assertions and make them directly executable. We also propose local projections to achieve simplified assertion implementations with soundness guaranteed. We compare Proq with existing assertions and demonstrate its effectiveness and efficiency by asserting two sophisticated quantum algorithms, the HHL algorithm and Shor’s algorithm.

References

  1. Ali Javadi Abhari, Arvin Faruque, Mohammad Javad Dousti, Lukas Svec, Oana Catu, Amlan Chakrabati, Chen-Fu Chiang, Seth Vanderwilt, John Black, Fred Chong, Margaret Martonosi, Martin Suchara, Ken Brown, Massoud Pedram, and Todd Brun. [n.d.]. 2012. Scafold: Quantum Programming Language. Technical Report. Technical Report TR-934-12. Princeton University.Google ScholarGoogle Scholar
  2. Garrett Birkhof and John Von Neumann. 1936. The logic of quantum mechanics. Annals of mathematics ( 1936 ), 823ś843.Google ScholarGoogle Scholar
  3. Vladimir B Braginsky, Yuri I Vorontsov, and Kip S Thorne. 1980. Quantum nondemolition measurements. Science 209, 4456 ( 1980 ), 547ś557.Google ScholarGoogle Scholar
  4. Olivier Brunet and Philippe Jorrand. 2004. Dynamic quantum logic for quantum programs. International Journal of Quantum Information 2, 01 ( 2004 ), 45ś54.Google ScholarGoogle ScholarCross RefCross Ref
  5. Jianxin Chen, Zhengfeng Ji, Bei Zeng, and D. L. Zhou. 2012. From ground states to local Hamiltonians. Phys. Rev. A 86 ( Aug 2012 ), 022339. Issue 2. https://doi.org/10.1103/PhysRevA.86.022339 Google ScholarGoogle ScholarCross RefCross Ref
  6. Jianxin Chen, Fang Zhang, Cupjin Huang, Michael Newman, and Yaoyun Shi. 2018. Classical simulation of intermediate-size quantum circuits. arXiv preprint arXiv: 1805. 01450 ( 2018 ).Google ScholarGoogle Scholar
  7. Google. 2018. Announcing Cirq : An Open Source Framework for NISQ Algorithms. https://ai.googleblog.com/ 2018 /07/ announcing-cirq-open-source-framework. html.Google ScholarGoogle Scholar
  8. Alexander S Green, Peter LeFanu Lumsdaine, Neil J Ross, Peter Selinger, and Benoît Valiron. 2013. Quipper: a scalable quantum programming language. In ACM SIGPLAN Notices, Vol. 48. ACM, 333ś342.Google ScholarGoogle Scholar
  9. 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. ACM, 212ś219.Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Aram W Harrow, Avinatan Hassidim, and Seth Lloyd. 2009. Quantum algorithm for linear systems of equations. Physical review letters 103, 15 ( 2009 ), 150502.Google ScholarGoogle Scholar
  11. Kesha Hietala, Robert Rand, Shih-Han Hung, Xiaodi Wu, and Michael Hicks. 2019. A Verified Optimizer for Quantum Circuits. arXiv preprint arXiv: 1912. 02250 ( 2019 ).Google ScholarGoogle Scholar
  12. Yipeng Huang and Margaret Martonosi. 2019a. QDB: From Quantum Algorithms Towards Correct Quantum Programs. In 9th Workshop on Evaluation and Usability of Programming Languages and Tools (PLATEAU 2018 ). Schloss DagstuhlLeibniz-Zentrum fuer Informatik.Google ScholarGoogle Scholar
  13. Yipeng Huang and Margaret Martonosi. 2019b. Statistical assertions for validating patterns and finding bugs in quantum programs. In Proceedings of the 46th International Symposium on Computer Architecture. ACM, 541ś553.Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. IBM. 2019. Gate and operation specification for quantum circuits. https://github.com/Qiskit/openqasm.Google ScholarGoogle Scholar
  15. Ali JavadiAbhari, Shruti Patil, Daniel Kudrow, Jef Heckey, Alexey Lvov, Frederic T Chong, and Margaret Martonosi. 2015. ScafCC: Scalable compilation and analysis of quantum programs. Parallel Comput. 45 ( 2015 ), 2ś17.Google ScholarGoogle Scholar
  16. Gudrun Kalmbach. 1983. Orthomodular lattices. Vol. 18. Academic Pr.Google ScholarGoogle Scholar
  17. Yangjia Li and Mingsheng Ying. 2014. Debugging quantum processes using monitoring measurements. Phys. Rev. A 89 ( Apr 2014 ), 042338. Issue 4. https://doi.org/10.1103/PhysRevA.89.042338 Google ScholarGoogle ScholarCross RefCross Ref
  18. Noah Linden, Sandu Popescu, and William Wootters. 2002. Almost Every Pure State of Three Qubits Is Completely Determined by Its Two-Particle Reduced Density Matrices. Phys. Rev. Lett. 89 (Oct 2002 ), 207901. Issue 20. https: //doi.org/10.1103/PhysRevLett.89.207901 Google ScholarGoogle ScholarCross RefCross Ref
  19. Ji Liu, Gregory T Byrd, and Huiyang Zhou. 2020. Quantum Circuits for Dynamic Runtime Assertions in Quantum Computation. In Proceedings of the Twenty-Fifth International Conference on Architectural Support for Programming Languages and Operating Systems. 1017ś1030.Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Seth Lloyd, Masoud Mohseni, and Patrick Rebentrost. 2014. Quantum principal component analysis. Nature Physics 10, 9 ( 2014 ), 631ś633.Google ScholarGoogle Scholar
  21. Michael A Nielsen and Isaac L Chuang. 2010. Quantum Computation and Quantum Information. Quantum Computation and Quantum Information, by Michael A. Nielsen, Isaac L. Chuang, Cambridge, UK: Cambridge University Press, 2010 ( 2010 ).Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. 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 Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Alberto Peruzzo, Jarrod McClean, Peter Shadbolt, Man-Hong Yung, Xiao-Qi Zhou, Peter J Love, Alán Aspuru-Guzik, and Jeremy L O'brien. 2014. A variational eigenvalue solver on a photonic quantum processor. Nature communications 5 ( 2014 ), 4213.Google ScholarGoogle Scholar
  24. Robert Rand, Jennifer Paykin, and Steve Zdancewic. 2018. QWIRE practice: Formal verification of quantum circuits in Coq. arXiv preprint arXiv: 1803. 00699 ( 2018 ).Google ScholarGoogle Scholar
  25. Rigetti. 2019. A Python library for quantum programming using Quil. https://github.com/rigetti/pyquil.Google ScholarGoogle Scholar
  26. Rigetti Forest team. 2019. Forest SDK. https://www.rigetti.com/forest.Google ScholarGoogle Scholar
  27. 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 preprint arXiv: 1908. 08963 ( 2019 ).Google ScholarGoogle Scholar
  28. Peter W Shor. 1999. Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM review 41, 2 ( 1999 ), 303ś332.Google ScholarGoogle Scholar
  29. Krysta M Svore, Alan Geller, Matthias Troyer, John Azariah, Christopher Granade, Bettina Heim, Vadym Kliuchnikov, Mariia Mykhailova, Andres Paz, and Martin Roetteler. 2018. Q#: Enabling scalable quantum computing and development with a high-level domain-specific language. arXiv preprint arXiv: 1803. 00652 ( 2018 ).Google ScholarGoogle Scholar
  30. Dominique Unruh. 2019. Quantum relational hoare logic. Proceedings of the ACM on Programming Languages 3, POPL ( 2019 ), 33.Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Lieven MK Vandersypen, Matthias Stefen, Gregory Breyta, Costantino S Yannoni, Mark H Sherwood, and Isaac L Chuang. 2001. Experimental realization of Shor's quantum factoring algorithm using nuclear magnetic resonance. Nature 414, 6866 ( 2001 ), 883.Google ScholarGoogle Scholar
  32. A. Winter. 1999. Coding theorem and strong converse for quantum channels. IEEE Transactions on Information Theory 45, 7 (Nov 1999 ), 2481ś2485. https://doi.org/10.1109/18.796385 Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. William K Wootters and Wojciech H Zurek. 1982. A single quantum cannot be cloned. Nature 299, 5886 ( 1982 ), 802.Google ScholarGoogle Scholar
  34. Tao Xin, Dawei Lu, Joel Klassen, Nengkun Yu, Zhengfeng Ji, Jianxin Chen, Xian Ma, Guilu Long, Bei Zeng, and Raymond Laflamme. 2017. Quantum State Tomography via Reduced Density Matrices. Phys. Rev. Lett. 118 (Jan 2017 ), 020401. Issue 2. https://doi.org/10.1103/PhysRevLett.118.020401 Google ScholarGoogle ScholarCross RefCross Ref
  35. Mingsheng Ying. 2011. Floydśhoare logic for quantum programs. ACM Transactions on Programming Languages and Systems (TOPLAS) 33, 6 ( 2011 ), 19.Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Mingsheng Ying. 2016. Foundations of Quantum Programming. Morgan Kaufmann.Google ScholarGoogle Scholar
  37. Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji. 2010. Predicate transformer semantics of quantum programs. Semantic Techniques in Quantum Computation 8 ( 2010 ), 311ś360.Google ScholarGoogle Scholar
  38. Nengkun Yu. 2019. Quantum Temporal Logic. arXiv: 1908. 00158 [cs.LO]Google ScholarGoogle Scholar
  39. Li Zhou, Nengkun Yu, and Mingsheng Ying. 2019. An applied quantum Hoare logic. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation. ACM, 1149ś1162.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Projection-based runtime assertions for testing and debugging Quantum programs

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!