]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/components/ng_paramodulation/orderings.ml
Merge remote-tracking branch 'origin/ld-0.99.3'
[helm.git] / matita / components / ng_paramodulation / orderings.ml
index bf033ec662d058ead724ec7195981eedceeffb8f..d5f35a3a321c16929177d4af525239dfcac334dc 100644 (file)
@@ -131,8 +131,8 @@ let compare_weights (h1, w1) (h2, w2) =
           if var1 = var2 then
             let diffs = (w1 - w2) + diffs in
             let r = Pervasives.compare w1 w2 in
-            let lt = lt or (r < 0) in
-            let gt = gt or (r > 0) in
+            let lt = lt || (r < 0) in
+            let gt = gt || (r > 0) in
               if lt && gt then XINCOMPARABLE else
                 aux hdiff (lt, gt) diffs tl1 tl2
           else if var1 < var2 then
@@ -208,7 +208,7 @@ module NRKBO (B : Terms.Blob) = struct
   let name = "nrkbo"
   include B 
 
-  module Pp = Pp.Pp(B)
+  (*module Pp = Pp.Pp(B)*)
 
   let eq_foterm = eq_foterm B.eq;;
 
@@ -224,7 +224,7 @@ exception UnificationFailure of string Lazy.t;;
       in
       match s, t with
         | s, t when eq_foterm s t -> subst
-        | Terms.Var i, Terms.Var j
+        | Terms.Var i, Terms.Var _j
             when (not (List.exists (fun (_,k) -> k=t) subst)) ->
             let subst = FoSubst.build_subst i t subst in
               subst
@@ -290,7 +290,7 @@ module KBO (B : Terms.Blob) = struct
   let name = "kbo"
   include B 
 
-  module Pp = Pp.Pp(B)
+  (*module Pp = Pp.Pp(B)*)
 
   let eq_foterm = eq_foterm B.eq;;
 
@@ -356,7 +356,7 @@ module LPO (B : Terms.Blob) = struct
   let name = "lpo"
   include B 
 
-  module Pp = Pp.Pp(B)
+  (*module Pp = Pp.Pp(B)*)
 
   let eq_foterm = eq_foterm B.eq;;
 
@@ -364,13 +364,13 @@ module LPO (B : Terms.Blob) = struct
   let compute_goal_weight = compute_goal_weight;;
 
   (*CSC: beware! Imperative cache! *)
-  let cache = ref [];;
+  let cache = Hashtbl.create 101
 
   let rec lpo_le s t = 
     eq_foterm s t || lpo_lt s t 
   
   and lpo_lt s t =
-    try List.assoc (s,t) !cache
+    try Hashtbl.find cache (s,t)
     with
     Not_found -> let res =
     match s,t with
@@ -406,7 +406,7 @@ module LPO (B : Terms.Blob) = struct
             | _ -> assert false
            end
    in
-    cache := ((s,t),res)::!cache; res
+    Hashtbl.add cache (s,t) res; res
   ;;
 
   let lpo s t =
@@ -416,7 +416,7 @@ module LPO (B : Terms.Blob) = struct
     else if lpo_lt t s then XGT
     else XINCOMPARABLE
     in
-     cache := []; res
+     Hashtbl.clear cache; res
   ;;