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!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: if#_A(x1,x2,x3) = 0 false_A() = 0 if2#_A(x1,x2) = 0 weight#_A(x1) = 0 sum_A(x1,x2) = x2 cons_A(x1,x2) = x2 |0|_A() = 1 tail_A(x1) = x1 empty_A(x1) = 1 s_A(x1) = x1 + 1 nil_A() = 1 true_A() = 0 if#!_A(x1,x2,x3) = x3 + 7 false!_A() = 9 if2#!_A(x1,x2) = x2 + 7 weight#!_A(x1) = x1 + 7 sum!_A(x1,x2) = 6 cons!_A(x1,x2) = 10 |0|!_A() = 0 tail!_A(x1) = 3 empty!_A(x1) = 8 s!_A(x1) = x1 + 5 nil!_A() = 2 true!_A() = 1 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: if#_A(x1,x2,x3) = max{11, x3 - 38} false_A = 68 if2#_A(x1,x2) = max{11, x2 - 38} weight#_A(x1) = max{11, x1 - 38} sum_A(x1,x2) = max{34, x2} cons_A(x1,x2) = x2 + 42 |0|_A = 36 tail_A(x1) = max{7, x1 - 25} empty_A(x1) = x1 + 26 s_A(x1) = 38 nil_A = 3 true_A = 29 if#!_A(x1,x2,x3) = max{x1 - 67, x2 + 3, x3 - 1} false!_A = 38 if2#!_A(x1,x2) = max{2, x1 - 12, x2 - 2} weight#!_A(x1) = max{37, x1 + 5} sum!_A(x1,x2) = max{57, x2} cons!_A(x1,x2) = x2 + 48 |0|!_A = 37 tail!_A(x1) = max{57, x1 - 4} empty!_A(x1) = max{4, x1 - 43} s!_A(x1) = 49 nil!_A = 57 true!_A = 1 partial status: pi(if#) = [] pi(false) = [] pi(if2#) = [] pi(weight#) = [] pi(sum) = [1, 2] pi(cons) = [2] pi(|0|) = [] pi(tail) = [1] pi(empty) = [1] pi(s) = [] pi(nil) = [] pi(true) = [] The following rules are removed: p1, p2, p3 Then no dependency pair remains. -- 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: 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!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: sum#_A(x1,x2) = x1 + x2 cons_A(x1,x2) = x1 + x2 + 3 s_A(x1) = x1 |0|_A() = 1 sum#!_A(x1,x2) = x2 + 1 cons!_A(x1,x2) = 5 s!_A(x1) = 5 |0|!_A() = 0 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: sum#_A(x1,x2) = max{0, x1 - 51, x2 - 36} cons_A(x1,x2) = max{35, x1 + 20, x2 + 22} s_A(x1) = max{1, x1} |0|_A = 10 sum#!_A(x1,x2) = max{1, x1 - 18} cons!_A(x1,x2) = 18 s!_A(x1) = 18 |0|!_A = 31 partial status: pi(sum#) = [2] pi(cons) = [] pi(s) = [] pi(|0|) = [] 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 (no rules) 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!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: sum#_A(x1,x2) = x1 + x2 cons_A(x1,x2) = x1 + 1 s_A(x1) = x1 + 1 sum#!_A(x1,x2) = x1 + 1 cons!_A(x1,x2) = 3 s!_A(x1) = 3 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: sum#_A(x1,x2) = max{0, x1 - 33, x2 - 31} cons_A(x1,x2) = max{30, x1 - 26, x2 + 6} s_A(x1) = max{55, x1} sum#!_A(x1,x2) = max{27, x1 - 4, x2 - 31} cons!_A(x1,x2) = max{27, x1 - 81, x2 + 2} s!_A(x1) = 30 partial status: pi(sum#) = [] pi(cons) = [] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains.