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

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)))
FROM(X) -> FROM(s(X))
FILTER(s(s(X)), cons(Y, Z)) -> IF(divides(s(s(X)), Y), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
FILTER(s(s(X)), cons(Y, Z)) -> FILTER(s(s(X)), Z)
FILTER(s(s(X)), cons(Y, Z)) -> FILTER(X, sieve(Y))
FILTER(s(s(X)), cons(Y, Z)) -> SIEVE(Y)
SIEVE(cons(X, Y)) -> FILTER(X, sieve(Y))
SIEVE(cons(X, Y)) -> SIEVE(Y)

Furthermore, R contains two SCCs.


   R
DPs
       →DP Problem 1
Usable Rules (Innermost)
       →DP Problem 2
UsableRules


Dependency Pairs:

SIEVE(cons(X, Y)) -> SIEVE(Y)
FILTER(s(s(X)), cons(Y, Z)) -> SIEVE(Y)
FILTER(s(s(X)), cons(Y, Z)) -> FILTER(X, sieve(Y))
FILTER(s(s(X)), cons(Y, Z)) -> FILTER(s(s(X)), Z)
SIEVE(cons(X, Y)) -> FILTER(X, sieve(Y))


Rules:


primes -> sieve(from(s(s(0))))
from(X) -> cons(X, from(s(X)))
head(cons(X, Y)) -> X
tail(cons(X, Y)) -> Y
if(true, X, Y) -> X
if(false, X, Y) -> Y
filter(s(s(X)), cons(Y, Z)) -> if(divides(s(s(X)), Y), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
sieve(cons(X, Y)) -> cons(X, filter(X, sieve(Y)))


Strategy:

innermost




As we are in the innermost case, we can delete all 6 non-usable-rules.


   R
DPs
       →DP Problem 1
UsableRules
           →DP Problem 3
Negative Polynomial Order
       →DP Problem 2
UsableRules


Dependency Pairs:

SIEVE(cons(X, Y)) -> SIEVE(Y)
FILTER(s(s(X)), cons(Y, Z)) -> SIEVE(Y)
FILTER(s(s(X)), cons(Y, Z)) -> FILTER(X, sieve(Y))
FILTER(s(s(X)), cons(Y, Z)) -> FILTER(s(s(X)), Z)
SIEVE(cons(X, Y)) -> FILTER(X, sieve(Y))


Rules:


filter(s(s(X)), cons(Y, Z)) -> if(divides(s(s(X)), Y), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
sieve(cons(X, Y)) -> cons(X, filter(X, sieve(Y)))


Strategy:

innermost




The following Dependency Pairs can be strictly oriented using the given order.

SIEVE(cons(X, Y)) -> SIEVE(Y)
FILTER(s(s(X)), cons(Y, Z)) -> SIEVE(Y)
FILTER(s(s(X)), cons(Y, Z)) -> FILTER(X, sieve(Y))
FILTER(s(s(X)), cons(Y, Z)) -> FILTER(s(s(X)), Z)
SIEVE(cons(X, Y)) -> FILTER(X, sieve(Y))


Moreover, the following usable rules (regarding the implicit AFS) are oriented.

filter(s(s(X)), cons(Y, Z)) -> if(divides(s(s(X)), Y), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
sieve(cons(X, Y)) -> cons(X, filter(X, sieve(Y)))


Used ordering:
Polynomial Order with Interpretation:

POL( SIEVE(x1) ) = x1

POL( cons(x1, x2) ) = x1 + x2 + 1

POL( FILTER(x1, x2) ) = x2

POL( sieve(x1) ) = x1

POL( filter(x1, x2) ) = 0

POL( if(x1, ..., x3) ) = 0


This results in one new DP problem.


   R
DPs
       →DP Problem 1
UsableRules
           →DP Problem 3
Neg POLO
             ...
               →DP Problem 4
Dependency Graph
       →DP Problem 2
UsableRules


Dependency Pair:


Rules:


filter(s(s(X)), cons(Y, Z)) -> if(divides(s(s(X)), Y), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
sieve(cons(X, Y)) -> cons(X, filter(X, sieve(Y)))


Strategy:

innermost




Using the Dependency Graph resulted in no new DP problems.


   R
DPs
       →DP Problem 1
UsableRules
       →DP Problem 2
Usable Rules (Innermost)


Dependency Pair:

FROM(X) -> FROM(s(X))


Rules:


primes -> sieve(from(s(s(0))))
from(X) -> cons(X, from(s(X)))
head(cons(X, Y)) -> X
tail(cons(X, Y)) -> Y
if(true, X, Y) -> X
if(false, X, Y) -> Y
filter(s(s(X)), cons(Y, Z)) -> if(divides(s(s(X)), Y), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
sieve(cons(X, Y)) -> cons(X, filter(X, sieve(Y)))


Strategy:

innermost




As we are in the innermost case, we can delete all 8 non-usable-rules.


   R
DPs
       →DP Problem 1
UsableRules
       →DP Problem 2
UsableRules
           →DP Problem 5
Non Termination


Dependency Pair:

FROM(X) -> FROM(s(X))


Rule:

none


Strategy:

innermost




Found an infinite P-chain over R:
P =

FROM(X) -> FROM(s(X))

R = none

s = FROM(X)
evaluates to t =FROM(s(X))

Thus, s starts an infinite chain as s matches t.

Innermost Non-Termination of R could be shown.
Duration:
0:01 minutes