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

times(x, y) → sum(generate(x, y))
generate(x, y) → gen(x, y, 0)
gen(x, y, z) → if(ge(z, x), x, y, z)
if(true, x, y, z) → nil
if(false, x, y, z) → cons(y, gen(x, y, s(z)))
sum(nil) → 0
sum(cons(0, xs)) → sum(xs)
sum(cons(s(x), xs)) → s(sum(cons(x, xs)))
ge(x, 0) → true
ge(0, s(y)) → false
ge(s(x), s(y)) → ge(x, y)

Rewrite Strategy: INNERMOST


Renamed function symbols to avoid clashes with predefined symbol.


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


times'(x, y) → sum'(generate'(x, y))
generate'(x, y) → gen'(x, y, 0')
gen'(x, y, z) → if'(ge'(z, x), x, y, z)
if'(true', x, y, z) → nil'
if'(false', x, y, z) → cons'(y, gen'(x, y, s'(z)))
sum'(nil') → 0'
sum'(cons'(0', xs)) → sum'(xs)
sum'(cons'(s'(x), xs)) → s'(sum'(cons'(x, xs)))
ge'(x, 0') → true'
ge'(0', s'(y)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)

Rewrite Strategy: INNERMOST


Infered types.


Rules:
times'(x, y) → sum'(generate'(x, y))
generate'(x, y) → gen'(x, y, 0')
gen'(x, y, z) → if'(ge'(z, x), x, y, z)
if'(true', x, y, z) → nil'
if'(false', x, y, z) → cons'(y, gen'(x, y, s'(z)))
sum'(nil') → 0'
sum'(cons'(0', xs)) → sum'(xs)
sum'(cons'(s'(x), xs)) → s'(sum'(cons'(x, xs)))
ge'(x, 0') → true'
ge'(0', s'(y)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)

Types:
times' :: 0':s' → 0':s' → 0':s'
sum' :: nil':cons' → 0':s'
generate' :: 0':s' → 0':s' → nil':cons'
gen' :: 0':s' → 0':s' → 0':s' → nil':cons'
0' :: 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s' → nil':cons'
ge' :: 0':s' → 0':s' → true':false'
true' :: true':false'
nil' :: nil':cons'
false' :: true':false'
cons' :: 0':s' → nil':cons' → nil':cons'
s' :: 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_gen_0':s'4 :: Nat → 0':s'
_gen_nil':cons'5 :: Nat → nil':cons'


Heuristically decided to analyse the following defined symbols:
sum', gen', ge'

They will be analysed ascendingly in the following order:
ge' < gen'


Rules:
times'(x, y) → sum'(generate'(x, y))
generate'(x, y) → gen'(x, y, 0')
gen'(x, y, z) → if'(ge'(z, x), x, y, z)
if'(true', x, y, z) → nil'
if'(false', x, y, z) → cons'(y, gen'(x, y, s'(z)))
sum'(nil') → 0'
sum'(cons'(0', xs)) → sum'(xs)
sum'(cons'(s'(x), xs)) → s'(sum'(cons'(x, xs)))
ge'(x, 0') → true'
ge'(0', s'(y)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)

Types:
times' :: 0':s' → 0':s' → 0':s'
sum' :: nil':cons' → 0':s'
generate' :: 0':s' → 0':s' → nil':cons'
gen' :: 0':s' → 0':s' → 0':s' → nil':cons'
0' :: 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s' → nil':cons'
ge' :: 0':s' → 0':s' → true':false'
true' :: true':false'
nil' :: nil':cons'
false' :: true':false'
cons' :: 0':s' → nil':cons' → nil':cons'
s' :: 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_gen_0':s'4 :: Nat → 0':s'
_gen_nil':cons'5 :: Nat → nil':cons'

Generator Equations:
_gen_0':s'4(0) ⇔ 0'
_gen_0':s'4(+(x, 1)) ⇔ s'(_gen_0':s'4(x))
_gen_nil':cons'5(0) ⇔ nil'
_gen_nil':cons'5(+(x, 1)) ⇔ cons'(0', _gen_nil':cons'5(x))

The following defined symbols remain to be analysed:
sum', gen', ge'

They will be analysed ascendingly in the following order:
ge' < gen'


Proved the following rewrite lemma:
sum'(_gen_nil':cons'5(_n7)) → _gen_0':s'4(0), rt ∈ Ω(1 + n7)

Induction Base:
sum'(_gen_nil':cons'5(0)) →RΩ(1)
0'

Induction Step:
sum'(_gen_nil':cons'5(+(_$n8, 1))) →RΩ(1)
sum'(_gen_nil':cons'5(_$n8)) →IH
_gen_0':s'4(0)

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


Rules:
times'(x, y) → sum'(generate'(x, y))
generate'(x, y) → gen'(x, y, 0')
gen'(x, y, z) → if'(ge'(z, x), x, y, z)
if'(true', x, y, z) → nil'
if'(false', x, y, z) → cons'(y, gen'(x, y, s'(z)))
sum'(nil') → 0'
sum'(cons'(0', xs)) → sum'(xs)
sum'(cons'(s'(x), xs)) → s'(sum'(cons'(x, xs)))
ge'(x, 0') → true'
ge'(0', s'(y)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)

Types:
times' :: 0':s' → 0':s' → 0':s'
sum' :: nil':cons' → 0':s'
generate' :: 0':s' → 0':s' → nil':cons'
gen' :: 0':s' → 0':s' → 0':s' → nil':cons'
0' :: 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s' → nil':cons'
ge' :: 0':s' → 0':s' → true':false'
true' :: true':false'
nil' :: nil':cons'
false' :: true':false'
cons' :: 0':s' → nil':cons' → nil':cons'
s' :: 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_gen_0':s'4 :: Nat → 0':s'
_gen_nil':cons'5 :: Nat → nil':cons'

Lemmas:
sum'(_gen_nil':cons'5(_n7)) → _gen_0':s'4(0), rt ∈ Ω(1 + n7)

Generator Equations:
_gen_0':s'4(0) ⇔ 0'
_gen_0':s'4(+(x, 1)) ⇔ s'(_gen_0':s'4(x))
_gen_nil':cons'5(0) ⇔ nil'
_gen_nil':cons'5(+(x, 1)) ⇔ cons'(0', _gen_nil':cons'5(x))

The following defined symbols remain to be analysed:
ge', gen'

They will be analysed ascendingly in the following order:
ge' < gen'


Proved the following rewrite lemma:
ge'(_gen_0':s'4(_n487), _gen_0':s'4(_n487)) → true', rt ∈ Ω(1 + n487)

Induction Base:
ge'(_gen_0':s'4(0), _gen_0':s'4(0)) →RΩ(1)
true'

Induction Step:
ge'(_gen_0':s'4(+(_$n488, 1)), _gen_0':s'4(+(_$n488, 1))) →RΩ(1)
ge'(_gen_0':s'4(_$n488), _gen_0':s'4(_$n488)) →IH
true'

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


Rules:
times'(x, y) → sum'(generate'(x, y))
generate'(x, y) → gen'(x, y, 0')
gen'(x, y, z) → if'(ge'(z, x), x, y, z)
if'(true', x, y, z) → nil'
if'(false', x, y, z) → cons'(y, gen'(x, y, s'(z)))
sum'(nil') → 0'
sum'(cons'(0', xs)) → sum'(xs)
sum'(cons'(s'(x), xs)) → s'(sum'(cons'(x, xs)))
ge'(x, 0') → true'
ge'(0', s'(y)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)

Types:
times' :: 0':s' → 0':s' → 0':s'
sum' :: nil':cons' → 0':s'
generate' :: 0':s' → 0':s' → nil':cons'
gen' :: 0':s' → 0':s' → 0':s' → nil':cons'
0' :: 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s' → nil':cons'
ge' :: 0':s' → 0':s' → true':false'
true' :: true':false'
nil' :: nil':cons'
false' :: true':false'
cons' :: 0':s' → nil':cons' → nil':cons'
s' :: 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_gen_0':s'4 :: Nat → 0':s'
_gen_nil':cons'5 :: Nat → nil':cons'

Lemmas:
sum'(_gen_nil':cons'5(_n7)) → _gen_0':s'4(0), rt ∈ Ω(1 + n7)
ge'(_gen_0':s'4(_n487), _gen_0':s'4(_n487)) → true', rt ∈ Ω(1 + n487)

Generator Equations:
_gen_0':s'4(0) ⇔ 0'
_gen_0':s'4(+(x, 1)) ⇔ s'(_gen_0':s'4(x))
_gen_nil':cons'5(0) ⇔ nil'
_gen_nil':cons'5(+(x, 1)) ⇔ cons'(0', _gen_nil':cons'5(x))

The following defined symbols remain to be analysed:
gen'


Could not prove a rewrite lemma for the defined symbol gen'.


Rules:
times'(x, y) → sum'(generate'(x, y))
generate'(x, y) → gen'(x, y, 0')
gen'(x, y, z) → if'(ge'(z, x), x, y, z)
if'(true', x, y, z) → nil'
if'(false', x, y, z) → cons'(y, gen'(x, y, s'(z)))
sum'(nil') → 0'
sum'(cons'(0', xs)) → sum'(xs)
sum'(cons'(s'(x), xs)) → s'(sum'(cons'(x, xs)))
ge'(x, 0') → true'
ge'(0', s'(y)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)

Types:
times' :: 0':s' → 0':s' → 0':s'
sum' :: nil':cons' → 0':s'
generate' :: 0':s' → 0':s' → nil':cons'
gen' :: 0':s' → 0':s' → 0':s' → nil':cons'
0' :: 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s' → nil':cons'
ge' :: 0':s' → 0':s' → true':false'
true' :: true':false'
nil' :: nil':cons'
false' :: true':false'
cons' :: 0':s' → nil':cons' → nil':cons'
s' :: 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_gen_0':s'4 :: Nat → 0':s'
_gen_nil':cons'5 :: Nat → nil':cons'

Lemmas:
sum'(_gen_nil':cons'5(_n7)) → _gen_0':s'4(0), rt ∈ Ω(1 + n7)
ge'(_gen_0':s'4(_n487), _gen_0':s'4(_n487)) → true', rt ∈ Ω(1 + n487)

Generator Equations:
_gen_0':s'4(0) ⇔ 0'
_gen_0':s'4(+(x, 1)) ⇔ s'(_gen_0':s'4(x))
_gen_nil':cons'5(0) ⇔ nil'
_gen_nil':cons'5(+(x, 1)) ⇔ cons'(0', _gen_nil':cons'5(x))

No more defined symbols left to analyse.


The lowerbound Ω(n) was proven with the following lemma:
sum'(_gen_nil':cons'5(_n7)) → _gen_0':s'4(0), rt ∈ Ω(1 + n7)