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


Renamed function symbols to avoid clashes with predefined symbol.


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


Infered types.


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))

Types:
nonZero' :: 0':s' → false':true'
0' :: 0':s'
false' :: false':true'
s' :: 0':s' → 0':s'
true' :: false':true'
p' :: 0':s' → 0':s'
id_inc' :: 0':s' → 0':s'
random' :: 0':s' → 0':s'
rand' :: 0':s' → 0':s' → 0':s'
if' :: false':true' → 0':s' → 0':s' → 0':s'
_hole_false':true'1 :: false':true'
_hole_0':s'2 :: 0':s'
_gen_0':s'3 :: Nat → 0':s'


Heuristically decided to analyse the following defined symbols:
rand'


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))

Types:
nonZero' :: 0':s' → false':true'
0' :: 0':s'
false' :: false':true'
s' :: 0':s' → 0':s'
true' :: false':true'
p' :: 0':s' → 0':s'
id_inc' :: 0':s' → 0':s'
random' :: 0':s' → 0':s'
rand' :: 0':s' → 0':s' → 0':s'
if' :: false':true' → 0':s' → 0':s' → 0':s'
_hole_false':true'1 :: false':true'
_hole_0':s'2 :: 0':s'
_gen_0':s'3 :: Nat → 0':s'

Generator Equations:
_gen_0':s'3(0) ⇔ 0'
_gen_0':s'3(+(x, 1)) ⇔ s'(_gen_0':s'3(x))

The following defined symbols remain to be analysed:
rand'


Proved the following rewrite lemma:
rand'(_gen_0':s'3(_n5), _gen_0':s'3(b)) → _gen_0':s'3(b), rt ∈ Ω(1 + n5)

Induction Base:
rand'(_gen_0':s'3(0), _gen_0':s'3(b)) →RΩ(1)
if'(nonZero'(_gen_0':s'3(0)), _gen_0':s'3(0), _gen_0':s'3(b)) →RΩ(1)
if'(false', _gen_0':s'3(0), _gen_0':s'3(b)) →RΩ(1)
_gen_0':s'3(b)

Induction Step:
rand'(_gen_0':s'3(+(_$n6, 1)), _gen_0':s'3(_b212)) →RΩ(1)
if'(nonZero'(_gen_0':s'3(+(_$n6, 1))), _gen_0':s'3(+(_$n6, 1)), _gen_0':s'3(_b212)) →RΩ(1)
if'(true', _gen_0':s'3(+(1, _$n6)), _gen_0':s'3(_b212)) →RΩ(1)
rand'(p'(_gen_0':s'3(+(1, _$n6))), id_inc'(_gen_0':s'3(_b212))) →RΩ(1)
rand'(_gen_0':s'3(_$n6), id_inc'(_gen_0':s'3(_b212))) →RΩ(1)
rand'(_gen_0':s'3(_$n6), _gen_0':s'3(_b212)) →IH
_gen_0':s'3(_b212)

We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).


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))

Types:
nonZero' :: 0':s' → false':true'
0' :: 0':s'
false' :: false':true'
s' :: 0':s' → 0':s'
true' :: false':true'
p' :: 0':s' → 0':s'
id_inc' :: 0':s' → 0':s'
random' :: 0':s' → 0':s'
rand' :: 0':s' → 0':s' → 0':s'
if' :: false':true' → 0':s' → 0':s' → 0':s'
_hole_false':true'1 :: false':true'
_hole_0':s'2 :: 0':s'
_gen_0':s'3 :: Nat → 0':s'

Lemmas:
rand'(_gen_0':s'3(_n5), _gen_0':s'3(b)) → _gen_0':s'3(b), rt ∈ Ω(1 + n5)

Generator Equations:
_gen_0':s'3(0) ⇔ 0'
_gen_0':s'3(+(x, 1)) ⇔ s'(_gen_0':s'3(x))

No more defined symbols left to analyse.


The lowerbound Ω(n) was proven with the following lemma:
rand'(_gen_0':s'3(_n5), _gen_0':s'3(b)) → _gen_0':s'3(b), rt ∈ Ω(1 + n5)