(0) Obligation:
Q restricted rewrite system:
The TRS R consists of the following rules:
primes → sieve(from(s(s(0))))
from(X) → cons(X, n__from(s(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), n__filter(s(s(X)), activate(Z)), n__cons(Y, n__filter(X, sieve(Y))))
sieve(cons(X, Y)) → cons(X, n__filter(X, sieve(activate(Y))))
from(X) → n__from(X)
filter(X1, X2) → n__filter(X1, X2)
cons(X1, X2) → n__cons(X1, X2)
activate(n__from(X)) → from(X)
activate(n__filter(X1, X2)) → filter(X1, X2)
activate(n__cons(X1, X2)) → cons(X1, X2)
activate(X) → X
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:
PRIMES → SIEVE(from(s(s(0))))
PRIMES → FROM(s(s(0)))
FROM(X) → CONS(X, n__from(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), n__filter(s(s(X)), activate(Z)), n__cons(Y, n__filter(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, n__filter(X, sieve(activate(Y))))
SIEVE(cons(X, Y)) → SIEVE(activate(Y))
SIEVE(cons(X, Y)) → ACTIVATE(Y)
ACTIVATE(n__from(X)) → FROM(X)
ACTIVATE(n__filter(X1, X2)) → FILTER(X1, X2)
ACTIVATE(n__cons(X1, X2)) → CONS(X1, X2)
The TRS R consists of the following rules:
primes → sieve(from(s(s(0))))
from(X) → cons(X, n__from(s(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), n__filter(s(s(X)), activate(Z)), n__cons(Y, n__filter(X, sieve(Y))))
sieve(cons(X, Y)) → cons(X, n__filter(X, sieve(activate(Y))))
from(X) → n__from(X)
filter(X1, X2) → n__filter(X1, X2)
cons(X1, X2) → n__cons(X1, X2)
activate(n__from(X)) → from(X)
activate(n__filter(X1, X2)) → filter(X1, X2)
activate(n__cons(X1, X2)) → cons(X1, X2)
activate(X) → X
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 1 SCC with 10 less nodes.
(4) Obligation:
Q DP problem:
The TRS P consists of the following rules:
ACTIVATE(n__filter(X1, X2)) → FILTER(X1, X2)
FILTER(s(s(X)), cons(Y, Z)) → ACTIVATE(Z)
FILTER(s(s(X)), cons(Y, Z)) → SIEVE(Y)
SIEVE(cons(X, Y)) → SIEVE(activate(Y))
SIEVE(cons(X, Y)) → ACTIVATE(Y)
The TRS R consists of the following rules:
primes → sieve(from(s(s(0))))
from(X) → cons(X, n__from(s(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), n__filter(s(s(X)), activate(Z)), n__cons(Y, n__filter(X, sieve(Y))))
sieve(cons(X, Y)) → cons(X, n__filter(X, sieve(activate(Y))))
from(X) → n__from(X)
filter(X1, X2) → n__filter(X1, X2)
cons(X1, X2) → n__cons(X1, X2)
activate(n__from(X)) → from(X)
activate(n__filter(X1, X2)) → filter(X1, X2)
activate(n__cons(X1, X2)) → cons(X1, X2)
activate(X) → X
Q is empty.
We have to consider all minimal (P,Q,R)-chains.
(5) NonLoopProof (EQUIVALENT transformation)
By Theorem 8 [NONLOOP] we deduce infiniteness of the QDP.
We apply the theorem with m = 1, b = 0,
σ' = [ ], and μ' = [x1 / x0, x0 / s(x0)] on the rule
SIEVE(cons(x0, n__from(s(x0))))[ ]n[ ] → SIEVE(cons(x0, n__from(s(x0))))[ ]n[x1 / x0, x0 / s(x0)]
This rule is correct for the QDP as the following derivation shows:
intermediate steps: Equivalent (Simplify mu) - Instantiate mu
SIEVE(cons(x1, n__from(x0)))[ ]n[ ] → SIEVE(cons(x0, n__from(s(x0))))[ ]n[ ]
by Narrowing at position: [0]
intermediate steps: Instantiation
SIEVE(cons(x1, n__from(y0)))[ ]n[ ] → SIEVE(from(y0))[ ]n[ ]
by Narrowing at position: [0]
intermediate steps: Instantiation - Instantiation
SIEVE(cons(X, Y))[ ]n[ ] → SIEVE(activate(Y))[ ]n[ ]
by OriginalRule from TRS P
intermediate steps: Instantiation
activate(n__from(X))[ ]n[ ] → from(X)[ ]n[ ]
by OriginalRule from TRS R
intermediate steps: Instantiation - Instantiation
from(X)[ ]n[ ] → cons(X, n__from(s(X)))[ ]n[ ]
by OriginalRule from TRS R
(6) NO