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, r10 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: if#_A(x1,x2,x3) = max{x1 + 109, x2 + 120, x3 + 80} false_A = 43 if2#_A(x1,x2) = max{151, x1 + 119, x2 + 79} weight#_A(x1) = max{140, x1 + 81} sum_A(x1,x2) = max{31, x1 - 82, x2 + 1} cons_A(x1,x2) = max{x1 + 73, x2 + 32} |0|_A = 4 tail_A(x1) = max{48, x1 - 18} empty_A(x1) = max{17, x1 - 29} s_A(x1) = x1 nil_A = 17 true_A = 16 if_A(x1,x2,x3) = max{2, x2 - 20, x3 - 1} weight_undefined_error_A = 1 base order 2: precedence: |0| = if > sum > if2# = s > if# = cons > false > tail > weight# = nil > empty > true > weight_undefined_error partial status: pi(if#) = [] pi(false) = [] pi(if2#) = [2] pi(weight#) = [] pi(sum) = [2] pi(cons) = [] pi(|0|) = [] pi(tail) = [] pi(empty) = [] pi(s) = [1] pi(nil) = [] pi(true) = [] pi(if) = [] pi(weight_undefined_error) = [] The following rules are removed: p2 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: if#(false(),b,x) -> if2#(b,x) p2: 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 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 r5, r7, r10 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: sum#_A(x1,x2) = max{7, x1 - 7} cons_A(x1,x2) = max{x1 + 6, x2 + 19} s_A(x1) = max{14, x1 + 10} |0|_A = 10 empty_A(x1) = max{32, x1 - 20} false_A = 18 tail_A(x1) = max{0, x1 - 10} if_A(x1,x2,x3) = max{20, x1 - 33, x2 - 33, x3 - 63} true_A = 31 weight_undefined_error_A = 0 base order 2: precedence: sum# = cons = empty > false > |0| > tail > s > true > weight_undefined_error > if partial status: pi(sum#) = [] pi(cons) = [1] pi(s) = [1] pi(|0|) = [] pi(empty) = [] pi(false) = [] pi(tail) = [] pi(if) = [] pi(true) = [] pi(weight_undefined_error) = [] The following rules are removed: p2 -- 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)) 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: {p1} -- 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)) 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 r5, r6, r10 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: sum#_A(x1,x2) = max{x1 + 11, x2 + 21} cons_A(x1,x2) = max{2, x1, x2 - 7} s_A(x1) = x1 empty_A(x1) = max{2, x1 - 7} false_A = 1 tail_A(x1) = max{6, x1 - 9} nil_A = 5 if_A(x1,x2,x3) = max{8, x1 - 11, x2 - 3, x3 - 4} true_A = 1 weight_undefined_error_A = 0 base order 2: precedence: weight_undefined_error > if > sum# = empty > cons > s = tail > false = nil > true partial status: pi(sum#) = [1] pi(cons) = [1] pi(s) = [1] pi(empty) = [] pi(false) = [] pi(tail) = [] pi(nil) = [] pi(if) = [] pi(true) = [] pi(weight_undefined_error) = [] The following rules are removed: p1 Then no dependency pair remains.