(0) Obligation:

Q restricted rewrite system:
The TRS R consists of the following rules:

primessieve(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)))

Q is empty.

(1) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LPAR04] we result in the following initial DP problem.

(2) Obligation:

Q DP problem:
The TRS P consists of the following rules:

PRIMESSIEVE(from(s(s(0))))
PRIMESFROM(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)

The TRS R consists of the following rules:

primessieve(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)))

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

(3) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 2 SCCs with 3 less nodes.

(4) Complex Obligation (AND)

(5) Obligation:

Q DP problem:
The TRS P consists of the following rules:

FILTER(s(s(X)), cons(Y, Z)) → FILTER(X, sieve(Y))
FILTER(s(s(X)), cons(Y, Z)) → FILTER(s(s(X)), Z)
FILTER(s(s(X)), cons(Y, Z)) → SIEVE(Y)
SIEVE(cons(X, Y)) → FILTER(X, sieve(Y))
SIEVE(cons(X, Y)) → SIEVE(Y)

The TRS R consists of the following rules:

primessieve(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)))

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

(6) MNOCProof (EQUIVALENT transformation)

We use the modular non-overlap check [LPAR04] to enlarge Q to all left-hand sides of R.

(7) Obligation:

Q DP problem:
The TRS P consists of the following rules:

FILTER(s(s(X)), cons(Y, Z)) → FILTER(X, sieve(Y))
FILTER(s(s(X)), cons(Y, Z)) → FILTER(s(s(X)), Z)
FILTER(s(s(X)), cons(Y, Z)) → SIEVE(Y)
SIEVE(cons(X, Y)) → FILTER(X, sieve(Y))
SIEVE(cons(X, Y)) → SIEVE(Y)

The TRS R consists of the following rules:

primessieve(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)))

The set Q consists of the following terms:

primes
from(x0)
head(cons(x0, x1))
tail(cons(x0, x1))
if(true, x0, x1)
if(false, x0, x1)
filter(s(s(x0)), cons(x1, x2))
sieve(cons(x0, x1))

We have to consider all minimal (P,Q,R)-chains.

(8) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(9) Obligation:

Q DP problem:
The TRS P consists of the following rules:

FILTER(s(s(X)), cons(Y, Z)) → FILTER(X, sieve(Y))
FILTER(s(s(X)), cons(Y, Z)) → FILTER(s(s(X)), Z)
FILTER(s(s(X)), cons(Y, Z)) → SIEVE(Y)
SIEVE(cons(X, Y)) → FILTER(X, sieve(Y))
SIEVE(cons(X, Y)) → SIEVE(Y)

The TRS R consists of the following rules:

sieve(cons(X, Y)) → cons(X, filter(X, sieve(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))))

The set Q consists of the following terms:

primes
from(x0)
head(cons(x0, x1))
tail(cons(x0, x1))
if(true, x0, x1)
if(false, x0, x1)
filter(s(s(x0)), cons(x1, x2))
sieve(cons(x0, x1))

We have to consider all minimal (P,Q,R)-chains.

(10) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

primes
from(x0)
head(cons(x0, x1))
tail(cons(x0, x1))

(11) Obligation:

Q DP problem:
The TRS P consists of the following rules:

FILTER(s(s(X)), cons(Y, Z)) → FILTER(X, sieve(Y))
FILTER(s(s(X)), cons(Y, Z)) → FILTER(s(s(X)), Z)
FILTER(s(s(X)), cons(Y, Z)) → SIEVE(Y)
SIEVE(cons(X, Y)) → FILTER(X, sieve(Y))
SIEVE(cons(X, Y)) → SIEVE(Y)

The TRS R consists of the following rules:

sieve(cons(X, Y)) → cons(X, filter(X, sieve(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))))

The set Q consists of the following terms:

if(true, x0, x1)
if(false, x0, x1)
filter(s(s(x0)), cons(x1, x2))
sieve(cons(x0, x1))

We have to consider all minimal (P,Q,R)-chains.

(12) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04,JAR06].


The following pairs can be oriented strictly and are deleted.


FILTER(s(s(X)), cons(Y, Z)) → FILTER(X, sieve(Y))
FILTER(s(s(X)), cons(Y, Z)) → FILTER(s(s(X)), Z)
FILTER(s(s(X)), cons(Y, Z)) → SIEVE(Y)
SIEVE(cons(X, Y)) → FILTER(X, sieve(Y))
SIEVE(cons(X, Y)) → SIEVE(Y)
The remaining pairs can at least be oriented weakly.
Used ordering: Polynomial Order [NEGPOLO,POLO] with Interpretation:

POL( FILTER(x1, x2) ) = 2x1 + 2x2


POL( sieve(x1) ) = x1


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


POL( filter(x1, x2) ) = max{0, -1}


POL( s(x1) ) = 2x1


POL( if(x1, ..., x3) ) = max{0, 2x1 + x2 - 1}


POL( divides(x1, x2) ) = max{0, -2}


POL( SIEVE(x1) ) = x1 + 1



The following usable rules [FROCOS05] with respect to the argument filtering of the ordering [JAR06] were oriented:

sieve(cons(X, Y)) → cons(X, filter(X, sieve(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))))

(13) Obligation:

Q DP problem:
P is empty.
The TRS R consists of the following rules:

sieve(cons(X, Y)) → cons(X, filter(X, sieve(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))))

The set Q consists of the following terms:

if(true, x0, x1)
if(false, x0, x1)
filter(s(s(x0)), cons(x1, x2))
sieve(cons(x0, x1))

We have to consider all minimal (P,Q,R)-chains.

(14) PisEmptyProof (EQUIVALENT transformation)

The TRS P is empty. Hence, there is no (P,Q,R) chain.

(15) YES

(16) Obligation:

Q DP problem:
The TRS P consists of the following rules:

FROM(X) → FROM(s(X))

The TRS R consists of the following rules:

primessieve(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)))

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

(17) NonLoopProof (EQUIVALENT transformation)

By Theorem 8 [NONLOOP] we deduce infiniteness of the QDP.
We apply the theorem with m = 1, b = 0,
σ' = [ ], and μ' = [x0 / s(x0)] on the rule
FROM(s(x0))[ ]n[ ] → FROM(s(x0))[ ]n[x0 / s(x0)]
This rule is correct for the QDP as the following derivation shows:

intermediate steps: Equivalent (Simplify mu) - Instantiate mu - Instantiation
FROM(X)[ ]n[ ] → FROM(s(X))[ ]n[ ]
    by OriginalRule from TRS P

(18) NO