]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/tactics/filter_auto.ml
Added a filter for uris in tactic "auto".
[helm.git] / helm / ocaml / tactics / filter_auto.ml
diff --git a/helm/ocaml/tactics/filter_auto.ml b/helm/ocaml/tactics/filter_auto.ml
new file mode 100644 (file)
index 0000000..6fae7b7
--- /dev/null
@@ -0,0 +1,65 @@
+(* Copyright (C) 2000-2002, HELM Team.
+ * 
+ * This file is part of HELM, an Hypertextual, Electronic
+ * Library of Mathematics, developed at the Computer Science
+ * Department, University of Bologna, Italy.
+ * 
+ * HELM is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * HELM is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HELM; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ * 
+ * For details, see the HELM World-Wide-Web page,
+ * http://cs.unibo.it/helm/.
+ *)
+
+
+let in_hypothesis = "'http://www.cs.unibo.it/helm/schemas/schema-helm#InHypothesis'" ;;
+
+let main_hypothesis = "'http://www.cs.unibo.it/helm/schemas/schema-helm#MainHypothesis'" ;;
+
+let main_conclusion = "'http://www.cs.unibo.it/helm/schemas/schema-helm#MainConclusion'" ;;
+
+let in_conclusion = "'http://www.cs.unibo.it/helm/schemas/schema-helm#InConclusion'" ;;
+
+
+let hyp_const (conn:Mysql.dbd) uri =
+  (*query to obtain all the constants in the hypothesis 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);
+  let result = Mysql.exec conn query in 
+  (* now we transform the result in a set *)
+  let f a = 
+    match (Array.to_list a) with
+       [Some uri] -> uri
+      | _ -> assert false in
+  let result = Mysql.map ~f:f result in
+  List.fold_left 
+    (fun set uri ->
+       NewConstraints.StringSet.add uri set)
+    NewConstraints.StringSet.empty result
+;;
+
+(* for each uri check if its costants are a subset of
+   const, the set of the costants of the proof *)
+let filter_new_constants (conn:Mysql.dbd) const (_,uri) =
+   let hyp = hyp_const conn uri in
+   prerr_endline (NewConstraints.pp_StringSet hyp);
+    NewConstraints.StringSet.subset hyp const
+;;
+
+       
+