Higher-Order and Symbolic Computation

, Volume 22, Issue 3, pp 199–231 | Cite as

A verified framework for higher-order uncurrying optimizations

Article

Abstract

Function uncurrying is an important optimization for the efficient execution of functional programming languages. This optimization replaces curried functions by uncurried, multiple-argument functions, while preserving the ability to evaluate partial applications. First-order uncurrying (where curried functions are optimized only in the static scopes of their definitions) is well understood and implemented by many compilers, but its extension to higher-order functions (where uncurrying can also be performed on parameters and results of higher-order functions) is challenging. This article develops a generic framework that expresses higher-order uncurrying optimizations as type-directed insertion of coercions, and prove its correctness. The proof uses step-indexed logical relations and was entirely mechanized using the Coq proof assistant.

Keywords

Functional programming languages Compiler optimization Compiler verification Semantic preservation Mechanized verification 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Abadi, M., Cardelli, L., Curien, P.L., Lévy, J.J.: Explicit substitutions. J. Funct. Program. 1(4), 375–416 (1991) MATHCrossRefGoogle Scholar
  2. 2.
    Acar, U.A., Ahmed, A., Blume, M.: Imperative self-adjusting computation. In: 35th Symposium Principles of Programming Languages, pp. 309–322. ACM, New York (2008) Google Scholar
  3. 3.
    Aczel, P.: An introduction to inductive definitions. In: Barwise, J. (ed.) Handbook of Mathematical Logic. Studies in Logics and the Foundations of Mathematics, vol. 90, pp. 739–782. North-Holland, Amsterdam (1997) CrossRefGoogle Scholar
  4. 4.
    Ahmed, A.J.: Semantics of types for mutable state. Ph.D. thesis,. Princeton University (2004) Google Scholar
  5. 5.
    Ahmed, A.J.: Step-indexed syntactic logical relations for recursive and quantified types. In: Programming Languages and Systems, 15th European Symposium on Programming, ESOP 2006. Lecture Notes in Computer Science, vol. 3924, pp. 69–83. Springer, Berlin (2006) Google Scholar
  6. 6.
    Appel, A.W.: Foundational proof-carrying code. In: Logic in Computer Science 2001, pp. 247–258. IEEE Computer Society, Los Alamitos (2001) Google Scholar
  7. 7.
    Appel, A.W., McAllester, D.A.: An indexed model of recursive types for foundational proof-carrying code. ACM Trans. Program. Lang. Syst. 23(5), 657–683 (2001) CrossRefGoogle Scholar
  8. 8.
    Aydemir, B.E., Bohannon, A., Fairbairn, M., Foster, J.N., Pierce, B.C., Sewell, P., Vytiniotis, D., Washburn, G., Weirich, S., Zdancewic, S.: Mechanized metatheory for the masses: the POPLmark challenge. In: Int. Conf. on Theorem Proving in Higher Order Logics (TPHOLs). Lecture Notes in Computer Science, vol. 3603, pp. 50–65. Springer, Berlin (2005) Google Scholar
  9. 9.
    Bertot, Y., Castéran, P.: Interactive Theorem Proving and Program Development—Coq’Art: The Calculus of Inductive Constructions. EATCS Texts in Theoretical Computer Science. Springer, Berlin (2004) MATHGoogle Scholar
  10. 10.
    Cardone, F., Hindley, J.R.: History of lambda-calculus and combinatory logic. In: Gabbay, D.M., Woods, J. (eds.) Logic from Russell to Church. Handbook of the History of Logic, vol. 5. North-Holland, Amsterdam (2009) CrossRefGoogle Scholar
  11. 11.
    Coq development team: The Coq proof assistant. Software and documentation available at http://coq.inria.fr/ (1989–2009)
  12. 12.
    Cousineau, G., Curien, P.L., Mauny, M.: The categorical abstract machine. Sci. Comput. Program. 8(2), 173–202 (1987) MATHCrossRefMathSciNetGoogle Scholar
  13. 13.
    Curry, H.B., Feys, R.: Combinatory Logic, vol. I. North-Holland, Amsterdam (1958). 3rd edn. 1974 MATHGoogle Scholar
  14. 14.
    Dargaye, Z.: Décurryfication certifiée. In: Journées Francophones des Langages Applicatifs (JFLA’07, pp. 119–134. INRIA, Rocquencourt (2007) Google Scholar
  15. 15.
    Di Cosmo, R.: Isomorphisms of Types: From Lambda Calculus to Information Retrieval and Language Design. Birkhauser, Basel (1995) MATHGoogle Scholar
  16. 16.
    Felleisen, M., Friedman, D.P.: Control operators, the SECD machine and the λ-calculus. In: Formal Description of Programming Concepts III, pp. 131–141. North-Holland, Amsterdam (1986) Google Scholar
  17. 17.
    Flanagan, C.: Hybrid type checking. In: 33rd Symposium Principles of Programming Languages, pp. 245–256. ACM, New York (2006) Google Scholar
  18. 18.
    Hannan, J., Hicks, P.: Higher-order arity raising. In: International Conference on Functional Programming 1998, pp. 27–38. ACM, New York (1998) Google Scholar
  19. 19.
    Hannan, J., Hicks, P.: Higher-order uncurrying. High.-Order Symb. Comput. 13(3), 179–216 (2000) MATHCrossRefGoogle Scholar
  20. 20.
    Henglein, F.: Dynamic typing: syntax and proof theory. Sci. Comput. Program. 22(3), 197–230 (1994) MATHCrossRefMathSciNetGoogle Scholar
  21. 21.
    Henglein, F., Jørgensen, J.: Formally optimal boxing. In: 21st Symposium Principles of Programming Languages, pp. 213–226. ACM, New York (1994) CrossRefGoogle Scholar
  22. 22.
    Krivine, J.L.: A call-by-name lambda-calculus machine. High.-Order Symb. Comput. 20(3), 199–207 (2007) MATHCrossRefGoogle Scholar
  23. 23.
    Landin, P.J.: The mechanical evaluation of expressions. Comput. J. 6, 308–320 (1964) MATHGoogle Scholar
  24. 24.
    Leroy, X.: The ZINC experiment: an economical implementation of the ML language. Technical report 117, INRIA (1990) Google Scholar
  25. 25.
    Leroy, X.: Unboxed objects and polymorphic typing. In: 19th Symposium Principles of Programming Languages, pp. 177–188. ACM, New York (1992) CrossRefGoogle Scholar
  26. 26.
    Letouzey, P.: Extraction in Coq: An overview. In: Logic and Theory of Algorithms, Fourth Conference on Computability in Europe, CiE 2008. Lecture Notes in Computer Science, vol. 5028, pp. 359–369. Springer, Berlin (2008) Google Scholar
  27. 27.
    Marlow, S., Peyton Jones, S.: Making a fast curry: push/enter vs eval/apply for higher-order languages. J. Funct. Program. 16(4–5), 375–414 (2006) MathSciNetGoogle Scholar
  28. 28.
    Necula, G.C.: Proof-carrying code. In: 24th Symposium Principles of Programming Languages, pp. 106–119. ACM, New York (1997) CrossRefGoogle Scholar
  29. 29.
    Necula, G.C.: Translation validation for an optimizing compiler. In: Programming Language Design and Implementation 2000, pp. 83–95. ACM, New York (2000) CrossRefGoogle Scholar
  30. 30.
    Peyton Jones, S.L.: Implementing lazy functional languages on stock hardware: the spineless tagless G-machine. J. Funct. Program. 2(2), 127–202 (1992) MATHCrossRefGoogle Scholar
  31. 31.
    Pnueli, A., Siegel, M., Singerman, E.: Translation validation. In: Tools and Algorithms for Construction and Analysis of Systems, TACAS ’98. Lecture Notes in Computer Science, vol. 1384, pp. 151–166. Springer, Berlin (1998) CrossRefGoogle Scholar
  32. 32.
    Shivers, O.: Control-flow analysis in Scheme. In: Programming Language Design and Implementation 1988, pp. 164–174. ACM, New York (1988) CrossRefGoogle Scholar
  33. 33.
    Siek, J.G., Taha, W.: Gradual typing for functional languages. In: Scheme and Functional Programming 2006, pp. 81–92. Technical report TR-2006-06, University of Chicago (2006) Google Scholar
  34. 34.
    Statman, R.: Logical relations and the typed λ-calculus. Inf. Control 65(2/3), 85–97 (1985) MATHCrossRefMathSciNetGoogle Scholar
  35. 35.
    Thatte, S.R.: Quasi-static typing. In: 17th Symposium Principles of Programming Languages, pp. 367–381. ACM, New York (1990) CrossRefGoogle Scholar
  36. 36.
    Tristan, J.B., Leroy, X.: Formal verification of translation validators: a case study on instruction scheduling optimizations. In: 35th Symposium Principles of Programming Languages, pp. 17–27. ACM, New York (2008) Google Scholar
  37. 37.
    Wells, J.B., Dimock, A., Muller, R., Turbak, F.: A calculus for polymorphic and polyvariant flow types. J. Funct. Program. 12(3), 183–227 (2002) MATHCrossRefMathSciNetGoogle Scholar
  38. 38.
    Wright, A.K., Cartwright, R.: A practical soft type system for scheme. ACM Trans. Program. Lang. Syst. 19(1), 87–152 (1997) CrossRefGoogle Scholar

Copyright information

© Springer Science+Business Media, LLC 2010

Authors and Affiliations

  1. 1.ENSIIEÉvryFrance
  2. 2.CEA LIST, SaclayGif-sur-YvetteFrance
  3. 3.INRIA Paris-Rocquencourt, Domaine de VoluceauLe ChesnayFrance

Personalised recommendations