X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fng_paramodulation%2Forderings.ml;h=f8e1d423153049358926583872708027b1453b22;hb=39a2078b0e835d39895a5b6c0862d668ece544f3;hp=f2151528f698df8472f17c2d608bb2e03a5729ed;hpb=95a14ced97592a4116485f94c6ffa806feb62dbc;p=helm.git diff --git a/helm/software/components/ng_paramodulation/orderings.ml b/helm/software/components/ng_paramodulation/orderings.ml index f2151528f..f8e1d4231 100644 --- a/helm/software/components/ng_paramodulation/orderings.ml +++ b/helm/software/components/ng_paramodulation/orderings.ml @@ -11,7 +11,7 @@ (* $Id$ *) -type aux_comparison = XEQ | XLE | XGE | XLT | XGT | XINCOMPARABLE +type aux_comparison = XEQ | XLE | XGE | XLT | XGT | XINCOMPARABLE | XINVERTIBLE module type Blob = sig @@ -88,14 +88,15 @@ let compute_literal_weight l = let w, m = weight_of_term x in weight_of_polynomial w m | Terms.Equation (l,r,_,Terms.Eq) - | Terms.Equation (l,r,_,Terms.Incomparable) -> + | Terms.Equation (l,r,_,Terms.Incomparable) + | Terms.Equation (l,r,_,Terms.Invertible) -> let wl, ml = weight_of_term l in let wr, mr = weight_of_term r in weight_of_polynomial (wl+wr) (ml@mr) ;; let compute_clause_weight (_,nl,pl,_,_) = - List.fold_left (fun acc lit -> compute_literal_weight lit + acc) 0 (nl@pl) + List.fold_left (fun acc (lit,_) -> compute_literal_weight lit + acc) 0 (nl@pl) let compute_goal_weight = compute_clause_weight;; @@ -181,6 +182,7 @@ let compare_terms o x y = | XGT -> Terms.Gt | XLT -> Terms.Lt | XEQ -> Terms.Eq + | XINVERTIBLE -> Terms.Invertible | _ -> assert false ;; @@ -204,7 +206,9 @@ module NRKBO (B : Terms.Blob) = struct if aux_ordering B.compare t1 t2 = XLT then XLT else XINCOMPARABLE | XGE -> if aux_ordering B.compare t1 t2 = XGT then XGT else XINCOMPARABLE - | XEQ -> aux_ordering B.compare t1 t2 + | XEQ -> let res = aux_ordering B.compare t1 t2 in + if res = XINCOMPARABLE && are_invertible t1 t2 then XINVERTIBLE + else res | res -> res ;; @@ -267,6 +271,7 @@ module KBO (B : Terms.Blob) = struct let r = aux t1 t2 in if r = XEQ then ( match t1, t2 with + | Terms.Var i, Terms.Var j when i=j -> XEQ | Terms.Node (_::tl1), Terms.Node (_::tl2) -> cmp tl1 tl2 | _, _ -> XINCOMPARABLE ) else r