(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
primes → sieve(from(s(s(0))))
from(X) → cons(X, n__from(n__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(n__s(n__s(X)), activate(Z)), n__cons(Y, n__filter(X, n__sieve(Y))))
sieve(cons(X, Y)) → cons(X, n__filter(X, n__sieve(activate(Y))))
from(X) → n__from(X)
s(X) → n__s(X)
filter(X1, X2) → n__filter(X1, X2)
cons(X1, X2) → n__cons(X1, X2)
sieve(X) → n__sieve(X)
activate(n__from(X)) → from(activate(X))
activate(n__s(X)) → s(activate(X))
activate(n__filter(X1, X2)) → filter(activate(X1), activate(X2))
activate(n__cons(X1, X2)) → cons(activate(X1), X2)
activate(n__sieve(X)) → sieve(activate(X))
activate(X) → X
Rewrite Strategy: INNERMOST
(1) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)
Converted Cpx (relative) TRS to CDT
(2) Obligation:
Complexity Dependency Tuples Problem
Rules:
primes → sieve(from(s(s(0))))
from(z0) → cons(z0, n__from(n__s(z0)))
from(z0) → n__from(z0)
head(cons(z0, z1)) → z0
tail(cons(z0, z1)) → activate(z1)
if(true, z0, z1) → activate(z0)
if(false, z0, z1) → activate(z1)
filter(s(s(z0)), cons(z1, z2)) → if(divides(s(s(z0)), z1), n__filter(n__s(n__s(z0)), activate(z2)), n__cons(z1, n__filter(z0, n__sieve(z1))))
filter(z0, z1) → n__filter(z0, z1)
sieve(cons(z0, z1)) → cons(z0, n__filter(z0, n__sieve(activate(z1))))
sieve(z0) → n__sieve(z0)
s(z0) → n__s(z0)
cons(z0, z1) → n__cons(z0, z1)
activate(n__from(z0)) → from(activate(z0))
activate(n__s(z0)) → s(activate(z0))
activate(n__filter(z0, z1)) → filter(activate(z0), activate(z1))
activate(n__cons(z0, z1)) → cons(activate(z0), z1)
activate(n__sieve(z0)) → sieve(activate(z0))
activate(z0) → z0
Tuples:
PRIMES → c(SIEVE(from(s(s(0)))), FROM(s(s(0))), S(s(0)), S(0))
FROM(z0) → c1(CONS(z0, n__from(n__s(z0))))
FROM(z0) → c2
HEAD(cons(z0, z1)) → c3
TAIL(cons(z0, z1)) → c4(ACTIVATE(z1))
IF(true, z0, z1) → c5(ACTIVATE(z0))
IF(false, z0, z1) → c6(ACTIVATE(z1))
FILTER(s(s(z0)), cons(z1, z2)) → c7(IF(divides(s(s(z0)), z1), n__filter(n__s(n__s(z0)), activate(z2)), n__cons(z1, n__filter(z0, n__sieve(z1)))), S(s(z0)), S(z0), ACTIVATE(z2))
FILTER(z0, z1) → c8
SIEVE(cons(z0, z1)) → c9(CONS(z0, n__filter(z0, n__sieve(activate(z1)))), ACTIVATE(z1))
SIEVE(z0) → c10
S(z0) → c11
CONS(z0, z1) → c12
ACTIVATE(n__from(z0)) → c13(FROM(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(FILTER(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(CONS(activate(z0), z1), ACTIVATE(z0))
ACTIVATE(n__sieve(z0)) → c17(SIEVE(activate(z0)), ACTIVATE(z0))
ACTIVATE(z0) → c18
S tuples:
PRIMES → c(SIEVE(from(s(s(0)))), FROM(s(s(0))), S(s(0)), S(0))
FROM(z0) → c1(CONS(z0, n__from(n__s(z0))))
FROM(z0) → c2
HEAD(cons(z0, z1)) → c3
TAIL(cons(z0, z1)) → c4(ACTIVATE(z1))
IF(true, z0, z1) → c5(ACTIVATE(z0))
IF(false, z0, z1) → c6(ACTIVATE(z1))
FILTER(s(s(z0)), cons(z1, z2)) → c7(IF(divides(s(s(z0)), z1), n__filter(n__s(n__s(z0)), activate(z2)), n__cons(z1, n__filter(z0, n__sieve(z1)))), S(s(z0)), S(z0), ACTIVATE(z2))
FILTER(z0, z1) → c8
SIEVE(cons(z0, z1)) → c9(CONS(z0, n__filter(z0, n__sieve(activate(z1)))), ACTIVATE(z1))
SIEVE(z0) → c10
S(z0) → c11
CONS(z0, z1) → c12
ACTIVATE(n__from(z0)) → c13(FROM(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(FILTER(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(CONS(activate(z0), z1), ACTIVATE(z0))
ACTIVATE(n__sieve(z0)) → c17(SIEVE(activate(z0)), ACTIVATE(z0))
ACTIVATE(z0) → c18
K tuples:none
Defined Rule Symbols:
primes, from, head, tail, if, filter, sieve, s, cons, activate
Defined Pair Symbols:
PRIMES, FROM, HEAD, TAIL, IF, FILTER, SIEVE, S, CONS, ACTIVATE
Compound Symbols:
c, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18
(3) CdtLeafRemovalProof (ComplexityIfPolyImplication transformation)
Removed 5 leading nodes:
TAIL(cons(z0, z1)) → c4(ACTIVATE(z1))
IF(true, z0, z1) → c5(ACTIVATE(z0))
IF(false, z0, z1) → c6(ACTIVATE(z1))
FILTER(s(s(z0)), cons(z1, z2)) → c7(IF(divides(s(s(z0)), z1), n__filter(n__s(n__s(z0)), activate(z2)), n__cons(z1, n__filter(z0, n__sieve(z1)))), S(s(z0)), S(z0), ACTIVATE(z2))
SIEVE(cons(z0, z1)) → c9(CONS(z0, n__filter(z0, n__sieve(activate(z1)))), ACTIVATE(z1))
Removed 9 trailing nodes:
S(z0) → c11
SIEVE(z0) → c10
PRIMES → c(SIEVE(from(s(s(0)))), FROM(s(s(0))), S(s(0)), S(0))
FROM(z0) → c1(CONS(z0, n__from(n__s(z0))))
ACTIVATE(z0) → c18
FROM(z0) → c2
HEAD(cons(z0, z1)) → c3
CONS(z0, z1) → c12
FILTER(z0, z1) → c8
(4) Obligation:
Complexity Dependency Tuples Problem
Rules:
primes → sieve(from(s(s(0))))
from(z0) → cons(z0, n__from(n__s(z0)))
from(z0) → n__from(z0)
head(cons(z0, z1)) → z0
tail(cons(z0, z1)) → activate(z1)
if(true, z0, z1) → activate(z0)
if(false, z0, z1) → activate(z1)
filter(s(s(z0)), cons(z1, z2)) → if(divides(s(s(z0)), z1), n__filter(n__s(n__s(z0)), activate(z2)), n__cons(z1, n__filter(z0, n__sieve(z1))))
filter(z0, z1) → n__filter(z0, z1)
sieve(cons(z0, z1)) → cons(z0, n__filter(z0, n__sieve(activate(z1))))
sieve(z0) → n__sieve(z0)
s(z0) → n__s(z0)
cons(z0, z1) → n__cons(z0, z1)
activate(n__from(z0)) → from(activate(z0))
activate(n__s(z0)) → s(activate(z0))
activate(n__filter(z0, z1)) → filter(activate(z0), activate(z1))
activate(n__cons(z0, z1)) → cons(activate(z0), z1)
activate(n__sieve(z0)) → sieve(activate(z0))
activate(z0) → z0
Tuples:
ACTIVATE(n__from(z0)) → c13(FROM(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(FILTER(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(CONS(activate(z0), z1), ACTIVATE(z0))
ACTIVATE(n__sieve(z0)) → c17(SIEVE(activate(z0)), ACTIVATE(z0))
S tuples:
ACTIVATE(n__from(z0)) → c13(FROM(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(FILTER(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(CONS(activate(z0), z1), ACTIVATE(z0))
ACTIVATE(n__sieve(z0)) → c17(SIEVE(activate(z0)), ACTIVATE(z0))
K tuples:none
Defined Rule Symbols:
primes, from, head, tail, if, filter, sieve, s, cons, activate
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c13, c14, c15, c16, c17
(5) CdtRhsSimplificationProcessorProof (BOTH BOUNDS(ID, ID) transformation)
Removed 5 trailing tuple parts
(6) Obligation:
Complexity Dependency Tuples Problem
Rules:
primes → sieve(from(s(s(0))))
from(z0) → cons(z0, n__from(n__s(z0)))
from(z0) → n__from(z0)
head(cons(z0, z1)) → z0
tail(cons(z0, z1)) → activate(z1)
if(true, z0, z1) → activate(z0)
if(false, z0, z1) → activate(z1)
filter(s(s(z0)), cons(z1, z2)) → if(divides(s(s(z0)), z1), n__filter(n__s(n__s(z0)), activate(z2)), n__cons(z1, n__filter(z0, n__sieve(z1))))
filter(z0, z1) → n__filter(z0, z1)
sieve(cons(z0, z1)) → cons(z0, n__filter(z0, n__sieve(activate(z1))))
sieve(z0) → n__sieve(z0)
s(z0) → n__s(z0)
cons(z0, z1) → n__cons(z0, z1)
activate(n__from(z0)) → from(activate(z0))
activate(n__s(z0)) → s(activate(z0))
activate(n__filter(z0, z1)) → filter(activate(z0), activate(z1))
activate(n__cons(z0, z1)) → cons(activate(z0), z1)
activate(n__sieve(z0)) → sieve(activate(z0))
activate(z0) → z0
Tuples:
ACTIVATE(n__from(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(ACTIVATE(z0))
ACTIVATE(n__sieve(z0)) → c17(ACTIVATE(z0))
S tuples:
ACTIVATE(n__from(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(ACTIVATE(z0))
ACTIVATE(n__sieve(z0)) → c17(ACTIVATE(z0))
K tuples:none
Defined Rule Symbols:
primes, from, head, tail, if, filter, sieve, s, cons, activate
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c13, c14, c15, c16, c17
(7) CdtUsableRulesProof (EQUIVALENT transformation)
The following rules are not usable and were removed:
primes → sieve(from(s(s(0))))
from(z0) → cons(z0, n__from(n__s(z0)))
from(z0) → n__from(z0)
head(cons(z0, z1)) → z0
tail(cons(z0, z1)) → activate(z1)
if(true, z0, z1) → activate(z0)
if(false, z0, z1) → activate(z1)
filter(s(s(z0)), cons(z1, z2)) → if(divides(s(s(z0)), z1), n__filter(n__s(n__s(z0)), activate(z2)), n__cons(z1, n__filter(z0, n__sieve(z1))))
filter(z0, z1) → n__filter(z0, z1)
sieve(cons(z0, z1)) → cons(z0, n__filter(z0, n__sieve(activate(z1))))
sieve(z0) → n__sieve(z0)
s(z0) → n__s(z0)
cons(z0, z1) → n__cons(z0, z1)
activate(n__from(z0)) → from(activate(z0))
activate(n__s(z0)) → s(activate(z0))
activate(n__filter(z0, z1)) → filter(activate(z0), activate(z1))
activate(n__cons(z0, z1)) → cons(activate(z0), z1)
activate(n__sieve(z0)) → sieve(activate(z0))
activate(z0) → z0
(8) Obligation:
Complexity Dependency Tuples Problem
Rules:none
Tuples:
ACTIVATE(n__from(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(ACTIVATE(z0))
ACTIVATE(n__sieve(z0)) → c17(ACTIVATE(z0))
S tuples:
ACTIVATE(n__from(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(ACTIVATE(z0))
ACTIVATE(n__sieve(z0)) → c17(ACTIVATE(z0))
K tuples:none
Defined Rule Symbols:none
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c13, c14, c15, c16, c17
(9) CdtRuleRemovalProof (UPPER BOUND (ADD(O(n^1))) transformation)
Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.
ACTIVATE(n__from(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(ACTIVATE(z0))
We considered the (Usable) Rules:none
And the Tuples:
ACTIVATE(n__from(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(ACTIVATE(z0))
ACTIVATE(n__sieve(z0)) → c17(ACTIVATE(z0))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(ACTIVATE(x1)) = [2] + [2]x1
POL(c13(x1)) = x1
POL(c14(x1)) = x1
POL(c15(x1, x2)) = x1 + x2
POL(c16(x1)) = x1
POL(c17(x1)) = x1
POL(n__cons(x1, x2)) = [4] + x1
POL(n__filter(x1, x2)) = [2] + x1 + x2
POL(n__from(x1)) = [2] + x1
POL(n__s(x1)) = [2] + x1
POL(n__sieve(x1)) = x1
(10) Obligation:
Complexity Dependency Tuples Problem
Rules:none
Tuples:
ACTIVATE(n__from(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(ACTIVATE(z0))
ACTIVATE(n__sieve(z0)) → c17(ACTIVATE(z0))
S tuples:
ACTIVATE(n__sieve(z0)) → c17(ACTIVATE(z0))
K tuples:
ACTIVATE(n__from(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(ACTIVATE(z0))
Defined Rule Symbols:none
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c13, c14, c15, c16, c17
(11) CdtRuleRemovalProof (UPPER BOUND (ADD(O(n^1))) transformation)
Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.
ACTIVATE(n__sieve(z0)) → c17(ACTIVATE(z0))
We considered the (Usable) Rules:none
And the Tuples:
ACTIVATE(n__from(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(ACTIVATE(z0))
ACTIVATE(n__sieve(z0)) → c17(ACTIVATE(z0))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(ACTIVATE(x1)) = [3] + x1
POL(c13(x1)) = x1
POL(c14(x1)) = x1
POL(c15(x1, x2)) = x1 + x2
POL(c16(x1)) = x1
POL(c17(x1)) = x1
POL(n__cons(x1, x2)) = x1
POL(n__filter(x1, x2)) = [4] + x1 + x2
POL(n__from(x1)) = x1
POL(n__s(x1)) = x1
POL(n__sieve(x1)) = [1] + x1
(12) Obligation:
Complexity Dependency Tuples Problem
Rules:none
Tuples:
ACTIVATE(n__from(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(ACTIVATE(z0))
ACTIVATE(n__sieve(z0)) → c17(ACTIVATE(z0))
S tuples:none
K tuples:
ACTIVATE(n__from(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
ACTIVATE(n__filter(z0, z1)) → c15(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__cons(z0, z1)) → c16(ACTIVATE(z0))
ACTIVATE(n__sieve(z0)) → c17(ACTIVATE(z0))
Defined Rule Symbols:none
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c13, c14, c15, c16, c17
(13) SIsEmptyProof (BOTH BOUNDS(ID, ID) transformation)
The set S is empty
(14) BOUNDS(O(1), O(1))