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.
- 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 Scholar
- 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 Scholar
- 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 Scholar
- Aug84.L. Augustsson. A compiler for Luy ML. In Proc. A CM Svrnp. on Lisp and Functional Programming, Austin, 1984.]] Google ScholarDigital Library
- Bar84.H.P. Barendregt. The Lombda Calculus, volume 103 of Studies in Logic and the Foundations of Mathematics. North-Holland, Amsterdam, 1984.]]Google Scholar
- 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 Scholar
- 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 ScholarDigital Library
- CCM87.G. Cousineau, P.-L. Curien, and M. Mauny. The categorical abstract machine. Science of Computer Programming, 8-1"/'3-202, 1987.]] Google ScholarDigital Library
- Chu41.A. Church. The Calculi of Lambda Conversion. Princeton University Press, Princeton, NJ, 1941.]] Google ScholarDigital Library
- Cur86a.P.-L. Curien. Categorical eombinators. {afar. motion and Control, 69:188-254, 1986.]] Google ScholarDigital Library
- Cur86b.P.-L. Curien. Categorical Combinators, Sequential Algorithms, and Functional Programming. Research Notes in Theoretical Computer Science. Pitman, London, 1986.]] Google ScholarDigital Library
- 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 Scholar
- 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 Scholar
- 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 Scholar
- Der87.Nachum Dershowitz. Termination of rewriting. J. SFmbolic Computation, 3:69-116, 1987.]] Google ScholarDigital Library
- FH88.Anthony J. Field and Peter G. Harrison. Func. tional Programming. Addison-Wesley, Wakingham, England, 1988.]]Google Scholar
- 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 ScholarDigital Library
- 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 Scholar
- 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 ScholarDigital Library
- 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 Scholar
- 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 ScholarDigital Library
- 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 Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- Hug84.R.J.M. Hughes. The Design and Implements. tion of Programming Languages. PhD thesis, Oxford University, September 1984. (PRG-40).]]Google Scholar
- Joh84.T. Johnsson. E~_cient compilation of lazy evaluation. In Proc. A CM Cony. on Compiler Con. struction, Montreal, 1984.]] Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- Klo80.J.W. Klop. Combinatory Reduction Systems, volume 127 of Mathematical Centre Tracts. Mathematical Centre, Kruislaan 413, Amsterdam 1098SJ, The Netherlands, 1980.]]Google Scholar
- 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 ScholarDigital Library
- Lan64.P.J. Laadin. The mechanical evaluation of expressions. Computer Journal, 6:308-320, 1964.]]Google ScholarCross Ref
- 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 Scholar
- 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 ScholarDigital Library
- 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 Scholar
- 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 Scholar
- 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 ScholarDigital Library
- Pey87.S.L. Peyton Jones. The Implementation of Functional Programming Languages. Prentice Hall International, Englewood Cliffs, New Jersey, 1987.]] Google ScholarDigital Library
- Rus87.Michael Rusinowitch. P~th of subterms ordering and recursive decomposition ordering revisited. Y. Symbolic Computation, 3:117-131, 1987.]] Google ScholarDigital Library
- Sta80a.John Staples. Computation on graph-like expressions. Theoretical Computer Science, 10:171-185, 1980.]]Google ScholarCross Ref
- Sta80b.John Staples. Optimal evaluations of graphlike expressions. Theoretical Computer Science, 10:297-316, 1980.]]Google ScholarCross Ref
- Sta80c.John Staples. Speeding up subtree replacement systems. Theoretical Computer Science, 11:39- 4~, 1980.]]Google ScholarDigital Library
- Sta81.John Staples. Efficient combinatory reduction. Zeitschr. !. math. Logik und Grundlagen d. Math., 27:391-402, 1981.]]Google Scholar
- 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 ScholarDigital Library
- Tur79.D.A. Turner. A new imptementation technique for applicative lugusges. Software--Practice and Experience, 9:31-49, 1979.]]Google ScholarCross Ref
- Wad71.C.P. Wadsworth. Semantics and Pragmatics of the Lambda.Calculus. PhD thesis, Oxford University, 1971.]]Google Scholar
- Yok89.Hirofumi Yokouchi. Church-rosser theorem for a rewriting system on categorical combinators. Theoretical Computer Science, 65:271- 290, 1989.]] Google ScholarDigital Library
Index Terms
- On laziness and optimality in lambda interpreters: tools for specification and analysis
Recommendations
Complete Laziness: a Natural Semantics
Lazy evaluation (or call-by-need) is widely used and well understood, partly thanks to a clear operational semantics given by Launchbury. However, modern non-strict functional languages do not use plain call-by-need evaluation: they also use ...
Defunctionalized interpreters for programming languages
ICFP '08This document illustrates how functional implementations of formal semantics (structural operational semantics, reduction semantics, small-step and big-step abstract machines, natural semantics, and denotational semantics) can be transformed into each ...
Defunctionalized interpreters for programming languages
ICFP '08: Proceedings of the 13th ACM SIGPLAN international conference on Functional programmingThis document illustrates how functional implementations of formal semantics (structural operational semantics, reduction semantics, small-step and big-step abstract machines, natural semantics, and denotational semantics) can be transformed into each ...
Comments