YES We show the termination of the TRS R: a(h(),h(),h(),x) -> s(x) a(l,x,s(y),h()) -> a(l,x,y,s(h())) a(l,x,s(y),s(z)) -> a(l,x,y,a(l,x,s(y),z)) a(l,s(x),h(),z) -> a(l,x,z,z) a(s(l),h(),h(),z) -> a(l,z,h(),z) +(x,h()) -> x +(h(),x) -> x +(s(x),s(y)) -> s(s(+(x,y))) +(+(x,y),z) -> +(x,+(y,z)) s(h()) -> |1|() app(nil(),k) -> k app(l,nil()) -> l app(cons(x,l),k) -> cons(x,app(l,k)) sum(cons(x,nil())) -> cons(x,nil()) sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h(),h()),l)) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: a#(h(),h(),h(),x) -> s#(x) p2: a#(l,x,s(y),h()) -> a#(l,x,y,s(h())) p3: a#(l,x,s(y),h()) -> s#(h()) p4: a#(l,x,s(y),s(z)) -> a#(l,x,y,a(l,x,s(y),z)) p5: a#(l,x,s(y),s(z)) -> a#(l,x,s(y),z) p6: a#(l,s(x),h(),z) -> a#(l,x,z,z) p7: a#(s(l),h(),h(),z) -> a#(l,z,h(),z) p8: +#(s(x),s(y)) -> s#(s(+(x,y))) p9: +#(s(x),s(y)) -> s#(+(x,y)) p10: +#(s(x),s(y)) -> +#(x,y) p11: +#(+(x,y),z) -> +#(x,+(y,z)) p12: +#(+(x,y),z) -> +#(y,z) p13: app#(cons(x,l),k) -> app#(l,k) p14: sum#(cons(x,cons(y,l))) -> sum#(cons(a(x,y,h(),h()),l)) p15: sum#(cons(x,cons(y,l))) -> a#(x,y,h(),h()) and R consists of: r1: a(h(),h(),h(),x) -> s(x) r2: a(l,x,s(y),h()) -> a(l,x,y,s(h())) r3: a(l,x,s(y),s(z)) -> a(l,x,y,a(l,x,s(y),z)) r4: a(l,s(x),h(),z) -> a(l,x,z,z) r5: a(s(l),h(),h(),z) -> a(l,z,h(),z) r6: +(x,h()) -> x r7: +(h(),x) -> x r8: +(s(x),s(y)) -> s(s(+(x,y))) r9: +(+(x,y),z) -> +(x,+(y,z)) r10: s(h()) -> |1|() r11: app(nil(),k) -> k r12: app(l,nil()) -> l r13: app(cons(x,l),k) -> cons(x,app(l,k)) r14: sum(cons(x,nil())) -> cons(x,nil()) r15: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h(),h()),l)) The estimated dependency graph contains the following SCCs: {p14} {p2, p4, p5, p6, p7} {p10, p11, p12} {p13} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: sum#(cons(x,cons(y,l))) -> sum#(cons(a(x,y,h(),h()),l)) and R consists of: r1: a(h(),h(),h(),x) -> s(x) r2: a(l,x,s(y),h()) -> a(l,x,y,s(h())) r3: a(l,x,s(y),s(z)) -> a(l,x,y,a(l,x,s(y),z)) r4: a(l,s(x),h(),z) -> a(l,x,z,z) r5: a(s(l),h(),h(),z) -> a(l,z,h(),z) r6: +(x,h()) -> x r7: +(h(),x) -> x r8: +(s(x),s(y)) -> s(s(+(x,y))) r9: +(+(x,y),z) -> +(x,+(y,z)) r10: s(h()) -> |1|() r11: app(nil(),k) -> k r12: app(l,nil()) -> l r13: app(cons(x,l),k) -> cons(x,app(l,k)) r14: sum(cons(x,nil())) -> cons(x,nil()) r15: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h(),h()),l)) The set of usable rules consists of r1, r2, r3, r4, r5, r10 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: sum#_A(x1) = max{20, x1 + 9} cons_A(x1,x2) = max{x1 + 10, x2 + 9} a_A(x1,x2,x3,x4) = 7 h_A = 0 s_A(x1) = 6 |1|_A = 1 precedence: sum# = cons = a = s = |1| > h partial status: pi(sum#) = [1] pi(cons) = [1, 2] pi(a) = [] pi(h) = [] pi(s) = [] pi(|1|) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: sum#_A(x1) = max{100, x1 + 14} cons_A(x1,x2) = max{x1 + 15, x2 + 43} a_A(x1,x2,x3,x4) = 6 h_A = 11 s_A(x1) = 15 |1|_A = 16 precedence: sum# > |1| > s > cons = a = h partial status: pi(sum#) = [] pi(cons) = [2] pi(a) = [] pi(h) = [] pi(s) = [] pi(|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: a#(l,x,s(y),h()) -> a#(l,x,y,s(h())) p2: a#(s(l),h(),h(),z) -> a#(l,z,h(),z) p3: a#(l,s(x),h(),z) -> a#(l,x,z,z) p4: a#(l,x,s(y),s(z)) -> a#(l,x,s(y),z) p5: a#(l,x,s(y),s(z)) -> a#(l,x,y,a(l,x,s(y),z)) and R consists of: r1: a(h(),h(),h(),x) -> s(x) r2: a(l,x,s(y),h()) -> a(l,x,y,s(h())) r3: a(l,x,s(y),s(z)) -> a(l,x,y,a(l,x,s(y),z)) r4: a(l,s(x),h(),z) -> a(l,x,z,z) r5: a(s(l),h(),h(),z) -> a(l,z,h(),z) r6: +(x,h()) -> x r7: +(h(),x) -> x r8: +(s(x),s(y)) -> s(s(+(x,y))) r9: +(+(x,y),z) -> +(x,+(y,z)) r10: s(h()) -> |1|() r11: app(nil(),k) -> k r12: app(l,nil()) -> l r13: app(cons(x,l),k) -> cons(x,app(l,k)) r14: sum(cons(x,nil())) -> cons(x,nil()) r15: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h(),h()),l)) The set of usable rules consists of r1, r2, r3, r4, r5, r10 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1,x2,x3,x4) = x1 + 4 s_A(x1) = x1 h_A = 0 a_A(x1,x2,x3,x4) = max{x1 + 5, x2, x3, x4} |1|_A = 0 precedence: a > s > a# > h = |1| partial status: pi(a#) = [1] pi(s) = [1] pi(h) = [] pi(a) = [1, 2, 3, 4] pi(|1|) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1,x2,x3,x4) = x1 + 1 s_A(x1) = x1 + 3 h_A = 8 a_A(x1,x2,x3,x4) = x4 + 3 |1|_A = 7 precedence: h = a > a# = s = |1| partial status: pi(a#) = [] pi(s) = [1] pi(h) = [] pi(a) = [] pi(|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#(l,x,s(y),h()) -> a#(l,x,y,s(h())) p2: a#(l,s(x),h(),z) -> a#(l,x,z,z) p3: a#(l,x,s(y),s(z)) -> a#(l,x,s(y),z) p4: a#(l,x,s(y),s(z)) -> a#(l,x,y,a(l,x,s(y),z)) and R consists of: r1: a(h(),h(),h(),x) -> s(x) r2: a(l,x,s(y),h()) -> a(l,x,y,s(h())) r3: a(l,x,s(y),s(z)) -> a(l,x,y,a(l,x,s(y),z)) r4: a(l,s(x),h(),z) -> a(l,x,z,z) r5: a(s(l),h(),h(),z) -> a(l,z,h(),z) r6: +(x,h()) -> x r7: +(h(),x) -> x r8: +(s(x),s(y)) -> s(s(+(x,y))) r9: +(+(x,y),z) -> +(x,+(y,z)) r10: s(h()) -> |1|() r11: app(nil(),k) -> k r12: app(l,nil()) -> l r13: app(cons(x,l),k) -> cons(x,app(l,k)) r14: sum(cons(x,nil())) -> cons(x,nil()) r15: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h(),h()),l)) The estimated dependency graph contains the following SCCs: {p1, p2, p3, p4} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: a#(l,x,s(y),h()) -> a#(l,x,y,s(h())) p2: a#(l,x,s(y),s(z)) -> a#(l,x,y,a(l,x,s(y),z)) p3: a#(l,x,s(y),s(z)) -> a#(l,x,s(y),z) p4: a#(l,s(x),h(),z) -> a#(l,x,z,z) and R consists of: r1: a(h(),h(),h(),x) -> s(x) r2: a(l,x,s(y),h()) -> a(l,x,y,s(h())) r3: a(l,x,s(y),s(z)) -> a(l,x,y,a(l,x,s(y),z)) r4: a(l,s(x),h(),z) -> a(l,x,z,z) r5: a(s(l),h(),h(),z) -> a(l,z,h(),z) r6: +(x,h()) -> x r7: +(h(),x) -> x r8: +(s(x),s(y)) -> s(s(+(x,y))) r9: +(+(x,y),z) -> +(x,+(y,z)) r10: s(h()) -> |1|() r11: app(nil(),k) -> k r12: app(l,nil()) -> l r13: app(cons(x,l),k) -> cons(x,app(l,k)) r14: sum(cons(x,nil())) -> cons(x,nil()) r15: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h(),h()),l)) The set of usable rules consists of r1, r2, r3, r4, r5, r10 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1,x2,x3,x4) = max{x1 + 1, x2 + 2, x3 + 1, x4 + 1} s_A(x1) = x1 h_A = 0 a_A(x1,x2,x3,x4) = max{x1, x2, x3, x4} |1|_A = 0 precedence: a > a# = s = |1| > h partial status: pi(a#) = [2, 3, 4] pi(s) = [1] pi(h) = [] pi(a) = [1, 2, 3, 4] pi(|1|) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1,x2,x3,x4) = max{x2 + 6, x3 + 2, x4 + 5} s_A(x1) = x1 h_A = 0 a_A(x1,x2,x3,x4) = max{x1 - 1, x2 - 1, x3 - 2, x4 + 4} |1|_A = 0 precedence: a > s = |1| > a# = h partial status: pi(a#) = [2, 3, 4] pi(s) = [1] pi(h) = [] pi(a) = [] pi(|1|) = [] The next rules are strictly ordered: p1, p2, p3, p4 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: +#(s(x),s(y)) -> +#(x,y) p2: +#(+(x,y),z) -> +#(y,z) p3: +#(+(x,y),z) -> +#(x,+(y,z)) and R consists of: r1: a(h(),h(),h(),x) -> s(x) r2: a(l,x,s(y),h()) -> a(l,x,y,s(h())) r3: a(l,x,s(y),s(z)) -> a(l,x,y,a(l,x,s(y),z)) r4: a(l,s(x),h(),z) -> a(l,x,z,z) r5: a(s(l),h(),h(),z) -> a(l,z,h(),z) r6: +(x,h()) -> x r7: +(h(),x) -> x r8: +(s(x),s(y)) -> s(s(+(x,y))) r9: +(+(x,y),z) -> +(x,+(y,z)) r10: s(h()) -> |1|() r11: app(nil(),k) -> k r12: app(l,nil()) -> l r13: app(cons(x,l),k) -> cons(x,app(l,k)) r14: sum(cons(x,nil())) -> cons(x,nil()) r15: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h(),h()),l)) The set of usable rules consists of r6, r7, r8, r9, r10 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: +#_A(x1,x2) = max{2, x1 + 1, x2} s_A(x1) = x1 +_A(x1,x2) = max{x1 + 1, x2} h_A = 2 |1|_A = 1 precedence: +# = + > s = h = |1| partial status: pi(+#) = [1] pi(s) = [1] pi(+) = [1, 2] pi(h) = [] pi(|1|) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: +#_A(x1,x2) = max{1, x1} s_A(x1) = x1 + 7 +_A(x1,x2) = max{6, x1 + 5, x2 + 2} h_A = 7 |1|_A = 8 precedence: +# = s = + = h = |1| partial status: pi(+#) = [1] pi(s) = [1] pi(+) = [1, 2] pi(h) = [] pi(|1|) = [] The next rules are strictly ordered: p1, p2, p3 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: app#(cons(x,l),k) -> app#(l,k) and R consists of: r1: a(h(),h(),h(),x) -> s(x) r2: a(l,x,s(y),h()) -> a(l,x,y,s(h())) r3: a(l,x,s(y),s(z)) -> a(l,x,y,a(l,x,s(y),z)) r4: a(l,s(x),h(),z) -> a(l,x,z,z) r5: a(s(l),h(),h(),z) -> a(l,z,h(),z) r6: +(x,h()) -> x r7: +(h(),x) -> x r8: +(s(x),s(y)) -> s(s(+(x,y))) r9: +(+(x,y),z) -> +(x,+(y,z)) r10: s(h()) -> |1|() r11: app(nil(),k) -> k r12: app(l,nil()) -> l r13: app(cons(x,l),k) -> cons(x,app(l,k)) r14: sum(cons(x,nil())) -> cons(x,nil()) r15: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h(),h()),l)) 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: app#_A(x1,x2) = x1 + 1 cons_A(x1,x2) = max{x1, x2 + 1} precedence: app# = cons partial status: pi(app#) = [1] pi(cons) = [1, 2] 2. weighted path order base order: max/plus interpretations on natural numbers: app#_A(x1,x2) = max{0, x1 - 1} cons_A(x1,x2) = max{x1, x2} precedence: app# = cons partial status: pi(app#) = [] pi(cons) = [1, 2] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.