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: weighted path order base order: max/plus interpretations on natural numbers: app#_A(x1,x2) = max{0, x1 - 2} cons_A(x1,x2) = max{x1 + 3, x2 + 1} precedence: app# = cons partial status: pi(app#) = [] pi(cons) = [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: weighted path order base order: max/plus interpretations on natural numbers: sum#_A(x1) = max{41, x1 + 30} cons_A(x1,x2) = max{x1 + 17, x2 + 20} a_A(x1,x2,x3) = 14 h_A = 16 s_A(x1) = 14 precedence: sum# = cons = a = h = s partial status: pi(sum#) = [] pi(cons) = [2] pi(a) = [] pi(h) = [] 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: 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: weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1,x2,x3) = max{x1 + 8, x2 + 2, x3 + 2} s_A(x1) = max{1, x1} h_A = 5 a_A(x1,x2,x3) = max{x1 + 6, x2, x3} precedence: h > a > a# = s 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: weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1,x2,x3) = max{x1 + 7, x2 + 8, x3 + 4} s_A(x1) = max{2, x1} h_A = 0 a_A(x1,x2,x3) = max{x1 + 3, x2, x3} precedence: a > s = h > a# partial status: pi(a#) = [2] pi(s) = [1] pi(h) = [] pi(a) = [1, 2, 3] 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#(x,s(y),s(z)) -> a#(x,y,a(x,s(y),z)) p2: 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 estimated dependency graph contains the following SCCs: {p1, p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: a#(x,s(y),s(z)) -> a#(x,y,a(x,s(y),z)) p2: 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: weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1,x2,x3) = max{x1 + 7, x2 + 7, x3 + 4} s_A(x1) = max{2, x1} a_A(x1,x2,x3) = max{x1 + 3, x2, x3} h_A = 1 precedence: a > a# = s = h partial status: pi(a#) = [1, 2] pi(s) = [1] pi(a) = [1, 2, 3] pi(h) = [] 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#(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 estimated dependency graph contains the following SCCs: {p1} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: 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 (no rules) Take the reduction pair: weighted path order base order: max/plus interpretations on natural numbers: a#_A(x1,x2,x3) = max{0, x3 - 2} s_A(x1) = max{3, x1 + 1} precedence: a# = s partial status: pi(a#) = [] pi(s) = [1] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.