let rec demodulate bag (id, literal, vl, pr) table =
debug (lazy ("demodulate " ^ (string_of_int id)));
match literal with
- | Terms.Predicate t -> assert false
+ | Terms.Predicate t -> (* assert false *)
+ let bag,_,id1 =
+ visit bag [] (fun x -> x) id t (ctx_demod table vl)
+ in
+ let cl,_,_ = Terms.get_from_bag id1 bag in
+ bag,cl
| Terms.Equation (l,r,ty,_) ->
let bag,l,id1 =
visit bag [2]
match acc with
| None -> None
| Some(bag,maxvar,(id,lit,vl,p),subst) ->
+ (* prerr_endline ("input subst = "^Pp.pp_substitution subst); *)
let l = Subst.apply_subst subst l in
let r = Subst.apply_subst subst r in
try
with FoUnif.UnificationFailure _ ->
match rewrite_eq ~unify l r ty vl table with
| Some (id2, dir, subst1) ->
+ (* prerr_endline ("subst1 = "^Pp.pp_substitution subst1);
+ prerr_endline ("old subst = "^Pp.pp_substitution subst);*)
let newsubst = Subst.concat subst1 subst in
let id_t =
FoSubst.apply_subst newsubst
subst1 id id2 (pos@[2]) dir
with
| Some ((bag, maxvar), c), r ->
- let newsubst = Subst.concat r newsubst in
+ (* prerr_endline ("r = "^Pp.pp_substitution r); *)
+ let newsubst = Subst.flat
+ (Subst.concat r subst) in
Some(bag,maxvar,c,newsubst)
| None, _ -> assert false)
| None ->