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: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: if#_A(x1,x2,x3) = max{0, x1 - 36, x2 - 2, x3 - 104} false_A = 1 if2#_A(x1,x2) = max{0, x1 - 57, x2 - 104} weight#_A(x1) = max{0, x1 - 104} sum_A(x1,x2) = max{103, x1 - 60, x2} cons_A(x1,x2) = max{x1 - 2, x2 + 58} |0|_A = 68 tail_A(x1) = max{43, x1 - 35} empty_A(x1) = max{1, x1 - 68} s_A(x1) = max{1, x1} nil_A = 0 true_A = 1 if#!_A(x1,x2,x3) = max{5, x1 - 36, x2 - 2, x3 - 105} false!_A = 3 if2#!_A(x1,x2) = max{5, x1 - 3, x2 - 106} weight#!_A(x1) = max{5, x1 - 104} sum!_A(x1,x2) = max{6, x1 - 59, x2 - 67} cons!_A(x1,x2) = max{4, x1 - 123, x2 - 37} |0|!_A = 2 tail!_A(x1) = max{34, x1 - 106} empty!_A(x1) = max{5, x1 - 69} s!_A(x1) = max{5, x1 - 70} nil!_A = 35 true!_A = 1 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: if#_A(x1,x2,x3) = max{0, x1 - 62, x2 - 30, x3 - 83} false_A = 40 if2#_A(x1,x2) = max{0, x1 - 121, x2 - 83} weight#_A(x1) = max{0, x1 - 83} sum_A(x1,x2) = max{45, x1 - 63, x2} cons_A(x1,x2) = max{x1 - 2, x2 + 61} |0|_A = 45 tail_A(x1) = max{21, x1 - 32} empty_A(x1) = max{0, x1 - 21} s_A(x1) = max{1, x1} nil_A = 20 true_A = 0 if#!_A(x1,x2,x3) = max{1, x1 - 35, x2 - 1, x3 - 45} false!_A = 2 if2#!_A(x1,x2) = max{5, x1 - 1, x2 - 46} weight#!_A(x1) = max{4, x1 - 44} sum!_A(x1,x2) = max{42, x1 - 76, x2 - 83} cons!_A(x1,x2) = max{40, x1 - 87, x2 - 87} |0|!_A = 1 tail!_A(x1) = max{39, x1 - 45} empty!_A(x1) = max{3, x1 - 17} s!_A(x1) = max{43, x1 - 79} nil!_A = 40 true!_A = 2 partial status: pi(if#) = [] pi(false) = [] pi(if2#) = [] pi(weight#) = [] pi(sum) = [1, 2] pi(cons) = [1, 2] pi(|0|) = [] pi(tail) = [1] pi(empty) = [] pi(s) = [1] pi(nil) = [] pi(true) = [] The following rules are removed: p2, p3 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: if#(false(),b,x) -> if2#(b,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 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: sum#_A(x1,x2) = max{0, x1 - 30, x2 - 29} cons_A(x1,x2) = max{x1 + 28, x2 + 28} s_A(x1) = x1 |0|_A = 18 empty_A(x1) = max{16, x1 - 28} false_A = 1 sum#!_A(x1,x2) = max{24, x1 - 20} cons!_A(x1,x2) = max{24, x1 + 5, x2 - 19} s!_A(x1) = max{25, x1 - 17} |0|!_A = 3 empty!_A(x1) = max{6, x1 - 29} false!_A = 4 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: sum#_A(x1,x2) = max{0, x1 - 24, x2 - 23} cons_A(x1,x2) = max{x1 + 17, x2} s_A(x1) = max{5, x1} |0|_A = 27 empty_A(x1) = max{13, x1 - 17} false_A = 1 sum#!_A(x1,x2) = max{7, x1 - 37, x2 - 36} cons!_A(x1,x2) = max{13, x1 - 37, x2 - 37} s!_A(x1) = max{8, x1 - 27} |0|!_A = 8 empty!_A(x1) = max{12, x1 - 31} false!_A = 10 partial status: pi(sum#) = [] pi(cons) = [2] pi(s) = [1] pi(|0|) = [] pi(empty) = [1] pi(false) = [] 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 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: sum#_A(x1,x2) = max{0, x1 - 1} cons_A(x1,x2) = max{0, x1 - 6} s_A(x1) = max{19, x1 + 8} empty_A(x1) = max{25, x1 - 10} false_A = 1 sum#!_A(x1,x2) = x1 + 2 cons!_A(x1,x2) = max{x1 + 29, x2 + 23} s!_A(x1) = max{27, x1 - 5} empty!_A(x1) = max{0, x1 - 8} false!_A = 21 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: sum#_A(x1,x2) = max{x1 - 38, x2 + 1} cons_A(x1,x2) = max{1, x2 - 1} s_A(x1) = x1 + 27 empty_A(x1) = max{1, x1 - 4} false_A = 1 sum#!_A(x1,x2) = x1 + 32 cons!_A(x1,x2) = x1 + 1 s!_A(x1) = 29 empty!_A(x1) = max{33, x1 - 11} false!_A = 32 partial status: pi(sum#) = [1] pi(cons) = [1] pi(s) = [1] pi(empty) = [1] pi(false) = [] The following rules are removed: p1 Then no dependency pair remains.