Skip to main content

Using Intersection Types for Cost-Analysis of Higher-Order Polymorphic Functional Programs

  • Conference paper
Types for Proofs and Programs (TYPES 2006)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 4502))

Included in the following conference series:

Abstract

This paper presents a system of cost derivation for higher-order and polymorphic functional programs based on a notion of sized types and exploiting a type-and-effect system approach. The paper gives an operational semantics of cost for a simple strict functional language in terms of λ-calculus β-reduction steps and introduces type rules describing cost effects. The type system is based on intersection types. The use of discrete polymorphism (intersection types) instead of the usual parametric polymorphism approach improves the analysis and solves, in many cases, the “size aliasing problem” that has been identified as a limitation on previous type-and-effect approaches. Finally we provide a proof of the soundness of our effect system with respect to the cost semantics.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Amtoft, T., Nielson, F., Nielson, H.R.: Type and Effect Systems: Behaviours for Concurrency. Imperial College Press (1999)

    Google Scholar 

  2. Banerjee, A., Jensen, T.: Modular control-flow analysis with rank 2 intersection types. Mathematical. Structures in Comp. Sci. 13(1), 87–124 (2003)

    Article  MATH  MathSciNet  Google Scholar 

  3. Barendregt, H.: The Lambda Calculus. Its Syntax and Semantics. In: Studies in Logic and the Foundations of Mathematics, vol. 103, North-Holland, Amsterdam (1984)

    Google Scholar 

  4. Barendregt, H., Coppo, M., Dezani-Ciancaglini, M.: A filter lambda model and the completeness of type assignment. The Journal of Symbolic Logic 48(4), 931–940 (1983)

    Article  MATH  MathSciNet  Google Scholar 

  5. Carlier, S., Polakow, J., Wells, J.B., Kfoury, A.J.: System e: Expansion variables for flexible typing with linear and non-linear types and intersection types. In: Schmidt, D. (ed.) ESOP 2004. LNCS, vol. 2986, pp. 294–309. Springer, Heidelberg (2004)

    Google Scholar 

  6. Chin, W.-N., Khoo, S.-C.: Calculating Sized Types. Higher-Order and Symbolic Computing 14(2,3) (2001)

    Google Scholar 

  7. Coppo, M., Dezani-Ciancaglini, M.: An extension of the basic functionality theory for the λ-calculus. Notre-Dame Journal of Formal Logic 21(4), 685–693 (1980)

    Article  MATH  MathSciNet  Google Scholar 

  8. Coppo, M., Giannini, P.: Principal types and unification for simple intersection type systems. Information and Computation 122(1) (1995)

    Google Scholar 

  9. Lago, U.D., Martini, S.: An invariant cost model for the lambda calculus. In: Beckmann, A., Berger, U., Löwe, B., Tucker, J.V. (eds.) CiE 2006. LNCS, vol. 3988, pp. 105–114. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  10. Damiani, F.: Rank 2 intersection types for local definitions and conditional expressions. ACM Transactions On Programming Languages and Systems 25(4), 401–451 (2003)

    Article  Google Scholar 

  11. Damiani, F., Giannini, P.: A decidable intersection type system based on relevance. In: Theoretical Aspects of Computer Science. LNCS, Springer, Heidelberg (1994)

    Google Scholar 

  12. Damiani, F.: Rank-2 Intersection and Polymorphic Recursion. In: Urzyczyn, P. (ed.) TLCA 2005. LNCS, vol. 3461, pp. 146–161. Springer, Heidelberg (2005)

    Google Scholar 

  13. Davies, R., Pfenning, F.: Intersection types and computational effects. In: ICFP, pp. 198–208 (2000)

    Google Scholar 

  14. Dornic, V., Jouvelot, P., Gifford, D.K.: Polymorphic Time Systems for Estimating Program Complexity. ACM Letters on Prog. Lang. and Systems 1(1), 33–45 (1992)

    Article  Google Scholar 

  15. Felleisen, M., Friedman, D.P.: Control Operators, the SECD-Machine and the λ-Calculus. In: Wirsing, M. (ed.) Formal Description of Programming Concepts III, pp. 193–217. Elsevier, Amsterdam (1986)

    Google Scholar 

  16. Grobauer, B.: Cost Recurrences for DML Programs. In: Proc. 2001 ACM Intl. Conf. on Functional Programming – ICFP 2001, Florence, Italy (September 2001)

    Google Scholar 

  17. Hofmann, M., Jost, S.: Type-based amortised heap-space analysis (for an object-oriented language). In: Sestoft, P. (ed.) ESOP 2006 and ETAPS 2006. LNCS, vol. 3924, pp. 22–37. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  18. Hughes, R.J.M., Pareto, L., Sabry, A.: Proving the Correctness of Reactive Systems using Sized Types. In: Proc. 1996 ACM Symposium on Principles of Programming Languages – POPL 1996, St Petersburg, FL (January 1996)

    Google Scholar 

  19. Jim, T.: Rank 2 type systems and recursive definitions. Technical Report MIT/LCS/TM-531, Massachusetts Institute of Technology, Laboratory for Computer Science (November 1995)

    Google Scholar 

  20. Kfoury, A.J., Wells, J.B.: Principality and decidable type inference for finite-rank intersection types. In: Assaf, J. (ed.) popl99, pp. 161–174. ACM Press, New York (1999)

    Google Scholar 

  21. Launchbury, J.: A Natural Semantics for Lazy Evaluation. In: Proc. 1993 ACM Symp. on Principles of Prog. Langs. – POPL 1993, pp. 144–154 (1993)

    Google Scholar 

  22. Milner, A.J.R.G.: A Theory of Type Polymorphism in Programming. J. Computer System Sciences 17(3), 348–375 (1976)

    Article  MathSciNet  Google Scholar 

  23. Nielson, F., Nielson, H., Hankin, C.: Principles of Program Analysis. Springer, Heidelberg (1999)

    MATH  Google Scholar 

  24. Pottinger, G.: A type assignement for the strongly normalizable terms. In: Hindley, J.R., Seldin, J.P. (eds.) To H.B. Curry, Essays in Combinatory Logic, Lambda-calculus and Formalism, pp. 561–577. Academic Press, San Diego (1980)

    Google Scholar 

  25. Portillo, A.J.R., Hammond, K., Loidl, H.-W., Vasconcelos, P.: Cost analysis using automatic size and time inference. In: Peña, R., Arts, T. (eds.) IFL 2002. LNCS, vol. 2670, pp. 232–247. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  26. Reistad, B., Gifford, D.K.: Static Dependent Costs for Estimating Execution Time. In: Proc. 1994 ACM Conference on Lisp and Functional Programming – LFP 1994, pp. 65–78, Orlando, FL (June 1994)

    Google Scholar 

  27. Simoes, H.R., Hammond, K., Florido, M., Vasconcelos, P.: Using intersection types for cost-analysis of higher-order polymorphic functional programs. Technical report (2006), http://www.dcs.st-and.ac.uk/~kh/papers/itypes_cost.pdf

  28. van Bakel, S.: Intersection Type Disciplines in Lambda Calculus and Applicative Term Rewriting Systems. PhD thesis, Department of Computer Science, University of Nijmegen (1993)

    Google Scholar 

  29. van Bakel, S.: Rank 2 intersection type assignment in term rewriting systems. Fundam. Inform. 26(2), 141–166 (1996)

    MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Thorsten Altenkirch Conor McBride

Rights and permissions

Reprints and permissions

Copyright information

© 2007 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Simões, H.R., Hammond, K., Florido, M., Vasconcelos, P. (2007). Using Intersection Types for Cost-Analysis of Higher-Order Polymorphic Functional Programs. In: Altenkirch, T., McBride, C. (eds) Types for Proofs and Programs. TYPES 2006. Lecture Notes in Computer Science, vol 4502. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-74464-1_15

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-74464-1_15

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-74463-4

  • Online ISBN: 978-3-540-74464-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics