Term Rewriting System R:
[X, Y, Z, X1, X2]
primes -> sieve(from(s(s(0))))
from(X) -> cons(X, nfrom(s(X)))
from(X) -> nfrom(X)
head(cons(X, Y)) -> X
tail(cons(X, Y)) -> activate(Y)
if(true, X, Y) -> activate(X)
if(false, X, Y) -> activate(Y)
filter(s(s(X)), cons(Y, Z)) -> if(divides(s(s(X)), Y), nfilter(s(s(X)), activate(Z)), ncons(Y, nfilter(X, sieve(Y))))
filter(X1, X2) -> nfilter(X1, X2)
sieve(cons(X, Y)) -> cons(X, nfilter(X, sieve(activate(Y))))
cons(X1, X2) -> ncons(X1, X2)
activate(nfrom(X)) -> from(X)
activate(nfilter(X1, X2)) -> filter(X1, X2)
activate(ncons(X1, X2)) -> cons(X1, X2)
activate(X) -> X

Termination of R to be shown.



   R
Dependency Pair Analysis



R contains the following Dependency Pairs:

PRIMES -> SIEVE(from(s(s(0))))
PRIMES -> FROM(s(s(0)))
FROM(X) -> CONS(X, nfrom(s(X)))
TAIL(cons(X, Y)) -> ACTIVATE(Y)
IF(true, X, Y) -> ACTIVATE(X)
IF(false, X, Y) -> ACTIVATE(Y)
FILTER(s(s(X)), cons(Y, Z)) -> IF(divides(s(s(X)), Y), nfilter(s(s(X)), activate(Z)), ncons(Y, nfilter(X, sieve(Y))))
FILTER(s(s(X)), cons(Y, Z)) -> ACTIVATE(Z)
FILTER(s(s(X)), cons(Y, Z)) -> SIEVE(Y)
SIEVE(cons(X, Y)) -> CONS(X, nfilter(X, sieve(activate(Y))))
SIEVE(cons(X, Y)) -> SIEVE(activate(Y))
SIEVE(cons(X, Y)) -> ACTIVATE(Y)
ACTIVATE(nfrom(X)) -> FROM(X)
ACTIVATE(nfilter(X1, X2)) -> FILTER(X1, X2)
ACTIVATE(ncons(X1, X2)) -> CONS(X1, X2)

Furthermore, R contains one SCC.


   R
DPs
       →DP Problem 1
Narrowing Transformation


Dependency Pairs:

FILTER(s(s(X)), cons(Y, Z)) -> SIEVE(Y)
FILTER(s(s(X)), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfilter(X1, X2)) -> FILTER(X1, X2)
SIEVE(cons(X, Y)) -> ACTIVATE(Y)
SIEVE(cons(X, Y)) -> SIEVE(activate(Y))


Rules:


primes -> sieve(from(s(s(0))))
from(X) -> cons(X, nfrom(s(X)))
from(X) -> nfrom(X)
head(cons(X, Y)) -> X
tail(cons(X, Y)) -> activate(Y)
if(true, X, Y) -> activate(X)
if(false, X, Y) -> activate(Y)
filter(s(s(X)), cons(Y, Z)) -> if(divides(s(s(X)), Y), nfilter(s(s(X)), activate(Z)), ncons(Y, nfilter(X, sieve(Y))))
filter(X1, X2) -> nfilter(X1, X2)
sieve(cons(X, Y)) -> cons(X, nfilter(X, sieve(activate(Y))))
cons(X1, X2) -> ncons(X1, X2)
activate(nfrom(X)) -> from(X)
activate(nfilter(X1, X2)) -> filter(X1, X2)
activate(ncons(X1, X2)) -> cons(X1, X2)
activate(X) -> X





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

SIEVE(cons(X, Y)) -> SIEVE(activate(Y))
four new Dependency Pairs are created:

SIEVE(cons(X, nfrom(X''))) -> SIEVE(from(X''))
SIEVE(cons(X, nfilter(X1', X2'))) -> SIEVE(filter(X1', X2'))
SIEVE(cons(X, ncons(X1', X2'))) -> SIEVE(cons(X1', X2'))
SIEVE(cons(X, Y')) -> SIEVE(Y')

The transformation is resulting in one new DP problem:



   R
DPs
       →DP Problem 1
Nar
           →DP Problem 2
Remaining Obligation(s)




The following remains to be proven:
Dependency Pairs:

SIEVE(cons(X, Y')) -> SIEVE(Y')
SIEVE(cons(X, ncons(X1', X2'))) -> SIEVE(cons(X1', X2'))
SIEVE(cons(X, nfilter(X1', X2'))) -> SIEVE(filter(X1', X2'))
SIEVE(cons(X, nfrom(X''))) -> SIEVE(from(X''))
FILTER(s(s(X)), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfilter(X1, X2)) -> FILTER(X1, X2)
SIEVE(cons(X, Y)) -> ACTIVATE(Y)
FILTER(s(s(X)), cons(Y, Z)) -> SIEVE(Y)


Rules:


primes -> sieve(from(s(s(0))))
from(X) -> cons(X, nfrom(s(X)))
from(X) -> nfrom(X)
head(cons(X, Y)) -> X
tail(cons(X, Y)) -> activate(Y)
if(true, X, Y) -> activate(X)
if(false, X, Y) -> activate(Y)
filter(s(s(X)), cons(Y, Z)) -> if(divides(s(s(X)), Y), nfilter(s(s(X)), activate(Z)), ncons(Y, nfilter(X, sieve(Y))))
filter(X1, X2) -> nfilter(X1, X2)
sieve(cons(X, Y)) -> cons(X, nfilter(X, sieve(activate(Y))))
cons(X1, X2) -> ncons(X1, X2)
activate(nfrom(X)) -> from(X)
activate(nfilter(X1, X2)) -> filter(X1, X2)
activate(ncons(X1, X2)) -> cons(X1, X2)
activate(X) -> X




Termination of R could not be shown.
Duration:
0:00 minutes