Abstract
A central method for analyzing the asymptotic complexity of a functional program is to extract and then solve a recurrence that expresses evaluation cost in terms of input size. The relevant notion of input size is often specific to a datatype, with measures including the length of a list, the maximum element in a list, and the height of a tree. In this work, we give a formal account of the extraction of cost and size recurrences from higher-order functional programs over inductive datatypes. Our approach allows a wide range of programmer-specified notions of size, and ensures that the extracted recurrences correctly predict evaluation cost. To extract a recurrence from a program, we first make costs explicit by applying a monadic translation from the source language to a complexity language, and then abstract datatype values as sizes. Size abstraction can be done semantically, working in models of the complexity language, or syntactically, by adding rules to a preorder judgement. We give several different models of the complexity language, which support different notions of size. Additionally, we prove by a logical relations argument that recurrences extracted by this process are upper bounds for evaluation cost; the proof is entirely syntactic and therefore applies to all of the models we consider.
- J. Backus. Can programming be liberated from the von Neumann style? A functional style and its algebra of programs. Communications of the Association for Computing Machinery, 21(8):613–641, 1978. doi: 10. 1145/359576.359579. Google Scholar
Digital Library
- R. Benzinger. Automated higher-order complexity analysis. Theoretical Computer Science, 318(1-2):79 – 103, 2004. doi: 10.1016/j.tcs.2003.10. 022. N. A. Danielsson. Lightweight semiformal time complexity analysis for purely functional data structures. In A. Aiken and G. Morrisett, editors, Proceedings of the 30th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 133–144. ACM Press, 2003. doi: 10.1145/1328438.1328457. Google Scholar
Digital Library
- N. Danner and J. S. Royer. Two algorithms in search of a type system. Theory of Computing Systems, 45(4):787–821, 2009. doi: 10.1007/ s00224-009-9181-y. N. Danner, J. Paykin, and J. S. Royer. A static cost analysis for a higher-order language. In M. Might and D. V. Horn, editors, Proceedings of the 7th workshop on Programming languages meets program verification, pages 25–34. ACM Press, 2013. doi: 10.1145/2428116.2428123. Google Scholar
Digital Library
- N. Danner, D. R. Licata, and R. Ramyaa. Denotational cost semantics for functional languages with inductive types. arXiv:1506.01949, 2015. Google Scholar
Digital Library
- S. K. Debray and N.-W. Lin. Cost analysis of logic programs. ACM Transactions on Programming Languages and Systems, 15(5):826–875, 1993. doi: 10.1145/161468.161472. Google Scholar
Digital Library
- R. Harper. Practical Foundations for Programming Languages. Cambridge University Press, 2013.Google Scholar
Digital Library
- S. Jost, K. Hammond, H.-W. Loidl, and M. Hofmann. Static determination of quantitative resource usage for higher-order programs. In M. Hermenegildo, editor, Proceedings of the 37th Annual ACM SIGPLANSIGACT Symposium on Principles of Programming Languages, pages 223–236. ACM Press, 2010. doi: 10.1145/1706299.1706327. Google Scholar
Digital Library
- D. Le Métayer. ACE: an automatic complexity evaluator. ACM Transactions on Programming Languages and Systems, 10(2):248–266, 1988. doi: 10. 1145/42190.42347. Google Scholar
Digital Library
- X. Leroy and H. Grall. Coinductive big-step operational semantics. Information and Computation, 207(2):284–304, 2009. doi: 10.1016/j.ic.2007. Google Scholar
Digital Library
- 12.004. E. Moggi. Notions of computation and monads. Information And Computation, 93(1):55–92, 1991. doi: 10.1016/0890-5401(91)90052-4. J. Navas, E. Mera, P. López-Garcia, and M. V. Hermenegildo. User-definable resource bounds analysis for logic programs. In V. Dahl and I. Niemelä, editors, Proceedings of Logic Programming: 23rd International Conference, ICLP 2007, volume 4670 of Lecture Notes in Computer Science, pages 348–363, 2007. doi: 10.1007/978-3-540-74610-2_24. C. Okasaki. Purely Functional Data Structures. Cambridge University Press, 1998. Google Scholar
Digital Library
- M. Rosendahl. Automatic complexity analysis. In J. E. Stoy, editor, Proceedings of the Fourth International Conference on Functional Programming Languages and Computer Architecture, pages 144–156. ACM Press, 1989. doi: 10.1145/99370.99381. Google Scholar
Digital Library
- D. Sands. Calculi for Time Analysis of Functional Programs. PhD thesis, University of London, 1990.Google Scholar
- J. Shultis. On the complexity of higher-order programs. Technical Report CU-CS-288-85, University of Colorado at Boulder, 1985.Google Scholar
- K. Van Stone. A Denotational Approach to Measuring Complexity in Functional Programs. PhD thesis, School of Computer Science, Carnegie Mellon University, 2003. Google Scholar
Digital Library
- P. Wadler. Views: A way for pattern matching to cohabit with data abstraction. In Proceedings of the 14th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pages 307–313, 1987. doi: 10. 1145/41625.41653. Google Scholar
Digital Library
- P. Wadler. The essence of functional programming. In R. Sethi, editor, Proceedings of the 19th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 1–14. ACM Press, 1992. Google Scholar
Digital Library
- doi: 10.1145/143165.143169.Google Scholar
- B. Wegbreit. Mechanical program analysis. Communications of the Association for Computing Machinery, 18(9):528–539, 1975. doi: 10. 1145/361002.361016. Google Scholar
Digital Library
Index Terms
Denotational cost semantics for functional languages with inductive types
Recommendations
Denotational cost semantics for functional languages with inductive types
ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional ProgrammingA central method for analyzing the asymptotic complexity of a functional program is to extract and then solve a recurrence that expresses evaluation cost in terms of input size. The relevant notion of input size is often specific to a datatype, with ...
A Denotational Semantics for First-Order Logic
CL '00: Proceedings of the First International Conference on Computational LogicIn Apt and Bezem [AB99] we provided a computational interpretation of first-order formulas over arbitrary interpretations. Here we complement this work by introducing a denotational semantics for first-order logic. Additionally, by allowing an ...
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