YES We show the termination of the TRS R: min(|0|(),y) -> |0|() min(s(x),|0|()) -> |0|() min(s(x),s(y)) -> min(x,y) len(nil()) -> |0|() len(cons(x,xs)) -> s(len(xs)) sum(x,|0|()) -> x sum(x,s(y)) -> s(sum(x,y)) le(|0|(),x) -> true() le(s(x),|0|()) -> false() le(s(x),s(y)) -> le(x,y) take(|0|(),cons(y,ys)) -> y take(s(x),cons(y,ys)) -> take(x,ys) addList(x,y) -> if(le(|0|(),min(len(x),len(y))),|0|(),x,y,nil()) if(false(),c,x,y,z) -> z if(true(),c,xs,ys,z) -> if(le(s(c),min(len(xs),len(ys))),s(c),xs,ys,cons(sum(take(c,xs),take(c,ys)),z)) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: min#(s(x),s(y)) -> min#(x,y) p2: len#(cons(x,xs)) -> len#(xs) p3: sum#(x,s(y)) -> sum#(x,y) p4: le#(s(x),s(y)) -> le#(x,y) p5: take#(s(x),cons(y,ys)) -> take#(x,ys) p6: addList#(x,y) -> if#(le(|0|(),min(len(x),len(y))),|0|(),x,y,nil()) p7: addList#(x,y) -> le#(|0|(),min(len(x),len(y))) p8: addList#(x,y) -> min#(len(x),len(y)) p9: addList#(x,y) -> len#(x) p10: addList#(x,y) -> len#(y) p11: if#(true(),c,xs,ys,z) -> if#(le(s(c),min(len(xs),len(ys))),s(c),xs,ys,cons(sum(take(c,xs),take(c,ys)),z)) p12: if#(true(),c,xs,ys,z) -> le#(s(c),min(len(xs),len(ys))) p13: if#(true(),c,xs,ys,z) -> min#(len(xs),len(ys)) p14: if#(true(),c,xs,ys,z) -> len#(xs) p15: if#(true(),c,xs,ys,z) -> len#(ys) p16: if#(true(),c,xs,ys,z) -> sum#(take(c,xs),take(c,ys)) p17: if#(true(),c,xs,ys,z) -> take#(c,xs) p18: if#(true(),c,xs,ys,z) -> take#(c,ys) and R consists of: r1: min(|0|(),y) -> |0|() r2: min(s(x),|0|()) -> |0|() r3: min(s(x),s(y)) -> min(x,y) r4: len(nil()) -> |0|() r5: len(cons(x,xs)) -> s(len(xs)) r6: sum(x,|0|()) -> x r7: sum(x,s(y)) -> s(sum(x,y)) r8: le(|0|(),x) -> true() r9: le(s(x),|0|()) -> false() r10: le(s(x),s(y)) -> le(x,y) r11: take(|0|(),cons(y,ys)) -> y r12: take(s(x),cons(y,ys)) -> take(x,ys) r13: addList(x,y) -> if(le(|0|(),min(len(x),len(y))),|0|(),x,y,nil()) r14: if(false(),c,x,y,z) -> z r15: if(true(),c,xs,ys,z) -> if(le(s(c),min(len(xs),len(ys))),s(c),xs,ys,cons(sum(take(c,xs),take(c,ys)),z)) The estimated dependency graph contains the following SCCs: {p11} {p1} {p2} {p3} {p4} {p5} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: if#(true(),c,xs,ys,z) -> if#(le(s(c),min(len(xs),len(ys))),s(c),xs,ys,cons(sum(take(c,xs),take(c,ys)),z)) and R consists of: r1: min(|0|(),y) -> |0|() r2: min(s(x),|0|()) -> |0|() r3: min(s(x),s(y)) -> min(x,y) r4: len(nil()) -> |0|() r5: len(cons(x,xs)) -> s(len(xs)) r6: sum(x,|0|()) -> x r7: sum(x,s(y)) -> s(sum(x,y)) r8: le(|0|(),x) -> true() r9: le(s(x),|0|()) -> false() r10: le(s(x),s(y)) -> le(x,y) r11: take(|0|(),cons(y,ys)) -> y r12: take(s(x),cons(y,ys)) -> take(x,ys) r13: addList(x,y) -> if(le(|0|(),min(len(x),len(y))),|0|(),x,y,nil()) r14: if(false(),c,x,y,z) -> z r15: if(true(),c,xs,ys,z) -> if(le(s(c),min(len(xs),len(ys))),s(c),xs,ys,cons(sum(take(c,xs),take(c,ys)),z)) The set of usable rules consists of r1, r2, r3, r8, r9, r10 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,x4,x5) = max{x1 - 128, x2 - 63, x3 + 1, x4 + 2} true_A = 71 le_A(x1,x2) = 130 s_A(x1) = 64 min_A(x1,x2) = 67 len_A(x1) = max{39, x1 - 3} cons_A(x1,x2) = x2 + 20 sum_A(x1,x2) = 17 take_A(x1,x2) = 20 |0|_A = 66 false_A = 1 if#!_A(x1,x2,x3,x4,x5) = max{x1 - 61, x2 + 5, x3 + 12, x4 + 69} true!_A = 15 le!_A(x1,x2) = 15 s!_A(x1) = 16 min!_A(x1,x2) = 3 len!_A(x1) = max{13, x1 - 3} cons!_A(x1,x2) = x1 + 52 sum!_A(x1,x2) = 18 take!_A(x1,x2) = 11 |0|!_A = 2 false!_A = 1 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: if#_A(x1,x2,x3,x4,x5) = max{0, x3 - 1} true_A = 131 le_A(x1,x2) = 131 s_A(x1) = 125 min_A(x1,x2) = 139 len_A(x1) = max{51, x1 + 39} cons_A(x1,x2) = max{28, x1 - 40, x2 - 40} sum_A(x1,x2) = max{106, x1 + 37, x2 + 39} take_A(x1,x2) = max{40, x2 + 35} |0|_A = 139 false_A = 1 if#!_A(x1,x2,x3,x4,x5) = max{x1 + 25, x3 + 65, x4 + 69} true!_A = 129 le!_A(x1,x2) = max{73, x1 - 9, x2 - 51} s!_A(x1) = 2 min!_A(x1,x2) = 63 len!_A(x1) = max{66, x1 - 1} cons!_A(x1,x2) = max{68, x1 - 105, x2 + 67} sum!_A(x1,x2) = 130 take!_A(x1,x2) = 129 |0|!_A = 1 false!_A = 117 partial status: pi(if#) = [1, 4] pi(true) = [] pi(le) = [2] pi(s) = [1] pi(min) = [] pi(len) = [] pi(cons) = [2] pi(sum) = [2] pi(take) = [] pi(|0|) = [] pi(false) = [] The following rules are removed: p1 Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: min#(s(x),s(y)) -> min#(x,y) and R consists of: r1: min(|0|(),y) -> |0|() r2: min(s(x),|0|()) -> |0|() r3: min(s(x),s(y)) -> min(x,y) r4: len(nil()) -> |0|() r5: len(cons(x,xs)) -> s(len(xs)) r6: sum(x,|0|()) -> x r7: sum(x,s(y)) -> s(sum(x,y)) r8: le(|0|(),x) -> true() r9: le(s(x),|0|()) -> false() r10: le(s(x),s(y)) -> le(x,y) r11: take(|0|(),cons(y,ys)) -> y r12: take(s(x),cons(y,ys)) -> take(x,ys) r13: addList(x,y) -> if(le(|0|(),min(len(x),len(y))),|0|(),x,y,nil()) r14: if(false(),c,x,y,z) -> z r15: if(true(),c,xs,ys,z) -> if(le(s(c),min(len(xs),len(ys))),s(c),xs,ys,cons(sum(take(c,xs),take(c,ys)),z)) 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!): max/plus interpretation on natural numbers: min#_A(x1,x2) = 0 s_A(x1) = max{19, x1 - 28} min#!_A(x1,x2) = max{0, x2 - 157} s!_A(x1) = max{11, x1 - 156} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: min#_A(x1,x2) = 0 s_A(x1) = max{18, x1 - 63} min#!_A(x1,x2) = max{2, x1 - 79, x2 - 81} s!_A(x1) = max{1, x1 - 80} partial status: pi(min#) = [2] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: len#(cons(x,xs)) -> len#(xs) and R consists of: r1: min(|0|(),y) -> |0|() r2: min(s(x),|0|()) -> |0|() r3: min(s(x),s(y)) -> min(x,y) r4: len(nil()) -> |0|() r5: len(cons(x,xs)) -> s(len(xs)) r6: sum(x,|0|()) -> x r7: sum(x,s(y)) -> s(sum(x,y)) r8: le(|0|(),x) -> true() r9: le(s(x),|0|()) -> false() r10: le(s(x),s(y)) -> le(x,y) r11: take(|0|(),cons(y,ys)) -> y r12: take(s(x),cons(y,ys)) -> take(x,ys) r13: addList(x,y) -> if(le(|0|(),min(len(x),len(y))),|0|(),x,y,nil()) r14: if(false(),c,x,y,z) -> z r15: if(true(),c,xs,ys,z) -> if(le(s(c),min(len(xs),len(ys))),s(c),xs,ys,cons(sum(take(c,xs),take(c,ys)),z)) The set of usable rules consists of r1, r2 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: len#_A(x1) = x1 cons_A(x1,x2) = max{x1 + 22, x2 + 1} min_A(x1,x2) = max{23, x1 - 18, x2 - 18} |0|_A = 17 s_A(x1) = max{12, x1 - 42} len#!_A(x1) = max{1, x1 - 71} cons!_A(x1,x2) = max{1, x1 - 67, x2 - 71} min!_A(x1,x2) = max{61, x1 - 161, x2 - 161} |0|!_A = 58 s!_A(x1) = max{63, x1 - 42} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: len#_A(x1) = x1 cons_A(x1,x2) = max{44, x1 + 42, x2 + 1} min_A(x1,x2) = max{27, x1 - 25, x2 - 33} |0|_A = 24 s_A(x1) = max{22, x1 - 63} len#!_A(x1) = max{1, x1 - 81} cons!_A(x1,x2) = max{135, x1 - 2, x2 - 81} min!_A(x1,x2) = max{x1 + 69, x2 - 90} |0|!_A = 5 s!_A(x1) = max{1, x1 - 89} partial status: pi(len#) = [1] pi(cons) = [2] pi(min) = [] pi(|0|) = [] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: sum#(x,s(y)) -> sum#(x,y) and R consists of: r1: min(|0|(),y) -> |0|() r2: min(s(x),|0|()) -> |0|() r3: min(s(x),s(y)) -> min(x,y) r4: len(nil()) -> |0|() r5: len(cons(x,xs)) -> s(len(xs)) r6: sum(x,|0|()) -> x r7: sum(x,s(y)) -> s(sum(x,y)) r8: le(|0|(),x) -> true() r9: le(s(x),|0|()) -> false() r10: le(s(x),s(y)) -> le(x,y) r11: take(|0|(),cons(y,ys)) -> y r12: take(s(x),cons(y,ys)) -> take(x,ys) r13: addList(x,y) -> if(le(|0|(),min(len(x),len(y))),|0|(),x,y,nil()) r14: if(false(),c,x,y,z) -> z r15: if(true(),c,xs,ys,z) -> if(le(s(c),min(len(xs),len(ys))),s(c),xs,ys,cons(sum(take(c,xs),take(c,ys)),z)) 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!): max/plus interpretation on natural numbers: sum#_A(x1,x2) = 0 s_A(x1) = max{8, x1 - 33} sum#!_A(x1,x2) = 6 s!_A(x1) = max{5, x1 - 33} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: sum#_A(x1,x2) = 0 s_A(x1) = max{56, x1 - 62} sum#!_A(x1,x2) = max{0, x1 - 1} s!_A(x1) = max{8, x1 - 83} partial status: pi(sum#) = [2] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: le#(s(x),s(y)) -> le#(x,y) and R consists of: r1: min(|0|(),y) -> |0|() r2: min(s(x),|0|()) -> |0|() r3: min(s(x),s(y)) -> min(x,y) r4: len(nil()) -> |0|() r5: len(cons(x,xs)) -> s(len(xs)) r6: sum(x,|0|()) -> x r7: sum(x,s(y)) -> s(sum(x,y)) r8: le(|0|(),x) -> true() r9: le(s(x),|0|()) -> false() r10: le(s(x),s(y)) -> le(x,y) r11: take(|0|(),cons(y,ys)) -> y r12: take(s(x),cons(y,ys)) -> take(x,ys) r13: addList(x,y) -> if(le(|0|(),min(len(x),len(y))),|0|(),x,y,nil()) r14: if(false(),c,x,y,z) -> z r15: if(true(),c,xs,ys,z) -> if(le(s(c),min(len(xs),len(ys))),s(c),xs,ys,cons(sum(take(c,xs),take(c,ys)),z)) The set of usable rules consists of r1, r2 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: le#_A(x1,x2) = 0 s_A(x1) = max{107, x1 - 125} min_A(x1,x2) = max{3, x1 - 118, x2 - 1} |0|_A = 0 le#!_A(x1,x2) = max{0, x2 - 369} s!_A(x1) = max{3, x1 - 368} min!_A(x1,x2) = max{5, x1 - 242, x2 - 148} |0|!_A = 0 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: le#_A(x1,x2) = 0 s_A(x1) = max{73, x1 - 22} min_A(x1,x2) = max{77, x1 - 74, x2 - 76} |0|_A = 73 le#!_A(x1,x2) = max{5, x1 - 74, x2 - 74} s!_A(x1) = max{4, x1 - 22} min!_A(x1,x2) = max{4, x1 - 151, x2 - 156} |0|!_A = 4 partial status: pi(le#) = [2] pi(s) = [1] pi(min) = [] pi(|0|) = [] The following rules are removed: p1 Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: take#(s(x),cons(y,ys)) -> take#(x,ys) and R consists of: r1: min(|0|(),y) -> |0|() r2: min(s(x),|0|()) -> |0|() r3: min(s(x),s(y)) -> min(x,y) r4: len(nil()) -> |0|() r5: len(cons(x,xs)) -> s(len(xs)) r6: sum(x,|0|()) -> x r7: sum(x,s(y)) -> s(sum(x,y)) r8: le(|0|(),x) -> true() r9: le(s(x),|0|()) -> false() r10: le(s(x),s(y)) -> le(x,y) r11: take(|0|(),cons(y,ys)) -> y r12: take(s(x),cons(y,ys)) -> take(x,ys) r13: addList(x,y) -> if(le(|0|(),min(len(x),len(y))),|0|(),x,y,nil()) r14: if(false(),c,x,y,z) -> z r15: if(true(),c,xs,ys,z) -> if(le(s(c),min(len(xs),len(ys))),s(c),xs,ys,cons(sum(take(c,xs),take(c,ys)),z)) The set of usable rules consists of r1, r2 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: take#_A(x1,x2) = 0 s_A(x1) = max{8, x1 - 19} cons_A(x1,x2) = max{4, x1 - 1, x2 - 52} min_A(x1,x2) = max{11, x1 - 9, x2 - 7} |0|_A = 6 take#!_A(x1,x2) = max{2, x1 - 71} s!_A(x1) = max{6, x1 - 70} cons!_A(x1,x2) = max{1, x1 - 12, x2 - 115} min!_A(x1,x2) = max{5, x1 - 21, x2 - 23} |0|!_A = 3 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: take#_A(x1,x2) = x2 s_A(x1) = max{22, x1 - 69} cons_A(x1,x2) = max{x1 + 1, x2 + 23} min_A(x1,x2) = max{38, x1 - 25, x2 - 27} |0|_A = 24 take#!_A(x1,x2) = max{8, x1 - 23, x2 - 46} s!_A(x1) = max{2, x1 - 69} cons!_A(x1,x2) = max{7, x1 - 68, x2 - 47} min!_A(x1,x2) = max{5, x1 - 110, x2 - 105} |0|!_A = 2 partial status: pi(take#) = [1] pi(s) = [1] pi(cons) = [] pi(min) = [] pi(|0|) = [] The following rules are removed: p1 Then no dependency pair remains.