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.
Supplemental Material
- 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 Scholar
- Garrett Birkhof and John Von Neumann. 1936. The logic of quantum mechanics. Annals of mathematics ( 1936 ), 823ś843.Google Scholar
- Vladimir B Braginsky, Yuri I Vorontsov, and Kip S Thorne. 1980. Quantum nondemolition measurements. Science 209, 4456 ( 1980 ), 547ś557.Google Scholar
- Olivier Brunet and Philippe Jorrand. 2004. Dynamic quantum logic for quantum programs. International Journal of Quantum Information 2, 01 ( 2004 ), 45ś54.Google Scholar
Cross Ref
- 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 Scholar
Cross Ref
- 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 Scholar
- Google. 2018. Announcing Cirq : An Open Source Framework for NISQ Algorithms. https://ai.googleblog.com/ 2018 /07/ announcing-cirq-open-source-framework. html.Google Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- Aram W Harrow, Avinatan Hassidim, and Seth Lloyd. 2009. Quantum algorithm for linear systems of equations. Physical review letters 103, 15 ( 2009 ), 150502.Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- IBM. 2019. Gate and operation specification for quantum circuits. https://github.com/Qiskit/openqasm.Google Scholar
- 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 Scholar
- Gudrun Kalmbach. 1983. Orthomodular lattices. Vol. 18. Academic Pr.Google Scholar
- 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 Scholar
Cross Ref
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- Seth Lloyd, Masoud Mohseni, and Patrick Rebentrost. 2014. Quantum principal component analysis. Nature Physics 10, 9 ( 2014 ), 631ś633.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- Robert Rand, Jennifer Paykin, and Steve Zdancewic. 2018. QWIRE practice: Formal verification of quantum circuits in Coq. arXiv preprint arXiv: 1803. 00699 ( 2018 ).Google Scholar
- Rigetti. 2019. A Python library for quantum programming using Quil. https://github.com/rigetti/pyquil.Google Scholar
- Rigetti Forest team. 2019. Forest SDK. https://www.rigetti.com/forest.Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- Dominique Unruh. 2019. Quantum relational hoare logic. Proceedings of the ACM on Programming Languages 3, POPL ( 2019 ), 33.Google Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- William K Wootters and Wojciech H Zurek. 1982. A single quantum cannot be cloned. Nature 299, 5886 ( 1982 ), 802.Google Scholar
- 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 Scholar
Cross Ref
- Mingsheng Ying. 2011. Floydśhoare logic for quantum programs. ACM Transactions on Programming Languages and Systems (TOPLAS) 33, 6 ( 2011 ), 19.Google Scholar
Digital Library
- Mingsheng Ying. 2016. Foundations of Quantum Programming. Morgan Kaufmann.Google Scholar
- 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 Scholar
- Nengkun Yu. 2019. Quantum Temporal Logic. arXiv: 1908. 00158 [cs.LO]Google Scholar
- 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 Scholar
Digital Library
Index Terms
Projection-based runtime assertions for testing and debugging Quantum programs
Recommendations
Statistical assertions for validating patterns and finding bugs in quantum programs
ISCA '19: Proceedings of the 46th International Symposium on Computer ArchitectureIn support of the growing interest in quantum computing experimentation, programmers need new tools to write quantum algorithms as program code. Compared to debugging classical programs, debugging quantum programs is difficult because programmers have ...
Quantum Circuits for Dynamic Runtime Assertions in Quantum Computation
ASPLOS '20: Proceedings of the Twenty-Fifth International Conference on Architectural Support for Programming Languages and Operating SystemsIn this paper, we propose quantum circuits for runtime assertions, which can be used for both software debugging and error detection. Runtime assertion is challenging in quantum computing for two key reasons. First, a quantum bit (qubit) cannot be ...
Twist: sound reasoning for purity and entanglement in Quantum programs
Quantum programming languages enable developers to implement algorithms for quantum computers that promise computational breakthroughs in classically intractable tasks. Programming quantum computers requires awareness of entanglement, the phenomenon in ...






Comments