Dependent Pattern Matching and Proof-Relevant Unification

Dependent type theory is a powerful language for writing functional programs with very precise types. It is used to write not only programs but also mathematical proofs that these programs satisfy certain properties. Because of this, languages based on dependent types – such as Coq, Agda, and Idris – are used both as programming languages and as interactive proof assistants. While dependent types give strong guarantees about your programs and proofs, they also impose equally strong requirements on them. This often makes it harder to write programs in a dependently typed language compared to one with a simpler type system. For this reason certain techniques have been developed, such as dependent pattern matching and specialization by unification. These techniques provide an intuitive way to write programs and proofs in dependently typed languages. Previously, dependent pattern matching had only been shown to work in a limited setting. In particular, it relied on the K axiom – also known as the uniqueness of identity proofs – to remove equations of the form x = x. This axiom is inadmissible in many type theories, particularly in the new and promising branch known as homotopy type theory (HoTT). As a result, programs and proofs in these new theories cannot make use of dependent pattern matching and are as a result much harder to write, modify, and understand. Additionally, the interaction of dependent pattern matching with small but practical features such as eta-equality for record types and postponing of unification constraints was poorly understood, resulting in subtle bugs and inconsistencies. In this thesis, we develop dependent pattern matching and unification in a general setting that does not require the K axiom, both from a theoretical perspective and a practical one. In particular, we present a proof-relevant unification algorithm, where each unification rule produces evidence of its correctness. This evidence guarantees that all unification rules are correct by

[1]  Andreas Abel,et al.  Sprinkles of extensionality for your vanilla type theory , 2016 .

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

[3]  Neil D. Jones,et al.  The size-change principle for program termination , 2001, POPL '01.

[4]  Lennart Augustsson,et al.  Compiling Pattern Matching , 1985, FPCA.

[5]  Conor McBride,et al.  Inverting Inductively Defined Relations in LEGO , 1996, TYPES.

[6]  Thierry Coquand,et al.  Cubical Type Theory: A Constructive Interpretation of the Univalence Axiom , 2015, TYPES.

[7]  Matthieu Sozeau,et al.  A unification algorithm for Coq featuring universe polymorphism and overloading , 2015, ICFP.

[8]  J. Monin Proof Trick: Small Inversions , 2010 .

[9]  Dominique Devriese,et al.  Unifiers as equivalences: proof-relevant unification of dependently typed data , 2016, ICFP.

[10]  Cristina Cornes,et al.  Automating Inversion of Inductive Predicates in Coq , 1995, TYPES.

[11]  Dominique Devriese,et al.  Overlapping and Order-Independent Patterns - Definitional Equality for All , 2014, ESOP.

[12]  Dale Miller,et al.  A Logic Programming Language with Lambda-Abstraction, Function Variables, and Simple Unification , 1991, J. Log. Comput..

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

[14]  Dominique Devriese,et al.  Lifting proof-relevant unification to higher dimensions , 2017, CPP.

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

[16]  de Ng Dick Bruijn,et al.  The mathematical language AUTOMATH, its usage, and some of its extensions , 1970 .

[17]  Pierre Boutillier,et al.  De nouveaux outils pour calculer avec des inductifs en Coq. (New tool to compute with inductive in Coq) , 2014 .

[18]  H B Curry,et al.  Functionality in Combinatory Logic. , 1934, Proceedings of the National Academy of Sciences of the United States of America.

[19]  Dominique Devriese,et al.  Eliminating dependent pattern matching without K , 2016, Journal of Functional Programming.

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

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

[22]  Conor McBride,et al.  A Few Constructions on Constructors , 2004, TYPES.

[23]  Christian Sattler,et al.  Higher Homotopies in a Hierarchy of Univalent Universes , 2013, ACM Trans. Comput. Log..

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

[25]  Claude Kirchner,et al.  Solving Equations in Abstract Algebras: A Rule-Based Survey of Unification , 1991, Computational Logic - Essays in Honor of Alan Robinson.

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

[27]  Martin Hofmann,et al.  The groupoid model refutes uniqueness of identity proofs , 1994, Proceedings Ninth Annual IEEE Symposium on Logic in Computer Science.

[28]  Jeremy Avigad,et al.  The Lean Theorem Prover (System Description) , 2015, CADE.

[29]  Franz Baader,et al.  Unification theory , 1986, Decis. Support Syst..

[30]  Dominique Devriese,et al.  Pattern matching without K , 2014, ICFP.

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

[32]  Anton Setzer,et al.  Inductive-Inductive Definitions , 2010, CSL.

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

[34]  Benjamin Grégoire,et al.  A New Elimination Rule for the Calculus of Inductive Constructions , 2008, TYPES.

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

[36]  Pierre-Évariste Dagand,et al.  A cosmology of datatypes : reusability and dependent types , 2013 .

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

[38]  Stefan Bauer-Mengelberg,et al.  On the Significance of the Principle of Excluded Middle in Mathematics, Especially in Function Theory , 1970 .

[39]  Thierry Coquand,et al.  A Model of Type Theory in Cubical Sets , 2013, TYPES.

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

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

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

[43]  Joseph A. Goguen,et al.  What Is Unification?: A Categorical View of Substitution, Equation and Solution , 1989 .

[44]  Andrea Asperti,et al.  Hints in Unification , 2009, TPHOLs.

[45]  Daniel R. Licata,et al.  Calculating the Fundamental Group of the Circle in Homotopy Type Theory , 2013, 2013 28th Annual ACM/IEEE Symposium on Logic in Computer Science.

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

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

[48]  Conor McBride,et al.  New equations for neutral terms: a sound and complete decision procedure, formalized , 2013, DTP '13.

[49]  Edwin Brady,et al.  Idris, a general-purpose dependently typed programming language: Design and implementation , 2013, Journal of Functional Programming.

[50]  James McKinna,et al.  The encode-decode method, relationally , 2015 .

[51]  Andreas Abel Irrelevance in Type Theory with a Heterogeneous Equality Judgement , 2011, FoSSaCS.

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

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