Nothing Special   »   [go: up one dir, main page]

skip to main content
research-article

How to make ad hoc proof automation less ad hoc

Published: 19 September 2011 Publication History

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.

Supplementary Material

MP4 File (_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.
[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.
[3]
Yves Bertot, Georges Gonthier, Sidi Ould Biha, and Ioana Pasca. Canonical big operators. In TPHOLs, volume 5170 of LNCS, pages 86--101, 2008.
[4]
Thomas Braibant and Damien Pous. Rewriting modulo associativity and commutativity in Coq. In Second Coq workshop, 2010.
[5]
Manuel M. T. Chakravarty, Gabriele Keller, and Simon Peyton Jones. Associated type synonyms. In ICFP, pages 241--253, 2005.
[6]
Adam Chlipala. Certified programming with dependent types. URL: http://adam.chlipala.net/cpdt, 2008.
[7]
Adam Chlipala. Mostly-automated verification of low-level programs in computational separation logic. In PLDI, 2011.
[8]
Georges Gonthier. Formal proof - the four-color theorem. Notices of the AMS, 55(11):1382--93, 2008.
[9]
Georges Gonthier. Point-free, set-free concrete linear algebra. In ITP, 2011.
[10]
Georges Gonthier and Assia Mahboubi. An introduction to small scale reflection in Coq. Journal of Formalized Reasoning, 3(2):95--152, 2010.
[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.
[12]
Benjamin Grégoire and Assia Mahboubi. Proving equalities in a commutative ring done right in Coq. In TPHOLs, pages 98--113, 2005.
[13]
Cordelia Hall, Kevin Hammond, Simon Peyton Jones, and Philip Wadler. Type classes in Haskell. TOPLAS, 18:241--256, 1996.
[14]
Limin Jia, Jianzhou Zhao, Vilhelm Sjöberg, and Stephanie Weirich. Dependent types and program equivalence. In POPL, pages 275--286, 2010.
[15]
Mark P. Jones. Type classes with functional dependencies. In ESOP, pages 230--244, 2000.
[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.
[17]
Xavier Leroy. Formal verification of a realistic compiler. CACM, 52:107--115, July 2009.
[18]
J. Garrett Morris and Mark P. Jones. Instance chains: Type class programming without overlapping instances. In ICFP, pages 375--386, 2010.
[19]
Aleksandar Nanevski, Viktor Vafeiadis, and Josh Berdine. Structuring the verification of heap-manipulating programs. In POPL, pages 261--274, 2010.
[20]
Brigitte Pientka and Joshua Dunfield. Programming with proofs and explicit contexts. In PPDP, pages 163--173, 2008.
[21]
Adam Poswolsky and Carsten Schürmann. System description: Delphin - a functional programming language for deductive systems. ENTCS, 228:113--120, 2009.
[22]
John C. Reynolds. Separation logic: a logic for shared mutable data structures. In LICS, 2002.
[23]
Amokrane Saïbi. Typing algorithm in type theory with inheritance. In POPL, pages 292--301, 1997.
[24]
Matthieu Sozeau and Nicolas Oury. First-class type classes. In TPHOLs, volume 5170 of LNCS, pages 278--293, 2008.
[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.
[26]
Antonis Stampoulis and Zhong Shao. VeriML: Typed computation of logical terms inside a language with effects. In ICFP, pages 333--344, 2010.
[27]
Pierre-Yves Strub. Coq modulo theory. In CSL, pages 529--543, 2010.
[28]
Philip Wadler and Stephen Blott. How to make ad-hoc polymorphism less ad hoc. In POPL, pages 60--76, 1989.

Cited By

View all
  • (2017)Coinductive Soundness of Corecursive Type Class ResolutionLogic-Based Program Synthesis and Transformation10.1007/978-3-319-63139-4_18(311-327)Online publication date: 25-Jul-2017
  • (2016)Extensible and Efficient Automation Through Reflective TacticsProgramming Languages and Systems10.1007/978-3-662-49498-1_21(532-559)Online publication date: 2016
  • (2015)A Type-Theoretic Approach to ResolutionRevised Selected Papers of the 25th International Symposium on Logic-Based Program Synthesis and Transformation - Volume 952710.1007/978-3-319-27436-2_6(91-106)Online publication date: 13-Jul-2015
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 46, Issue 9
ICFP '11
September 2011
456 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/2034574
Issue’s Table of Contents
  • cover image ACM Conferences
    ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programming
    September 2011
    470 pages
    ISBN:9781450308656
    DOI:10.1145/2034773
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 19 September 2011
Published in SIGPLAN Volume 46, Issue 9

Check for updates

Author Tags

  1. canonical structures
  2. coq
  3. custom proof automation
  4. hoare type theory
  5. interactive theorem proving
  6. tactics
  7. type classes

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)22
  • Downloads (Last 6 weeks)2
Reflects downloads up to 16 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2017)Coinductive Soundness of Corecursive Type Class ResolutionLogic-Based Program Synthesis and Transformation10.1007/978-3-319-63139-4_18(311-327)Online publication date: 25-Jul-2017
  • (2016)Extensible and Efficient Automation Through Reflective TacticsProgramming Languages and Systems10.1007/978-3-662-49498-1_21(532-559)Online publication date: 2016
  • (2015)A Type-Theoretic Approach to ResolutionRevised Selected Papers of the 25th International Symposium on Logic-Based Program Synthesis and Transformation - Volume 952710.1007/978-3-319-27436-2_6(91-106)Online publication date: 13-Jul-2015
  • (2013)Meta-theory à la carteACM SIGPLAN Notices10.1145/2480359.242909448:1(207-218)Online publication date: 23-Jan-2013
  • (2013)Meta-theory à la carteProceedings of the 40th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages10.1145/2429069.2429094(207-218)Online publication date: 23-Jan-2013
  • (2013)Canonical structures for the working coq userProceedings of the 4th international conference on Interactive Theorem Proving10.1007/978-3-642-39634-2_5(19-34)Online publication date: 22-Jul-2013
  • (2013)The picard algorithm for ordinary differential equations in coqProceedings of the 4th international conference on Interactive Theorem Proving10.1007/978-3-642-39634-2_34(463-468)Online publication date: 22-Jul-2013
  • (2013)A machine-checked proof of the odd order theoremProceedings of the 4th international conference on Interactive Theorem Proving10.1007/978-3-642-39634-2_14(163-179)Online publication date: 22-Jul-2013
  • (2012)Barriers in Concurrent Separation Logic: Now With Tool Support!Logical Methods in Computer Science10.2168/LMCS-8(2:2)20128:2Online publication date: 20-Apr-2012
  • (2012)Dependently typed programming based on automated theorem provingProceedings of the 11th international conference on Mathematics of Program Construction10.1007/978-3-642-31113-0_12(220-240)Online publication date: 25-Jun-2012
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media