Nested Datatypes with Generalized Mendler Iteration: Map Fusion and the Example of the Representation of Untyped Lambda Calculus with Explicit Flattening

  • Authors:
  • Ralph Matthes

  • Affiliations:
  • Institut de Recherche en Informatique de Toulouse (IRIT), C. N. R. S. et Université Paul Sabatier (Toulouse III), Toulouse Cedex 9, F-31062

  • Venue:
  • MPC '08 Proceedings of the 9th international conference on Mathematics of Program Construction
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

Nested datatypes are families of datatypes that are indexed over all types such that the constructors may relate different family members. Moreover, the argument types of the constructors refer to indices given by expressions where the family name may occur. Especially in this case of true nesting, there is no direct support by theorem provers to guarantee termination of functions that traverse these data structures.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. They are generic in the sense that no specific syntactic form of the underlying datatype "functor" is required. In subsequent work (accepted for the Journal of Functional Programming), the author introduced an induction principle for the verification of programs obtained from Mendler-style iteration of rank 2, which is one of those schemes, and justified it in the Calculus of Inductive Constructions through an implementation in the theorem prover Coq.The new contribution is an extension of this work to generalized Mendler iteration (introduced in Abel et al, cited above), leading to a map fusion theorem for the obtained iterative functions. The results and their implementation in Coq are used for a case study on a representation of untyped lambda calculus with explicit flattening. Substitution is proven to fulfill two of the three monad laws, the third only for "hereditarily canonical" terms, but this is rectified by a relativisation of the whole construction to those terms.