Abstract
This paper presents λ-amor, a new type-theoretic framework for amortized cost analysis of higher-order functional programs and shows that existing type systems for cost analysis can be embedded in it. λ-amor introduces a new modal type for representing potentials – costs that have been accounted for, but not yet incurred, which are central to amortized analysis. Additionally, λ-amor relies on standard type-theoretic concepts like affineness, refinement types and an indexed cost monad. λ-amor is proved sound using a rather simple logical relation. We embed two existing type systems for cost analysis in λ-amor showing that, despite its simplicity, λ-amor can simulate cost analysis for different evaluation strategies (call-by-name and call-by-value), in different styles (effect-based and coeffect-based), and with or without amortization. One of the embeddings also implies that λ-amor is relatively complete for all terminating PCF programs.
- Amal Jamil Ahmed. 2004. Semantics of types for mutable state. Ph.D. Dissertation. Princeton university.Google Scholar
Digital Library
- Robert Atkey. 2018. Syntax and Semantics of Quantitative Type Theory. In Annual ACM/IEEE Symposium on Logic in Computer Science.Google Scholar
- Martin Avanzini and Ugo Dal Lago. 2017. Automating Sized-type Inference for Complexity Analysis. Proc. ACM Program. Lang. 1, ICFP ( 2017 ).Google Scholar
Digital Library
- Aloïs Brunel, Marco Gaboardi, Damiano Mazza, and Steve Zdancewic. 2014. A Core Quantitative Coefect Calculus. In Proceedings of the European Symposium on Programming Languages and Systems.Google Scholar
Digital Library
- Quentin Carbonneaux, Jan Hofmann, and Zhong Shao. 2015. Compositional certified resource bounds. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation.Google Scholar
Digital Library
- Arthur Charguéraud and François Pottier. 2019. Verifying the Correctness and Amortized Complexity of a Union-Find Implementation in Separation Logic with Time Credits. J. Autom. Reasoning 62, 3 ( 2019 ).Google Scholar
Digital Library
- Ezgi Çiçek, Gilles Barthe, Marco Gaboardi, Deepak Garg, and Jan Hofmann. 2017. Relational cost analysis. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages.Google Scholar
Digital Library
- Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Cliford Stein. 2009. Introduction to Algorithms, 3rd Edition. MIT Press.Google Scholar
Digital Library
- Karl Crary and Stephanie Weirich. 2000. Resource Bound Certification. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages.Google Scholar
Digital Library
- Ugo Dal Lago and Marco Gaboardi. 2011. Linear Dependent Types and Relative Completeness. Logical Methods in Computer Science 8, 4 ( 2011 ).Google Scholar
- Ugo Dal Lago and Barbara Petit. 2012. Linear Dependent Types in a Call-by-value Scenario. Science of Computer Programming 84 ( 2012 ).Google Scholar
- Nils Anders Danielsson. 2008. Lightweight Semiformal Time Complexity Analysis for Purely Functional Data Structures. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages.Google Scholar
Digital Library
- Norman Danner, Daniel R. Licata, and Ramyaa. 2015. Denotational cost semantics for functional languages with inductive types. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming. 140-151.Google Scholar
Digital Library
- Marco Gaboardi, Shin-ya Katsumata, Dominic Orchard, Flavien Breuvart, and Tarmo Uustalu. 2016. Combining Efects and Coefects via Grading. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming.Google Scholar
Digital Library
- Jean-Yves Girard, Andre Scedrov, and Philip J. Scott. 1992. Bounded linear logic: a modular approach to polynomial-time computability. Theoretical Computer Science 97, 1 ( 1992 ).Google Scholar
- Martin A. T. Handley, Niki Vazou, and Graham Hutton. 2020. Liquidate your assets: reasoning about resource usage in liquid Haskell. Proc. ACM Program. Lang. 4, POPL ( 2020 ).Google Scholar
Digital Library
- Maximilian P. L. Haslbeck and Tobias Nipkow. 2018. Hoare Logics for Time Bounds-A Study in Meta Theory. In Tools and Algorithms for the Construction and Analysis of Systems, Vol. 10805.Google Scholar
- Jan Hofman. 2011. Types with Potential: Polynomial Resource Bounds via Automatic Amortized Analysis. Ph.D. Dissertation. Ludwig-Maximilians-Universität München.Google Scholar
- Jan Hofmann, Klaus Aehlig, and Martin Hofmann. 2011. Multivariate Amortized Resource Analysis. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages.Google Scholar
Digital Library
- Jan Hofmann, Ankush Das, and Shu-Chun Weng. 2017. Towards Automatic Resource Bound Analysis for OCaml. In Proceedings of the ACM SIGPLAN Symposium on Principles of Programming Languages.Google Scholar
Digital Library
- Jan Hofmann and Martin Hofmann. 2010. Amortized Resource Analysis with Polynomial Potential: A Static Inference of Polynomial Bounds for Functional Programs. In Proceedings of the European Conference on Programming Languages and Systems.Google Scholar
Digital Library
- Martin Hofmann and Stefen Jost. 2003. Static Prediction of Heap Space Usage for First-order Functional Programs. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages.Google Scholar
Digital Library
- Stefen Jost, Kevin Hammond, Hans-Wolfgang Loidl, and Martin Hofmann. 2010. Static Determination of Quantitative Resource Usage for Higher-order Programs. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages.Google Scholar
Digital Library
- Stefen Jost, Hans-Wolfgang Loidl, Kevin Hammond, Norman Scaife, and Martin Hofmann. 2009. "Carbon Credits" for Resource-Bounded Computations Using Amortised Analysis. In Proceedings of Formal Methods.Google Scholar
Digital Library
- Stefen Jost, Pedro Vasconcelos, Mário Florido, and Kevin Hammond. 2017. Type-Based Cost Analysis for Lazy Functional Languages. J. Autom. Reason. 59, 1 ( 2017 ).Google Scholar
Digital Library
- G. A. Kavvos, Edward Morehouse, Daniel R. Licata, and Norman Danner. 2020. Recurrence extraction for functional programs through call-by-push-value. Proc. ACM Program. Lang. 4, POPL ( 2020 ).Google Scholar
Digital Library
- Tristan Knoth, Di Wang, Nadia Polikarpova, and Jan Hofmann. 2019. Resource-guided program synthesis. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation.Google Scholar
Digital Library
- Jean-Louis Krivine. 2007. A Call-by-name Lambda-calculus Machine. Higher Order Symbolic Computation 20, 3 ( 2007 ).Google Scholar
- Ravichandhran Madhavan, Sumith Kulal, and Viktor Kuncak. 2017. Contract-based Resource Verification for Higher-order Functions with Memoization. In Proceedings of the ACM SIGPLAN Symposium on Principles of Programming Languages.Google Scholar
Digital Library
- Dylan McDermott and Alan Mycroft. 2018. Call-by-need efects via coefects. Open Comput. Sci. 8, 1 ( 2018 ).Google Scholar
- Glen Mével, Jacques-Henri Jourdan, and François Pottier. 2019. Time credits and time receipts in Iris. In European Symposium on Programming.Google Scholar
Cross Ref
- Eugenio Moggi. 1991. Notions of Computation and Monads. Information and Computation 93, 1 ( 1991 ).Google Scholar
- Georg Neis, Derek Dreyer, and Andreas Rossberg. 2011. Non-parametric parametricity. J. Funct. Program. 21, 4-5 ( 2011 ).Google Scholar
Digital Library
- Chris Okasaki. 1996. Purely Functional Data Structures. Ph.D. Dissertation. Carnegie Mellon University.Google Scholar
Digital Library
- Tomas Petricek, Dominic Orchard, and Alan Mycroft. 2014. Coefects: A Calculus of Context-dependent Computation. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming.Google Scholar
Digital Library
- Tomas Petricek, Dominic A. Orchard, and Alan Mycroft. 2013. Coefects: Unified Static Analysis of Context-Dependence. In Automata, Languages, and Programming-International Colloquium.Google Scholar
- David J. Pym, Peter W. O'Hearn, and Hongseok Yang. 2004. Possible worlds and resources: the semantics of BI. Theoretical Computer Science 315, 1 ( 2004 ).Google Scholar
- Robert E. Tarjan. 1985. Amortized computational complexity. SIAM J. Algebraic Discrete Methods 6, 2 ( 1985 ).Google Scholar
Cross Ref
- Hongwei Xi. 2007. Dependent ML An approach to practical programming with dependent types. J. Funct. Program. 17, 2 ( 2007 ).Google Scholar
Digital Library
Index Terms
A unifying type-theory for higher-order (amortized) cost analysis
Recommendations
Formalizing Type Operations Using the “Image” Type Constructor
In this paper we introduce a new approach to formalizing certain type operations in type theory. Traditionally, many type constructors in type theory are independently axiomatized and the correctness of these axioms is argued semantically. In this paper ...
A sequent calculus for type theory
CSL'06: Proceedings of the 20th international conference on Computer Science LogicBased on natural deduction, Pure Type Systems (PTS) can express a wide range of type theories. In order to express proof-search in such theories, we introduce the Pure Type Sequent Calculi (PTSC) by enriching a sequent calculus due to Herbelin, adapted ...
Inductive Types in Homotopy Type Theory
LICS '12: Proceedings of the 2012 27th Annual IEEE/ACM Symposium on Logic in Computer ScienceHomotopy type theory is an interpretation of Martin-Löf's constructive type theory into abstract homotopy theory. There results a link between constructive mathematics and algebraic topology, providing topological semantics for intensional systems of ...






Comments