YES We show the termination of the TRS R: terms(N) -> cons(recip(sqr(N)),n__terms(s(N))) sqr(|0|()) -> |0|() sqr(s(X)) -> s(n__add(sqr(activate(X)),dbl(activate(X)))) dbl(|0|()) -> |0|() dbl(s(X)) -> s(n__s(n__dbl(activate(X)))) add(|0|(),X) -> X add(s(X),Y) -> s(n__add(activate(X),Y)) first(|0|(),X) -> nil() first(s(X),cons(Y,Z)) -> cons(Y,n__first(activate(X),activate(Z))) terms(X) -> n__terms(X) add(X1,X2) -> n__add(X1,X2) s(X) -> n__s(X) dbl(X) -> n__dbl(X) first(X1,X2) -> n__first(X1,X2) activate(n__terms(X)) -> terms(X) activate(n__add(X1,X2)) -> add(X1,X2) activate(n__s(X)) -> s(X) activate(n__dbl(X)) -> dbl(X) activate(n__first(X1,X2)) -> first(X1,X2) activate(X) -> X -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: terms#(N) -> sqr#(N) p2: terms#(N) -> s#(N) p3: sqr#(s(X)) -> s#(n__add(sqr(activate(X)),dbl(activate(X)))) p4: sqr#(s(X)) -> sqr#(activate(X)) p5: sqr#(s(X)) -> activate#(X) p6: sqr#(s(X)) -> dbl#(activate(X)) p7: dbl#(s(X)) -> s#(n__s(n__dbl(activate(X)))) p8: dbl#(s(X)) -> activate#(X) p9: add#(s(X),Y) -> s#(n__add(activate(X),Y)) p10: add#(s(X),Y) -> activate#(X) p11: first#(s(X),cons(Y,Z)) -> activate#(X) p12: first#(s(X),cons(Y,Z)) -> activate#(Z) p13: activate#(n__terms(X)) -> terms#(X) p14: activate#(n__add(X1,X2)) -> add#(X1,X2) p15: activate#(n__s(X)) -> s#(X) p16: activate#(n__dbl(X)) -> dbl#(X) p17: activate#(n__first(X1,X2)) -> first#(X1,X2) and R consists of: r1: terms(N) -> cons(recip(sqr(N)),n__terms(s(N))) r2: sqr(|0|()) -> |0|() r3: sqr(s(X)) -> s(n__add(sqr(activate(X)),dbl(activate(X)))) r4: dbl(|0|()) -> |0|() r5: dbl(s(X)) -> s(n__s(n__dbl(activate(X)))) r6: add(|0|(),X) -> X r7: add(s(X),Y) -> s(n__add(activate(X),Y)) r8: first(|0|(),X) -> nil() r9: first(s(X),cons(Y,Z)) -> cons(Y,n__first(activate(X),activate(Z))) r10: terms(X) -> n__terms(X) r11: add(X1,X2) -> n__add(X1,X2) r12: s(X) -> n__s(X) r13: dbl(X) -> n__dbl(X) r14: first(X1,X2) -> n__first(X1,X2) r15: activate(n__terms(X)) -> terms(X) r16: activate(n__add(X1,X2)) -> add(X1,X2) r17: activate(n__s(X)) -> s(X) r18: activate(n__dbl(X)) -> dbl(X) r19: activate(n__first(X1,X2)) -> first(X1,X2) r20: activate(X) -> X The estimated dependency graph contains the following SCCs: {p1, p4, p5, p6, p8, p10, p11, p12, p13, p14, p16, p17} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: terms#(N) -> sqr#(N) p2: sqr#(s(X)) -> dbl#(activate(X)) p3: dbl#(s(X)) -> activate#(X) p4: activate#(n__first(X1,X2)) -> first#(X1,X2) p5: first#(s(X),cons(Y,Z)) -> activate#(Z) p6: activate#(n__dbl(X)) -> dbl#(X) p7: activate#(n__add(X1,X2)) -> add#(X1,X2) p8: add#(s(X),Y) -> activate#(X) p9: activate#(n__terms(X)) -> terms#(X) p10: first#(s(X),cons(Y,Z)) -> activate#(X) p11: sqr#(s(X)) -> activate#(X) p12: sqr#(s(X)) -> sqr#(activate(X)) and R consists of: r1: terms(N) -> cons(recip(sqr(N)),n__terms(s(N))) r2: sqr(|0|()) -> |0|() r3: sqr(s(X)) -> s(n__add(sqr(activate(X)),dbl(activate(X)))) r4: dbl(|0|()) -> |0|() r5: dbl(s(X)) -> s(n__s(n__dbl(activate(X)))) r6: add(|0|(),X) -> X r7: add(s(X),Y) -> s(n__add(activate(X),Y)) r8: first(|0|(),X) -> nil() r9: first(s(X),cons(Y,Z)) -> cons(Y,n__first(activate(X),activate(Z))) r10: terms(X) -> n__terms(X) r11: add(X1,X2) -> n__add(X1,X2) r12: s(X) -> n__s(X) r13: dbl(X) -> n__dbl(X) r14: first(X1,X2) -> n__first(X1,X2) r15: activate(n__terms(X)) -> terms(X) r16: activate(n__add(X1,X2)) -> add(X1,X2) r17: activate(n__s(X)) -> s(X) r18: activate(n__dbl(X)) -> dbl(X) r19: activate(n__first(X1,X2)) -> first(X1,X2) r20: 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, r19, r20 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: terms#_A(x1) = x1 + 18 sqr#_A(x1) = x1 + 18 s_A(x1) = max{19, x1} dbl#_A(x1) = x1 + 6 activate_A(x1) = max{2, x1} activate#_A(x1) = max{5, x1} n__first_A(x1,x2) = max{47, x1 + 46, x2 + 43} first#_A(x1,x2) = max{42, x1 + 6, x2 + 6} cons_A(x1,x2) = max{42, x1 + 6, x2} n__dbl_A(x1) = x1 + 7 n__add_A(x1,x2) = max{x1, x2 + 7} add#_A(x1,x2) = max{x1, x2 + 6} n__terms_A(x1) = max{42, x1 + 23} sqr_A(x1) = x1 + 16 |0|_A = 45 dbl_A(x1) = x1 + 7 terms_A(x1) = max{42, x1 + 23} recip_A(x1) = max{22, x1} n__s_A(x1) = max{19, x1} add_A(x1,x2) = max{x1, x2 + 7} first_A(x1,x2) = max{47, x1 + 46, x2 + 43} nil_A = 44 precedence: n__dbl = dbl > sqr > n__add = add > first# > s = activate# = add# = n__s > activate = terms > first > cons > n__first > n__terms > nil > |0| > terms# > sqr# > dbl# > recip partial status: pi(terms#) = [1] pi(sqr#) = [1] pi(s) = [1] pi(dbl#) = [1] pi(activate) = [1] pi(activate#) = [1] pi(n__first) = [1, 2] pi(first#) = [1, 2] pi(cons) = [1, 2] pi(n__dbl) = [1] pi(n__add) = [1, 2] pi(add#) = [1, 2] pi(n__terms) = [1] pi(sqr) = [1] pi(|0|) = [] pi(dbl) = [1] pi(terms) = [1] pi(recip) = [1] pi(n__s) = [1] pi(add) = [1, 2] pi(first) = [] pi(nil) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: terms#_A(x1) = x1 + 86 sqr#_A(x1) = x1 + 86 s_A(x1) = x1 + 110 dbl#_A(x1) = max{16, x1} activate_A(x1) = x1 + 24 activate#_A(x1) = x1 + 69 n__first_A(x1,x2) = max{537, x1 + 355, x2 + 182} first#_A(x1,x2) = max{x1 + 424, x2 + 250} cons_A(x1,x2) = max{16, x1 - 17, x2 - 181} n__dbl_A(x1) = max{134, x1 + 8} n__add_A(x1,x2) = max{120, x1 - 24, x2 - 50} add#_A(x1,x2) = max{18, x1 - 41} n__terms_A(x1) = x1 + 86 sqr_A(x1) = max{123, x1 + 120} |0|_A = 160 dbl_A(x1) = max{159, x1 + 109} terms_A(x1) = max{16, x1 + 15} recip_A(x1) = 17 n__s_A(x1) = 0 add_A(x1,x2) = max{230, x1 + 120, x2 + 101} first_A(x1,x2) = 355 nil_A = 161 precedence: terms > activate > dbl = add = first = nil > n__s > n__first > |0| > s = n__dbl = n__add = n__terms = sqr > add# > activate# = first# > terms# > sqr# > dbl# = recip > cons partial status: pi(terms#) = [1] pi(sqr#) = [1] pi(s) = [] pi(dbl#) = [1] pi(activate) = [1] pi(activate#) = [1] pi(n__first) = [] pi(first#) = [1, 2] pi(cons) = [] pi(n__dbl) = [1] pi(n__add) = [] pi(add#) = [] pi(n__terms) = [] pi(sqr) = [1] pi(|0|) = [] pi(dbl) = [] pi(terms) = [1] pi(recip) = [] pi(n__s) = [] pi(add) = [1] pi(first) = [] pi(nil) = [] The next rules are strictly ordered: p1, p2, p3, p4, p5, p6, p9, p10, p11, p12 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#(X1,X2) p2: add#(s(X),Y) -> activate#(X) and R consists of: r1: terms(N) -> cons(recip(sqr(N)),n__terms(s(N))) r2: sqr(|0|()) -> |0|() r3: sqr(s(X)) -> s(n__add(sqr(activate(X)),dbl(activate(X)))) r4: dbl(|0|()) -> |0|() r5: dbl(s(X)) -> s(n__s(n__dbl(activate(X)))) r6: add(|0|(),X) -> X r7: add(s(X),Y) -> s(n__add(activate(X),Y)) r8: first(|0|(),X) -> nil() r9: first(s(X),cons(Y,Z)) -> cons(Y,n__first(activate(X),activate(Z))) r10: terms(X) -> n__terms(X) r11: add(X1,X2) -> n__add(X1,X2) r12: s(X) -> n__s(X) r13: dbl(X) -> n__dbl(X) r14: first(X1,X2) -> n__first(X1,X2) r15: activate(n__terms(X)) -> terms(X) r16: activate(n__add(X1,X2)) -> add(X1,X2) r17: activate(n__s(X)) -> s(X) r18: activate(n__dbl(X)) -> dbl(X) r19: activate(n__first(X1,X2)) -> first(X1,X2) r20: 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#(X1,X2) p2: add#(s(X),Y) -> activate#(X) and R consists of: r1: terms(N) -> cons(recip(sqr(N)),n__terms(s(N))) r2: sqr(|0|()) -> |0|() r3: sqr(s(X)) -> s(n__add(sqr(activate(X)),dbl(activate(X)))) r4: dbl(|0|()) -> |0|() r5: dbl(s(X)) -> s(n__s(n__dbl(activate(X)))) r6: add(|0|(),X) -> X r7: add(s(X),Y) -> s(n__add(activate(X),Y)) r8: first(|0|(),X) -> nil() r9: first(s(X),cons(Y,Z)) -> cons(Y,n__first(activate(X),activate(Z))) r10: terms(X) -> n__terms(X) r11: add(X1,X2) -> n__add(X1,X2) r12: s(X) -> n__s(X) r13: dbl(X) -> n__dbl(X) r14: first(X1,X2) -> n__first(X1,X2) r15: activate(n__terms(X)) -> terms(X) r16: activate(n__add(X1,X2)) -> add(X1,X2) r17: activate(n__s(X)) -> s(X) r18: activate(n__dbl(X)) -> dbl(X) r19: activate(n__first(X1,X2)) -> first(X1,X2) r20: 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{3, x1 + 2} n__add_A(x1,x2) = max{x1 + 5, x2 + 5} add#_A(x1,x2) = max{x1 + 5, x2 + 4} s_A(x1) = x1 + 4 precedence: activate# = n__add = add# = s partial status: pi(activate#) = [1] pi(n__add) = [1, 2] pi(add#) = [1, 2] pi(s) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: activate#_A(x1) = max{5, x1 + 4} n__add_A(x1,x2) = max{x1 + 1, x2 + 3} add#_A(x1,x2) = max{x1 + 4, x2 + 6} s_A(x1) = x1 precedence: activate# = n__add = add# = s partial status: pi(activate#) = [] pi(n__add) = [2] pi(add#) = [2] pi(s) = [1] The next rules are strictly ordered: p1, p2 We remove them from the problem. Then no dependency pair remains.