]> matita.cs.unibo.it Git - helm.git/blobdiff - matitaB/components/ng_tactics/nnAuto.ml
Fixes a bug in NnAuto: printing the statistics triggered loading of
[helm.git] / matitaB / components / ng_tactics / nnAuto.ml
index 697355db296cd2dc74a5c247b3dcd743b2ffe955..d65fda22db614749926e73e525a4c1377c9a5e6d 100644 (file)
@@ -72,8 +72,12 @@ let print_stat status tbl =
   let vcompare (_,v1) (_,v2) =
     Pervasives.compare (relevance v1) (relevance v2) in
   let l = List.sort vcompare l in
+  let short_name r = 
+    Filename.chop_extension 
+      (Filename.basename (NReference.string_of_reference r))
+  in
   let vstring (a,v)=
-      NotationPp.pp_term status (Ast.NCic (NCic.Const a)) ^ ": rel = " ^
+      short_name a ^ ": rel = " ^
       (string_of_float (relevance v)) ^
       "; uses = " ^ (string_of_int !(v.uses)) ^
       "; nom = " ^ (string_of_int !(v.nominations)) in
@@ -591,7 +595,7 @@ let compare_statuses ~past ~present =
  List.map fst (List.filter (fun (i,_) -> not (List.mem_assoc i present)) past)
 ;;
 
-(* paramodulation has only an implicit knoweledge of the symmetry of equality;
+(* paramodulation has only an implicit knowledge of the symmetry of equality;
    hence it is in trouble in proving (a = b) = (b = a) *) 
 let try_sym tac status g =
   (* put the right uri *)
@@ -986,9 +990,9 @@ let try_candidate ?(smart=0) flags depth status eq_cache ctx t =
   debug_print (lazy ("expected branching: " ^ (string_of_int res)));
   debug_print (lazy ("actual: branching" ^ (string_of_int diff))); 
   (* some flexibility *)
-  if og_no - old_og_no > res then 
+  if diff > res  && res > 0 (* facts are never pruned *) then 
     (debug_print (lazy ("branch factor for: " ^ (ppterm status cict) ^ " = " 
-                   ^ (string_of_int res) ^ " vs. " ^ (string_of_int og_no)));
+                   ^ (string_of_int res) ^ " vs. " ^ (string_of_int diff)));
      debug_print ~depth (lazy "strange application"); None)
   else 
     (incr candidate_no; Some ((!candidate_no,t),status))
@@ -1729,7 +1733,7 @@ let auto_tac ~params:(univ,flags) ?(trace_ref=ref []) status =
 (*   pp_th status facts; *)
 (*
   NDiscriminationTree.DiscriminationTree.iter status#auto_cache (fun p t -> 
-    debug_print (lazy(
+    (*debug_*)print (lazy(
       NDiscriminationTree.NCicIndexable.string_of_path p ^ " |--> " ^
       String.concat "\n    " (List.map (
       status#ppterm ~metasenv:[] ~context:[] ~subst:[])
@@ -1800,10 +1804,10 @@ let auto_tac ~params:(univ,flags) ?(trace_ref=ref []) status =
               in
               let s = s#set_stack stack in
                 trace_ref := trace;
-                oldstatus#set_status s 
+                oldstatus#set_status s
   in
   let s = up_to depth depth in
-    debug_print (print_stat status statistics);
+    debug_print (print_stat status statistics); 
     debug_print(lazy
         ("TIME ELAPSED:"^string_of_float(Unix.gettimeofday()-.initial_time)));
     debug_print(lazy