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(xs) → sum2(xs, 0)
sum2(xs, y) → ifsum(isNil(xs), isZero(head(xs)), xs, y)
ifsum(true, b, xs, y) → y
ifsum(false, b, xs, y) → ifsum2(b, xs, y)
ifsum2(true, xs, y) → sum2(tail(xs), y)
ifsum2(false, xs, y) → sum2(cons(p(head(xs)), tail(xs)), s(y))
isNil(nil) → true
isNil(cons(x, xs)) → false
tail(nil) → nil
tail(cons(x, xs)) → xs
head(cons(x, xs)) → x
head(nil) → error
isZero(0) → true
isZero(s(0)) → false
isZero(s(s(x))) → isZero(s(x))
p(0) → s(s(0))
p(s(0)) → 0
p(s(s(x))) → s(p(s(x)))
ge(x, 0) → true
ge(0, s(y)) → false
ge(s(x), s(y)) → ge(x, y)
ac
ad

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'(xs) → sum2'(xs, 0')
sum2'(xs, y) → ifsum'(isNil'(xs), isZero'(head'(xs)), xs, y)
ifsum'(true', b, xs, y) → y
ifsum'(false', b, xs, y) → ifsum2'(b, xs, y)
ifsum2'(true', xs, y) → sum2'(tail'(xs), y)
ifsum2'(false', xs, y) → sum2'(cons'(p'(head'(xs)), tail'(xs)), s'(y))
isNil'(nil') → true'
isNil'(cons'(x, xs)) → false'
tail'(nil') → nil'
tail'(cons'(x, xs)) → xs
head'(cons'(x, xs)) → x
head'(nil') → error'
isZero'(0') → true'
isZero'(s'(0')) → false'
isZero'(s'(s'(x))) → isZero'(s'(x))
p'(0') → s'(s'(0'))
p'(s'(0')) → 0'
p'(s'(s'(x))) → s'(p'(s'(x)))
ge'(x, 0') → true'
ge'(0', s'(y)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
a'c'
a'd'

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'(xs) → sum2'(xs, 0')
sum2'(xs, y) → ifsum'(isNil'(xs), isZero'(head'(xs)), xs, y)
ifsum'(true', b, xs, y) → y
ifsum'(false', b, xs, y) → ifsum2'(b, xs, y)
ifsum2'(true', xs, y) → sum2'(tail'(xs), y)
ifsum2'(false', xs, y) → sum2'(cons'(p'(head'(xs)), tail'(xs)), s'(y))
isNil'(nil') → true'
isNil'(cons'(x, xs)) → false'
tail'(nil') → nil'
tail'(cons'(x, xs)) → xs
head'(cons'(x, xs)) → x
head'(nil') → error'
isZero'(0') → true'
isZero'(s'(0')) → false'
isZero'(s'(s'(x))) → isZero'(s'(x))
p'(0') → s'(s'(0'))
p'(s'(0')) → 0'
p'(s'(s'(x))) → s'(p'(s'(x)))
ge'(x, 0') → true'
ge'(0', s'(y)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
a'c'
a'd'

Types:
times' :: 0':s':error' → 0':s':error' → 0':s':error'
sum' :: nil':cons' → 0':s':error'
generate' :: 0':s':error' → 0':s':error' → nil':cons'
gen' :: 0':s':error' → 0':s':error' → 0':s':error' → nil':cons'
0' :: 0':s':error'
if' :: true':false' → 0':s':error' → 0':s':error' → 0':s':error' → nil':cons'
ge' :: 0':s':error' → 0':s':error' → true':false'
true' :: true':false'
nil' :: nil':cons'
false' :: true':false'
cons' :: 0':s':error' → nil':cons' → nil':cons'
s' :: 0':s':error' → 0':s':error'
sum2' :: nil':cons' → 0':s':error' → 0':s':error'
ifsum' :: true':false' → true':false' → nil':cons' → 0':s':error' → 0':s':error'
isNil' :: nil':cons' → true':false'
isZero' :: 0':s':error' → true':false'
head' :: nil':cons' → 0':s':error'
ifsum2' :: true':false' → nil':cons' → 0':s':error' → 0':s':error'
tail' :: nil':cons' → nil':cons'
p' :: 0':s':error' → 0':s':error'
error' :: 0':s':error'
a' :: c':d'
c' :: c':d'
d' :: c':d'
_hole_0':s':error'1 :: 0':s':error'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_hole_c':d'4 :: c':d'
_gen_0':s':error'5 :: Nat → 0':s':error'
_gen_nil':cons'6 :: Nat → nil':cons'


Heuristically decided to analyse the following defined symbols:
gen', ge', sum2', isZero', p'

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


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'(xs) → sum2'(xs, 0')
sum2'(xs, y) → ifsum'(isNil'(xs), isZero'(head'(xs)), xs, y)
ifsum'(true', b, xs, y) → y
ifsum'(false', b, xs, y) → ifsum2'(b, xs, y)
ifsum2'(true', xs, y) → sum2'(tail'(xs), y)
ifsum2'(false', xs, y) → sum2'(cons'(p'(head'(xs)), tail'(xs)), s'(y))
isNil'(nil') → true'
isNil'(cons'(x, xs)) → false'
tail'(nil') → nil'
tail'(cons'(x, xs)) → xs
head'(cons'(x, xs)) → x
head'(nil') → error'
isZero'(0') → true'
isZero'(s'(0')) → false'
isZero'(s'(s'(x))) → isZero'(s'(x))
p'(0') → s'(s'(0'))
p'(s'(0')) → 0'
p'(s'(s'(x))) → s'(p'(s'(x)))
ge'(x, 0') → true'
ge'(0', s'(y)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
a'c'
a'd'

Types:
times' :: 0':s':error' → 0':s':error' → 0':s':error'
sum' :: nil':cons' → 0':s':error'
generate' :: 0':s':error' → 0':s':error' → nil':cons'
gen' :: 0':s':error' → 0':s':error' → 0':s':error' → nil':cons'
0' :: 0':s':error'
if' :: true':false' → 0':s':error' → 0':s':error' → 0':s':error' → nil':cons'
ge' :: 0':s':error' → 0':s':error' → true':false'
true' :: true':false'
nil' :: nil':cons'
false' :: true':false'
cons' :: 0':s':error' → nil':cons' → nil':cons'
s' :: 0':s':error' → 0':s':error'
sum2' :: nil':cons' → 0':s':error' → 0':s':error'
ifsum' :: true':false' → true':false' → nil':cons' → 0':s':error' → 0':s':error'
isNil' :: nil':cons' → true':false'
isZero' :: 0':s':error' → true':false'
head' :: nil':cons' → 0':s':error'
ifsum2' :: true':false' → nil':cons' → 0':s':error' → 0':s':error'
tail' :: nil':cons' → nil':cons'
p' :: 0':s':error' → 0':s':error'
error' :: 0':s':error'
a' :: c':d'
c' :: c':d'
d' :: c':d'
_hole_0':s':error'1 :: 0':s':error'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_hole_c':d'4 :: c':d'
_gen_0':s':error'5 :: Nat → 0':s':error'
_gen_nil':cons'6 :: Nat → nil':cons'

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

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

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


Proved the following rewrite lemma:
ge'(_gen_0':s':error'5(_n8), _gen_0':s':error'5(_n8)) → true', rt ∈ Ω(1 + n8)

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

Induction Step:
ge'(_gen_0':s':error'5(+(_$n9, 1)), _gen_0':s':error'5(+(_$n9, 1))) →RΩ(1)
ge'(_gen_0':s':error'5(_$n9), _gen_0':s':error'5(_$n9)) →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'(xs) → sum2'(xs, 0')
sum2'(xs, y) → ifsum'(isNil'(xs), isZero'(head'(xs)), xs, y)
ifsum'(true', b, xs, y) → y
ifsum'(false', b, xs, y) → ifsum2'(b, xs, y)
ifsum2'(true', xs, y) → sum2'(tail'(xs), y)
ifsum2'(false', xs, y) → sum2'(cons'(p'(head'(xs)), tail'(xs)), s'(y))
isNil'(nil') → true'
isNil'(cons'(x, xs)) → false'
tail'(nil') → nil'
tail'(cons'(x, xs)) → xs
head'(cons'(x, xs)) → x
head'(nil') → error'
isZero'(0') → true'
isZero'(s'(0')) → false'
isZero'(s'(s'(x))) → isZero'(s'(x))
p'(0') → s'(s'(0'))
p'(s'(0')) → 0'
p'(s'(s'(x))) → s'(p'(s'(x)))
ge'(x, 0') → true'
ge'(0', s'(y)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
a'c'
a'd'

Types:
times' :: 0':s':error' → 0':s':error' → 0':s':error'
sum' :: nil':cons' → 0':s':error'
generate' :: 0':s':error' → 0':s':error' → nil':cons'
gen' :: 0':s':error' → 0':s':error' → 0':s':error' → nil':cons'
0' :: 0':s':error'
if' :: true':false' → 0':s':error' → 0':s':error' → 0':s':error' → nil':cons'
ge' :: 0':s':error' → 0':s':error' → true':false'
true' :: true':false'
nil' :: nil':cons'
false' :: true':false'
cons' :: 0':s':error' → nil':cons' → nil':cons'
s' :: 0':s':error' → 0':s':error'
sum2' :: nil':cons' → 0':s':error' → 0':s':error'
ifsum' :: true':false' → true':false' → nil':cons' → 0':s':error' → 0':s':error'
isNil' :: nil':cons' → true':false'
isZero' :: 0':s':error' → true':false'
head' :: nil':cons' → 0':s':error'
ifsum2' :: true':false' → nil':cons' → 0':s':error' → 0':s':error'
tail' :: nil':cons' → nil':cons'
p' :: 0':s':error' → 0':s':error'
error' :: 0':s':error'
a' :: c':d'
c' :: c':d'
d' :: c':d'
_hole_0':s':error'1 :: 0':s':error'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_hole_c':d'4 :: c':d'
_gen_0':s':error'5 :: Nat → 0':s':error'
_gen_nil':cons'6 :: Nat → nil':cons'

Lemmas:
ge'(_gen_0':s':error'5(_n8), _gen_0':s':error'5(_n8)) → true', rt ∈ Ω(1 + n8)

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

The following defined symbols remain to be analysed:
gen', sum2', isZero', p'

They will be analysed ascendingly in the following order:
isZero' < sum2'
p' < sum2'


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'(xs) → sum2'(xs, 0')
sum2'(xs, y) → ifsum'(isNil'(xs), isZero'(head'(xs)), xs, y)
ifsum'(true', b, xs, y) → y
ifsum'(false', b, xs, y) → ifsum2'(b, xs, y)
ifsum2'(true', xs, y) → sum2'(tail'(xs), y)
ifsum2'(false', xs, y) → sum2'(cons'(p'(head'(xs)), tail'(xs)), s'(y))
isNil'(nil') → true'
isNil'(cons'(x, xs)) → false'
tail'(nil') → nil'
tail'(cons'(x, xs)) → xs
head'(cons'(x, xs)) → x
head'(nil') → error'
isZero'(0') → true'
isZero'(s'(0')) → false'
isZero'(s'(s'(x))) → isZero'(s'(x))
p'(0') → s'(s'(0'))
p'(s'(0')) → 0'
p'(s'(s'(x))) → s'(p'(s'(x)))
ge'(x, 0') → true'
ge'(0', s'(y)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
a'c'
a'd'

Types:
times' :: 0':s':error' → 0':s':error' → 0':s':error'
sum' :: nil':cons' → 0':s':error'
generate' :: 0':s':error' → 0':s':error' → nil':cons'
gen' :: 0':s':error' → 0':s':error' → 0':s':error' → nil':cons'
0' :: 0':s':error'
if' :: true':false' → 0':s':error' → 0':s':error' → 0':s':error' → nil':cons'
ge' :: 0':s':error' → 0':s':error' → true':false'
true' :: true':false'
nil' :: nil':cons'
false' :: true':false'
cons' :: 0':s':error' → nil':cons' → nil':cons'
s' :: 0':s':error' → 0':s':error'
sum2' :: nil':cons' → 0':s':error' → 0':s':error'
ifsum' :: true':false' → true':false' → nil':cons' → 0':s':error' → 0':s':error'
isNil' :: nil':cons' → true':false'
isZero' :: 0':s':error' → true':false'
head' :: nil':cons' → 0':s':error'
ifsum2' :: true':false' → nil':cons' → 0':s':error' → 0':s':error'
tail' :: nil':cons' → nil':cons'
p' :: 0':s':error' → 0':s':error'
error' :: 0':s':error'
a' :: c':d'
c' :: c':d'
d' :: c':d'
_hole_0':s':error'1 :: 0':s':error'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_hole_c':d'4 :: c':d'
_gen_0':s':error'5 :: Nat → 0':s':error'
_gen_nil':cons'6 :: Nat → nil':cons'

Lemmas:
ge'(_gen_0':s':error'5(_n8), _gen_0':s':error'5(_n8)) → true', rt ∈ Ω(1 + n8)

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

The following defined symbols remain to be analysed:
isZero', sum2', p'

They will be analysed ascendingly in the following order:
isZero' < sum2'
p' < sum2'


Proved the following rewrite lemma:
isZero'(_gen_0':s':error'5(+(1, _n1274))) → false', rt ∈ Ω(1 + n1274)

Induction Base:
isZero'(_gen_0':s':error'5(+(1, 0))) →RΩ(1)
false'

Induction Step:
isZero'(_gen_0':s':error'5(+(1, +(_$n1275, 1)))) →RΩ(1)
isZero'(s'(_gen_0':s':error'5(_$n1275))) →IH
false'

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'(xs) → sum2'(xs, 0')
sum2'(xs, y) → ifsum'(isNil'(xs), isZero'(head'(xs)), xs, y)
ifsum'(true', b, xs, y) → y
ifsum'(false', b, xs, y) → ifsum2'(b, xs, y)
ifsum2'(true', xs, y) → sum2'(tail'(xs), y)
ifsum2'(false', xs, y) → sum2'(cons'(p'(head'(xs)), tail'(xs)), s'(y))
isNil'(nil') → true'
isNil'(cons'(x, xs)) → false'
tail'(nil') → nil'
tail'(cons'(x, xs)) → xs
head'(cons'(x, xs)) → x
head'(nil') → error'
isZero'(0') → true'
isZero'(s'(0')) → false'
isZero'(s'(s'(x))) → isZero'(s'(x))
p'(0') → s'(s'(0'))
p'(s'(0')) → 0'
p'(s'(s'(x))) → s'(p'(s'(x)))
ge'(x, 0') → true'
ge'(0', s'(y)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
a'c'
a'd'

Types:
times' :: 0':s':error' → 0':s':error' → 0':s':error'
sum' :: nil':cons' → 0':s':error'
generate' :: 0':s':error' → 0':s':error' → nil':cons'
gen' :: 0':s':error' → 0':s':error' → 0':s':error' → nil':cons'
0' :: 0':s':error'
if' :: true':false' → 0':s':error' → 0':s':error' → 0':s':error' → nil':cons'
ge' :: 0':s':error' → 0':s':error' → true':false'
true' :: true':false'
nil' :: nil':cons'
false' :: true':false'
cons' :: 0':s':error' → nil':cons' → nil':cons'
s' :: 0':s':error' → 0':s':error'
sum2' :: nil':cons' → 0':s':error' → 0':s':error'
ifsum' :: true':false' → true':false' → nil':cons' → 0':s':error' → 0':s':error'
isNil' :: nil':cons' → true':false'
isZero' :: 0':s':error' → true':false'
head' :: nil':cons' → 0':s':error'
ifsum2' :: true':false' → nil':cons' → 0':s':error' → 0':s':error'
tail' :: nil':cons' → nil':cons'
p' :: 0':s':error' → 0':s':error'
error' :: 0':s':error'
a' :: c':d'
c' :: c':d'
d' :: c':d'
_hole_0':s':error'1 :: 0':s':error'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_hole_c':d'4 :: c':d'
_gen_0':s':error'5 :: Nat → 0':s':error'
_gen_nil':cons'6 :: Nat → nil':cons'

Lemmas:
ge'(_gen_0':s':error'5(_n8), _gen_0':s':error'5(_n8)) → true', rt ∈ Ω(1 + n8)
isZero'(_gen_0':s':error'5(+(1, _n1274))) → false', rt ∈ Ω(1 + n1274)

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

The following defined symbols remain to be analysed:
p', sum2'

They will be analysed ascendingly in the following order:
p' < sum2'


Proved the following rewrite lemma:
p'(_gen_0':s':error'5(+(1, _n2149))) → _gen_0':s':error'5(_n2149), rt ∈ Ω(1 + n2149)

Induction Base:
p'(_gen_0':s':error'5(+(1, 0))) →RΩ(1)
0'

Induction Step:
p'(_gen_0':s':error'5(+(1, +(_$n2150, 1)))) →RΩ(1)
s'(p'(s'(_gen_0':s':error'5(_$n2150)))) →IH
s'(_gen_0':s':error'5(_$n2150))

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'(xs) → sum2'(xs, 0')
sum2'(xs, y) → ifsum'(isNil'(xs), isZero'(head'(xs)), xs, y)
ifsum'(true', b, xs, y) → y
ifsum'(false', b, xs, y) → ifsum2'(b, xs, y)
ifsum2'(true', xs, y) → sum2'(tail'(xs), y)
ifsum2'(false', xs, y) → sum2'(cons'(p'(head'(xs)), tail'(xs)), s'(y))
isNil'(nil') → true'
isNil'(cons'(x, xs)) → false'
tail'(nil') → nil'
tail'(cons'(x, xs)) → xs
head'(cons'(x, xs)) → x
head'(nil') → error'
isZero'(0') → true'
isZero'(s'(0')) → false'
isZero'(s'(s'(x))) → isZero'(s'(x))
p'(0') → s'(s'(0'))
p'(s'(0')) → 0'
p'(s'(s'(x))) → s'(p'(s'(x)))
ge'(x, 0') → true'
ge'(0', s'(y)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
a'c'
a'd'

Types:
times' :: 0':s':error' → 0':s':error' → 0':s':error'
sum' :: nil':cons' → 0':s':error'
generate' :: 0':s':error' → 0':s':error' → nil':cons'
gen' :: 0':s':error' → 0':s':error' → 0':s':error' → nil':cons'
0' :: 0':s':error'
if' :: true':false' → 0':s':error' → 0':s':error' → 0':s':error' → nil':cons'
ge' :: 0':s':error' → 0':s':error' → true':false'
true' :: true':false'
nil' :: nil':cons'
false' :: true':false'
cons' :: 0':s':error' → nil':cons' → nil':cons'
s' :: 0':s':error' → 0':s':error'
sum2' :: nil':cons' → 0':s':error' → 0':s':error'
ifsum' :: true':false' → true':false' → nil':cons' → 0':s':error' → 0':s':error'
isNil' :: nil':cons' → true':false'
isZero' :: 0':s':error' → true':false'
head' :: nil':cons' → 0':s':error'
ifsum2' :: true':false' → nil':cons' → 0':s':error' → 0':s':error'
tail' :: nil':cons' → nil':cons'
p' :: 0':s':error' → 0':s':error'
error' :: 0':s':error'
a' :: c':d'
c' :: c':d'
d' :: c':d'
_hole_0':s':error'1 :: 0':s':error'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_hole_c':d'4 :: c':d'
_gen_0':s':error'5 :: Nat → 0':s':error'
_gen_nil':cons'6 :: Nat → nil':cons'

Lemmas:
ge'(_gen_0':s':error'5(_n8), _gen_0':s':error'5(_n8)) → true', rt ∈ Ω(1 + n8)
isZero'(_gen_0':s':error'5(+(1, _n1274))) → false', rt ∈ Ω(1 + n1274)
p'(_gen_0':s':error'5(+(1, _n2149))) → _gen_0':s':error'5(_n2149), rt ∈ Ω(1 + n2149)

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

The following defined symbols remain to be analysed:
sum2'


Proved the following rewrite lemma:
sum2'(_gen_nil':cons'6(_n3224), _gen_0':s':error'5(b)) → _gen_0':s':error'5(b), rt ∈ Ω(1 + n3224)

Induction Base:
sum2'(_gen_nil':cons'6(0), _gen_0':s':error'5(b)) →RΩ(1)
ifsum'(isNil'(_gen_nil':cons'6(0)), isZero'(head'(_gen_nil':cons'6(0))), _gen_nil':cons'6(0), _gen_0':s':error'5(b)) →RΩ(1)
ifsum'(true', isZero'(head'(_gen_nil':cons'6(0))), _gen_nil':cons'6(0), _gen_0':s':error'5(b)) →RΩ(1)
ifsum'(true', isZero'(error'), _gen_nil':cons'6(0), _gen_0':s':error'5(b)) →RΩ(1)
_gen_0':s':error'5(b)

Induction Step:
sum2'(_gen_nil':cons'6(+(_$n3225, 1)), _gen_0':s':error'5(_b3642)) →RΩ(1)
ifsum'(isNil'(_gen_nil':cons'6(+(_$n3225, 1))), isZero'(head'(_gen_nil':cons'6(+(_$n3225, 1)))), _gen_nil':cons'6(+(_$n3225, 1)), _gen_0':s':error'5(_b3642)) →RΩ(1)
ifsum'(false', isZero'(head'(_gen_nil':cons'6(+(1, _$n3225)))), _gen_nil':cons'6(+(1, _$n3225)), _gen_0':s':error'5(_b3642)) →RΩ(1)
ifsum'(false', isZero'(0'), _gen_nil':cons'6(+(1, _$n3225)), _gen_0':s':error'5(_b3642)) →RΩ(1)
ifsum'(false', true', _gen_nil':cons'6(+(1, _$n3225)), _gen_0':s':error'5(_b3642)) →RΩ(1)
ifsum2'(true', _gen_nil':cons'6(+(1, _$n3225)), _gen_0':s':error'5(_b3642)) →RΩ(1)
sum2'(tail'(_gen_nil':cons'6(+(1, _$n3225))), _gen_0':s':error'5(_b3642)) →RΩ(1)
sum2'(_gen_nil':cons'6(_$n3225), _gen_0':s':error'5(_b3642)) →IH
_gen_0':s':error'5(_b3642)

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'(xs) → sum2'(xs, 0')
sum2'(xs, y) → ifsum'(isNil'(xs), isZero'(head'(xs)), xs, y)
ifsum'(true', b, xs, y) → y
ifsum'(false', b, xs, y) → ifsum2'(b, xs, y)
ifsum2'(true', xs, y) → sum2'(tail'(xs), y)
ifsum2'(false', xs, y) → sum2'(cons'(p'(head'(xs)), tail'(xs)), s'(y))
isNil'(nil') → true'
isNil'(cons'(x, xs)) → false'
tail'(nil') → nil'
tail'(cons'(x, xs)) → xs
head'(cons'(x, xs)) → x
head'(nil') → error'
isZero'(0') → true'
isZero'(s'(0')) → false'
isZero'(s'(s'(x))) → isZero'(s'(x))
p'(0') → s'(s'(0'))
p'(s'(0')) → 0'
p'(s'(s'(x))) → s'(p'(s'(x)))
ge'(x, 0') → true'
ge'(0', s'(y)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
a'c'
a'd'

Types:
times' :: 0':s':error' → 0':s':error' → 0':s':error'
sum' :: nil':cons' → 0':s':error'
generate' :: 0':s':error' → 0':s':error' → nil':cons'
gen' :: 0':s':error' → 0':s':error' → 0':s':error' → nil':cons'
0' :: 0':s':error'
if' :: true':false' → 0':s':error' → 0':s':error' → 0':s':error' → nil':cons'
ge' :: 0':s':error' → 0':s':error' → true':false'
true' :: true':false'
nil' :: nil':cons'
false' :: true':false'
cons' :: 0':s':error' → nil':cons' → nil':cons'
s' :: 0':s':error' → 0':s':error'
sum2' :: nil':cons' → 0':s':error' → 0':s':error'
ifsum' :: true':false' → true':false' → nil':cons' → 0':s':error' → 0':s':error'
isNil' :: nil':cons' → true':false'
isZero' :: 0':s':error' → true':false'
head' :: nil':cons' → 0':s':error'
ifsum2' :: true':false' → nil':cons' → 0':s':error' → 0':s':error'
tail' :: nil':cons' → nil':cons'
p' :: 0':s':error' → 0':s':error'
error' :: 0':s':error'
a' :: c':d'
c' :: c':d'
d' :: c':d'
_hole_0':s':error'1 :: 0':s':error'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_hole_c':d'4 :: c':d'
_gen_0':s':error'5 :: Nat → 0':s':error'
_gen_nil':cons'6 :: Nat → nil':cons'

Lemmas:
ge'(_gen_0':s':error'5(_n8), _gen_0':s':error'5(_n8)) → true', rt ∈ Ω(1 + n8)
isZero'(_gen_0':s':error'5(+(1, _n1274))) → false', rt ∈ Ω(1 + n1274)
p'(_gen_0':s':error'5(+(1, _n2149))) → _gen_0':s':error'5(_n2149), rt ∈ Ω(1 + n2149)
sum2'(_gen_nil':cons'6(_n3224), _gen_0':s':error'5(b)) → _gen_0':s':error'5(b), rt ∈ Ω(1 + n3224)

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

No more defined symbols left to analyse.


The lowerbound Ω(n) was proven with the following lemma:
ge'(_gen_0':s':error'5(_n8), _gen_0':s':error'5(_n8)) → true', rt ∈ Ω(1 + n8)