skip to main content
research-article

Three syntactic theories for combinatory graph reduction

Published: 28 November 2013 Publication History

Abstract

We present a purely syntactic theory of graph reduction for the canonical combinators S, K, and I, where graph vertices are represented with evaluation contexts and let expressions. We express this first syntactic theory as a storeless reduction semantics of combinatory terms. We then factor out the introduction of let expressions to denote as many graph vertices as possible upfront instead of on demand. The factored terms can be interpreted as term graphs in the sense of Barendregt et al. We express this second syntactic theory, which we prove equivalent to the first, as a storeless reduction semantics of combinatory term graphs. We then recast let bindings as bindings in a global store, thus shifting, in Strachey's words, from denotable entities to storable entities. The store-based terms can still be interpreted as term graphs. We express this third syntactic theory, which we prove equivalent to the second, as a store-based reduction semantics of combinatory term graphs. We then refocus this store-based reduction semantics into a store-based abstract machine. The architecture of this store-based abstract machine coincides with that of Turner's original reduction machine. The three syntactic theories presented here therefore properly account for combinatory graph reduction As We Know It.
These three syntactic theories scale to handling the Y combinator. This article therefore illustrates the scientific consensus of theoreticians and implementors about graph reduction: it is the same combinatory elephant.

References

[1]
Ager, M. S., Biernacki, D., Danvy, O., and Midtgaard, J. 2003. A functional correspondence between evaluators and abstract machines. In Proceedings of the 5th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP'03). D. Miller, Ed., ACM Press, New York, 8--19.
[2]
Ariola, Z. M. and Arvind. 1995. Properties of a first-order functional language with sharing. Theor. Comput. Sci. 146, 1--2, 69--108.
[3]
Ariola, Z. M. and Felleisen, M. 1997. The call-by-need lambda calculus. J. Funct. Program. 7, 3, 265--301.
[4]
Ariola, Z. M., Felleisen, M., Maraist, J., Odersky, M., and Wadler, P. 1995. A call-by-need lambda calculus. In Proceedings of the 22nd Annual ACM Symposium on Principles of Programming Languages, P. Lee, Ed., ACM Press, New York, 233--246.
[5]
Ariola, Z. M. and Klop, J. W. 1996. Equational term graph rewriting. Fundamenta Informaticae 26, 3--4, 207--240.
[6]
Barendregt, H. 1984. The Lambda Calculus: Its Syntax and Semantics Revised Ed. Studies in Logic and the Foundation of Mathematics Series, vol. 103. North-Holland.
[7]
Barendregt, H. P., Van Eekelen, M. C. J. D., Glauert, J. R. W., Kennaway, R., Plasmeijer, M. J., and Sleep, M. R. 1987. Term graph rewriting. In PARLE, Parallel Architectures and Languages Europe, Volume II: Parallel Languages, J. de Bakker, A. J. Nijman, and P. C. Treleaven, Eds., Lecture Notes in Computer Science, vol. 259, Springer, 141--158.
[8]
Biernacka, M., Danvy, O., and Blom, S. 2001. Term graph rewriting -- Syntax and semantics. Ph.D. thesis, Institute for Programming Research and Algorithmics, Vrije Universiteit, Amsterdam, The Netherlands.
[9]
Bondorf, A. and Danvy, O. 1991. Automatic autoprojection of recursive equations with global variables and abstract data types. Sci. Comput. Program. 16, 151--195.
[10]
Chang, S., Horn, D. V., and Felleisen, M. 2011. Evaluating call by need on the control stack. In Proceedings of the 11th International Conference on Trends in Functional Programming. R. Page, Z. Horvath, and V. Zsok, Eds., Lecture Notes in Computer Science, vol. 6546, Springer, 1--15.
[11]
Curry, H. B. 1933. Apparent variables from the standpoint of combinatory logic. Ann. Math. 34, 381--404.
[12]
Danvy, O. 2008a. Defunctionalized interpreters for programming languages. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming (ICFP'08). J. Hook and P. Thiemann, Eds., ACM Press, New York, 131--142.
[13]
Danvy, O. 2008b. From reduction-based to reduction-free normalization. In Proceedings of the 6th International Conference on Advanced Functional Programming (AFP'08). P. Koopman, R. Plasmeijer, and D. Swierstra, Eds., Lecture Notes in Computer Science, vol. 5382, Springer, 66--164.
[14]
Danvy, O. and Millikin, K. 2008. On the equivalence between small-step and bigstep abstract machines: a simple application of lightweight fusion. Inf. Process. Lett. 106, 3, 100--109.
[15]
Danvy, O., Millikin, K., Munk, J., and Zerny, I. 2010. Defunctionalized interpreters for call-by-need evaluation. In Proceedings of the 10th International Symposium on Functional and Logic Programming (FLOPS'10). M. Blume and G. Vidal, Eds., Lecture Notes in Computer Science, vol. 6009, Springer, 240--256.
[16]
Danvy, O., Millikin, K., Munk, J., and Zerny, I. 2012. On inter-deriving smallstep and big-step semantics: A case study for storeless call-by-need evaluation. Theor. Comput. Sci. 435, 21--42.
[17]
Danvy, O. and Nielsen, L. R. 2001. Defunctionalization at work. In Proceedings of the 3rd International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP'01). H. Søndergaard, Ed., ACM Press, New York, 162--174.
[18]
Danvy, O. and Nielsen, L. R. 2004. Refocusing in reduction semantics. Res. rep. BRICS RS-04-26, Department of Computer Science, Aarhus University, Aarhus, Denmark. http://www.brics.dk/RS/04/26/BRICS-RS-04-26.pdf.
[19]
Danvy, O. and Schultz, U. P. 2004. Lambda-lifting in quadratic time. J. Funct. Logic Program. 2004, 1. http://danae.uni-muenster.de/lehre/kuchen/JFLP/.
[20]
Garcia, R., Lumsdaine, A., and Sabry, A. 2010. Lazy evaluation and delimited control. Logical Methods Comput. Sci. 6, 3:1, 1--39.
[21]
Glauert, J. R. W., Kennaway, R., and Sleep, M. R. 1990. Dactl: An experimental graph rewriting language. In Proceedings of the 4th International Workshop on Graph-Grammars and Their Application to Computer Science. H. Ehrig, H.-J. Kreowski, and G. Rozenberg, Eds., Lecture Notes in Computer Science Series, vol. 532, Springer, New York, 378--395.
[22]
Hatcliff, J. and Danvy, O. 1994. A generic account of continuation-passing styles. In Proceedings of the 21st Annual ACM Symposium on Principles of Programming Languages. H.-J. Boehm, Ed., ACM Press, New York, 458--471.
[23]
Hatcliff, J. and Danvy, O. 1997. A computational formalization for partial evaluation. Math. Struct. Comput. Sci. 7, 5, 507--541.
[24]
Jeffrey, A. 1994. A fully abstract semantics for concurrent graph reduction. In Proceedings of the 9th IEEE Symposium on Logic in Computer Science. IEEE Computer Society Press, Los Alamitos, CA, 82--91.
[25]
Johnsson, T. 1985. Lambda lifting: Transforming programs to recursive equations. In Functional Programming Languages and Computer Architecture. J.-P. Jouannaud, Ed., Lecture Notes in Computer Science, vol. 201, Springer, 190--203.
[26]
Klop, J. W. 1980. Combinatory reduction systems. Mathematical Centre Tracts, vol. 127, Mathematisch Centrum, Amsterdam.
[27]
Koopman, P. W. M. 1990. Functional programs as executable specifications. Ph.D. thesis, University of Nijmegen, Nijmegen, The Netherlands.
[28]
Maraist, J., Odersky, M., and Wadler, P. 1998. The call-by-need lambda calculus. J. Funct. Program. 8, 3, 275--317.
[29]
Nakata, K. and Hasegawa, M. 2009. Small-step and big-step semantics for call-byneed. J. Funct. Program. 19, 6, 699--722.
[30]
Peyton Jones, S. L. 1987. The Implementation of Functional Programming Languages. Prentice Hall International Series in Computer Science. Prentice-Hall International.
[31]
Plasmeijer, M. J. and Van Eekelen, M. C. J. D. 1993. Functional Programming and Parallel Graph Rewriting. Addison-Wesley.
[32]
Plotkin, G. D. 1981. A structural approach to operational semantics. Tech. rep. FN-19, Department of Computer Science, Aarhus University, Aarhus, Denmark.
[33]
Plotkin, G. D. 2004. The origins of structural operational semantics. J. Logic Algebraic Program. 60--61, 3--15.
[34]
Robinet, B. 1974. Contribution à l'étude de réalités informatiques. Thèse d'état, Université Pierre et Marie Curie (Paris VI), Paris, France.
[35]
Robinson, J. A. 1969. A note on mechanizing higher order logic. InMachine Intelligence, vol. 5, B. Meltzer and D. Michie, Eds., Edinburgh University Press, 123--133.
[36]
Turner, D. A. 1979. A new implementation technique for applicative languages. Softw. Pract. Exper. 9, 1, 31--49.
[37]
Zerny, I. 2009. On graph rewriting, reduction and evaluation. In Trends in Functional Programming, vol. 10, Z. Horvath, V. Zsok, P. Achten, and P. Koopman, Eds., Intellect Books, Komarno, Slovakia, 81--112.

Cited By

View all
  • (2023)Graph IRs for Impure Higher-Order Languages: Making Aggressive Optimizations Affordable with Precise Effect DependenciesProceedings of the ACM on Programming Languages10.1145/36228137:OOPSLA2(400-430)Online publication date: 16-Oct-2023

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Computational Logic
ACM Transactions on Computational Logic  Volume 14, Issue 4
November 2013
282 pages
ISSN:1529-3785
EISSN:1557-945X
DOI:10.1145/2555591
Issue’s Table of Contents
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: 28 November 2013
Accepted: 01 August 2011
Revised: 01 July 2011
Received: 01 February 2011
Published in TOCL Volume 14, Issue 4

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. CPS transformation
  2. Continuation-Passing style (CPS)
  3. Reduction-based normalization
  4. abstract machines
  5. continuations
  6. defunctionalization
  7. evaluation contexts
  8. reduction contexts
  9. reduction semantics
  10. reduction-free normalization
  11. refocusing
  12. refunctionalization

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)5
  • Downloads (Last 6 weeks)0
Reflects downloads up to 28 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2023)Graph IRs for Impure Higher-Order Languages: Making Aggressive Optimizations Affordable with Precise Effect DependenciesProceedings of the ACM on Programming Languages10.1145/36228137:OOPSLA2(400-430)Online publication date: 16-Oct-2023

View Options

Login options

Full Access

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media