YES We show the termination of the TRS R: eq(|0|(),|0|()) -> true() eq(|0|(),s(X)) -> false() eq(s(X),|0|()) -> false() eq(s(X),s(Y)) -> eq(X,Y) rm(N,nil()) -> nil() rm(N,add(M,X)) -> ifrm(eq(N,M),N,add(M,X)) ifrm(true(),N,add(M,X)) -> rm(N,X) ifrm(false(),N,add(M,X)) -> add(M,rm(N,X)) purge(nil()) -> nil() purge(add(N,X)) -> add(N,purge(rm(N,X))) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: eq#(s(X),s(Y)) -> eq#(X,Y) p2: rm#(N,add(M,X)) -> ifrm#(eq(N,M),N,add(M,X)) p3: rm#(N,add(M,X)) -> eq#(N,M) p4: ifrm#(true(),N,add(M,X)) -> rm#(N,X) p5: ifrm#(false(),N,add(M,X)) -> rm#(N,X) p6: purge#(add(N,X)) -> purge#(rm(N,X)) p7: purge#(add(N,X)) -> rm#(N,X) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(X)) -> false() r3: eq(s(X),|0|()) -> false() r4: eq(s(X),s(Y)) -> eq(X,Y) r5: rm(N,nil()) -> nil() r6: rm(N,add(M,X)) -> ifrm(eq(N,M),N,add(M,X)) r7: ifrm(true(),N,add(M,X)) -> rm(N,X) r8: ifrm(false(),N,add(M,X)) -> add(M,rm(N,X)) r9: purge(nil()) -> nil() r10: purge(add(N,X)) -> add(N,purge(rm(N,X))) The estimated dependency graph contains the following SCCs: {p6} {p2, p4, p5} {p1} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: purge#(add(N,X)) -> purge#(rm(N,X)) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(X)) -> false() r3: eq(s(X),|0|()) -> false() r4: eq(s(X),s(Y)) -> eq(X,Y) r5: rm(N,nil()) -> nil() r6: rm(N,add(M,X)) -> ifrm(eq(N,M),N,add(M,X)) r7: ifrm(true(),N,add(M,X)) -> rm(N,X) r8: ifrm(false(),N,add(M,X)) -> add(M,rm(N,X)) r9: purge(nil()) -> nil() r10: purge(add(N,X)) -> add(N,purge(rm(N,X))) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8 Take the reduction pair: weighted path order base order: max/plus interpretations on natural numbers: purge#_A(x1) = x1 + 1 add_A(x1,x2) = max{x1 + 4, x2 + 4} rm_A(x1,x2) = x2 + 2 eq_A(x1,x2) = x2 + 7 |0|_A = 10 true_A = 11 s_A(x1) = x1 + 12 false_A = 9 ifrm_A(x1,x2,x3) = max{6, x1 - 1, x3 + 2} nil_A = 2 precedence: rm = ifrm > add > purge# > eq = |0| = true = s = false = nil partial status: pi(purge#) = [1] pi(add) = [2] pi(rm) = [] pi(eq) = [2] pi(|0|) = [] pi(true) = [] pi(s) = [1] pi(false) = [] pi(ifrm) = [] pi(nil) = [] The next rules are strictly ordered: p1 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: ifrm#(false(),N,add(M,X)) -> rm#(N,X) p2: rm#(N,add(M,X)) -> ifrm#(eq(N,M),N,add(M,X)) p3: ifrm#(true(),N,add(M,X)) -> rm#(N,X) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(X)) -> false() r3: eq(s(X),|0|()) -> false() r4: eq(s(X),s(Y)) -> eq(X,Y) r5: rm(N,nil()) -> nil() r6: rm(N,add(M,X)) -> ifrm(eq(N,M),N,add(M,X)) r7: ifrm(true(),N,add(M,X)) -> rm(N,X) r8: ifrm(false(),N,add(M,X)) -> add(M,rm(N,X)) r9: purge(nil()) -> nil() r10: purge(add(N,X)) -> add(N,purge(rm(N,X))) The set of usable rules consists of r1, r2, r3, r4 Take the reduction pair: weighted path order base order: max/plus interpretations on natural numbers: ifrm#_A(x1,x2,x3) = max{x1 - 3, x3 + 1} false_A = 11 add_A(x1,x2) = max{x1 - 3, x2 + 5} rm#_A(x1,x2) = x2 + 2 eq_A(x1,x2) = max{9, x2 + 1} true_A = 6 |0|_A = 23 s_A(x1) = x1 + 10 precedence: ifrm# = false = add = rm# = eq = true > |0| = s partial status: pi(ifrm#) = [3] pi(false) = [] pi(add) = [2] pi(rm#) = [] pi(eq) = [] pi(true) = [] pi(|0|) = [] pi(s) = [1] The next rules are strictly ordered: p1 We remove them from the problem. -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: rm#(N,add(M,X)) -> ifrm#(eq(N,M),N,add(M,X)) p2: ifrm#(true(),N,add(M,X)) -> rm#(N,X) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(X)) -> false() r3: eq(s(X),|0|()) -> false() r4: eq(s(X),s(Y)) -> eq(X,Y) r5: rm(N,nil()) -> nil() r6: rm(N,add(M,X)) -> ifrm(eq(N,M),N,add(M,X)) r7: ifrm(true(),N,add(M,X)) -> rm(N,X) r8: ifrm(false(),N,add(M,X)) -> add(M,rm(N,X)) r9: purge(nil()) -> nil() r10: purge(add(N,X)) -> add(N,purge(rm(N,X))) The estimated dependency graph contains the following SCCs: {p1, p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: rm#(N,add(M,X)) -> ifrm#(eq(N,M),N,add(M,X)) p2: ifrm#(true(),N,add(M,X)) -> rm#(N,X) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(X)) -> false() r3: eq(s(X),|0|()) -> false() r4: eq(s(X),s(Y)) -> eq(X,Y) r5: rm(N,nil()) -> nil() r6: rm(N,add(M,X)) -> ifrm(eq(N,M),N,add(M,X)) r7: ifrm(true(),N,add(M,X)) -> rm(N,X) r8: ifrm(false(),N,add(M,X)) -> add(M,rm(N,X)) r9: purge(nil()) -> nil() r10: purge(add(N,X)) -> add(N,purge(rm(N,X))) The set of usable rules consists of r1, r2, r3, r4 Take the reduction pair: weighted path order base order: max/plus interpretations on natural numbers: rm#_A(x1,x2) = max{x1 + 7, x2 + 3} add_A(x1,x2) = x2 + 4 ifrm#_A(x1,x2,x3) = max{x2 + 7, x3} eq_A(x1,x2) = max{8, x1 - 3} true_A = 1 |0|_A = 0 s_A(x1) = max{12, x1 + 2} false_A = 1 precedence: rm# = add = ifrm# = eq = true = |0| = s = false partial status: pi(rm#) = [2] pi(add) = [2] pi(ifrm#) = [3] pi(eq) = [] pi(true) = [] pi(|0|) = [] pi(s) = [1] pi(false) = [] The next rules are strictly ordered: p2 We remove them from the problem. -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: rm#(N,add(M,X)) -> ifrm#(eq(N,M),N,add(M,X)) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(X)) -> false() r3: eq(s(X),|0|()) -> false() r4: eq(s(X),s(Y)) -> eq(X,Y) r5: rm(N,nil()) -> nil() r6: rm(N,add(M,X)) -> ifrm(eq(N,M),N,add(M,X)) r7: ifrm(true(),N,add(M,X)) -> rm(N,X) r8: ifrm(false(),N,add(M,X)) -> add(M,rm(N,X)) r9: purge(nil()) -> nil() r10: purge(add(N,X)) -> add(N,purge(rm(N,X))) The estimated dependency graph contains the following SCCs: (no SCCs) -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: eq#(s(X),s(Y)) -> eq#(X,Y) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(X)) -> false() r3: eq(s(X),|0|()) -> false() r4: eq(s(X),s(Y)) -> eq(X,Y) r5: rm(N,nil()) -> nil() r6: rm(N,add(M,X)) -> ifrm(eq(N,M),N,add(M,X)) r7: ifrm(true(),N,add(M,X)) -> rm(N,X) r8: ifrm(false(),N,add(M,X)) -> add(M,rm(N,X)) r9: purge(nil()) -> nil() r10: purge(add(N,X)) -> add(N,purge(rm(N,X))) The set of usable rules consists of (no rules) Take the reduction pair: weighted path order base order: max/plus interpretations on natural numbers: eq#_A(x1,x2) = max{0, x1 - 2, x2 - 2} s_A(x1) = max{3, x1 + 1} precedence: eq# = s partial status: pi(eq#) = [] pi(s) = [] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.