Term Rewriting System R:
[N, X, Y, Z, X1, X2]
terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X

Termination of R to be shown.



   R
Dependency Pair Analysis



R contains the following Dependency Pairs:

TERMS(N) -> SQR(N)
SQR(s(X)) -> S(add(sqr(X), dbl(X)))
SQR(s(X)) -> ADD(sqr(X), dbl(X))
SQR(s(X)) -> SQR(X)
SQR(s(X)) -> DBL(X)
DBL(s(X)) -> S(s(dbl(X)))
DBL(s(X)) -> S(dbl(X))
DBL(s(X)) -> DBL(X)
ADD(s(X), Y) -> S(add(X, Y))
ADD(s(X), Y) -> ADD(X, Y)
FIRST(s(X), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nterms(X)) -> TERMS(activate(X))
ACTIVATE(nterms(X)) -> ACTIVATE(X)
ACTIVATE(ns(X)) -> S(activate(X))
ACTIVATE(ns(X)) -> ACTIVATE(X)
ACTIVATE(nfirst(X1, X2)) -> FIRST(activate(X1), activate(X2))
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X2)

Furthermore, R contains four SCCs.


   R
DPs
       →DP Problem 1
Polynomial Ordering
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Nar


Dependency Pair:

ADD(s(X), Y) -> ADD(X, Y)


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





The following dependency pair can be strictly oriented:

ADD(s(X), Y) -> ADD(X, Y)


There are no usable rules w.r.t. to the implicit AFS that need to be oriented.

Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(s(x1))=  1 + x1  
  POL(ADD(x1, x2))=  x1  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
           →DP Problem 5
Dependency Graph
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Nar


Dependency Pair:


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





Using the Dependency Graph resulted in no new DP problems.


   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polynomial Ordering
       →DP Problem 3
Polo
       →DP Problem 4
Nar


Dependency Pair:

DBL(s(X)) -> DBL(X)


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





The following dependency pair can be strictly oriented:

DBL(s(X)) -> DBL(X)


There are no usable rules w.r.t. to the implicit AFS that need to be oriented.

Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(s(x1))=  1 + x1  
  POL(DBL(x1))=  x1  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
           →DP Problem 6
Dependency Graph
       →DP Problem 3
Polo
       →DP Problem 4
Nar


Dependency Pair:


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





Using the Dependency Graph resulted in no new DP problems.


   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polynomial Ordering
       →DP Problem 4
Nar


Dependency Pair:

SQR(s(X)) -> SQR(X)


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





The following dependency pair can be strictly oriented:

SQR(s(X)) -> SQR(X)


There are no usable rules w.r.t. to the implicit AFS that need to be oriented.

Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(s(x1))=  1 + x1  
  POL(SQR(x1))=  x1  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
           →DP Problem 7
Dependency Graph
       →DP Problem 4
Nar


Dependency Pair:


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





Using the Dependency Graph resulted in no new DP problems.


   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Narrowing Transformation


Dependency Pairs:

ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(nfirst(X1, X2)) -> FIRST(activate(X1), activate(X2))
ACTIVATE(ns(X)) -> ACTIVATE(X)
ACTIVATE(nterms(X)) -> ACTIVATE(X)
FIRST(s(X), cons(Y, Z)) -> ACTIVATE(Z)


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





On this DP problem, a Narrowing SCC transformation can be performed.
As a result of transforming the rule

ACTIVATE(nfirst(X1, X2)) -> FIRST(activate(X1), activate(X2))
eight new Dependency Pairs are created:

ACTIVATE(nfirst(nterms(X'), X2)) -> FIRST(terms(activate(X')), activate(X2))
ACTIVATE(nfirst(ns(X'), X2)) -> FIRST(s(activate(X')), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', X2''), X2)) -> FIRST(first(activate(X1''), activate(X2'')), activate(X2))
ACTIVATE(nfirst(X1', X2)) -> FIRST(X1', activate(X2))
ACTIVATE(nfirst(X1, nterms(X'))) -> FIRST(activate(X1), terms(activate(X')))
ACTIVATE(nfirst(X1, ns(X'))) -> FIRST(activate(X1), s(activate(X')))
ACTIVATE(nfirst(X1, nfirst(X1'', X2''))) -> FIRST(activate(X1), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1, X2')) -> FIRST(activate(X1), X2')

The transformation is resulting in one new DP problem:



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Nar
           →DP Problem 8
Narrowing Transformation


Dependency Pairs:

ACTIVATE(nfirst(X1, X2')) -> FIRST(activate(X1), X2')
ACTIVATE(nfirst(X1, nfirst(X1'', X2''))) -> FIRST(activate(X1), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1, ns(X'))) -> FIRST(activate(X1), s(activate(X')))
ACTIVATE(nfirst(X1, nterms(X'))) -> FIRST(activate(X1), terms(activate(X')))
ACTIVATE(nfirst(X1', X2)) -> FIRST(X1', activate(X2))
ACTIVATE(nfirst(nfirst(X1'', X2''), X2)) -> FIRST(first(activate(X1''), activate(X2'')), activate(X2))
ACTIVATE(nfirst(ns(X'), X2)) -> FIRST(s(activate(X')), activate(X2))
FIRST(s(X), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfirst(nterms(X'), X2)) -> FIRST(terms(activate(X')), activate(X2))
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(ns(X)) -> ACTIVATE(X)
ACTIVATE(nterms(X)) -> ACTIVATE(X)
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X2)


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





On this DP problem, a Narrowing SCC transformation can be performed.
As a result of transforming the rule

ACTIVATE(nfirst(nterms(X'), X2)) -> FIRST(terms(activate(X')), activate(X2))
10 new Dependency Pairs are created:

ACTIVATE(nfirst(nterms(X''), X2)) -> FIRST(cons(recip(sqr(activate(X''))), nterms(ns(activate(X'')))), activate(X2))
ACTIVATE(nfirst(nterms(X''), X2)) -> FIRST(nterms(activate(X'')), activate(X2))
ACTIVATE(nfirst(nterms(nterms(X'')), X2)) -> FIRST(terms(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(ns(X'')), X2)) -> FIRST(terms(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(nfirst(X1', X2'')), X2)) -> FIRST(terms(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(nterms(X''), X2)) -> FIRST(terms(X''), activate(X2))
ACTIVATE(nfirst(nterms(X'), nterms(X''))) -> FIRST(terms(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(nterms(X'), ns(X''))) -> FIRST(terms(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(nterms(X'), nfirst(X1', X2''))) -> FIRST(terms(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(nterms(X'), X2')) -> FIRST(terms(activate(X')), X2')

The transformation is resulting in one new DP problem:



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Nar
           →DP Problem 8
Nar
             ...
               →DP Problem 9
Narrowing Transformation


Dependency Pairs:

ACTIVATE(nfirst(nterms(X'), X2')) -> FIRST(terms(activate(X')), X2')
ACTIVATE(nfirst(nterms(X'), nfirst(X1', X2''))) -> FIRST(terms(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(nterms(X'), ns(X''))) -> FIRST(terms(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(nterms(X'), nterms(X''))) -> FIRST(terms(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(nterms(X''), X2)) -> FIRST(terms(X''), activate(X2))
ACTIVATE(nfirst(nterms(nfirst(X1', X2'')), X2)) -> FIRST(terms(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(nterms(ns(X'')), X2)) -> FIRST(terms(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(nterms(X'')), X2)) -> FIRST(terms(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(X1, nfirst(X1'', X2''))) -> FIRST(activate(X1), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1, ns(X'))) -> FIRST(activate(X1), s(activate(X')))
ACTIVATE(nfirst(X1, nterms(X'))) -> FIRST(activate(X1), terms(activate(X')))
ACTIVATE(nfirst(X1', X2)) -> FIRST(X1', activate(X2))
ACTIVATE(nfirst(nfirst(X1'', X2''), X2)) -> FIRST(first(activate(X1''), activate(X2'')), activate(X2))
ACTIVATE(nfirst(ns(X'), X2)) -> FIRST(s(activate(X')), activate(X2))
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(ns(X)) -> ACTIVATE(X)
ACTIVATE(nterms(X)) -> ACTIVATE(X)
FIRST(s(X), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfirst(X1, X2')) -> FIRST(activate(X1), X2')


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





On this DP problem, a Narrowing SCC transformation can be performed.
As a result of transforming the rule

ACTIVATE(nfirst(ns(X'), X2)) -> FIRST(s(activate(X')), activate(X2))
nine new Dependency Pairs are created:

ACTIVATE(nfirst(ns(X''), X2)) -> FIRST(ns(activate(X'')), activate(X2))
ACTIVATE(nfirst(ns(nterms(X'')), X2)) -> FIRST(s(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(ns(ns(X'')), X2)) -> FIRST(s(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(ns(nfirst(X1', X2'')), X2)) -> FIRST(s(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(ns(X''), X2)) -> FIRST(s(X''), activate(X2))
ACTIVATE(nfirst(ns(X'), nterms(X''))) -> FIRST(s(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(ns(X'), ns(X''))) -> FIRST(s(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(ns(X'), nfirst(X1', X2''))) -> FIRST(s(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(ns(X'), X2')) -> FIRST(s(activate(X')), X2')

The transformation is resulting in one new DP problem:



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Nar
           →DP Problem 8
Nar
             ...
               →DP Problem 10
Narrowing Transformation


Dependency Pairs:

ACTIVATE(nfirst(ns(X'), X2')) -> FIRST(s(activate(X')), X2')
ACTIVATE(nfirst(ns(X'), nfirst(X1', X2''))) -> FIRST(s(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(ns(X'), ns(X''))) -> FIRST(s(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(ns(X'), nterms(X''))) -> FIRST(s(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(ns(X''), X2)) -> FIRST(s(X''), activate(X2))
ACTIVATE(nfirst(ns(nfirst(X1', X2'')), X2)) -> FIRST(s(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(ns(ns(X'')), X2)) -> FIRST(s(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(ns(nterms(X'')), X2)) -> FIRST(s(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(X'), nfirst(X1', X2''))) -> FIRST(terms(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(nterms(X'), ns(X''))) -> FIRST(terms(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(nterms(X'), nterms(X''))) -> FIRST(terms(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(nterms(X''), X2)) -> FIRST(terms(X''), activate(X2))
ACTIVATE(nfirst(nterms(nfirst(X1', X2'')), X2)) -> FIRST(terms(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(nterms(ns(X'')), X2)) -> FIRST(terms(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(nterms(X'')), X2)) -> FIRST(terms(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(X1, X2')) -> FIRST(activate(X1), X2')
ACTIVATE(nfirst(X1, nfirst(X1'', X2''))) -> FIRST(activate(X1), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1, ns(X'))) -> FIRST(activate(X1), s(activate(X')))
ACTIVATE(nfirst(X1, nterms(X'))) -> FIRST(activate(X1), terms(activate(X')))
ACTIVATE(nfirst(X1', X2)) -> FIRST(X1', activate(X2))
ACTIVATE(nfirst(nfirst(X1'', X2''), X2)) -> FIRST(first(activate(X1''), activate(X2'')), activate(X2))
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(ns(X)) -> ACTIVATE(X)
ACTIVATE(nterms(X)) -> ACTIVATE(X)
FIRST(s(X), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfirst(nterms(X'), X2')) -> FIRST(terms(activate(X')), X2')


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





On this DP problem, a Narrowing SCC transformation can be performed.
As a result of transforming the rule

ACTIVATE(nfirst(nfirst(X1'', X2''), X2)) -> FIRST(first(activate(X1''), activate(X2'')), activate(X2))
13 new Dependency Pairs are created:

ACTIVATE(nfirst(nfirst(X1''', X2'''), X2)) -> FIRST(nfirst(activate(X1'''), activate(X2''')), activate(X2))
ACTIVATE(nfirst(nfirst(nterms(X'), X2''), X2)) -> FIRST(first(terms(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(ns(X'), X2''), X2)) -> FIRST(first(s(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nfirst(X1', X2'''), X2''), X2)) -> FIRST(first(first(activate(X1'), activate(X2''')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(X1''', X2''), X2)) -> FIRST(first(X1''', activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nterms(X')), X2)) -> FIRST(first(activate(X1''), terms(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', ns(X')), X2)) -> FIRST(first(activate(X1''), s(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nfirst(X1', X2''')), X2)) -> FIRST(first(activate(X1''), first(activate(X1'), activate(X2'''))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', X2'''), X2)) -> FIRST(first(activate(X1''), X2'''), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', X2''), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2'')), terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), ns(X'))) -> FIRST(first(activate(X1''), activate(X2'')), s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), nfirst(X1', X2'''))) -> FIRST(first(activate(X1''), activate(X2'')), first(activate(X1'), activate(X2''')))
ACTIVATE(nfirst(nfirst(X1'', X2''), X2')) -> FIRST(first(activate(X1''), activate(X2'')), X2')

The transformation is resulting in one new DP problem:



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Nar
           →DP Problem 8
Nar
             ...
               →DP Problem 11
Narrowing Transformation


Dependency Pairs:

ACTIVATE(nfirst(nfirst(X1'', X2''), X2')) -> FIRST(first(activate(X1''), activate(X2'')), X2')
ACTIVATE(nfirst(nfirst(X1'', X2''), nfirst(X1', X2'''))) -> FIRST(first(activate(X1''), activate(X2'')), first(activate(X1'), activate(X2''')))
ACTIVATE(nfirst(nfirst(X1'', X2''), ns(X'))) -> FIRST(first(activate(X1''), activate(X2'')), s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2'')), terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'''), X2)) -> FIRST(first(activate(X1''), X2'''), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nfirst(X1', X2''')), X2)) -> FIRST(first(activate(X1''), first(activate(X1'), activate(X2'''))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', ns(X')), X2)) -> FIRST(first(activate(X1''), s(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nterms(X')), X2)) -> FIRST(first(activate(X1''), terms(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1''', X2''), X2)) -> FIRST(first(X1''', activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nfirst(X1', X2'''), X2''), X2)) -> FIRST(first(first(activate(X1'), activate(X2''')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(ns(X'), X2''), X2)) -> FIRST(first(s(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nterms(X'), X2''), X2)) -> FIRST(first(terms(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(ns(X'), nfirst(X1', X2''))) -> FIRST(s(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(ns(X'), ns(X''))) -> FIRST(s(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(ns(X'), nterms(X''))) -> FIRST(s(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(ns(X''), X2)) -> FIRST(s(X''), activate(X2))
ACTIVATE(nfirst(ns(nfirst(X1', X2'')), X2)) -> FIRST(s(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(ns(ns(X'')), X2)) -> FIRST(s(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(ns(nterms(X'')), X2)) -> FIRST(s(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(X'), X2')) -> FIRST(terms(activate(X')), X2')
ACTIVATE(nfirst(nterms(X'), nfirst(X1', X2''))) -> FIRST(terms(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(nterms(X'), ns(X''))) -> FIRST(terms(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(nterms(X'), nterms(X''))) -> FIRST(terms(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(nterms(X''), X2)) -> FIRST(terms(X''), activate(X2))
ACTIVATE(nfirst(nterms(nfirst(X1', X2'')), X2)) -> FIRST(terms(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(nterms(ns(X'')), X2)) -> FIRST(terms(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(nterms(X'')), X2)) -> FIRST(terms(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(X1, X2')) -> FIRST(activate(X1), X2')
ACTIVATE(nfirst(X1, nfirst(X1'', X2''))) -> FIRST(activate(X1), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1, ns(X'))) -> FIRST(activate(X1), s(activate(X')))
ACTIVATE(nfirst(X1, nterms(X'))) -> FIRST(activate(X1), terms(activate(X')))
ACTIVATE(nfirst(X1', X2)) -> FIRST(X1', activate(X2))
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(ns(X)) -> ACTIVATE(X)
ACTIVATE(nterms(X)) -> ACTIVATE(X)
FIRST(s(X), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfirst(ns(X'), X2')) -> FIRST(s(activate(X')), X2')


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





On this DP problem, a Narrowing SCC transformation can be performed.
As a result of transforming the rule

ACTIVATE(nfirst(X1', X2)) -> FIRST(X1', activate(X2))
four new Dependency Pairs are created:

ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(X1', nfirst(X1'', X2''))) -> FIRST(X1', first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1', X2')) -> FIRST(X1', X2')

The transformation is resulting in one new DP problem:



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Nar
           →DP Problem 8
Nar
             ...
               →DP Problem 12
Narrowing Transformation


Dependency Pairs:

ACTIVATE(nfirst(X1', X2')) -> FIRST(X1', X2')
ACTIVATE(nfirst(X1', nfirst(X1'', X2''))) -> FIRST(X1', first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), nfirst(X1', X2'''))) -> FIRST(first(activate(X1''), activate(X2'')), first(activate(X1'), activate(X2''')))
ACTIVATE(nfirst(nfirst(X1'', X2''), ns(X'))) -> FIRST(first(activate(X1''), activate(X2'')), s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2'')), terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'''), X2)) -> FIRST(first(activate(X1''), X2'''), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nfirst(X1', X2''')), X2)) -> FIRST(first(activate(X1''), first(activate(X1'), activate(X2'''))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', ns(X')), X2)) -> FIRST(first(activate(X1''), s(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nterms(X')), X2)) -> FIRST(first(activate(X1''), terms(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1''', X2''), X2)) -> FIRST(first(X1''', activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nfirst(X1', X2'''), X2''), X2)) -> FIRST(first(first(activate(X1'), activate(X2''')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(ns(X'), X2''), X2)) -> FIRST(first(s(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nterms(X'), X2''), X2)) -> FIRST(first(terms(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(ns(X'), X2')) -> FIRST(s(activate(X')), X2')
ACTIVATE(nfirst(ns(X'), nfirst(X1', X2''))) -> FIRST(s(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(ns(X'), ns(X''))) -> FIRST(s(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(ns(X'), nterms(X''))) -> FIRST(s(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(ns(X''), X2)) -> FIRST(s(X''), activate(X2))
ACTIVATE(nfirst(ns(nfirst(X1', X2'')), X2)) -> FIRST(s(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(ns(ns(X'')), X2)) -> FIRST(s(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(ns(nterms(X'')), X2)) -> FIRST(s(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(X'), X2')) -> FIRST(terms(activate(X')), X2')
ACTIVATE(nfirst(nterms(X'), nfirst(X1', X2''))) -> FIRST(terms(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(nterms(X'), ns(X''))) -> FIRST(terms(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(nterms(X'), nterms(X''))) -> FIRST(terms(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(nterms(X''), X2)) -> FIRST(terms(X''), activate(X2))
ACTIVATE(nfirst(nterms(nfirst(X1', X2'')), X2)) -> FIRST(terms(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(nterms(ns(X'')), X2)) -> FIRST(terms(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(nterms(X'')), X2)) -> FIRST(terms(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(X1, X2')) -> FIRST(activate(X1), X2')
ACTIVATE(nfirst(X1, nfirst(X1'', X2''))) -> FIRST(activate(X1), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1, ns(X'))) -> FIRST(activate(X1), s(activate(X')))
ACTIVATE(nfirst(X1, nterms(X'))) -> FIRST(activate(X1), terms(activate(X')))
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(ns(X)) -> ACTIVATE(X)
ACTIVATE(nterms(X)) -> ACTIVATE(X)
FIRST(s(X), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfirst(nfirst(X1'', X2''), X2')) -> FIRST(first(activate(X1''), activate(X2'')), X2')


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





On this DP problem, a Narrowing SCC transformation can be performed.
As a result of transforming the rule

ACTIVATE(nfirst(X1, nterms(X'))) -> FIRST(activate(X1), terms(activate(X')))
10 new Dependency Pairs are created:

ACTIVATE(nfirst(nterms(X''), nterms(X'))) -> FIRST(terms(activate(X'')), terms(activate(X')))
ACTIVATE(nfirst(ns(X''), nterms(X'))) -> FIRST(s(activate(X'')), terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2')), terms(activate(X')))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), cons(recip(sqr(activate(X''))), nterms(ns(activate(X'')))))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), nterms(activate(X'')))
ACTIVATE(nfirst(X1, nterms(nterms(X'')))) -> FIRST(activate(X1), terms(terms(activate(X''))))
ACTIVATE(nfirst(X1, nterms(ns(X'')))) -> FIRST(activate(X1), terms(s(activate(X''))))
ACTIVATE(nfirst(X1, nterms(nfirst(X1'', X2')))) -> FIRST(activate(X1), terms(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), terms(X''))

The transformation is resulting in one new DP problem:



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Nar
           →DP Problem 8
Nar
             ...
               →DP Problem 13
Narrowing Transformation


Dependency Pairs:

ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), terms(X''))
ACTIVATE(nfirst(X1, nterms(nfirst(X1'', X2')))) -> FIRST(activate(X1), terms(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, nterms(ns(X'')))) -> FIRST(activate(X1), terms(s(activate(X''))))
ACTIVATE(nfirst(X1, nterms(nterms(X'')))) -> FIRST(activate(X1), terms(terms(activate(X''))))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), cons(recip(sqr(activate(X''))), nterms(ns(activate(X'')))))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2')), terms(activate(X')))
ACTIVATE(nfirst(ns(X''), nterms(X'))) -> FIRST(s(activate(X'')), terms(activate(X')))
ACTIVATE(nfirst(nterms(X''), nterms(X'))) -> FIRST(terms(activate(X'')), terms(activate(X')))
ACTIVATE(nfirst(X1', nfirst(X1'', X2''))) -> FIRST(X1', first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), X2')) -> FIRST(first(activate(X1''), activate(X2'')), X2')
ACTIVATE(nfirst(nfirst(X1'', X2''), nfirst(X1', X2'''))) -> FIRST(first(activate(X1''), activate(X2'')), first(activate(X1'), activate(X2''')))
ACTIVATE(nfirst(nfirst(X1'', X2''), ns(X'))) -> FIRST(first(activate(X1''), activate(X2'')), s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2'')), terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'''), X2)) -> FIRST(first(activate(X1''), X2'''), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nfirst(X1', X2''')), X2)) -> FIRST(first(activate(X1''), first(activate(X1'), activate(X2'''))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', ns(X')), X2)) -> FIRST(first(activate(X1''), s(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nterms(X')), X2)) -> FIRST(first(activate(X1''), terms(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1''', X2''), X2)) -> FIRST(first(X1''', activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nfirst(X1', X2'''), X2''), X2)) -> FIRST(first(first(activate(X1'), activate(X2''')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(ns(X'), X2''), X2)) -> FIRST(first(s(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nterms(X'), X2''), X2)) -> FIRST(first(terms(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(ns(X'), X2')) -> FIRST(s(activate(X')), X2')
ACTIVATE(nfirst(ns(X'), nfirst(X1', X2''))) -> FIRST(s(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(ns(X'), ns(X''))) -> FIRST(s(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(ns(X'), nterms(X''))) -> FIRST(s(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(ns(X''), X2)) -> FIRST(s(X''), activate(X2))
ACTIVATE(nfirst(ns(nfirst(X1', X2'')), X2)) -> FIRST(s(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(ns(ns(X'')), X2)) -> FIRST(s(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(ns(nterms(X'')), X2)) -> FIRST(s(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(X'), X2')) -> FIRST(terms(activate(X')), X2')
ACTIVATE(nfirst(nterms(X'), nfirst(X1', X2''))) -> FIRST(terms(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(nterms(X'), ns(X''))) -> FIRST(terms(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(nterms(X'), nterms(X''))) -> FIRST(terms(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(nterms(X''), X2)) -> FIRST(terms(X''), activate(X2))
ACTIVATE(nfirst(nterms(nfirst(X1', X2'')), X2)) -> FIRST(terms(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(nterms(ns(X'')), X2)) -> FIRST(terms(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(nterms(X'')), X2)) -> FIRST(terms(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(X1, X2')) -> FIRST(activate(X1), X2')
ACTIVATE(nfirst(X1, nfirst(X1'', X2''))) -> FIRST(activate(X1), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1, ns(X'))) -> FIRST(activate(X1), s(activate(X')))
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(ns(X)) -> ACTIVATE(X)
ACTIVATE(nterms(X)) -> ACTIVATE(X)
FIRST(s(X), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfirst(X1', X2')) -> FIRST(X1', X2')


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





On this DP problem, a Narrowing SCC transformation can be performed.
As a result of transforming the rule

ACTIVATE(nfirst(X1, ns(X'))) -> FIRST(activate(X1), s(activate(X')))
nine new Dependency Pairs are created:

ACTIVATE(nfirst(nterms(X''), ns(X'))) -> FIRST(terms(activate(X'')), s(activate(X')))
ACTIVATE(nfirst(ns(X''), ns(X'))) -> FIRST(s(activate(X'')), s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), ns(X'))) -> FIRST(first(activate(X1''), activate(X2')), s(activate(X')))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(X1, ns(X''))) -> FIRST(activate(X1), ns(activate(X'')))
ACTIVATE(nfirst(X1, ns(nterms(X'')))) -> FIRST(activate(X1), s(terms(activate(X''))))
ACTIVATE(nfirst(X1, ns(ns(X'')))) -> FIRST(activate(X1), s(s(activate(X''))))
ACTIVATE(nfirst(X1, ns(nfirst(X1'', X2')))) -> FIRST(activate(X1), s(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, ns(X''))) -> FIRST(activate(X1), s(X''))

The transformation is resulting in one new DP problem:



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Nar
           →DP Problem 8
Nar
             ...
               →DP Problem 14
Narrowing Transformation


Dependency Pairs:

ACTIVATE(nfirst(X1, ns(X''))) -> FIRST(activate(X1), s(X''))
ACTIVATE(nfirst(X1, ns(nfirst(X1'', X2')))) -> FIRST(activate(X1), s(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, ns(ns(X'')))) -> FIRST(activate(X1), s(s(activate(X''))))
ACTIVATE(nfirst(X1, ns(nterms(X'')))) -> FIRST(activate(X1), s(terms(activate(X''))))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), ns(X'))) -> FIRST(first(activate(X1''), activate(X2')), s(activate(X')))
ACTIVATE(nfirst(ns(X''), ns(X'))) -> FIRST(s(activate(X'')), s(activate(X')))
ACTIVATE(nfirst(nterms(X''), ns(X'))) -> FIRST(terms(activate(X'')), s(activate(X')))
ACTIVATE(nfirst(X1, nterms(nfirst(X1'', X2')))) -> FIRST(activate(X1), terms(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, nterms(ns(X'')))) -> FIRST(activate(X1), terms(s(activate(X''))))
ACTIVATE(nfirst(X1, nterms(nterms(X'')))) -> FIRST(activate(X1), terms(terms(activate(X''))))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), cons(recip(sqr(activate(X''))), nterms(ns(activate(X'')))))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2')), terms(activate(X')))
ACTIVATE(nfirst(ns(X''), nterms(X'))) -> FIRST(s(activate(X'')), terms(activate(X')))
ACTIVATE(nfirst(nterms(X''), nterms(X'))) -> FIRST(terms(activate(X'')), terms(activate(X')))
ACTIVATE(nfirst(X1', X2')) -> FIRST(X1', X2')
ACTIVATE(nfirst(X1', nfirst(X1'', X2''))) -> FIRST(X1', first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), X2')) -> FIRST(first(activate(X1''), activate(X2'')), X2')
ACTIVATE(nfirst(nfirst(X1'', X2''), nfirst(X1', X2'''))) -> FIRST(first(activate(X1''), activate(X2'')), first(activate(X1'), activate(X2''')))
ACTIVATE(nfirst(nfirst(X1'', X2''), ns(X'))) -> FIRST(first(activate(X1''), activate(X2'')), s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2'')), terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'''), X2)) -> FIRST(first(activate(X1''), X2'''), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nfirst(X1', X2''')), X2)) -> FIRST(first(activate(X1''), first(activate(X1'), activate(X2'''))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', ns(X')), X2)) -> FIRST(first(activate(X1''), s(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nterms(X')), X2)) -> FIRST(first(activate(X1''), terms(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1''', X2''), X2)) -> FIRST(first(X1''', activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nfirst(X1', X2'''), X2''), X2)) -> FIRST(first(first(activate(X1'), activate(X2''')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(ns(X'), X2''), X2)) -> FIRST(first(s(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nterms(X'), X2''), X2)) -> FIRST(first(terms(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(ns(X'), X2')) -> FIRST(s(activate(X')), X2')
ACTIVATE(nfirst(ns(X'), nfirst(X1', X2''))) -> FIRST(s(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(ns(X'), ns(X''))) -> FIRST(s(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(ns(X'), nterms(X''))) -> FIRST(s(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(ns(X''), X2)) -> FIRST(s(X''), activate(X2))
ACTIVATE(nfirst(ns(nfirst(X1', X2'')), X2)) -> FIRST(s(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(ns(ns(X'')), X2)) -> FIRST(s(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(ns(nterms(X'')), X2)) -> FIRST(s(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(X'), X2')) -> FIRST(terms(activate(X')), X2')
ACTIVATE(nfirst(nterms(X'), nfirst(X1', X2''))) -> FIRST(terms(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(nterms(X'), ns(X''))) -> FIRST(terms(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(nterms(X'), nterms(X''))) -> FIRST(terms(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(nterms(X''), X2)) -> FIRST(terms(X''), activate(X2))
ACTIVATE(nfirst(nterms(nfirst(X1', X2'')), X2)) -> FIRST(terms(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(nterms(ns(X'')), X2)) -> FIRST(terms(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(nterms(X'')), X2)) -> FIRST(terms(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(X1, X2')) -> FIRST(activate(X1), X2')
ACTIVATE(nfirst(X1, nfirst(X1'', X2''))) -> FIRST(activate(X1), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(ns(X)) -> ACTIVATE(X)
ACTIVATE(nterms(X)) -> ACTIVATE(X)
FIRST(s(X), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), terms(X''))


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





On this DP problem, a Narrowing SCC transformation can be performed.
As a result of transforming the rule

ACTIVATE(nfirst(X1, nfirst(X1'', X2''))) -> FIRST(activate(X1), first(activate(X1''), activate(X2'')))
13 new Dependency Pairs are created:

ACTIVATE(nfirst(nterms(X'), nfirst(X1'', X2''))) -> FIRST(terms(activate(X')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(ns(X'), nfirst(X1'', X2''))) -> FIRST(s(activate(X')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(nfirst(X1''', X2'), nfirst(X1'', X2''))) -> FIRST(first(activate(X1'''), activate(X2')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1', nfirst(X1'', X2''))) -> FIRST(X1', first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(X1''', X2'''))) -> FIRST(activate(X1), nfirst(activate(X1'''), activate(X2''')))
ACTIVATE(nfirst(X1, nfirst(nterms(X'), X2''))) -> FIRST(activate(X1), first(terms(activate(X')), activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(ns(X'), X2''))) -> FIRST(activate(X1), first(s(activate(X')), activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(nfirst(X1''', X2'), X2''))) -> FIRST(activate(X1), first(first(activate(X1'''), activate(X2')), activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(X1''', X2''))) -> FIRST(activate(X1), first(X1''', activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(X1'', nterms(X')))) -> FIRST(activate(X1), first(activate(X1''), terms(activate(X'))))
ACTIVATE(nfirst(X1, nfirst(X1'', ns(X')))) -> FIRST(activate(X1), first(activate(X1''), s(activate(X'))))
ACTIVATE(nfirst(X1, nfirst(X1'', nfirst(X1''', X2')))) -> FIRST(activate(X1), first(activate(X1''), first(activate(X1'''), activate(X2'))))
ACTIVATE(nfirst(X1, nfirst(X1'', X2'''))) -> FIRST(activate(X1), first(activate(X1''), X2'''))

The transformation is resulting in one new DP problem:



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Nar
           →DP Problem 8
Nar
             ...
               →DP Problem 15
Narrowing Transformation


Dependency Pairs:

ACTIVATE(nfirst(X1, nfirst(X1'', X2'''))) -> FIRST(activate(X1), first(activate(X1''), X2'''))
ACTIVATE(nfirst(X1, nfirst(X1'', nfirst(X1''', X2')))) -> FIRST(activate(X1), first(activate(X1''), first(activate(X1'''), activate(X2'))))
ACTIVATE(nfirst(X1, nfirst(X1'', ns(X')))) -> FIRST(activate(X1), first(activate(X1''), s(activate(X'))))
ACTIVATE(nfirst(X1, nfirst(X1'', nterms(X')))) -> FIRST(activate(X1), first(activate(X1''), terms(activate(X'))))
ACTIVATE(nfirst(X1, nfirst(X1''', X2''))) -> FIRST(activate(X1), first(X1''', activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(nfirst(X1''', X2'), X2''))) -> FIRST(activate(X1), first(first(activate(X1'''), activate(X2')), activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(ns(X'), X2''))) -> FIRST(activate(X1), first(s(activate(X')), activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(nterms(X'), X2''))) -> FIRST(activate(X1), first(terms(activate(X')), activate(X2'')))
ACTIVATE(nfirst(X1', nfirst(X1'', X2''))) -> FIRST(X1', first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(nfirst(X1''', X2'), nfirst(X1'', X2''))) -> FIRST(first(activate(X1'''), activate(X2')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(ns(X'), nfirst(X1'', X2''))) -> FIRST(s(activate(X')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(nterms(X'), nfirst(X1'', X2''))) -> FIRST(terms(activate(X')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1, ns(nfirst(X1'', X2')))) -> FIRST(activate(X1), s(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, ns(ns(X'')))) -> FIRST(activate(X1), s(s(activate(X''))))
ACTIVATE(nfirst(X1, ns(nterms(X'')))) -> FIRST(activate(X1), s(terms(activate(X''))))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), ns(X'))) -> FIRST(first(activate(X1''), activate(X2')), s(activate(X')))
ACTIVATE(nfirst(ns(X''), ns(X'))) -> FIRST(s(activate(X'')), s(activate(X')))
ACTIVATE(nfirst(nterms(X''), ns(X'))) -> FIRST(terms(activate(X'')), s(activate(X')))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), terms(X''))
ACTIVATE(nfirst(X1, nterms(nfirst(X1'', X2')))) -> FIRST(activate(X1), terms(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, nterms(ns(X'')))) -> FIRST(activate(X1), terms(s(activate(X''))))
ACTIVATE(nfirst(X1, nterms(nterms(X'')))) -> FIRST(activate(X1), terms(terms(activate(X''))))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), cons(recip(sqr(activate(X''))), nterms(ns(activate(X'')))))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2')), terms(activate(X')))
ACTIVATE(nfirst(ns(X''), nterms(X'))) -> FIRST(s(activate(X'')), terms(activate(X')))
ACTIVATE(nfirst(nterms(X''), nterms(X'))) -> FIRST(terms(activate(X'')), terms(activate(X')))
ACTIVATE(nfirst(X1', X2')) -> FIRST(X1', X2')
ACTIVATE(nfirst(X1', nfirst(X1'', X2''))) -> FIRST(X1', first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), X2')) -> FIRST(first(activate(X1''), activate(X2'')), X2')
ACTIVATE(nfirst(nfirst(X1'', X2''), nfirst(X1', X2'''))) -> FIRST(first(activate(X1''), activate(X2'')), first(activate(X1'), activate(X2''')))
ACTIVATE(nfirst(nfirst(X1'', X2''), ns(X'))) -> FIRST(first(activate(X1''), activate(X2'')), s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2'')), terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'''), X2)) -> FIRST(first(activate(X1''), X2'''), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nfirst(X1', X2''')), X2)) -> FIRST(first(activate(X1''), first(activate(X1'), activate(X2'''))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', ns(X')), X2)) -> FIRST(first(activate(X1''), s(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nterms(X')), X2)) -> FIRST(first(activate(X1''), terms(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1''', X2''), X2)) -> FIRST(first(X1''', activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nfirst(X1', X2'''), X2''), X2)) -> FIRST(first(first(activate(X1'), activate(X2''')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(ns(X'), X2''), X2)) -> FIRST(first(s(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nterms(X'), X2''), X2)) -> FIRST(first(terms(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(ns(X'), X2')) -> FIRST(s(activate(X')), X2')
ACTIVATE(nfirst(ns(X'), nfirst(X1', X2''))) -> FIRST(s(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(ns(X'), ns(X''))) -> FIRST(s(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(ns(X'), nterms(X''))) -> FIRST(s(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(ns(X''), X2)) -> FIRST(s(X''), activate(X2))
ACTIVATE(nfirst(ns(nfirst(X1', X2'')), X2)) -> FIRST(s(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(ns(ns(X'')), X2)) -> FIRST(s(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(ns(nterms(X'')), X2)) -> FIRST(s(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(X'), X2')) -> FIRST(terms(activate(X')), X2')
ACTIVATE(nfirst(nterms(X'), nfirst(X1', X2''))) -> FIRST(terms(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(nterms(X'), ns(X''))) -> FIRST(terms(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(nterms(X'), nterms(X''))) -> FIRST(terms(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(nterms(X''), X2)) -> FIRST(terms(X''), activate(X2))
ACTIVATE(nfirst(nterms(nfirst(X1', X2'')), X2)) -> FIRST(terms(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(nterms(ns(X'')), X2)) -> FIRST(terms(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(nterms(X'')), X2)) -> FIRST(terms(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(X1, X2')) -> FIRST(activate(X1), X2')
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(ns(X)) -> ACTIVATE(X)
ACTIVATE(nterms(X)) -> ACTIVATE(X)
FIRST(s(X), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfirst(X1, ns(X''))) -> FIRST(activate(X1), s(X''))


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





On this DP problem, a Narrowing SCC transformation can be performed.
As a result of transforming the rule

ACTIVATE(nfirst(X1, X2')) -> FIRST(activate(X1), X2')
four new Dependency Pairs are created:

ACTIVATE(nfirst(nterms(X'), X2')) -> FIRST(terms(activate(X')), X2')
ACTIVATE(nfirst(ns(X'), X2')) -> FIRST(s(activate(X')), X2')
ACTIVATE(nfirst(nfirst(X1'', X2''), X2')) -> FIRST(first(activate(X1''), activate(X2'')), X2')
ACTIVATE(nfirst(X1', X2')) -> FIRST(X1', X2')

The transformation is resulting in one new DP problem:



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Nar
           →DP Problem 8
Nar
             ...
               →DP Problem 16
Polynomial Ordering


Dependency Pairs:

ACTIVATE(nfirst(X1', X2')) -> FIRST(X1', X2')
ACTIVATE(nfirst(nfirst(X1'', X2''), X2')) -> FIRST(first(activate(X1''), activate(X2'')), X2')
ACTIVATE(nfirst(ns(X'), X2')) -> FIRST(s(activate(X')), X2')
ACTIVATE(nfirst(nterms(X'), X2')) -> FIRST(terms(activate(X')), X2')
ACTIVATE(nfirst(X1, nfirst(X1'', nfirst(X1''', X2')))) -> FIRST(activate(X1), first(activate(X1''), first(activate(X1'''), activate(X2'))))
ACTIVATE(nfirst(X1, nfirst(X1'', ns(X')))) -> FIRST(activate(X1), first(activate(X1''), s(activate(X'))))
ACTIVATE(nfirst(X1, nfirst(X1'', nterms(X')))) -> FIRST(activate(X1), first(activate(X1''), terms(activate(X'))))
ACTIVATE(nfirst(X1, nfirst(X1''', X2''))) -> FIRST(activate(X1), first(X1''', activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(nfirst(X1''', X2'), X2''))) -> FIRST(activate(X1), first(first(activate(X1'''), activate(X2')), activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(ns(X'), X2''))) -> FIRST(activate(X1), first(s(activate(X')), activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(nterms(X'), X2''))) -> FIRST(activate(X1), first(terms(activate(X')), activate(X2'')))
ACTIVATE(nfirst(X1', nfirst(X1'', X2''))) -> FIRST(X1', first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(nfirst(X1''', X2'), nfirst(X1'', X2''))) -> FIRST(first(activate(X1'''), activate(X2')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(ns(X'), nfirst(X1'', X2''))) -> FIRST(s(activate(X')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(nterms(X'), nfirst(X1'', X2''))) -> FIRST(terms(activate(X')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1, ns(X''))) -> FIRST(activate(X1), s(X''))
ACTIVATE(nfirst(X1, ns(nfirst(X1'', X2')))) -> FIRST(activate(X1), s(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, ns(ns(X'')))) -> FIRST(activate(X1), s(s(activate(X''))))
ACTIVATE(nfirst(X1, ns(nterms(X'')))) -> FIRST(activate(X1), s(terms(activate(X''))))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), ns(X'))) -> FIRST(first(activate(X1''), activate(X2')), s(activate(X')))
ACTIVATE(nfirst(ns(X''), ns(X'))) -> FIRST(s(activate(X'')), s(activate(X')))
ACTIVATE(nfirst(nterms(X''), ns(X'))) -> FIRST(terms(activate(X'')), s(activate(X')))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), terms(X''))
ACTIVATE(nfirst(X1, nterms(nfirst(X1'', X2')))) -> FIRST(activate(X1), terms(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, nterms(ns(X'')))) -> FIRST(activate(X1), terms(s(activate(X''))))
ACTIVATE(nfirst(X1, nterms(nterms(X'')))) -> FIRST(activate(X1), terms(terms(activate(X''))))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), cons(recip(sqr(activate(X''))), nterms(ns(activate(X'')))))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2')), terms(activate(X')))
ACTIVATE(nfirst(ns(X''), nterms(X'))) -> FIRST(s(activate(X'')), terms(activate(X')))
ACTIVATE(nfirst(nterms(X''), nterms(X'))) -> FIRST(terms(activate(X'')), terms(activate(X')))
ACTIVATE(nfirst(X1', X2')) -> FIRST(X1', X2')
ACTIVATE(nfirst(X1', nfirst(X1'', X2''))) -> FIRST(X1', first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), X2')) -> FIRST(first(activate(X1''), activate(X2'')), X2')
ACTIVATE(nfirst(nfirst(X1'', X2''), nfirst(X1', X2'''))) -> FIRST(first(activate(X1''), activate(X2'')), first(activate(X1'), activate(X2''')))
ACTIVATE(nfirst(nfirst(X1'', X2''), ns(X'))) -> FIRST(first(activate(X1''), activate(X2'')), s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2'')), terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'''), X2)) -> FIRST(first(activate(X1''), X2'''), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nfirst(X1', X2''')), X2)) -> FIRST(first(activate(X1''), first(activate(X1'), activate(X2'''))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', ns(X')), X2)) -> FIRST(first(activate(X1''), s(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nterms(X')), X2)) -> FIRST(first(activate(X1''), terms(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1''', X2''), X2)) -> FIRST(first(X1''', activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nfirst(X1', X2'''), X2''), X2)) -> FIRST(first(first(activate(X1'), activate(X2''')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(ns(X'), X2''), X2)) -> FIRST(first(s(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nterms(X'), X2''), X2)) -> FIRST(first(terms(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(ns(X'), X2')) -> FIRST(s(activate(X')), X2')
ACTIVATE(nfirst(ns(X'), nfirst(X1', X2''))) -> FIRST(s(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(ns(X'), ns(X''))) -> FIRST(s(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(ns(X'), nterms(X''))) -> FIRST(s(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(ns(X''), X2)) -> FIRST(s(X''), activate(X2))
ACTIVATE(nfirst(ns(nfirst(X1', X2'')), X2)) -> FIRST(s(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(ns(ns(X'')), X2)) -> FIRST(s(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(ns(nterms(X'')), X2)) -> FIRST(s(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(X'), X2')) -> FIRST(terms(activate(X')), X2')
ACTIVATE(nfirst(nterms(X'), nfirst(X1', X2''))) -> FIRST(terms(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(nterms(X'), ns(X''))) -> FIRST(terms(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(nterms(X'), nterms(X''))) -> FIRST(terms(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(nterms(X''), X2)) -> FIRST(terms(X''), activate(X2))
ACTIVATE(nfirst(nterms(nfirst(X1', X2'')), X2)) -> FIRST(terms(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(nterms(ns(X'')), X2)) -> FIRST(terms(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(nterms(X'')), X2)) -> FIRST(terms(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(ns(X)) -> ACTIVATE(X)
ACTIVATE(nterms(X)) -> ACTIVATE(X)
FIRST(s(X), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfirst(X1, nfirst(X1'', X2'''))) -> FIRST(activate(X1), first(activate(X1''), X2'''))


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





The following dependency pairs can be strictly oriented:

ACTIVATE(nfirst(nterms(X'), X2')) -> FIRST(terms(activate(X')), X2')
ACTIVATE(nfirst(nterms(X'), nfirst(X1'', X2''))) -> FIRST(terms(activate(X')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(nterms(X''), ns(X'))) -> FIRST(terms(activate(X'')), s(activate(X')))
ACTIVATE(nfirst(nterms(X''), nterms(X'))) -> FIRST(terms(activate(X'')), terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', nterms(X')), X2)) -> FIRST(first(activate(X1''), terms(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(nterms(X'), X2''), X2)) -> FIRST(first(terms(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(ns(nterms(X'')), X2)) -> FIRST(s(terms(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(X'), nfirst(X1', X2''))) -> FIRST(terms(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(nterms(X'), ns(X''))) -> FIRST(terms(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(nterms(X'), nterms(X''))) -> FIRST(terms(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(nterms(X''), X2)) -> FIRST(terms(X''), activate(X2))
ACTIVATE(nfirst(nterms(nfirst(X1', X2'')), X2)) -> FIRST(terms(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(nterms(ns(X'')), X2)) -> FIRST(terms(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(nterms(nterms(X'')), X2)) -> FIRST(terms(terms(activate(X''))), activate(X2))
ACTIVATE(nterms(X)) -> ACTIVATE(X)


Additionally, the following usable rules w.r.t. to the implicit AFS can be oriented:

activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X
first(0, X) -> nil
first(s(X), cons(Y, Z)) -> cons(Y, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)


Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(activate(x1))=  x1  
  POL(n__terms(x1))=  1 + x1  
  POL(sqr(x1))=  0  
  POL(n__s(x1))=  x1  
  POL(terms(x1))=  1 + x1  
  POL(ACTIVATE(x1))=  x1  
  POL(add(x1, x2))=  0  
  POL(first(x1, x2))=  x1 + x2  
  POL(0)=  0  
  POL(cons(x1, x2))=  x2  
  POL(FIRST(x1, x2))=  x2  
  POL(dbl(x1))=  0  
  POL(nil)=  0  
  POL(s(x1))=  x1  
  POL(recip(x1))=  0  
  POL(n__first(x1, x2))=  x1 + x2  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Nar
           →DP Problem 8
Nar
             ...
               →DP Problem 17
Polynomial Ordering


Dependency Pairs:

ACTIVATE(nfirst(X1', X2')) -> FIRST(X1', X2')
ACTIVATE(nfirst(nfirst(X1'', X2''), X2')) -> FIRST(first(activate(X1''), activate(X2'')), X2')
ACTIVATE(nfirst(ns(X'), X2')) -> FIRST(s(activate(X')), X2')
ACTIVATE(nfirst(X1, nfirst(X1'', nfirst(X1''', X2')))) -> FIRST(activate(X1), first(activate(X1''), first(activate(X1'''), activate(X2'))))
ACTIVATE(nfirst(X1, nfirst(X1'', ns(X')))) -> FIRST(activate(X1), first(activate(X1''), s(activate(X'))))
ACTIVATE(nfirst(X1, nfirst(X1'', nterms(X')))) -> FIRST(activate(X1), first(activate(X1''), terms(activate(X'))))
ACTIVATE(nfirst(X1, nfirst(X1''', X2''))) -> FIRST(activate(X1), first(X1''', activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(nfirst(X1''', X2'), X2''))) -> FIRST(activate(X1), first(first(activate(X1'''), activate(X2')), activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(ns(X'), X2''))) -> FIRST(activate(X1), first(s(activate(X')), activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(nterms(X'), X2''))) -> FIRST(activate(X1), first(terms(activate(X')), activate(X2'')))
ACTIVATE(nfirst(X1', nfirst(X1'', X2''))) -> FIRST(X1', first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(nfirst(X1''', X2'), nfirst(X1'', X2''))) -> FIRST(first(activate(X1'''), activate(X2')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(ns(X'), nfirst(X1'', X2''))) -> FIRST(s(activate(X')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1, ns(X''))) -> FIRST(activate(X1), s(X''))
ACTIVATE(nfirst(X1, ns(nfirst(X1'', X2')))) -> FIRST(activate(X1), s(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, ns(ns(X'')))) -> FIRST(activate(X1), s(s(activate(X''))))
ACTIVATE(nfirst(X1, ns(nterms(X'')))) -> FIRST(activate(X1), s(terms(activate(X''))))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), ns(X'))) -> FIRST(first(activate(X1''), activate(X2')), s(activate(X')))
ACTIVATE(nfirst(ns(X''), ns(X'))) -> FIRST(s(activate(X'')), s(activate(X')))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), terms(X''))
ACTIVATE(nfirst(X1, nterms(nfirst(X1'', X2')))) -> FIRST(activate(X1), terms(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, nterms(ns(X'')))) -> FIRST(activate(X1), terms(s(activate(X''))))
ACTIVATE(nfirst(X1, nterms(nterms(X'')))) -> FIRST(activate(X1), terms(terms(activate(X''))))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), cons(recip(sqr(activate(X''))), nterms(ns(activate(X'')))))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2')), terms(activate(X')))
ACTIVATE(nfirst(ns(X''), nterms(X'))) -> FIRST(s(activate(X'')), terms(activate(X')))
ACTIVATE(nfirst(X1', X2')) -> FIRST(X1', X2')
ACTIVATE(nfirst(X1', nfirst(X1'', X2''))) -> FIRST(X1', first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), X2')) -> FIRST(first(activate(X1''), activate(X2'')), X2')
ACTIVATE(nfirst(nfirst(X1'', X2''), nfirst(X1', X2'''))) -> FIRST(first(activate(X1''), activate(X2'')), first(activate(X1'), activate(X2''')))
ACTIVATE(nfirst(nfirst(X1'', X2''), ns(X'))) -> FIRST(first(activate(X1''), activate(X2'')), s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2'')), terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'''), X2)) -> FIRST(first(activate(X1''), X2'''), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nfirst(X1', X2''')), X2)) -> FIRST(first(activate(X1''), first(activate(X1'), activate(X2'''))), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', ns(X')), X2)) -> FIRST(first(activate(X1''), s(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(X1''', X2''), X2)) -> FIRST(first(X1''', activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nfirst(X1', X2'''), X2''), X2)) -> FIRST(first(first(activate(X1'), activate(X2''')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(ns(X'), X2''), X2)) -> FIRST(first(s(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(ns(X'), X2')) -> FIRST(s(activate(X')), X2')
ACTIVATE(nfirst(ns(X'), nfirst(X1', X2''))) -> FIRST(s(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(ns(X'), ns(X''))) -> FIRST(s(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(ns(X'), nterms(X''))) -> FIRST(s(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(ns(X''), X2)) -> FIRST(s(X''), activate(X2))
ACTIVATE(nfirst(ns(nfirst(X1', X2'')), X2)) -> FIRST(s(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(ns(ns(X'')), X2)) -> FIRST(s(s(activate(X''))), activate(X2))
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(ns(X)) -> ACTIVATE(X)
FIRST(s(X), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfirst(X1, nfirst(X1'', X2'''))) -> FIRST(activate(X1), first(activate(X1''), X2'''))


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





The following dependency pairs can be strictly oriented:

ACTIVATE(nfirst(ns(X'), X2')) -> FIRST(s(activate(X')), X2')
ACTIVATE(nfirst(ns(X'), nfirst(X1'', X2''))) -> FIRST(s(activate(X')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(ns(X''), ns(X'))) -> FIRST(s(activate(X'')), s(activate(X')))
ACTIVATE(nfirst(ns(X''), nterms(X'))) -> FIRST(s(activate(X'')), terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', ns(X')), X2)) -> FIRST(first(activate(X1''), s(activate(X'))), activate(X2))
ACTIVATE(nfirst(nfirst(ns(X'), X2''), X2)) -> FIRST(first(s(activate(X')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(ns(X'), nfirst(X1', X2''))) -> FIRST(s(activate(X')), first(activate(X1'), activate(X2'')))
ACTIVATE(nfirst(ns(X'), ns(X''))) -> FIRST(s(activate(X')), s(activate(X'')))
ACTIVATE(nfirst(ns(X'), nterms(X''))) -> FIRST(s(activate(X')), terms(activate(X'')))
ACTIVATE(nfirst(ns(X''), X2)) -> FIRST(s(X''), activate(X2))
ACTIVATE(nfirst(ns(nfirst(X1', X2'')), X2)) -> FIRST(s(first(activate(X1'), activate(X2''))), activate(X2))
ACTIVATE(nfirst(ns(ns(X'')), X2)) -> FIRST(s(s(activate(X''))), activate(X2))
ACTIVATE(ns(X)) -> ACTIVATE(X)


Additionally, the following usable rules w.r.t. to the implicit AFS can be oriented:

activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X
first(0, X) -> nil
first(s(X), cons(Y, Z)) -> cons(Y, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)


Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(activate(x1))=  x1  
  POL(n__terms(x1))=  0  
  POL(sqr(x1))=  0  
  POL(n__s(x1))=  1 + x1  
  POL(terms(x1))=  0  
  POL(ACTIVATE(x1))=  x1  
  POL(add(x1, x2))=  0  
  POL(first(x1, x2))=  x1 + x2  
  POL(0)=  0  
  POL(cons(x1, x2))=  x2  
  POL(FIRST(x1, x2))=  x2  
  POL(dbl(x1))=  0  
  POL(nil)=  0  
  POL(s(x1))=  1 + x1  
  POL(recip(x1))=  0  
  POL(n__first(x1, x2))=  x1 + x2  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Nar
           →DP Problem 8
Nar
             ...
               →DP Problem 18
Polynomial Ordering


Dependency Pairs:

ACTIVATE(nfirst(X1', X2')) -> FIRST(X1', X2')
ACTIVATE(nfirst(nfirst(X1'', X2''), X2')) -> FIRST(first(activate(X1''), activate(X2'')), X2')
ACTIVATE(nfirst(X1, nfirst(X1'', nfirst(X1''', X2')))) -> FIRST(activate(X1), first(activate(X1''), first(activate(X1'''), activate(X2'))))
ACTIVATE(nfirst(X1, nfirst(X1'', ns(X')))) -> FIRST(activate(X1), first(activate(X1''), s(activate(X'))))
ACTIVATE(nfirst(X1, nfirst(X1'', nterms(X')))) -> FIRST(activate(X1), first(activate(X1''), terms(activate(X'))))
ACTIVATE(nfirst(X1, nfirst(X1''', X2''))) -> FIRST(activate(X1), first(X1''', activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(nfirst(X1''', X2'), X2''))) -> FIRST(activate(X1), first(first(activate(X1'''), activate(X2')), activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(ns(X'), X2''))) -> FIRST(activate(X1), first(s(activate(X')), activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(nterms(X'), X2''))) -> FIRST(activate(X1), first(terms(activate(X')), activate(X2'')))
ACTIVATE(nfirst(X1', nfirst(X1'', X2''))) -> FIRST(X1', first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(nfirst(X1''', X2'), nfirst(X1'', X2''))) -> FIRST(first(activate(X1'''), activate(X2')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1, ns(X''))) -> FIRST(activate(X1), s(X''))
ACTIVATE(nfirst(X1, ns(nfirst(X1'', X2')))) -> FIRST(activate(X1), s(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, ns(ns(X'')))) -> FIRST(activate(X1), s(s(activate(X''))))
ACTIVATE(nfirst(X1, ns(nterms(X'')))) -> FIRST(activate(X1), s(terms(activate(X''))))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), ns(X'))) -> FIRST(first(activate(X1''), activate(X2')), s(activate(X')))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), terms(X''))
ACTIVATE(nfirst(X1, nterms(nfirst(X1'', X2')))) -> FIRST(activate(X1), terms(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, nterms(ns(X'')))) -> FIRST(activate(X1), terms(s(activate(X''))))
ACTIVATE(nfirst(X1, nterms(nterms(X'')))) -> FIRST(activate(X1), terms(terms(activate(X''))))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), cons(recip(sqr(activate(X''))), nterms(ns(activate(X'')))))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2')), terms(activate(X')))
ACTIVATE(nfirst(X1', X2')) -> FIRST(X1', X2')
ACTIVATE(nfirst(X1', nfirst(X1'', X2''))) -> FIRST(X1', first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), X2')) -> FIRST(first(activate(X1''), activate(X2'')), X2')
ACTIVATE(nfirst(nfirst(X1'', X2''), nfirst(X1', X2'''))) -> FIRST(first(activate(X1''), activate(X2'')), first(activate(X1'), activate(X2''')))
ACTIVATE(nfirst(nfirst(X1'', X2''), ns(X'))) -> FIRST(first(activate(X1''), activate(X2'')), s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2'')), terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'''), X2)) -> FIRST(first(activate(X1''), X2'''), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nfirst(X1', X2''')), X2)) -> FIRST(first(activate(X1''), first(activate(X1'), activate(X2'''))), activate(X2))
ACTIVATE(nfirst(nfirst(X1''', X2''), X2)) -> FIRST(first(X1''', activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nfirst(X1', X2'''), X2''), X2)) -> FIRST(first(first(activate(X1'), activate(X2''')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X1)
FIRST(s(X), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfirst(X1, nfirst(X1'', X2'''))) -> FIRST(activate(X1), first(activate(X1''), X2'''))


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





The following dependency pairs can be strictly oriented:

ACTIVATE(nfirst(X1', X2')) -> FIRST(X1', X2')
ACTIVATE(nfirst(nfirst(X1'', X2''), X2')) -> FIRST(first(activate(X1''), activate(X2'')), X2')
ACTIVATE(nfirst(X1, nfirst(X1'', nfirst(X1''', X2')))) -> FIRST(activate(X1), first(activate(X1''), first(activate(X1'''), activate(X2'))))
ACTIVATE(nfirst(X1, nfirst(X1'', ns(X')))) -> FIRST(activate(X1), first(activate(X1''), s(activate(X'))))
ACTIVATE(nfirst(X1, nfirst(X1'', nterms(X')))) -> FIRST(activate(X1), first(activate(X1''), terms(activate(X'))))
ACTIVATE(nfirst(X1, nfirst(X1''', X2''))) -> FIRST(activate(X1), first(X1''', activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(nfirst(X1''', X2'), X2''))) -> FIRST(activate(X1), first(first(activate(X1'''), activate(X2')), activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(ns(X'), X2''))) -> FIRST(activate(X1), first(s(activate(X')), activate(X2'')))
ACTIVATE(nfirst(X1, nfirst(nterms(X'), X2''))) -> FIRST(activate(X1), first(terms(activate(X')), activate(X2'')))
ACTIVATE(nfirst(X1', nfirst(X1'', X2''))) -> FIRST(X1', first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(nfirst(X1''', X2'), nfirst(X1'', X2''))) -> FIRST(first(activate(X1'''), activate(X2')), first(activate(X1''), activate(X2'')))
ACTIVATE(nfirst(X1, ns(X''))) -> FIRST(activate(X1), s(X''))
ACTIVATE(nfirst(X1, ns(nfirst(X1'', X2')))) -> FIRST(activate(X1), s(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, ns(ns(X'')))) -> FIRST(activate(X1), s(s(activate(X''))))
ACTIVATE(nfirst(X1, ns(nterms(X'')))) -> FIRST(activate(X1), s(terms(activate(X''))))
ACTIVATE(nfirst(X1', ns(X'))) -> FIRST(X1', s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), ns(X'))) -> FIRST(first(activate(X1''), activate(X2')), s(activate(X')))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), terms(X''))
ACTIVATE(nfirst(X1, nterms(nfirst(X1'', X2')))) -> FIRST(activate(X1), terms(first(activate(X1''), activate(X2'))))
ACTIVATE(nfirst(X1, nterms(ns(X'')))) -> FIRST(activate(X1), terms(s(activate(X''))))
ACTIVATE(nfirst(X1, nterms(nterms(X'')))) -> FIRST(activate(X1), terms(terms(activate(X''))))
ACTIVATE(nfirst(X1, nterms(X''))) -> FIRST(activate(X1), cons(recip(sqr(activate(X''))), nterms(ns(activate(X'')))))
ACTIVATE(nfirst(X1', nterms(X'))) -> FIRST(X1', terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2')), terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), nfirst(X1', X2'''))) -> FIRST(first(activate(X1''), activate(X2'')), first(activate(X1'), activate(X2''')))
ACTIVATE(nfirst(nfirst(X1'', X2''), ns(X'))) -> FIRST(first(activate(X1''), activate(X2'')), s(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2''), nterms(X'))) -> FIRST(first(activate(X1''), activate(X2'')), terms(activate(X')))
ACTIVATE(nfirst(nfirst(X1'', X2'''), X2)) -> FIRST(first(activate(X1''), X2'''), activate(X2))
ACTIVATE(nfirst(nfirst(X1'', nfirst(X1', X2''')), X2)) -> FIRST(first(activate(X1''), first(activate(X1'), activate(X2'''))), activate(X2))
ACTIVATE(nfirst(nfirst(X1''', X2''), X2)) -> FIRST(first(X1''', activate(X2'')), activate(X2))
ACTIVATE(nfirst(nfirst(nfirst(X1', X2'''), X2''), X2)) -> FIRST(first(first(activate(X1'), activate(X2''')), activate(X2'')), activate(X2))
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfirst(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(nfirst(X1, nfirst(X1'', X2'''))) -> FIRST(activate(X1), first(activate(X1''), X2'''))


Additionally, the following usable rules w.r.t. to the implicit AFS can be oriented:

activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X
first(0, X) -> nil
first(s(X), cons(Y, Z)) -> cons(Y, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)


Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(activate(x1))=  x1  
  POL(n__terms(x1))=  0  
  POL(sqr(x1))=  0  
  POL(n__s(x1))=  x1  
  POL(terms(x1))=  0  
  POL(ACTIVATE(x1))=  x1  
  POL(add(x1, x2))=  0  
  POL(first(x1, x2))=  1 + x1 + x2  
  POL(0)=  0  
  POL(cons(x1, x2))=  x2  
  POL(FIRST(x1, x2))=  x2  
  POL(dbl(x1))=  0  
  POL(nil)=  0  
  POL(s(x1))=  x1  
  POL(recip(x1))=  0  
  POL(n__first(x1, x2))=  1 + x1 + x2  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Nar
           →DP Problem 8
Nar
             ...
               →DP Problem 19
Dependency Graph


Dependency Pair:

FIRST(s(X), cons(Y, Z)) -> ACTIVATE(Z)


Rules:


terms(N) -> cons(recip(sqr(N)), nterms(ns(N)))
terms(X) -> nterms(X)
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, nfirst(X, activate(Z)))
first(X1, X2) -> nfirst(X1, X2)
s(X) -> ns(X)
activate(nterms(X)) -> terms(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfirst(X1, X2)) -> first(activate(X1), activate(X2))
activate(X) -> X





Using the Dependency Graph resulted in no new DP problems.

Termination of R successfully shown.
Duration:
0:18 minutes