Abstract
We show how the complexity of higher-order functional programs can be analysed automatically by applying program transformations to a defunctionalised versions of them, and feeding the result to existing tools for the complexity analysis of first-order term rewrite systems. This is done while carefully analysing complexity preservation and reflection of the employed transformations such that the complexity of the obtained term rewrite system reflects on the complexity of the initial program. Further, we describe suitable strategies for the application of the studied transformations and provide ample experimental data for assessing the viability of our method.
- B. Accattoli and U. Dal Lago. Beta Reduction is Invariant, Indeed. In Proc. of 23rd CSL, pages 8:1–8:10. ACM, 2014. Google Scholar
Digital Library
- B. Accattoli and C. Sacerdoti Coen. On the Usefulness of Constructors. In Proc. of 30th LICS. IEEE, 2015. To appear.Google Scholar
- E. Albert, S. Genaim, and A. N. Masud. On the Inference of Resource Usage Upper and Lower Bounds. TOCL, 14(3):22(1–35), 2013. Google Scholar
Digital Library
- T. Arts and J. Giesl. Termination of Term Rewriting using Dependency Pairs. TCS, 236(1–2):133–178, 2000. Google Scholar
Digital Library
- D. Aspinall, L. Beringer, M. Hofmann, H.-W. Loidl, and A. Momigliano. A Program Logic for Resources. TCS, 389(3):411–445, 2007. Google Scholar
Digital Library
- M. Avanzini and G. Moser. Closing the Gap Between Runtime Complexity and Polytime Computability. In Proc. of 21st RTA, volume 6 of LIPIcs, pages 33–48, 2010.Google Scholar
- M. Avanzini and G. Moser. Polynomial Path Orders. LMCS, 9(4), 2013.Google Scholar
- M. Avanzini and G. Moser. Tyrolean Complexity Tool: Features and Usage. In Proc. of 24th RTA, volume 21 of LIPIcs, pages 71–80, 2013.Google Scholar
- M. Avanzini and G. Moser. A Combination Framework for Complexity. IC, 2015. To appear.Google Scholar
- M. Avanzini, U. Dal Lago, and G. Moser. Analysing the Complexity of Functional Programs: Higher-Order Meets First-Order (Long Version). CoRR, cs/CC/1506.05043, 2015. Available at http://www.arxiv. org/abs/1506.05043. Google Scholar
Digital Library
- F. Baader and T. Nipkow. Term Rewriting and All That. Cambridge University Press, 1998. ISBN 978-0-521-77920-3. Google Scholar
Digital Library
- P. Baillot and U. Dal Lago. Higher-Order Interpretations and Program Complexity. In Proc. of 26th CSL, volume 16 of LIPIcs, pages 62–76, 2012.Google Scholar
- P. Baillot and K. Terui. Light types for Polynomial Time Computation in Lambda Calculus. IC, 207(1):41–62, 2009. Google Scholar
Digital Library
- R. Benzinger. Automated Higher-order Complexity Analysis. TCS, 318(1-2):79–103, 2004. Google Scholar
Digital Library
- R. Bird. Introduction to Functional Programming using Haskell, Second Edition. Prentice Hall, 1998. ISBN 978-0-134-84346-9. Google Scholar
Digital Library
- G. Bonfante, A. Cichon, J.-Y. Marion, and H. Touzet. Algorithms with Polynomial Interpretation Termination Proof. JFP, 11(1):33–53, 2001. Google Scholar
Digital Library
- G. Bonfante, J.-Y. Marion, and R. Péchoux. Quasi-interpretation Synthesis by Decomposition and an Application to Higher-order Programs. In Proc. of 4th ICTAC, volume 4711 of LNCS, pages 410– 424, 2007. Google Scholar
Digital Library
- U. Dal Lago and M. Gaboardi. Linear Dependent Types and Relative Completeness. LMCS, 8(4), 2012.Google Scholar
- U. Dal Lago and S. Martini. On Constructor Rewrite Systems and the Lambda Calculus. LMCS, 8(3):1–27, 2012.Google Scholar
- U. Dal Lago and B. Petit. The Geometry of Types. In Proc. of 40th POPL, pages 167–178. ACM, 2013. Google Scholar
Digital Library
- N. Danielsson. Lightweight Semiformal Time Complexity Analysis for Purely Functional Data Structures. In Proc. of 35th POPL, pages 133–144. ACM, 2008. Google Scholar
Digital Library
- O. Danvy and L. R. Nielsen. Defunctionalization at Work. In Proc. of 3rd PPDP, pages 162–174. ACM, 2001. Google Scholar
Digital Library
- G. Feuillade, T. Genet, and V. Viet Triem Tong. Reachability Analysis over Term Rewriting Systems. JAR, 33(3-4):341–383, 2004. Google Scholar
Digital Library
- J. Giesl, R. Thiemann, and P. Schneider-Kamp. Proving and Disproving Termination of Higher-Order Functions. In Proc. of 5th FROCOS, volume 3717 of LNCS, pages 216–231, 2005. Google Scholar
Digital Library
- J. Giesl, M. Raffelsieper, P. Schneider-Kamp, S. Swiderski, and R. Thiemann. Automated Termination Proofs for Haskell by Term Rewriting. TOPLAS, 33(2):7:1–7:39, 2011. Google Scholar
Digital Library
- J. Giesl, M. Brockschmidt, F. Emmes, F. Frohn, C. Fuhs, C. Otto, M. Plücker, P. Schneider-Kamp, T. Ströder, S. Swiderski, and R. Thiemann. Proving Termination of Programs Automatically with AProVE. In Proc. of 7th IJCAR, volume 8562 of LNCS, pages 184–191, 2014.Google Scholar
Cross Ref
- G. Gomez and Y. Liu. Automatic Time-bound Analysis for a Higherorder Language. In Proc. of 9th PEPM, pages 75–86. ACM, 2002. Google Scholar
Digital Library
- B. Gramlich. Abstract Relations between Restricted Termination and Confluence Properties of Rewrite Systems. FI, 24:3–23, 1995. Google Scholar
Digital Library
- R. Harper. Practical Foundations for Programming Languages. Cambridge University Press, 2012. ISBN 978-1-107-02957-6. Google Scholar
Digital Library
- N. Hirokawa and G. Moser. Automated Complexity Analysis Based on the Dependency Pair Method. In Proc. of 4th IJCAR, volume 5195 of LNAI, pages 364–380, 2008. Google Scholar
Digital Library
- N. Hirokawa and G. Moser. Complexity, Graphs, and the Dependency Pair Method. In Proc. of 15th LPAR, volume 5330 of LNCS, pages 652–666, 2008. Google Scholar
Digital Library
- N. Hirokawa, A. Middeldorp, and H. Zankl. Uncurrying for Termination and Complexity. JAR, 50(3):279–315, 2013. Google Scholar
Digital Library
- N. D. Jones. Flow Analysis of Lazy Higher-order Functional Programs. TCS, 375(1-3):120–136, 2007. Google Scholar
Digital Library
- N. D. Jones and N. Bohr. Call-by-Value Termination in the Untyped lambda-Calculus. LMCS, 4(1), 2008.Google Scholar
- S. Jost, K. Hammond, H.-W. Loidl, and M.Hofmann. Static Determination of Quantitative Resource Usage for Higher-order Programs. In Proc. of 37th POPL, pages 223–236. ACM, 2010. Google Scholar
Digital Library
- J. Kochems and L. Ong. Improved Functional Flow and Reachability Analyses Using Indexed Linear Tree Grammars. In Proc. of 22nd RTA, volume 10 of LIPIcs, pages 187–202, 2011.Google Scholar
- M. Korp, C. Sternagel, H. Zankl, and A. Middeldorp. Tyrolean Termination Tool 2. In Proc. of 20th RTA, volume 5595 of LNCS, pages 295–304, 2009. Google Scholar
Digital Library
- J.-Y. Marion. Analysing the Implicit Complexity of Programs. IC, 183: 2–18, 2003. Google Scholar
Digital Library
- J. Midtgaard. Control-flow Analysis of Functional Programs. ACM Comput. Surv., 44(3):10, 2012. Google Scholar
Digital Library
- G. Moser. Proof Theory at Work: Complexity Analysis of Term Rewrite Systems. CoRR, cs.LO/0907.5527, 2009. Habilitation Thesis.Google Scholar
- F. Nielson, H. Nielson, and C. Hankin. Principles of Program Analysis. Springer, 2005. ISBN 978-3-540-65410-0. Google Scholar
Digital Library
- L. Noschinski, F. Emmes, and J. Giesl. A Dependency Pair Framework for Innermost Complexity Analysis of Term Rewrite Systems. In Proc. of 23rd CADE, LNAI, pages 422–438. Springer, 2011. Google Scholar
Digital Library
- C. Okasaki. Functional Pearl: Even Higher-Order Functions for Parsing. JFP, 8(2):195–199, 1998. Google Scholar
Digital Library
- S. E. Panitz and M. Schmidt-Schauß. TEA: Automatically Proving Termination of Programs in a Non-Strict Higher-Order Functional Language. In Proc. of 4th SAS, pages 345–360, 1997. Google Scholar
Digital Library
- B. C. Pierce. Types and programming languages. MIT Press, 2002. ISBN 978-0-262-16209-8. Google Scholar
Digital Library
- G. D. Plotkin. LCF Considered as a Programming Language. TCS, 5 (3):223–255, 1977.Google Scholar
Cross Ref
- F. Rabhi and G. Lapalme. Algorithms: A Functional Programming Approach. Addison-Wesley, 1999. ISBN 978-0-201-59604-5. Google Scholar
Digital Library
- J. C. Reynolds. Definitional Interpreters for Higher-Order Programming Languages. Higher-Order and Symbolic Computation, 11(4):363–397, 1998. Google Scholar
Digital Library
- D. Sands. Complexity Analysis for a Lazy Higher-Order Language. In Proc. of 3rd ESOP, volume 432 of LNCS, pages 361–376, 1990. Google Scholar
Digital Library
- M. Sinn, F. Zuleger, and H. Veith. A Simple and Scalable Static Analysis for Bound Analysis and Amortized Complexity Analysis. In Proc. of 26th CAV, volume 8559 of LNCS, pages 745–761, 2014. Google Scholar
Digital Library
- C. Sternagel and R. Thiemann. Generalized and Formalized Uncurrying. In Proc. of 8th FROCOS, volume 6989 of LNCS, pages 243–258, 2011. Google Scholar
Digital Library
- TeReSe. Term Rewriting Systems, volume 55. Cambridge University Press, 2003. ISBN 978-0-521-39115-3.Google Scholar
- P. B. Vasconcelos and K. Hammond. Inferring Cost Equations for Recursive, Polymorphic and Higher-Order Functional Programs. In Revised Papers of 15th Workshop on IFL, pages 86–101, 2003. Google Scholar
Digital Library
- R. Wilhelm, J. Engblom, A. Ermedahl, N. Holsti, S. Thesing, D. Whalley, G. Bernat, C. Ferdinand, R. Heckmann, T. Mitra, F. Mueller, I. Puaut, P. Puschner, J. Staschulat, and P. Stenstrom. The Worst Case Execution Time Problem - Overview of Methods and Survey of Tools. TECS, pages 1–53, 2008. Google Scholar
Digital Library
- H. Zankl and M. Korp. Modular Complexity Analysis for Term Rewriting. LMCS, 10(1:19):1–33, 2014.Google Scholar
Index Terms
Analysing the complexity of functional programs: higher-order meets first-order
Recommendations
Analysing the complexity of functional programs: higher-order meets first-order
ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional ProgrammingWe show how the complexity of higher-order functional programs can be analysed automatically by applying program transformations to a defunctionalised versions of them, and feeding the result to existing tools for the complexity analysis of first-order ...
Relating Higher-order and First-order Rewriting
We define a formal encoding from higher-order rewriting into first-order rewriting modulo an equational theory. In particular, we obtain a characterization of the class of higher-order rewriting systems which can be encoded by first-order rewriting ...
Analyzing Program Termination and Complexity Automatically with AProVE
In this system description, we present the tool AProVE for automatic termination and complexity proofs of Java, C, Haskell, Prolog, and rewrite systems. In addition to classical term rewrite systems (TRSs), AProVE also supports rewrite systems ...






Comments