Giter VIP home page Giter VIP logo

maximedenes / coqhammer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lukaszcz/coqhammer

0.0 2.0 0.0 1.81 MB

CoqHammer: An Automated Reasoning Hammer Tool for Coq - Proof Automation for Dependent Type Theory

Home Page: http://cl-informatik.uibk.ac.at/cek/coqhammer/

License: Other

Makefile 1.01% Nix 0.26% Shell 1.36% OCaml 65.14% C 1.09% Standard ML 0.02% C++ 14.19% Coq 16.92%

coqhammer's Introduction

CoqHammer (dev) for Coq master (use other branches for other versions of Coq)

Travis

CoqHammer is a general-purpose automated reasoning hammer tool for Coq. It combines learning from previous proofs with the translation of problems to the logics of automated systems and the reconstruction of successfully found proofs. A typical use is to prove relatively simple goals using available lemmas. The problem is to find appropriate lemmas in a large collection of all accessible lemmas and combine them to prove the goal. The advantage of a hammer is that it is a general system not depending on any domain-specific knowledge and not requiring configuration by the user. The hammer plugin may use all currently accessible lemmas, including those proven earlier in a given formalization, not only the lemmas from predefined libraries or hint databases. At present, however, best results are achieved for statements "close to" first-order logic and lemmas from the standard library or similar.

Requirements

Installation

The latest release of CoqHammer is most easily installed via OPAM:

opam repo add coq-released https://coq.inria.fr/opam/released
opam install coq-hammer

To instead build and install CoqHammer manually, run make followed by make install. Then optionally run make tests to check if everything works (some of the tests may fail if your machine is not fast enough or you do not have all provers installed).

To use CoqHammer, you will also need some automated provers installed. More information about provers is provided below.

The plugin has been tested on Linux and MacOS X. On MacOS X you need grep available in the path. You also need the GNU C and C++ compilers (gcc and g++) available in the path for installation to succeed.

The command make install will try to install the predict and htimeout programs into the directory specified by the COQBIN environment variable. If this variable is not set then a binary directory is guessed basing on the Coq library directory.

Note that some old versions of Proof General encounter problems with the plugin. If you use Proof General you might need the most recent version obtained directly from https://proofgeneral.github.io.

Usage

In coqtop or coqide, first load the hammer plugin:

From Hammer Require Import Hammer.

Then, the available commands are as follows:

command description
hammer Runs the hammer tactic.
predict n Prints n dependencies for the current goal predicted by the machine-learning premise selection.
Hammer_version Prints the version of CoqHammer.
Hammer_cleanup Resets the hammer cache.

More actual examples are given in the examples directory.

The intended use of the hammer tactic is to replace it upon success with the reconstruction tactic shown in the response window. This reconstruction tactic has no time limits and makes no calls to external ATPs. The success of the hammer tactic itself is not guaranteed to be reproducible.

Installation of first-order provers

To use the plugin you need at least one of the following ATPs available in the path (under the command name in brackets): Vampire (vampire), CVC4 (cvc4), Eprover (eprover), Z3 (z3_tptp). It is recommended to have all four ATPs, or at least Vampire and CVC4.

The websites for the provers are:

Tactics

The Reconstr module contains the reconstruction tactics which may also be used directly in your proof scripts. In contrast to the hammer tactic they do not invoke external ATPs, they do not know anything about accessible lemmas (you need to add any necessary lemmas to the context with generalize or pose), and they never unfold any constants except basic logical operators (if necessary you need to unfold constants manually beforehand). To be able to directly use these tactics type:

From Hammer Require Import Reconstr.

The most useful tactics are:

  • sauto

    A "super" version of intuition/auto. Tries to simplify the goal and possibly solve it. Does not perform much of actual proof search (beyond what intuition already does). It is designed in such a way as to terminate in a short time in most circumstances. It is possible to customize this tactic by adding rewrite hints to the yhints database.

    WARNING: This tactic may change the proof state unpredictably and introduce randomly named hypotheses into the context.

    It is nonetheless useful to sometimes use sauto before a call to hammer. Examples of this are provided in examples/imp.v and examples/combs.v.

  • ycrush

    Tries various heuristics and performs some limited proof search. Usually stronger than sauto, but may take a long time if it cannot find a proof. In contrast to sauto, ycrush does not perform rewriting with rewrite hints in the yhints database. One commonly uses ycrush (or scrush) after sauto for goals which sauto could not solve.

  • scrush

    Essentially, a combination of sauto and ycrush.

  • yelles n

    Performs proof search up to depth n. May be very slow for n larger than 3-4.

  • blast

    This tactic instantiates some universally quantified hypotheses, calls sauto, performs shallow proof search, and repeats the whole process with new instantiations. The tactic will loop if it cannot solve the goal.

Further CoqHammer options

Set/Unset Hammer Debug.
Set Hammer GSMode n.
(* The hammer may operate in one of two modes: gs-mode or the ordinary
   mode. If GSMode is set to n > 0 then n best strategies (combination
   of prover, prediction method and number of predictions) are run in
   parallel. Otherwise, if n = 0, then the ordinary mode is active and
   the number of machine-learning dependency predictions, the
   prediction method and whether to run the ATPs in parallel are
   determined by the options below (Hammer Predictions, Hammer
   PredictMethod and Hammer Parallel). It is advisable to set GSMode
   to the number of cores your machine has, plus/minus one. Default: 8 *)
Set Hammer Predictions n.
(* number of predictions for machine-learning dependency prediction;
   irrelevant if GSMode > 0; default: 1024 *)
Set Hammer PredictMethod "knn"/"nbayes".
(* irrelevant if GSMode > 0; default: "knn" *)
Set/Unset Hammer Parallel.
(* run ATPs in parallel; irrelevant if GSMode > 0; default: on *)
Set Hammer ATPLimit n.
(* ATP time limit in seconds, default: 10s *)
Set Hammer ReconstrLimit n.
(* time limit for proof reconstruction, default: 10s *)
Set Hammer CrushLimit n.
(* before invoking external ATPs the hammer first tries to solve the
   goal using a crush-like tactic with a time limit of n seconds; default: 1s *)
Set/Unset Hammer Vampire/CVC4/Eprover/Z3.
Set Hammer PredictPath "/path/to/predict". (* default: "predict" *)
Set/Unset Hammer FilterProgram.
(* ignore dependencies from Coq.Program.*, default: on *)
Set/Unset Hammer FilterClasses.
(* ignore dependencies from Coq.Classes.*, default: on *)
Set/Unset Hammer FilterHurkens.
(* ignore dependencies from Coq.Logic.Hurkens.*, default: on *)
Set Hammer MinimizationThreshold n.
(* the minimum number of dependencies returned by an ATP for which minimization is performed, default: 6 *)
Set/Unset Hammer SearchBlacklist.
(* ignore dependencies blacklisted with the Search Blacklist
   vernacular command, default: on *)
Set/Unset Hammer ClosureGuards.
(* should guards be generated for types of free variables? setting
   this to "on" will typically harm the hammer success rate, but it
   may help with functional extensionality; set this to "on" if you
   use functional extensionality and get many unreconstructible
   proofs; default: off *)

Debugging

The following commands are useful for debugging.

command description
Hammer_print "name" Prints object name in hhterm format.
Hammer_transl "name" Prints all axioms resulting from the translation of name in the intermediate coqterm format accepted by the tptp_out.ml module.
hammer_transl Prints all axioms resulting from the translation of the current goal.
Hammer_features "name" Prints the features of name, bypassing the cache.
Hammer_features_cached "name" Prints the features of name, using and possibly modifying the cache.
hammer_features Prints the features of the current goal.
Hammer_objects Prints the number of accessible objects.

Copyright and license

Copyright (c) 2017-2018, Lukasz Czajka and Cezary Kaliszyk, University of Innsbruck. Distributed under the terms of LGPL 2.1, see the file LICENSE.

coqhammer's People

Contributors

ejgallego avatar ekiciburak avatar emarzion avatar lukaszcz avatar palmskog avatar skyskimmer avatar vbgl avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.