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.
Supplemental Material
- [n.d.]. COIN-OR CLP. https://projects.coin-or.org/Clp Accessed: 2020.Google Scholar
- [n.d.]. OCaml/stdlib/set.ml. https://github.com/lucasaiu/ocaml/blob/master/stdlib/set.ml Accessed: 2020.Google Scholar
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- Robert Atkey. 2010. Amortised resource analysis with separation logic. In European Symposium on Programming. 85–103.Google Scholar
Digital Library
- 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 Scholar
Digital Library
- M. Avanzini and G. Moser. 2013. A Combination Framework for Complexity. In Int. Conf. on Rewriting Techniques and Applications (RTA’13).Google Scholar
- Charles H Bennett. 1973. Logical reversibility of computation. IBM journal of Research and Development, 17, 6 (1973), 525–532.Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Brian Campbell. 2008. Type-based amortized stack memory prediction.Google Scholar
- Brian Campbell. 2009. Amortised memory analysis using the depth of data structures. In European Symposium on Programming. 190–204.Google Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- K. Crary and S. Weirich. 2000. Resource Bound Certification. In Princ. of Prog. Lang. (POPL’00).Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Ugo Dal Lago and Barbara Petit. 2013. The geometry of types. ACM SIGPLAN Notices, 48, 1 (2013), 167–178.Google Scholar
Digital Library
- 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 Scholar
Digital Library
- N. A. Danielsson. 2008. Lightweight Semiformal Time Complexity Analysis for Purely Functional Data Structures. In Princ. of Prog. Lang. (POPL’08).Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
- Hugh Everett III. 1957. " Relative state" formulation of quantum mechanics. Reviews of modern physics, 29, 3 (1957), 454.Google Scholar
- David J Griffiths and Darrell F Schroeter. 2018. Introduction to quantum mechanics. Cambridge University Press.Google Scholar
- 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 Scholar
Cross Ref
- Sumit Gulwani. 2009. Speed: Symbolic complexity bound analysis. In International Conference on Computer Aided Verification. 51–62.Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- Jan Hoffmann, Klaus Aehlig, and Martin Hofmann. 2012. Multivariate Amortized Resource Analysis. ACM Trans. Program. Lang. Syst..Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Martin Hofmann and Steffen Jost. 2006. Type-based amortised heap-space analysis. In European Symposium on Programming. 22–37.Google Scholar
Digital Library
- Martin Hofmann and Dulma Rodriguez. 2013. Automatic type inference for amortised heap-space analysis. In European Symposium on Programming. 593–613.Google Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
- Zachary Kincaid, Jason Breck, Ashkan Forouhi Boroujeni, and Thomas Reps. 2017. Compositional recurrence analysis revisited. ACM SIGPLAN Notices, 52, 6 (2017), 248–262.Google Scholar
Digital Library
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
Cross Ref
- 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 Scholar
- Tobias Nipkow and Hauke Brinkop. 2019. Amortized complexity verified. Journal of Automated Reasoning, 62, 3 (2019), 367–391.Google Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
- R. E. Tarjan. 1985. Amortized Computational Complexity. SIAM J. Algebraic Discrete Methods, 6 (1985), August.Google Scholar
- Pedro B Vasconcelos. 2008. Space cost analysis using sized types. Ph.D. Dissertation. University of St Andrews.Google Scholar
- 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 Scholar
- 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 Scholar
Digital Library
Index Terms
Automatic amortized resource analysis with the Quantum physicist’s method
Recommendations
Quantum bit commitment on IBM QX
AbstractQuantum bit commitment (QBC) is a quantum version of the classical bit commitment security primitive. As other quantum security primitives and protocols, QBC improves on cheating detection over its classical counterpart. The implementation of the ...
Product-state approximations to quantum ground states
STOC '13: Proceedings of the forty-fifth annual ACM symposium on Theory of ComputingThe local Hamiltonian problem consists of estimating the ground-state energy (given by the minimum eigenvalue) of a local quantum Hamiltonian. It can be considered as a quantum generalization of constraint satisfaction problems (CSPs) and has a key role ...
Using non-ideal gates to implement universal quantum computing between uncoupled qubits
In many physical systems, when implementing quantum gate operations unavoidable global and relative phases occur as by-products due to the internal structure of the governing Hamiltonian. To correct, additional phase rotation gates are used, which ...






Comments