YES We show the termination of the TRS R: sum(cons(s(n),x),cons(m,y)) -> sum(cons(n,x),cons(s(m),y)) sum(cons(|0|(),x),y) -> sum(x,y) sum(nil(),y) -> y empty(nil()) -> true() empty(cons(n,x)) -> false() tail(nil()) -> nil() tail(cons(n,x)) -> x head(cons(n,x)) -> n weight(x) -> if(empty(x),empty(tail(x)),x) if(true(),b,x) -> weight_undefined_error() if(false(),b,x) -> if2(b,x) if2(true(),x) -> head(x) if2(false(),x) -> weight(sum(x,cons(|0|(),tail(tail(x))))) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: sum#(cons(s(n),x),cons(m,y)) -> sum#(cons(n,x),cons(s(m),y)) p2: sum#(cons(|0|(),x),y) -> sum#(x,y) p3: weight#(x) -> if#(empty(x),empty(tail(x)),x) p4: weight#(x) -> empty#(x) p5: weight#(x) -> empty#(tail(x)) p6: weight#(x) -> tail#(x) p7: if#(false(),b,x) -> if2#(b,x) p8: if2#(true(),x) -> head#(x) p9: if2#(false(),x) -> weight#(sum(x,cons(|0|(),tail(tail(x))))) p10: if2#(false(),x) -> sum#(x,cons(|0|(),tail(tail(x)))) p11: if2#(false(),x) -> tail#(tail(x)) p12: if2#(false(),x) -> tail#(x) and R consists of: r1: sum(cons(s(n),x),cons(m,y)) -> sum(cons(n,x),cons(s(m),y)) r2: sum(cons(|0|(),x),y) -> sum(x,y) r3: sum(nil(),y) -> y r4: empty(nil()) -> true() r5: empty(cons(n,x)) -> false() r6: tail(nil()) -> nil() r7: tail(cons(n,x)) -> x r8: head(cons(n,x)) -> n r9: weight(x) -> if(empty(x),empty(tail(x)),x) r10: if(true(),b,x) -> weight_undefined_error() r11: if(false(),b,x) -> if2(b,x) r12: if2(true(),x) -> head(x) r13: if2(false(),x) -> weight(sum(x,cons(|0|(),tail(tail(x))))) The estimated dependency graph contains the following SCCs: {p3, p7, p9} {p1, p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: if#(false(),b,x) -> if2#(b,x) p2: if2#(false(),x) -> weight#(sum(x,cons(|0|(),tail(tail(x))))) p3: weight#(x) -> if#(empty(x),empty(tail(x)),x) and R consists of: r1: sum(cons(s(n),x),cons(m,y)) -> sum(cons(n,x),cons(s(m),y)) r2: sum(cons(|0|(),x),y) -> sum(x,y) r3: sum(nil(),y) -> y r4: empty(nil()) -> true() r5: empty(cons(n,x)) -> false() r6: tail(nil()) -> nil() r7: tail(cons(n,x)) -> x r8: head(cons(n,x)) -> n r9: weight(x) -> if(empty(x),empty(tail(x)),x) r10: if(true(),b,x) -> weight_undefined_error() r11: if(false(),b,x) -> if2(b,x) r12: if2(true(),x) -> head(x) r13: if2(false(),x) -> weight(sum(x,cons(|0|(),tail(tail(x))))) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: if#_A(x1,x2,x3) = max{76, x1 - 48, x2 + 2, x3 + 23} false_A = 102 if2#_A(x1,x2) = max{75, x1 + 1, x2 - 1} weight#_A(x1) = max{78, x1 + 24} sum_A(x1,x2) = max{45, x2 + 2} cons_A(x1,x2) = x2 + 72 |0|_A = 40 tail_A(x1) = max{4, x1 - 50} empty_A(x1) = x1 + 71 s_A(x1) = max{43, x1 + 35} nil_A = 2 true_A = 2 precedence: cons = |0| = tail = s = nil = true > empty > if# = false > if2# > weight# = sum partial status: pi(if#) = [] pi(false) = [] pi(if2#) = [] pi(weight#) = [] pi(sum) = [2] pi(cons) = [] pi(|0|) = [] pi(tail) = [] pi(empty) = [1] pi(s) = [] pi(nil) = [] pi(true) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: if#_A(x1,x2,x3) = 44 false_A = 14 if2#_A(x1,x2) = 44 weight#_A(x1) = 42 sum_A(x1,x2) = max{41, x2} cons_A(x1,x2) = 42 |0|_A = 15 tail_A(x1) = 6 empty_A(x1) = max{12, x1 - 27} s_A(x1) = 29 nil_A = 7 true_A = 13 precedence: if# > empty = true > false > if2# = weight# = sum = cons = |0| = tail = s = nil partial status: pi(if#) = [] pi(false) = [] pi(if2#) = [] pi(weight#) = [] pi(sum) = [2] pi(cons) = [] pi(|0|) = [] pi(tail) = [] pi(empty) = [] pi(s) = [] pi(nil) = [] pi(true) = [] The next rules are strictly ordered: p3 We remove them from the problem. -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: if#(false(),b,x) -> if2#(b,x) p2: if2#(false(),x) -> weight#(sum(x,cons(|0|(),tail(tail(x))))) and R consists of: r1: sum(cons(s(n),x),cons(m,y)) -> sum(cons(n,x),cons(s(m),y)) r2: sum(cons(|0|(),x),y) -> sum(x,y) r3: sum(nil(),y) -> y r4: empty(nil()) -> true() r5: empty(cons(n,x)) -> false() r6: tail(nil()) -> nil() r7: tail(cons(n,x)) -> x r8: head(cons(n,x)) -> n r9: weight(x) -> if(empty(x),empty(tail(x)),x) r10: if(true(),b,x) -> weight_undefined_error() r11: if(false(),b,x) -> if2(b,x) r12: if2(true(),x) -> head(x) r13: if2(false(),x) -> weight(sum(x,cons(|0|(),tail(tail(x))))) The estimated dependency graph contains the following SCCs: (no SCCs) -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: sum#(cons(s(n),x),cons(m,y)) -> sum#(cons(n,x),cons(s(m),y)) p2: sum#(cons(|0|(),x),y) -> sum#(x,y) and R consists of: r1: sum(cons(s(n),x),cons(m,y)) -> sum(cons(n,x),cons(s(m),y)) r2: sum(cons(|0|(),x),y) -> sum(x,y) r3: sum(nil(),y) -> y r4: empty(nil()) -> true() r5: empty(cons(n,x)) -> false() r6: tail(nil()) -> nil() r7: tail(cons(n,x)) -> x r8: head(cons(n,x)) -> n r9: weight(x) -> if(empty(x),empty(tail(x)),x) r10: if(true(),b,x) -> weight_undefined_error() r11: if(false(),b,x) -> if2(b,x) r12: if2(true(),x) -> head(x) r13: if2(false(),x) -> weight(sum(x,cons(|0|(),tail(tail(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: sum#_A(x1,x2) = max{8, x1 + 4, x2 + 2} cons_A(x1,x2) = max{x1 + 2, x2 + 4} s_A(x1) = x1 |0|_A = 2 precedence: sum# = cons = s = |0| partial status: pi(sum#) = [1, 2] pi(cons) = [1, 2] pi(s) = [1] pi(|0|) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: sum#_A(x1,x2) = x1 + 6 cons_A(x1,x2) = max{x1 + 2, x2} s_A(x1) = x1 + 3 |0|_A = 0 precedence: sum# = cons = s = |0| partial status: pi(sum#) = [1] pi(cons) = [1, 2] pi(s) = [1] pi(|0|) = [] The next rules are strictly ordered: p1, p2 We remove them from the problem. Then no dependency pair remains.