TYPES 2002: Types for Proofs and Programs pp 39-58

# General Recursion in Type Theory

• Ana Bove
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2646)

## Abstract

In this work, a method to formalise general recursive algorithms in constructive type theory is presented throughout examples. The method separates the computational and logical parts of the definitions. As a consequence, the resulting type-theoretic algorithms are clear, compact and easy to understand. They are as simple as their equivalents in a functional programming language, where there is no restriction on recursive calls. Given a general recursive algorithm, the method consists in defining an inductive special-purpose accessibility predicate that characterises the inputs on which the algorithm terminates. The type-theoretic version of the algorithm can then be defined by structural recursion on the proof that the input values satisfy this predicate. When formalising nested algorithms, the special-purpose accessibility predicate and the type-theoretic version of the algorithm must be defined simultaneously because they depend on each other. Since the method separates the computational part from the logical part of a definition, formalising partial functions becomes also possible

## Preview

### References

1. [Abe02]
A. Abel. Termination checking with types — Strong normalization for Mendler-style course-of-value recursion. Technical Report 0201, Institut für Informatik, Ludwig-Maximilians — Universität München, 2002.Google Scholar
2. [Acz77]
P. Aczel. An Introduction to Inductive Definitions. In J. Barwise, editor, Handbook of Mathematical Logic, pages 739–782. North-Holland Publishing Company, 1977.Google Scholar
3. [BB00]
A. Balaa and Y. Bertot. Fix-point equations for well-founded recursion in type theory. In Harrison and Aagaard [HA00], pages 1–16.
4. [BB02]
A. Balaa and Y. Bertot. Fonctions récursives générales par itération en théorie des types. Journées Francophones des Langages Applicatifs — JFLA02, INRIA, January 2002.Google Scholar
5. [BC01]
A. Bove and V. Capretta. Nested general recursion and partiality in type theory. In R. J. Boulton and P. B. Jackson, editors, Theorem Proving in Higher Order Logics: 14th International Conference, TPHOLs 2001, volume 2152 of Lecture Notes in Computer Science, Springer-Verlag, pages 121–135, September 2001.
6. [BC02]
A. Bove and V. Capretta. Modelling general recursion in type theory, September 2002. Available on the WWW http://cs.chalmers.se/~bove/Papers/general_presentation.ps.gz.
7. [BCB02]
Y. Bertot, V. Capretta, and K. Das Barman. Type-theoretic functional semantics. In Theorem Proving in Higher Order Logics: 15th International Conference, TPHOLs 2002, 2002.Google Scholar
8. [BFG+00]
G. Barthe, M.J. Frade, E. Giménez, L. Pinto, and T. Uustalu. Type-based termination of recursive definitions. Under consideration for publication in Math. Struct. in Comp. Science, December 2000.Google Scholar
9. [Bov99]
A. Bove. Programming in Martin-Löf type theory: Unification — A nontrivial example, November 1999. Licentiate Thesis of the Department of Computer Science, Chalmers University of Technology. Available on the WWW http://cs.chalmers.se/~bove/Papers/lic_thesis.ps.gz.
10. [Bov01]
A. Bove. Simple general recursion in type theory. Nordic Journal of Computing, 8(1):22–42, Spring 2001.
11. [Bov02a]
A. Bove. General Recursion in Type Theory. PhD thesis, Department of Computing Science, Chalmers University of Technology, November 2002. Available on the WWW http://cs.chalmers.se/~bove/Papers/phd_thesis.ps.gz.
12. [Bov02b]
A. Bove. Mutual general recursion in type theory, May 2002. Available on the WWW http://cs.chalmers.se/~bove/Papers/mutual_rec.ps.gz.
13. [CH88]
T. Coquand and G. Huet. The Calculus of Constructions. Information and Computation, 76: 95–120, 1988.
14. [CNSvS94]
T. Coquand, B. Nordström, J. M. Smith, and B. von Sydow. Type theory and programming. EATCS, 52, February 1994.Google Scholar
15. [DDG98]
C. Dubois and V. Viguié Donzeau-Gouge. A step towards the mechanization of partial functions: Domains as inductive predicates. In M. Kerber, editor, CADE-15, The 15th International Conference on Automated Deduction, pages 53–62, July 1998. WORKSHOP Mechanization of Partial Functions.Google Scholar
16. [Dyb00]
P. Dybjer. A general formulation of simultaneous inductive-recursive definitions in type theory. Journal of Symbolic Logic, 65(2), June 2000.Google Scholar
17. [FFL97]
S. Finn, M.P. Fourman, and J. Longley. Partial functions in a total setting. Journal of Automated Reasoning, 18(1):85–104, 1997.
18. [Gie97]
J. Giesl. Termination of nested and mutually recursive algorithms. Journal of Automated Reasoning, 19:1–29, 1997.
19. [HA00]
J. Harrison and M. Aagaard, editors. Theorem Proving in Higher Order Logics: 13th International Conference, TPHOLs 2000, volume 1869 of Lecture Notes in Computer Science. Springer-Verlag, 2000.
20. [How80]
W. A. Howard. The formulae-as-types notion of construction. In J. P. Seldin and J. R. Hindley, editors, To H.B. Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism, pages 479–490. Academic Press, London, 1980.Google Scholar
21. [JHe+99]
S. Peyton Jones, J. Hughes, (editors), L. Augustsson, D. Barton, B. Boutel, W. Burton, J. Fasel, K. Hammond, R. Hinze, P. Hudak, T. Johnsson, M. Jones, J. Launchbury, E. Meijer, J. Peterson, A. Reid, C. Runciman, and P. Wadler. Report on the Programming Language Haskell 98, a Nonstrict, Purely Functional Language. Available from http://haskell.org, February 1999.
22. [ML84]
P. Martin-Löf. Intuitionistic Type Theory. Bibliopolis, Napoli, 1984.
23. [MM70]
Z. Manna and J. McCarthy. Properties of programs and partial function logic. Machine Intelligence, 5:27–37, 1970.
24. [MM02]
C. McBride and J. McKinna. The view from the left, 2002. Under consideration for publication in Journal of Functional Programming.Google Scholar
25. [Nor88]
B. Nordström. Terminating General Recursion. BIT, 28(3):605–619, October 1988.
26. [NPS90]
B. Nordström, K. Petersson, and J. M. Smith. Programming in Martin-Löf’s Type Theory. An Introduction. Oxford University Press, 1990.Google Scholar
27. [Pau86]
L. C. Paulson. Proving Termination of Normalization Functions for Conditional Expressions. Journal of Automated Reasoning, 2:63–74, 1986.
28. [Sli96]
K. Slind. Function definition in higher-order logic. In Theorem Proving in Higher Order Logics, volume 1125 of Lecture Notes in Computer Science, Turku, Finland, August 1996.Google Scholar
29. [Sli00]
K. Slind. Another look at nested recursion. In Harrison and Aagaard [HA00], pages 498–518.