Skip to content

This Coq plugin provides tactics for rewriting universally quantified equations, modulo associative (and possibly commutative) operators.

License

Notifications You must be signed in to change notification settings

fakusb/aac-tactics

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AAC tactics

Travis Contributing Code of Conduct Gitter DOI

This Coq plugin provides tactics for rewriting universally quantified equations, modulo associativity and commutativity of some operator. The tactics can be applied for custom operators by registering the operators and their properties as type class instances. Many common operator instances, such as for Z binary arithmetic and booleans, are provided with the plugin.

More details about the project can be found in the paper Tactics for Reasoning modulo AC in Coq.

Meta

  • Author(s):
    • Thomas Braibant (initial)
    • Damien Pous (initial)
    • Fabian Kunze
  • Coq-community maintainer(s):
  • License: GNU Lesser General Public License v3.0 or later
  • Compatible Coq versions: Coq master (use the corresponding branch or release for other Coq versions)
  • Compatible OCaml versions: all versions supported by Coq
  • Additional dependencies: none

Building and installation instructions

The easiest way to install the latest released version is via OPAM:

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

To instead build and install manually, do:

git clone https://github.com/coq-community/aac-tactics
cd aac-tactics
make   # or make -j <number-of-cores-on-your-machine>
make install

After installation, the included modules are available under the AAC_tactics namespace.

Documentation

The following example shows an application of the tactics for reasoning over Z binary numbers:

Require Import AAC_tactics.AAC.
Require AAC_tactics.Instances.
Require Import ZArith.

Section ZOpp.
  Import Instances.Z.
  Variables a b c : Z.
  Hypothesis H: forall x, x + Z.opp x = 0.

  Goal a + b + c + Z.opp (c + a) = b.
    aac_rewrite H.
    aac_reflexivity.
  Qed.
End ZOpp.

The file Tutorial.v provides a succinct introduction and more examples of how to use this plugin.

The file Instances.v defines several type class instances for frequent use-cases of this plugin, that should allow you to use it off-the-shelf. Namely, it contains instances for:

  • Peano naturals (Import Instances.Peano.)
  • Z binary numbers (Import Instances.Z.)
  • N binary numbers (Import Instances.N.)
  • P binary numbers (Import Instances.P.)
  • Rational numbers (Import Instances.Q.)
  • Prop (Import Instances.Prop_ops.)
  • Booleans (Import Instances.Bool.)
  • Relations (Import Instances.Relations.)
  • all of the above (Import Instances.All.)

To understand the inner workings of the tactics, please refer to the .mli files as the main source of information on each .ml file.

Acknowledgements

The initial authors are grateful to Evelyne Contejean, Hugo Herbelin, Assia Mahboubi, and Matthieu Sozeau for highly instructive discussions. The plugin took inspiration from the plugin tutorial "constructors" by Matthieu Sozeau, distributed under the LGPL 2.1.

About

This Coq plugin provides tactics for rewriting universally quantified equations, modulo associative (and possibly commutative) operators.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • OCaml 65.4%
  • Coq 34.2%
  • Other 0.4%