Abstract
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.
Similar content being viewed by others
References
Abadi, M., Cardelli, L., Curien, P.-L., Levy, J.-J.: Explicit substitutions. J. of Funct. Program. 1(4), 375 – 416 (1991)
Abel, A., Matthes, R., Uustalu, T.: Iteration schemes for higher-order and nested datatypes. Theor. Comput. Sci. 333(1–2), 3–66 (2005)
Aczel, P., Adámek, J., Milius, S., Velebil, J.: Infinite trees and completely iterative theories: A coalgebraic view. Theor. Comput. Sci. 300(1–3), 1–45 (2003)
Adámek, J., Milius, S., Velebil, J.: Free iterative theories: A coalgebraic view. Math. Struct. in Comput. Sci. 13(2), 259–320 (2003)
Adámek, J., Milius, S., Velebil, J.: On rational monads and free iterative theories. In: Blute, R., Selinger, P. (eds.), Proceedings of 9th Conf. on Category Theory and Comput. Sci., CTCS’02,, vol.69 of Electr. Notes in Theor. Comput. Sci., Elsevier (2003)
Adámek, J., Rosický, J.: Locally lowercase Presentable and Accessible Categories, vol. 189 of London Math. Soc. Lecture Note Series. Cambridge Univ. Press, (1994)
Altenkirch, T., Reus, B.: Monadic presentations of lambda terms using generalized inductive types. In: Flum, J., Rodríguez-Artalejo, M. (eds.), Proceedings of 13th Int. Wksh. on Comput. Sci. Logic, CSL’99, vol. 1683 of Lect. Notes in Comput. Sci., Springer-Verlag, pp. 453–468 (1999)
Bird, R., Paterson, R.: De Bruijn notation as a nested datatype. J. of Funct. Program. 9(1), 77–91 (1999)
Bird, R., Paterson, R.: Generalized folds for nested datatypes. Formal Aspects of Comput. 11(2), 200–222 (1999)
Curien, P.-L.: An abstract framework for environment machines. Theor. Comput. Sci. 82(2), 389–402 (1991)
Dubuc, E.J. and Kelly, G.M.: A presentation of topoi as algebraic relative to categories or graphs. J. of Algebra 83, 420–433 (1983)
Fiore, M.: Semantic analysis of normalisation by evaluation for typed lambda calculus. In: Proceedings of 4th Int. ACM SIGPLAN Conf. on Principles and Practice of Declarative Programming, PPDP’02, ACM Press, pp.26–37 (2002)
Fiore, M., Plotkin, G.D., Turi, D.: Abstract syntax and variable binding (extended abstract). In: Proceedings of 14th Ann. IEEE Symp. on Logic in Comput. Sci., LICS’99, IEEE CS Press, pp.193–202 (1999)
Fiore, M., Turi, D.: Semantics of name and value passing. In: Proceedings of 16th Ann. IEEE Symp. on Logic in Comput. Sci., LICS’01, IEEE CS Press, pp.93–104 (2001)
Ghani, N., Lüth, C., deMarchi, F.: Coalgebraic monads. In: Proceedings of 5th Wksh. on Coalgebraic Methods in Comput. Sci., CMCS’02, Moss, L.S. (ed.), vol. 65(1) of Electr. Notes in Theor. Comput. Sci., Elsevier (2002)
Ghani, N., Lüth, C., deMarchi, F., Power, J.: Dualising initial algebras. Math. Struct. in Comput. Sci. 13(2), 349–370 (2003)
Ghani, N., Uustalu, T.: Explicit substitutions and higher-order syntax (extended abstract). In: Honsell, F., Miculan, M., Momigliano, A. (eds.), Proceedings of 2nd ACM SIGPLAN Wksh. on Mechanized Reasoning about Languages with Variable Binding, MERIN 2003, ACM Press (2003)
Hyland, M., Plotkin, G., Power, J.: Combining computational effects: Commutativity and sum. In: Baeza-Yates, A., Montanari, U., Santoro, N. (eds.), Proceedings of IFIP 17th World Computer Congress, TC1 Stream/2nd IFIP Int. Conf. on Theor. Comput. Sci., TCS 2002, vol. 223 of IFIP Conf. Proc., Kluwer Acad. Publishers, pp.474–484 (2002)
Lüth, C., Ghani, N.: Monads and modular term rewriting. In: Moggi, E., Rosolini, G. (eds.), Proceedings of 7th Int. Conf. on Category Theory and Comput. Sci., CTCS’97, vol.1290 of Lect. Notes in Comput. Sci., Springer-Verlag, pp.69–86 (1997)
Lüth, C., Ghani, N.: Composing monads using coproducts. In: Proceedings of 7th ACM SIGPLAN Int. Conf. on Functional Programming, ICFP’02, ACM Press, New York, pp.133–144 (2002) [Also: ACM SIGPLAN Notices, 37(9) (2002), pp.133–144.]
Lüth, C., Ghani, N.: Monads and modularity. In: Armando, A. (ed.), Proceedings of 4th Int. Wksh. on Frontiers of Combining Systems, FroCoS 2002, vol. 2309 of Lect. Notes in Artif. Intell., Springer-Verlag, pp.18–32 (2002)
E.G. Manes. Algebraic Theories, v.26 of Graduate Texts in Math. Springer-Verlag, 1976.
Matthes, R., Uustalu, T.: Substitution in non-wellfounded syntax with variable binding. In H.P. Gumm, ed., Proc. of 6th Int. Wksh. on Coalg. Methods in Comput. Sci., CMCS’03, v.82(4) of Electr. Notes in Theor. Comput. Sci. Elsevier, 2003. Theor. Comput. Sci. 327(1–2), 155–174 (2004)
McCracken, N.J.: The typechecking of programs with implicit type structure. In: Kahn, G., MacQueen, D.B., Plotkin, G. (eds.), Proceedings of Int. Symp. on the Semantics of Data Types, vol.173 of Lect. Notes in Comput. Sci., Springer-Verlag, pp.301–315 (1984)
Miculan, M., Scagnetto, I.: A framework for typed HOAS and semantics. In: Proceedings of 5th Int. ACM SIGPLAN Conf. on Principles and Practice of Declarative Programming, PPDP’03, ACM Press, pp.184–194 (2003)
Milius, S.: On iteratable endofunctors. In: Proceedings of 9th Conf. on Category Theory and Comput. Sci., CTCS’02, Blute, R., Selinger, P. (eds.), v.69 of Electr. Notes in Theor. Comput. Sci., Elsevier (2003)
Moss, L.S.: Parametric corecursion. Theor. Comput. Sci. 260(1–2), 139–163 (2001)
Peyton Jones, S. (ed.) Haskell 98 language and libraries: The revised report. J. of Funct. Program. 13(1), 1–277 (2003)
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Ghani, N., Uustalu, T. & Hamana, M. Explicit substitutions and higher-order syntax. Higher-Order Symb Comput 19, 263–282 (2006). https://doi.org/10.1007/s10990-006-8748-4
Issue Date:
DOI: https://doi.org/10.1007/s10990-006-8748-4