YES We show the termination of the TRS R: and(true(),X) -> activate(X) and(false(),Y) -> false() if(true(),X,Y) -> activate(X) if(false(),X,Y) -> activate(Y) add(|0|(),X) -> activate(X) add(s(X),Y) -> s(n__add(activate(X),activate(Y))) first(|0|(),X) -> nil() first(s(X),cons(Y,Z)) -> cons(activate(Y),n__first(activate(X),activate(Z))) from(X) -> cons(activate(X),n__from(n__s(activate(X)))) add(X1,X2) -> n__add(X1,X2) first(X1,X2) -> n__first(X1,X2) from(X) -> n__from(X) s(X) -> n__s(X) activate(n__add(X1,X2)) -> add(activate(X1),X2) activate(n__first(X1,X2)) -> first(activate(X1),activate(X2)) activate(n__from(X)) -> from(X) activate(n__s(X)) -> s(X) activate(X) -> X -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: and#(true(),X) -> activate#(X) p2: if#(true(),X,Y) -> activate#(X) p3: if#(false(),X,Y) -> activate#(Y) p4: add#(|0|(),X) -> activate#(X) p5: add#(s(X),Y) -> s#(n__add(activate(X),activate(Y))) p6: add#(s(X),Y) -> activate#(X) p7: add#(s(X),Y) -> activate#(Y) p8: first#(s(X),cons(Y,Z)) -> activate#(Y) p9: first#(s(X),cons(Y,Z)) -> activate#(X) p10: first#(s(X),cons(Y,Z)) -> activate#(Z) p11: from#(X) -> activate#(X) p12: activate#(n__add(X1,X2)) -> add#(activate(X1),X2) p13: activate#(n__add(X1,X2)) -> activate#(X1) p14: activate#(n__first(X1,X2)) -> first#(activate(X1),activate(X2)) p15: activate#(n__first(X1,X2)) -> activate#(X1) p16: activate#(n__first(X1,X2)) -> activate#(X2) p17: activate#(n__from(X)) -> from#(X) p18: activate#(n__s(X)) -> s#(X) and R consists of: r1: and(true(),X) -> activate(X) r2: and(false(),Y) -> false() r3: if(true(),X,Y) -> activate(X) r4: if(false(),X,Y) -> activate(Y) r5: add(|0|(),X) -> activate(X) r6: add(s(X),Y) -> s(n__add(activate(X),activate(Y))) r7: first(|0|(),X) -> nil() r8: first(s(X),cons(Y,Z)) -> cons(activate(Y),n__first(activate(X),activate(Z))) r9: from(X) -> cons(activate(X),n__from(n__s(activate(X)))) r10: add(X1,X2) -> n__add(X1,X2) r11: first(X1,X2) -> n__first(X1,X2) r12: from(X) -> n__from(X) r13: s(X) -> n__s(X) r14: activate(n__add(X1,X2)) -> add(activate(X1),X2) r15: activate(n__first(X1,X2)) -> first(activate(X1),activate(X2)) r16: activate(n__from(X)) -> from(X) r17: activate(n__s(X)) -> s(X) r18: activate(X) -> X The estimated dependency graph contains the following SCCs: {p4, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: activate#(n__add(X1,X2)) -> add#(activate(X1),X2) p2: add#(s(X),Y) -> activate#(Y) p3: activate#(n__from(X)) -> from#(X) p4: from#(X) -> activate#(X) p5: activate#(n__first(X1,X2)) -> activate#(X2) p6: activate#(n__first(X1,X2)) -> activate#(X1) p7: activate#(n__first(X1,X2)) -> first#(activate(X1),activate(X2)) p8: first#(s(X),cons(Y,Z)) -> activate#(Z) p9: activate#(n__add(X1,X2)) -> activate#(X1) p10: first#(s(X),cons(Y,Z)) -> activate#(X) p11: first#(s(X),cons(Y,Z)) -> activate#(Y) p12: add#(s(X),Y) -> activate#(X) p13: add#(|0|(),X) -> activate#(X) and R consists of: r1: and(true(),X) -> activate(X) r2: and(false(),Y) -> false() r3: if(true(),X,Y) -> activate(X) r4: if(false(),X,Y) -> activate(Y) r5: add(|0|(),X) -> activate(X) r6: add(s(X),Y) -> s(n__add(activate(X),activate(Y))) r7: first(|0|(),X) -> nil() r8: first(s(X),cons(Y,Z)) -> cons(activate(Y),n__first(activate(X),activate(Z))) r9: from(X) -> cons(activate(X),n__from(n__s(activate(X)))) r10: add(X1,X2) -> n__add(X1,X2) r11: first(X1,X2) -> n__first(X1,X2) r12: from(X) -> n__from(X) r13: s(X) -> n__s(X) r14: activate(n__add(X1,X2)) -> add(activate(X1),X2) r15: activate(n__first(X1,X2)) -> first(activate(X1),activate(X2)) r16: activate(n__from(X)) -> from(X) r17: activate(n__s(X)) -> s(X) r18: activate(X) -> X The set of usable rules consists of 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{9, x1 + 4} n__add_A(x1,x2) = max{x1 + 19, x2 + 15} add#_A(x1,x2) = max{x1 + 13, x2 + 10} activate_A(x1) = x1 s_A(x1) = max{0, x1 - 3} n__from_A(x1) = x1 + 9 from#_A(x1) = max{9, x1 + 4} n__first_A(x1,x2) = max{x1 + 14, x2 + 10} first#_A(x1,x2) = max{x1 + 8, x2 + 8} cons_A(x1,x2) = max{4, x1 - 4, x2 - 4} |0|_A = 0 add_A(x1,x2) = max{x1 + 19, x2 + 15} first_A(x1,x2) = max{x1 + 14, x2 + 10} nil_A = 1 from_A(x1) = x1 + 9 n__s_A(x1) = max{0, x1 - 3} precedence: activate = n__from = from# = |0| = nil = from > s = add = n__s > first > n__add = add# = first# = cons > activate# = n__first partial status: pi(activate#) = [1] pi(n__add) = [1, 2] pi(add#) = [1, 2] pi(activate) = [1] pi(s) = [] pi(n__from) = [] pi(from#) = [] pi(n__first) = [2] pi(first#) = [] pi(cons) = [] pi(|0|) = [] pi(add) = [1, 2] pi(first) = [1, 2] pi(nil) = [] pi(from) = [1] pi(n__s) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: activate#_A(x1) = 4 n__add_A(x1,x2) = max{x1 + 116, x2 + 115} add#_A(x1,x2) = max{124, x1 + 77, x2 + 116} activate_A(x1) = x1 + 50 s_A(x1) = 164 n__from_A(x1) = 27 from#_A(x1) = 3 n__first_A(x1,x2) = max{4, x2 - 4} first#_A(x1,x2) = 4 cons_A(x1,x2) = 48 |0|_A = 41 add_A(x1,x2) = max{166, x1 + 116, x2 + 165} first_A(x1,x2) = max{47, x2 + 43} nil_A = 42 from_A(x1) = max{112, x1 + 49} n__s_A(x1) = 113 precedence: from# = n__first > add# = first# > activate# = activate = s = cons = |0| = add > n__add = n__from = first = nil = from = n__s partial status: pi(activate#) = [] pi(n__add) = [2] pi(add#) = [1, 2] pi(activate) = [1] pi(s) = [] pi(n__from) = [] pi(from#) = [] pi(n__first) = [] pi(first#) = [] pi(cons) = [] pi(|0|) = [] pi(add) = [1, 2] pi(first) = [] pi(nil) = [] pi(from) = [] pi(n__s) = [] The next rules are strictly ordered: p1, p2, p3, p4, p5, p7, 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__first(X1,X2)) -> activate#(X1) p2: first#(s(X),cons(Y,Z)) -> activate#(Z) and R consists of: r1: and(true(),X) -> activate(X) r2: and(false(),Y) -> false() r3: if(true(),X,Y) -> activate(X) r4: if(false(),X,Y) -> activate(Y) r5: add(|0|(),X) -> activate(X) r6: add(s(X),Y) -> s(n__add(activate(X),activate(Y))) r7: first(|0|(),X) -> nil() r8: first(s(X),cons(Y,Z)) -> cons(activate(Y),n__first(activate(X),activate(Z))) r9: from(X) -> cons(activate(X),n__from(n__s(activate(X)))) r10: add(X1,X2) -> n__add(X1,X2) r11: first(X1,X2) -> n__first(X1,X2) r12: from(X) -> n__from(X) r13: s(X) -> n__s(X) r14: activate(n__add(X1,X2)) -> add(activate(X1),X2) r15: activate(n__first(X1,X2)) -> first(activate(X1),activate(X2)) r16: activate(n__from(X)) -> from(X) r17: activate(n__s(X)) -> s(X) r18: activate(X) -> X The estimated dependency graph contains the following SCCs: {p1} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: activate#(n__first(X1,X2)) -> activate#(X1) and R consists of: r1: and(true(),X) -> activate(X) r2: and(false(),Y) -> false() r3: if(true(),X,Y) -> activate(X) r4: if(false(),X,Y) -> activate(Y) r5: add(|0|(),X) -> activate(X) r6: add(s(X),Y) -> s(n__add(activate(X),activate(Y))) r7: first(|0|(),X) -> nil() r8: first(s(X),cons(Y,Z)) -> cons(activate(Y),n__first(activate(X),activate(Z))) r9: from(X) -> cons(activate(X),n__from(n__s(activate(X)))) r10: add(X1,X2) -> n__add(X1,X2) r11: first(X1,X2) -> n__first(X1,X2) r12: from(X) -> n__from(X) r13: s(X) -> n__s(X) r14: activate(n__add(X1,X2)) -> add(activate(X1),X2) r15: activate(n__first(X1,X2)) -> first(activate(X1),activate(X2)) r16: activate(n__from(X)) -> from(X) r17: activate(n__s(X)) -> s(X) r18: activate(X) -> X The set of usable rules consists of (no rules) 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{2, x1 + 1} n__first_A(x1,x2) = max{x1, x2 + 1} precedence: activate# = n__first partial status: pi(activate#) = [1] pi(n__first) = [1, 2] 2. weighted path order base order: max/plus interpretations on natural numbers: activate#_A(x1) = max{2, x1 - 1} n__first_A(x1,x2) = x2 + 1 precedence: activate# = n__first partial status: pi(activate#) = [] pi(n__first) = [2] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.