Nested Datatypes with Generalized Mendler Iteration: Map Fusion and the Example of the Representation of Untyped Lambda Calculus with Explicit Flattening
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.
Unable to display preview. Download preview PDF.
- 2.Bird, R., Gibbons, J., Jones, G.: Program optimisation, naturally. In: Davies, J., Roscoe, B., Woodcock, J. (eds.) Millenial Perspectives in Computer Science, Proceedings of the 1999 Oxford-Microsoft Symp. in Honour of Professor Sir Anthony Hoare, Palgrave (2000)Google Scholar
- 3.Hinze, R.: Efficient generalized folds. In: Jeuring, J. (ed.) Proceedings of the Second Workshop on Generic Programming, WGP 2000, Ponte de Lima, Portugal (2000)Google Scholar
- 7.Coq Development Team: The Coq Proof Assistant Reference Manual Version 8.1. Project LogiCal, INRIA (2006), http://coq.inria.fr
- 8.Paulin-Mohring, C.: Définitions Inductives en Théorie des Types d’Ordre Supérieur. Habilitation à diriger les recherches, Université Claude Bernard Lyon I (1996)Google Scholar
- 14.Matthes, R.: An induction principle for nested datatypes in intensional type theory. Journal of Functional Programming (to appear, 2008)Google Scholar
- 17.Matthes, R.: Coq development for Nested datatypes with generalized Mendler iteration: map fusion and the example of the representation of untyped lambda calculus with explicit flattening (January 2008), http://www.irit.fr/~Ralph.Matthes/Coq/MapFusion/
- 18.Matthes, R.: Coq development for An induction principle for nested datatypes in intensional type theory (January 2008), http://www.irit.fr/~Ralph.Matthes/Coq/InductionNested/
- 19.Mendler, N.P.: Recursive types and type constraints in second-order lambda calculus. In: Proceedings of the Second Annual IEEE Symposium on Logic in Computer Science, Ithaca, pp. 30–36. IEEE Computer Society Press (1987)Google Scholar
- 21.Uustalu, T., Vene, V.: A cube of proof systems for the intuitionistic predicate μ-, ν-logic. In: Haveraaen, M., Owe, O. (eds.) Selected Papers of the 8th Nordic Workshop on Programming Theory (NWPT 1996). Research Reports, Department of Informatics, University of Oslo, vol. 248, pp. 237–246 (May 1997)Google Scholar
- 22.Matthes, R.: Naive reduktionsfreie Normalisierung (translated to English: naive reduction-free normalization). Slides of talk on December 19, 1996, given at the Bern Munich meeting on proof theory and computer science in Munich, available at the author’s homepage (December 1996)Google Scholar
- 23.Hofmann, M.: Extensional concepts in intensional type theory. PhD thesis, University of Edinburgh, Available as report ECS-LFCS-95-327 (1995)Google Scholar
- 24.Altenkirch, T.: Extensional equality in intensional type theory. In: 14th Annual IEEE Symposium on Logic in Computer Science (LICS 1999), pp. 412–420. IEEE Computer Society, Los Alamitos (1999)Google Scholar
- 25.Oury, N.: Extensionality in the Calculus of Constructions. In: Hurd, J., Melham, T. (eds.) TPHOLs 2005. LNCS, vol. 3603, pp. 278–293. Springer, Heidelberg (2005)Google Scholar
- 27.Abel, A.: A Polymorphic Lambda-Calculus with Sized Higher-Order Types. Doktorarbeit (PhD thesis), LMU München (2006)Google Scholar
- 29.Capretta, V.: A polymorphic representation of induction-recursion. Note of 9 pages available on the author’s web page (a second 15 pages version of May 2005 has been seen by the present author) (March 2004)Google Scholar