]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/ng_paramodulation/nCicParamod.ml
Support for the new auto tactics //
[helm.git] / helm / software / components / ng_paramodulation / nCicParamod.ml
index a96d3cc0a098ab8046c72ada33eaba6cc9d5e44c..c680e8417346885453b2e70852d814065c6e0ed8 100644 (file)
@@ -16,22 +16,25 @@ NCicBlob.set_default_eqP()
 NCicProof.set_default_sig()
 ;;
 
+let debug _ = ();;
+let print s = prerr_endline (Lazy.force s);; 
+
 module B(C : NCicBlob.NCicContext): Orderings.Blob 
   with type t = NCic.term and type input = NCic.term 
   = Orderings.LPO(NCicBlob.NCicBlob(C))
 
 module NCicParamod(C : NCicBlob.NCicContext) = Paramod.Paramod(B(C))
 
-let readback rdb metasenv subst context (bag,i,l) =
+let readback rdb metasenv subst context (bag,i,fo_subst,l) =
 (*
   List.iter (fun x ->
      print_endline (Pp.pp_unit_clause ~margin:max_int
      (fst(Terms.M.find x bag)))) l; 
 *)
-  let stamp = Unix.gettimeofday () in
-  let proofterm = NCicProof.mk_proof bag i l in
-    prerr_endline (Printf.sprintf "Got proof term in %fs"
-                    (Unix.gettimeofday() -. stamp));
+  (* let stamp = Unix.gettimeofday () in *)
+  let proofterm,prooftype = NCicProof.mk_proof bag i fo_subst l in
+  (* debug (lazy (Printf.sprintf "Got proof term in %fs"
+                    (Unix.gettimeofday() -. stamp))); *)
   let metasenv, proofterm = 
     let rec aux k metasenv = function
       | NCic.Meta _ as t -> metasenv, t
@@ -44,15 +47,19 @@ let readback rdb metasenv subst context (bag,i,l) =
           (fun _ k -> k+1) k aux metasenv t
     in
       aux 0 metasenv proofterm
-  in
-  prerr_endline "so far 1";
-  prerr_endline (NCicPp.ppterm ~metasenv ~subst ~context proofterm);
+  in 
+  debug (lazy (NCicPp.ppterm ~metasenv ~subst ~context proofterm));
+(*
+  let stamp = Unix.gettimeofday () in
   let metasenv, subst, proofterm, _prooftype = 
     NCicRefiner.typeof 
       (rdb#set_coerc_db NCicCoercion.empty_db) 
       metasenv subst context proofterm None
   in
-    proofterm, metasenv, subst
+    print (lazy (Printf.sprintf "Refined in %fs"
+                    (Unix.gettimeofday() -. stamp)));
+*)
+    proofterm, prooftype, metasenv, subst
 
 let nparamod rdb metasenv subst context t table =
   let module C =
@@ -70,7 +77,7 @@ let nparamod rdb metasenv subst context t table =
     HExtlib.list_mapi_acc (fun x _ a -> P.mk_goal a x) (bag,maxvar) [t]
   in
   let (bag,maxvar), passives = 
-    HExtlib.list_mapi_acc (fun x _ a -> P.mk_passive a x) (bag,maxvar) table
+    HExtlib.list_mapi_acc (fun x _ a -> prerr_endline "there"; P.mk_passive a x) (bag,maxvar) table
   in
   match 
     P.paramod ~useage:true ~max_steps:max_int ~timeout:(Unix.gettimeofday () +. 300.0) 
@@ -94,11 +101,12 @@ type state = P.state
 let empty_state = P.empty_state
 
 let forward_infer_step s t ty =
-  let bag = P.bag_of_state s in 
+  let bag = P.bag_of_state s in
+  prerr_endline "here"; 
   let bag,clause = P.mk_passive bag (t,ty) in
     if Terms.is_eq_clause clause then
       P.forward_infer_step (P.replace_bag s bag) clause 0
-    else (prerr_endline "not and equality"; s)
+    else s
 ;;
 
 let index_obj s uri =
@@ -110,9 +118,12 @@ let index_obj s uri =
 ;;
 
 let fast_eq_check rdb metasenv subst context s goal =
+  (* let stamp = Unix.gettimeofday () in *)
   match P.fast_eq_check s goal with
   | P.Error _ | P.GaveUp | P.Timeout _ -> []
   | P.Unsatisfiable solutions -> 
+      (* print (lazy (Printf.sprintf "Got solutions in %fs"
+                    (Unix.gettimeofday() -. stamp))); *)
       List.map (readback rdb metasenv subst context) solutions
 ;;