YES We show the termination of the TRS R: merge(nil(),y) -> y merge(x,nil()) -> x merge(.(x,y),.(u,v)) -> if(<(x,u),.(x,merge(y,.(u,v))),.(u,merge(.(x,y),v))) ++(nil(),y) -> y ++(.(x,y),z) -> .(x,++(y,z)) if(true(),x,y) -> x if(false(),x,y) -> x -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: merge#(.(x,y),.(u,v)) -> if#(<(x,u),.(x,merge(y,.(u,v))),.(u,merge(.(x,y),v))) p2: merge#(.(x,y),.(u,v)) -> merge#(y,.(u,v)) p3: merge#(.(x,y),.(u,v)) -> merge#(.(x,y),v) p4: ++#(.(x,y),z) -> ++#(y,z) and R consists of: r1: merge(nil(),y) -> y r2: merge(x,nil()) -> x r3: merge(.(x,y),.(u,v)) -> if(<(x,u),.(x,merge(y,.(u,v))),.(u,merge(.(x,y),v))) r4: ++(nil(),y) -> y r5: ++(.(x,y),z) -> .(x,++(y,z)) r6: if(true(),x,y) -> x r7: if(false(),x,y) -> x The estimated dependency graph contains the following SCCs: {p2, p3} {p4} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: merge#(.(x,y),.(u,v)) -> merge#(y,.(u,v)) p2: merge#(.(x,y),.(u,v)) -> merge#(.(x,y),v) and R consists of: r1: merge(nil(),y) -> y r2: merge(x,nil()) -> x r3: merge(.(x,y),.(u,v)) -> if(<(x,u),.(x,merge(y,.(u,v))),.(u,merge(.(x,y),v))) r4: ++(nil(),y) -> y r5: ++(.(x,y),z) -> .(x,++(y,z)) r6: if(true(),x,y) -> x r7: if(false(),x,y) -> x The set of usable rules consists of (no rules) Take the reduction pair: matrix interpretations: carrier: N^3 order: lexicographic order interpretations: merge#_A(x1,x2) = ((0,0,0),(0,0,0),(1,0,0)) x1 + ((1,0,0),(1,1,0),(1,0,1)) x2 ._A(x1,x2) = ((1,0,0),(1,0,0),(1,1,0)) x1 + ((1,0,0),(1,0,0),(1,1,0)) x2 + (1,1,1) The next rules are strictly ordered: p1, p2 We remove them from the problem. Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: ++#(.(x,y),z) -> ++#(y,z) and R consists of: r1: merge(nil(),y) -> y r2: merge(x,nil()) -> x r3: merge(.(x,y),.(u,v)) -> if(<(x,u),.(x,merge(y,.(u,v))),.(u,merge(.(x,y),v))) r4: ++(nil(),y) -> y r5: ++(.(x,y),z) -> .(x,++(y,z)) r6: if(true(),x,y) -> x r7: if(false(),x,y) -> x The set of usable rules consists of (no rules) Take the reduction pair: matrix interpretations: carrier: N^3 order: lexicographic order interpretations: ++#_A(x1,x2) = ((0,0,0),(1,0,0),(1,1,0)) x1 + ((1,0,0),(0,1,0),(0,1,1)) x2 ._A(x1,x2) = ((1,0,0),(1,1,0),(1,1,1)) x1 + ((1,0,0),(1,1,0),(1,1,1)) x2 + (1,1,1) The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.