Bottom-Up β-Reduction: Uplinks and λ-DAGs

  • Olin Shivers
  • Mitchell Wand
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3444)


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.


  1. 1.
    Asperti, A., Guerrini, S.: The Optimal Implementation of Functional Programming Languages. Cambridge University Press, Cambridge (1999)Google Scholar
  2. 2.
    Barendregt, H.: The Lambda Calculus, revised edition. North Holland, Amsterdam (1984)Google Scholar
  3. 3.
    Bawden, A.: Personal communication (November 2002); Alan wrote the compiler, a toy exercise for Scheme, sometime in the late 1980’s Google Scholar
  4. 4.
    Bourbaki, N.: Théorie des ensembles. Hermann & C. Editeurs (1954)Google Scholar
  5. 5.
    Church, A.: The Calculi of Lambda Conversion. Princeton University Press, Princeton (1941)Google Scholar
  6. 6.
    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)Google Scholar
  7. 7.
    Kennaway, J.R., Sleep, M.R.: Director strings as combinators. ACM Transactions on Programming Languages and Systems 10, 602–626 (1988)MATHCrossRefGoogle Scholar
  8. 8.
    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)Google Scholar
  9. 9.
    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)Google Scholar
  10. 10.
    Lévy, J.-J.: Réductions Correctes et Optimales dans le Lambda-calcul. Ph.D. thesis, Université Paris VII (1978)Google Scholar
  11. 11.
    Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML (Revised). MIT Press, Cambridge (1997)Google Scholar
  12. 12.
    Nadathur, G., Wilson, D.S.: A notation for lambda terms: A generalization of environments. Theoretical Computer Science 198(1–2), 49–98 (1998)MATHCrossRefMathSciNetGoogle Scholar
  13. 13.
    Peyton Jones, S.L.: The Implementation of Functional Programming Languages. Prentice-Hall, Englewood Cliffs (1987)MATHGoogle Scholar
  14. 14.
    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)Google Scholar
  15. 15.
    Wadsworth, C.P.: Semantics and pragmatics of the lambda-calculus. PhD dissertation, Oxford University (1971)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Olin Shivers
    • 1
  • Mitchell Wand
    • 2
  1. 1.Georgia Institute of Technology 
  2. 2.Northeastern University 

Personalised recommendations