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
Polynomial 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 pair can be strictly oriented:

ACTIVATE(nsieve(X)) -> ACTIVATE(X)


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

Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(n__cons(x1, x2))=  x1  
  POL(n__from(x1))=  x1  
  POL(n__filter(x1, x2))=  x1 + x2  
  POL(n__sieve(x1))=  1 + x1  
  POL(n__s(x1))=  x1  
  POL(ACTIVATE(x1))=  x1  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
           →DP Problem 2
Polynomial Ordering


Dependency Pairs:

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 pair can be strictly oriented:

ACTIVATE(ncons(X1, X2)) -> ACTIVATE(X1)


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

Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(n__cons(x1, x2))=  1 + x1  
  POL(n__from(x1))=  x1  
  POL(n__filter(x1, x2))=  x1 + x2  
  POL(n__s(x1))=  x1  
  POL(ACTIVATE(x1))=  x1  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
           →DP Problem 2
Polo
             ...
               →DP Problem 3
Polynomial Ordering


Dependency Pairs:

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(nfilter(X1, X2)) -> ACTIVATE(X2)
ACTIVATE(nfilter(X1, X2)) -> ACTIVATE(X1)


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

Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(n__from(x1))=  x1  
  POL(n__filter(x1, x2))=  1 + x1 + x2  
  POL(n__s(x1))=  x1  
  POL(ACTIVATE(x1))=  x1  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
           →DP Problem 2
Polo
             ...
               →DP Problem 4
Polynomial Ordering


Dependency Pairs:

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 pair can be strictly oriented:

ACTIVATE(ns(X)) -> ACTIVATE(X)


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

Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(n__from(x1))=  x1  
  POL(n__s(x1))=  1 + x1  
  POL(ACTIVATE(x1))=  x1  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
           →DP Problem 2
Polo
             ...
               →DP Problem 5
Polynomial Ordering


Dependency Pair:

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 pair can be strictly oriented:

ACTIVATE(nfrom(X)) -> ACTIVATE(X)


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

Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(n__from(x1))=  1 + x1  
  POL(ACTIVATE(x1))=  x1  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
           →DP Problem 2
Polo
             ...
               →DP Problem 6
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