Skip to main content Accessibility help

Modules over relative monads for syntax and semantics


We give an algebraic characterization of the syntax and semantics of a class of untyped functional programming languages.

To this end, we introduce a notion of 2-signature: such a signature specifies not only the terms of a language, but also reduction rules on those terms. To any 2-signature (S, A) we associate a category of ‘models’. We then prove that this category has an initial object, which integrates the terms freely generated by S, and which is equipped with reductions according to the rules given in A. We call this initial object the programming language generated by (S, A). Models of a 2-signature are built from relative monads and modules over such monads. Through the use of monads, the models – and in particular, the initial model – come equipped with a substitution operation that is compatible with reduction in a suitable sense.

The initiality theorem is formalized in the proof assistant Coq, yielding a machinery which, when fed with a 2-signature, provides the associated programming language with reduction relation and certified substitution.

Hide All
Ahrens, B. (2012) Extended initiality for typed abstract syntax. Logical Methods in Computer Science 8.2 135. (doi: 10.2168/LMCS-8(2:1)2012.)
Ahrens, B. and Zsidó, J. (2011) Initial semantics for higher–order typed syntax in Coq. Journal of Formalized Reasoning 4.1 2569.
Altenkirch, T. and Reus, B. (1999) Monadic presentations of lambda terms using generalized inductive types. In: Computer Science Logic, 13th International Workshop, CSL '99 453–468.
Altenkirch, T. et al. (2010) Monads need not be endofunctors. In: Luke Ong, C.-H. (ed.) FOSSACS. Springer Lecture Notes in Computer Science 6014 297311. ISBN: 978-3-642-12031-2.
Barendregt, H. and Barendsen, E. (1994) Introduction to lambda calculus. Available at: revised 2000.
Bird, R. S. and Meertens, L. (1998) Nested datatypes. In: Jeuring, J. (ed.) Proceedings of Mathematics of Program Construction. Springer Lecture Notes in Computer Science 1422 5267.
Coq (2010) The coq proof assistant. Available at: URL:
Fernández, M. and Gabbay, M. J. (2007) Nominal rewriting. Information and Computation 205.6 917965. doi: 10.1016/j.ic.2006.12.002.
Fiore, M. (2002) Semantic analysis of normalisation by evaluation for typed lambda calculus. In: Proceedings of the 4th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming. PPDP'02, Pittsburgh, PA, USA: ACM 26–37. ISBN: 1-58113-528-9. doi:
Fiore, M. (2005) Mathematical models of computational and combinatorial structures. In: Sassone, V. (ed.) FoSSaCS. Springer Lecture Notes in Computer Science 3441 2546. ISBN: 3-540-25388-2.
Fiore, M. and Hur, C.-K. (2007) Equational systems and free constructions (extended abstract). In: Arge, L. et al. (ed.) ICALP. Springer Lecture Notes in Computer Science 4596 607618. ISBN: 978-3-540-73419-2.
Fiore, M. et al. (1999) Abstract syntax and variable binding. In: Proceedings of the 14th Annual IEEE Symposium on Logic in Computer Science. LICS '99, Washington, DC, USA: IEEE Computer Society 193–202. ISBN: 0-7695-0158-3.
Gabbay, M. and Pitts, A. (1999) A new approach to abstract syntax involving binders. In: Proceedings of the 14th Annual IEEE Symposium on Logic in Computer Science. LICS '99, Washington, DC, USA: IEEE Computer Society 214–224. ISBN: 0-7695-0158-3.
Gabbay, M. J. and Pitts, A. M. (2001) A new approach to abstract syntax with variable binding. Formal Aspects of Computing 13.3–5 341363. doi:
Ghani, N. and Lüth, C. (2003) Rewriting via coinserters. Nordic Journal of Computing 10.4 290312.
Hirschowitz, A. and Maggesi, M. (2007a) Modules over monads and linearity. In: Leivant, D. and de Queiroz, R. J. G. B. (eds.) WoLLIC. Springer Lecture Notes in Computer Science 4576 218237. ISBN: 978-3-540-73443-7.
Hirschowitz, A. and Maggesi, M. (2007b) The algebraicity of the lambda-calculus. In: CoRR abs/0704.2900. Available at
Hirschowitz, A. and Maggesi, M. (2010) Modules over monads and initial semantics. Information and Computation 208.5 545564.
Hirschowitz, T. (2013) Cartesian closed 2-categories and permutation equivalence in higher-order rewriting. Logical Methods in Computer Science 9 (3). Available at:
Hofmann, M. (1999) Semantical analysis of higher-order syntax. In: 14th Annual Symposium on Logic in Computer Science, IEEE Computer Society Press 204213.
Hur, C.-K. (2010) Categorical Equational Systems: Algebraic Models and Equational Reasoning, Ph.D. thesis, University of Cambridge, UK.
Mac Lane, S. (1998) Categories for the Working Mathematician, Second. Graduate Texts in Mathematics volume 5, New York: Springer-Verlag xii+314. ISBN: 0-387-98403-8.
Miculan, M. and Scagnetto, I. (2003) A framework for typed HOAS and semantics. In: Principles and Practice of Declarative Programming, ACM 184194. ISBN: 1-58113-705-2.
Pitts, A. M. (2003) Nominal logic, a first order theory of names and binding. Information and Computation 186 165193.
Power, J. (2007) Abstract syntax: Substitution and binders. Electronic Notes in Theoretical Computer Science 173 316. ISSN: . doi: 10.1016/j.entcs.2007.02.024.
Tanaka, M. and Power, J. (2005) A unified category-theoretic formulation of typed binding signatures. In: Proceedings of the 3rd ACM SIGPLAN Workshop on Mechanized Reasoning about Languages with Variable Binding. MERLIN '05, Tallinn, Estonia: ACM, 1324. ISBN: 1-59593-072-8. doi:
Zsidó, J. (2010) Typed abstract syntax. Available at Ph.D. thesis, University of Nice, France.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Mathematical Structures in Computer Science
  • ISSN: 0960-1295
  • EISSN: 1469-8072
  • URL: /core/journals/mathematical-structures-in-computer-science
Please enter your name
Please enter a valid email address
Who would you like to send this to? *


Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed