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.
Similar content being viewed by others
References
Abadi, M., Cardelli, L., Curien, P.L., Lévy, J.J.: Explicit substitutions. J. Funct. Program. 1(4), 375–416 (1991)
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)
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)
Ahmed, A.J.: Semantics of types for mutable state. Ph.D. thesis,. Princeton University (2004)
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)
Appel, A.W.: Foundational proof-carrying code. In: Logic in Computer Science 2001, pp. 247–258. IEEE Computer Society, Los Alamitos (2001)
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)
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)
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)
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)
Coq development team: The Coq proof assistant. Software and documentation available at http://coq.inria.fr/ (1989–2009)
Cousineau, G., Curien, P.L., Mauny, M.: The categorical abstract machine. Sci. Comput. Program. 8(2), 173–202 (1987)
Curry, H.B., Feys, R.: Combinatory Logic, vol. I. North-Holland, Amsterdam (1958). 3rd edn. 1974
Dargaye, Z.: Décurryfication certifiée. In: Journées Francophones des Langages Applicatifs (JFLA’07, pp. 119–134. INRIA, Rocquencourt (2007)
Di Cosmo, R.: Isomorphisms of Types: From Lambda Calculus to Information Retrieval and Language Design. Birkhauser, Basel (1995)
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)
Flanagan, C.: Hybrid type checking. In: 33rd Symposium Principles of Programming Languages, pp. 245–256. ACM, New York (2006)
Hannan, J., Hicks, P.: Higher-order arity raising. In: International Conference on Functional Programming 1998, pp. 27–38. ACM, New York (1998)
Hannan, J., Hicks, P.: Higher-order uncurrying. High.-Order Symb. Comput. 13(3), 179–216 (2000)
Henglein, F.: Dynamic typing: syntax and proof theory. Sci. Comput. Program. 22(3), 197–230 (1994)
Henglein, F., Jørgensen, J.: Formally optimal boxing. In: 21st Symposium Principles of Programming Languages, pp. 213–226. ACM, New York (1994)
Krivine, J.L.: A call-by-name lambda-calculus machine. High.-Order Symb. Comput. 20(3), 199–207 (2007)
Landin, P.J.: The mechanical evaluation of expressions. Comput. J. 6, 308–320 (1964)
Leroy, X.: The ZINC experiment: an economical implementation of the ML language. Technical report 117, INRIA (1990)
Leroy, X.: Unboxed objects and polymorphic typing. In: 19th Symposium Principles of Programming Languages, pp. 177–188. ACM, New York (1992)
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)
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)
Necula, G.C.: Proof-carrying code. In: 24th Symposium Principles of Programming Languages, pp. 106–119. ACM, New York (1997)
Necula, G.C.: Translation validation for an optimizing compiler. In: Programming Language Design and Implementation 2000, pp. 83–95. ACM, New York (2000)
Peyton Jones, S.L.: Implementing lazy functional languages on stock hardware: the spineless tagless G-machine. J. Funct. Program. 2(2), 127–202 (1992)
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)
Shivers, O.: Control-flow analysis in Scheme. In: Programming Language Design and Implementation 1988, pp. 164–174. ACM, New York (1988)
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)
Statman, R.: Logical relations and the typed λ-calculus. Inf. Control 65(2/3), 85–97 (1985)
Thatte, S.R.: Quasi-static typing. In: 17th Symposium Principles of Programming Languages, pp. 367–381. ACM, New York (1990)
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)
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)
Wright, A.K., Cartwright, R.: A practical soft type system for scheme. ACM Trans. Program. Lang. Syst. 19(1), 87–152 (1997)
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Dargaye, Z., Leroy, X. A verified framework for higher-order uncurrying optimizations. Higher-Order Symb Comput 22, 199–231 (2009). https://doi.org/10.1007/s10990-010-9050-z
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10990-010-9050-z