skip to main content

Automatic amortized resource analysis with the Quantum physicist’s method

Published:19 August 2021Publication History
Skip Abstract Section

Abstract

We present a novel method for working with the physicist's method of amortized resource analysis, which we call the quantum physicist's method. These principles allow for more precise analyses of resources that are not monotonically consumed, like stack. This method takes its name from its two major features, worldviews and resource tunneling, which behave analogously to quantum superposition and quantum tunneling. We use the quantum physicist's method to extend the Automatic Amortized Resource Analysis (AARA) type system, enabling the derivation of resource bounds based on tree depth. In doing so, we also introduce remainder contexts, which aid bookkeeping in linear type systems. We then evaluate this new type system's performance by bounding stack use of functions in the Set module of OCaml's standard library. Compared to state-of-the-art implementations of AARA, our new system derives tighter bounds with only moderate overhead.

Skip Supplemental Material Section

Supplemental Material

Auxiliary Presentation Video

This is a video talk for the paper "Automatic Amortized Resource Analysis with the Quantum Physicist's Method". It focuses on providing an intuitive explanation of "resource tunneling", a technique developed in the paper to improve upon naive, local usage of the physicist's method.

3473581.mp4

Presentation Videos

References

  1. [n.d.]. COIN-OR CLP. https://projects.coin-or.org/Clp Accessed: 2020.Google ScholarGoogle Scholar
  2. [n.d.]. OCaml/stdlib/set.ml. https://github.com/lucasaiu/ocaml/blob/master/stdlib/set.ml Accessed: 2020.Google ScholarGoogle Scholar
  3. Elvira Albert, Puri Arenas, Samir Genaim, Germán Puebla, and Damiano Zanardini. 2007. Cost analysis of java bytecode. In European symposium on programming. 157–172.Google ScholarGoogle ScholarCross RefCross Ref
  4. Elvira Albert, Jesús Correas Fernández, and Guillermo Román-Díez. 2015. Non-cumulative resource analysis. In International Conference on Tools and Algorithms for the Construction and Analysis of Systems. 85–100.Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Robert Atkey. 2010. Amortised resource analysis with separation logic. In European Symposium on Programming. 85–103.Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Martin Avanzini, Ugo Dal Lago, and Georg Moser. 2015. Analysing the complexity of functional programs: higher-order meets first-order. In Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming. 152–164.Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. M. Avanzini and G. Moser. 2013. A Combination Framework for Complexity. In Int. Conf. on Rewriting Techniques and Applications (RTA’13).Google ScholarGoogle Scholar
  8. Charles H Bennett. 1973. Logical reversibility of computation. IBM journal of Research and Development, 17, 6 (1973), 525–532.Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Benjamin Bichsel, Maximilian Baader, Timon Gehr, and Martin Vechev. 2020. Silq: A high-level quantum language with safe uncomputation and intuitive semantics. In Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation. 286–300.Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. R. Blanc, T. A. Henzinger, T. Hottelier, and L. Kovács. 2010. ABC: Algebraic Bound Computation for Loops. In Logic for Prog., AI., and Reasoning (LPAR’10).Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Brian Campbell. 2008. Type-based amortized stack memory prediction.Google ScholarGoogle Scholar
  12. Brian Campbell. 2009. Amortised memory analysis using the depth of data structures. In European Symposium on Programming. 190–204.Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Quentin Carbonneaux, Jan Hoffmann, and Zhong Shao. 2015. Compositional Certified Resource Bounds. In 36th Conference on Programming Language Design and Implementation (PLDI’15). Artifact submitted and approved.Google ScholarGoogle Scholar
  14. Iliano Cervesato, Joshua S Hodas, and Frank Pfenning. 1996. Efficient resource management for linear logic proof search. In International Workshop on Extensions of Logic Programming. 67–81.Google ScholarGoogle ScholarCross RefCross Ref
  15. Krishnendu Chatterjee, Hongfei Fu, and Amir Kafshdar Goharshady. 2019. Non-polynomial worst-case analysis of recursive programs. ACM Transactions on Programming Languages and Systems (TOPLAS), 41, 4 (2019), 1–52.Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. K. Crary and S. Weirich. 2000. Resource Bound Certification. In Princ. of Prog. Lang. (POPL’00).Google ScholarGoogle Scholar
  17. Joseph W. Cutler, Daniel R. Licata, and Norman Danner. 2020. Denotational Recurrence Extraction for Amortized Analysis. Proc. ACM Program. Lang., 4, ICFP (2020), Article 97, Aug., 29 pages. https://doi.org/10.1145/3408979 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Ugo Dal Lago and Marco Gaboardi. 2011. Linear dependent types and relative completeness. In 2011 IEEE 26th Annual Symposium on Logic in Computer Science. 133–142.Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Ugo Dal Lago and Barbara Petit. 2013. The geometry of types. ACM SIGPLAN Notices, 48, 1 (2013), 167–178.Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Luis Damas and Robin Milner. 1982. Principal type-schemes for functional programs. In Proceedings of the 9th ACM SIGPLAN-SIGACT symposium on Principles of programming languages. 207–212.Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. N. A. Danielsson. 2008. Lightweight Semiformal Time Complexity Analysis for Purely Functional Data Structures. In Princ. of Prog. Lang. (POPL’08).Google ScholarGoogle Scholar
  22. Norman Danner, Daniel R Licata, and Ramyaa Ramyaa. 2015. Denotational cost semantics for functional languages with inductive types. In Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming. 140–151.Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Ankush Das, Stephanie Balzer, Jan Hoffmann, Frank Pfenning, and Ishani Santurkar. [n.d.]. Resource-Aware Session Types for Digital Contracts. In 2021 IEEE 34th Computer Security Foundations Symposium (CSF). 111–126.Google ScholarGoogle Scholar
  24. Ankush Das, Stephanie Balzer, Jan Hoffmann, Frank Pfenning, and Ishani Santurkar. 2019. Resource-aware session types for digital contracts. arXiv preprint arXiv:1902.06056.Google ScholarGoogle Scholar
  25. Hugh Everett III. 1957. " Relative state" formulation of quantum mechanics. Reviews of modern physics, 29, 3 (1957), 454.Google ScholarGoogle Scholar
  26. David J Griffiths and Darrell F Schroeter. 2018. Introduction to quantum mechanics. Cambridge University Press.Google ScholarGoogle Scholar
  27. Armaël Guéneau, Arthur Charguéraud, and François Pottier. 2018. A fistful of dollars: Formalizing asymptotic complexity claims via deductive program verification. In European Symposium on Programming. 533–560.Google ScholarGoogle ScholarCross RefCross Ref
  28. Sumit Gulwani. 2009. Speed: Symbolic complexity bound analysis. In International Conference on Computer Aided Verification. 51–62.Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Sumit Gulwani, Krishna K Mehra, and Trishul Chilimbi. 2009. SPEED: precise and efficient static estimation of program computational complexity. ACM Sigplan Notices, 44, 1 (2009), 127–139.Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Nao Hirokawa and Georg Moser. 2008. Automated complexity analysis based on the dependency pair method. In International Joint Conference on Automated Reasoning. 364–379.Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Joshua S Hodas and Dale Miller. 1994. Logic programming in a fragment of intuitionistic linear logic. Information and computation, 110, 2 (1994), 327–365.Google ScholarGoogle Scholar
  32. Jan Hoffmann, Klaus Aehlig, and Martin Hofmann. 2012. Multivariate Amortized Resource Analysis. ACM Trans. Program. Lang. Syst..Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Jan Hoffmann, Ankush Das, and Shu-Chun Weng. 2017. Towards automatic resource bound analysis for OCaml. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages. 359–373.Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Martin Hofmann and Steffen Jost. 2003. Static prediction of heap space usage for first-order functional programs. ACM SIGPLAN Notices, 38, 1 (2003), 185–197.Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Martin Hofmann and Steffen Jost. 2006. Type-based amortised heap-space analysis. In European Symposium on Programming. 22–37.Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Martin Hofmann and Dulma Rodriguez. 2013. Automatic type inference for amortised heap-space analysis. In European Symposium on Programming. 593–613.Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Steffen Jost, Kevin Hammond, Hans-Wolfgang Loidl, and Martin Hofmann. 2010. Static Determination of Quantitative Resource Usage for Higher-Order Programs. In 37th Symposium on Principles of Programming Languages (POPL’10). 223–236.Google ScholarGoogle Scholar
  38. Steffen Jost, Hans-Wolfgang Loidl, Kevin Hammond, Norman Scaife, and Martin Hofmann. 2009. Carbon Credits for Resource-Bounded Computations using Amortised Analysis. In 16th International Symposium on Formal Methods (FM’09). 354–369.Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. David M Kahn and Jan Hoffmann. 2020. Exponential Automatic Amortized Resource Analysis. In International Conference on Foundations of Software Science and Computation Structures. 359–380.Google ScholarGoogle Scholar
  40. G. A. Kavvos, E. Morehouse, D. R. Licata, and N. Danner. 2020. Recurrence Extraction for Functional Programs through Call-by-Push-Value. In Princ. of Prog. Lang. (POPL’20).Google ScholarGoogle Scholar
  41. Zachary Kincaid, Jason Breck, Ashkan Forouhi Boroujeni, and Thomas Reps. 2017. Compositional recurrence analysis revisited. ACM SIGPLAN Notices, 52, 6 (2017), 248–262.Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Zachary Kincaid, John Cyphert, Jason Breck, and Thomas Reps. 2017. Non-linear reasoning for invariant synthesis. Proceedings of the ACM on Programming Languages, 2, POPL (2017), 1–33.Google ScholarGoogle Scholar
  43. Pedro Lopez-Garcia, Luthfi Darmawan, Maximiliano Klemen, Umer Liqat, Francisco Bueno, and Manuel V Hermenegildo. 2018. Interval-based resource usage verification by translation into Horn clauses and an application to energy consumption. arXiv preprint arXiv:1803.04451.Google ScholarGoogle Scholar
  44. Glen Mével, Jacques-Henri Jourdan, and François Pottier. 2019. Time Credits and Time Receipts in Iris. In Programming Languages and Systems, Luís Caires (Ed.). Springer International Publishing, Cham. 3–29. isbn:978-3-030-17184-1Google ScholarGoogle Scholar
  45. Matthias Naaf, Florian Frohn, Marc Brockschmidt, Carsten Fuhs, and Jürgen Giesl. 2017. Complexity analysis for term rewriting by integer transition systems. In International Symposium on Frontiers of Combining Systems. 132–150.Google ScholarGoogle ScholarCross RefCross Ref
  46. Van Chan Ngo, Quentin Carbonneaux, and Jan Hoffmann. 2018. Bounded Expectations: Resource Analysis for Probabilistic Programs. In 39th Conference on Programming Language Design and Implementation (PLDI’18).Google ScholarGoogle Scholar
  47. Tobias Nipkow and Hauke Brinkop. 2019. Amortized complexity verified. Journal of Automated Reasoning, 62, 3 (2019), 367–391.Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. Lars Noschinski, Fabian Emmes, and Jürgen Giesl. 2013. Analyzing innermost runtime complexity of term rewriting by dependency pairs. Journal of Automated Reasoning, 51, 1 (2013), 27–56.Google ScholarGoogle ScholarCross RefCross Ref
  49. I. Radicek, G. Barthe, M. Gaboardi, D. Garg, and F. Zuleger. 2018. Monadic Refinements for Relational Cost Analysis. In Princ. of Prog. Lang. (POPL’18).Google ScholarGoogle Scholar
  50. R. E. Tarjan. 1985. Amortized Computational Complexity. SIAM J. Algebraic Discrete Methods, 6 (1985), August.Google ScholarGoogle Scholar
  51. Pedro B Vasconcelos. 2008. Space cost analysis using sized types. Ph.D. Dissertation. University of St Andrews.Google ScholarGoogle Scholar
  52. Di Wang, David M Kahn, and Jan Hoffmann. 2020. Raising expectations: automating expected cost analysis with types. Proceedings of the ACM on Programming Languages, 4, ICFP (2020), 1–31.Google ScholarGoogle Scholar
  53. Peng Wang, Di Wang, and Adam Chlipala. 2017. TiML: a functional language for practical complexity analysis with invariants. Proceedings of the ACM on Programming Languages, 1, OOPSLA (2017), 1–26.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Automatic amortized resource analysis with the Quantum physicist’s method

        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!