Initial Semantics for higher-order typed syntax in Coq
AbstractInitial Semantics aims at characterizing the syntax associated to a signature as the initial object of some category. We present an initial semantics result for typed higher-order syntax together with its formalization in the Coq proof assistant. The main theorem was first proved on paper in the second author’s PhD thesis in 2010, and verified formally shortly afterwards. To a simply–typed binding signature S over a fixed set T of object types we associate a category called the category of representations of S. We show that this category has an initial object Sigma(S), i.e. an object Sigma(S) from which there is precisely one morphism i_R : Sigma(S) -> R to any object R of this category. From its construction it will be clear that the object Sigma(S) merits the name abstract syntax associated to S: it is given by an inductive set – parametrized by a set of free variables and dependent on object types – the type of whose constructors are each given by the arities of the signature S. Our theorem is implemented and proved correct in the proof assistant Coq through heavy use of dependent types. The approach through monads gives rise to an implementation of syntax where both terms and variables are intrinsically typed, i.e. where the object types are rejected in the meta–level types. Terms are implemented as a Coq data type – which play the role of sets – dependent on an object type as well as on a type family of free variables. This article is to be seen as a research article rather than about the formalization of a classical mathematical result. The nature of our theorem – involving lengthy, technical proofs and complicated algebraic structures – makes it particularly interesting for formal verification. Our goal is to promote the use of computer theorem provers as research tools, and, accordingly, a new way of publishing mathematical results: a parallel description of a theorem and its formalization should allow the verification of correct transcription of definitions and statements into the proof assistant, and straightforward but technical proofs should be well–hidden in a digital library. We argue that Coq’s rich type theory, combined with its various features such as implicit arguments, allows a particularly readable formalization and is hence well–suited for communicating mathematics.
How to Cite
Ahrens, B., & Zsido, J. (2011). Initial Semantics for higher-order typed syntax in Coq. Journal of Formalized Reasoning, 4(1), 25-69. https://doi.org/10.6092/issn.1972-5787/2066
Copyright (c) 2011 Benedikt Ahrens, Julianna Zsido
Copyrights and publishing rights of all the texts on this journal belong to the respective authors without restrictions.