Uris of theorems containing, in the conclusion or in the hypothesis, constants not present in the proof (hypothesis or conclusion) are filtered out.
helm-cic_unification helm-mathql_interpreter helm-mathql_generator
INTERFACE_FILES = \
+ newConstraints.mli match_concl.mli filter_auto.mli\
proofEngineReduction.mli proofEngineHelpers.mli \
newConstraints.mli match_concl.mli \
tacticals.mli reductionTactics.mli proofEngineStructuralRules.mli \
--- /dev/null
+(* 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
+;;
+
+
+
--- /dev/null
+(* 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/.
+ *)
+
+
+
+val filter_new_constants:
+ Mysql.dbd ->
+ NewConstraints.StringSet.t ->
+ int * string ->
+ bool
+
val pp_SetSet : SetSet.t -> string
+val pp_StringSet : StringSet.t -> string
+
+
+
val inspect_term : int -> Cic.term -> string option * SetSet.t
val prefixes : int -> Cic.term -> string option * ((int * (StringSet.elt list)) list)
-(* (constants_of t) returns a pair (b,n) where n is the number of
+(* (constants_of t) returns a pair (b,n) where n is the set of the
constants in the conclusion of t, and b is true if in MainConclusion
we have an equality *)
val constants_of : Cic.term -> bool * StringSet.t
+val constants_concl : Cic.term -> StringSet.t
+
val pp_prefixes : ((int * (StringSet.elt list)) list) -> string
(fun (n,u) ->
(n,MQueryMisc.wrong_xpointer_format_from_wrong_xpointer_format' u))
result in
+ (* delete all .var uris *)
let isvar (_,s) =
let len = String.length s in
let suffix = String.sub s (len-4) 4 in
not (suffix = ".var") in
let uris = List.filter isvar uris in
+ (* delete all not "cic:/Coq" uris *)
let uris =
(* TODO ristretto per ragioni di efficienza *)
- prerr_endline "STO FILTRANDO2";
List.filter (fun _,uri -> Pcre.pmatch ~pat:"^cic:/Coq/" uri) uris in
+ (* concl_cost are the costants in the conclusion of the proof
+ while hyp_const are the constants in the hypothesis *)
+ let (_,concl_const) = NewConstraints.constants_of ty in
+ prerr_endline ("Ne sono rimasti " ^ string_of_int (List.length uris));
+ let hyp t set =
+ match t with
+ Some (_,Cic.Decl t) -> (NewConstraints.StringSet.union set (NewConstraints.constants_concl t))
+ | Some (_,Cic.Def (t,_)) -> (NewConstraints.StringSet.union set (NewConstraints.constants_concl t))
+ | _ -> set in
+ let hyp_const =
+ List.fold_right hyp ey NewConstraints.StringSet.empty in
+ prerr_endline (NewConstraints.pp_StringSet (NewConstraints.StringSet.union hyp_const concl_const));
+ (* uris with new constants in the proof are filtered *)
+ let uris = List.filter (Filter_auto.filter_new_constants conn (NewConstraints.StringSet.union hyp_const concl_const)) uris in
(*
- let uris =
- (* TODO ristretto per ragioni di efficienza *)
- prerr_endline "STO FILTRANDO2";
- List.filter (fun uri -> Pcre.pmatch ~pat:"^cic:/Coq/" uri) uris
- in
let uris =
(* ristretto all cache *)
prerr_endline "SOLO CACHE";
prerr_endline ("Ne sono rimasti " ^ string_of_int (List.length uris));
filter_out uris
in
- uris'
+ prerr_endline ("Ne sono rimasti " ^ string_of_int (List.length uris'));
+ uris'
;;
(*funzione che sceglie il penultimo livello di profondita' dei must*)
else l1 - l2)
subproofs
in
- (* now we may drop the prefix tag *)
+ (* now we may drop the prefix tag *)
List.map snd res
* http://cs.unibo.it/helm/.
*)
+
+(* Da rimuovere, solo per debug*)
+let print_context ctx =
+ let print_name =
+ function
+ Cic.Name n -> n
+ | Cic.Anonymous -> "_"
+ in
+ List.fold_right
+ (fun i (output,context) ->
+ let (newoutput,context') =
+ match i with
+ Some (n,Cic.Decl t) ->
+ print_name n ^ ":" ^ CicPp.pp t context ^ "\n", (Some n)::context
+ | Some (n,Cic.Def (t,None)) ->
+ print_name n ^ ":=" ^ CicPp.pp t context ^ "\n", (Some n)::context
+ | None ->
+ "_ ?= _\n", None::context
+ | Some (_,Cic.Def (_,Some _)) -> assert false
+ in
+ output^newoutput,context'
+ ) ctx ("",[])
+ ;;
+
+
+
+
+
let search_theorems_in_context status =
let (proof, goal) = status in
let module C = Cic in
match meta_inf with
Some (ey, ty) ->
prerr_endline ("CURRENT GOAL = " ^ (CicPp.ppterm ty));
+ prerr_endline ("CURRENT HYP = " ^ (fst (print_context ey)));
(*
let time1 = Unix.gettimeofday() in
let _, all_paths = NewConstraints.prefixes 5 ty in