skip to main content
research-article
Open Access

Recurrence extraction for functional programs through call-by-push-value

Published:20 December 2019Publication History
Skip Abstract Section

Abstract

The main way of analysing the complexity of a program is that of extracting and solving a recurrence that expresses its running time in terms of the size of its input. We develop a method that automatically extracts such recurrences from the syntax of higher-order recursive functional programs. The resulting recurrences, which are programs in a call-by-name language with recursion, explicitly compute the running time in terms of the size of the input. In order to achieve this in a uniform way that covers both call-by-name and call-by-value evaluation strategies, we use Call-by-Push-Value (CBPV) as an intermediate language. Finally, we use domain theory to develop a denotational cost semantics for the resulting recurrences.

References

  1. Samson Abramsky. 1990. The Lazy Lambda Calculus. In Research Topics in Functional Programming. Addison Wesley, 65–117. https://www.cs.ox.ac.uk/files/293/lazy.pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  2. Samson Abramsky, Radha Jagadeesan, and Pasquale Malacaria. 1996. Full Abstraction for PCF. Information and Computation 163 (1996), 409–470.Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Samson Abramsky and Achim Jung. 1994. Domain Theory. In Handbook of Logic in Computer Science, Samson Abramsky, Dov M. Gabbay, and Thomas S. E. Maibaum (Eds.). Vol. 3. Oxford University Press, 1–168. https://www.cs.bham.ac.uk/ ~axj/pub/papers/handy1.pdfGoogle ScholarGoogle Scholar
  4. Elvira Albert, Puri Arenas, Samir Genaim, German Puebla, and Damiano Zanardini. 2012. Cost analysis of object-oriented bytecode programs. Theoretical Computer Science 413, 1 (2012), 142–159. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Elvira Albert, Jesús Correas, Einar Broch Johnsen, Ka I. Pun, and Guillermo Román-Díez. 2018. Parallel Cost Analysis. ACM Transactions on Computational Logic 19, 4, Article 31 (Nov. 2018), 37 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Elvira Albert, Samir Genaim, and Abu Naser Masud. 2013. On the Inference of Resource Usage Upper and Lower Bounds. ACM Transactions on Computational Logic 14, 3 (2013), 22:1–22:35. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Martin Avanzini and Ugo Dal Lago. 2017. Automating Sized-type Inference for Complexity Analysis. Proceedings of the ACM on Programming Languages 1, ICFP, Article 43 (2017), 29 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Martin Avanzini, Ugo Dal Lago, and Georg Moser. 2015. Analyzing the complexity of functional programs: higher-order meets first-order. In Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming, ICFP 2015, Kathleen Fisher and John Reppy (Eds.). 152–164. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Ralph Benzinger. 2004. Automated higher-order complexity analysis. Theoretical Computer Science 318, 1-2 (2004), 79–103. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Richard Bird. 2014. Thinking Functionally with Haskell. Cambridge University Press, Cambridge. Google ScholarGoogle ScholarCross RefCross Ref
  11. Guy Blelloch and John Greiner. 1995. Parallelism in Sequential Functional Languages. In Proceedings of the Seventh International Conference on Functional Programming Languages and Computer Architecture (FPCA ’95). ACM, New York, NY, USA, 226–237. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Nils Anders Danielsson. 2008. Lightweight semiformal time complexity analysis for purely functional data structures. In Proceedings of the 35th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, George Necula and Philip Wadler (Eds.). 133–144. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 - ICFP 2015. ACM Press, New York, New York, USA, 140–151. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Norman Danner, Jennifer Paykin, and James S. Royer. 2013. A static cost analysis for a higher-order language. In Proceedings of the 7th workshop on Programming languages meets program verification - PLPV ’13. ACM Press, New York, New York, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Norman Danner and James S. Royer. 2007. Adventures in time and space. Logical Methods in Computer Science 3, 9 (2007), 1–53. Google ScholarGoogle ScholarCross RefCross Ref
  16. Conal Elliott and Paul Hudak. 1997. Functional reactive animation. In Proceedings of the second ACM SIGPLAN International Conference on Functional Programming - ICFP ’97. ACM Press, New York, New York, USA, 263–273. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Martín Hötzel Escardó and Weng Kin Ho. 2009. Operational domain theory and topology of sequential programming languages. Information and Computation 207, 3 (2009), 411–437. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Marcelo P. Fiore. 1996. Axiomatic Domain Theory in Categories of Partial Maps. Cambridge University Press, Cambridge. Google ScholarGoogle ScholarCross RefCross Ref
  19. Carl A. Gunter. 1992. Semantics of Programming Languages: Structures and Techniques. The MIT Press.Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. 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 (POPL 2017). ACM, New York, NY, USA, 359–373. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Richard M. Karp. 1994. Probabilistic recurrence relations. Journal of the Association for Computing Machinery 41, 6 (1994), 1136–1150. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Theodore Seok Kim. 2016. Cost Semantics for Plotkin’s PCF. Master’s Thesis. Wesleyan University. https://wesscholar. wesleyan.edu/etd_mas_theses/130/Google ScholarGoogle Scholar
  23. 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, Article 54 (Dec. 2017), 33 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Paul Blain Levy. 2003. Call-by-Push-Value: A Functional-Imperative Synthesis. Springer. Google ScholarGoogle ScholarCross RefCross Ref
  25. Paul Blain Levy. 2006. Call-by-push-value: Decomposing call-by-value and call-by-name. Higher-Order and Symbolic Computation 19 (2006), 377–414. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Robin Milner. 1977. Fully abstract models of typed λ-calculi. Theoretical Computer Science 4, 1 (1977), 1–22. Google ScholarGoogle ScholarCross RefCross Ref
  27. John C. Mitchell. 1996. Foundations for programming languages. The MIT Press.Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Yue Niu and Jan Hoffmann. 2018. Automatic Space Bound Analysis for Functional Programs with Garbage Collection. In LPAR-22. 22nd International Conference on Logic for Programming, Artificial Intelligence and Reasoning (EPiC Series in Computing), Gilles Barthe, Geoff Sutcliffe, and Margus Veanes (Eds.), Vol. 57. EasyChair, 543–563. Google ScholarGoogle ScholarCross RefCross Ref
  29. Benjamin C. Pierce. 2002. Types and Programming Languages. The MIT Press.Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. A. M. Pitts. 1994. Some notes on inductive and co-inductive techniques in the semantics of functional programs. Technical Report. BRICS. https://www.brics.dk/NS/94/5/BRICS- NS- 94- 5.pdfGoogle ScholarGoogle Scholar
  31. A. M. Pitts. 1997. Operationally-Based Theories of Program Equivalence. In Semantics and Logics of Computation, A. M. Pitts and P. Dybjer (Eds.). Cambridge University Press, 241–298. https://www.cl.cam.ac.uk/~amp12/papers/opebtp/opebtp.pdfGoogle ScholarGoogle Scholar
  32. Gordon Plotkin and John Power. 2001. Adequacy for Algebraic Effects. In Foundations of Software Science and Computation Structures. FoSSaCS 2001, Furio Honsell and M. Miculan (Eds.). Lecture Notes in Computer Science, Vol. 2030. Springer, Berlin, Heidelberg. Google ScholarGoogle ScholarCross RefCross Ref
  33. Gordon D. Plotkin. 1977. LCF considered as a programming language. Theoretical Computer Science 5, 3 (1977), 223–255. Google ScholarGoogle ScholarCross RefCross Ref
  34. G. D. Plotkin. 1985. Lectures on predomains and partial functions. Notes for a course given at CSLI, Stanford University.Google ScholarGoogle Scholar
  35. Jon G. Riecke. 1993. Fully abstract translations between functional languages. Mathematical Structures in Computer Science 3 (1993), 387–415. Google ScholarGoogle ScholarCross RefCross Ref
  36. V. Stoltenberg-Hansen, I. Lindstrom, and E. R. Griffor. 1994. Mathematical Theory of Domains. Cambridge University Press, Cambridge. Google ScholarGoogle ScholarCross RefCross Ref
  37. Thomas Streicher. 2006. Domain-theoretic Foundations of Functional Programming. World Scientific.Google ScholarGoogle Scholar
  38. Robert Endre Tarjan. 1985. Amortized computational complexity. SIAM J. Algebraic Discrete Methods 6, 2 (1985), 306–318. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Ben Wegbreit. 1975. Mechanical program analysis. Communications of the Association for Computing Machinery 18, 9 (1975), 528–539. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Recurrence extraction for functional programs through call-by-push-value

          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!