(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 Cpx (relative) TRS 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))
FACT(z0) → c1
ADD(0, z0) → c2
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))
PROD(z0, z1) → c6
IF(true, z0, z1) → c7(ACTIVATE(z0))
IF(false, z0, z1) → c8(ACTIVATE(z1))
ZERO(0) → c9
ZERO(s(z0)) → c10
P(s(z0)) → c11
P(z0) → c12
S(z0) → c13
0' → c14
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))
ACTIVATE(z0) → c20
S tuples:
FACT(z0) → c(IF(zero(z0), n__s(n__0), n__prod(z0, n__fact(n__p(z0)))), ZERO(z0))
FACT(z0) → c1
ADD(0, z0) → c2
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))
PROD(z0, z1) → c6
IF(true, z0, z1) → c7(ACTIVATE(z0))
IF(false, z0, z1) → c8(ACTIVATE(z1))
ZERO(0) → c9
ZERO(s(z0)) → c10
P(s(z0)) → c11
P(z0) → c12
S(z0) → c13
0' → c14
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))
ACTIVATE(z0) → c20
K tuples:none
Defined Rule Symbols:
fact, add, prod, if, zero, p, s, 0, activate
Defined Pair Symbols:
FACT, ADD, PROD, IF, ZERO, P, S, 0', ACTIVATE
Compound Symbols:
c, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20
(3) CdtLeafRemovalProof (ComplexityIfPolyImplication transformation)
Removed 2 leading nodes:
IF(true, z0, z1) → c7(ACTIVATE(z0))
IF(false, z0, z1) → c8(ACTIVATE(z1))
Removed 15 trailing nodes:
P(z0) → c12
ZERO(s(z0)) → c10
ADD(s(z0), z1) → c3(S(add(z0, z1)), ADD(z0, z1))
ADD(0, z0) → c2
P(s(z0)) → c11
FACT(z0) → c1
0' → c14
PROD(0, z0) → c4(0')
ACTIVATE(z0) → c20
S(z0) → c13
ACTIVATE(n__0) → c16(0')
ZERO(0) → c9
FACT(z0) → c(IF(zero(z0), n__s(n__0), n__prod(z0, n__fact(n__p(z0)))), ZERO(z0))
PROD(s(z0), z1) → c5(ADD(z1, prod(z0, z1)), PROD(z0, z1))
PROD(z0, z1) → c6
(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:
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
(5) CdtRhsSimplificationProcessorProof (BOTH BOUNDS(ID, ID) transformation)
Removed 4 trailing tuple parts
(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(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
(7) CdtUsableRulesProof (EQUIVALENT transformation)
The following rules are not usable and were removed:
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
(8) Obligation:
Complexity Dependency Tuples Problem
Rules:none
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:none
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c15, c17, c18, c19
(9) CdtRuleRemovalProof (UPPER BOUND(ADD(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)) = 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)) = [1] + x1
POL(n__prod(x1, x2)) = [1] + x1 + x2
POL(n__s(x1)) = [1] + x1
(10) Obligation:
Complexity Dependency Tuples Problem
Rules:none
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__fact(z0)) → c18(ACTIVATE(z0))
K 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))
Defined Rule Symbols:none
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c15, c17, c18, c19
(11) CdtRuleRemovalProof (UPPER BOUND(ADD(n^2)) 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)) = [1] + x1 + x12
POL(c15(x1)) = x1
POL(c17(x1, x2)) = x1 + x2
POL(c18(x1)) = x1
POL(c19(x1)) = x1
POL(n__fact(x1)) = [1] + x1
POL(n__p(x1)) = [1] + x1
POL(n__prod(x1, x2)) = [1] + x1 + x2
POL(n__s(x1)) = [1] + x1
(12) Obligation:
Complexity Dependency Tuples Problem
Rules:none
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__s(z0)) → c15(ACTIVATE(z0))
ACTIVATE(n__prod(z0, z1)) → c17(ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__p(z0)) → c19(ACTIVATE(z0))
ACTIVATE(n__fact(z0)) → c18(ACTIVATE(z0))
Defined Rule Symbols:none
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c15, c17, c18, c19
(13) SIsEmptyProof (BOTH BOUNDS(ID, ID) transformation)
The set S is empty
(14) BOUNDS(1, 1)