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

lt(0, s(x)) → true
lt(x, 0) → false
lt(s(x), s(y)) → lt(x, y)
times(0, y) → 0
times(s(x), y) → plus(y, times(x, y))
plus(0, y) → y
plus(s(x), y) → s(plus(x, y))
fac(x) → loop(x, s(0), s(0))
loop(x, c, y) → if(lt(x, c), x, c, y)
if(false, x, c, y) → loop(x, s(c), times(y, s(c)))
if(true, x, c, y) → y

Rewrite Strategy: INNERMOST


Renamed function symbols to avoid clashes with predefined symbol.


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


lt'(0', s'(x)) → true'
lt'(x, 0') → false'
lt'(s'(x), s'(y)) → lt'(x, y)
times'(0', y) → 0'
times'(s'(x), y) → plus'(y, times'(x, y))
plus'(0', y) → y
plus'(s'(x), y) → s'(plus'(x, y))
fac'(x) → loop'(x, s'(0'), s'(0'))
loop'(x, c, y) → if'(lt'(x, c), x, c, y)
if'(false', x, c, y) → loop'(x, s'(c), times'(y, s'(c)))
if'(true', x, c, y) → y

Rewrite Strategy: INNERMOST


Infered types.


Rules:
lt'(0', s'(x)) → true'
lt'(x, 0') → false'
lt'(s'(x), s'(y)) → lt'(x, y)
times'(0', y) → 0'
times'(s'(x), y) → plus'(y, times'(x, y))
plus'(0', y) → y
plus'(s'(x), y) → s'(plus'(x, y))
fac'(x) → loop'(x, s'(0'), s'(0'))
loop'(x, c, y) → if'(lt'(x, c), x, c, y)
if'(false', x, c, y) → loop'(x, s'(c), times'(y, s'(c)))
if'(true', x, c, y) → y

Types:
lt' :: 0':s' → 0':s' → true':false'
0' :: 0':s'
s' :: 0':s' → 0':s'
true' :: true':false'
false' :: true':false'
times' :: 0':s' → 0':s' → 0':s'
plus' :: 0':s' → 0':s' → 0':s'
fac' :: 0':s' → 0':s'
loop' :: 0':s' → 0':s' → 0':s' → 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s' → 0':s'
_hole_true':false'1 :: true':false'
_hole_0':s'2 :: 0':s'
_gen_0':s'3 :: Nat → 0':s'


Heuristically decided to analyse the following defined symbols:
lt', times', plus', loop'

They will be analysed ascendingly in the following order:
lt' < loop'
plus' < times'
times' < loop'


Rules:
lt'(0', s'(x)) → true'
lt'(x, 0') → false'
lt'(s'(x), s'(y)) → lt'(x, y)
times'(0', y) → 0'
times'(s'(x), y) → plus'(y, times'(x, y))
plus'(0', y) → y
plus'(s'(x), y) → s'(plus'(x, y))
fac'(x) → loop'(x, s'(0'), s'(0'))
loop'(x, c, y) → if'(lt'(x, c), x, c, y)
if'(false', x, c, y) → loop'(x, s'(c), times'(y, s'(c)))
if'(true', x, c, y) → y

Types:
lt' :: 0':s' → 0':s' → true':false'
0' :: 0':s'
s' :: 0':s' → 0':s'
true' :: true':false'
false' :: true':false'
times' :: 0':s' → 0':s' → 0':s'
plus' :: 0':s' → 0':s' → 0':s'
fac' :: 0':s' → 0':s'
loop' :: 0':s' → 0':s' → 0':s' → 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s' → 0':s'
_hole_true':false'1 :: true':false'
_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:
lt', times', plus', loop'

They will be analysed ascendingly in the following order:
lt' < loop'
plus' < times'
times' < loop'


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

Induction Base:
lt'(_gen_0':s'3(0), _gen_0':s'3(+(1, 0))) →RΩ(1)
true'

Induction Step:
lt'(_gen_0':s'3(+(_$n6, 1)), _gen_0':s'3(+(1, +(_$n6, 1)))) →RΩ(1)
lt'(_gen_0':s'3(_$n6), _gen_0':s'3(+(1, _$n6))) →IH
true'

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


Rules:
lt'(0', s'(x)) → true'
lt'(x, 0') → false'
lt'(s'(x), s'(y)) → lt'(x, y)
times'(0', y) → 0'
times'(s'(x), y) → plus'(y, times'(x, y))
plus'(0', y) → y
plus'(s'(x), y) → s'(plus'(x, y))
fac'(x) → loop'(x, s'(0'), s'(0'))
loop'(x, c, y) → if'(lt'(x, c), x, c, y)
if'(false', x, c, y) → loop'(x, s'(c), times'(y, s'(c)))
if'(true', x, c, y) → y

Types:
lt' :: 0':s' → 0':s' → true':false'
0' :: 0':s'
s' :: 0':s' → 0':s'
true' :: true':false'
false' :: true':false'
times' :: 0':s' → 0':s' → 0':s'
plus' :: 0':s' → 0':s' → 0':s'
fac' :: 0':s' → 0':s'
loop' :: 0':s' → 0':s' → 0':s' → 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s' → 0':s'
_hole_true':false'1 :: true':false'
_hole_0':s'2 :: 0':s'
_gen_0':s'3 :: Nat → 0':s'

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

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:
plus', times', loop'

They will be analysed ascendingly in the following order:
plus' < times'
times' < loop'


Proved the following rewrite lemma:
plus'(_gen_0':s'3(_n770), _gen_0':s'3(b)) → _gen_0':s'3(+(_n770, b)), rt ∈ Ω(1 + n770)

Induction Base:
plus'(_gen_0':s'3(0), _gen_0':s'3(b)) →RΩ(1)
_gen_0':s'3(b)

Induction Step:
plus'(_gen_0':s'3(+(_$n771, 1)), _gen_0':s'3(_b903)) →RΩ(1)
s'(plus'(_gen_0':s'3(_$n771), _gen_0':s'3(_b903))) →IH
s'(_gen_0':s'3(+(_$n771, _b903)))

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


Rules:
lt'(0', s'(x)) → true'
lt'(x, 0') → false'
lt'(s'(x), s'(y)) → lt'(x, y)
times'(0', y) → 0'
times'(s'(x), y) → plus'(y, times'(x, y))
plus'(0', y) → y
plus'(s'(x), y) → s'(plus'(x, y))
fac'(x) → loop'(x, s'(0'), s'(0'))
loop'(x, c, y) → if'(lt'(x, c), x, c, y)
if'(false', x, c, y) → loop'(x, s'(c), times'(y, s'(c)))
if'(true', x, c, y) → y

Types:
lt' :: 0':s' → 0':s' → true':false'
0' :: 0':s'
s' :: 0':s' → 0':s'
true' :: true':false'
false' :: true':false'
times' :: 0':s' → 0':s' → 0':s'
plus' :: 0':s' → 0':s' → 0':s'
fac' :: 0':s' → 0':s'
loop' :: 0':s' → 0':s' → 0':s' → 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s' → 0':s'
_hole_true':false'1 :: true':false'
_hole_0':s'2 :: 0':s'
_gen_0':s'3 :: Nat → 0':s'

Lemmas:
lt'(_gen_0':s'3(_n5), _gen_0':s'3(+(1, _n5))) → true', rt ∈ Ω(1 + n5)
plus'(_gen_0':s'3(_n770), _gen_0':s'3(b)) → _gen_0':s'3(+(_n770, b)), rt ∈ Ω(1 + n770)

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:
times', loop'

They will be analysed ascendingly in the following order:
times' < loop'


Proved the following rewrite lemma:
times'(_gen_0':s'3(_n1595), _gen_0':s'3(b)) → _gen_0':s'3(*(_n1595, b)), rt ∈ Ω(1 + b1855·n1595 + n1595)

Induction Base:
times'(_gen_0':s'3(0), _gen_0':s'3(b)) →RΩ(1)
0'

Induction Step:
times'(_gen_0':s'3(+(_$n1596, 1)), _gen_0':s'3(_b1855)) →RΩ(1)
plus'(_gen_0':s'3(_b1855), times'(_gen_0':s'3(_$n1596), _gen_0':s'3(_b1855))) →IH
plus'(_gen_0':s'3(_b1855), _gen_0':s'3(*(_$n1596, _b1855))) →LΩ(1 + b1855)
_gen_0':s'3(+(_b1855, *(_$n1596, _b1855)))

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


Rules:
lt'(0', s'(x)) → true'
lt'(x, 0') → false'
lt'(s'(x), s'(y)) → lt'(x, y)
times'(0', y) → 0'
times'(s'(x), y) → plus'(y, times'(x, y))
plus'(0', y) → y
plus'(s'(x), y) → s'(plus'(x, y))
fac'(x) → loop'(x, s'(0'), s'(0'))
loop'(x, c, y) → if'(lt'(x, c), x, c, y)
if'(false', x, c, y) → loop'(x, s'(c), times'(y, s'(c)))
if'(true', x, c, y) → y

Types:
lt' :: 0':s' → 0':s' → true':false'
0' :: 0':s'
s' :: 0':s' → 0':s'
true' :: true':false'
false' :: true':false'
times' :: 0':s' → 0':s' → 0':s'
plus' :: 0':s' → 0':s' → 0':s'
fac' :: 0':s' → 0':s'
loop' :: 0':s' → 0':s' → 0':s' → 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s' → 0':s'
_hole_true':false'1 :: true':false'
_hole_0':s'2 :: 0':s'
_gen_0':s'3 :: Nat → 0':s'

Lemmas:
lt'(_gen_0':s'3(_n5), _gen_0':s'3(+(1, _n5))) → true', rt ∈ Ω(1 + n5)
plus'(_gen_0':s'3(_n770), _gen_0':s'3(b)) → _gen_0':s'3(+(_n770, b)), rt ∈ Ω(1 + n770)
times'(_gen_0':s'3(_n1595), _gen_0':s'3(b)) → _gen_0':s'3(*(_n1595, b)), rt ∈ Ω(1 + b1855·n1595 + n1595)

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:
loop'


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


Rules:
lt'(0', s'(x)) → true'
lt'(x, 0') → false'
lt'(s'(x), s'(y)) → lt'(x, y)
times'(0', y) → 0'
times'(s'(x), y) → plus'(y, times'(x, y))
plus'(0', y) → y
plus'(s'(x), y) → s'(plus'(x, y))
fac'(x) → loop'(x, s'(0'), s'(0'))
loop'(x, c, y) → if'(lt'(x, c), x, c, y)
if'(false', x, c, y) → loop'(x, s'(c), times'(y, s'(c)))
if'(true', x, c, y) → y

Types:
lt' :: 0':s' → 0':s' → true':false'
0' :: 0':s'
s' :: 0':s' → 0':s'
true' :: true':false'
false' :: true':false'
times' :: 0':s' → 0':s' → 0':s'
plus' :: 0':s' → 0':s' → 0':s'
fac' :: 0':s' → 0':s'
loop' :: 0':s' → 0':s' → 0':s' → 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s' → 0':s'
_hole_true':false'1 :: true':false'
_hole_0':s'2 :: 0':s'
_gen_0':s'3 :: Nat → 0':s'

Lemmas:
lt'(_gen_0':s'3(_n5), _gen_0':s'3(+(1, _n5))) → true', rt ∈ Ω(1 + n5)
plus'(_gen_0':s'3(_n770), _gen_0':s'3(b)) → _gen_0':s'3(+(_n770, b)), rt ∈ Ω(1 + n770)
times'(_gen_0':s'3(_n1595), _gen_0':s'3(b)) → _gen_0':s'3(*(_n1595, b)), rt ∈ Ω(1 + b1855·n1595 + n1595)

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 Ω(n2) was proven with the following lemma:
times'(_gen_0':s'3(_n1595), _gen_0':s'3(b)) → _gen_0':s'3(*(_n1595, b)), rt ∈ Ω(1 + b1855·n1595 + n1595)