Abstract
Bug-catching is important for developing quantum programs. Motivated by the incorrectness logic for classical programs, we propose an incorrectness logic towards a logical foundation for static bug-catching in quantum programming. The validity of formulas in this logic is dual to that of quantum Hoare logics. We justify the formulation of validity by an intuitive explanation from a reachability point of view and a comparison against several alternative formulations. Compared with existing works focusing on dynamic analysis, our logic provides sound and complete arguments. We further demonstrate the usefulness of the logic by reasoning several examples, including Grover's search, quantum teleportation, and a repeat-until-success program. We also automate the reasoning procedure by a prototyped static analyzer built on top of the logic rules.
- Ali J Abhari, Arvin Faruque, Mohammad J Dousti, Lukas Svec, Oana Catu, Amlan Chakrabati, Chen-Fu Chiang, Seth Vanderwilt, John Black, and Fred Chong. 2012. Scaffold: Quantum programming language. Princeton Univ NJ Dept of Computer Science.Google Scholar
- Gadi Aleksandrowicz. 2019. Qiskit: An Open-source Framework for Quantum Computing. https://doi.org/10.5281/zenodo.2562111 Google Scholar
Cross Ref
- Frank Arute, Kunal Arya, Ryan Babbush, Dave Bacon, Joseph C Bardin, Rami Barends, Rupak Biswas, Sergio Boixo, Fernando GSL Brandao, and David A Buell. 2019. Quantum supremacy using a programmable superconducting processor. Nature, 574, 7779 (2019), 505–510. https://doi.org/10.1038/s41586-019-1666-5 Google Scholar
- Gilles Barthe, Justin Hsu, Mingsheng Ying, Nengkun Yu, and Li Zhou. 2019. Relational Proofs for Quantum Programs. Proc. ACM Program. Lang., 4, POPL (2019), Article 21, dec, 29 pages. https://doi.org/10.1145/3371089 Google Scholar
Digital Library
- Garrett Birkhoff and John Von Neumann. 1936. The Logic of Quantum Mechanics. Annals of Mathematics, 37, 4 (1936), 823–843. issn:0003486X http://www.jstor.org/stable/1968621Google Scholar
Cross Ref
- Sam Blackshear, Nikos Gorogiannis, Peter W. O’Hearn, and Ilya Sergey. 2018. RacerD: Compositional Static Race Detection. Proc. ACM Program. Lang., 2, OOPSLA (2018), Article 144, oct, 28 pages. https://doi.org/10.1145/3276514 Google Scholar
Digital Library
- Alex Bocharov, Martin Roetteler, and Krysta M. Svore. 2015. Efficient Synthesis of Universal Repeat-Until-Success Quantum Circuits. Phys. Rev. Lett., 114 (2015), Feb, 080502. https://doi.org/10.1103/PhysRevLett.114.080502 Google Scholar
Cross Ref
- Andrew Cross, Ali Javadi-Abhari, Thomas Alexander, Niel de Beaudrap, Lev S. Bishop, Steven Heidel, Colm A. Ryan, Prasahnt Sivarajah, John Smolin, Jay M. Gambetta, and Blake R. Johnson. 2021. OpenQASM 3: A Broader and Deeper Quantum Assembly Language. ACM Transactions on Quantum Computing, dec, issn:2643-6809 https://doi.org/10.1145/3505636 Just Accepted Google Scholar
Digital Library
- Cirq Developers. 2021. Cirq. https://doi.org/10.5281/zenodo.5182845 See full list of authors on Github: https://github.com/ quantumlib/Cirq/graphs/contributors Google Scholar
Cross Ref
- Ellie D’hondt and Prakash Panangaden. 2006. Quantum Weakest Preconditions. Mathematical. Structures in Comp. Sci., 16, 3 (2006), jun, 429–451. issn:0960-1295 https://doi.org/10.1017/S0960129506005251 Google Scholar
Digital Library
- Dino Distefano, Manuel Fähndrich, Francesco Logozzo, and Peter W. O’Hearn. 2019. Scaling Static Analyses at Facebook. Commun. ACM, 62, 8 (2019), jul, 62–70. issn:0001-0782 https://doi.org/10.1145/3338112 Google Scholar
Digital Library
- Nikos Gorogiannis, Peter W. O’Hearn, and Ilya Sergey. 2019. A True Positives Theorem for a Static Race Detector. Proc. ACM Program. Lang., 3, POPL (2019), Article 57, jan, 29 pages. https://doi.org/10.1145/3290370 Google Scholar
Digital Library
- Alexander S. Green, Peter LeFanu Lumsdaine, Neil J. Ross, Peter Selinger, and Benoît Valiron. 2013. Quipper: A Scalable Quantum Programming Language. SIGPLAN Not., 48, 6 (2013), jun, 333–342. issn:0362-1340 https://doi.org/10.1145/2499370.2462177 Google Scholar
Digital Library
- 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 (STOC ’96). Association for Computing Machinery, New York, NY, USA. 212–219. isbn:0897917855 https://doi.org/10.1145/237814.237866 Google Scholar
Digital Library
- Yipeng Huang and Margaret Martonosi. 2019. QDB: From Quantum Algorithms Towards Correct Quantum Programs. In 9th Workshop on Evaluation and Usability of Programming Languages and Tools (PLATEAU 2018), Titus Barik, Joshua Sunshine, and Sarah Chasins (Eds.) (OpenAccess Series in Informatics (OASIcs), Vol. 67). Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany. 4:1–4:14. isbn:978-3-95977-091-0 issn:2190-6807 https://doi.org/10.4230/OASIcs.PLATEAU.2018.4 Google Scholar
Cross Ref
- Yipeng Huang and Margaret Martonosi. 2019. Statistical Assertions for Validating Patterns and Finding Bugs in Quantum Programs. In Proceedings of the 46th International Symposium on Computer Architecture (ISCA ’19). Association for Computing Machinery, New York, NY, USA. 541–553. isbn:9781450366694 https://doi.org/10.1145/3307650.3322213 Google Scholar
Digital Library
- Shih-Han Hung, Kesha Hietala, Shaopeng Zhu, Mingsheng Ying, Michael Hicks, and Xiaodi Wu. 2019. Quantitative robustness analysis of quantum programs. Proc. ACM Program. Lang., 3, POPL (2019), 31:1–31:29. https://doi.org/10.1145/3290344 Google Scholar
Digital Library
- Ali JavadiAbhari, Shruti Patil, Daniel Kudrow, Jeff Heckey, Alexey Lvov, Frederic T. Chong, and Margaret Martonosi. 2015. ScaffCC: Scalable compilation and analysis of quantum programs. Parallel Comput., 45, C (2015), jun, 2–17. issn:0167-8191 https://doi.org/10.1016/j.parco.2014.12.001 Google Scholar
Digital Library
- Yoshihiko Kakutani. 2009. A Logic for Formal Verification of Quantum Programs. In Proceedings of the 13th Asian Conference on Advances in Computer Science: Information Security and Privacy (ASIAN’09). Springer-Verlag, Berlin, Heidelberg. 79–93. isbn:3642106218 https://doi.org/10.1007/978-3-642-10622-4_7 Google Scholar
Digital Library
- Gushu Li, Li Zhou, Nengkun Yu, Yufei Ding, Mingsheng Ying, and Yuan Xie. 2020. Projection-Based Runtime Assertions for Testing and Debugging Quantum Programs. Proc. ACM Program. Lang., 4, OOPSLA (2020), Article 150, nov, 29 pages. https://doi.org/10.1145/3428218 Google Scholar
Digital Library
- Yangjia Li and Mingsheng Ying. 2014. Debugging quantum processes using monitoring measurements. Phys. Rev. A, 89 (2014), Apr, 042338. https://doi.org/10.1103/PhysRevA.89.042338 Google Scholar
Cross Ref
- Ji Liu, Gregory T. Byrd, and Huiyang Zhou. 2020. Quantum Circuits for Dynamic Runtime Assertions in Quantum Computation. Association for Computing Machinery, New York, NY, USA. 1017–1030. isbn:9781450371025 https://doi.org/10.1145/3373376.3378488 Google Scholar
Digital Library
- Peter W. O’Hearn. 2019. Incorrectness Logic. Proc. ACM Program. Lang., 4, POPL (2019), Article 10, dec, 32 pages. https://doi.org/10.1145/3371078 Google Scholar
Digital Library
- Adam Paetznick and Krysta M. Svore. 2014. Repeat-until-Success: Non-Deterministic Decomposition of Single-Qubit Unitaries. Quantum Info. Comput., 14, 15–16 (2014), nov, 1277–1301. issn:1533-7146 https://doi.org/10.26421/QIC14.15-16-2 Google Scholar
Cross Ref
- Jennifer Paykin, Robert Rand, and Steve Zdancewic. 2017. QWIRE: A Core Language for Quantum Circuits. SIGPLAN Not., 52, 1 (2017), Jan, 846–858. issn:0362-1340 https://doi.org/10.1145/3093333.3009894 Google Scholar
Digital Library
- Simon Perdrix. 2008. A Hierarchy of Quantum Semantics. Electron. Notes Theor. Comput. Sci., 192, 3 (2008), 71–83. https://doi.org/10.1016/j.entcs.2008.10.028 Google Scholar
Digital Library
- Simon Perdrix. 2008. Quantum Entanglement Analysis Based on Abstract Interpretation. In Proceedings of the 15th International Symposium on Static Analysis (SAS ’08, Vol. 5079). Springer-Verlag, Berlin, Heidelberg. 270–282. isbn:9783540691631 https://doi.org/10.1007/978-3-540-69166-2_18 Google Scholar
Digital Library
- Azalea Raad, Josh Berdine, Hoang-Hai Dang, Derek Dreyer, Peter O’Hearn, and Jules Villard. 2020. Local Reasoning About the Presence of Bugs: Incorrectness Separation Logic. In Computer Aided Verification: 32nd International Conference, CAV 2020, Los Angeles, CA, USA, July 21–24, 2020, Proceedings, Part II. Springer-Verlag, Berlin, Heidelberg. 225–252. isbn:978-3-030-53290-1 https://doi.org/10.1007/978-3-030-53291-8_14 Google Scholar
Digital Library
- Robert Rand, Jennifer Paykin, and Steve Zdancewic. 2018. QWIRE Practice: Formal Verification of Quantum Circuits in Coq. Electronic Proceedings in Theoretical Computer Science, 266 (2018), Feb, 119–132. issn:2075-2180 https://doi.org/10.4204/eptcs.266.8 Google Scholar
Cross Ref
- Peter Selinger. 2004. Towards a Quantum Programming Language. Mathematical. Structures in Comp. Sci., 14, 4 (2004), aug, 527–586. issn:0960-1295 https://doi.org/10.1017/S0960129504004256 Google Scholar
Digital Library
- Robert S. Smith, Michael J. Curtis, and William J. Zeng. 2016. A Practical Quantum Instruction Set Architecture. arxiv:1608.03355.Google Scholar
- Krysta 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 DSL. In Proceedings of the Real World Domain Specific Languages Workshop 2018 (RWDSL2018). Association for Computing Machinery, New York, NY, USA. Article 7, 10 pages. isbn:9781450363556 https://doi.org/10.1145/3183895.3183901 Google Scholar
Digital Library
- Runzhou Tao, Yunong Shi, Jianan Yao, John Hui, Frederic T. Chong, and Ronghui Gu. 2021. Gleipnir: Toward Practical Error Analysis for Quantum Programs. In Proceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation (PLDI 2021). Association for Computing Machinery, New York, NY, USA. 48–64. isbn:9781450383912 https://doi.org/10.1145/3453483.3454029 Google Scholar
Digital Library
- Dominique Unruh. 2019. Quantum Relational Hoare Logic. Proc. ACM Program. Lang., 3, POPL (2019), Article 33, jan, 31 pages. https://doi.org/10.1145/3290346 Google Scholar
Digital Library
- Peng Yan, Hanru Jiang, and Nengkun Yu. 2022. On Incorrectness Logic for Quantum Programs (Technical Report). https://hrjiang.github.io/ilq/Google Scholar
- Mingsheng Ying. 2012. Floyd–Hoare Logic for Quantum Programs. ACM Trans. Program. Lang. Syst., 33, 6 (2012), Article 19, Jan., 49 pages. issn:0164-0925 https://doi.org/10.1145/2049706.2049708 Google Scholar
Digital Library
- Mingsheng Ying. 2016. Foundations of Quantum Programming (1st ed.). Morgan Kaufmann Publishers Inc., San Francisco, CA, USA. isbn:0128023066 https://doi.org/10.1016/C2014-0-02660-3 Google Scholar
Cross Ref
- Mingsheng Ying, Runyao Duan, Yuan Feng, and Zhengfeng Ji. 2009. Predicate Transformer Semantics of Quantum Programs. Cambridge University Press, Cambridge. 311–360. https://doi.org/10.1017/CBO9781139193313.009 Google Scholar
Cross Ref
- Nengkun Yu. 2019. Quantum Temporal Logic. https://doi.org/10.48550/arXiv.1908.00158Google Scholar
- Nengkun Yu and Jens Palsberg. 2021. Quantum Abstract Interpretation. In Proceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation (PLDI 2021). Association for Computing Machinery, New York, NY, USA. 542–558. isbn:9781450383912 https://doi.org/10.1145/3453483.3454061 Google Scholar
Digital Library
- Nengkun Yu and Mingsheng Ying. 2012. Reachability and Termination Analysis of Concurrent Quantum Programs. In Proceedings of the 23rd International Conference on Concurrency Theory (CONCUR’12). Springer-Verlag, Berlin, Heidelberg. 69–83. isbn:9783642329395 https://doi.org/10.1007/978-3-642-32940-1_7 Google Scholar
Digital Library
- Han-Sen Zhong, Hui Wang, Yu-Hao Deng, Ming-Cheng Chen, Li-Chao Peng, Yi-Han Luo, Jian Qin, Dian Wu, Xing Ding, and Yi Hu. 2020. Quantum computational advantage using photons. Science, 370, 6523 (2020), 1460–1463. https://doi.org/10.1126/science.abe8770 Google Scholar
- Li Zhou, Gilles Barthe, Justin Hsu, Mingsheng Ying, and Nengkun Yu. 2021. A Quantum Interpretation of Bunched Logic & Quantum Separation Logic. In Proceedings of the 36th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS ’21). IEEE Computer Society, Los Alamitos, CA, USA. 1–14. https://doi.org/10.1109/LICS52264.2021.9470673 Google Scholar
Digital Library
- 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 (PLDI 2019). Association for Computing Machinery, New York, NY, USA. 1149–1162. isbn:9781450367127 https://doi.org/10.1145/3314221.3314584 Google Scholar
Digital Library
Index Terms
On incorrectness logic for Quantum programs
Recommendations
Floyd--hoare logic for quantum programs
Floyd--Hoare logic is a foundation of axiomatic semantics of classical programs, and it provides effective proof techniques for reasoning about correctness of classical programs. To offer similar techniques for quantum program verification and to build ...
A Correctness and Incorrectness Program Logic
Abstract interpretation is a well-known and extensively used method to extract over-approximate program invariants by a sound program analysis algorithm. Soundness means that no program errors are lost and it is, in principle, guaranteed by construction. ...
Formalization of Metatheory of the Quipper Quantum Programming Language in a Linear Logic
AbstractWe develop a linear logical framework within the Hybrid system and use it to reason about the type system of a quantum lambda calculus. In particular, we consider a practical version of the calculus called Proto-Quipper, which contains the core of ...






Comments