Abstract

Nested datatypes are families of datatypes that are indexed over all types such that the constructors may relate different family members (unlike the homogeneous lists). Moreover, even the family name may be involved in the expression that gives the index the argument type of the constructor refers to. Especially in this case of true nesting, termination of functions that traverse these data structures is far from being obvious. A joint article with A. Abel and T. Uustalu (TCS 333(1–2), pp. 3–66, 2005) proposes iteration schemes that guarantee termination not by structural requirements but just by polymorphic typing. And they are generic in the sense that no specific syntactic form of the underlying datatype “functor” is required. However, there have not been induction principles for the verification of the programs thus obtained although they are well-known in the usual model of initial algebras on endofunctor categories. The new contribution is a representation of nested datatypes in intensional type theory (more specifically, in the Calculus of Inductive Constructions) that is still generic, guarantees termination of all expressible programs and has induction principles that allow to prove functoriality of monotonicity witnesses (maps for nested datatypes) and naturality properties of iteratively defined polymorphic functions.

Highlights

  • The algebra of programming [3] shows the benefits of programming recursive functions in a structured fashion, in particular with iterators: there are equational laws that allow a calculational way of verification

  • The author concentrated on polymorphic lambda-calculi with nested datatypes that guarantee termination of all functions that follow the proposed iteration schemes

  • The present article proposes a combination of both worlds: the world of terminating programs known from type theory and the categorical laws used in advanced functional programming

Read more

Summary

INTRODUCTION

The algebra of programming [3] shows the benefits of programming recursive functions in a structured fashion, in particular with iterators: there are equational laws that allow a calculational way of verification. The author concentrated on polymorphic lambda-calculi with nested datatypes that guarantee termination of all functions that follow the proposed iteration schemes. It will turn out that, after having introduced non-canonical elements into Mendler’s style (following [19]), Coq supports reasoning very well. This does not hold for nested datatypes since one programs polymorphic functions on them for which naturality laws are needed if more serious verification is aimed at. The section introduces the important concepts for this article and discusses how Mendler’s style for nested datatypes can be used in the Coq theorem prover. Coq vernacular files for the results are provided on the author’s web page [13]

TOWARDS THE SYSTEM
THE SYSTEM
JUSTIFICATION
BACK TO CANONICAL ELEMENTS
CONCLUSIONS
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call