Dependent types and program equivalence

The definition of type equivalence is one of the most important design issues for any typed language. In dependently typed languages, because terms appear in types, this definition must rely on a definition of term equivalence. In that case, decidability of type checking requires decidability for the term equivalence relation. Almost all dependently-typed languages require this relation to be decidable. Some, such as Coq, Epigram or Agda, do so by employing analyses to force all programs to terminate. Conversely, others, such as DML, ATS, Ωmega, or Haskell, allow nonterminating computation, but do not allow those terms to appear in types. Instead, they identify a terminating index language and use singleton types to connect indices to computation. In both cases, decidable type checking comes at a cost, in terms of complexity and expressiveness. Conversely, the benefits to be gained by decidable type checking are modest. Termination analyses allow dependently typed programs to verify total correctness properties. However, decidable type checking is not a prerequisite for type safety. Furthermore, decidability does not imply tractability. A decidable approximation of program equivalence may not be useful in practice. Therefore, we take a different approach: instead of a fixed notion for term equivalence, we parameterize our type system with an abstract relation that is not necessarily decidable. We then design a novel set of typing rules that require only weak properties of this abstract relation in the proof of the preservation and progress lemmas. This design provides flexibility: we compare valid instantiations of term equivalence which range from beta-equivalence, to contextual equivalence, to some exotic equivalences.

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

[2]  Thorsten Altenkirch,et al.  ΠΣ : A Core Language for Dependently Typed Programming , 2008 .

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

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

[5]  T. Coquand An algorithm for testing conversion in type theory , 1991 .

[6]  David Walker,et al.  Dynamic Typing with Dependent Types , 2004, IFIP TCS.

[7]  Tim Sheard,et al.  Type-level Computation Using Narrowing in Omegamega , 2007, PLPV@IJCAR.

[8]  Mark P. Jones,et al.  A system of constructor classes: overloading and implicit higher-order polymorphism , 1993, FPCA '93.

[9]  Daniel R. Licata,et al.  A Formulation of Dependent ML with Explicit Equality Proofs , 2005 .

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

[11]  Tim Sheard,et al.  Type - level computation using narrowing in Omega , 2006 .

[12]  Henk Barendregt,et al.  The Lambda Calculus: Its Syntax and Semantics , 1985 .

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

[14]  Stephanie Weirich,et al.  LNgen: Tool Support for Locally Nameless Representations , 2010 .

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

[16]  Hugo Herbelin,et al.  The Coq proof assistant : reference manual, version 6.1 , 1997 .

[17]  Patrick Maxim Rondon,et al.  Liquid types , 2008, PLDI '08.

[18]  Timothy W. Simpson,et al.  Verified programming in Guru , 2009, PLPV '09.

[19]  Walid Taha,et al.  Concoqtion: indexed types now! , 2007, PEPM '07.

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

[21]  Wouter Swierstra,et al.  The power of Pi , 2008, ICFP 2008.

[22]  Yann Régis-Gianas,et al.  Stratified type inference for generalized algebraic data types , 2006, POPL '06.

[23]  Nathan Mishra-Linger,et al.  Erasure and Polymorphism in Pure Type Systems , 2008, FoSSaCS.

[24]  Luca Cardelli A Polymorphic Lambda Calculus with Type:Type , 1986 .

[25]  Carolyn L. Talcott,et al.  1 Equivalence in Functional Languages with E ectsIan , 2007 .

[26]  Mark P. Jones A system of constructor classes: overloading and implicit higher-order polymorphism , 1993, FPCA '93.

[27]  Robert Harper,et al.  Abstract 1 Introduction , 2022 .

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

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

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

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

[32]  Tom Ridge,et al.  Ott: effective tool support for the working semanticist , 2007, ICFP '07.

[33]  Lars Birkedal,et al.  Ynot: dependent types for imperative programs , 2008, ICFP 2008.

[34]  Matthias Felleisen,et al.  A Syntactic Approach to Type Soundness , 1994, Inf. Comput..