From e04377e2c5eca2b47bd5f8db320069aa47040488 Mon Sep 17 00:00:00 2001 From: Emilio Jesus Gallego Arias Date: Sat, 18 Apr 2020 22:58:40 -0400 Subject: [declare] [tactics] Move declare to `vernac` This PR moves `Declare` to `vernac` which will hopefully allow to unify it with `DeclareDef` and avoid exposing entry internals. There are many tradeoffs to be made as interface and placement of tactics is far from clear; I've tried to reach a minimally invasive compromise: - moved leminv to `ltac_plugin`; this is unused in the core codebase and IMO for now it is the best place - hook added for abstract; this should be cleaned up later - hook added for scheme declaration; this should be cleaned up later - separation of hints vernacular and "tactic" part should be also done later, for now I've introduced a `declareUctx` module to avoid being invasive there. In particular this last point strongly suggest that for now, the best place for `Class_tactics` would be also in `ltac`, but I've avoided that for now too. This partially supersedes #10951 for now and helps with #11492 . --- dev/base_include | 2 +- plugins/ltac/extratactics.mlg | 2 +- plugins/ltac/leminv.ml | 297 +++++++++++++ plugins/ltac/leminv.mli | 21 + plugins/ltac/ltac_plugin.mlpack | 1 + plugins/setoid_ring/newring.ml | 2 +- tactics/abstract.ml | 5 +- tactics/abstract.mli | 12 + tactics/declare.ml | 901 ---------------------------------------- tactics/declare.mli | 314 -------------- tactics/declareUctx.ml | 34 ++ tactics/declareUctx.mli | 11 + tactics/hints.ml | 5 +- tactics/hints.mli | 2 +- tactics/ind_tables.ml | 8 +- tactics/ind_tables.mli | 8 + tactics/leminv.ml | 297 ------------- tactics/leminv.mli | 21 - tactics/tactics.mllib | 3 +- vernac/comAssumption.ml | 6 +- vernac/comHints.ml | 2 +- vernac/declare.ml | 886 +++++++++++++++++++++++++++++++++++++++ vernac/declare.mli | 299 +++++++++++++ vernac/declareUniv.ml | 4 +- vernac/vernac.mllib | 1 + vernac/vernacentries.ml | 3 +- 26 files changed, 1593 insertions(+), 1554 deletions(-) create mode 100644 plugins/ltac/leminv.ml create mode 100644 plugins/ltac/leminv.mli delete mode 100644 tactics/declare.ml delete mode 100644 tactics/declare.mli create mode 100644 tactics/declareUctx.ml create mode 100644 tactics/declareUctx.mli delete mode 100644 tactics/leminv.ml delete mode 100644 tactics/leminv.mli create mode 100644 vernac/declare.ml create mode 100644 vernac/declare.mli diff --git a/dev/base_include b/dev/base_include index 96a867475d..45e79147c1 100644 --- a/dev/base_include +++ b/dev/base_include @@ -129,7 +129,7 @@ open Elim open Equality open Hipattern open Inv -open Leminv +open Ltac_plugin.Leminv open Tacticals open Tactics open Eqschemes diff --git a/plugins/ltac/extratactics.mlg b/plugins/ltac/extratactics.mlg index 7754fe401e..0bad3cbe5b 100644 --- a/plugins/ltac/extratactics.mlg +++ b/plugins/ltac/extratactics.mlg @@ -312,7 +312,7 @@ let add_rewrite_hint ~poly bases ort t lcsr = if poly then ctx else (* This is a global universe context that shouldn't be refreshed at every use of the hint, declare it globally. *) - (Declare.declare_universe_context ~poly:false ctx; + (DeclareUctx.declare_universe_context ~poly:false ctx; Univ.ContextSet.empty) in CAst.make ?loc:(Constrexpr_ops.constr_loc ce) ((c, ctx), ort, Option.map (in_gen (rawwit wit_ltac)) t) in diff --git a/plugins/ltac/leminv.ml b/plugins/ltac/leminv.ml new file mode 100644 index 0000000000..5a8ec404ee --- /dev/null +++ b/plugins/ltac/leminv.ml @@ -0,0 +1,297 @@ +(************************************************************************) +(* * The Coq Proof Assistant / The Coq Development Team *) +(* v * Copyright INRIA, CNRS and contributors *) +(*