Skip to main content
×
×
Home

How to make ad hoc proof automation less ad hoc

  • GEORGES GONTHIER (a1), BETA ZILIANI (a2), ALEKSANDAR NANEVSKI (a3) and DEREK DREYER (a4)
Abstract
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.

Copyright
References
Hide All
Asperti A., Ricciotti W., Coen C. S. & Tassi E. (2009) Hints in unification. In Theorem Proving in Higher Order Logics, LNCS, Vol. 5674. Springer, pp. 8498.
Barras B., Jouannaud J.-P., Strub P.-Y. & Wang Q. (2011) CoqMTU: A higher-order type theory with a predicative hierarchy of universes parametrized by a decidable first-order theory. In Twenty-Sixth Annual IEEE Symposium on Logic in Computer Science. IEEE, pp. 143151.
Bertot Y., Gonthier G., Ould Biha S. & Pasca I. (2008) Canonical big operators. In TPHOLs, LNCS, Vol. 5170. Springer, pp. 86101.
Braibant T. & Pous D. (2010) Rewriting modulo associativity and commutativity in Coq. Second Coq Workshop.
Chakravarty M. M. T., Keller G. & Peyton Jones S. (2005) Associated type synonyms. In ACM SIGPLAN International Conference on Functional Programming. ACM, pp. 241253.
Chlipala A. (2008) Certified Programming with Dependent Types. Available at: http://adam.hlipala.net/cpdt.
Chlipala A. (2011) Mostly-automated verification of low-level programs in computational separation logic. In Proceedings of the ACM SIGPLAN 2011 Conference on Programming Language Design and Implementation. ACM, pp. 234245.
Goldfarb W. D. (1981) The undecidability of the second-order unification problem. Theor. Comput. Sci. 13 (2), 225230.
Gonthier G. (2008) Formal proof – the four-color theorem. Not. AMS 55 (11), 13821393.
Gonthier G. (2011) Point-free, set-free concrete linear algebra. In Interactive Theorem Proving, LNCS, Vol. 6898. Springer, pp 103118.
Gonthier G. & Mahboubi A. (2010) An introduction to small scale reflection in Coq. J. Formalized Reason. 3 (2), 95152.
Gonthier G., Ziliani B., Nanevski A. & Dreyer D. (2012) How to make ad hoc proof automation less ad hoc. Supporting material available at: http://www.mpi-sws.org/~beta/lessadhoc.
Grégoire B. & Mahboubi A. (2005) Proving equalities in a commutative ring done right in Coq. In Theorem Proving in Higher Order Logics, LNCS, Vol. 3603. Springer, pp. 98113.
Hall C., Hammond K., Jones S. P. & Wadler P. (1996) Type classes in Haskell. ACM Trans. Program. Lang. Syst. 18 (2), 241256.
Jia L., Zhao J., Sjöberg V. & Weirich S. (2010) Dependent types and program equivalence. In Proceedings of the ACM SIGPLAN–SIGACT Symposium on Principles of Programming Languages. ACM, pp. 275286.
Jones M. P. (2000) Type classes with functional dependencies. In Proceedings of the European Symposium on Programming, LNCS, Vol. 1782. Springer, pp. 230244.
Klein G., Andronick J., Elphinstone K., Heiser G., Cock D., Derrin P., Elkaduwe D., Engelhardt K., Kolanski R., Norrish M., Sewell T., Tuch H. & Winwood S. (2010) seL4: Formal verification of an operating-system kernel. Commun. ACM 53 (6), 107115.
Leroy X. (2009) Formal verification of a realistic compiler. Commun. ACM 52 (7), 107115.
Miller D. (1991) Unification of simply typed lambda-terms as logic programming. In International Conference on Logic Programming, Seattle, WA, USA, MIT Press, pp. 255269.
Morris J. G. & Jones M. P. (2010) Instance chains: type class programming without overlapping instances. In Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming. ACM, pp. 375386.
Nanevski A., Vafeiadis V. & Berdine J. (2010) Structuring the verification of heap-manipulating programs. In Proceedings of the 37th annual ACM SIGPLAN–SIGACT Symposium on Principles of Programming Languages. ACM, pp. 261274.
Pientka B. & Dunfield J. (2008) Programming with proofs and explicit contexts. In ACM SIGPLAN Symposium on Principles and Practice of Declarative Programming. ACM, pp. 163173.
Poswolsky A. & Schürmann C. (2009) System description: Delphin – a functional programming language for deductive systems. Electron. Notes Theor. Comput. Sci. 228, 113120.
Reynolds J. C. (2002) Separation logic: A logic for shared mutable data structures. In Proceedings of the 17th Annual IEEE Symposium on Logic in Computer Science. IEEE, pp. 5574.
Saïbi A. (1997) Typing algorithm in type theory with inheritance. In Proceedings of the 24th ACM SIGPLAN–SIGACT Symposium on Principles of Programming Languages. ACM, pp. 292301.
Sozeau M. & Oury N. (2008) First-class type classes. In Theorem Proving in Higher Order Logics, LNCS, Vol. 5170. Springer, pp. 278293.
Spitters B. & van der Weegen E. (2011) Type classes for mathematics in type theory. Math. Struct. Comput. Sci. 21 (4), 795825.
Stampoulis A. & Shao Z. (2010) VeriML: Typed computation of logical terms inside a language with effects. In Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming. ACM, pp. 333344.
Stampoulis A. & Shao Z. (2012) Static and user-extensible proof checking. In 39th ACM Symposium on Principles of Programming Languages. ACM, pp. 273284.
Strub P.-Y. (2010) Coq modulo theory. In Computer Science Logic, LNCS, Vol. 6247. Springer, pp. 529543.
Wadler P. & Blott S. (1989) How to make ad-hoc polymorphism less ad hoc. In Proceedings of the 16th Annual ACM SIGPLAN–SIGACT Symposium on Principles of Programming Languages. ACM, pp. 6076.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 14 *
Loading metrics...

Abstract views

Total abstract views: 152 *
Loading metrics...

* Views captured on Cambridge Core between September 2016 - 17th January 2018. This data will be updated every 24 hours.