]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/helena/src/basic_rg/brgReduction.ml
- conditional compilation continues ...
[helm.git] / helm / software / helena / src / basic_rg / brgReduction.ml
index 8747e6425dab62313088dd93f84d6328e0478e83..e62b90777fe0ebf41bcc442ec67e06d62401c203 100644 (file)
@@ -91,9 +91,11 @@ let get m i =
    let _, c, a, _, b = B.get m.e i in c, a, b
 
 (* to share *)
-let rec step st m r = 
+let rec step st m r =
+IFDEF TRACE THEN
    if !G.ct >= sublevel then 
-   log1 st (Printf.sprintf "entering R.step: l=%u, n=%s," m.l (match m.n with Some n -> string_of_int n | None -> "infinite")) m.e r;
+   log1 st (Printf.sprintf "entering R.step: l=%u, n=%s," m.l (match m.n with Some n -> string_of_int n | None -> "infinite")) m.e r
+ELSE () END;
    match r with
    | B.Sort k                            ->
       if assert_tstep m false then
@@ -105,7 +107,9 @@ let rec step st m r =
               m, B.gref a u, Some v
          | _, _, _, E.Abst w ->
             if assert_tstep m true then begin
-               if !G.summary then O.add ~grt:1 (); 
+IFDEF SUMMARY THEN
+               if !G.summary then O.add ~grt:1 ()
+ELSE () END;
                step st (tstep m) w
             end else
               m, r, None   
@@ -115,11 +119,15 @@ let rec step st m r =
    | B.LRef (_, i)                       ->
       begin match get m i with
         | c, _, B.Abbr v         ->
-           if !G.summary then O.add ~ldelta:1 ();
+IFDEF SUMMARY THEN
+           if !G.summary then O.add ~ldelta:1 ()
+ELSE () END; 
            step st {m with e = c} v
         | c, a, B.Abst (_, _, w) ->
             if assert_tstep m true then begin
-               if !G.summary then O.add ~lrt:1 ();
+IFDEF SUMMARY THEN
+               if !G.summary then O.add ~lrt:1 ()
+ELSE () END;
                step st {(tstep m) with e = c} w
             end else
               m, B.lref a i, None
@@ -128,17 +136,23 @@ let rec step st m r =
       end
    | B.Cast (u, t)                       ->
       if assert_tstep m false then begin
-         if !G.summary then O.add ~e:1 ();
+IFDEF SUMMARY THEN
+         if !G.summary then O.add ~e:1 ()
+ELSE () END;
          step st (tstep m) u
       end else begin
-         if !G.summary then O.add ~epsilon:1 ();
+IFDEF SUMMARY THEN
+         if !G.summary then O.add ~epsilon:1 ()
+ELSE () END;
          step st m t
       end
    | B.Appl (_, v, t)                    ->
       step st {m with s = (m.e, v) :: m.s} t   
    | B.Bind (y, B.Abst (false, n, w), t) ->
       let i = tsteps m in
-      if !G.summary then O.add ~x:i ();
+IFDEF SUMMARY THEN
+      if !G.summary then O.add ~x:i ()
+ELSE () END;
       let n = if i = 0 then n else N.minus st n i in
       let r = B.Bind (y, B.Abst (true, n, w), t) in
       step st m r
@@ -147,17 +161,23 @@ let rec step st m r =
          | []          ->
             m, B.Bind (y, B.Abst (true, n, w), t), None
         | (c, v) :: s ->
-           if !G.summary then O.add ~beta:1 ~theta:(List.length s) ();
+IFDEF SUMMARY THEN
+           if !G.summary then O.add ~beta:1 ~theta:(List.length s) ()
+ELSE () END;
            let v = B.Cast (w, v) in
             let e = B.push m.e c E.empty_node y (B.abbr v) in
            step st {m with e = e; s = s} t
       end else begin
-         if !G.summary then O.add ~upsilon:1 ();
+IFDEF SUMMARY THEN
+         if !G.summary then O.add ~upsilon:1 ()
+ELSE () END;
          let e = B.push m.e m.e E.empty_node y B.Void in (**) (* this is wrong in general *) 
          step st {m with e = e} t
       end
    | B.Bind (y, b, t)        ->
-      if !G.summary then O.add ~theta:(List.length m.s) ();
+IFDEF SUMMARY THEN
+      if !G.summary then O.add ~theta:(List.length m.s) ()
+ELSE () END;
       let e = B.push m.e m.e E.empty_node y b in 
       step st {m with e = e} t
 
@@ -176,7 +196,9 @@ let push m y b =
    {m with e = e; l = l}
 
 let rec ac_nfs st (m1, t1, r1) (m2, t2, r2) =
-   if !G.ct >= level then log2 st "Now converting nfs" m1.e t1 m2.e t2;
+IFDEF TRACE THEN
+   if !G.ct >= level then log2 st "Now converting nfs" m1.e t1 m2.e t2
+ELSE () END;
    match t1, r1, t2, r2 with
       | B.Sort k1, _, B.Sort k2, _                         ->
          k1 = k2
@@ -188,21 +210,31 @@ let rec ac_nfs st (m1, t1, r1) (m2, t2, r2) =
       | B.GRef ({E.n_apix = e1}, u1), Some v1, 
         B.GRef ({E.n_apix = e2}, u2), Some v2              ->
          if U.eq u1 u2 && assert_iterations m1 m2 && ac_stacks st m1 m2 then true
-         else if e1 < e2 then begin 
-            if !G.summary then O.add ~gdelta:1 ();
+         else if e1 < e2 then begin
+IFDEF SUMMARY THEN 
+            if !G.summary then O.add ~gdelta:1 ()
+ELSE () END;
            ac_nfs st (m1, t1, r1) (step st m2 v2)
         end else if e2 < e1 then begin
-           if !G.summary then O.add ~gdelta:1 ();
+IFDEF SUMMARY THEN
+           if !G.summary then O.add ~gdelta:1 ()
+ELSE () END;
            ac_nfs st (step st m1 v1) (m2, t2, r2) 
          end else begin
-           if !G.summary then O.add ~gdelta:2 ();
+IFDEF SUMMARY THEN
+           if !G.summary then O.add ~gdelta:2 ()
+ELSE () END;
            ac st m1 v1 m2 v2
          end
       | _, _, B.GRef _, Some v2                            ->
-         if !G.summary then O.add ~gdelta:1 ();
+IFDEF SUMMARY THEN
+         if !G.summary then O.add ~gdelta:1 ()
+ELSE () END;
         ac_nfs st (m1, t1, r1) (step st m2 v2)
       | B.GRef _, Some v1, _, _                            ->
-        if !G.summary then O.add ~gdelta:1 ();
+IFDEF SUMMARY THEN
+        if !G.summary then O.add ~gdelta:1 ()
+ELSE () END;
         ac_nfs st (step st m1 v1) (m2, t2, r2)
       | B.Bind (y1, (B.Abst (true, n1, w1) as b1), t1), _, 
         B.Bind (y2, (B.Abst (true, n2, w2) as b2), t2), _  ->
@@ -213,7 +245,9 @@ let rec ac_nfs st (m1, t1, r1) (m2, t2, r2) =
       | B.Sort _, _, B.Bind (y, B.Abst (true, n, _), t), _ ->
          if !G.si then
             if !G.cc && not (N.assert_zero st n) then false else begin
-           if !G.summary then O.add ~upsilon:1 ();
+IFDEF SUMMARY THEN
+           if !G.summary then O.add ~upsilon:1 ()
+ELSE () END;
            ac st (push m1 y B.Void) t1 (push m2 y B.Void) t end
          else false
       | _                                                  -> false
@@ -234,7 +268,9 @@ and ac_stacks st m1 m2 =
 let rec ih_nfs st (m, t, r) =
    match t, r with
       | B.GRef _, Some v ->
-        if !G.summary then O.add ~gdelta:1 ();
+IFDEF SUMMARY THEN
+        if !G.summary then O.add ~gdelta:1 ()
+ELSE () END;
         ih st m v
       | _                -> m, t
 
@@ -251,11 +287,15 @@ let get m i =
    let _, _, _, _, b = B.get m.e i in b
 
 let xwhd st m n t =
-   if !G.ct >= level then log1 st "Now scanning" m.e t;   
+IFDEF TRACE THEN
+   if !G.ct >= level then log1 st "Now scanning" m.e t
+ELSE () END;
    ih st (reset m n) t
 
 let are_convertible st m1 n1 t1 m2 n2 t2 = 
-   if !G.ct >= level then log2 st "Now converting" m1.e t1 m2.e t2;
+IFDEF TRACE THEN
+   if !G.ct >= level then log2 st "Now converting" m1.e t1 m2.e t2
+ELSE () END;   
    let r = ac st (reset m1 n1) t1 (reset m2 n2) t2 in
    r
 (*    let err _ = in