Structured Monads for Generic First-Order Syntax Metatheory
Open Access
- 11 August 2025
- journal article
- research article
- Published by Springer Nature in Journal of Automated Reasoning
- Vol. 69 (3) , 1-41
Abstract
Reasoning about substitution remains one of the most tedious and error-prone aspects of formal metatheory. We present Tealeaves, a framework implemented in Coq for developing such infrastructure generically and modularly. Tealeaves is centered on a novel categorical abstraction, decorated traversable monads (DTMs), which provide a unifying foundation for first-order syntax and enable local, compositional reasoning about syntactic operations, such as substitution, that are defined purely by their effect on individual variable occurrences. Within this framework, Tealeaves supports extensible backend modules, each implementing the metatheory of a specific concrete strategy for representing binders. Our current backends include implementations of de Bruijn indices in the style of Autosubst, as well as locally nameless in the style of LNgen. Tealeaves goes further by providing a certified translation between these representations, illustrating how DTMs reconcile their underlying structures. The framework also accommodates challenging features such as variadic and mutually-recursive binders, which are often overlooked by both theoretical treatments and practical tools. We describe the implementation and use of Tealeaves’ backends in formalized language developments, introduce the equational axioms that characterize DTMs, and conclude with a presentation of those axioms instantiated for the lambda calculus extended with a variadic binding constructor.Keywords
This publication has 43 references indexed in Scilit:
- Variable binding and substitution for (nameless) dummies2022
- Autosubst: Reasoning with de Bruijn Terms and Parallel Substitutions2015
- Constructing Applicative FunctorsLecture Notes in Computer Science, 2012
- GMeta: A Generic Formal Metatheory Framework for First-Order Representations2012
- First-Class Type Classes2008
- Nominal Techniques in Isabelle/HOL2005
- Mechanized Metatheory for the Masses: The PoplMark Challenge2005
- A Tactic Language for the System Coq2002
- Monadic Presentations of Lambda Terms Using Generalized Inductive Types1999
- Shapely types and shape polymorphism1994