YES We show the termination of the TRS R: from(X) -> cons(X,n__from(s(X))) head(cons(X,XS)) -> X |2nd|(cons(X,XS)) -> head(activate(XS)) take(|0|(),XS) -> nil() take(s(N),cons(X,XS)) -> cons(X,n__take(N,activate(XS))) sel(|0|(),cons(X,XS)) -> X sel(s(N),cons(X,XS)) -> sel(N,activate(XS)) from(X) -> n__from(X) take(X1,X2) -> n__take(X1,X2) activate(n__from(X)) -> from(X) activate(n__take(X1,X2)) -> take(X1,X2) activate(X) -> X -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: |2nd|#(cons(X,XS)) -> head#(activate(XS)) p2: |2nd|#(cons(X,XS)) -> activate#(XS) p3: take#(s(N),cons(X,XS)) -> activate#(XS) p4: sel#(s(N),cons(X,XS)) -> sel#(N,activate(XS)) p5: sel#(s(N),cons(X,XS)) -> activate#(XS) p6: activate#(n__from(X)) -> from#(X) p7: activate#(n__take(X1,X2)) -> take#(X1,X2) and R consists of: r1: from(X) -> cons(X,n__from(s(X))) r2: head(cons(X,XS)) -> X r3: |2nd|(cons(X,XS)) -> head(activate(XS)) r4: take(|0|(),XS) -> nil() r5: take(s(N),cons(X,XS)) -> cons(X,n__take(N,activate(XS))) r6: sel(|0|(),cons(X,XS)) -> X r7: sel(s(N),cons(X,XS)) -> sel(N,activate(XS)) r8: from(X) -> n__from(X) r9: take(X1,X2) -> n__take(X1,X2) r10: activate(n__from(X)) -> from(X) r11: activate(n__take(X1,X2)) -> take(X1,X2) r12: activate(X) -> X The estimated dependency graph contains the following SCCs: {p4} {p3, p7} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: sel#(s(N),cons(X,XS)) -> sel#(N,activate(XS)) and R consists of: r1: from(X) -> cons(X,n__from(s(X))) r2: head(cons(X,XS)) -> X r3: |2nd|(cons(X,XS)) -> head(activate(XS)) r4: take(|0|(),XS) -> nil() r5: take(s(N),cons(X,XS)) -> cons(X,n__take(N,activate(XS))) r6: sel(|0|(),cons(X,XS)) -> X r7: sel(s(N),cons(X,XS)) -> sel(N,activate(XS)) r8: from(X) -> n__from(X) r9: take(X1,X2) -> n__take(X1,X2) r10: activate(n__from(X)) -> from(X) r11: activate(n__take(X1,X2)) -> take(X1,X2) r12: activate(X) -> X The set of usable rules consists of r1, r4, r5, r8, r9, r10, r11, r12 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: sel#_A(x1,x2) = x1 + 3 s_A(x1) = x1 cons_A(x1,x2) = max{x1 + 1, x2 - 2} activate_A(x1) = max{2, x1} from_A(x1) = x1 + 4 n__from_A(x1) = x1 + 4 take_A(x1,x2) = max{x1 + 9, x2 + 6} |0|_A = 0 nil_A = 1 n__take_A(x1,x2) = max{x1 + 9, x2 + 6} precedence: sel# > s = activate = from > n__from = take = |0| = nil > cons = n__take partial status: pi(sel#) = [1] pi(s) = [1] pi(cons) = [] pi(activate) = [1] pi(from) = [1] pi(n__from) = [] pi(take) = [1, 2] pi(|0|) = [] pi(nil) = [] pi(n__take) = [1, 2] 2. weighted path order base order: max/plus interpretations on natural numbers: sel#_A(x1,x2) = max{0, x1 - 3} s_A(x1) = x1 + 8 cons_A(x1,x2) = 12 activate_A(x1) = max{18, x1 + 2} from_A(x1) = 21 n__from_A(x1) = 21 take_A(x1,x2) = max{x1 + 11, x2 + 13} |0|_A = 0 nil_A = 12 n__take_A(x1,x2) = max{x1 + 10, x2 + 8} precedence: sel# = s = cons = activate = from = n__from = take = |0| > nil = n__take partial status: pi(sel#) = [] pi(s) = [] pi(cons) = [] pi(activate) = [1] pi(from) = [] pi(n__from) = [] pi(take) = [] pi(|0|) = [] pi(nil) = [] pi(n__take) = [2] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: take#(s(N),cons(X,XS)) -> activate#(XS) p2: activate#(n__take(X1,X2)) -> take#(X1,X2) and R consists of: r1: from(X) -> cons(X,n__from(s(X))) r2: head(cons(X,XS)) -> X r3: |2nd|(cons(X,XS)) -> head(activate(XS)) r4: take(|0|(),XS) -> nil() r5: take(s(N),cons(X,XS)) -> cons(X,n__take(N,activate(XS))) r6: sel(|0|(),cons(X,XS)) -> X r7: sel(s(N),cons(X,XS)) -> sel(N,activate(XS)) r8: from(X) -> n__from(X) r9: take(X1,X2) -> n__take(X1,X2) r10: activate(n__from(X)) -> from(X) r11: activate(n__take(X1,X2)) -> take(X1,X2) r12: 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: take#_A(x1,x2) = max{x1 + 8, x2 + 6} s_A(x1) = max{3, x1 + 1} cons_A(x1,x2) = max{x1 + 10, x2 + 5} activate#_A(x1) = max{10, x1 + 5} n__take_A(x1,x2) = max{x1 + 3, x2 + 1} precedence: cons = activate# > take# = n__take > s partial status: pi(take#) = [1] pi(s) = [1] pi(cons) = [2] pi(activate#) = [] pi(n__take) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: take#_A(x1,x2) = x1 + 2 s_A(x1) = x1 cons_A(x1,x2) = x2 activate#_A(x1) = 1 n__take_A(x1,x2) = x1 + 1 precedence: s > take# = activate# > cons > n__take partial status: pi(take#) = [1] pi(s) = [1] pi(cons) = [2] pi(activate#) = [] pi(n__take) = [] The next rules are strictly ordered: p1, p2 We remove them from the problem. Then no dependency pair remains.