]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_proof_checking/cicReduction.ml
removed debug prerr_endline
[helm.git] / helm / ocaml / cic_proof_checking / cicReduction.ml
index 687a46549a5455f2253b085c4f83b49a552fd55d..35c89ae33e6f5c6fcf96f7247362d276ae830fb9 100644 (file)
@@ -33,6 +33,8 @@ exception ReferenceToVariable;;
 exception ReferenceToCurrentProof;;
 exception ReferenceToInductiveDefinition;;
 
+let debug_print = fun _ -> ()
+
 let fdebug = ref 1;;
 let debug t env s =
  let rec debug_aux t i =
@@ -41,7 +43,7 @@ let debug t env s =
    CicPp.ppobj (C.Variable ("DEBUG", None, t, [], [])) ^ "\n" ^ i
  in
   if !fdebug = 0 then
-   prerr_endline (s ^ "\n" ^ List.fold_right debug_aux (t::env) "")
+   debug_print (s ^ "\n" ^ List.fold_right debug_aux (t::env) "")
 ;;
 
 module type Strategy =
@@ -347,7 +349,7 @@ module Reduction(RS : Strategy) =
             )
        | C.Var (uri,exp_named_subst) ->
 (*
-prerr_endline ("%%%%%UWVAR " ^ String.concat " ; " (List.map (function (uri,t) -> UriManager.string_of_uri uri ^ " := " ^ CicPp.ppterm t) ens)) ;
+debug_print ("%%%%%UWVAR " ^ String.concat " ; " (List.map (function (uri,t) -> UriManager.string_of_uri uri ^ " := " ^ CicPp.ppterm t) ens)) ;
 *)
          if List.exists (function (uri',_) -> UriManager.eq uri' uri) ens then
           CicSubstitution.lift m (RS.from_ens (List.assq uri ens))
@@ -493,10 +495,11 @@ prerr_endline ("%%%%%UWVAR " ^ String.concat " ; " (List.map (function (uri,t) -
         | _::tl -> filter_and_lift already_instantiated tl
 (*
         | (uri,_)::tl ->
-prerr_endline ("---- SKIPPO " ^ UriManager.string_of_uri uri) ;
-if List.for_all (function (uri',_) -> not (UriManager.eq uri uri')) exp_named_subst' then prerr_endline "---- OK1" ;
-prerr_endline ("++++ uri " ^ UriManager.string_of_uri uri ^ " not in " ^ String.concat " ; " (List.map UriManager.string_of_uri params)) ;
-if List.mem uri params then prerr_endline "---- OK2" ;
+debug_print ("---- SKIPPO " ^ UriManager.string_of_uri uri) ;
+if List.for_all (function (uri',_) -> not (UriManager.eq uri uri'))
+exp_named_subst' then debug_print "---- OK1" ;
+debug_print ("++++ uri " ^ UriManager.string_of_uri uri ^ " not in " ^ String.concat " ; " (List.map UriManager.string_of_uri params)) ;
+if List.mem uri params then debug_print "---- OK2" ;
         filter_and_lift tl
 *)
       in
@@ -754,7 +757,7 @@ if List.mem uri params then prerr_endline "---- OK2" ;
     try 
       reduce context (0, [], [], t, [])
     with Not_found -> 
-      prerr_endline (CicPp.ppterm t) ; 
+      debug_print (CicPp.ppterm t) ; 
       raise Not_found
   ;;
   *)
@@ -770,11 +773,11 @@ let whd context t =
  let rescsc = CicReductionNaif.whd context t in
   if not (CicReductionNaif.are_convertible context res rescsc) then
    begin
-    prerr_endline ("PRIMA: " ^ CicPp.ppterm t) ;
+    debug_print ("PRIMA: " ^ CicPp.ppterm t) ;
     flush stderr ;
-    prerr_endline ("DOPO: " ^ CicPp.ppterm res) ;
+    debug_print ("DOPO: " ^ CicPp.ppterm res) ;
     flush stderr ;
-    prerr_endline ("CSC: " ^ CicPp.ppterm rescsc) ;
+    debug_print ("CSC: " ^ CicPp.ppterm rescsc) ;
     flush stderr ;
 CicReductionNaif.fdebug := 0 ;
 let _ =  CicReductionNaif.are_convertible context res rescsc in
@@ -1020,10 +1023,10 @@ let are_convertible ?(subst=[]) ?(metasenv=[])  =
      (* 
      (match t1 with 
         Cic.Meta _ -> 
-          prerr_endline (CicPp.ppterm t1);
-          prerr_endline (CicPp.ppterm (whd ~subst context t1));
-          prerr_endline (CicPp.ppterm t2);
-          prerr_endline (CicPp.ppterm (whd ~subst context t2))
+          debug_print (CicPp.ppterm t1);
+          debug_print (CicPp.ppterm (whd ~subst context t1));
+          debug_print (CicPp.ppterm t2);
+          debug_print (CicPp.ppterm (whd ~subst context t2))
        | _ -> ()); *)
      let t1' = whd ~subst context t1 in
      let t2' = whd ~subst context t2 in