(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
fact(X) → if(zero(X), n__s(n__0), n__prod(X, n__fact(n__p(X))))
add(0, X) → X
add(s(X), Y) → s(add(X, Y))
prod(0, X) → 0
prod(s(X), Y) → add(Y, prod(X, Y))
if(true, X, Y) → activate(X)
if(false, X, Y) → activate(Y)
zero(0) → true
zero(s(X)) → false
p(s(X)) → X
s(X) → n__s(X)
0 → n__0
prod(X1, X2) → n__prod(X1, X2)
fact(X) → n__fact(X)
p(X) → n__p(X)
activate(n__s(X)) → s(activate(X))
activate(n__0) → 0
activate(n__prod(X1, X2)) → prod(activate(X1), activate(X2))
activate(n__fact(X)) → fact(activate(X))
activate(n__p(X)) → p(activate(X))
activate(X) → X
Rewrite Strategy: INNERMOST
(1) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)
Converted CpxTRS to CDT
(2) Obligation:
Complexity Dependency Tuples Problem
Rules:
fact(z0) → if(zero(z0), n__s(n__0), n__prod(z0, n__fact(n__p(z0))))
fact(z0) → n__fact(z0)
add(0, z0) → z0
add(s(z0), z1) → s(add(z0, z1))
prod(0, z0) → 0
prod(s(z0), z1) → add(z1, prod(z0, z1))
prod(z0, z1) → n__prod(z0, z1)
if(true, z0, z1) → activate(z0)
if(false, z0, z1) → activate(z1)
zero(0) → true
zero(s(z0)) → false
p(s(z0)) → z0
p(z0) → n__p(z0)
s(z0) → n__s(z0)
0 → n__0
activate(n__s(z0)) → s(activate(z0))
activate(n__0) → 0
activate(n__prod(z0, z1)) → prod(activate(z0), activate(z1))
activate(n__fact(z0)) → fact(activate(z0))
activate(n__p(z0)) → p(activate(z0))
activate(z0) → z0
Tuples:
FACT(z0) → c(IF(zero(z0), n__s(n__0), n__prod(z0, n__fact(n__p(z0)))), ZERO(z0))
ADD(s(z0), z1) → c3(S(add(z0, z1)), ADD(z0, z1))
PROD(0, z0) → c4(0')
PROD(s(z0), z1) → c5(ADD(z1, prod(z0, z1)), PROD(z0, z1))
IF(true, z0, z1) → c7(ACTIVATE(z0))
IF(false, z0, z1) → c8(ACTIVATE(z1))
ACTIVATE(n__s(z0)) → c15(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__0) → c16(0')
ACTIVATE(n__prod(z0, z1)) → c17(PROD(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__fact(z0)) → c18(FACT(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__p(z0)) → c19(P(activate(z0)), ACTIVATE(z0))
S tuples:
FACT(z0) → c(IF(zero(z0), n__s(n__0), n__prod(z0, n__fact(n__p(z0)))), ZERO(z0))
ADD(s(z0), z1) → c3(S(add(z0, z1)), ADD(z0, z1))
PROD(0, z0) → c4(0')
PROD(s(z0), z1) → c5(ADD(z1, prod(z0, z1)), PROD(z0, z1))
IF(true, z0, z1) → c7(ACTIVATE(z0))
IF(false, z0, z1) → c8(ACTIVATE(z1))
ACTIVATE(n__s(z0)) → c15(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__0) → c16(0')
ACTIVATE(n__prod(z0, z1)) → c17(PROD(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__fact(z0)) → c18(FACT(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__p(z0)) → c19(P(activate(z0)), ACTIVATE(z0))
K tuples:none
Defined Rule Symbols:
fact, add, prod, if, zero, p, s, 0, activate
Defined Pair Symbols:
FACT, ADD, PROD, IF, ACTIVATE
Compound Symbols:
c, c3, c4, c5, c7, c8, c15, c16, c17, c18, c19
(3) CdtUnreachableProof (EQUIVALENT transformation)
The following tuples could be removed as they are not reachable from basic start terms:
ADD(s(z0), z1) → c3(S(add(z0, z1)), ADD(z0, z1))
PROD(0, z0) → c4(0')
PROD(s(z0), z1) → c5(ADD(z1, prod(z0, z1)), PROD(z0, z1))
(4) Obligation:
Complexity Dependency Tuples Problem
Rules:
fact(z0) → if(zero(z0), n__s(n__0), n__prod(z0, n__fact(n__p(z0))))
fact(z0) → n__fact(z0)
add(0, z0) → z0
add(s(z0), z1) → s(add(z0, z1))
prod(0, z0) → 0
prod(s(z0), z1) → add(z1, prod(z0, z1))
prod(z0, z1) → n__prod(z0, z1)
if(true, z0, z1) → activate(z0)
if(false, z0, z1) → activate(z1)
zero(0) → true
zero(s(z0)) → false
p(s(z0)) → z0
p(z0) → n__p(z0)
s(z0) → n__s(z0)
0 → n__0
activate(n__s(z0)) → s(activate(z0))
activate(n__0) → 0
activate(n__prod(z0, z1)) → prod(activate(z0), activate(z1))
activate(n__fact(z0)) → fact(activate(z0))
activate(n__p(z0)) → p(activate(z0))
activate(z0) → z0
Tuples:
FACT(z0) → c(IF(zero(z0), n__s(n__0), n__prod(z0, n__fact(n__p(z0)))), ZERO(z0))
IF(true, z0, z1) → c7(ACTIVATE(z0))
IF(false, z0, z1) → c8(ACTIVATE(z1))
ACTIVATE(n__s(z0)) → c15(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__0) → c16(0')
ACTIVATE(n__prod(z0, z1)) → c17(PROD(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__fact(z0)) → c18(FACT(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__p(z0)) → c19(P(activate(z0)), ACTIVATE(z0))
S tuples:
FACT(z0) → c(IF(zero(z0), n__s(n__0), n__prod(z0, n__fact(n__p(z0)))), ZERO(z0))
IF(true, z0, z1) → c7(ACTIVATE(z0))
IF(false, z0, z1) → c8(ACTIVATE(z1))
ACTIVATE(n__s(z0)) → c15(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__0) → c16(0')
ACTIVATE(n__prod(z0, z1)) → c17(PROD(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__fact(z0)) → c18(FACT(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__p(z0)) → c19(P(activate(z0)), ACTIVATE(z0))
K tuples:none
Defined Rule Symbols:
fact, add, prod, if, zero, p, s, 0, activate
Defined Pair Symbols:
FACT, IF, ACTIVATE
Compound Symbols:
c, c7, c8, c15, c16, c17, c18, c19
(5) CdtLeafRemovalProof (ComplexityIfPolyImplication transformation)
Removed 2 leading nodes:
IF(true, z0, z1) → c7(ACTIVATE(z0))
IF(false, z0, z1) → c8(ACTIVATE(z1))
Removed 2 trailing nodes:
ACTIVATE(n__0) → c16(0')
FACT(z0) → c(IF(zero(z0), n__s(n__0), n__prod(z0, n__fact(n__p(z0)))), ZERO(z0))
(6) Obligation:
Complexity Dependency Tuples Problem
Rules:
fact(z0) → if(zero(z0), n__s(n__0), n__prod(z0, n__fact(n__p(z0))))
fact(z0) → n__fact(z0)
add(0, z0) → z0
add(s(z0), z1) → s(add(z0, z1))
prod(0, z0) → 0
prod(s(z0), z1) → add(z1, prod(z0, z1))
prod(z0, z1) → n__prod(z0, z1)
if(true, z0, z1) → activate(z0)
if(false, z0, z1) → activate(z1)
zero(0) → true
zero(s(z0)) → false
p(s(z0)) → z0
p(z0) → n__p(z0)
s(z0) → n__s(z0)
0 → n__0
activate(n__s(z0)) → s(activate(z0))
activate(n__0) → 0
activate(n__prod(z0, z1)) → prod(activate(z0), activate(z1))
activate(n__fact(z0)) → fact(activate(z0))
activate(n__p(z0)) → p(activate(z0))
activate(z0) → z0
Tuples:
ACTIVATE(n__s(z0)) → c15(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__prod(z0, z1)) → c17(PROD(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__fact(z0)) → c18(FACT(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__p(z0)) → c19(P(activate(z0)), ACTIVATE(z0))
S tuples:
ACTIVATE(n__s(z0)) → c15(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__prod(z0, z1)) → c17(PROD(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__fact(z0)) → c18(FACT(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__p(z0)) → c19(P(activate(z0)), ACTIVATE(z0))
K tuples:none
Defined Rule Symbols:
fact, add, prod, if, zero, p, s, 0, activate
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c15, c17, c18, c19
(7) CdtRhsSimplificationProcessorProof (BOTH BOUNDS(ID, ID) transformation)
Removed 4 trailing tuple parts
(8) Obligation:
Complexity Dependency Tuples Problem
Rules:
fact(z0) → if(zero(z0), n__s(n__0), n__prod(z0, n__fact(n__p(z0))))
fact(z0) → n__fact(z0)
add(0, z0) → z0
add(s(z0), z1) → s(add(z0, z1))
prod(0, z0) → 0
prod(s(z0), z1) → add(z1, prod(z0, z1))
prod(z0, z1) → n__prod(z0, z1)
if(true, z0, z1) → activate(z0)
if(false, z0, z1) → activate(z1)
zero(0) → true
zero(s(z0)) → false
p(s(z0)) → z0
p(z0) → n__p(z0)
s(z0) → n__s(z0)
0 → n__0
activate(n__s(z0)) → s(activate(z0))
activate(n__0) → 0
activate(n__prod(z0, z1)) → prod(activate(z0), activate(z1))
activate(n__fact(z0)) → fact(activate(z0))
activate(n__p(z0)) → p(activate(z0))
activate(z0) → z0
Tuples:
ACTIVATE(n__s(z0)) → c15(ACTIVATE(z0))
ACTIVATE(n__prod(z0, z1)) → c17(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__fact(z0)) → c18(ACTIVATE(z0))
ACTIVATE(n__p(z0)) → c19(ACTIVATE(z0))
S tuples:
ACTIVATE(n__s(z0)) → c15(ACTIVATE(z0))
ACTIVATE(n__prod(z0, z1)) → c17(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__fact(z0)) → c18(ACTIVATE(z0))
ACTIVATE(n__p(z0)) → c19(ACTIVATE(z0))
K tuples:none
Defined Rule Symbols:
fact, add, prod, if, zero, p, s, 0, activate
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c15, c17, c18, c19
(9) CdtPolyRedPairProof (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__fact(z0)) → c18(ACTIVATE(z0))
We considered the (Usable) Rules:none
And the Tuples:
ACTIVATE(n__s(z0)) → c15(ACTIVATE(z0))
ACTIVATE(n__prod(z0, z1)) → c17(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__fact(z0)) → c18(ACTIVATE(z0))
ACTIVATE(n__p(z0)) → c19(ACTIVATE(z0))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(ACTIVATE(x1)) = [2]x1
POL(c15(x1)) = x1
POL(c17(x1, x2)) = x1 + x2
POL(c18(x1)) = x1
POL(c19(x1)) = x1
POL(n__fact(x1)) = [2] + x1
POL(n__p(x1)) = x1
POL(n__prod(x1, x2)) = x1 + x2
POL(n__s(x1)) = x1
(10) Obligation:
Complexity Dependency Tuples Problem
Rules:
fact(z0) → if(zero(z0), n__s(n__0), n__prod(z0, n__fact(n__p(z0))))
fact(z0) → n__fact(z0)
add(0, z0) → z0
add(s(z0), z1) → s(add(z0, z1))
prod(0, z0) → 0
prod(s(z0), z1) → add(z1, prod(z0, z1))
prod(z0, z1) → n__prod(z0, z1)
if(true, z0, z1) → activate(z0)
if(false, z0, z1) → activate(z1)
zero(0) → true
zero(s(z0)) → false
p(s(z0)) → z0
p(z0) → n__p(z0)
s(z0) → n__s(z0)
0 → n__0
activate(n__s(z0)) → s(activate(z0))
activate(n__0) → 0
activate(n__prod(z0, z1)) → prod(activate(z0), activate(z1))
activate(n__fact(z0)) → fact(activate(z0))
activate(n__p(z0)) → p(activate(z0))
activate(z0) → z0
Tuples:
ACTIVATE(n__s(z0)) → c15(ACTIVATE(z0))
ACTIVATE(n__prod(z0, z1)) → c17(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__fact(z0)) → c18(ACTIVATE(z0))
ACTIVATE(n__p(z0)) → c19(ACTIVATE(z0))
S tuples:
ACTIVATE(n__s(z0)) → c15(ACTIVATE(z0))
ACTIVATE(n__prod(z0, z1)) → c17(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__p(z0)) → c19(ACTIVATE(z0))
K tuples:
ACTIVATE(n__fact(z0)) → c18(ACTIVATE(z0))
Defined Rule Symbols:
fact, add, prod, if, zero, p, s, 0, activate
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c15, c17, c18, c19
(11) CdtPolyRedPairProof (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__s(z0)) → c15(ACTIVATE(z0))
ACTIVATE(n__prod(z0, z1)) → c17(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__p(z0)) → c19(ACTIVATE(z0))
We considered the (Usable) Rules:none
And the Tuples:
ACTIVATE(n__s(z0)) → c15(ACTIVATE(z0))
ACTIVATE(n__prod(z0, z1)) → c17(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__fact(z0)) → c18(ACTIVATE(z0))
ACTIVATE(n__p(z0)) → c19(ACTIVATE(z0))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(ACTIVATE(x1)) = [2] + [4]x1
POL(c15(x1)) = x1
POL(c17(x1, x2)) = x1 + x2
POL(c18(x1)) = x1
POL(c19(x1)) = x1
POL(n__fact(x1)) = x1
POL(n__p(x1)) = [4] + x1
POL(n__prod(x1, x2)) = [5] + x1 + x2
POL(n__s(x1)) = [5] + x1
(12) Obligation:
Complexity Dependency Tuples Problem
Rules:
fact(z0) → if(zero(z0), n__s(n__0), n__prod(z0, n__fact(n__p(z0))))
fact(z0) → n__fact(z0)
add(0, z0) → z0
add(s(z0), z1) → s(add(z0, z1))
prod(0, z0) → 0
prod(s(z0), z1) → add(z1, prod(z0, z1))
prod(z0, z1) → n__prod(z0, z1)
if(true, z0, z1) → activate(z0)
if(false, z0, z1) → activate(z1)
zero(0) → true
zero(s(z0)) → false
p(s(z0)) → z0
p(z0) → n__p(z0)
s(z0) → n__s(z0)
0 → n__0
activate(n__s(z0)) → s(activate(z0))
activate(n__0) → 0
activate(n__prod(z0, z1)) → prod(activate(z0), activate(z1))
activate(n__fact(z0)) → fact(activate(z0))
activate(n__p(z0)) → p(activate(z0))
activate(z0) → z0
Tuples:
ACTIVATE(n__s(z0)) → c15(ACTIVATE(z0))
ACTIVATE(n__prod(z0, z1)) → c17(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__fact(z0)) → c18(ACTIVATE(z0))
ACTIVATE(n__p(z0)) → c19(ACTIVATE(z0))
S tuples:none
K tuples:
ACTIVATE(n__fact(z0)) → c18(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c15(ACTIVATE(z0))
ACTIVATE(n__prod(z0, z1)) → c17(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__p(z0)) → c19(ACTIVATE(z0))
Defined Rule Symbols:
fact, add, prod, if, zero, p, s, 0, activate
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c15, c17, c18, c19
(13) SIsEmptyProof (EQUIVALENT transformation)
The set S is empty
(14) BOUNDS(O(1), O(1))