(0) Obligation:

Runtime Complexity TRS:
The TRS R consists of the following rules:

nonZero(0) → false
nonZero(s(x)) → true
p(0) → 0
p(s(x)) → x
id_inc(x) → x
id_inc(x) → s(x)
random(x) → rand(x, 0)
rand(x, y) → if(nonZero(x), x, y)
if(false, x, y) → y
if(true, x, y) → rand(p(x), id_inc(y))

Rewrite Strategy: INNERMOST

(1) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)

Converted CpxTRS to CDT

(2) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RANDOM(z0) → c6(RAND(z0, 0))
RAND(z0, z1) → c7(IF(nonZero(z0), z0, z1), NONZERO(z0))
IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)), P(z0), ID_INC(z1))
S tuples:

RANDOM(z0) → c6(RAND(z0, 0))
RAND(z0, z1) → c7(IF(nonZero(z0), z0, z1), NONZERO(z0))
IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)), P(z0), ID_INC(z1))
K tuples:none
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RANDOM, RAND, IF

Compound Symbols:

c6, c7, c9

(3) CdtLeafRemovalProof (ComplexityIfPolyImplication transformation)

Removed 1 leading nodes:

RANDOM(z0) → c6(RAND(z0, 0))

(4) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(z0, z1) → c7(IF(nonZero(z0), z0, z1), NONZERO(z0))
IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)), P(z0), ID_INC(z1))
S tuples:

RAND(z0, z1) → c7(IF(nonZero(z0), z0, z1), NONZERO(z0))
IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)), P(z0), ID_INC(z1))
K tuples:none
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9

(5) CdtRhsSimplificationProcessorProof (BOTH BOUNDS(ID, ID) transformation)

Removed 3 trailing tuple parts

(6) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(z0, z1) → c7(IF(nonZero(z0), z0, z1))
IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)))
S tuples:

RAND(z0, z1) → c7(IF(nonZero(z0), z0, z1))
IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)))
K tuples:none
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9

(7) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)

Use narrowing to replace RAND(z0, z1) → c7(IF(nonZero(z0), z0, z1)) by

RAND(0, x1) → c7(IF(false, 0, x1))
RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
RAND(x0, x1) → c7

(8) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)))
RAND(0, x1) → c7(IF(false, 0, x1))
RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
RAND(x0, x1) → c7
S tuples:

IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)))
RAND(0, x1) → c7(IF(false, 0, x1))
RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
RAND(x0, x1) → c7
K tuples:none
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

IF, RAND

Compound Symbols:

c9, c7, c7

(9) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)

Removed 2 trailing nodes:

RAND(0, x1) → c7(IF(false, 0, x1))
RAND(x0, x1) → c7

(10) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)))
RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
S tuples:

IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)))
RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
K tuples:none
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

IF, RAND

Compound Symbols:

c9, c7

(11) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)

Use narrowing to replace IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1))) by

IF(true, x0, z0) → c9(RAND(p(x0), z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
IF(true, 0, x1) → c9(RAND(0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, x0, x1) → c9

(12) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, x0, z0) → c9(RAND(p(x0), z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
IF(true, 0, x1) → c9(RAND(0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, x0, x1) → c9
S tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, x0, z0) → c9(RAND(p(x0), z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
IF(true, 0, x1) → c9(RAND(0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, x0, x1) → c9
K tuples:none
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9, c9

(13) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)

Removed 2 trailing nodes:

IF(true, x0, x1) → c9
IF(true, 0, x1) → c9(RAND(0, id_inc(x1)))

(14) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, x0, z0) → c9(RAND(p(x0), z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
S tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, x0, z0) → c9(RAND(p(x0), z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
K tuples:none
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9

(15) 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.

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
We considered the (Usable) Rules:

id_inc(z0) → z0
id_inc(z0) → s(z0)
p(0) → 0
p(s(z0)) → z0
And the Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, x0, z0) → c9(RAND(p(x0), z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(0) = 0   
POL(IF(x1, x2, x3)) = [3]x1 + x2   
POL(RAND(x1, x2)) = x1   
POL(c7(x1)) = x1   
POL(c9(x1)) = x1   
POL(id_inc(x1)) = [2] + [2]x1   
POL(p(x1)) = x1   
POL(s(x1)) = [1] + x1   
POL(true) = 0   

(16) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, x0, z0) → c9(RAND(p(x0), z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
S tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, x0, z0) → c9(RAND(p(x0), z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9

(17) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)

Use narrowing to replace IF(true, x0, z0) → c9(RAND(p(x0), z0)) by

IF(true, 0, x1) → c9(RAND(0, x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
IF(true, x0, x1) → c9

(18) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, 0, x1) → c9(RAND(0, x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
IF(true, x0, x1) → c9
S tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
IF(true, 0, x1) → c9(RAND(0, x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
IF(true, x0, x1) → c9
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9, c9

(19) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)

Removed 2 trailing nodes:

IF(true, x0, x1) → c9
IF(true, 0, x1) → c9(RAND(0, x1))

(20) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
S tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9

(21) 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.

IF(true, s(z0), x1) → c9(RAND(z0, x1))
We considered the (Usable) Rules:

id_inc(z0) → z0
id_inc(z0) → s(z0)
p(0) → 0
p(s(z0)) → z0
And the Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(0) = [3]   
POL(IF(x1, x2, x3)) = [3]x1 + [2]x2   
POL(RAND(x1, x2)) = [2]x1   
POL(c7(x1)) = x1   
POL(c9(x1)) = x1   
POL(id_inc(x1)) = [5] + [2]x1   
POL(p(x1)) = x1   
POL(s(x1)) = [2] + x1   
POL(true) = 0   

(22) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
S tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)))
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9

(23) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)

Use narrowing to replace IF(true, x0, z0) → c9(RAND(p(x0), s(z0))) by

IF(true, 0, x1) → c9(RAND(0, s(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)))
IF(true, x0, x1) → c9

(24) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
IF(true, 0, x1) → c9(RAND(0, s(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)))
IF(true, x0, x1) → c9
S tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, 0, x1) → c9(RAND(0, s(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)))
IF(true, x0, x1) → c9
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9, c9

(25) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)

Removed 2 trailing nodes:

IF(true, 0, x1) → c9(RAND(0, s(x1)))
IF(true, x0, x1) → c9

(26) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)))
S tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)))
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9

(27) 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.

IF(true, s(z0), x1) → c9(RAND(z0, s(x1)))
We considered the (Usable) Rules:

id_inc(z0) → z0
id_inc(z0) → s(z0)
And the Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(IF(x1, x2, x3)) = [3]x1 + [4]x2   
POL(RAND(x1, x2)) = [4]x1   
POL(c7(x1)) = x1   
POL(c9(x1)) = x1   
POL(id_inc(x1)) = [2] + [3]x1   
POL(s(x1)) = [2] + x1   
POL(true) = 0   

(28) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)))
S tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9

(29) CdtKnowledgeProof (EQUIVALENT transformation)

The following tuples could be moved from S to K by knowledge propagation:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)))
IF(true, s(z0), x1) → c9(RAND(z0, x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)))
Now S is empty

(30) BOUNDS(O(1), O(1))