R
↳Dependency Pair Analysis
PRIMES -> SIEVE(from(s(s(0))))
PRIMES -> FROM(s(s(0)))
FROM(X) -> CONS(X, nfrom(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), nfilter(s(s(X)), activate(Z)), ncons(Y, nfilter(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, nfilter(X, sieve(activate(Y))))
SIEVE(cons(X, Y)) -> SIEVE(activate(Y))
SIEVE(cons(X, Y)) -> ACTIVATE(Y)
ACTIVATE(nfrom(X)) -> FROM(X)
ACTIVATE(nfilter(X1, X2)) -> FILTER(X1, X2)
ACTIVATE(ncons(X1, X2)) -> CONS(X1, X2)
R
↳DPs
→DP Problem 1
↳Narrowing Transformation
FILTER(s(s(X)), cons(Y, Z)) -> SIEVE(Y)
FILTER(s(s(X)), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfilter(X1, X2)) -> FILTER(X1, X2)
SIEVE(cons(X, Y)) -> ACTIVATE(Y)
SIEVE(cons(X, Y)) -> SIEVE(activate(Y))
primes -> sieve(from(s(s(0))))
from(X) -> cons(X, nfrom(s(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(s(s(X)), activate(Z)), ncons(Y, nfilter(X, sieve(Y))))
filter(X1, X2) -> nfilter(X1, X2)
sieve(cons(X, Y)) -> cons(X, nfilter(X, sieve(activate(Y))))
cons(X1, X2) -> ncons(X1, X2)
activate(nfrom(X)) -> from(X)
activate(nfilter(X1, X2)) -> filter(X1, X2)
activate(ncons(X1, X2)) -> cons(X1, X2)
activate(X) -> X
four new Dependency Pairs are created:
SIEVE(cons(X, Y)) -> SIEVE(activate(Y))
SIEVE(cons(X, nfrom(X''))) -> SIEVE(from(X''))
SIEVE(cons(X, nfilter(X1', X2'))) -> SIEVE(filter(X1', X2'))
SIEVE(cons(X, ncons(X1', X2'))) -> SIEVE(cons(X1', X2'))
SIEVE(cons(X, Y')) -> SIEVE(Y')
R
↳DPs
→DP Problem 1
↳Nar
→DP Problem 2
↳Remaining Obligation(s)
SIEVE(cons(X, Y')) -> SIEVE(Y')
SIEVE(cons(X, ncons(X1', X2'))) -> SIEVE(cons(X1', X2'))
SIEVE(cons(X, nfilter(X1', X2'))) -> SIEVE(filter(X1', X2'))
SIEVE(cons(X, nfrom(X''))) -> SIEVE(from(X''))
FILTER(s(s(X)), cons(Y, Z)) -> ACTIVATE(Z)
ACTIVATE(nfilter(X1, X2)) -> FILTER(X1, X2)
SIEVE(cons(X, Y)) -> ACTIVATE(Y)
FILTER(s(s(X)), cons(Y, Z)) -> SIEVE(Y)
primes -> sieve(from(s(s(0))))
from(X) -> cons(X, nfrom(s(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(s(s(X)), activate(Z)), ncons(Y, nfilter(X, sieve(Y))))
filter(X1, X2) -> nfilter(X1, X2)
sieve(cons(X, Y)) -> cons(X, nfilter(X, sieve(activate(Y))))
cons(X1, X2) -> ncons(X1, X2)
activate(nfrom(X)) -> from(X)
activate(nfilter(X1, X2)) -> filter(X1, X2)
activate(ncons(X1, X2)) -> cons(X1, X2)
activate(X) -> X