## Foundational, Compositional (Co)datatypes for Higher-Order Logic -- Category Theory Applied to Theorem Proving

### Cached

### Download Links

Citations: | 8 - 4 self |

### BibTeX

@MISC{Traytel_foundational,compositional,

author = {Dmitriy Traytel and Andrei Popescu and Jasmin Christian Blanchette},

title = {Foundational, Compositional (Co)datatypes for Higher-Order Logic -- Category Theory Applied to Theorem Proving},

year = {}

}

### OpenURL

### Abstract

Higher-order logic (HOL) forms the basis of several popular interactive theorem provers. These follow the definitional approach, reducing high-level specifications to logical primitives. This also applies to the support for datatype definitions. However, the internal datatype construction used in HOL4, HOL Light, and Isabelle/HOL is fundamentally noncompositional, limiting its efficiency and flexibility, and it does not cater for codatatypes. We present a fully modular framework for constructing (co)datatypes in HOL, with support for mixed mutual and nested (co)recursion. Mixed (co)recursion enables type definitions involving both datatypes and codatatypes, such as the type of finitely branching trees of possibly infinite depth. Our framework draws heavily from category theory. The key notion is that of a rich type constructor—a functor satisfying specific properties preserved by interesting categorical operations. Our ideas are formalized in Isabelle and implemented as a new definitional package, answering a long-standing user request.

### Citations

879 |
A formulation of the simple theory of types
- Church
- 1940
(Show Context)
Citation Context ...t. V).II. HIGHER-ORDER LOGIC (HOL) By HOL we mean classical higher-order logic with Hilbert choice, the axiom of infinity, and ML-style polymorphism. HOL is based on Church’s simple type theory [2], =-=[7]-=-. It is the logic of Gordon’s original HOL system [9] and of its many successors and emulators. To keep the discussion focused on the relevant issues, we depart from tradition and present HOL not as a... |

795 |
Isabelle/HOL: A Proof Assistant for Higher-Order Logic, volume 2283
- Nipkow, Paulson, et al.
- 2002
(Show Context)
Citation Context ...proving, (co)datatypes, cardinals I. INTRODUCTION Higher-order logic (HOL, Sect. II) forms the basis of several popular interactive theorem provers, notably HOL4 [9], HOL Light [15], and Isabelle/HOL =-=[25]-=-. Its straightforward semantics, which interprets types as sets (collections) of elements, makes it an attractive choice for many computer science and mathematical formalizations. The theorem provers ... |

325 | Universal coalgebra: a theory of systems
- Rutten
- 1996
(Show Context)
Citation Context ...nit F n )n for the final coalgebra). Many results from the literature are concerned only with a given type of construction, and only with admissibility (C2), ignoring closure (C3). Rutten’s monograph =-=[31]-=- focuses on coalgebras. It describes a general class of functors on sets, namely, those that preserve weak pullbacks and have a set of generators, or, sufficiently, preserve weak pullbacks and are bou... |

319 |
Introduction to Mathematical Logic and Type Theory: To Truth through Proof
- Andrews
- 2002
(Show Context)
Citation Context ... (Sect. V).II. HIGHER-ORDER LOGIC (HOL) By HOL we mean classical higher-order logic with Hilbert choice, the axiom of infinity, and ML-style polymorphism. HOL is based on Church’s simple type theory =-=[2]-=-, [7]. It is the logic of Gordon’s original HOL system [9] and of its many successors and emulators. To keep the discussion focused on the relevant issues, we depart from tradition and present HOL not... |

165 |
A final coalgebra theorem
- Aczel, Mendler
- 1989
(Show Context)
Citation Context ... a final coalgebra for accessible functors on sets (i.e., functors preserving k-filtered colimits for some k). This result is an internalization to sets of Aczel and Mendler’s final coalgebra theorem =-=[1]-=- stated for set-based functors on classes. Moreover, Barr produces a bound for the size of the final coalgebra, assuming the existence of a certain large cardinal. However, k-filtered colimits are inc... |

140 |
Terminal coalgebras in well-founded set theory, Theoretical Computer Science 114
- Barr
- 1993
(Show Context)
Citation Context ...he main issue with this class of functors is admissibility of initial algebras (C2-a). Closure properties (C3), which Rutten omits to discuss, might also be an issue. Also focusing on coalgebra, Barr =-=[4]-=-, [5] proves the existence of a final coalgebra for accessible functors on sets (i.e., functors preserving k-filtered colimits for some k). This result is an internalization to sets of Aczel and Mendl... |

91 |
Algebraic Approaches to Program Semantics
- Manes, Arbib
- 1986
(Show Context)
Citation Context ...ssary (co)iterators and their properties. The literature does not appear to provide a complete solution for the above system of constraints. An obvious candidate, the class of ω-bicontinuous functors =-=[22]-=-, satisfies C1–C3 but not C4, because the associated limit construction requires a logic that can express infinite type families (e.g., (unit F n )n for the final coalgebra). Many results from the lit... |

87 | Nominal Techniques in Isabelle/HOL
- Urban, Tasson
(Show Context)
Citation Context ...he datatype package (Sect. III-A) are the most widely used, but there are many others. Homeier [18] developed a package to define quotient types in HOL4, now ported to Isabelle [21]. Nominal Isabelle =-=[33]-=- extends HOL with infrastructure for reasoning about datatypes containing name binders; Urban is currently rebasing it on the quotient package in unison with our (co)datatype package, exploiting the s... |

77 | Automating recursive type definitions in higher order logic
- Melham
- 1989
(Show Context)
Citation Context ...cification to primitive type definitions. The most important high-level mechanism is undoubtedly the datatype package, which automates the derivation of (freely generated inductive) datatypes. Melham =-=[23]-=- devised such a definitional package already two decades ago. His approach, considerably extended by Gunter [12], [13] and simplified by Harrison [14], now lies at the heart of the implementations in ... |

71 | HOL light: A tutorial introduction
- Harrison
- 1996
(Show Context)
Citation Context ...c, interactive theorem proving, (co)datatypes, cardinals I. INTRODUCTION Higher-order logic (HOL, Sect. II) forms the basis of several popular interactive theorem provers, notably HOL4 [9], HOL Light =-=[15]-=-, and Isabelle/HOL [25]. Its straightforward semantics, which interprets types as sets (collections) of elements, makes it an attractive choice for many computer science and mathematical formalization... |

70 | Structural induction and coinduction in a fibrational setting
- Hermida, Jacobs
- 1998
(Show Context)
Citation Context ...cation of composition, initial algebra, and final coalgebra. Datafunctors satisfy C1–C3 but ostensibly not C4, because the arguments, which employ abstract results on categorical logic and fibrations =-=[17]-=-, rely on (co)limits. IV. RICH TYPE CONSTRUCTORS To accommodate constraints C1–C4 in HOL, we must work in a strict cardinal-bounded fashion, always keeping in sight a universe type able to host the ne... |

65 |
Containers - constructing strictly positive types
- Abbott, Altenkirch, et al.
- 2005
(Show Context)
Citation Context ...ations [19], rely on (co)limits. Another drawback of datafunctors is their failure to satisfy D (even though the abstract results [19] may apply to a much larger class). Abbott, Altenkirch, and Ghani =-=[1]-=- define container types (with an indexed extension [3] also covering terms with bindings) satisfying C1–C3, but not C4 (as they rely on dependent types) or D. Finally, Hoogendijk and de Moor [22] disc... |

62 |
Melham, eds., Introduction to HOL: A Theorem Proving Environment for Higher Order Logic
- Gordon, F
- 1993
(Show Context)
Citation Context ...gher-order logic, interactive theorem proving, (co)datatypes, cardinals I. INTRODUCTION Higher-order logic (HOL, Sect. II) forms the basis of several popular interactive theorem provers, notably HOL4 =-=[9]-=-, HOL Light [15], and Isabelle/HOL [25]. Its straightforward semantics, which interprets types as sets (collections) of elements, makes it an attractive choice for many computer science and mathematic... |

45 | Inductive datatypes in HOL—lessons learned in formal-logic engineering
- Berghofer, Wenzel
(Show Context)
Citation Context ...the first HOL-based prover with general support for codatatypes and thereby answering a long-standing user request. After implementing the original datatype package for Isabelle, Berghofer and Wenzel =-=[6]-=- suggested three areas for future work: codatatypes, non-freely generated types, and composition of definitional packages. Thirteen years later, their vision is very close to a full materialization. A... |

45 | Mechanizing coinduction and corecursion in higher-order logic
- Paulson
- 1997
(Show Context)
Citation Context ...onal package: Völker [34] sketches a categorical approach to datatypes that prefigures our work; Vos and Swierstra [35] elaborate an ad hoc construction for recursion through finite sets; and Paulson =-=[27]-=- designed building blocks for codatatypes. PVS, whose logic is a simple type theory extended with dependent types and subtyping (but without polymorphism), provides monolithic axiomatic packages for d... |

30 | Abstract datatypes in PVS
- Owre, Shankar
- 1997
(Show Context)
Citation Context ... building blocks for codatatypes. PVS, whose logic is a simple type theory extended with dependent types and subtyping (but without polymorphism), provides monolithic axiomatic packages for datatypes =-=[26]-=- and codatatypes [11]. Hensel and Jacobs [16] illustrate the categorical approach to (co)datatypes in PVS by axiomatic declarations of various flavors of trees (including our treeF and treeI) with ass... |

25 | Indexed containers
- Morris, Altenkirch
- 2009
(Show Context)
Citation Context ...atafunctors is their failure to satisfy D (even though the abstract results [19] may apply to a much larger class). Abbott, Altenkirch, and Ghani [1] define container types (with an indexed extension =-=[3]-=- also covering terms with bindings) satisfying C1–C3, but not C4 (as they rely on dependent types) or D. Finally, Hoogendijk and de Moor [22] discuss container types by relators without analyzing C2–C... |

24 |
Inductive definitions: Automation and application
- Harrison
- 1995
(Show Context)
Citation Context ...of (freely generated inductive) datatypes. Melham [23] devised such a definitional package already two decades ago. His approach, considerably extended by Gunter [12], [13] and simplified by Harrison =-=[14]-=-, now lies at the heart of the implementations in HOL4, HOL Light, and Isabelle/HOL. Despite having withstood the test of time, the Melham– Gunter approach suffers from a few limitations that impair i... |

22 | A fixedpoint approach to (co)inductive and (co)datatype definitions
- Paulson
(Show Context)
Citation Context ...ich extends HOL4 with higher-rank polymorphism, provides a safe primitive for introducing abstractly specified types [19]. Isabelle/ZF, based on ZFC, reduces (co)datatypes to (co)inductive predicates =-=[28]-=-, with no support for mixed (co)recursion; for codatatypes, it relies on a concrete, definitional treatment of non-well-founded objects. In Agda and Coq, (co)datatypes are built into the underlying ca... |

22 | Filters on coinductive streams, an application to eratosthenes’ sieve. Pages 102–115 of: TLCA’05
- Bertot
- 2005
(Show Context)
Citation Context ...n; for codatatypes, it relies on a concrete, definitional treatment of non-well-founded objects. In Agda and Coq, (co)datatypes are built into the underlying calculus. Mixed (co)recursion is possible =-=[8]-=- but not the combination with non-free types. VII. CONCLUSION We presented a theoretical framework for defining types in higher-order logic. The framework relies on the abstract notion of a bounded na... |

19 |
Relators and metric bisimulations, in
- Rutten
- 1998
(Show Context)
Citation Context ...xiliary operation in interesting (co)datatype definitions. For example, the list-defining RTC (α, β) F discussed in Sect. III-B is a composition of basic RTCs. C. Relators A key insight due to Rutten =-=[30]-=- is that, thanks to WP, the functor (F, Fmap) has a natural extension to a relator, i.e., a functor on the category of types and binary relations, denoted R. We can express the relator action of F as ... |

17 | A broader class of trees for recursive type definitions for HOL
- Gunter
- 1994
(Show Context)
Citation Context ... which automates the derivation of (freely generated inductive) datatypes. Melham [23] devised such a definitional package already two decades ago. His approach, considerably extended by Gunter [12], =-=[13]-=- and simplified by Harrison [14], now lies at the heart of the implementations in HOL4, HOL Light, and Isabelle/HOL. Despite having withstood the test of time, the Melham– Gunter approach suffers from... |

17 | Proof principles for datatypes with iterated recursion
- Hensel, Jacobs
- 1997
(Show Context)
Citation Context ...on.�� �� � �� . a2 . a1 . a3 Fig. 3. An element x of α F with Fset x = {a1, a2, a3} Fset α F α set Fmap f Fig. 4. β F Fset � β set image f The “set” natural transformation Finally, Hensel and Jacobs =-=[16]-=- propose a modular development of (co)datatypes for datafunctors, namely, functors obtained from constants, +, and × by repeated application of composition, initial algebra, and final coalgebra. Dataf... |

13 | Container types categorically
- Hoogendijk, Moor
- 2000
(Show Context)
Citation Context ...Ghani [1] define container types (with an indexed extension [3] also covering terms with bindings) satisfying C1–C3, but not C4 (as they rely on dependent types) or D. Finally, Hoogendijk and de Moor =-=[22]-=- discuss container types by relators without analyzing C2–C4.�� � �� . a2 . a1 . a3 Fig. 3. An element x of α F with Fset x = {a1, a2, a3} Fmap f Fig. 4. α F β F Fset Fset �� α set � β set image f Th... |

12 |
Why we can’t have SML-style datatype declarations in HOL
- Gunter
- 1993
(Show Context)
Citation Context ...ckage, which automates the derivation of (freely generated inductive) datatypes. Melham [23] devised such a definitional package already two decades ago. His approach, considerably extended by Gunter =-=[12]-=-, [13] and simplified by Harrison [14], now lies at the heart of the implementations in HOL4, HOL Light, and Isabelle/HOL. Despite having withstood the test of time, the Melham– Gunter approach suffer... |

10 | Building Formal Method Tools in the Isabelle/Isar Framework - Wenzel, Wolff - 2007 |

9 |
A purely definitional universal domain
- Huffman
- 2009
(Show Context)
Citation Context ... our (co)datatype package, exploiting the support for non-free constructors. HOLCF, a HOL library for domain theory, has long included an axiomatic package for defining (co)recursive domains; Huffman =-=[20]-=- recast it into a purely definitional package, based on a large enough universal domain—a simplification that unfortunately is not available for general HOL datatypes. The package combines many of the... |

8 | A design structure for higher order quotients
- Homeier
- 2005
(Show Context)
Citation Context ...r definitional [6, p. 3]. In the world of HOL, the primitive type definition mechanism (Sect. II-A) and the datatype package (Sect. III-A) are the most widely used, but there are many others. Homeier =-=[18]-=- developed a package to define quotient types in HOL4, now ported to Isabelle [21]. Nominal Isabelle [33] extends HOL with infrastructure for reasoning about datatypes containing name binders; Urban i... |

6 | Quotients revisited for Isabelle/HOL
- Kaliszyk, Urban
- 2011
(Show Context)
Citation Context ...nism (Sect. II-A) and the datatype package (Sect. III-A) are the most widely used, but there are many others. Homeier [18] developed a package to define quotient types in HOL4, now ported to Isabelle =-=[21]-=-. Nominal Isabelle [33] extends HOL with infrastructure for reasoning about datatypes containing name binders; Urban is currently rebasing it on the quotient package in unison with our (co)datatype pa... |

5 |
Additions and corrections to ‘terminal coalgebras in well-founded set theory’, Theoretical Computer Science
- Barr
- 1994
(Show Context)
Citation Context ...in issue with this class of functors is admissibility of initial algebras (C2-a). Closure properties (C3), which Rutten omits to discuss, might also be an issue. Also focusing on coalgebra, Barr [4], =-=[5]-=- proves the existence of a final coalgebra for accessible functors on sets (i.e., functors preserving k-filtered colimits for some k). This result is an internalization to sets of Aczel and Mendler’s ... |

5 | Iterative Circular Coinduction for CoCasl
- Hausmann, Mossakowski, et al.
- 2005
(Show Context)
Citation Context ...uctive pendant of datatypes). Lacking a definitional package to automate the definition of codatatypes, users face an unappealing choice between tedious manual constructions and risky axiomatizations =-=[8]-=-. Creating a monolithic codatatype package to supplement the datatype package is not an attractive prospect, because many applications need to mix and match datatypes and codatatypes, as in the follow... |

3 | A proof pearl with the fan theorem and bar induction—Walking through infinite trees with mixed induction and coinduction
- Nakata, Uustalu, et al.
- 2011
(Show Context)
Citation Context ...n; for codatatypes, it relies on a concrete, definitional treatment of non-well-founded objects. In Agda and Coq, (co)datatypes are built into the underlying calculus. Mixed (co)recursion is possible =-=[24]-=- but not the combination with non-free types. VII. CONCLUSION We presented a theoretical framework for defining types in higher-order logic. The framework relies on the abstract notion of a rich type ... |

3 |
Formal development associated with this paper
- Traytel, Popescu, et al.
(Show Context)
Citation Context ...results in this paper are formalized in Isabelle/HOL and implemented in ML as a prototypical definitional package, together with a few examples of applications. This development is publicly available =-=[32]-=-. A. Formalized Metatheory Isabelle/HOL proved well suited for formalizing category theory over types, with relevant concepts, including functor and natural transformation, handled in a lightweight, f... |

3 | The HOL-Omega logic
- Homeier
- 2009
(Show Context)
Citation Context ...g our treeF and treeI) with associated (co)iterators and proof principles. HOLω, which extends HOL4 with higher-rank polymorphism, provides a safe primitive for introducing abstractly specified types =-=[21]-=-. Isabelle/ZF, based on ZFC, reduces (co)datatypes to (co)inductive predicates [30], with no support for mixed (co)recursion; for codatatypes, it relies on a concrete, definitional treatment of non-we... |

2 | Some Mathematical Case Studies in ProofPower-HOL
- Arthan
(Show Context)
Citation Context ...s very close to a full materialization. Although we focused on Isabelle, our approach is equally applicable to the other HOL-based theorem provers, such as HOL4 [9] HOL Light [15], and ProofPower–HOL =-=[3]-=-.Methodologically, we found that category theory helped us develop intuitions about the types of HOL, recasting them as richly structured objects rather than mere collections of elements. As a contin... |

1 | Co-inductive proofs for streams in PVS
- Gottliebsen
- 2007
(Show Context)
Citation Context ...codatatypes. PVS, whose logic is a simple type theory extended with dependent types and subtyping (but without polymorphism), provides monolithic axiomatic packages for datatypes [26] and codatatypes =-=[11]-=-. Hensel and Jacobs [16] illustrate the categorical approach to (co)datatypes in PVS by axiomatic declarations of various flavors of trees (including our treeF and treeI) with associated (co)iterators... |

1 |
Abstract data types in HOL-Omega. http://permalink.gmane.org/gmane.comp.mathematics
- Homeier
- 2011
(Show Context)
Citation Context ...g our treeF and treeI) with associated (co)iterators and proof principles. HOLω, which extends HOL4 with higher-rank polymorphism, provides a safe primitive for introducing abstractly specified types =-=[19]-=-. Isabelle/ZF, based on ZFC, reduces (co)datatypes to (co)inductive predicates [28], with no support for mixed (co)recursion; for codatatypes, it relies on a concrete, definitional treatment of non-we... |

1 |
On the representation of datatypes
- Völker
- 1995
(Show Context)
Citation Context ...e combines many of the categorical ideas present in our work, notably the modular mixture of recursion via enriched constructors. Some ideas have yet to be automated in a definitional package: Völker =-=[34]-=- sketches a categorical approach to datatypes that prefigures our work; Vos and Swierstra [35] elaborate an ad hoc construction for recursion through finite sets; and Paulson [27] designed building bl... |

1 | Inductive data types with negative occurrences in HOL. Thirty Five Years of Automath
- Vos, Swierstra
- 2002
(Show Context)
Citation Context ...ecursion via enriched constructors. Some ideas have yet to be automated in a definitional package: Völker [34] sketches a categorical approach to datatypes that prefigures our work; Vos and Swierstra =-=[35]-=- elaborate an ad hoc construction for recursion through finite sets; and Paulson [27] designed building blocks for codatatypes. PVS, whose logic is a simple type theory extended with dependent types a... |

1 |
A Category Theory Based (Co)datatype Package for Isabelle/HOL
- Traytel
- 2012
(Show Context)
Citation Context ...suffice to illustrate the functorial structure of the initial and final algebras, a structure that would be trivial if we started with unary functors. (The definition of n-ary BNFs is given elsewhere =-=[34]-=-.) Among the above conditions, FUNC and NATi were already explained and motivated. WP is a technical condition allowing a smooth treatment of bisimulation relations, relevant for coinduction and corec... |