]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/tactics/filter_auto.ml
Corrections to "auto" tactic
[helm.git] / helm / ocaml / tactics / filter_auto.ml
index f4964f575327f8695eb08dfcfc8dda19e9ebf0fc..a87be6c49bd8408f8c46b443a8505e004fa735e5 100644 (file)
@@ -32,6 +32,8 @@ let main_conclusion = "'http://www.cs.unibo.it/helm/schemas/schema-helm#MainConc
 
 let in_conclusion = "'http://www.cs.unibo.it/helm/schemas/schema-helm#InConclusion'" ;;
 
+let in_body = "'http://www.cs.unibo.it/helm/schemas/schema-helm#InBody'";;
+
 let escape = Str.global_replace (Str.regexp_string "\'") "\\'";;
 
 let hyp_const (conn:Mysql.dbd) uri =
@@ -39,9 +41,8 @@ let hyp_const (conn:Mysql.dbd) uri =
   (*query to obtain all the constants in the hypothesis and conclusion of the theorem*)
   let query =
      "select h_occurrence from refObj where source='"^uri^
-    "' and (h_position="^main_hypothesis^" or h_position="^in_hypothesis^
-    "or h_position="^main_conclusion^" or h_position="^in_conclusion^")" in
-(*  prerr_endline ("$$$$$$$$$$$$$$$"^query);*)
+    "' and (not (h_position ="^in_body^"))" in
+  (*prerr_endline ("$$$$$$$$$$$$$$$"^query);*)
   let result = Mysql.exec conn query in 
   (* now we transform the result in a set *)
   let f a = 
@@ -71,10 +72,7 @@ let rec exec_query (conn:Mysql.dbd) uris k =
     let refObjn = "refObj" ^ (string_of_int n) in
     let new_must =
       [ refObjn^".h_occurrence = '" ^ uri ^ "'";
-        "("^refObjn^".h_position = " ^ main_conclusion^ " or "
-       ^refObjn^".h_position = " ^ in_conclusion^ " or "
-       ^refObjn^".h_position = " ^ main_hypothesis^ " or "
-       ^refObjn^".h_position = " ^ in_hypothesis^ ")"] in
+        "(not ("^refObjn^".h_position ="^in_body^"))"] in
     let where' = 
       if n = 0 then new_must@where
       else 
@@ -91,8 +89,8 @@ let rec exec_query (conn:Mysql.dbd) uris k =
   in
   let from = String.concat "," from in
   let where = String.concat " and " where in
-  let query = "select refObj0.source from " ^ from ^ " where " ^ where in
-   (* prerr_endline query;*)
+  let query = "select distinct(refObj0.source) from " ^ from ^ " where " ^ where in
+    (* prerr_endline query;*)
     Mysql.exec conn query
 ;;