A type- and scope-safe universe of syntaxes with binding: their semantics and proofs
- 19 October 2021
- journal article
- research article
- Published by Cambridge University Press (CUP) in Journal of Functional Programming
- Vol. 31
Abstract
The syntax of almost every programming language includes a notion of binder and corresponding bound occurrences, along with the accompanying notions of α-equivalence, capture-avoiding substitution, typing contexts, runtime environments, and so on. In the past, implementing and reasoning about programming languages required careful handling to maintain the correct behaviour of bound variables. Modern programming languages include features that enable constraints like scope safety to be expressed in types. Nevertheless, the programmer is still forced to write the same boilerplate over again for each new implementation of a scope-safe operation (e.g., renaming, substitution, desugaring, printing), and then again for correctness proofs. We present an expressive universe of syntaxes with binding and demonstrate how to (1) implement scope-safe traversals once and for all by generic programming; and (2) how to derive properties of these traversals by generic proving. Our universe description, generic traversals and proofs, and our examples have all been formalised in Agda and are available in the accompanying material available online at https://github.com/gallais/generic-syntax .Keywords
All Related Versions
This publication has 69 references indexed in Scilit:
- MiniAgda: Integrating Sized and Dependent TypesElectronic Proceedings in Theoretical Computer Science, 2010
- The essence of the Iterator patternJournal of Functional Programming, 2009
- Program extraction from normalization proofs2005
- Local type inferenceACM Transactions on Programming Languages and Systems, 2000
- A coherence theorem for Martin-Löf's type theoryJournal of Functional Programming, 1998
- Shrinking lambda expressions in linear timeJournal of Functional Programming, 1997
- Inductive familiesFormal Aspects of Computing, 1994
- A term calculus for Intuitionistic Linear Logic1993
- Data structures and program transformationScience of Computer Programming, 1990
- Deforestation: transforming programs to eliminate treesTheoretical Computer Science, 1990