X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fng_paramodulation%2FfoUtils.ml;h=826687afc788b49d842b639d83467c94b88fd5de;hb=b3f366c0fa3fcadcf5f21913f71a2bce591e47d0;hp=454432ec48925a4e53dc734aa6680faff7e14d7f;hpb=a872dba2b03e27967d5b9b51e950e85967340e52;p=helm.git diff --git a/helm/software/components/ng_paramodulation/foUtils.ml b/helm/software/components/ng_paramodulation/foUtils.ml index 454432ec4..826687afc 100644 --- a/helm/software/components/ng_paramodulation/foUtils.ml +++ b/helm/software/components/ng_paramodulation/foUtils.ml @@ -21,14 +21,14 @@ let rec lexicograph f l1 l2 = | _,[] -> 1 ;; -module Utils (B : Terms.Blob) = struct - module Subst = FoSubst;; (*.Subst(B) ;;*) - module Order = Orderings.Orderings(B) ;; +module Utils (B : Orderings.Blob) = struct + module Subst = FoSubst;; + module Order = B;; let rec eq_foterm x y = x == y || match x, y with - | Terms.Leaf t1, Terms.Leaf t2 -> B.eq t1 t2 + | Terms.Leaf t1, Terms.Leaf t2 -> B.eq t1 t2 | Terms.Var i, Terms.Var j -> i = j | Terms.Node l1, Terms.Node l2 -> List.for_all2 eq_foterm l1 l2 | _ -> false @@ -72,29 +72,31 @@ module Utils (B : Terms.Blob) = struct let eq_unit_clause (id1,_,_,_) (id2,_,_,_) = id1 = id2 let compare_unit_clause (id1,_,_,_) (id2,_,_,_) = Pervasives.compare id1 id2 - let relocate maxvar varlist = + let relocate maxvar varlist subst = List.fold_right (fun i (maxvar, varlist, s) -> maxvar+1, maxvar::varlist, Subst.build_subst i (Terms.Var maxvar) s) - varlist (maxvar+1, [], Subst.id_subst) + varlist (maxvar+1, [], subst) ;; let fresh_unit_clause maxvar (id, lit, varlist, proof) = - let maxvar, varlist, subst = relocate maxvar varlist in + (* prerr_endline + ("varlist = " ^ (String.concat "," (List.map string_of_int varlist)));*) + let maxvar, varlist, subst = relocate maxvar varlist Subst.id_subst in let lit = match lit with | Terms.Equation (l,r,ty,o) -> - let l = Subst.apply_subst subst l in - let r = Subst.apply_subst subst r in - let ty = Subst.apply_subst subst ty in + let l = Subst.reloc_subst subst l in + let r = Subst.reloc_subst subst r in + let ty = Subst.reloc_subst subst ty in Terms.Equation (l,r,ty,o) | Terms.Predicate p -> - let p = Subst.apply_subst subst p in + let p = Subst.reloc_subst subst p in Terms.Predicate p in let proof = match proof with - | Terms.Exact t -> Terms.Exact (Subst.apply_subst subst t) + | Terms.Exact t -> Terms.Exact (Subst.reloc_subst subst t) | Terms.Step (rule,c1,c2,dir,pos,s) -> Terms.Step(rule,c1,c2,dir,pos,Subst.concat subst s) in @@ -112,11 +114,11 @@ module Utils (B : Terms.Blob) = struct aux (aux [] ty) proofterm in let lit = - match ty with - | Terms.Node [ Terms.Leaf eq ; ty; l; r ] when B.eq B.eqP eq -> + match B.is_eq ty with + | Some(ty,l,r) -> let o = Order.compare_terms l r in Terms.Equation (l, r, ty, o) - | t -> Terms.Predicate t + | None -> Terms.Predicate ty in let proof = Terms.Exact proofterm in fresh_unit_clause maxvar (0, lit, varlist, proof)