Abstract
Representing a λ term as a DAG rather than a tree allows us to represent the sharing that arises from β, thus avoiding combinatorial explosion in space. By adding uplinks from a child to its parents, we can efficiently implement β in a bottom-up manner, thus avoiding combinatorial explosion in time required to search the term in a top-down fashion. We present an algorithm for performing β onλ-terms represented as uplinked DAGs; discuss its relation to alternate techniques such as Lamping graphs, explicit-substitution calculi and director strings; and present some timings of an implementation. Besides being both fast and parsimonious of space, the algorithm is particularly suited to applications such as compilers, theorem provers, and type-manipulation systems that may need to examine terms in-between reductions—i.e., the “readback” problem for our representation is trivial. Like Lamping graphs, and unlike director strings or the suspension λ, the algorithm functions by side-effecting the term containing the redex; the representation is not a “persistent” one. The algorithm additionally has the charm of being quite simple: a complete implementation of the core data structures and algorithms is 180 lines of SML.
Chapter PDF
References
Asperti, A., Guerrini, S.: The Optimal Implementation of Functional Programming Languages. Cambridge University Press, Cambridge (1999)
Barendregt, H.: The Lambda Calculus, revised edition. North Holland, Amsterdam (1984)
Bawden, A.: Personal communication (November 2002); Alan wrote the compiler, a toy exercise for Scheme, sometime in the late 1980’s
Bourbaki, N.: Théorie des ensembles. Hermann & C. Editeurs (1954)
Church, A.: The Calculi of Lambda Conversion. Princeton University Press, Princeton (1941)
Gonthier, G., Abadi, M., Lévy, J.-J.: The geometry of optimal lambda reduction. In: Conference Record of the Nineteenth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, January 1992, pp. 15–26 (1992)
Kennaway, J.R., Sleep, M.R.: Director strings as combinators. ACM Transactions on Programming Languages and Systems 10, 602–626 (1988)
Kelsey, R.A.: A correspondence between continuation-passing style and static single assignment form. In: ACM SIGPLAN Workshop on Intermediate Representations, SIGPLAN Notices, January 1995, vol. 30(3), pp. 13–22 (1995)
Lamping, J.: An algorithm for optimal lambda-calculus reduction. In: Proceedings of the Seventeenth Annual ACM Symposium on Principles of Programming Languages, January 1990, pp. 16–30 (1990)
Lévy, J.-J.: Réductions Correctes et Optimales dans le Lambda-calcul. Ph.D. thesis, Université Paris VII (1978)
Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML (Revised). MIT Press, Cambridge (1997)
Nadathur, G., Wilson, D.S.: A notation for lambda terms: A generalization of environments. Theoretical Computer Science 198(1–2), 49–98 (1998)
Peyton Jones, S.L.: The Implementation of Functional Programming Languages. Prentice-Hall, Englewood Cliffs (1987)
Shao, Z., League, C., Monnier, S.: Implementing typed intermediate languages. In: Proceedings of the 1998 ACM SIGPLAN International Conference on Functional Programming Languages (September 1998)
Wadsworth, C.P.: Semantics and pragmatics of the lambda-calculus. PhD dissertation, Oxford University (1971)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2005 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Shivers, O., Wand, M. (2005). Bottom-Up β-Reduction: Uplinks and λ-DAGs. In: Sagiv, M. (eds) Programming Languages and Systems. ESOP 2005. Lecture Notes in Computer Science, vol 3444. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-31987-0_16
Download citation
DOI: https://doi.org/10.1007/978-3-540-31987-0_16
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-25435-5
Online ISBN: 978-3-540-31987-0
eBook Packages: Computer ScienceComputer Science (R0)