Code Monkey home page Code Monkey logo

coq-community / aac-tactics Goto Github PK

View Code? Open in Web Editor NEW
29.0 10.0 21.0 716 KB

Coq plugin providing tactics for rewriting universally quantified equations, modulo associative (and possibly commutative) operators [maintainer=@palmskog]

Home Page: https://coq-community.org/aac-tactics

License: Other

Coq 36.33% Makefile 0.29% OCaml 55.78% JavaScript 3.03% CSS 2.68% HTML 1.89%
coq-plugin coq-tactic coq docker-coq-action nix-action coq-ci coq-platform

aac-tactics's Introduction

AAC Tactics

Docker CI Nix CI Contributing Code of Conduct Zulip coqdoc DOI

This Coq plugin provides tactics for rewriting and proving universally quantified equations modulo associativity and commutativity of some operator, with idempotent commutative operators enabling additional simplifications. The tactics can be applied for custom operators by registering the operators and their properties as type class instances. Instances for many commonly used operators, such as for binary integer arithmetic and booleans, are provided with the plugin.

Meta

Building and installation instructions

The easiest way to install the latest released version of AAC Tactics 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.git
cd aac-tactics
make   # or make -j <number-of-cores-on-your-machine> 
make install

Documentation

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

From AAC_tactics Require Import AAC.
From AAC_tactics Require Instances.
From Coq 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.

  Goal Z.max (b + c) (c + b) + a + Z.opp (c + b) = a.
    aac_normalise.
    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.)
  • Lists (Import Instances.Lists.)
  • N binary numbers (Import Instances.N.)
  • Positive 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.

See also the latest coqdoc documentation and the latest ocamldoc documentation.

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.

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.