YES

We show the termination of the TRS R:

  terms(N) -> cons(recip(sqr(N)),n__terms(n__s(N)))
  sqr(|0|()) -> |0|()
  sqr(s(X)) -> s(add(sqr(X),dbl(X)))
  dbl(|0|()) -> |0|()
  dbl(s(X)) -> s(s(dbl(X)))
  add(|0|(),X) -> X
  add(s(X),Y) -> s(add(X,Y))
  first(|0|(),X) -> nil()
  first(s(X),cons(Y,Z)) -> cons(Y,n__first(X,activate(Z)))
  terms(X) -> n__terms(X)
  s(X) -> n__s(X)
  first(X1,X2) -> n__first(X1,X2)
  activate(n__terms(X)) -> terms(activate(X))
  activate(n__s(X)) -> s(activate(X))
  activate(n__first(X1,X2)) -> first(activate(X1),activate(X2))
  activate(X) -> X

-- SCC decomposition.

Consider the dependency pair problem (P, R), where P consists of

p1: terms#(N) -> sqr#(N)
p2: sqr#(s(X)) -> s#(add(sqr(X),dbl(X)))
p3: sqr#(s(X)) -> add#(sqr(X),dbl(X))
p4: sqr#(s(X)) -> sqr#(X)
p5: sqr#(s(X)) -> dbl#(X)
p6: dbl#(s(X)) -> s#(s(dbl(X)))
p7: dbl#(s(X)) -> s#(dbl(X))
p8: dbl#(s(X)) -> dbl#(X)
p9: add#(s(X),Y) -> s#(add(X,Y))
p10: add#(s(X),Y) -> add#(X,Y)
p11: first#(s(X),cons(Y,Z)) -> activate#(Z)
p12: activate#(n__terms(X)) -> terms#(activate(X))
p13: activate#(n__terms(X)) -> activate#(X)
p14: activate#(n__s(X)) -> s#(activate(X))
p15: activate#(n__s(X)) -> activate#(X)
p16: activate#(n__first(X1,X2)) -> first#(activate(X1),activate(X2))
p17: activate#(n__first(X1,X2)) -> activate#(X1)
p18: activate#(n__first(X1,X2)) -> activate#(X2)

and R consists of:

r1: terms(N) -> cons(recip(sqr(N)),n__terms(n__s(N)))
r2: sqr(|0|()) -> |0|()
r3: sqr(s(X)) -> s(add(sqr(X),dbl(X)))
r4: dbl(|0|()) -> |0|()
r5: dbl(s(X)) -> s(s(dbl(X)))
r6: add(|0|(),X) -> X
r7: add(s(X),Y) -> s(add(X,Y))
r8: first(|0|(),X) -> nil()
r9: first(s(X),cons(Y,Z)) -> cons(Y,n__first(X,activate(Z)))
r10: terms(X) -> n__terms(X)
r11: s(X) -> n__s(X)
r12: first(X1,X2) -> n__first(X1,X2)
r13: activate(n__terms(X)) -> terms(activate(X))
r14: activate(n__s(X)) -> s(activate(X))
r15: activate(n__first(X1,X2)) -> first(activate(X1),activate(X2))
r16: activate(X) -> X

The estimated dependency graph contains the following SCCs:

  {p11, p13, p15, p16, p17, p18}
  {p4}
  {p10}
  {p8}


-- Reduction pair.

Consider the dependency pair problem (P, R), where P consists of

p1: activate#(n__first(X1,X2)) -> activate#(X2)
p2: activate#(n__first(X1,X2)) -> activate#(X1)
p3: activate#(n__first(X1,X2)) -> first#(activate(X1),activate(X2))
p4: first#(s(X),cons(Y,Z)) -> activate#(Z)
p5: activate#(n__s(X)) -> activate#(X)
p6: activate#(n__terms(X)) -> activate#(X)

and R consists of:

r1: terms(N) -> cons(recip(sqr(N)),n__terms(n__s(N)))
r2: sqr(|0|()) -> |0|()
r3: sqr(s(X)) -> s(add(sqr(X),dbl(X)))
r4: dbl(|0|()) -> |0|()
r5: dbl(s(X)) -> s(s(dbl(X)))
r6: add(|0|(),X) -> X
r7: add(s(X),Y) -> s(add(X,Y))
r8: first(|0|(),X) -> nil()
r9: first(s(X),cons(Y,Z)) -> cons(Y,n__first(X,activate(Z)))
r10: terms(X) -> n__terms(X)
r11: s(X) -> n__s(X)
r12: first(X1,X2) -> n__first(X1,X2)
r13: activate(n__terms(X)) -> terms(activate(X))
r14: activate(n__s(X)) -> s(activate(X))
r15: activate(n__first(X1,X2)) -> first(activate(X1),activate(X2))
r16: 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

Take the reduction pair:

  matrix interpretations:
  
    carrier: N^1
    order: standard order
    interpretations:
      activate#_A(x1) = x1
      n__first_A(x1,x2) = x1 + x2 + 2
      first#_A(x1,x2) = x2 + 1
      activate_A(x1) = x1
      s_A(x1) = x1
      cons_A(x1,x2) = x2
      n__s_A(x1) = x1
      n__terms_A(x1) = x1 + 1
      dbl_A(x1) = 1
      |0|_A() = 1
      add_A(x1,x2) = x2
      sqr_A(x1) = 1
      terms_A(x1) = x1 + 1
      recip_A(x1) = 1
      first_A(x1,x2) = x1 + x2 + 2
      nil_A() = 0

The next rules are strictly ordered:

  p1, p2, p3, p4, p6

We remove them from the problem.

-- SCC decomposition.

Consider the dependency pair problem (P, R), where P consists of

p1: activate#(n__s(X)) -> activate#(X)

and R consists of:

r1: terms(N) -> cons(recip(sqr(N)),n__terms(n__s(N)))
r2: sqr(|0|()) -> |0|()
r3: sqr(s(X)) -> s(add(sqr(X),dbl(X)))
r4: dbl(|0|()) -> |0|()
r5: dbl(s(X)) -> s(s(dbl(X)))
r6: add(|0|(),X) -> X
r7: add(s(X),Y) -> s(add(X,Y))
r8: first(|0|(),X) -> nil()
r9: first(s(X),cons(Y,Z)) -> cons(Y,n__first(X,activate(Z)))
r10: terms(X) -> n__terms(X)
r11: s(X) -> n__s(X)
r12: first(X1,X2) -> n__first(X1,X2)
r13: activate(n__terms(X)) -> terms(activate(X))
r14: activate(n__s(X)) -> s(activate(X))
r15: activate(n__first(X1,X2)) -> first(activate(X1),activate(X2))
r16: 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__s(X)) -> activate#(X)

and R consists of:

r1: terms(N) -> cons(recip(sqr(N)),n__terms(n__s(N)))
r2: sqr(|0|()) -> |0|()
r3: sqr(s(X)) -> s(add(sqr(X),dbl(X)))
r4: dbl(|0|()) -> |0|()
r5: dbl(s(X)) -> s(s(dbl(X)))
r6: add(|0|(),X) -> X
r7: add(s(X),Y) -> s(add(X,Y))
r8: first(|0|(),X) -> nil()
r9: first(s(X),cons(Y,Z)) -> cons(Y,n__first(X,activate(Z)))
r10: terms(X) -> n__terms(X)
r11: s(X) -> n__s(X)
r12: first(X1,X2) -> n__first(X1,X2)
r13: activate(n__terms(X)) -> terms(activate(X))
r14: activate(n__s(X)) -> s(activate(X))
r15: activate(n__first(X1,X2)) -> first(activate(X1),activate(X2))
r16: activate(X) -> X

The set of usable rules consists of

  (no rules)

Take the monotone reduction pair:

  matrix interpretations:
  
    carrier: N^1
    order: standard order
    interpretations:
      activate#_A(x1) = x1
      n__s_A(x1) = x1 + 1

The next rules are strictly ordered:

  p1
  r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16

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: sqr#(s(X)) -> sqr#(X)

and R consists of:

r1: terms(N) -> cons(recip(sqr(N)),n__terms(n__s(N)))
r2: sqr(|0|()) -> |0|()
r3: sqr(s(X)) -> s(add(sqr(X),dbl(X)))
r4: dbl(|0|()) -> |0|()
r5: dbl(s(X)) -> s(s(dbl(X)))
r6: add(|0|(),X) -> X
r7: add(s(X),Y) -> s(add(X,Y))
r8: first(|0|(),X) -> nil()
r9: first(s(X),cons(Y,Z)) -> cons(Y,n__first(X,activate(Z)))
r10: terms(X) -> n__terms(X)
r11: s(X) -> n__s(X)
r12: first(X1,X2) -> n__first(X1,X2)
r13: activate(n__terms(X)) -> terms(activate(X))
r14: activate(n__s(X)) -> s(activate(X))
r15: activate(n__first(X1,X2)) -> first(activate(X1),activate(X2))
r16: activate(X) -> X

The set of usable rules consists of

  (no rules)

Take the monotone reduction pair:

  matrix interpretations:
  
    carrier: N^1
    order: standard order
    interpretations:
      sqr#_A(x1) = x1
      s_A(x1) = x1 + 1

The next rules are strictly ordered:

  p1
  r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16

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: add#(s(X),Y) -> add#(X,Y)

and R consists of:

r1: terms(N) -> cons(recip(sqr(N)),n__terms(n__s(N)))
r2: sqr(|0|()) -> |0|()
r3: sqr(s(X)) -> s(add(sqr(X),dbl(X)))
r4: dbl(|0|()) -> |0|()
r5: dbl(s(X)) -> s(s(dbl(X)))
r6: add(|0|(),X) -> X
r7: add(s(X),Y) -> s(add(X,Y))
r8: first(|0|(),X) -> nil()
r9: first(s(X),cons(Y,Z)) -> cons(Y,n__first(X,activate(Z)))
r10: terms(X) -> n__terms(X)
r11: s(X) -> n__s(X)
r12: first(X1,X2) -> n__first(X1,X2)
r13: activate(n__terms(X)) -> terms(activate(X))
r14: activate(n__s(X)) -> s(activate(X))
r15: activate(n__first(X1,X2)) -> first(activate(X1),activate(X2))
r16: activate(X) -> X

The set of usable rules consists of

  (no rules)

Take the reduction pair:

  matrix interpretations:
  
    carrier: N^1
    order: standard order
    interpretations:
      add#_A(x1,x2) = x1
      s_A(x1) = x1 + 1

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: dbl#(s(X)) -> dbl#(X)

and R consists of:

r1: terms(N) -> cons(recip(sqr(N)),n__terms(n__s(N)))
r2: sqr(|0|()) -> |0|()
r3: sqr(s(X)) -> s(add(sqr(X),dbl(X)))
r4: dbl(|0|()) -> |0|()
r5: dbl(s(X)) -> s(s(dbl(X)))
r6: add(|0|(),X) -> X
r7: add(s(X),Y) -> s(add(X,Y))
r8: first(|0|(),X) -> nil()
r9: first(s(X),cons(Y,Z)) -> cons(Y,n__first(X,activate(Z)))
r10: terms(X) -> n__terms(X)
r11: s(X) -> n__s(X)
r12: first(X1,X2) -> n__first(X1,X2)
r13: activate(n__terms(X)) -> terms(activate(X))
r14: activate(n__s(X)) -> s(activate(X))
r15: activate(n__first(X1,X2)) -> first(activate(X1),activate(X2))
r16: activate(X) -> X

The set of usable rules consists of

  (no rules)

Take the monotone reduction pair:

  matrix interpretations:
  
    carrier: N^1
    order: standard order
    interpretations:
      dbl#_A(x1) = x1
      s_A(x1) = x1 + 1

The next rules are strictly ordered:

  p1
  r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16

We remove them from the problem.  Then no dependency pair remains.