Recursive Functions with Higher Order Domains
In a series of articles, we developed a method to translate general recursive functions written in a functional programming style into constructive type theory. Three problems remained: the method could not properly deal with functions taking functional arguments, the translation of terms containing λ-abstractions was too strict, and partial application of general recursive functions was not allowed. Here, we show how the three problems can be solved by defining a type of partial functions between given types. Every function, including arguments to higher order functions, λ-abstractions and partially applied functions, is then translated as a pair consisting of a domain predicate and a function dependent on the predicate. Higher order functions are assigned domain predicates that inherit termination conditions from their functional arguments. The translation of a λ-abstraction does not need to be total anymore, but generates a local termination condition. The domain predicate of a partially applied function is defined by fixing the given arguments in the domain of the original function. As in our previous articles, simultaneous induction-recursion is required to deal with nested recursive functions. Since by using our method the inductive definition of the domain predicate can refer globally to the domain predicate itself, here we need to work on an impredicative type theory for the method to apply to all functions. However, in most practical cases the method can be adapted to work on a predicative type theory with type universes.
Unable to display preview. Download preview PDF.
- [BC04]Bove, A., Capretta, V.: Modelling general recursion in type theory. To appear in Mathematical Structures in Computer Science (May 2004) Available on the WWW: http://www.cs.chalmers.se/~bove/Papers/general_presentation.ps.gz
- [Bov02a]Bove, A.: Mutual general recursion in type theory. Technical Report, Chalmers University of Technology (May 2002) Available on the WWW: http://www.cs.chalmers.se/~bove/Papers/mutual_rec.ps.gz
- [Bov02b]Bove, A.: General Recursion in Type Theory. PhD thesis, Chalmers University of Technology, Department of Computing Science (November 2002) Available on the WWW: http://cs.chalmers.se/~bove/Papers/phd_thesis.ps.gz
- [Cap04]Caprett, V.: A polymorphic representation of induction-recursion. Draft paper (2004), Available from, http://www.science.uottawa.ca/~vcapr396/
- [CM85]Constable, R.L., Mendler, N.P.: Recursive definitions in type theory. In: Parikh, R. (ed.) Logic of Programs 1985. LNCS, vol. 193, pp. 61–78. Springer, Heidelberg (1985)Google Scholar
- [Coq02]Coq Development Team. LogiCal Project. The Coq Proof Assistant. Reference Manual. Version 7.4. INRIA (2002)Google Scholar
- [DDG98]Dubois, C., Donzeau-Gouge, V.V.: A step towards the mechanization of partial functions: Domains as inductive predicates. In: Kerber, M. (ed.) CADE-15, The 15th International Conference on Automated Deduction, Workshop Mechanization of Partial Functions, July 1998, pp. 53–62 (1998)Google Scholar
- [Dyb00]Dybjer, P.: A general formulation of simultaneous inductive-recursive definitions in type theory. Journal of Symbolic Logic 65(2) (June 2000)Google Scholar
- [Jon03]Peyton Jones, S. (ed.): Haskell 98 Language and Libraries. The Revised Report. Cambridge University Press (April 2003)Google Scholar
- [Pau]Paulin, C.: How widely applicable is Coq? Contribution to the Coq mailing list, 19 (August 2002), http://pauillac.inria.fr/bin/wilma_hiliter/coq-club/200208/msg00003.html