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

minus(0, Y) → 0
minus(s(X), s(Y)) → minus(X, Y)
geq(X, 0) → true
geq(0, s(Y)) → false
geq(s(X), s(Y)) → geq(X, Y)
div(0, s(Y)) → 0
div(s(X), s(Y)) → if(geq(X, Y), s(div(minus(X, Y), s(Y))), 0)
if(true, X, Y) → X
if(false, X, 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:


minus'(0', Y) → 0'
minus'(s'(X), s'(Y)) → minus'(X, Y)
geq'(X, 0') → true'
geq'(0', s'(Y)) → false'
geq'(s'(X), s'(Y)) → geq'(X, Y)
div'(0', s'(Y)) → 0'
div'(s'(X), s'(Y)) → if'(geq'(X, Y), s'(div'(minus'(X, Y), s'(Y))), 0')
if'(true', X, Y) → X
if'(false', X, Y) → Y

Rewrite Strategy: INNERMOST


Infered types.


Rules:
minus'(0', Y) → 0'
minus'(s'(X), s'(Y)) → minus'(X, Y)
geq'(X, 0') → true'
geq'(0', s'(Y)) → false'
geq'(s'(X), s'(Y)) → geq'(X, Y)
div'(0', s'(Y)) → 0'
div'(s'(X), s'(Y)) → if'(geq'(X, Y), s'(div'(minus'(X, Y), s'(Y))), 0')
if'(true', X, Y) → X
if'(false', X, Y) → Y

Types:
minus' :: 0':s' → 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
geq' :: 0':s' → 0':s' → true':false'
true' :: true':false'
false' :: true':false'
div' :: 0':s' → 0':s' → 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_hole_true':false'2 :: true':false'
_gen_0':s'3 :: Nat → 0':s'


Heuristically decided to analyse the following defined symbols:
minus', geq', div'

They will be analysed ascendingly in the following order:
minus' < div'
geq' < div'


Rules:
minus'(0', Y) → 0'
minus'(s'(X), s'(Y)) → minus'(X, Y)
geq'(X, 0') → true'
geq'(0', s'(Y)) → false'
geq'(s'(X), s'(Y)) → geq'(X, Y)
div'(0', s'(Y)) → 0'
div'(s'(X), s'(Y)) → if'(geq'(X, Y), s'(div'(minus'(X, Y), s'(Y))), 0')
if'(true', X, Y) → X
if'(false', X, Y) → Y

Types:
minus' :: 0':s' → 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
geq' :: 0':s' → 0':s' → true':false'
true' :: true':false'
false' :: true':false'
div' :: 0':s' → 0':s' → 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_hole_true':false'2 :: true':false'
_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:
minus', geq', div'

They will be analysed ascendingly in the following order:
minus' < div'
geq' < div'


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

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

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

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


Rules:
minus'(0', Y) → 0'
minus'(s'(X), s'(Y)) → minus'(X, Y)
geq'(X, 0') → true'
geq'(0', s'(Y)) → false'
geq'(s'(X), s'(Y)) → geq'(X, Y)
div'(0', s'(Y)) → 0'
div'(s'(X), s'(Y)) → if'(geq'(X, Y), s'(div'(minus'(X, Y), s'(Y))), 0')
if'(true', X, Y) → X
if'(false', X, Y) → Y

Types:
minus' :: 0':s' → 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
geq' :: 0':s' → 0':s' → true':false'
true' :: true':false'
false' :: true':false'
div' :: 0':s' → 0':s' → 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_hole_true':false'2 :: true':false'
_gen_0':s'3 :: Nat → 0':s'

Lemmas:
minus'(_gen_0':s'3(_n5), _gen_0':s'3(_n5)) → _gen_0':s'3(0), 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:
geq', div'

They will be analysed ascendingly in the following order:
geq' < div'


Proved the following rewrite lemma:
geq'(_gen_0':s'3(_n511), _gen_0':s'3(_n511)) → true', rt ∈ Ω(1 + n511)

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

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

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


Rules:
minus'(0', Y) → 0'
minus'(s'(X), s'(Y)) → minus'(X, Y)
geq'(X, 0') → true'
geq'(0', s'(Y)) → false'
geq'(s'(X), s'(Y)) → geq'(X, Y)
div'(0', s'(Y)) → 0'
div'(s'(X), s'(Y)) → if'(geq'(X, Y), s'(div'(minus'(X, Y), s'(Y))), 0')
if'(true', X, Y) → X
if'(false', X, Y) → Y

Types:
minus' :: 0':s' → 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
geq' :: 0':s' → 0':s' → true':false'
true' :: true':false'
false' :: true':false'
div' :: 0':s' → 0':s' → 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_hole_true':false'2 :: true':false'
_gen_0':s'3 :: Nat → 0':s'

Lemmas:
minus'(_gen_0':s'3(_n5), _gen_0':s'3(_n5)) → _gen_0':s'3(0), rt ∈ Ω(1 + n5)
geq'(_gen_0':s'3(_n511), _gen_0':s'3(_n511)) → true', rt ∈ Ω(1 + n511)

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


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


Rules:
minus'(0', Y) → 0'
minus'(s'(X), s'(Y)) → minus'(X, Y)
geq'(X, 0') → true'
geq'(0', s'(Y)) → false'
geq'(s'(X), s'(Y)) → geq'(X, Y)
div'(0', s'(Y)) → 0'
div'(s'(X), s'(Y)) → if'(geq'(X, Y), s'(div'(minus'(X, Y), s'(Y))), 0')
if'(true', X, Y) → X
if'(false', X, Y) → Y

Types:
minus' :: 0':s' → 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
geq' :: 0':s' → 0':s' → true':false'
true' :: true':false'
false' :: true':false'
div' :: 0':s' → 0':s' → 0':s'
if' :: true':false' → 0':s' → 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_hole_true':false'2 :: true':false'
_gen_0':s'3 :: Nat → 0':s'

Lemmas:
minus'(_gen_0':s'3(_n5), _gen_0':s'3(_n5)) → _gen_0':s'3(0), rt ∈ Ω(1 + n5)
geq'(_gen_0':s'3(_n511), _gen_0':s'3(_n511)) → true', rt ∈ Ω(1 + n511)

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:
minus'(_gen_0':s'3(_n5), _gen_0':s'3(_n5)) → _gen_0':s'3(0), rt ∈ Ω(1 + n5)