YES We show the termination of the TRS R: 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()),l)) a(h(),h(),x) -> s(x) a(x,s(y),h()) -> a(x,y,s(h())) a(x,s(y),s(z)) -> a(x,y,a(x,s(y),z)) a(s(x),h(),z) -> a(x,z,z) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: app#(cons(x,l),k) -> app#(l,k) p2: sum#(cons(x,cons(y,l))) -> sum#(cons(a(x,y,h()),l)) p3: sum#(cons(x,cons(y,l))) -> a#(x,y,h()) p4: a#(x,s(y),h()) -> a#(x,y,s(h())) p5: a#(x,s(y),s(z)) -> a#(x,y,a(x,s(y),z)) p6: a#(x,s(y),s(z)) -> a#(x,s(y),z) p7: a#(s(x),h(),z) -> a#(x,z,z) and R consists of: r1: app(nil(),k) -> k r2: app(l,nil()) -> l r3: app(cons(x,l),k) -> cons(x,app(l,k)) r4: sum(cons(x,nil())) -> cons(x,nil()) r5: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h()),l)) r6: a(h(),h(),x) -> s(x) r7: a(x,s(y),h()) -> a(x,y,s(h())) r8: a(x,s(y),s(z)) -> a(x,y,a(x,s(y),z)) r9: a(s(x),h(),z) -> a(x,z,z) The estimated dependency graph contains the following SCCs: {p1} {p2} {p4, p5, p6, p7} -- 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: app(nil(),k) -> k r2: app(l,nil()) -> l r3: app(cons(x,l),k) -> cons(x,app(l,k)) r4: sum(cons(x,nil())) -> cons(x,nil()) r5: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h()),l)) r6: a(h(),h(),x) -> s(x) r7: a(x,s(y),h()) -> a(x,y,s(h())) r8: a(x,s(y),s(z)) -> a(x,y,a(x,s(y),z)) r9: a(s(x),h(),z) -> a(x,z,z) 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. -- 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()),l)) and R consists of: r1: app(nil(),k) -> k r2: app(l,nil()) -> l r3: app(cons(x,l),k) -> cons(x,app(l,k)) r4: sum(cons(x,nil())) -> cons(x,nil()) r5: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h()),l)) r6: a(h(),h(),x) -> s(x) r7: a(x,s(y),h()) -> a(x,y,s(h())) r8: a(x,s(y),s(z)) -> a(x,y,a(x,s(y),z)) r9: a(s(x),h(),z) -> a(x,z,z) The set of usable rules consists of r6, r7, r8, r9 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{3, x1 + 2} cons_A(x1,x2) = x2 + 9 a_A(x1,x2,x3) = max{x1 + 1, x2, x3} h_A = 17 s_A(x1) = x1 precedence: cons > sum# = a > h = s partial status: pi(sum#) = [1] pi(cons) = [2] pi(a) = [1, 2, 3] pi(h) = [] pi(s) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: sum#_A(x1) = max{30, x1 + 8} cons_A(x1,x2) = x2 + 11 a_A(x1,x2,x3) = max{1, x1 - 7, x2 - 1, x3 - 2} h_A = 4 s_A(x1) = x1 + 6 precedence: sum# = cons = a = h = s partial status: pi(sum#) = [] pi(cons) = [2] pi(a) = [] pi(h) = [] 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: a#(x,s(y),h()) -> a#(x,y,s(h())) p2: a#(s(x),h(),z) -> a#(x,z,z) p3: a#(x,s(y),s(z)) -> a#(x,s(y),z) p4: a#(x,s(y),s(z)) -> a#(x,y,a(x,s(y),z)) and R consists of: r1: app(nil(),k) -> k r2: app(l,nil()) -> l r3: app(cons(x,l),k) -> cons(x,app(l,k)) r4: sum(cons(x,nil())) -> cons(x,nil()) r5: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h()),l)) r6: a(h(),h(),x) -> s(x) r7: a(x,s(y),h()) -> a(x,y,s(h())) r8: a(x,s(y),s(z)) -> a(x,y,a(x,s(y),z)) r9: a(s(x),h(),z) -> a(x,z,z) The set of usable rules consists of r6, r7, r8, r9 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) = x1 + 1 s_A(x1) = x1 h_A = 0 a_A(x1,x2,x3) = max{x1, x2, x3} precedence: a# = a > s > h partial status: pi(a#) = [1] pi(s) = [1] pi(h) = [] pi(a) = [1, 2, 3] 2. weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1,x2,x3) = x1 + 1 s_A(x1) = max{4, x1} h_A = 3 a_A(x1,x2,x3) = max{x1 + 4, x2, x3} precedence: a > s > a# = h partial status: pi(a#) = [1] pi(s) = [1] pi(h) = [] pi(a) = [1, 2, 3] 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#(x,s(y),h()) -> a#(x,y,s(h())) p2: a#(x,s(y),s(z)) -> a#(x,s(y),z) p3: a#(x,s(y),s(z)) -> a#(x,y,a(x,s(y),z)) and R consists of: r1: app(nil(),k) -> k r2: app(l,nil()) -> l r3: app(cons(x,l),k) -> cons(x,app(l,k)) r4: sum(cons(x,nil())) -> cons(x,nil()) r5: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h()),l)) r6: a(h(),h(),x) -> s(x) r7: a(x,s(y),h()) -> a(x,y,s(h())) r8: a(x,s(y),s(z)) -> a(x,y,a(x,s(y),z)) r9: a(s(x),h(),z) -> a(x,z,z) 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#(x,s(y),h()) -> a#(x,y,s(h())) p2: a#(x,s(y),s(z)) -> a#(x,y,a(x,s(y),z)) p3: a#(x,s(y),s(z)) -> a#(x,s(y),z) and R consists of: r1: app(nil(),k) -> k r2: app(l,nil()) -> l r3: app(cons(x,l),k) -> cons(x,app(l,k)) r4: sum(cons(x,nil())) -> cons(x,nil()) r5: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h()),l)) r6: a(h(),h(),x) -> s(x) r7: a(x,s(y),h()) -> a(x,y,s(h())) r8: a(x,s(y),s(z)) -> a(x,y,a(x,s(y),z)) r9: a(s(x),h(),z) -> a(x,z,z) The set of usable rules consists of r6, r7, r8, r9 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) = max{x1 + 5, x2 + 3, x3 + 3} s_A(x1) = max{2, x1} h_A = 2 a_A(x1,x2,x3) = max{x1 + 1, x2, x3} precedence: a# = h = a > s partial status: pi(a#) = [1, 2, 3] pi(s) = [1] pi(h) = [] pi(a) = [1, 2, 3] 2. weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1,x2,x3) = max{x1 + 6, x2 + 6, x3 - 6} s_A(x1) = x1 + 5 h_A = 0 a_A(x1,x2,x3) = x3 + 5 precedence: a > a# = s > h partial status: pi(a#) = [] pi(s) = [] pi(h) = [] pi(a) = [] The next rules are strictly ordered: p1, p2, p3 We remove them from the problem. Then no dependency pair remains.