Irrelevance, polymorphism, and erasure in type theory

Dependent type theory is a proven technology for verified functional programming in which programs and their correctness proofs may be developed using the same rules in a single formal system. In practice, large portions of programs developed in this way have no computational relevance to the ultimate result of the program and should therefore be removed prior to program execution. In previous work on identifying and removing irrelevant portions of programs, computational irrelevance is usually treated as an intrinsic property of program expressions. We find that such an approach forces programmers to maintain two copies of commonly used datatypes: a computationally relevant one and a computationally irrelevant one. We instead develop an extrinsic notion of computational irrelevance and find that it yields several benefits including (1) avoidance of the above mentioned code duplication problem; (2) an identification of computational irrelevance with a highly general form of parametric polymorphism; and (3) an elective (i.e., user-directed) notion of proof irrelevance. We also develop a program analysis for identifying irrelevant expressions and show how previously studied types embodying computational irrelevance (including subset types and squash types) are expressible in the extension of type theory developed herein.

[1]  Alexandre Miquel The Implicit Calculus of Constructions , 2001, TLCA.

[2]  Gang Chen,et al.  Guarded recursive datatype constructors , 2003, POPL '03.

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

[4]  John McCarthy,et al.  Recursive functions of symbolic expressions and their computation by machine, Part I , 1960, Commun. ACM.

[5]  John C. Reynolds,et al.  Types, Abstraction and Parametric Polymorphism , 1983, IFIP Congress.

[6]  Mitchell Wand,et al.  Constraint systems for useless variable elimination , 1999, POPL '99.

[7]  Frank Pfenning,et al.  Intensionality, extensionality, and proof irrelevance in modal type theory , 2001, Proceedings 16th Annual IEEE Symposium on Logic in Computer Science.

[8]  James Cheney,et al.  First-Class Phantom Types , 2003 .

[9]  Ian Mackie,et al.  Reduction Strategies for Program Extraction , 2003, CLEI Electron. J..

[10]  P. J. Landin,et al.  A correspondence between ALGOL 60 and Church's Lambda-notations: Part II , 1965, CACM.

[11]  Emir Pasalic,et al.  Meta-programming With Built-in Type Equality , 2008, Electron. Notes Theor. Comput. Sci..

[12]  Naoki Kobayashi Type-based useless variable elimination , 1999, PEPM '00.

[13]  Ulrich Berger,et al.  Program Extraction from Normalization Proofs , 2006, Stud Logica.

[14]  Maribel Fernández,et al.  An Operational Approach to Program Extraction in the Calculus of Constructions , 2002, LOPSTR.

[15]  Conor McBride,et al.  Inductive Families Need Not Store Their Indices , 2003, TYPES.

[16]  Pierre Letouzey,et al.  A New Extraction for Coq , 2002, TYPES.

[17]  Roland Carl Backhouse,et al.  Do-it-yourself type theory , 1989, Formal Aspects of Computing.

[18]  Anne Salvesen,et al.  The strength of the subset type in Martin-Lof's type theory , 1988, [1988] Proceedings. Third Annual Information Symposium on Logic in Computer Science.

[19]  Christopher Strachey,et al.  Fundamental Concepts in Programming Languages , 2000, High. Order Symb. Comput..

[20]  Paula Severi,et al.  Studies of a Theory of Specifications with Built-in Program Extraction , 2004, Journal of Automated Reasoning.

[21]  Paola Giannini,et al.  Refinement Types for Program Analysis , 1996, SAS.

[22]  Paula Severi,et al.  Eliminating Proofs from Programs , 2002, Electron. Notes Theor. Comput. Sci..

[23]  F. Dick A survey of the project Automath , 1980 .

[24]  William W. Tait,et al.  Intensional interpretations of functionals of finite type I , 1967, Journal of Symbolic Logic.

[25]  Simon J. Thompson,et al.  Are Subsets Necessary in Martin-Löf Type Theory? , 1992, Constructivity in Computer Science.

[26]  Stefano Berardi,et al.  Selected papers from the International Workshop on Types for Proofs and Programs , 1995 .

[27]  Zhaohui Luo,et al.  Computation and reasoning - a type theory for computer science , 1994, International series of monographs on computer science.

[28]  Stephen Cole Kleene,et al.  On the interpretation of intuitionistic number theory , 1945, Journal of Symbolic Logic.

[29]  P. J. Landin,et al.  The next 700 programming languages , 1966, CACM.

[30]  Yu Guo,et al.  Foundational Typed Assembly Language with Certified Garbage Collection , 2007, First Joint IEEE/IFIP Symposium on Theoretical Aspects of Software Engineering (TASE '07).

[31]  Joe B. Wells,et al.  Typability and Type Checking in System F are Equivalent and Undecidable , 1999, Ann. Pure Appl. Log..

[32]  Conor McBride,et al.  The view from the left , 2004, Journal of Functional Programming.

[33]  P. J. Landin The Mechanical Evaluation of Expressions , 1964, Comput. J..

[34]  G. Gentzen Untersuchungen über das logische Schließen. I , 1935 .

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

[36]  Conor McBride,et al.  Dependently typed functional programs and their proofs , 2000 .

[37]  P. Martin-Löf An Intuitionistic Theory of Types: Predicative Part , 1975 .

[38]  Olin Shivers,et al.  Control-flow analysis of higher-order languages of taming lambda , 1991 .

[39]  Conor McBride,et al.  Applicative programming with effects , 2008, J. Funct. Program..

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

[41]  Bas Spitters,et al.  Program Extraction from Large Proof Developments , 2003, TPHOLs.

[42]  Chiyan Chen,et al.  Combining programming with theorem proving , 2005, ICFP '05.

[43]  Luca Boerio Extending Pruning Techniques to Polymorphic Second order Lambda-Calculus , 1994, ESOP.

[44]  Gerhard Gentzen,et al.  Investigations into Logical Deduction , 1970 .

[45]  Christine Paulin-Mohring,et al.  Extracting ω's programs from proofs in the calculus of constructions , 1989, POPL '89.

[46]  Simon L. Peyton Jones,et al.  Simple unification-based type inference for GADTs , 2006, ICFP '06.

[47]  J. Y. Girard,et al.  Interpretation fonctionelle et elimination des coupures dans l'aritmetique d'ordre superieur , 1972 .

[48]  Lennart Augustsson,et al.  Cayenne—a language with dependent types , 1998, ICFP '98.

[49]  Tim Sheard Languages of the future , 2004, ACM SIGPLAN Notices.

[50]  M. E. Szabo,et al.  The collected papers of Gerhard Gentzen , 1969 .

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

[52]  Joyce L. Vedral,et al.  Functional Programming Languages and Computer Architecture , 1989, Lecture Notes in Computer Science.

[53]  Xavier Leroy,et al.  Formal Verification of a C Compiler Front-End , 2006, FM.

[54]  Hendrik Pieter Barendregt,et al.  Introduction to generalized type systems , 1991, Journal of Functional Programming.

[55]  J. C. Reynolds An Introduction to the Polymorphic Lambda Calculus , 1994 .

[56]  Stefano Berardi,et al.  Pruning Simply Typed Lambda-Terms , 1996, J. Log. Comput..

[57]  L. S. van Benthem Jutting Typing in Pure Type Systems , 1993, Inf. Comput..

[58]  Luca Cardelli,et al.  Phase Distinctions in Type Theory , 1988 .

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

[60]  Paola Giannini,et al.  Type-Based Useless-Code Elimination for Functional Programs , 2000, SAIG.

[61]  William C. Frederick,et al.  A Combinatory Logic , 1995 .

[62]  A. Church A Set of Postulates for the Foundation of Logic , 1932 .

[63]  Philip Wadler,et al.  Theorems for free! , 1989, FPCA.

[64]  Thierry Coquand,et al.  An Introduction to Dependent Type Theory , 2000, APPSEM.

[65]  M. Hofmann,et al.  The groupoid interpretation of type theory , 1998 .

[66]  David B. MacQueen Using dependent types to express modular structure , 1986, POPL '86.

[67]  Bengt Nordström,et al.  Programming in Martin-Löf's Type Theory , 1990 .

[68]  Sharad Malik,et al.  Chaff: engineering an efficient SAT solver , 2001, Proceedings of the 38th Design Automation Conference (IEEE Cat. No.01CH37232).

[69]  J. Girard Une Extension De ĽInterpretation De Gödel a ĽAnalyse, Et Son Application a ĽElimination Des Coupures Dans ĽAnalyse Et La Theorie Des Types , 1971 .

[70]  Frank Pfenning,et al.  Dependent types in practical programming , 1999, POPL '99.

[71]  Ulrich Berger,et al.  Uniform Heyting arithmetic , 2005, Ann. Pure Appl. Log..

[72]  John C. Mitchell,et al.  Higher-order modules and the phase distinction , 1989, POPL '90.

[73]  Anne Salvesen On specifications, subset types and interpretation of proposition in type theory , 1992, BIT Comput. Sci. Sect..

[74]  John Hannan,et al.  Type Systems for Useless-Variable Elimination , 2001, PADO.

[75]  T. Coquand Une théorie des constructions , 1985 .

[76]  Alberto Momigliano,et al.  Elimination of Negation in a Logical Framework , 2000, CSL.

[77]  John C. Reynolds,et al.  Towards a theory of type structure , 1974, Symposium on Programming.

[78]  Thierry Coquand,et al.  Pattern Matching with Dependent Types , 1992 .

[79]  Robert L. Constable,et al.  Decidability Extracted: Synthesizing "Correct-by-Construction" Decision Procedures form Constructive Proofs , 1998 .

[80]  Haskell B. Curry,et al.  Combinatory Logic, Volume I , 1959 .

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

[82]  Olin Shivers Useless-Variable Elimination , 1991, JTASPEFT/WSA.

[83]  P. J. Landin,et al.  Correspondence between ALGOL 60 and Church's Lambda-notation , 1965, Commun. ACM.

[84]  Alonzo Church,et al.  A formulation of the simple theory of types , 1940, Journal of Symbolic Logic.

[85]  Edwin Brady,et al.  Practical implementation of a dependently typed functional programming language , 2005 .

[86]  Alexandre Miquel A model for impredicative type systems, universes, intersection types and subtyping , 2000, Proceedings Fifteenth Annual IEEE Symposium on Logic in Computer Science (Cat. No.99CB36332).