TLCA 2007: Typed Lambda Calculi and Applications pp 70-83 | Cite as
Computation by Prophecy
Abstract
We describe a new method to represent (partial) recursive functions in type theory. For every recursive definition, we define a co-inductive type of prophecies that characterises the traces of the computation of the function. The structure of a prophecy is a possibly infinite tree, which is coerced by linearisation to a type of partial results defined by applying the delay monad to the co-domain of the function. Using induction on a weight relation defined on the prophecies, we can reason about them and prove that the formal type-theoretic version of the recursive function, resulting from the present method, satisfies the recursive equations of the original function. The advantages of this technique over the method previously developed by the authors via a special-purpose accessibility (domain) predicate are: there is no need of extra logical arguments in the definition of the recursive function; the function can be applied to any element in its domain, regardless of termination properties; we obtain a type of partial recursive functions between any two given types; and composition of recursive functions can be easily defined.
Keywords
Type Theory Recursive Function Recursive Call Recursive Equation Proof AssistantPreview
Unable to display preview. Download preview PDF.
References
- 1.Balaa, A., Bertot, Y.: 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
- 2.Barthe, G., Courtieu, P.: Efficient reasoning about executable specifications in Coq. In: Carreño, V.A., Muñoz, C.A., Tahar, S. (eds.) TPHOLs 2002. LNCS, vol. 2410, pp. 31–46. Springer, Heidelberg (2002)CrossRefGoogle Scholar
- 3.Bertot, Y., Castéran, P.: Interactive Theorem Proving and Program Development. Coq’Art: The Calculus of Inductive Constructions. Springer, Heidelberg (2004)MATHGoogle Scholar
- 4.Bove, A.: General recursion in type theory. In: Geuvers, H., Wiedijk, F. (eds.) TYPES 2002. LNCS, vol. 2646, pp. 39–58. Springer, Heidelberg (2003)Google Scholar
- 5.Bove, A., Capretta, V.: Nested general recursion and partiality in type theory. In: Boulton, R.J., Jackson, P.B. (eds.) TPHOLs 2001. LNCS, vol. 2152, pp. 121–135. Springer, Heidelberg (2001)Google Scholar
- 6.Bove, A., Capretta, V.: Modelling general recursion in type theory. Mathematical Structures in Computer Science 15(4), 671–708 (2005)MATHCrossRefGoogle Scholar
- 7.Bove, A., Capretta, V.: Recursive functions with higher order domains. In: Urzyczyn, P. (ed.) TLCA 2005. LNCS, vol. 3461, pp. 116–130. Springer, Heidelberg (2005)Google Scholar
- 8.Capretta, V.: General recursion via coinductive types. Logical Methods in Computer Science 1(2), 1–18 (2005)CrossRefGoogle Scholar
- 9.Capretta, V., Uustalu, T., Vene, V.: Recursive coalgebras from comonads. Information and Computation 204(4), 437–468 (2006)MATHCrossRefGoogle Scholar
- 10.Dybjer, P.: A general formulation of simultaneous inductive-recursive definitions in type theory. Journal of Symbolic Logic, 65(2) (2000)Google Scholar
- 11.Giménez, E.: Codifying guarded definitions with recursive schemes. In: Smith, J., Dybjer, P., Nordström, B. (eds.) TYPES 1994. LNCS, vol. 996, pp. 39–59. Springer, Heidelberg (1995)Google Scholar
- 12.McBride, C., McKinna, J.: The view from the left. Journal of Functional Programming 14(1), 69–111 (2004)MATHCrossRefGoogle Scholar
- 13.Reynolds, J.C.: The discoveries of continuations. Lisp and Symbolic Computation 6(3-4), 233–248 (1993)CrossRefGoogle Scholar
- 14.The Coq Development Team. LogiCal Project. The Coq Proof Assistant. Reference Manual. Version 8. INRIA (2004), Available at the web page http://pauillac.inria.fr/coq/coq-eng.html