skip to main content
10.1145/2034773.2034798acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
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
  • (2023)Mostly Automated Proof Repair for Verified LibrariesProceedings of the ACM on Programming Languages10.1145/35912217:PLDI(25-49)Online publication date: 6-Jun-2023
  • (2023)Proof Automation for Linearizability in Separation LogicProceedings of the ACM on Programming Languages10.1145/35860437:OOPSLA1(462-491)Online publication date: 6-Apr-2023
  • (2020)Syntax vs SemanticsProceedings of the 24th Brazilian Symposium on Context-Oriented Programming and Advanced Modularity10.1145/3427081.3427083(9-16)Online publication date: 19-Oct-2020
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

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
  • 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
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]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 19 September 2011

Permissions

Request permissions for this article.

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

Conference

ICFP '11
Sponsor:

Acceptance Rates

ICFP '11 Paper Acceptance Rate 33 of 92 submissions, 36%;
Overall Acceptance Rate 333 of 1,064 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)21
  • Downloads (Last 6 weeks)2
Reflects downloads up to 17 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2023)Mostly Automated Proof Repair for Verified LibrariesProceedings of the ACM on Programming Languages10.1145/35912217:PLDI(25-49)Online publication date: 6-Jun-2023
  • (2023)Proof Automation for Linearizability in Separation LogicProceedings of the ACM on Programming Languages10.1145/35860437:OOPSLA1(462-491)Online publication date: 6-Apr-2023
  • (2020)Syntax vs SemanticsProceedings of the 24th Brazilian Symposium on Context-Oriented Programming and Advanced Modularity10.1145/3427081.3427083(9-16)Online publication date: 19-Oct-2020
  • (2020)Practical Machine-Checked Formalization of Change Impact AnalysisTools and Algorithms for the Construction and Analysis of Systems10.1007/978-3-030-45237-7_9(137-157)Online publication date: 17-Apr-2020
  • (2019)Dependent type systems as macrosProceedings of the ACM on Programming Languages10.1145/33710714:POPL(1-29)Online publication date: 20-Dec-2019
  • (2019)Structuring the synthesis of heap-manipulating programsProceedings of the ACM on Programming Languages10.1145/32903853:POPL(1-30)Online publication date: 2-Jan-2019
  • (2019)COCHIS: Stable and coherent implicitsJournal of Functional Programming10.1017/S095679681800024229Online publication date: 8-Feb-2019
  • (2018)Adapting proof automation to adapt proofsProceedings of the 7th ACM SIGPLAN International Conference on Certified Programs and Proofs - CPP 201810.1145/3176245.3167094(115-129)Online publication date: 2018
  • (2018)Adapting proof automation to adapt proofsProceedings of the 7th ACM SIGPLAN International Conference on Certified Programs and Proofs10.1145/3167094(115-129)Online publication date: 8-Jan-2018
  • (2017)Simplicitly: foundations and applications of implicit function typesProceedings of the ACM on Programming Languages10.1145/31581302:POPL(1-29)Online publication date: 27-Dec-2017
  • 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

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media