Automatically Proving Equivalence by Type-Safe Reflection

One difficulty with reasoning and programming with dependent types is that proof obligations arise naturally once programs become even moderately sized. For example, implementing an adder for binary numbers indexed over their natural number equivalents naturally leads to proof obligations for equalities of expressions over natural numbers. The need for these equality proofs comes, in intensional type theories, from the fact that the propositional equality enables us to prove as equal terms that are not judgementally equal, which means that the typechecker can’t always obtain equalities by reduction. As far as possible, we would like to solve such proof obligations automatically. In this paper, we show one way to automate these proofs by reflection in the dependently typed programming language Idris. We show how defining reflected terms indexed by the original Idris expression allows us to construct and manipulate proofs. We build a hierarchy of tactics for proving equivalences in semi-groups, monoids, commutative monoids, groups, commutative groups, semi-rings and rings. We also show how each tactic reuses those from simpler structures, thus avoiding duplication of code and proofs.

[1]  Adam Chlipala,et al.  Certified Programming with Dependent Types - A Pragmatic Introduction to the Coq Proof Assistant , 2013 .

[2]  Claude Kirchner,et al.  Theorem Proving Modulo , 2003, Journal of Automated Reasoning.

[3]  Viktor Vafeiadis,et al.  Mtac: A monad for typed tactic programming in Coq , 2015, J. Funct. Program..

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

[5]  David Delahaye,et al.  A Proof Dedicated Meta-Language , 2002, LFM.

[6]  Adam Chlipala,et al.  Compositional Computational Reflection , 2014, ITP.

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

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

[9]  Fredrik Lindblad,et al.  A Tool for Automated Theorem Proving in Agda , 2004, TYPES.

[10]  Damien Doligez,et al.  Zenon Modulo: When Achilles Outruns the Tortoise Using Deduction Modulo , 2013, LPAR.

[11]  William M. Farmer The Formalization of Syntax-Based Mathematical Algorithms Using Quotation and Evaluation , 2013, MKM/Calculemus/DML.

[12]  David Delahaye,et al.  Field, une procédure de décision pour les nombres réels en Coq , 2001, JFLA.

[13]  Wouter Swierstra,et al.  Auto in Agda - Programming Proof Search Using Reflection , 2015, MPC.

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

[15]  Jacques Carette,et al.  Theory Presentation Combinators , 2012, AISC/MKM/Calculemus.

[16]  Edwin Brady,et al.  Constructing Correct Circuits: Verification of Functional Aspects of Hardware Specifications with Dependent Types , 2007, Trends in Functional Programming.

[17]  Benjamin Grégoire,et al.  Proving Equalities in a Commutative Ring Done Right in Coq , 2005, TPHOLs.