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: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1) = x1 nf_A(x1,x2) = max{10, x1 + 6, x2 + 3} f#_A(x1,x2) = max{2, x1 + 1, x2 + 1} a_A(x1) = max{4, x1} s_A(x1) = max{3, x1} cs_A(x1,x2) = max{x1 + 7, x2} ns_A(x1) = max{2, x1} nt_A(x1) = max{21, x1 + 17} d_A(x1) = x1 + 6 |0|_A = 6 p_A(x1,x2) = max{13, x1, x2 + 4} q_A(x1) = x1 + 10 t_A(x1) = max{21, x1 + 17} r_A(x1) = max{9, x1} f_A(x1,x2) = max{10, x1 + 6, x2 + 3} nil_A = 11 precedence: f# = d > nf = a = |0| = q = t = f = nil > nt > cs = p > a# = s = ns > r partial status: pi(a#) = [1] pi(nf) = [1, 2] pi(f#) = [1, 2] pi(a) = [1] pi(s) = [1] pi(cs) = [1, 2] pi(ns) = [1] pi(nt) = [1] pi(d) = [1] pi(|0|) = [] pi(p) = [1, 2] pi(q) = [1] pi(t) = [1] pi(r) = [1] pi(f) = [1, 2] pi(nil) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1) = x1 + 30 nf_A(x1,x2) = max{x1 + 2, x2 + 25} f#_A(x1,x2) = max{29, x1 - 5, x2} a_A(x1) = x1 + 33 s_A(x1) = max{34, x1} cs_A(x1,x2) = max{x1 + 1, x2 + 17} ns_A(x1) = x1 nt_A(x1) = x1 + 1 d_A(x1) = 34 |0|_A = 38 p_A(x1,x2) = max{x1 + 74, x2 + 74} q_A(x1) = x1 + 38 t_A(x1) = max{35, x1 + 17} r_A(x1) = max{36, x1 - 1} f_A(x1,x2) = max{x1 + 74, x2 + 40} nil_A = 39 precedence: r = f = nil > a# = nf = f# = a = cs = nt = d = t > s > ns > |0| = p = q partial status: pi(a#) = [] pi(nf) = [2] pi(f#) = [2] pi(a) = [1] pi(s) = [] pi(cs) = [2] pi(ns) = [] pi(nt) = [1] pi(d) = [] pi(|0|) = [] pi(p) = [1] pi(q) = [1] pi(t) = [] pi(r) = [] pi(f) = [] pi(nil) = [] The next rules are strictly ordered: p1, p2, p3, p4, p5, p6 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 reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: q#_A(x1) = max{4, x1 + 3} s_A(x1) = max{3, x1 + 2} precedence: q# = s partial status: pi(q#) = [1] pi(s) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: q#_A(x1) = max{1, x1 - 1} s_A(x1) = x1 precedence: q# = s partial status: pi(q#) = [] 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: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: p#_A(x1,x2) = max{2, x1 - 1, x2 + 1} s_A(x1) = max{1, x1} precedence: p# = s partial status: pi(p#) = [2] pi(s) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: p#_A(x1,x2) = 0 s_A(x1) = max{2, x1} precedence: p# = s partial status: pi(p#) = [] 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: 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 reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: d#_A(x1) = max{4, x1 + 3} s_A(x1) = max{3, x1 + 2} precedence: d# = s partial status: pi(d#) = [1] pi(s) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: d#_A(x1) = max{1, x1 - 1} s_A(x1) = x1 precedence: d# = s partial status: pi(d#) = [] pi(s) = [1] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.