Term Rewriting System R:
[X, Y, Z, X1, X2]
primes -> sieve(from(s(s(0))))
from(X) -> cons(X, nfrom(ns(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(ns(ns(X)), activate(Z)), ncons(Y, nfilter(X, nsieve(Y))))
filter(X1, X2) -> nfilter(X1, X2)
sieve(cons(X, Y)) -> cons(X, nfilter(X, nsieve(activate(Y))))
sieve(X) -> nsieve(X)
s(X) -> ns(X)
cons(X1, X2) -> ncons(X1, X2)
activate(nfrom(X)) -> from(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfilter(X1, X2)) -> filter(activate(X1), activate(X2))
activate(ncons(X1, X2)) -> cons(activate(X1), X2)
activate(nsieve(X)) -> sieve(activate(X))
activate(X) -> X

Innermost 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)))
PRIMES -> S(s(0))
PRIMES -> S(0)
FROM(X) -> CONS(X, nfrom(ns(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(ns(ns(X)), activate(Z)), ncons(Y, nfilter(X, nsieve(Y))))
FILTER(s(s(X)), cons(Y, Z)) -> ACTIVATE(Z)
SIEVE(cons(X, Y)) -> CONS(X, nfilter(X, nsieve(activate(Y))))
SIEVE(cons(X, Y)) -> ACTIVATE(Y)
ACTIVATE(nfrom(X)) -> FROM(activate(X))
ACTIVATE(nfrom(X)) -> ACTIVATE(X)
ACTIVATE(ns(X)) -> S(activate(X))
ACTIVATE(ns(X)) -> ACTIVATE(X)
ACTIVATE(nfilter(X1, X2)) -> FILTER(activate(X1), activate(X2))
ACTIVATE(nfilter(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(nfilter(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(ncons(X1, X2)) -> CONS(activate(X1), X2)
ACTIVATE(ncons(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(nsieve(X)) -> SIEVE(activate(X))
ACTIVATE(nsieve(X)) -> ACTIVATE(X)

Furthermore, R contains one SCC.


   R
DPs
       →DP Problem 1
Argument Filtering and Ordering


Dependency Pairs:

ACTIVATE(nsieve(X)) -> ACTIVATE(X)
ACTIVATE(ncons(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(nfilter(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfilter(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(ns(X)) -> ACTIVATE(X)
ACTIVATE(nfrom(X)) -> ACTIVATE(X)


Rules:


primes -> sieve(from(s(s(0))))
from(X) -> cons(X, nfrom(ns(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(ns(ns(X)), activate(Z)), ncons(Y, nfilter(X, nsieve(Y))))
filter(X1, X2) -> nfilter(X1, X2)
sieve(cons(X, Y)) -> cons(X, nfilter(X, nsieve(activate(Y))))
sieve(X) -> nsieve(X)
s(X) -> ns(X)
cons(X1, X2) -> ncons(X1, X2)
activate(nfrom(X)) -> from(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfilter(X1, X2)) -> filter(activate(X1), activate(X2))
activate(ncons(X1, X2)) -> cons(activate(X1), X2)
activate(nsieve(X)) -> sieve(activate(X))
activate(X) -> X


Strategy:

innermost




The following dependency pairs can be strictly oriented:

ACTIVATE(nsieve(X)) -> ACTIVATE(X)
ACTIVATE(ncons(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(nfilter(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfilter(X1, X2)) -> ACTIVATE(X1)
ACTIVATE(ns(X)) -> ACTIVATE(X)
ACTIVATE(nfrom(X)) -> ACTIVATE(X)


There are no usable rules for innermost w.r.t. to the AFS that need to be oriented.
Used ordering: Homeomorphic Embedding Order with EMB
resulting in one new DP problem.
Used Argument Filtering System:
ACTIVATE(x1) -> ACTIVATE(x1)
nsieve(x1) -> nsieve(x1)
ncons(x1, x2) -> ncons(x1, x2)
nfilter(x1, x2) -> nfilter(x1, x2)
ns(x1) -> ns(x1)
nfrom(x1) -> nfrom(x1)


   R
DPs
       →DP Problem 1
AFS
           →DP Problem 2
Dependency Graph


Dependency Pair:


Rules:


primes -> sieve(from(s(s(0))))
from(X) -> cons(X, nfrom(ns(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(ns(ns(X)), activate(Z)), ncons(Y, nfilter(X, nsieve(Y))))
filter(X1, X2) -> nfilter(X1, X2)
sieve(cons(X, Y)) -> cons(X, nfilter(X, nsieve(activate(Y))))
sieve(X) -> nsieve(X)
s(X) -> ns(X)
cons(X1, X2) -> ncons(X1, X2)
activate(nfrom(X)) -> from(activate(X))
activate(ns(X)) -> s(activate(X))
activate(nfilter(X1, X2)) -> filter(activate(X1), activate(X2))
activate(ncons(X1, X2)) -> cons(activate(X1), X2)
activate(nsieve(X)) -> sieve(activate(X))
activate(X) -> X


Strategy:

innermost




Using the Dependency Graph resulted in no new DP problems.

Innermost Termination of R successfully shown.
Duration:
0:01 minutes