skip to main content
10.1145/3531130.3533327acmconferencesArticle/Chapter ViewAbstractPublication PageslicsConference Proceedingsconference-collections
research-article
Open access

Quantum Weakest Preconditions for Reasoning about Expected Runtimes of Quantum Programs

Published: 04 August 2022 Publication History

Abstract

We study expected runtimes for quantum programs. Inspired by recent work on probabilistic programs, we first define expected runtime as a generalisation of quantum weakest precondition. Then, we show that the expected runtime of a quantum program can be represented as the expectation of an observable (in physics). A method for computing the expected runtimes of quantum programs in finite-dimensional state spaces is developed. Several examples are provided as applications of this method, including computing the expected runtime of quantum Bernoulli Factory – a quantum algorithm for generating random numbers. In particular, using our new method, an open problem of computing the expected runtime of quantum random walks introduced by Ambainis et al. (STOC 2001) is solved.

References

[1]
Dorit Aharonov, Andris Ambainis, Julia Kempe, and Umesh Vazirani. 2001. Quantum walks on graphs. In Proceedings of the thirty-third annual ACM symposium on Theory of computing. ACM, Association for Computing Machinery, 50–59. https://doi.org/10.1145/380752.380758
[2]
Andris Ambainis. 2007. Quantum Walk Algorithm for Element Distinctness. SIAM J. Comput. 37, 1 (2007), 210–239. https://doi.org/10.1137/S0097539705447311
[3]
Andris Ambainis. 2008. Quantum random walks–new method for designing quantum algorithms. In International Conference on Current Trends in Theory and Practice of Computer Science. Springer, Springer Berlin Heidelberg, 1–4. https://doi.org/10.1007/978-3-540-77566-9_1
[4]
Andris Ambainis, Eric Bach, Ashwin Nayak, Ashvin Vishwanath, and John Watrous. 2001. One-dimensional Quantum Walks. In Proceedings of the Thirty-third Annual ACM Symposium on Theory of Computing (Hersonissos, Greece) (STOC ’01). ACM, 37–49. https://doi.org/10.1145/380752.380757
[5]
Frank Arute, Kunal Arya, Ryan Babbush, Dave Bacon, Joseph C Bardin, Rami Barends, Rupak Biswas, Sergio Boixo, Fernando GSL Brandao, 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
[6]
Kevin Batz, Benjamin Lucien Kaminski, Joost-Pieter Katoen, and Christoph Matheja. 2018. How long, O Bayesian network, will I sample thee?. In European Symposium on Programming. Springer, Springer International Publishing, 186–213. https://doi.org/10.1007/978-3-319-89884-1_7
[7]
Tomáš Brázdil, Stefan Kiefer, Antonín Kučera, and Ivana Hutařová Vařeková. 2015. Runtime analysis of probabilistic programs with unbounded recursion. J. Comput. System Sci. 81, 1 (2015), 288–310. https://doi.org/10.1016/j.jcss.2014.06.005
[8]
Quentin Carbonneaux, Jan Hoffmann, Thomas Reps, and Zhong Shao. 2017. Automated resource analysis with Coq proof objects. In International Conference on Computer Aided Verification. Springer, Springer International Publishing, 64–85. https://doi.org/10.1007/978-3-319-63390-9_4
[9]
Orieta Celiku and Annabelle McIver. 2005. Compositional specification and analysis of cost-based properties in probabilistic programs. In International Symposium on Formal Methods. Springer, Springer Berlin Heidelberg, 107–122. https://doi.org/10.1007/11526841_9
[10]
Pavol Černỳ, Thomas A Henzinger, Laura Kovács, Arjun Radhakrishna, and Jakob Zwirchmayr. 2015. Segment abstraction for worst-case execution time analysis. In European Symposium on Programming Languages and Systems. Springer, Springer Berlin Heidelberg, 105–131. https://doi.org/10.1007/978-3-662-46669-8_5
[11]
Aleksandar Chakarov and Sriram Sankaranarayanan. 2013. Probabilistic program analysis with martingales. In International Conference on Computer Aided Verification. Springer, Springer Berlin Heidelberg, 511–526. https://doi.org/10.1007/978-3-642-39799-8_34
[12]
Krishnendu Chatterjee, Hongfei Fu, and Aniket Murhekar. 2017. Automated recurrence analysis for almost-linear expected-runtime bounds. In International Conference on Computer Aided Verification. Springer, Springer International Publishing, 118–139. https://doi.org/10.1007/978-3-319-63387-9_6
[13]
Andrew Cross. 2018. The IBM Q experience and QISKit open-source quantum computing software. In APS March Meeting Abstracts, Vol. 2018. L58–003.
[14]
Howard Dale, David Jennings, and Terry Rudolph. 2015. Provable quantum advantage in randomness processing. Nature communications 6(2015), 8203. https://doi.org/10.1038/ncomms9203
[15]
Ellie D’hondt and Prakash Panangaden. 2006. Quantum weakest preconditions. Mathematical Structures in Computer Science 16, 3 (2006), 429–451. https://doi.org/10.1017/S0960129506005251
[16]
Ming Gong, Shiyu Wang, Chen Zha, Ming-Cheng Chen, He-Liang Huang, Yulin Wu, Qingling Zhu, Youwei Zhao, Shaowei Li, Shaojun Guo, 2021. Quantum walks on a programmable two-dimensional 62-qubit superconducting processor. Science 372, 6545 (2021), 948–952. https://doi.org/10.1126/science.abg7812
[17]
Jan Hoffmann and Zhong Shao. 2015. Type-based amortized resource analysis with integers and arrays. Journal of Functional Programming 25 (2015), e17. https://doi.org/10.1017/S0956796815000192
[18]
Martin Hofmann and Georg Moser. 2015. Multivariate Amortised Resource Analysis for Term Rewrite Systems. In 13th International Conference on Typed Lambda Calculi and Applications (TLCA 2015)(Leibniz International Proceedings in Informatics (LIPIcs), Vol. 38). Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, 241–256. https://doi.org/10.4230/LIPIcs.TLCA.2015.241
[19]
Roger A Horn and Charles R Johnson. 2012. Matrix analysis. Cambridge university press.
[20]
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, 2–17. https://doi.org/10.1016/j.parco.2014.12.001
[21]
Benjamin Lucien Kaminski, Joost-Pieter Katoen, Christoph Matheja, and Federico Olmedo. 2016. Weakest Precondition Reasoning for Expected Run—Times of Probabilistic Programs. In Proceedings of the 25th European Symposium on Programming Languages and Systems - Volume 9632. Springer-Verlag, 364–389. https://doi.org/10.1007/978-3-662-49498-1_15
[22]
Benjamin Lucien Kaminski, Joost-Pieter Katoen, Christoph Matheja, and Federico Olmedo. 2018. Weakest Precondition Reasoning for Expected Runtimes of Randomized Algorithms. J. ACM 65, 5, Article 30 (2018), 68 pages. https://doi.org/10.1145/3208102
[23]
Parker Kuklinski and Mark Kon. 2018. Absorption probabilities of quantum walks. Quantum Information Processing 17, 10 (2018), 1–34. https://doi.org/10.1007/s11128-018-2017-4
[24]
Junyi Liu, Li Zhou, Gilles Barthe, and Mingsheng Ying. 2022. Quantum Weakest Preconditions for Reasoning about Expected Runtimes of Quantum Programs (Extended Version). arXiv preprint arXiv:1911.12557(2022).
[25]
Annabelle McIver, Carroll Morgan, and Charles Carroll Morgan. 2005. Abstraction, refinement and proof for probabilistic systems. Springer Science & Business Media.
[26]
Van Chan Ngo, Quentin Carbonneaux, and Jan Hoffmann. 2018. Bounded expectations: resource analysis for probabilistic programs. In ACM SIGPLAN Notices, Vol. 53. ACM, Association for Computing Machinery, 496–512. https://doi.org/10.1145/3296979.3192394
[27]
Van Chan Ngo, Mario Dehesa-Azuara, Matthew Fredrikson, and Jan Hoffmann. 2017. Verifying and Synthesizing Constant-Resource Implementations with Types. In 2017 IEEE Symposium on Security and Privacy (SP). IEEE Computer Society, 710–728. https://doi.org/10.1109/SP.2017.53
[28]
Michael A Nielsen and Isaac Chuang. 2002. Quantum computation and quantum information.
[29]
Hanne Riis Nielson. 1987. A hoare-like proof system for analysing the computation time of programs. Science of Computer Programming 9, 2 (1987), 107–136. https://doi.org/10.1016/0167-6423(87)90029-3
[30]
Federico Olmedo and Alejandro Díaz-Caro. 2019. Runtime Analysis of Quantum Programs: A Formal Approach. arXiv preprint arXiv:1911.11247(2019).
[31]
Federico Olmedo, Benjamin Lucien Kaminski, Joost-Pieter Katoen, and Christoph Matheja. 2016. Reasoning about recursive probabilistic programs. In 2016 31st Annual ACM/IEEE Symposium on Logic in Computer Science (LICS). IEEE, Association for Computing Machinery, 1–10. https://doi.org/10.1145/2933575.2935317
[32]
John Preskill. 2018. Quantum Computing in the NISQ era and beyond. Quantum 2(2018), 79. https://doi.org/10.22331/q-2018-08-06-79
[33]
Martin Roetteler, Michael Naehrig, Krysta M Svore, and Kristin Lauter. 2017. Quantum resource estimates for computing elliptic curve discrete logarithms. In International Conference on the Theory and Application of Cryptology and Information Security. Springer, Springer International Publishing, 241–270. https://doi.org/10.1007/978-3-319-70697-9_9
[34]
J. Sanders and P. Zuliani. 2000. Quantum Programming. In Proceedings of the 5th International Conference on Mathematics of Program Construction (MPC 2000)(LNCS, Vol. 1837). Springer Berlin Heidelberg, 80–99. https://doi.org/10.1007/10722010_6
[35]
Peter Selinger. 2004. Towards a quantum programming language. Mathematical Structures in Computer Science 14, 4 (2004), 527–586. https://doi.org/10.1017/S0960129504004256
[36]
Neil Shenvi, Julia Kempe, and K Birgitta Whaley. 2003. Quantum random-walk search algorithm. Physical Review A 67, 5 (2003), 052307. https://doi.org/10.1103/PhysRevA.67.052307
[37]
Pedro Vasconcelos, Steffen Jost, Mário Florido, and Kevin Hammond. 2015. Type-based allocation analysis for co-recursion in lazy functional languages. In European Symposium on Programming Languages and Systems. Springer, Springer Berlin Heidelberg, 787–811. https://doi.org/10.1007/978-3-662-46669-8_32
[38]
Mingsheng Ying. 2012. Floyd–Hoare Logic for Quantum Programs. ACM Trans. Program. Lang. Syst. 33, 6, Article 19(2012). https://doi.org/10.1145/2049706.2049708
[39]
Mingsheng Ying. 2016. Foundations of Quantum Programming. Morgan Kaufmann.
[40]
Mingsheng Ying, Nengkun Yu, Yuan Feng, and Runyao Duan. 2013. Verification of quantum programs. Science of Computer Programming 78, 9 (2013), 1679–1700. https://doi.org/10.1016/j.scico.2013.03.016
[41]
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, 1149–1162. https://doi.org/10.1145/3314221.3314584

Cited By

View all
  • (2025)Flexible Type-Based Resource Estimation in Quantum Circuit Description LanguagesProceedings of the ACM on Programming Languages10.1145/37048839:POPL(1386-1416)Online publication date: 9-Jan-2025
  • (2024)Automated Verification of Higher-Order Probabilistic Programs via a Dependent Refinement Type SystemProceedings of the ACM on Programming Languages10.1145/36746628:ICFP(973-1002)Online publication date: 15-Aug-2024
  • (2024)The T-Complexity Costs of Error Correction for Control Flow in Quantum ComputationProceedings of the ACM on Programming Languages10.1145/36563978:PLDI(492-517)Online publication date: 20-Jun-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
LICS '22: Proceedings of the 37th Annual ACM/IEEE Symposium on Logic in Computer Science
August 2022
817 pages
ISBN:9781450393515
DOI:10.1145/3531130
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 04 August 2022

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Quantum programming
  2. expected runtime
  3. physical observable
  4. quantum random walk
  5. quantum weakest precondition
  6. termination

Qualifiers

  • Research-article
  • Research
  • Refereed limited

Funding Sources

Conference

LICS '22
Sponsor:

Acceptance Rates

Overall Acceptance Rate 215 of 622 submissions, 35%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)280
  • Downloads (Last 6 weeks)53
Reflects downloads up to 30 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2025)Flexible Type-Based Resource Estimation in Quantum Circuit Description LanguagesProceedings of the ACM on Programming Languages10.1145/37048839:POPL(1386-1416)Online publication date: 9-Jan-2025
  • (2024)Automated Verification of Higher-Order Probabilistic Programs via a Dependent Refinement Type SystemProceedings of the ACM on Programming Languages10.1145/36746628:ICFP(973-1002)Online publication date: 15-Aug-2024
  • (2024)The T-Complexity Costs of Error Correction for Control Flow in Quantum ComputationProceedings of the ACM on Programming Languages10.1145/36563978:PLDI(492-517)Online publication date: 20-Jun-2024
  • (2024)Quantum Computing: From Weakest Preconditions to Voltage PulsesPrinciples of Verification: Cycling the Probabilistic Landscape10.1007/978-3-031-75783-9_9(201-229)Online publication date: 13-Nov-2024
  • (2023)Structured Theorem for Quantum Programs and its ApplicationsACM Transactions on Software Engineering and Methodology10.1145/358715432:4(1-35)Online publication date: 26-May-2023

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

HTML Format

View this article in HTML Format.

HTML Format

Login options

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media