skip to main content
research-article

A hierarchy of mendler style recursion combinators: taming inductive datatypes with negative occurrences

Published:19 September 2011Publication History
Skip Abstract Section

Abstract

The Mendler style catamorphism (which corresponds to weak induction) always terminates even for negative inductive datatypes. The Mendler style histomorphism (which corresponds to strong induction) is known to terminate for positive inductive datatypes. To our knowledge, the literature is silent on its termination properties for negative datatypes. In this paper, we prove that histomorphisms do not always termintate by showing a counter-example. We also enrich the Mendler collection of recursion combinators by defining a new form of Mendler style catamorphism (msfcata), which terminates for all inductive datatypes, that is more expressive than the original. We organize the collection of combinators by placing them into a hierarchy of ever increasing generality, and describing the termination properties of each point on the hierarchy. We also provide many examples (including a case study on a negative inductive datatype), which illustrate both the expressive power and beauty of the Mendler style. One lesson we learn from this work is that weak induction applies to negative inductive datatypes but strong induction is problematic. We provide a proof of weak induction by exhibiting an embedding of our new combinator into Fω. We pose the open question: Is there a safe way to apply strong induction to negative inductive datatypes?

Skip Supplemental Material Section

Supplemental Material

_talk9.mp4

References

  1. A. Abel, R. Matthes, and T. Uustalu. Generalized iteration and coiteration for higher-order nested datatypes. In FoSSaCS, volume 2620 of LNCS, pages 54--69. Springer, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. A. Abel, R. Matthes, and T. Uustalu. Iteration and coiteration schemes for higher-order and nested datatypes. Theoretical Computer Science, 333 (1-2): 3--66, 2005. ISSN 0304-3975. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Bird and Meertens. Nested datatypes. In MPC: 4th International Conference on Mathematics of Program Construction. LNCS, Springer-Verlag, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. R. Bird and R. Paterson. Generalised folds for nested datatypes. Formal Aspects of Computing, 11: 11--2, 1999.Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. R. S. Bird and O. de Moor. Algebra of Programming. Prentice-Hall, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. A. Chlipala. Parametric higher-order abstract syntax for mechanized semantics. ICFP '08, pages 143--156. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. A. Church. A formulation of the simple theory of types. Journal of Symbolic Logic, 5 (1): 56--68, 1940.Google ScholarGoogle ScholarCross RefCross Ref
  8. R. L. Constable, S. F. Allen, H. M. Bromley, W. R. Cleaveland, J. F. Cremer, R. W. Harper, D. J. Howe, T. B. Knoblock, N. P. Mendler, P. Panangaden, J. T. Sasaki, and S. F. Smith. Implementing mathematics with the Nuprl proof development system. Prentice-Hall, Inc., Upper Saddle River, NJ, USA, 1986. ISBN 0-13-451832-2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. K. Crary and S. Weirich. Flexible type analysis. In ICFP, pages 233--248, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. J. Despeyroux and P. Leleu. Primitive recursion for higher-order abstract syntax with dependant types. In Informal proceedings of the FLoC'99 IMLA, June 1999.Google ScholarGoogle Scholar
  11. J. Despeyroux, A. P. Felty, and A. Hirschowitz. Higher-order abstract syntax in coq. In Proceedings of the Second International Conference on Typed Lambda Calculi and Applications, pages 124--138, London, UK, 1995. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. J. Despeyroux, F. Pfenning, and C. Schürmann. Primitive recursion for higher-order abstract syntax. In P. de Groote, editor, TLCA, volume 1210 of LNCS, pages 147--163. Springer, 1997. ISBN 3-540-62688-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. L. Fegaras and T. Sheard. Revisiting catamorphisms over datatypes with embedded functions (or, programs from outer space). POPL '96, pages 284--294. ACM, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. T. Hagino. A Categorical Programming Language. PhD thesis, University of Edinburgh, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. R. Hinze. Efficient generalized folds. In J. Jeuring, editor, Proc. of 2nd Workshop on Generic Programming. July 2000.Google ScholarGoogle Scholar
  16. R. Hinze. Adjoint folds and unfolds. In C. Bolduc, J. Desharnais, and B. Ktari, editors, Mathematics of Program Construction, volume 6120 of LNCS, pages 195--228. Springer Berlin / Heidelberg, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Honsell, Miculan, and Scagnetto. An axiomatic approach to metareasoning on nominal algebras in HOAS. In ICALP: Annual International Colloquium on Automata, Languages and Programming, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. C. E. Martin, J. Gibbons, and I. Bayley. Disciplined, efficient, generalised folds for nested datatypes. Formal Aspects of Computing, 16 (1): 19--35, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. R. Matthes. Extensions of System F by Iteration and Primitive Recursion on Monotone Inductive Types. PhD thesis, Ludwig-Maximilians Universität, May 1998.Google ScholarGoogle Scholar
  20. R. Matthes. An induction principle for nested datatypes in intensional type theory. Journal of Functional Programming, 19 (3-4): 439--468, June 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. R. Matthes. Map fusion for nested datatypes in intensional type theory. Sci. Comput. Program., 76: 204--224, March 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. E. Meijer and G. Hutton. Bananas in space: extending fold and unfold to exponential types. FPCA '95, pages 324--333. ACM, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. N. P. Mendler. Recursive types and type constraints in second-order lambda calculus. In LICS, pages 30--36. IEEE Computer Society, 1987.Google ScholarGoogle Scholar
  24. N. P. Mendler. Inductive types and type constraints in the second-order lambda calculus. Ann. Pure Appl. Logic, 51 (1-2): 159--172, 1991.Google ScholarGoogle ScholarCross RefCross Ref
  25. R. Paterson. Control structures from types. Unpublished draft, 1993.Google ScholarGoogle Scholar
  26. C. Paulin-Mohring. Inductive definitions in the system Coq - rules and properties. In M. Bezem and J. F. Groote, editors, TLCA, volume 664 of LNCS, pages 328--345. Springer, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. F. Pfenning and C. Elliot. Higher-order abstract syntax. PLDI '88, pages 199--208. ACM, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. B. Russell. Mathematical logic as based on the theory of types. American Journal of Mathematics, 30: 222--262, 1908.Google ScholarGoogle ScholarCross RefCross Ref
  29. C.-C. Shan. A static simulation of dynamic delimited control. Higher Order Symbol. Comput., 20: 371--401, December 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. T. Sheard. Putting curry-howard to work. In Proceedings of the 2005 ACM SIGPLAN workshop on Haskell, pages 74--85. ACM, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. The GHC Team. The Glorious Glasgow Haskell Compilation System User's Guide, Version 7.0.1, 2010.Google ScholarGoogle Scholar
  32. T. Uustalu. Natural Deduction for Intuitionistic Least and Greatest Fixedpoint Logics, with an Application to Program Construction. PhD thesis, Dept. of Teleinformatics, Royal Inst. of Technology, Stockholm, May 1998.Google ScholarGoogle Scholar
  33. T. Uustalu and V. Vene. Mendler-style inductive types, categorically. Nordic Journal of Computing, 6 (3): 343--361, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. T. Uustalu and V. Vene. Primitive (co)recursion and course-of-value (co)iteration, categorically. Informatica, Lith. Acad. Sci, 10 (1): 5--26, 1999.Google ScholarGoogle Scholar
  35. T. Uustalu and V. Vene. Coding recursion à la Mendler (extended abstract). In J. Jeuring, editor, Proc. of 2nd Workshop on Generic Programming, pages 69--85. 2000.Google ScholarGoogle Scholar
  36. V. Vene. Categorical Programming with Inductive and Coinductive Types. PhD thesis, Dept. of Computer Science, Univ. of Tartu, 2000.Google ScholarGoogle Scholar
  37. G. Washburn and S. Weirich. Boxes go bananas: encoding higher-order abstract syntax with parametric polymorphism. ICFP '03, pages 249--262. ACM, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A hierarchy of mendler style recursion combinators: taming inductive datatypes with negative occurrences

                      Recommendations

                      Comments

                      Login options

                      Check if you have access through your login credentials or your institution to get full access on this article.

                      Sign in

                      Full Access

                      PDF Format

                      View or Download as a PDF file.

                      PDF

                      eReader

                      View online with eReader.

                      eReader
                      About Cookies On This Site

                      We use cookies to ensure that we give you the best experience on our website.

                      Learn more

                      Got it!