Explicit substitutions and higher-order syntax

Recently there has been a great deal of interest in higher-order syntax which seeks to extend standard initial algebra semantics to cover languages with variable binding. The canonical example studied in the literature is that of the untyped λ-calculus which is handled as an instance of the general theory of binding algebras, cf. Fiore et al. [13].Another important syntactic construction is that of explicit substitutions which are used to model local definitions and to implement reduction in the λ-calculus. The syntax of a language with explicit substitutions does not form a binding algebra as an explicit substitution may bind an arbitrary number of variables. Thus explicit substitutions are a natural test case for the further development of the theory and applications of syntax with variable binding.This paper shows that a language containing explicit substitutions and a first-order signature Σ is naturally modelled as the initial algebra of the Id + FΣ∘_ +_ ∘ _ endofunctor. We derive a similar formula for adding explicit substitutions to the untyped λ-calculus and then show these initial algebras provide useful datatypes for manipulating abstract syntax by implementing two reduction machines. We also comment on the apparent lack of modularity in syntax with variable binding as compared to first-order languages.

[1]  S. Lane Categories for the Working Mathematician , 1971 .

[2]  Martín Abadi,et al.  Explicit substitutions , 1989, POPL '90.

[3]  Pierre-Louis Curien,et al.  An Abstract Framework for Environment Machines , 1991, Theor. Comput. Sci..

[4]  Christoph Lüth,et al.  Dualising Initial Algebras , 2003, Math. Struct. Comput. Sci..

[5]  Gordon D. Plotkin,et al.  Combining Computational Effects: commutativity & sum , 2002, IFIP TCS.

[6]  Richard S. Bird,et al.  Generalised folds for nested datatypes , 1999, Formal Aspects of Computing.

[7]  Ralph Matthes,et al.  Substitution in Non-wellfounded Syntax with Variable Binding , 2003, CMCS.

[8]  Richard S. Bird,et al.  de Bruijn notation as a nested datatype , 1999, Journal of Functional Programming.

[9]  Peyton Jones,et al.  Haskell 98 language and libraries : the revised report , 2003 .

[10]  Stefan Milius On Iteratable Endofunctors , 2002, CTCS.

[11]  Lawrence S. Moss Parametric corecursion , 2001, Theor. Comput. Sci..

[12]  Marino Miculan,et al.  A framework for typed HOAS and semantics , 2003, PPDP '03.

[13]  H.-J. Hoehnke,et al.  Manes, E. G., Algebraic Theories, Berlin‐Heidelberg‐New York. Springer‐Verlag. 1976. IX, 356 S., DM 55,70. US $ 22.20. (Graduate Texts in Mathematics 26) , 1978 .

[14]  Christoph Lüth,et al.  Monads and Modular Term Rewriting , 1997, Category Theory and Computer Science.

[15]  Daniele Turi,et al.  Abstract Syntax and Variable Binding (Extended Abstract) , 2003 .

[16]  Peter Aczel,et al.  Infinite trees and completely iterative theories: a coalgebraic view , 2003, Theor. Comput. Sci..

[17]  Thorsten Altenkirch,et al.  Monadic Presentations of Lambda Terms Using Generalized Inductive Types , 1999, CSL.

[18]  G. M. Kelly,et al.  A presentation of topoi as algebraic relative to categories or graphs , 1983 .

[19]  Ralph Matthes,et al.  Iteration and coiteration schemes for higher-order and nested datatypes , 2005, Theor. Comput. Sci..

[20]  Jirí Adámek,et al.  Free iterative theories: a coalgebraic view , 2003, Mathematical Structures in Computer Science.

[21]  Christoph Lüth,et al.  Monads and Modularity , 2002, FroCoS.

[22]  Daniele Turi,et al.  Semantics of name and value passing , 2001, Proceedings 16th Annual IEEE Symposium on Logic in Computer Science.

[23]  Jirí Adámek,et al.  On Rational Monads and Free Iterative Theories , 2002, CTCS.

[24]  Gordon D. Plotkin,et al.  Abstract syntax and variable binding , 1999, Proceedings. 14th Symposium on Logic in Computer Science (Cat. No. PR00158).

[25]  Nancy McCracken,et al.  The Typechecking of Programs with Implicit Type Structure , 1984, Semantics of Data Types.

[26]  Marcelo P. Fiore,et al.  Semantic analysis of normalisation by evaluation for typed lambda calculus , 2002, PPDP '02.

[27]  Tarmo Uustalu,et al.  Explicit substitutions and higher-order syntax , 2003, MERLIN '03.

[28]  Christoph Lüth,et al.  Composing monads using coproducts , 2002, ICFP '02.