implement term order attribute (for experiments)
authorblanchet
Tue, 20 Mar 2012 00:44:30 +0100
changeset 47034 77da780ddd6b
parent 47033 baa9dc39ee51
child 47035 5248fae40f09
implement term order attribute (for experiments)
src/HOL/Tools/ATP/atp_systems.ML
src/HOL/Tools/Sledgehammer/sledgehammer_provers.ML
--- a/src/HOL/Tools/ATP/atp_systems.ML	Tue Mar 20 00:44:30 2012 +0100
+++ b/src/HOL/Tools/ATP/atp_systems.ML	Tue Mar 20 00:44:30 2012 +0100
@@ -11,6 +11,11 @@
   type formula_kind = ATP_Problem.formula_kind
   type failure = ATP_Proof.failure
 
+  type term_order =
+    {is_lpo : bool,
+     generate_weights : bool,
+     generate_prec : bool,
+     generate_simp : bool}
   type slice_spec = int * atp_format * string * string * bool
   type atp_config =
     {exec : string * string,
@@ -54,6 +59,7 @@
   val waldmeisterN : string
   val z3_tptpN : string
   val remote_prefix : string
+  val effective_term_order : Proof.context -> string -> term_order
   val remote_atp :
     string -> string -> string list -> (string * string) list
     -> (failure * string) list -> formula_kind -> formula_kind
@@ -165,13 +171,34 @@
 val smartN = "smart"
 val kboN = "kbo"
 val lpoN = "lpo"
-val weightsN = "_weights"
-val precsN = "_precs"
-val lrN = "_lr" (* SPASS-specific *)
+val xweightsN = "_weights"
+val xprecN = "_prec"
+val xsimpN = "_simp" (* SPASS-specific *)
 
 val term_order =
   Attrib.setup_config_string @{binding atp_term_order} (K smartN)
 
+type term_order =
+  {is_lpo : bool,
+   generate_weights : bool,
+   generate_prec : bool,
+   generate_simp : bool}
+
+fun effective_term_order ctxt atp =
+  let val ord = Config.get ctxt term_order in
+    if ord = smartN then
+      if atp = spass_newN then
+        {is_lpo = false, generate_weights = true, generate_prec = false,
+         generate_simp = true}
+      else
+        {is_lpo = false, generate_weights = false, generate_prec = false,
+         generate_simp = false}
+    else
+      {is_lpo = String.isSubstring lpoN ord,
+       generate_weights = String.isSubstring xweightsN ord,
+       generate_prec = String.isSubstring xprecN ord,
+       generate_simp = String.isSubstring xsimpN ord}
+  end
 
 (* Alt-Ergo *)
 
--- a/src/HOL/Tools/Sledgehammer/sledgehammer_provers.ML	Tue Mar 20 00:44:30 2012 +0100
+++ b/src/HOL/Tools/Sledgehammer/sledgehammer_provers.ML	Tue Mar 20 00:44:30 2012 +0100
@@ -710,7 +710,11 @@
                            type_enc false lam_trans uncurried_aliases
                            readable_names true hyp_ts concl_t
                 fun sel_weights () = atp_problem_selection_weights atp_problem
-                fun ord_weights () = atp_problem_term_order_weights atp_problem
+                fun ord_weights () =
+                  if #generate_weights (effective_term_order ctxt name) then
+                    atp_problem_term_order_weights atp_problem
+                  else
+                    []
                 val full_proof = debug orelse isar_proof
                 val command =
                   File.shell_path command ^ " " ^