let rec aux bag pos ctx id = function
| Terms.Leaf _ as t -> f bag t pos ctx id
| Terms.Var _ as t -> bag,t,id
- | Terms.Node l as t->
+ | Terms.Node (hd::l) as t->
let bag,t,id1 = f bag t pos ctx id in
if id = id1 then
let bag, l, _, id =
let bag,newt,id = aux bag newpos newctx id t in
if post = [] then bag, pre@[newt], [], id
else bag, pre @ [newt], List.tl post, id)
- (bag, [], List.tl l, id) l
+ (bag, [hd], List.tl l, id) l
in
bag, Terms.Node l, id
else bag,t,id1
+ | _ -> assert false
in
aux bag pos ctx id t
;;
(IDX.DT.retrieve_generalizations table) subterm
in
list_first
- (fun (dir, (id,lit,vl,_)) ->
+ (fun (dir, is_pos, pos, (id,nlit,plit,vl,_)) ->
match lit with
| Terms.Predicate _ -> assert false
| Terms.Equation (l,r,_,o) ->
prof_demod_s.HExtlib.profile
(Subst.apply_subst subst) newside
in
- if o = Terms.Incomparable then
+ if o = Terms.Incomparable || o = Terms.Invertible then
let o =
prof_demod_o.HExtlib.profile
(Order.compare_terms newside) side in
let subst =
Unif.unification (* (varlist@vl)*) [] subterm side
in
- if o = Terms.Incomparable then
+ if o = Terms.Incomparable || o = Terms.Invertible then
let side = Subst.apply_subst subst side in
let newside = Subst.apply_subst subst newside in
let o = Order.compare_terms side newside in
(all_positions [3]
(fun x -> Terms.Node [ Terms.Leaf B.eqP; ty; l; x ])
r (superposition table vl))
+ | Terms.Equation (l,r,ty,Terms.Invertible)
| Terms.Equation (l,r,ty,Terms.Gt) ->
fold_build_new_clause bag maxvar id Terms.Superposition
(fun _ -> true)
fold_build_new_clause bag maxvar id Terms.Superposition
(filtering Terms.Lt)
(all_positions [2]
- (fun x -> Terms.Node [ Terms.Leaf B.eqP; ty; l; x ])
- r (superposition table vl))
+ (fun x -> Terms.Node [ Terms.Leaf B.eqP; ty; x; r ])
+ l (superposition table vl))
in
bag, maxvar, r_terms @ l_terms
| _ -> assert false