Partiality and recursion in interactive theorem provers – an overview

The use of interactive theorem provers to establish the correctness of critical parts of a software development or for formalizing mathematics is becoming more common and feasible in practice. However, most mature theorem provers lack a direct treatment of partial and general recursive functions; overcoming this weakness has been the objective of intensive research during the last decades. In this article, we review several techniques that have been proposed in the literature to simplify the formalization of partial and general recursive functions in interactive theorem provers. Moreover, we classify the techniques according to their theoretical basis and their practical use. This uniform presentation of the different techniques facilitates the comparison and highlights their commonalities and differences, as well as their relative advantages and limitations. We focus on theorem provers based on constructive type theory (in particular, Agda and Coq) and higher-order logic (in particular Isabelle/HOL). Other systems and logics are covered to a certain extent, but not exhaustively. In addition to the description of the techniques, we also demonstrate tools which facilitate working with the problematic functions in particular theorem provers.

[1]  Yves Bertot,et al.  Fixed point semantics and partial recursion in Coq , 2008, PPDP.

[2]  Thierry Coquand,et al.  The Calculus of Constructions , 1988, Inf. Comput..

[3]  Bas Luttik,et al.  Split-2 bisimilarity has a finite axiomatization over CCS with Hennessy's merge , 2004, Log. Methods Comput. Sci..

[4]  Robert L. Constable,et al.  Recursive Definitions in Type Theory , 1985, Logic of Programs.

[5]  Brian Huffman,et al.  Reasoning with Powerdomains in Isabelle / HOLCF , 2008 .

[6]  Jürgen Giesl Termination of Nested and Mutually Recursive Algorithms , 2004, Journal of Automated Reasoning.

[7]  Tobias Nipkow,et al.  Code Generation via Higher-Order Rewrite Systems , 2010, FLOPS.

[8]  Zohar Manna,et al.  The Theoretical Aspects of the Optimal Fixed Point , 1976, SIAM J. Comput..

[9]  Lawrence Charles Paulson,et al.  Isabelle/HOL: A Proof Assistant for Higher-Order Logic , 2002 .

[10]  William A. Howard,et al.  The formulae-as-types notion of construction , 1969 .

[11]  Philippe Audebaud,et al.  Partial objects in the calculus of constructions , 1991, [1991] Proceedings Sixth Annual IEEE Symposium on Logic in Computer Science.

[12]  Peter Dybjer,et al.  Intuitionistic Type Theory , 2016 .

[13]  P. Dybjer Inductive sets and families in Martin-Lo¨f's type theory and their set-theoretic semantics , 1991 .

[14]  Maria Paola Bonacina,et al.  Automated Reasoning , 2014, Lecture Notes in Computer Science.

[15]  David Greve Assuming termination , 2009, ACL2 '09.

[16]  Andreas Abel foetus - Termination Checker for Simple Functional Programs , 2002 .

[17]  Tobias Nipkow,et al.  The Isabelle Framework , 2008, TPHOLs.

[18]  Lawrence C. Paulson,et al.  Constructing Recursion Operators in Intuitionistic Type Theory , 1986, J. Symb. Comput..

[19]  Marino Miculan,et al.  A Unifying Approach to Recursive and Co-recursive Definitions , 2002, TYPES.

[20]  Amr Sabry,et al.  Proving the correctness of reactive systems using sized types , 1996, POPL '96.

[21]  John Longley,et al.  Partial Functions in a Total Setting , 2004, Journal of Automated Reasoning.

[22]  Benjamin Grégoire,et al.  CIC[^( )]: Type-Based Termination of Recursive Definitions in the Calculus of Inductive Constructions , 2006, LPAR.

[23]  Conor McBride,et al.  Eliminating Dependent Pattern Matching , 2006, Essays Dedicated to Joseph A. Goguen.

[24]  Michael J. C. Gordon,et al.  Edinburgh LCF: A mechanised logic of computation , 1979 .

[25]  John Matthews,et al.  Inductive Invariants for Nested Recursion , 2003, TPHOLs.

[26]  Conor McBride,et al.  Elimination with a Motive , 2000, TYPES.

[27]  Christine Paulin-Mohring A constructive denotational semantics for Kahn networks in Coq , 2009 .

[28]  Conor McBride First-order unification by structural recursion , 2003, J. Funct. Program..

[29]  Benjamin Grégoire,et al.  Type-Based Termination with Sized Products , 2008, CSL.

[30]  Andreas Abel Semi-Continuous Sized Types and Termination , 2008, Log. Methods Comput. Sci..

[31]  Peter Dybjer,et al.  Combining Interactive and Automatic Reasoning in First Order Theories of Functional Programs , 2012, FoSSaCS.

[32]  Ana Bove,et al.  Another Look at Function Domains , 2009, MFPS.

[33]  Robert S. Boyer,et al.  Computational Logic , 1990, ESPRIT Basic Research Series.

[34]  Venanzio Capretta,et al.  A Type of Partial Recursive Functions , 2008, TPHOLs.

[35]  Frédéric Blanqui A Type-Based Termination Criterion for Dependently-Typed Higher-Order Rewrite Systems , 2004, RTA.

[36]  Thorsten Altenkirch,et al.  Under Consideration for Publication in J. Functional Programming a Predicative Analysis of Structural Recursion , 2022 .

[37]  Geoff Sutcliffe The TPTP Problem Library and Associated Infrastructure , 2009, Journal of Automated Reasoning.

[38]  William M. Farmer,et al.  IMPS: An interactive mathematical proof system , 1990, Journal of Automated Reasoning.

[39]  E. D. Giorgi Selected Papers , 2006 .

[40]  Peter Dybjer,et al.  Embedding a logical theory of constructions in Agda , 2009, PLPV '09.

[41]  Arthur Charguéraud The Optimal Fixed Point Combinator , 2010, ITP.

[42]  Tobias Nipkow,et al.  HOLCF = HOL + LCF , 1999, Journal of Functional Programming.

[43]  Konrad Slind,et al.  Function Definition in Higher-Order Logic , 1996, TPHOLs.

[44]  Peter Dybjer,et al.  Program Verification in a Logical Theory of Constructions , 1985, FPCA.

[45]  Peter Aczel,et al.  The Strength of Martin-Löf's Intuitionistic Type Theory with One Universe , 1984 .

[46]  Stefan Berghofer,et al.  Inductive Datatypes in HOL - Lessons Learned in Formal-Logic Engineering , 1999, TPHOLs.

[47]  Peter Dybjer,et al.  A general formulation of simultaneous inductive-recursive definitions in type theory , 2000, Journal of Symbolic Logic.

[48]  Tobias Nipkow,et al.  Executing Higher Order Logic , 2000, TYPES.

[49]  Geoff Sutcliffe The TPTP Problem Library and Associated Infrastructure , 2017, Journal of Automated Reasoning.

[50]  Franz Regensburger,et al.  HOLCF: Higher Order Logic of Computable Functions , 1995, TPHOLs.

[51]  Cliff B. Jones,et al.  Systematic software development using VDM , 1986, Prentice Hall International Series in Computer Science.

[52]  Sofiène Tahar,et al.  Theorem Proving in Higher Order Logics, 21st International Conference, TPHOLs 2008, Montreal, Canada, August 18-21, 2008. Proceedings , 2008, TPHOLs.

[53]  Alexander Krauss Partial Recursive Functions in Higher-Order Logic , 2006, IJCAR.

[54]  Robert S. Boyer,et al.  Mechanized formal reasoning about programs and computing machines , 1997 .

[55]  Eduardo Giménez,et al.  Codifying Guarded Definitions with Recursive Schemes , 1994, TYPES.

[56]  Matthieu Sozeau,et al.  Subset Coercions in Coq , 2006, TYPES.

[57]  William M. Farmer,et al.  A Simple Type Theory with Partial Functions and Subtypes , 1993, Ann. Pure Appl. Log..

[58]  Adam Megacz,et al.  A coinductive monad for prop-bounded recursion , 2007, PLPV.

[59]  Eugenio Moggi,et al.  Notions of Computation and Monads , 1991, Inf. Comput..

[60]  Pierre Courtieu,et al.  Efficient Reasoning about Executable Specifications in Coq , 2002, TPHOLs.

[61]  Dana S. Scott,et al.  A Type-Theoretical Alternative to ISWIM, CUCH, OWHY , 1993, Theor. Comput. Sci..

[62]  Tobias Nipkow,et al.  Finding Lexicographic Orders for Termination Proofs in Isabelle/HOL , 2007, TPHOLs.

[63]  Larry Wos,et al.  What Is Automated Reasoning? , 1987, J. Autom. Reason..

[64]  Cliff B. Jones,et al.  On the Usability of Logics which Handle Partial Functions , 1991 .

[65]  M. Gordon,et al.  Introduction to HOL: a theorem proving environment for higher order logic , 1993 .

[66]  J. Urgen Giesl Induction Proofs with Partial Functions , 1998 .

[67]  Konrad Slind,et al.  Reasoning about terminating functional programs , 1999 .

[68]  Stephan Merz,et al.  Interactive Theorem Proving , 2016, Lecture Notes in Computer Science.

[69]  Benjamin Grégoire,et al.  A Tutorial on Type-Based Termination , 2009, LerNet ALFA Summer School.

[70]  Thierry Coquand,et al.  Inductively defined types , 1988, Conference on Computer Logic.

[71]  Cliff B. Jones,et al.  A logic covering undefinedness in program proofs , 1984, Acta Informatica.

[72]  Luís Pinto,et al.  Type-based termination of recursive definitions , 2004, Mathematical Structures in Computer Science.

[73]  Richard J. Boulton,et al.  Theorem Proving in Higher Order Logics , 2003, Lecture Notes in Computer Science.

[74]  Bengt Nordström,et al.  Programming in Martin-Lo¨f's type theory: an introduction , 1990 .

[75]  Christine Paulin-Mohring,et al.  Inductive Definitions in the system Coq - Rules and Properties , 1993, TLCA.

[76]  Peter Aczel,et al.  An Introduction to Inductive Definitions , 1977 .

[77]  Alexander Krauss,et al.  Partial and Nested Recursive Function Definitions in Higher-order Logic , 2010, Journal of Automated Reasoning.

[78]  Yves Bertot,et al.  Interactive Theorem Proving and Program Development: Coq'Art The Calculus of Inductive Constructions , 2010 .

[79]  Xavier Leroy,et al.  Formal certification of a compiler back-end or: programming a compiler with a proof assistant , 2006, POPL '06.

[80]  Gilles Barthe,et al.  Defining and Reasoning About Recursive Functions: A Practical Tool for the Coq Proof Assistant , 2006, FLOPS.

[81]  Venanzio Capretta,et al.  Computation by Prophecy , 2007, TLCA.

[82]  Venanzio Capretta,et al.  Type-Theoretic Functional Semantics , 2002, TPHOLs.

[83]  John Matthews Recursive Function Definition over Coinductive Types , 1999, TPHOLs.

[84]  Venanzio Capretta,et al.  Recursive Functions with Higher Order Domains , 2005, TLCA.

[85]  Samson Abramsky,et al.  Domain theory , 1995, LICS 1995.

[86]  Reiko Heckel,et al.  Bisimilarity and Behaviour-Preserving Reconfigurations of Open Petri Nets , 2007, Log. Methods Comput. Sci..

[87]  Bengt Nordström Terminating general recursion , 1988, BIT Comput. Sci. Sect..

[88]  Alexander Krauss,et al.  Recursive Definitions of Monadic Functions , 2010, PAR@ITP.

[89]  Hongwei Xi Dependent Types for Program Termination Verification , 2002, High. Order Symb. Comput..

[90]  U. Norell,et al.  Towards a practical programming language based on dependent type theory , 2007 .

[91]  Lawrence C. Paulson,et al.  The foundation of a generic theorem prover , 1989, Journal of Automated Reasoning.

[92]  Brian Huffman A Purely Definitional Universal Domain , 2009, TPHOLs.

[93]  Jim Alves-Foss,et al.  Higher Order Logic Theorem Proving and its Applications 8th International Workshop, Aspen Grove, Ut, Usa, September 11-14, 1995 : Proceedings , 1995 .

[94]  Frédéric Blanqui,et al.  Decidability of Type-Checking in the Calculus of Algebraic Constructions with Size Annotations , 2005, CSL.

[95]  Anton Setzer,et al.  Partial Recursive Functions in Martin-Löf Type Theory , 2006, CiE.

[96]  Konrad Slind,et al.  Adapting functional programs to higher order logic , 2008, High. Order Symb. Comput..

[97]  P. Medawar A view from the left , 1984, Nature.

[98]  Andreas Abel,et al.  MiniAgda: Integrating Sized and Dependent Types , 2010, PAR@ITP.

[99]  Peyton Jones,et al.  Haskell 98 language and libraries : the revised report , 2003 .

[100]  Matthieu Sozeau Equations: A Dependent Pattern-Matching Compiler , 2010, ITP.

[101]  Alexander Krauss,et al.  Certified Size-Change Termination , 2007, CADE.

[102]  Ulrike Wirth,et al.  Automated Reasoning, Third International Joint Conference, IJCAR 2006, Seattle, WA, USA, August 17-20, 2006, Proceedings , 2006, IJCAR.

[103]  Panagiotis Manolios,et al.  Partial Functions in ACL2 , 2003, Journal of Automated Reasoning.

[104]  Robin Milner,et al.  Logic for Computable Functions: description of a machine implementation. , 1972 .

[105]  Venanzio Capretta,et al.  General recursion via coinductive types , 2005, Log. Methods Comput. Sci..

[106]  Tobias Nipkow,et al.  Flyspeck I: Tame Graphs , 2006, IJCAR.

[107]  Jens Brandt,et al.  Theorem Proving in Higher Order Logics , 1997, Lecture Notes in Computer Science.

[108]  Venanzio Capretta,et al.  Modelling general recursion in type theory , 2005, Mathematical Structures in Computer Science.

[109]  David Wahlstedt,et al.  Dependent Type Theory with Parameterized First-Order Data Types and Well-Founded Recursion , 2007 .

[110]  Stefano Berardi,et al.  Types for proofs and programs : International Workshop TYPES '95, Torino, Italy, June 5-8, 1995 : selected papers , 1996 .

[111]  Andreas Abel,et al.  Type-based termination: a polymorphic lambda-calculus with sized higher-order types , 2006 .

[112]  John Harrison,et al.  Inductive Definitions: Automation and Application , 1995, TPHOLs.

[113]  Conor McBride,et al.  Epigram: Practical Programming with Dependent Types , 2004, Advanced Functional Programming.

[114]  Robert L. Constable,et al.  Partial Objects In Constructive Type Theory , 1987, Logic in Computer Science.

[115]  Yves Bertot,et al.  Fix-Point Equations for Well-Founded Recursion in Type Theory , 2000, TPHOLs.