Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

On incorrectness logic for Quantum programs

Published: 29 April 2022 Publication History

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.

References

[1]
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.
[2]
Gadi Aleksandrowicz. 2019. Qiskit: An Open-source Framework for Quantum Computing. https://doi.org/10.5281/zenodo.2562111
[3]
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
[4]
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
[5]
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/1968621
[6]
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
[7]
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
[8]
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
[9]
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
[10]
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
[11]
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
[12]
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
[13]
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
[14]
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
[15]
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
[16]
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
[17]
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
[18]
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
[19]
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
[20]
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
[21]
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
[22]
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
[23]
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
[24]
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
[25]
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
[26]
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
[27]
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
[28]
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
[29]
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
[30]
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
[31]
Robert S. Smith, Michael J. Curtis, and William J. Zeng. 2016. A Practical Quantum Instruction Set Architecture. arxiv:1608.03355.
[32]
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
[33]
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
[34]
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
[35]
Peng Yan, Hanru Jiang, and Nengkun Yu. 2022. On Incorrectness Logic for Quantum Programs (Technical Report). https://hrjiang.github.io/ilq/
[36]
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
[37]
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
[38]
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
[39]
Nengkun Yu. 2019. Quantum Temporal Logic. https://doi.org/10.48550/arXiv.1908.00158
[40]
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
[41]
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
[42]
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
[43]
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
[44]
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

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 6, Issue OOPSLA1
April 2022
687 pages
EISSN:2475-1421
DOI:10.1145/3534679
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: 29 April 2022
Published in PACMPL Volume 6, Issue OOPSLA1

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Incorrectness Logic
  2. Projective Quantum Predicates
  3. Quantum Programming Languages

Qualifiers

  • Research-article

Funding Sources

  • ARC Discovery Program
  • ARC DECRA

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)329
  • Downloads (Last 6 weeks)29
Reflects downloads up to 06 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

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media