YES We show the termination of the TRS R: t(N) -> cs(r(q(N)),nt(ns(N))) q(|0|()) -> |0|() q(s(X)) -> s(p(q(X),d(X))) d(|0|()) -> |0|() d(s(X)) -> s(s(d(X))) p(|0|(),X) -> X p(X,|0|()) -> X p(s(X),s(Y)) -> s(s(p(X,Y))) f(|0|(),X) -> nil() f(s(X),cs(Y,Z)) -> cs(Y,nf(X,a(Z))) t(X) -> nt(X) s(X) -> ns(X) f(X1,X2) -> nf(X1,X2) a(nt(X)) -> t(a(X)) a(ns(X)) -> s(a(X)) a(nf(X1,X2)) -> f(a(X1),a(X2)) a(X) -> X -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: t#(N) -> q#(N) p2: q#(s(X)) -> s#(p(q(X),d(X))) p3: q#(s(X)) -> p#(q(X),d(X)) p4: q#(s(X)) -> q#(X) p5: q#(s(X)) -> d#(X) p6: d#(s(X)) -> s#(s(d(X))) p7: d#(s(X)) -> s#(d(X)) p8: d#(s(X)) -> d#(X) p9: p#(s(X),s(Y)) -> s#(s(p(X,Y))) p10: p#(s(X),s(Y)) -> s#(p(X,Y)) p11: p#(s(X),s(Y)) -> p#(X,Y) p12: f#(s(X),cs(Y,Z)) -> a#(Z) p13: a#(nt(X)) -> t#(a(X)) p14: a#(nt(X)) -> a#(X) p15: a#(ns(X)) -> s#(a(X)) p16: a#(ns(X)) -> a#(X) p17: a#(nf(X1,X2)) -> f#(a(X1),a(X2)) p18: a#(nf(X1,X2)) -> a#(X1) p19: a#(nf(X1,X2)) -> a#(X2) and R consists of: r1: t(N) -> cs(r(q(N)),nt(ns(N))) r2: q(|0|()) -> |0|() r3: q(s(X)) -> s(p(q(X),d(X))) r4: d(|0|()) -> |0|() r5: d(s(X)) -> s(s(d(X))) r6: p(|0|(),X) -> X r7: p(X,|0|()) -> X r8: p(s(X),s(Y)) -> s(s(p(X,Y))) r9: f(|0|(),X) -> nil() r10: f(s(X),cs(Y,Z)) -> cs(Y,nf(X,a(Z))) r11: t(X) -> nt(X) r12: s(X) -> ns(X) r13: f(X1,X2) -> nf(X1,X2) r14: a(nt(X)) -> t(a(X)) r15: a(ns(X)) -> s(a(X)) r16: a(nf(X1,X2)) -> f(a(X1),a(X2)) r17: a(X) -> X The estimated dependency graph contains the following SCCs: {p12, p14, p16, p17, p18, p19} {p4} {p11} {p8} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: a#(nf(X1,X2)) -> a#(X2) p2: a#(nf(X1,X2)) -> a#(X1) p3: a#(nf(X1,X2)) -> f#(a(X1),a(X2)) p4: f#(s(X),cs(Y,Z)) -> a#(Z) p5: a#(ns(X)) -> a#(X) p6: a#(nt(X)) -> a#(X) and R consists of: r1: t(N) -> cs(r(q(N)),nt(ns(N))) r2: q(|0|()) -> |0|() r3: q(s(X)) -> s(p(q(X),d(X))) r4: d(|0|()) -> |0|() r5: d(s(X)) -> s(s(d(X))) r6: p(|0|(),X) -> X r7: p(X,|0|()) -> X r8: p(s(X),s(Y)) -> s(s(p(X,Y))) r9: f(|0|(),X) -> nil() r10: f(s(X),cs(Y,Z)) -> cs(Y,nf(X,a(Z))) r11: t(X) -> nt(X) r12: s(X) -> ns(X) r13: f(X1,X2) -> nf(X1,X2) r14: a(nt(X)) -> t(a(X)) r15: a(ns(X)) -> s(a(X)) r16: a(nf(X1,X2)) -> f(a(X1),a(X2)) r17: a(X) -> X The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17 Take the reduction pair: weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1) = x1 + 8 nf_A(x1,x2) = max{x1 + 12, x2 + 14} f#_A(x1,x2) = max{x1 + 11, x2 + 14} a_A(x1) = x1 s_A(x1) = x1 cs_A(x1,x2) = max{11, x1 + 9, x2} ns_A(x1) = x1 nt_A(x1) = x1 + 11 d_A(x1) = x1 + 2 |0|_A = 2 p_A(x1,x2) = max{11, x1, x2 + 9} q_A(x1) = x1 + 11 t_A(x1) = x1 + 11 r_A(x1) = max{2, x1 - 10} f_A(x1,x2) = max{x1 + 12, x2 + 14} nil_A = 1 precedence: d > nt = t > |0| > q > p > nf = a = s = cs = ns = f = nil > a# = f# = r partial status: pi(a#) = [1] pi(nf) = [1, 2] pi(f#) = [1] pi(a) = [1] pi(s) = [1] pi(cs) = [] pi(ns) = [1] pi(nt) = [] pi(d) = [1] pi(|0|) = [] pi(p) = [1, 2] pi(q) = [1] pi(t) = [] pi(r) = [] pi(f) = [1, 2] pi(nil) = [] 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: a#(nf(X1,X2)) -> a#(X1) p2: a#(nf(X1,X2)) -> f#(a(X1),a(X2)) p3: f#(s(X),cs(Y,Z)) -> a#(Z) p4: a#(ns(X)) -> a#(X) p5: a#(nt(X)) -> a#(X) and R consists of: r1: t(N) -> cs(r(q(N)),nt(ns(N))) r2: q(|0|()) -> |0|() r3: q(s(X)) -> s(p(q(X),d(X))) r4: d(|0|()) -> |0|() r5: d(s(X)) -> s(s(d(X))) r6: p(|0|(),X) -> X r7: p(X,|0|()) -> X r8: p(s(X),s(Y)) -> s(s(p(X,Y))) r9: f(|0|(),X) -> nil() r10: f(s(X),cs(Y,Z)) -> cs(Y,nf(X,a(Z))) r11: t(X) -> nt(X) r12: s(X) -> ns(X) r13: f(X1,X2) -> nf(X1,X2) r14: a(nt(X)) -> t(a(X)) r15: a(ns(X)) -> s(a(X)) r16: a(nf(X1,X2)) -> f(a(X1),a(X2)) r17: a(X) -> X The estimated dependency graph contains the following SCCs: {p1, p2, p3, p4, p5} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: a#(nf(X1,X2)) -> a#(X1) p2: a#(nt(X)) -> a#(X) p3: a#(ns(X)) -> a#(X) p4: a#(nf(X1,X2)) -> f#(a(X1),a(X2)) p5: f#(s(X),cs(Y,Z)) -> a#(Z) and R consists of: r1: t(N) -> cs(r(q(N)),nt(ns(N))) r2: q(|0|()) -> |0|() r3: q(s(X)) -> s(p(q(X),d(X))) r4: d(|0|()) -> |0|() r5: d(s(X)) -> s(s(d(X))) r6: p(|0|(),X) -> X r7: p(X,|0|()) -> X r8: p(s(X),s(Y)) -> s(s(p(X,Y))) r9: f(|0|(),X) -> nil() r10: f(s(X),cs(Y,Z)) -> cs(Y,nf(X,a(Z))) r11: t(X) -> nt(X) r12: s(X) -> ns(X) r13: f(X1,X2) -> nf(X1,X2) r14: a(nt(X)) -> t(a(X)) r15: a(ns(X)) -> s(a(X)) r16: a(nf(X1,X2)) -> f(a(X1),a(X2)) r17: a(X) -> X The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17 Take the reduction pair: weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1) = max{0, x1 - 2} nf_A(x1,x2) = max{13, x1 + 11, x2 + 12} nt_A(x1) = max{10, x1 + 3} ns_A(x1) = max{6, x1} f#_A(x1,x2) = max{x1 + 8, x2 + 8} a_A(x1) = x1 s_A(x1) = max{6, x1} cs_A(x1,x2) = max{10, x1 + 1, x2} d_A(x1) = max{8, x1 + 1} |0|_A = 4 p_A(x1,x2) = max{x1, x2 + 2} q_A(x1) = max{5, x1 + 4} t_A(x1) = max{10, x1 + 3} r_A(x1) = 1 f_A(x1,x2) = max{13, x1 + 11, x2 + 12} nil_A = 11 precedence: nf = nt = q = t = f = nil > p > a# = cs = d > f# > |0| = r > ns = a = s partial status: pi(a#) = [] pi(nf) = [] pi(nt) = [] pi(ns) = [1] pi(f#) = [2] pi(a) = [1] pi(s) = [1] pi(cs) = [] pi(d) = [1] pi(|0|) = [] pi(p) = [1, 2] pi(q) = [1] pi(t) = [] pi(r) = [] pi(f) = [] pi(nil) = [] The next rules are strictly ordered: p5 We remove them from the problem. -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: a#(nf(X1,X2)) -> a#(X1) p2: a#(nt(X)) -> a#(X) p3: a#(ns(X)) -> a#(X) p4: a#(nf(X1,X2)) -> f#(a(X1),a(X2)) and R consists of: r1: t(N) -> cs(r(q(N)),nt(ns(N))) r2: q(|0|()) -> |0|() r3: q(s(X)) -> s(p(q(X),d(X))) r4: d(|0|()) -> |0|() r5: d(s(X)) -> s(s(d(X))) r6: p(|0|(),X) -> X r7: p(X,|0|()) -> X r8: p(s(X),s(Y)) -> s(s(p(X,Y))) r9: f(|0|(),X) -> nil() r10: f(s(X),cs(Y,Z)) -> cs(Y,nf(X,a(Z))) r11: t(X) -> nt(X) r12: s(X) -> ns(X) r13: f(X1,X2) -> nf(X1,X2) r14: a(nt(X)) -> t(a(X)) r15: a(ns(X)) -> s(a(X)) r16: a(nf(X1,X2)) -> f(a(X1),a(X2)) r17: a(X) -> X The estimated dependency graph contains the following SCCs: {p1, p2, p3} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: a#(nf(X1,X2)) -> a#(X1) p2: a#(ns(X)) -> a#(X) p3: a#(nt(X)) -> a#(X) and R consists of: r1: t(N) -> cs(r(q(N)),nt(ns(N))) r2: q(|0|()) -> |0|() r3: q(s(X)) -> s(p(q(X),d(X))) r4: d(|0|()) -> |0|() r5: d(s(X)) -> s(s(d(X))) r6: p(|0|(),X) -> X r7: p(X,|0|()) -> X r8: p(s(X),s(Y)) -> s(s(p(X,Y))) r9: f(|0|(),X) -> nil() r10: f(s(X),cs(Y,Z)) -> cs(Y,nf(X,a(Z))) r11: t(X) -> nt(X) r12: s(X) -> ns(X) r13: f(X1,X2) -> nf(X1,X2) r14: a(nt(X)) -> t(a(X)) r15: a(ns(X)) -> s(a(X)) r16: a(nf(X1,X2)) -> f(a(X1),a(X2)) r17: a(X) -> X The set of usable rules consists of (no rules) Take the monotone reduction pair: weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1) = x1 + 1 nf_A(x1,x2) = max{x1, x2} ns_A(x1) = x1 nt_A(x1) = x1 precedence: a# = nf = ns = nt partial status: pi(a#) = [1] pi(nf) = [1, 2] pi(ns) = [1] pi(nt) = [1] 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: a#(nf(X1,X2)) -> a#(X1) p2: a#(nt(X)) -> a#(X) and R consists of: r1: t(N) -> cs(r(q(N)),nt(ns(N))) r2: q(|0|()) -> |0|() r3: q(s(X)) -> s(p(q(X),d(X))) r4: d(|0|()) -> |0|() r5: d(s(X)) -> s(s(d(X))) r6: p(|0|(),X) -> X r7: p(X,|0|()) -> X r8: p(s(X),s(Y)) -> s(s(p(X,Y))) r9: f(|0|(),X) -> nil() r10: f(s(X),cs(Y,Z)) -> cs(Y,nf(X,a(Z))) r11: t(X) -> nt(X) r12: s(X) -> ns(X) r13: f(X1,X2) -> nf(X1,X2) r14: a(nt(X)) -> t(a(X)) r15: a(ns(X)) -> s(a(X)) r16: a(nf(X1,X2)) -> f(a(X1),a(X2)) r17: a(X) -> 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: a#(nf(X1,X2)) -> a#(X1) p2: a#(nt(X)) -> a#(X) and R consists of: r1: t(N) -> cs(r(q(N)),nt(ns(N))) r2: q(|0|()) -> |0|() r3: q(s(X)) -> s(p(q(X),d(X))) r4: d(|0|()) -> |0|() r5: d(s(X)) -> s(s(d(X))) r6: p(|0|(),X) -> X r7: p(X,|0|()) -> X r8: p(s(X),s(Y)) -> s(s(p(X,Y))) r9: f(|0|(),X) -> nil() r10: f(s(X),cs(Y,Z)) -> cs(Y,nf(X,a(Z))) r11: t(X) -> nt(X) r12: s(X) -> ns(X) r13: f(X1,X2) -> nf(X1,X2) r14: a(nt(X)) -> t(a(X)) r15: a(ns(X)) -> s(a(X)) r16: a(nf(X1,X2)) -> f(a(X1),a(X2)) r17: a(X) -> X The set of usable rules consists of (no rules) Take the monotone reduction pair: weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1) = max{3, x1 + 1} nf_A(x1,x2) = max{x1 + 2, x2} nt_A(x1) = max{2, x1} precedence: a# = nf = nt partial status: pi(a#) = [1] pi(nf) = [1, 2] pi(nt) = [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: a#(nt(X)) -> a#(X) and R consists of: r1: t(N) -> cs(r(q(N)),nt(ns(N))) r2: q(|0|()) -> |0|() r3: q(s(X)) -> s(p(q(X),d(X))) r4: d(|0|()) -> |0|() r5: d(s(X)) -> s(s(d(X))) r6: p(|0|(),X) -> X r7: p(X,|0|()) -> X r8: p(s(X),s(Y)) -> s(s(p(X,Y))) r9: f(|0|(),X) -> nil() r10: f(s(X),cs(Y,Z)) -> cs(Y,nf(X,a(Z))) r11: t(X) -> nt(X) r12: s(X) -> ns(X) r13: f(X1,X2) -> nf(X1,X2) r14: a(nt(X)) -> t(a(X)) r15: a(ns(X)) -> s(a(X)) r16: a(nf(X1,X2)) -> f(a(X1),a(X2)) r17: a(X) -> X The estimated dependency graph contains the following SCCs: {p1} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: a#(nt(X)) -> a#(X) and R consists of: r1: t(N) -> cs(r(q(N)),nt(ns(N))) r2: q(|0|()) -> |0|() r3: q(s(X)) -> s(p(q(X),d(X))) r4: d(|0|()) -> |0|() r5: d(s(X)) -> s(s(d(X))) r6: p(|0|(),X) -> X r7: p(X,|0|()) -> X r8: p(s(X),s(Y)) -> s(s(p(X,Y))) r9: f(|0|(),X) -> nil() r10: f(s(X),cs(Y,Z)) -> cs(Y,nf(X,a(Z))) r11: t(X) -> nt(X) r12: s(X) -> ns(X) r13: f(X1,X2) -> nf(X1,X2) r14: a(nt(X)) -> t(a(X)) r15: a(ns(X)) -> s(a(X)) r16: a(nf(X1,X2)) -> f(a(X1),a(X2)) r17: a(X) -> X The set of usable rules consists of (no rules) Take the monotone reduction pair: weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1) = x1 + 2 nt_A(x1) = x1 + 2 precedence: a# = nt partial status: pi(a#) = [1] pi(nt) = [1] 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: q#(s(X)) -> q#(X) and R consists of: r1: t(N) -> cs(r(q(N)),nt(ns(N))) r2: q(|0|()) -> |0|() r3: q(s(X)) -> s(p(q(X),d(X))) r4: d(|0|()) -> |0|() r5: d(s(X)) -> s(s(d(X))) r6: p(|0|(),X) -> X r7: p(X,|0|()) -> X r8: p(s(X),s(Y)) -> s(s(p(X,Y))) r9: f(|0|(),X) -> nil() r10: f(s(X),cs(Y,Z)) -> cs(Y,nf(X,a(Z))) r11: t(X) -> nt(X) r12: s(X) -> ns(X) r13: f(X1,X2) -> nf(X1,X2) r14: a(nt(X)) -> t(a(X)) r15: a(ns(X)) -> s(a(X)) r16: a(nf(X1,X2)) -> f(a(X1),a(X2)) r17: a(X) -> X The set of usable rules consists of (no rules) Take the monotone reduction pair: weighted path order base order: max/plus interpretations on natural numbers: q#_A(x1) = x1 + 2 s_A(x1) = x1 + 2 precedence: q# = s partial status: pi(q#) = [1] pi(s) = [1] 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: p#(s(X),s(Y)) -> p#(X,Y) and R consists of: r1: t(N) -> cs(r(q(N)),nt(ns(N))) r2: q(|0|()) -> |0|() r3: q(s(X)) -> s(p(q(X),d(X))) r4: d(|0|()) -> |0|() r5: d(s(X)) -> s(s(d(X))) r6: p(|0|(),X) -> X r7: p(X,|0|()) -> X r8: p(s(X),s(Y)) -> s(s(p(X,Y))) r9: f(|0|(),X) -> nil() r10: f(s(X),cs(Y,Z)) -> cs(Y,nf(X,a(Z))) r11: t(X) -> nt(X) r12: s(X) -> ns(X) r13: f(X1,X2) -> nf(X1,X2) r14: a(nt(X)) -> t(a(X)) r15: a(ns(X)) -> s(a(X)) r16: a(nf(X1,X2)) -> f(a(X1),a(X2)) r17: a(X) -> 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: p#_A(x1,x2) = max{0, x1 - 2, x2 - 2} s_A(x1) = max{3, x1 + 1} precedence: p# = s partial status: pi(p#) = [] pi(s) = [] 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: d#(s(X)) -> d#(X) and R consists of: r1: t(N) -> cs(r(q(N)),nt(ns(N))) r2: q(|0|()) -> |0|() r3: q(s(X)) -> s(p(q(X),d(X))) r4: d(|0|()) -> |0|() r5: d(s(X)) -> s(s(d(X))) r6: p(|0|(),X) -> X r7: p(X,|0|()) -> X r8: p(s(X),s(Y)) -> s(s(p(X,Y))) r9: f(|0|(),X) -> nil() r10: f(s(X),cs(Y,Z)) -> cs(Y,nf(X,a(Z))) r11: t(X) -> nt(X) r12: s(X) -> ns(X) r13: f(X1,X2) -> nf(X1,X2) r14: a(nt(X)) -> t(a(X)) r15: a(ns(X)) -> s(a(X)) r16: a(nf(X1,X2)) -> f(a(X1),a(X2)) r17: a(X) -> X The set of usable rules consists of (no rules) Take the monotone reduction pair: weighted path order base order: max/plus interpretations on natural numbers: d#_A(x1) = x1 + 2 s_A(x1) = x1 + 2 precedence: d# = s partial status: pi(d#) = [1] pi(s) = [1] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.