An insider's look at LF type reconstruction: everything you (n)ever wanted to know

Although type reconstruction for dependently typed languages is common in practical systems, it is still ill-understood. Detailed descriptions of the issues around it are hard to find and formal descriptions together with correctness proofs are non-existing. In this paper, we discuss a one-pass type reconstruction for objects in the logical framework LF, describe formally the type reconstruction process using the framework of contextual modal types, and prove correctness of type reconstruction. Since type reconstruction will find most general types and may leave free variables, we in addition describe abstraction which will return a closed object where all free variables are bound at the outside. We also implemented our algorithms as part of the Beluga language, and the performance of our type reconstruction algorithm is comparable to type reconstruction in existing systems such as the logical framework Twelf.

[1]  Richard Statman,et al.  Higher-Order Rewriting with Dependent Types , 1999 .

[2]  George C. Necula,et al.  Efficient Representation and Validation of Logical Proofs , 1997, LICS 1997.

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

[4]  Furio Honsell,et al.  A framework for defining logics , 1993, JACM.

[5]  Frank Pfenning,et al.  System Description: Twelf - A Meta-Logical Framework for Deductive Systems , 1999, CADE.

[6]  Noam Zeilberger,et al.  Focusing on Binding and Computation , 2008, 2008 23rd Annual IEEE Symposium on Logic in Computer Science.

[7]  Brigitte Pientka Proof Pearl: The Power of Higher-Order Encodings in the Logical Framework LF , 2007, TPHOLs.

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

[9]  Claude Kirchner,et al.  Higher-order unification via explicit substitutions , 1995, Proceedings of Tenth Annual IEEE Symposium on Logic in Computer Science.

[10]  Karl Crary,et al.  Towards a mechanized metatheory of standard ML , 2007, POPL '07.

[11]  Patrick J. Hayes,et al.  Computation and Deduction , 1973, MFCS.

[12]  F. Pfenning Logic programming in the LF logical framework , 1991 .

[13]  George C. Necula,et al.  Proof-Carrying Code , 2011, Encyclopedia of Cryptography and Security.

[14]  Arthur Charguéraud,et al.  Engineering formal metatheory , 2008, POPL '08.

[15]  Frank Pfenning,et al.  A Linear Spine Calculus , 2003, J. Log. Comput..

[16]  Robert Harper,et al.  Mechanizing metatheory in a logical framework , 2007, Journal of Functional Programming.

[17]  Jason Reed Redundancy Elimination for LF , 2008, Electron. Notes Theor. Comput. Sci..

[18]  Frank Pfenning,et al.  A Coverage Checking Algorithm for LF , 2003, TPHOLs.

[19]  Jason Reed,et al.  Higher-order constraint simplification in dependent type theory , 2009, LFMTP '09.

[20]  Brigitte Pientka,et al.  Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description) , 2010, IJCAR.

[21]  Brigitte Pientka A type-theoretic foundation for programming with higher-order abstract syntax and first-class substitutions , 2008, POPL '08.

[22]  D. Walker,et al.  A concurrent logical framework I: Judgments and properties , 2003 .

[23]  Karl Crary,et al.  Toward a foundational typed assembly language , 2003, POPL '03.

[24]  Dale Miller Unification Of Simply Typed Lambda-Terms As Logic Programming MS-CIS-91-24 LINC LAB 198 , 2014 .

[25]  Masami Hagiya,et al.  On Implicit Arguments , 1994, Logic, Language and Computation.

[26]  Frank Pfenning,et al.  Contextual modal type theory , 2008, TOCL.

[27]  Bruno Barras,et al.  The Implicit Calculus of Constructions as a Programming Language with Dependent Types , 2008, FoSSaCS.

[28]  Alexandre Miquel,et al.  The Implicit Calculus of Constructions Extending Pure Type Systems with an Intersection Type Binder and Subtyping , 2001 .

[29]  Frank Pfenning,et al.  Tabled higher-order logic programming , 2003 .

[30]  Marko Luther,et al.  More On Implicit Syntax , 2001, IJCAR.

[31]  Satoru Takasu Logic, Language and Computation, Festschrift in Honor of Satoru Takasu , 1994, Logic, Language and Computation.

[32]  Robert Harper,et al.  An Extensible Theory of Indexed Types , 2007 .

[33]  Gilles Dowek,et al.  The Undecidability of Typability in the Lambda-Pi-Calculus , 1993, TLCA.

[34]  Martín Abadi,et al.  Explicit substitutions , 1989, POPL '90.

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

[36]  Brigitte Pientka,et al.  Programming with proofs and explicit contexts , 2008, PPDP '08.

[37]  Carsten Schürmann,et al.  Practical Programming with Higher-Order Encodings and Dependent Types , 2008, ESOP.

[38]  Carsten Schürmann,et al.  System Description: Delphin - A Functional Programming Language for Deductive Systems , 2008, LFMTP@LICS.

[39]  Claude Kirchner,et al.  Unification via Explicit Substitutions: The Case of Higher-Order Patterns , 1996, JICSLP.