unicoq

An enhanced unification algorithm for Coq

  • Owner: unicoq/unicoq
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

UniCoq

Unicoq logo

An enhanced unification algorithm for Coq

Copyright (c) 2015 Beta Ziliani bziliani@famaf.unc.edu.ar,
Matthieu Sozeau mattam@mattam.org

Distributed under the terms of the MIT License,
see LICENSE for details.

This archive contains a new unification algorithm for Coq, as
a plugin that replaces the existing unification algorithm. This
algorithm is described in detail in
A Unification Algorithm for Coq Featuring Universe Polymorphism
and Overloading
.

The archive has 3 subdirectories:

  • src contains the code of the plugin in munify.ml4.

  • theories contains support Coq files for the plugin.
    Unicoq.v declares the plugin on the Coq side.

  • test-suite just demonstrates a use of the plugin

Installation

The plugin works currently with Coq v8.5. Through OPAM,
this plugin is available in the Coq's repository:

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

Otherwise, you should have coqc, ocamlc and make in your path.
Then simply do:

 coq_makefile -f Make -o Makefile

To generate a makefile from the description in Make, then make.
This will consecutively build the plugin, the supporting
theories and the test-suite file.

You can then either make install the plugin or leave it in its
current directory. To be able to import it from anywhere in Coq,
simply add the following to ~/.coqrc:

Add LoadPath "path_to_unicoq/theories" as Unicoq.
Add ML Path "path_to_unicoq/src".

Usage

Once installed, you can Require Import Unicoq.Unicoq to load the
plugin, which will install unicoq's unification algorithm as the
unifier called when typechecking terms (Definitions...) and when
using the refine tactic. Note that Coq's standard apply,
rewrite etc... still use a different unification algorithm.
On the other hand, if you use Ssreflect all tactics will call
unicoq's unifier.

The plugin also defines a tactic munify t u taking two terms and
unifying them.

Options, debugging

To trace what the algorithm is doing, one can use Set Unicoq Debug
which will produce a trace on stdout. Additionally, if a file is set
using Set Unicoq LaTex File "file.tex" the algorithm, upon success,
will write a derivation tree in LaTex. In the directory doc there is
a file named treelog.tex with an example on how to build such document.

The option Set Unicoq Aggressive activates the strong Meta-DelDeps
rule to remove dependencies of meta-variables (see the paper for details).
It is on by default.

The option Set Unicoq Super Aggressive activates specialization of a
meta-variable to its instance arguments (in case it is of function
type). Implies Aggressive. Such arguments can be pruned afterwards to
fall back into HOPU.
It is off by default.

The option Set Unicoq Use Hash enables the use of a hash table to
record unification failures, improving time performance but consuming
more memory.
It is off by default.

The command Print Unicoq Stats will print the number of times the
unifier was called and the number of meta-variable instantiations performed.

Main metrics

Overview
Name With Ownerunicoq/unicoq
Primary LanguageOCaml
Program languageCoq (Language Count: 3)
Platform
License:MIT License
所有者活动
Created At2015-02-17 19:05:55
Pushed At2025-04-11 13:18:17
Last Commit At2025-04-11 15:18:17
Release Count26
Last Release Namev1.6-8.20 (Posted on )
First Release Namev1.0 (Posted on )
用户参与
Stargazers Count56
Watchers Count8
Fork Count18
Commits Count269
Has Issues Enabled
Issues Count29
Issue Open Count10
Pull Requests Count68
Pull Requests Open Count1
Pull Requests Close Count5
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private