### (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))))
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)
0n__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)
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)
0n__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
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
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)

IF(true, z0, z1) → c7(ACTIVATE(z0))
IF(false, z0, z1) → c8(ACTIVATE(z1))
Removed 15 trailing nodes:

P(s(z0)) → c11
PROD(s(z0), z1) → c5(ADD(z1, prod(z0, z1)), PROD(z0, z1))
P(z0) → c12
ZERO(0) → c9
S(z0) → c13
PROD(z0, z1) → c6
ZERO(s(z0)) → c10
FACT(z0) → c(IF(zero(z0), n__s(n__0), n__prod(z0, n__fact(n__p(z0)))), ZERO(z0))
0'c14
FACT(z0) → c1
PROD(0, z0) → c4(0')
ACTIVATE(z0) → c20
ACTIVATE(n__0) → c16(0')

### (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)
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)
0n__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)
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)
0n__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)
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)
0n__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(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__fact(z0)) → c18(ACTIVATE(z0))
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)) = [2] + x1
POL(n__p(x1)) = [4] + x1
POL(n__prod(x1, x2)) = [5] + x1 + x2
POL(n__s(x1)) = [4] + 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:none
K 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))
Defined Rule Symbols:none

Defined Pair Symbols:

ACTIVATE

Compound Symbols:

c15, c17, c18, c19

### (11) SIsEmptyProof (BOTH BOUNDS(ID, ID) transformation)

The set S is empty