skip to main content
research-article

How to make ad hoc proof automation less ad hoc

Published:19 September 2011Publication History
Skip Abstract Section

Abstract

Most interactive theorem provers provide support for some form of user-customizable proof automation. In a number of popular systems, such as Coq and Isabelle, this automation is achieved primarily through tactics, which are programmed in a separate language from that of the prover's base logic. While tactics are clearly useful in practice, they can be difficult to maintain and compose because, unlike lemmas, their behavior cannot be specified within the expressive type system of the prover itself.

We propose a novel approach to proof automation in Coq that allows the user to specify the behavior of custom automated routines in terms of Coq's own type system. Our approach involves a sophisticated application of Coq's canonical structures, which generalize Haskell type classes and facilitate a flexible style of dependently-typed logic programming. Specifically, just as Haskell type classes are used to infer the canonical implementation of an overloaded term at a given type, canonical structures can be used to infer the canonical proof of an overloaded lemma for a given instantiation of its parameters. We present a series of design patterns for canonical structure programming that enable one to carefully and predictably coax Coq's type inference engine into triggering the execution of user-supplied algorithms during unification, and we illustrate these patterns through several realistic examples drawn from Hoare Type Theory. We assume no prior knowledge of Coq and describe the relevant aspects of Coq type inference from first principles.

Skip Supplemental Material Section

Supplemental Material

_talk3.mp4

References

  1. Andrea Asperti, Wilmer Ricciotti, Claudio Sacerdoti Coen, and Enrico Tassi. Hints in unification. In TPHOLs, volume 5674 of LNCS, pages 84--98, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Bruno Barras, Jean-Pierre Jouannaud, Pierre-Yves Strub, and Qian Wang. CoqMTU: a higher-order type theory with a predicative hierarchy of universes parametrized by a decidable first-order theory. In LICS, pages 143--151, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Yves Bertot, Georges Gonthier, Sidi Ould Biha, and Ioana Pasca. Canonical big operators. In TPHOLs, volume 5170 of LNCS, pages 86--101, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Thomas Braibant and Damien Pous. Rewriting modulo associativity and commutativity in Coq. In Second Coq workshop, 2010.Google ScholarGoogle Scholar
  5. Manuel M. T. Chakravarty, Gabriele Keller, and Simon Peyton Jones. Associated type synonyms. In ICFP, pages 241--253, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Adam Chlipala. Certified programming with dependent types. URL: http://adam.chlipala.net/cpdt, 2008.Google ScholarGoogle Scholar
  7. Adam Chlipala. Mostly-automated verification of low-level programs in computational separation logic. In PLDI, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Georges Gonthier. Formal proof - the four-color theorem. Notices of the AMS, 55(11):1382--93, 2008.Google ScholarGoogle Scholar
  9. Georges Gonthier. Point-free, set-free concrete linear algebra. In ITP, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Georges Gonthier and Assia Mahboubi. An introduction to small scale reflection in Coq. Journal of Formalized Reasoning, 3(2):95--152, 2010.Google ScholarGoogle Scholar
  11. Georges Gonthier, Beta Ziliani, Aleksandar Nanevski, and Derek Dreyer. How to make ad hoc proof automation less ad hoc, 2011. Code + appendix: http://www.mpi-sws.org/~beta/lessadhoc. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Benjamin Grégoire and Assia Mahboubi. Proving equalities in a commutative ring done right in Coq. In TPHOLs, pages 98--113, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Cordelia Hall, Kevin Hammond, Simon Peyton Jones, and Philip Wadler. Type classes in Haskell. TOPLAS, 18:241--256, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Limin Jia, Jianzhou Zhao, Vilhelm Sjöberg, and Stephanie Weirich. Dependent types and program equivalence. In POPL, pages 275--286, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Mark P. Jones. Type classes with functional dependencies. In ESOP, pages 230--244, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Gerwin Klein, June Andronick, Kevin Elphinstone, Gernot Heiser, David Cock, Philip Derrin, Dhammika Elkaduwe, Kai Engelhardt, Rafal Kolanski, Michael Norrish, Thomas Sewell, Harvey Tuch, and Simon Winwood. seL4: formal verification of an operating-system kernel. CACM, 53(6):107--115, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Xavier Leroy. Formal verification of a realistic compiler. CACM, 52:107--115, July 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. J. Garrett Morris and Mark P. Jones. Instance chains: Type class programming without overlapping instances. In ICFP, pages 375--386, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Aleksandar Nanevski, Viktor Vafeiadis, and Josh Berdine. Structuring the verification of heap-manipulating programs. In POPL, pages 261--274, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Brigitte Pientka and Joshua Dunfield. Programming with proofs and explicit contexts. In PPDP, pages 163--173, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Adam Poswolsky and Carsten Schürmann. System description: Delphin - a functional programming language for deductive systems. ENTCS, 228:113--120, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. John C. Reynolds. Separation logic: a logic for shared mutable data structures. In LICS, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Amokrane Saïbi. Typing algorithm in type theory with inheritance. In POPL, pages 292--301, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Matthieu Sozeau and Nicolas Oury. First-class type classes. In TPHOLs, volume 5170 of LNCS, pages 278--293, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Bas Spitters and Eelis van der Weegen. Type classes for mathematics in type theory. MSCS, Special issue on 'Interactive theorem proving and the formalization of mathematics', 21:1--31, 2011.Google ScholarGoogle Scholar
  26. Antonis Stampoulis and Zhong Shao. VeriML: Typed computation of logical terms inside a language with effects. In ICFP, pages 333--344, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Pierre-Yves Strub. Coq modulo theory. In CSL, pages 529--543, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Philip Wadler and Stephen Blott. How to make ad-hoc polymorphism less ad hoc. In POPL, pages 60--76, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. How to make ad hoc proof automation less ad hoc

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!