aboutsummaryrefslogtreecommitdiffhomepage
path: root/tactics
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2013-07-17 15:31:24 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2013-07-17 15:31:24 +0000
commitb594d3f6f2c5ae36dd1da727bb1707271b0b784d (patch)
treef9ef6582833dbae0e57cc518e8352737e452f41e /tactics
parente97e56bcb2e7312d27232117180dbb7bddd67fe7 (diff)
Pre-create typeclass_instances and rewrite hintdb in Auto
This way, we avoid relying on the add_auto_init hook. This hook is left for the moment, but could probably be removed someday. We also stop using create_hint_db, which has an effect on the libstack. This wasn't a problem per se, but could if init_summaries is used more (for instance to temporary reset coq). git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16624 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'tactics')
-rw-r--r--tactics/auto.ml18
-rw-r--r--tactics/auto.mli5
-rw-r--r--tactics/class_tactics.ml49
-rw-r--r--tactics/rewrite.ml413
4 files changed, 27 insertions, 18 deletions
diff --git a/tactics/auto.ml b/tactics/auto.ml
index b5586bbd9..39d9fe766 100644
--- a/tactics/auto.ml
+++ b/tactics/auto.ml
@@ -444,7 +444,17 @@ type hint_db_table = hint_db Hintdbmap.t ref
type hint_db_name = string
-let searchtable = (ref Hintdbmap.empty : hint_db_table)
+(** Initially created hint databases, for typeclasses and rewrite *)
+
+let typeclasses_db = "typeclass_instances"
+let rewrite_db = "rewrite"
+
+let auto_init_db =
+ Hintdbmap.add typeclasses_db (Hint_db.empty full_transparent_state true)
+ (Hintdbmap.add rewrite_db (Hint_db.empty cst_full_transparent_state true)
+ Hintdbmap.empty)
+
+let searchtable : hint_db_table = ref auto_init_db
let searchtable_map name =
Hintdbmap.find name !searchtable
@@ -463,11 +473,11 @@ let current_db () =
(**************************************************************************)
let auto_init : (unit -> unit) ref = ref (fun () -> ())
-let add_auto_init f =
+let add_auto_init f =
let init = !auto_init in
- auto_init := (fun () -> init (); f ())
+ auto_init := (fun () -> init (); f ())
-let init () = searchtable := Hintdbmap.empty; !auto_init ()
+let init () = searchtable := auto_init_db; !auto_init ()
let freeze _ = !searchtable
let unfreeze fs = searchtable := fs
diff --git a/tactics/auto.mli b/tactics/auto.mli
index 2a163120a..5a5b8f56c 100644
--- a/tactics/auto.mli
+++ b/tactics/auto.mli
@@ -261,3 +261,8 @@ val pr_autotactic : 'a auto_tactic -> Pp.std_ppcmds
(** Hook for changing the initialization of auto *)
val add_auto_init : (unit -> unit) -> unit
+
+(** Pre-created hint databases *)
+
+val typeclasses_db : hint_db_name
+val rewrite_db : hint_db_name
diff --git a/tactics/class_tactics.ml4 b/tactics/class_tactics.ml4
index fb41c2e15..bfe80d708 100644
--- a/tactics/class_tactics.ml4
+++ b/tactics/class_tactics.ml4
@@ -27,14 +27,13 @@ open Evd
open Locus
open Misctypes
-let typeclasses_db = "typeclass_instances"
+(** Hint database named "typeclass_instances", now created directly in Auto *)
+
+let typeclasses_db = Auto.typeclasses_db
+
let typeclasses_debug = ref false
let typeclasses_depth = ref None
-let _ =
- Auto.add_auto_init
- (fun () -> Auto.create_hint_db false typeclasses_db full_transparent_state true)
-
exception Found of evar_map
(** We transform the evars that are concerned by this resolution
diff --git a/tactics/rewrite.ml4 b/tactics/rewrite.ml4
index a598f1d61..c88e67e8b 100644
--- a/tactics/rewrite.ml4
+++ b/tactics/rewrite.ml4
@@ -285,14 +285,9 @@ let decompose_applied_relation_expr env sigma flags (is, (c,l)) left2right =
let sigma, cbl = Tacinterp.interp_open_constr_with_bindings is env sigma (c,l) in
decompose_applied_relation env sigma flags (Some (is, (c,l))) cbl left2right
-let rewrite_db = "rewrite"
+(** Hint database named "rewrite", now created directly in Auto *)
-let conv_transparent_state = (Id.Pred.empty, Cpred.full)
-
-let _ =
- Auto.add_auto_init
- (fun () ->
- Auto.create_hint_db false rewrite_db conv_transparent_state true)
+let rewrite_db = Auto.rewrite_db
let rewrite_transparent_state () =
Auto.Hint_db.transparent_state (Auto.searchtable_map rewrite_db)
@@ -315,10 +310,10 @@ let rewrite_unif_flags = {
}
let rewrite2_unif_flags =
- { Unification.modulo_conv_on_closed_terms = Some conv_transparent_state;
+ { Unification.modulo_conv_on_closed_terms = Some cst_full_transparent_state;
Unification.use_metas_eagerly_in_conv_on_closed_terms = true;
Unification.modulo_delta = empty_transparent_state;
- Unification.modulo_delta_types = conv_transparent_state;
+ Unification.modulo_delta_types = cst_full_transparent_state;
Unification.modulo_delta_in_merge = None;
Unification.check_applied_meta_types = true;
Unification.resolve_evars = false;