Advertisement

Recursion on Nested Datatypes in Dependent Type Theory

  • Ralph Matthes
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5028)

Abstract

Nested datatypes are families of datatypes that are indexed over all types and where the datatype constructors relate different members of the family. This may be used to represent variable binding or to maintain certain invariants through typing.

In dependent type theory, a major concern is the termination of all expressible programs, so that types that depend on object terms can still be type-checked mechanically. Therefore, we study iteration and recursion schemes that have this termination guarantee throughout. This is not based on syntactic criteria (recursive calls with “smaller” arguments) but just on types (“type-based termination”). An important concern are reasoning principles that are compatible with the ambient type theory, in our case induction principles.

In previous work, the author has proposed an abstract description of nested datatypes together with a mapping operation (like map for lists) and an iterator on the term side and an induction principle on the logical side that could all be implemented within the Coq system (with impredicative Set that is just needed for the justification, not for the definition and the examples). For verification purposes, it is important to have naturality theorems for the obtained iterative functions. Although intensional type theory does not provide naturality in general, criteria for naturality could be established that are met in case studies on “bushes” and representations of lambda terms (also with explicit flattening).

The new contribution is an extension of this abstract description to full primitive recursion and its illustration by way of examples that have been carried out in Coq. Unlike the iterative system, we do not yet have a justification within Coq.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Bird, R., Meertens, L.: Nested datatypes. In: Jeuring, J. (ed.) MPC 1998. LNCS, vol. 1422, pp. 52–67. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  2. 2.
    Bird, R., Gibbons, J., Jones, G.: Program optimisation, naturally. In: Davies, J., Roscoe, B., Woodcock, J. (eds.) Millenial Perspectives in Computer Science, Proceedings (2000)Google Scholar
  3. 3.
    Bellegarde, F., Hook, J.: Substitution: A formal methods case study using monads and transformations. Science of Computer Programming 23, 287–311 (1994)zbMATHCrossRefGoogle Scholar
  4. 4.
    Bird, R.S., Paterson, R.: De Bruijn notation as a nested datatype. Journal of Functional Programming 9(1), 77–91 (1999)zbMATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    Altenkirch, T., Reus, B.: Monadic presentations of lambda terms using generalized inductive types. In: Flum, J., Rodríguez-Artalejo, M. (eds.) CSL 1999. LNCS, vol. 1683, pp. 453–468. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  6. 6.
    Abel, A., Matthes, R., Uustalu, T.: Iteration and coiteration schemes for higher-order and nested datatypes. Theoretical Computer Science 333(1–2), 3–66 (2005)zbMATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Barthe, G., Frade, M.J., Giménez, E., Pinto, L., Uustalu, T.: Type-based termination of recursive definitions. Mathematical Structures in Computer Science 14, 97–141 (2004)zbMATHCrossRefGoogle Scholar
  8. 8.
    Matthes, R.: An induction principle for nested datatypes in intensional type theory. Journal of Functional Programming (to appear, 2008)Google Scholar
  9. 9.
    Coquand, T., Paulin, C.: Inductively defined types. In: Martin-Löf, P., Mints, G. (eds.) COLOG 1988. LNCS, vol. 417, pp. 50–66. Springer, Heidelberg (1990)Google Scholar
  10. 10.
    Paulin-Mohring, C.: Inductive definitions in the system Coq – rules and properties. In: Bezem, M., Groote, J.F. (eds.) TLCA 1993. LNCS, vol. 664, pp. 328–345. Springer, Heidelberg (1993)CrossRefGoogle Scholar
  11. 11.
    Paulin-Mohring, C.: Définitions Inductives en Théorie des Types d’Ordre Supérieur. Habilitation thesis, Université Claude Bernard Lyon I (1996)Google Scholar
  12. 12.
    Coq Development Team: The Coq Proof Assistant Reference Manual Version 8.1. Project LogiCal, INRIA (2006), coq.inria.fr
  13. 13.
    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, N.Y, pp. 30–36. IEEE Computer Society Press, Los Alamitos (1987)Google Scholar
  14. 14.
    Abel, A., Matthes, R.: Fixed points of type constructors and primitive recursion. In: Marcinkowski, J., Tarlecki, A. (eds.) CSL 2004. LNCS, vol. 3210, pp. 190–204. Springer, Heidelberg (2004)Google Scholar
  15. 15.
    Matthes, R.: Coq development for Recursion on nested datatypes in dependent type theory (January 2008), http://www.irit.fr/~Ralph.Matthes/Coq/MendlerRecursion/
  16. 16.
    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/
  17. 17.
    Bird, R., Paterson, R.: Generalised folds for nested datatypes. Formal Aspects of Computing 11(2), 200–222 (1999)zbMATHCrossRefGoogle Scholar
  18. 18.
    Abel, A., Matthes, R. (Co-)iteration for higher-order nested datatypes. In: Geuvers, H., Wiedijk, F. (eds.) TYPES 2002. LNCS, vol. 2646, pp. 1–20. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  19. 19.
    Pfenning, F., Paulin-Mohring, C.: Inductively defined types in the calculus of constructions. In: Main, M.G., Melton, A., Mislove, M.W., Schmidt, D.A. (eds.) MFPS 1989. LNCS, vol. 442, pp. 209–228. Springer, Heidelberg (1990)CrossRefGoogle Scholar
  20. 20.
    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), May 1997. Research Reports, Department of Informatics, University of Oslo, vol. 248, pp. 237–246 (1997)Google Scholar
  21. 21.
    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
  22. 22.
    Geuvers, H.: Inductive and coinductive types with iteration and recursion. In: Nordström, B., Pettersson, K., Plotkin, G. (eds.) Proceedings of the Workshop on Types for Proofs and Programs, Båstad, Sweden, pp. 193–217 (1992), http://www.cs.chalmers.se/Cs/Research/Logic/Types/proc92.ps
  23. 23.
    Wadler, P.: Theorems for free! In: Proceedings of the fourth international conference on functional programming languages and computer architecture, Imperial College, London, England, September 1989, pp. 347–359. ACM Press, New York (1989)CrossRefGoogle Scholar
  24. 24.
    Abel, A.: A Polymorphic Lambda-Calculus with Sized Higher-Order Types. Doktorarbeit (PhD thesis), LMU München (2006)Google Scholar
  25. 25.
    Matthes, R.: Nested datatypes with generalized Mendler iteration: map fusion and the example of the representation of untyped lambda calculus with explicit flattening. In: Paulin-Mohring, C. (ed.) Mathematics of Program Construction, Proceedings. LNCS, Springer, Heidelberg (2008)Google Scholar
  26. 26.
    Johann, P., Ghani, N.: Initial algebra semantics is enough! In: Ronchi Della Rocca, S. (ed.) TLCA 2007. LNCS, vol. 4583, pp. 207–222. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  27. 27.
    Dybjer, P.: A general formulation of simultaneous inductive-recursive definitions in type theory. The Journal of Symbolic Logic 65(2), 525–549 (2000)zbMATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Ralph Matthes
    • 1
  1. 1.Institut de Recherche en Informatique de Toulouse (IRIT)C. N. R. S. et Université Paul Sabatier (Toulouse III)Toulouse Cedex 9 

Personalised recommendations