X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fng_paramodulation%2FfoUtils.ml;h=26b7f6fa4b2e1abec80070352d5dbb502d1f99b8;hb=1c9b8f3ba2c86446d44160ae494bc85624bc5eaf;hp=d53b19c8245f8b6513889be718bef52f2c9f9e83;hpb=637114791874df9ebc4e0f0936513c71886a913f;p=helm.git diff --git a/helm/software/components/ng_paramodulation/foUtils.ml b/helm/software/components/ng_paramodulation/foUtils.ml index d53b19c82..26b7f6fa4 100644 --- a/helm/software/components/ng_paramodulation/foUtils.ml +++ b/helm/software/components/ng_paramodulation/foUtils.ml @@ -11,9 +11,23 @@ (* $Id: terms.ml 9836 2009-06-05 15:33:35Z denes $ *) +let rec lexicograph f l1 l2 = + match l1, l2 with + | [], [] -> 0 + | x::xs, y::ys -> + let c = f x y in + if c <> 0 then c else lexicograph f xs ys + | [],_ -> ~-1 + | _,[] -> 1 +;; + +let mk_id = + let id = ref 0 in + fun () -> incr id; !id +;; module Utils (B : Terms.Blob) = struct - module Subst = FoSubst.Subst(B) ;; + module Subst = FoSubst;; (*.Subst(B) ;;*) module Order = Orderings.Orderings(B) ;; let rec eq_foterm x y = @@ -25,15 +39,6 @@ module Utils (B : Terms.Blob) = struct | _ -> false ;; - let rec lexicograph f l1 l2 = - match l1, l2 with - | [], [] -> 0 - | x::xs, y::ys -> - let c = f x y in - if c <> 0 then c else lexicograph f xs ys - | [],_ -> ~-1 - | _,[] -> 1 - ;; let rec compare_foterm x y = match x, y with @@ -102,11 +107,6 @@ module Utils (B : Terms.Blob) = struct ;; (* may be moved inside the bag *) - let mk_id = - let id = ref 0 in - fun () -> incr id; !id - ;; - let mk_unit_clause maxvar ty proofterm = let varlist = let rec aux acc = function @@ -127,15 +127,26 @@ module Utils (B : Terms.Blob) = struct fresh_unit_clause maxvar (mk_id (), lit, varlist, proof) ;; - let add_to_bag = - let id = ref 0 in - fun bag (_,lit,vl,proof) -> - incr id; - let clause = (!id, lit, vl, proof) in - let bag = Terms.M.add !id clause bag in + let add_to_bag bag (_,lit,vl,proof) = + let id = mk_id () in + let clause = (id, lit, vl, proof) in + let bag = Terms.M.add id clause bag in bag, clause ;; let empty_bag = Terms.M.empty ;; + let mk_passive_clause cl = + (Order.compute_unit_clause_weight cl, cl) + ;; + + let compare_passive_clauses_weight (w1,(id1,_,_,_)) (w2,(id2,_,_,_)) = + if w1 = w2 then id1 - id2 + else w1 - w2 + ;; + + let compare_passive_clauses_age (_,(id1,_,_,_)) (_,(id2,_,_,_)) = + id1 - id2 + ;; + end