skip to main content
10.1145/96709.96710acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
Article
Free Access

On laziness and optimality in lambda interpreters: tools for specification and analysis

Authors Info & Claims
Published:01 December 1989Publication History

ABSTRACT

In this paper, I introduce a new formal system, ACCL, based on Curien's Categorical Combinators [Cur86a]. I show that ACCL has properties not possessed by Curien's original combinators that make it particularly appropriate as the basis for implementation and analysis of a wide range of reduction schemes using shared environments, closures, or λ-terms. As an example of the practical utility of this formalism, I use it to specify a simple lazy interpreter for the λ-calculus, whose correctness follows trivially from the properties of ACCL.

I then describe a labeled variant of ACCL, ACCLL, which can be used as a tool to determine the degree of “laziness” possessed by various λ-reduction schemes. In particular, ACCLL is applied to the problem of optimal reduction in the λ-calculus. A reduction scheme for the λ-calculus is optimal if the number of redex contractions that must be performed in the course of reducing any λ-term to a normal form (if one exists) is guaranteed to be minimal. Results of Lévy [Lév78,Lév80] showed that for a natural class of reduction strategies allowing shared redexes, optimal reductions were, at least in principle, possible. He conjectured that an optimal reduction strategy might be realized in practice using shared closures and environments as well as shared λ-terms. I show, however, using ACCLL, a practical optimal reduction scheme for arbitrary λ-terms using only shared environments, closures, or terms is unlikely to exist.

References

  1. ACCJL89.M. Abadi, L. CardeUi, P.-L. Curien, and J.J.- Levy. Explicit substitutions. In Proc. Seventeenth A CM Symposium on Principles o} Programming Languages, San Francisco, 1989.]]Google ScholarGoogle Scholar
  2. AKP84.Arvind, Vinod Kathail, and Keshav Pingali. Sharing of computation in functional language implementations, in Proc. international Work. shop on High-Level Computer Architecture, Los Angeles, 1984.]]Google ScholarGoogle Scholar
  3. AP81.Luigia Aiello and Gianfraneo Prini. An efficient interpreter for the lambda calculus. Journal of Computer and Sl/stem Sciences, 23:383-424, 1981.]]Google ScholarGoogle Scholar
  4. Aug84.L. Augustsson. A compiler for Luy ML. In Proc. A CM Svrnp. on Lisp and Functional Programming, Austin, 1984.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Bar84.H.P. Barendregt. The Lombda Calculus, volume 103 of Studies in Logic and the Foundations of Mathematics. North-Holland, Amsterdam, 1984.]]Google ScholarGoogle Scholar
  6. BBKV76.H.P. Barendregt, J. Bergstra, J.W. Klop, and H. Volken. Degrees, reductions, and representability in the lambda calculus. Preprint 22, Department of Mathematics, University of Utrecht, The Netherlands, 1976.]]Google ScholarGoogle Scholar
  7. BKKS87.H.P. Barendregt, J.R. Kennaway, J.W. Klop, and M.R. Sleep. Needed reduction and spine strategies for the lambda calculus. Information and Computation, 75:191-231, 1987.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. CCM87.G. Cousineau, P.-L. Curien, and M. Mauny. The categorical abstract machine. Science of Computer Programming, 8-1"/'3-202, 1987.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Chu41.A. Church. The Calculi of Lambda Conversion. Princeton University Press, Princeton, NJ, 1941.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Cur86a.P.-L. Curien. Categorical eombinators. {afar. motion and Control, 69:188-254, 1986.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Cur86b.P.-L. Curien. Categorical Combinators, Sequential Algorithms, and Functional Programming. Research Notes in Theoretical Computer Science. Pitman, London, 1986.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Cur86c.P.-L. Curien. De Is diificult~ d'impl~menter le partage optimal au sens de l~vy. Unpublished Note, Universit~ de Paris VII, 1986.]]Google ScholarGoogle Scholar
  13. dB72.N.G. de Bruijn. Larnbda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the church-tosser theorem. Proc. of the Koninkli. jke Nederlandse Akademie van Wetenschappen, 75(5):381-392, 1972.]]Google ScholarGoogle Scholar
  14. dB78.N.G. de Bruijn. Lambdn calculus with namefree formulas involving symbols that represent reference transforming mappings. Proc. of the Koninklijke Nederlandse Akademie van Wetenschappen, 81(3):348-356, 1978.]]Google ScholarGoogle Scholar
  15. Der87.Nachum Dershowitz. Termination of rewriting. J. SFmbolic Computation, 3:69-116, 1987.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. FH88.Anthony J. Field and Peter G. Harrison. Func. tional Programming. Addison-Wesley, Wakingham, England, 1988.]]Google ScholarGoogle Scholar
  17. FW87.Jan Fairbairn and Stuart Wray. Tim: A simple, lazy abstract machine to execute supercombinators. In Proc. Conference on Functional Programming Languages and Computer Architecture, pages 34-45, Portland, 1987. Springer- Verlag. Lecture Notes in Computer Science 274.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Har87.Th~r~se Hardin. R~sultats de Confluence pour lea R~gles Fortes de la Logique Combinatoire Cat~gorique et Liens avec lea Lambda-Calctds. PhD thesis, Universit~ de Paris VII, 1987.]]Google ScholarGoogle Scholar
  19. Har89.Th~r~se Hardin. Confluence results for the pure strong categorical logic CCL. A-calculi as subsystems of CCL. Theoretical Computer Science, 65:291-342, 1989.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. HL86.Th~r~se Hardin and AlaJn Laville. Proof of termination of the rewriting system SUBST on CUL. Rapports de Recherche 560, Institut National de Recherche en Informatique et en Autom~tique, Domxine de Voluceau, Rocquencourt, B.P. 105, 78153 Le Chesnay Cedex, France, August 1986.]]Google ScholarGoogle Scholar
  21. HM76.P. Henderson and J.H. Morris. A lazy evaluator. In Proc. Third A CM Symposium on Principles o{ Programming Languages, pages 95-103, 1976.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. HO80.G. Hunt a~d D.C. Oppen. Equations and rewrite rules: A survey. In R.V. Book, editor, Formal Language Theory, Perspectives, and Open Problems, pages 349-405. Academic Press, London, 1980.]]Google ScholarGoogle Scholar
  23. HS86.J.R. Hindley and J.P. Seldin. Introduction to Combinators and Lambda.Calculus, volume 1 of London Mathematical Society Student Texts. Cambridge University Press, Cambridge, 1986.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Hue80.G. Hunt. Confluent reductions: Abstre~t properties and applications to term rewriting systems. Journal of the A CM, 27(4):797-821, 1980.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Hug84.R.J.M. Hughes. The Design and Implements. tion of Programming Languages. PhD thesis, Oxford University, September 1984. (PRG-40).]]Google ScholarGoogle Scholar
  26. Joh84.T. Johnsson. E~_cient compilation of lazy evaluation. In Proc. A CM Cony. on Compiler Con. struction, Montreal, 1984.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Joh85.T. Johnsson. Lambds lifting: Transforming programs to recursive equations. In Proc. Conference on Functional Programming Language8 and Computer Architecture. Springer- Verlag, 1985. Lecture Notes in Computer Science 201.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. KL80.S. Kamin and J.-J. L~vy. Two generalizations of the recursive path orderings. Unpublished note, Department of Computer Science, Unlverity of Illinois, Urbana, IL, 1980.]]Google ScholarGoogle Scholar
  29. Klo80.J.W. Klop. Combinatory Reduction Systems, volume 127 of Mathematical Centre Tracts. Mathematical Centre, Kruislaan 413, Amsterdam 1098SJ, The Netherlands, 1980.]]Google ScholarGoogle Scholar
  30. Lam89.John Lamping. An algorithm for optimal lambd~ calculus reduction. In Proc. Seven. teen& A CM Symposium on Principles of Pro- 9ramming Languages, San Francisco, 1989.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Lan64.P.J. Laadin. The mechanical evaluation of expressions. Computer Journal, 6:308-320, 1964.]]Google ScholarGoogle ScholarCross RefCross Ref
  32. Les84.Pierre Lescanne. Uniform termination of term rewriting systems. In B. Courcelle, editor, Ninth Colloquium on Trees in Algebra and Pro. gramming, pages 181-191, Bordeaux, France, 1984. Cambridge University Press.]]Google ScholarGoogle Scholar
  33. Lév75.Jean-Jacques L6vy. An algebraic interpretation of the ~tflK-cedculus and a labelled A-calculus. In C. BShm, editor, Proc. Syrup. on A-Calculus and Computer Science Theory. Springer-Verlag, 1975. Lecture Notes in Computer Science 37.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Lév78.Jeu-Jacques L~vy. R~duction8 correctes et op. timales dons le lambda-calcul. PhD thesis, Universit~ de Paris VII, 1978. (Th~se d'Etat).]]Google ScholarGoogle Scholar
  35. Lév80.Jeu-Jscques L~vy. Optimal reductions in the lsmbda-calculus. In J.P. Seldin and J.R. Hind- Icy, editors, To H.B. Curry: EsJays on Combi. natory Logic, Lambda Calculus, and Formalism. AceAemic Press, London, 1980.]]Google ScholarGoogle Scholar
  36. Lin87.R.D. Lins. On the efficiency of categorical comblnators as a rewriting system. Sofltoare-- Practice and Experience, 17(8):547-559, August 1987.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Pey87.S.L. Peyton Jones. The Implementation of Functional Programming Languages. Prentice Hall International, Englewood Cliffs, New Jersey, 1987.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Rus87.Michael Rusinowitch. P~th of subterms ordering and recursive decomposition ordering revisited. Y. Symbolic Computation, 3:117-131, 1987.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Sta80a.John Staples. Computation on graph-like expressions. Theoretical Computer Science, 10:171-185, 1980.]]Google ScholarGoogle ScholarCross RefCross Ref
  40. Sta80b.John Staples. Optimal evaluations of graphlike expressions. Theoretical Computer Science, 10:297-316, 1980.]]Google ScholarGoogle ScholarCross RefCross Ref
  41. Sta80c.John Staples. Speeding up subtree replacement systems. Theoretical Computer Science, 11:39- 4~, 1980.]]Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Sta81.John Staples. Efficient combinatory reduction. Zeitschr. !. math. Logik und Grundlagen d. Math., 27:391-402, 1981.]]Google ScholarGoogle Scholar
  43. Sta82.John Staples. Two-level expression representa~ tion for faster evaluation. In Proc. Second International Workshop on Graph Grammars and Their Applications, p~ges 392-404. Springer- Verla8, 1982. Lecture Notes in Computer Science 153.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Tur79.D.A. Turner. A new imptementation technique for applicative lugusges. Software--Practice and Experience, 9:31-49, 1979.]]Google ScholarGoogle ScholarCross RefCross Ref
  45. Wad71.C.P. Wadsworth. Semantics and Pragmatics of the Lambda.Calculus. PhD thesis, Oxford University, 1971.]]Google ScholarGoogle Scholar
  46. Yok89.Hirofumi Yokouchi. Church-rosser theorem for a rewriting system on categorical combinators. Theoretical Computer Science, 65:271- 290, 1989.]] Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. On laziness and optimality in lambda interpreters: tools for specification and analysis

                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
                • Published in

                  cover image ACM Conferences
                  POPL '90: Proceedings of the 17th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
                  December 1989
                  401 pages
                  ISBN:0897913434
                  DOI:10.1145/96709

                  Copyright © 1989 ACM

                  Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

                  Publisher

                  Association for Computing Machinery

                  New York, NY, United States

                  Publication History

                  • Published: 1 December 1989

                  Permissions

                  Request permissions about this article.

                  Request Permissions

                  Check for updates

                  Qualifiers

                  • Article

                  Acceptance Rates

                  Overall Acceptance Rate824of4,130submissions,20%

                  Upcoming Conference

                  POPL '25

                PDF Format

                View or Download as a PDF file.

                PDF

                eReader

                View online with eReader.

                eReader