YES We show the termination of the TRS R: fst(|0|(),Z) -> nil() fst(s(X),cons(Y,Z)) -> cons(Y,n__fst(activate(X),activate(Z))) from(X) -> cons(X,n__from(n__s(X))) add(|0|(),X) -> X add(s(X),Y) -> s(n__add(activate(X),Y)) len(nil()) -> |0|() len(cons(X,Z)) -> s(n__len(activate(Z))) fst(X1,X2) -> n__fst(X1,X2) from(X) -> n__from(X) s(X) -> n__s(X) add(X1,X2) -> n__add(X1,X2) len(X) -> n__len(X) activate(n__fst(X1,X2)) -> fst(activate(X1),activate(X2)) activate(n__from(X)) -> from(activate(X)) activate(n__s(X)) -> s(X) activate(n__add(X1,X2)) -> add(activate(X1),activate(X2)) activate(n__len(X)) -> len(activate(X)) activate(X) -> X -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: fst#(s(X),cons(Y,Z)) -> activate#(X) p2: fst#(s(X),cons(Y,Z)) -> activate#(Z) p3: add#(s(X),Y) -> s#(n__add(activate(X),Y)) p4: add#(s(X),Y) -> activate#(X) p5: len#(cons(X,Z)) -> s#(n__len(activate(Z))) p6: len#(cons(X,Z)) -> activate#(Z) p7: activate#(n__fst(X1,X2)) -> fst#(activate(X1),activate(X2)) p8: activate#(n__fst(X1,X2)) -> activate#(X1) p9: activate#(n__fst(X1,X2)) -> activate#(X2) p10: activate#(n__from(X)) -> from#(activate(X)) p11: activate#(n__from(X)) -> activate#(X) p12: activate#(n__s(X)) -> s#(X) p13: activate#(n__add(X1,X2)) -> add#(activate(X1),activate(X2)) p14: activate#(n__add(X1,X2)) -> activate#(X1) p15: activate#(n__add(X1,X2)) -> activate#(X2) p16: activate#(n__len(X)) -> len#(activate(X)) p17: activate#(n__len(X)) -> activate#(X) and R consists of: r1: fst(|0|(),Z) -> nil() r2: fst(s(X),cons(Y,Z)) -> cons(Y,n__fst(activate(X),activate(Z))) r3: from(X) -> cons(X,n__from(n__s(X))) r4: add(|0|(),X) -> X r5: add(s(X),Y) -> s(n__add(activate(X),Y)) r6: len(nil()) -> |0|() r7: len(cons(X,Z)) -> s(n__len(activate(Z))) r8: fst(X1,X2) -> n__fst(X1,X2) r9: from(X) -> n__from(X) r10: s(X) -> n__s(X) r11: add(X1,X2) -> n__add(X1,X2) r12: len(X) -> n__len(X) r13: activate(n__fst(X1,X2)) -> fst(activate(X1),activate(X2)) r14: activate(n__from(X)) -> from(activate(X)) r15: activate(n__s(X)) -> s(X) r16: activate(n__add(X1,X2)) -> add(activate(X1),activate(X2)) r17: activate(n__len(X)) -> len(activate(X)) r18: activate(X) -> X The estimated dependency graph contains the following SCCs: {p1, p2, p4, p6, p7, p8, p9, p11, p13, p14, p15, p16, p17} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: fst#(s(X),cons(Y,Z)) -> activate#(X) p2: activate#(n__len(X)) -> activate#(X) p3: activate#(n__len(X)) -> len#(activate(X)) p4: len#(cons(X,Z)) -> activate#(Z) p5: activate#(n__add(X1,X2)) -> activate#(X2) p6: activate#(n__add(X1,X2)) -> activate#(X1) p7: activate#(n__add(X1,X2)) -> add#(activate(X1),activate(X2)) p8: add#(s(X),Y) -> activate#(X) p9: activate#(n__from(X)) -> activate#(X) p10: activate#(n__fst(X1,X2)) -> activate#(X2) p11: activate#(n__fst(X1,X2)) -> activate#(X1) p12: activate#(n__fst(X1,X2)) -> fst#(activate(X1),activate(X2)) p13: fst#(s(X),cons(Y,Z)) -> activate#(Z) and R consists of: r1: fst(|0|(),Z) -> nil() r2: fst(s(X),cons(Y,Z)) -> cons(Y,n__fst(activate(X),activate(Z))) r3: from(X) -> cons(X,n__from(n__s(X))) r4: add(|0|(),X) -> X r5: add(s(X),Y) -> s(n__add(activate(X),Y)) r6: len(nil()) -> |0|() r7: len(cons(X,Z)) -> s(n__len(activate(Z))) r8: fst(X1,X2) -> n__fst(X1,X2) r9: from(X) -> n__from(X) r10: s(X) -> n__s(X) r11: add(X1,X2) -> n__add(X1,X2) r12: len(X) -> n__len(X) r13: activate(n__fst(X1,X2)) -> fst(activate(X1),activate(X2)) r14: activate(n__from(X)) -> from(activate(X)) r15: activate(n__s(X)) -> s(X) r16: activate(n__add(X1,X2)) -> add(activate(X1),activate(X2)) r17: activate(n__len(X)) -> len(activate(X)) r18: activate(X) -> X The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, r18 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: fst#_A(x1,x2) = max{x1 + 3, x2 + 3} s_A(x1) = max{9, x1} cons_A(x1,x2) = max{x1 + 10, x2} activate#_A(x1) = max{2, x1} n__len_A(x1) = x1 + 13 len#_A(x1) = x1 + 12 activate_A(x1) = x1 n__add_A(x1,x2) = max{x1 + 11, x2 + 10} add#_A(x1,x2) = max{x1 + 6, x2 + 9} n__from_A(x1) = max{21, x1 + 11} n__fst_A(x1,x2) = max{x1 + 4, x2 + 7} fst_A(x1,x2) = max{x1 + 4, x2 + 7} |0|_A = 8 nil_A = 8 from_A(x1) = max{21, x1 + 11} n__s_A(x1) = max{9, x1} add_A(x1,x2) = max{x1 + 11, x2 + 10} len_A(x1) = x1 + 13 precedence: activate = |0| = add = len > from > s = n__from = nil > n__len = n__s > n__add = fst > cons > fst# = activate# = len# = add# > n__fst partial status: pi(fst#) = [1, 2] pi(s) = [1] pi(cons) = [1, 2] pi(activate#) = [1] pi(n__len) = [1] pi(len#) = [1] pi(activate) = [1] pi(n__add) = [1, 2] pi(add#) = [1, 2] pi(n__from) = [1] pi(n__fst) = [1, 2] pi(fst) = [] pi(|0|) = [] pi(nil) = [] pi(from) = [1] pi(n__s) = [1] pi(add) = [1, 2] pi(len) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: fst#_A(x1,x2) = max{42, x1 + 2, x2 + 2} s_A(x1) = max{46, x1 + 42} cons_A(x1,x2) = max{x1 + 43, x2 + 18} activate#_A(x1) = max{43, x1 + 3} n__len_A(x1) = 17 len#_A(x1) = 17 activate_A(x1) = x1 + 37 n__add_A(x1,x2) = max{x1 + 82, x2 + 81} add#_A(x1,x2) = max{82, x1 + 2, x2 + 44} n__from_A(x1) = max{7, x1} n__fst_A(x1,x2) = max{x1 + 39, x2 + 39} fst_A(x1,x2) = 58 |0|_A = 47 nil_A = 1 from_A(x1) = 44 n__s_A(x1) = max{43, x1 + 6} add_A(x1,x2) = max{119, x2 + 81} len_A(x1) = 46 precedence: fst# = n__fst > cons = activate = fst = len > n__add > add > activate# = n__len = len# = add# > s > |0| = nil = from > n__from = n__s partial status: pi(fst#) = [2] pi(s) = [] pi(cons) = [2] pi(activate#) = [1] pi(n__len) = [] pi(len#) = [] pi(activate) = [1] pi(n__add) = [1, 2] pi(add#) = [1] pi(n__from) = [1] pi(n__fst) = [] pi(fst) = [] pi(|0|) = [] pi(nil) = [] pi(from) = [] pi(n__s) = [] pi(add) = [] pi(len) = [] The next rules are strictly ordered: p1, p2, p3, p4, p5, p6, p9, p10, p11, p12, p13 We remove them from the problem. -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: activate#(n__add(X1,X2)) -> add#(activate(X1),activate(X2)) p2: add#(s(X),Y) -> activate#(X) and R consists of: r1: fst(|0|(),Z) -> nil() r2: fst(s(X),cons(Y,Z)) -> cons(Y,n__fst(activate(X),activate(Z))) r3: from(X) -> cons(X,n__from(n__s(X))) r4: add(|0|(),X) -> X r5: add(s(X),Y) -> s(n__add(activate(X),Y)) r6: len(nil()) -> |0|() r7: len(cons(X,Z)) -> s(n__len(activate(Z))) r8: fst(X1,X2) -> n__fst(X1,X2) r9: from(X) -> n__from(X) r10: s(X) -> n__s(X) r11: add(X1,X2) -> n__add(X1,X2) r12: len(X) -> n__len(X) r13: activate(n__fst(X1,X2)) -> fst(activate(X1),activate(X2)) r14: activate(n__from(X)) -> from(activate(X)) r15: activate(n__s(X)) -> s(X) r16: activate(n__add(X1,X2)) -> add(activate(X1),activate(X2)) r17: activate(n__len(X)) -> len(activate(X)) r18: activate(X) -> X The estimated dependency graph contains the following SCCs: {p1, p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: activate#(n__add(X1,X2)) -> add#(activate(X1),activate(X2)) p2: add#(s(X),Y) -> activate#(X) and R consists of: r1: fst(|0|(),Z) -> nil() r2: fst(s(X),cons(Y,Z)) -> cons(Y,n__fst(activate(X),activate(Z))) r3: from(X) -> cons(X,n__from(n__s(X))) r4: add(|0|(),X) -> X r5: add(s(X),Y) -> s(n__add(activate(X),Y)) r6: len(nil()) -> |0|() r7: len(cons(X,Z)) -> s(n__len(activate(Z))) r8: fst(X1,X2) -> n__fst(X1,X2) r9: from(X) -> n__from(X) r10: s(X) -> n__s(X) r11: add(X1,X2) -> n__add(X1,X2) r12: len(X) -> n__len(X) r13: activate(n__fst(X1,X2)) -> fst(activate(X1),activate(X2)) r14: activate(n__from(X)) -> from(activate(X)) r15: activate(n__s(X)) -> s(X) r16: activate(n__add(X1,X2)) -> add(activate(X1),activate(X2)) r17: activate(n__len(X)) -> len(activate(X)) r18: activate(X) -> X The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, r18 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: activate#_A(x1) = max{23, x1} n__add_A(x1,x2) = max{50, x1 + 25, x2 + 43} add#_A(x1,x2) = max{26, x1 + 25, x2 + 15} activate_A(x1) = max{7, x1} s_A(x1) = max{24, x1} fst_A(x1,x2) = max{31, x2 + 23} |0|_A = 0 nil_A = 1 cons_A(x1,x2) = max{5, x2 - 15} n__fst_A(x1,x2) = max{31, x2 + 23} from_A(x1) = 5 n__from_A(x1) = 4 n__s_A(x1) = max{24, x1} add_A(x1,x2) = max{50, x1 + 25, x2 + 43} len_A(x1) = 25 n__len_A(x1) = 25 precedence: |0| = nil > activate# = n__add = add > add# > activate = s = from = len > fst = n__from > n__fst = n__s > cons = n__len partial status: pi(activate#) = [1] pi(n__add) = [] pi(add#) = [1, 2] pi(activate) = [1] pi(s) = [] pi(fst) = [2] pi(|0|) = [] pi(nil) = [] pi(cons) = [] pi(n__fst) = [2] pi(from) = [] pi(n__from) = [] pi(n__s) = [] pi(add) = [] pi(len) = [] pi(n__len) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: activate#_A(x1) = max{63, x1 + 43} n__add_A(x1,x2) = 11 add#_A(x1,x2) = max{62, x1 + 12, x2 + 7} activate_A(x1) = x1 + 17 s_A(x1) = 15 fst_A(x1,x2) = 36 |0|_A = 17 nil_A = 1 cons_A(x1,x2) = 4 n__fst_A(x1,x2) = 1 from_A(x1) = 11 n__from_A(x1) = 11 n__s_A(x1) = 14 add_A(x1,x2) = 36 len_A(x1) = 16 n__len_A(x1) = 0 precedence: |0| = n__s > activate# = n__add = add# = activate = fst = nil = n__fst = add = len = n__len > s = cons = from > n__from partial status: pi(activate#) = [] pi(n__add) = [] pi(add#) = [2] pi(activate) = [1] pi(s) = [] pi(fst) = [] pi(|0|) = [] pi(nil) = [] pi(cons) = [] pi(n__fst) = [] pi(from) = [] pi(n__from) = [] pi(n__s) = [] pi(add) = [] pi(len) = [] pi(n__len) = [] The next rules are strictly ordered: p1, p2 We remove them from the problem. Then no dependency pair remains.