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

gt(s(x), 0) → true
gt(0, y) → false
gt(s(x), s(y)) → gt(x, y)
divides(x, y) → div(x, y, y)
div(0, 0, z) → true
div(0, s(x), z) → false
div(s(x), 0, s(z)) → div(s(x), s(z), s(z))
div(s(x), s(y), z) → div(x, y, z)
prime(x) → test(x, s(s(0)))
test(x, y) → if1(gt(x, y), x, y)
if1(true, x, y) → if2(divides(x, y), x, y)
if1(false, x, y) → true
if2(true, x, y) → false
if2(false, x, y) → test(x, s(y))

Rewrite Strategy: INNERMOST


Renamed function symbols to avoid clashes with predefined symbol.


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


gt'(s'(x), 0') → true'
gt'(0', y) → false'
gt'(s'(x), s'(y)) → gt'(x, y)
divides'(x, y) → div'(x, y, y)
div'(0', 0', z) → true'
div'(0', s'(x), z) → false'
div'(s'(x), 0', s'(z)) → div'(s'(x), s'(z), s'(z))
div'(s'(x), s'(y), z) → div'(x, y, z)
prime'(x) → test'(x, s'(s'(0')))
test'(x, y) → if1'(gt'(x, y), x, y)
if1'(true', x, y) → if2'(divides'(x, y), x, y)
if1'(false', x, y) → true'
if2'(true', x, y) → false'
if2'(false', x, y) → test'(x, s'(y))

Rewrite Strategy: INNERMOST


Infered types.


Rules:
gt'(s'(x), 0') → true'
gt'(0', y) → false'
gt'(s'(x), s'(y)) → gt'(x, y)
divides'(x, y) → div'(x, y, y)
div'(0', 0', z) → true'
div'(0', s'(x), z) → false'
div'(s'(x), 0', s'(z)) → div'(s'(x), s'(z), s'(z))
div'(s'(x), s'(y), z) → div'(x, y, z)
prime'(x) → test'(x, s'(s'(0')))
test'(x, y) → if1'(gt'(x, y), x, y)
if1'(true', x, y) → if2'(divides'(x, y), x, y)
if1'(false', x, y) → true'
if2'(true', x, y) → false'
if2'(false', x, y) → test'(x, s'(y))

Types:
gt' :: s':0' → s':0' → true':false'
s' :: s':0' → s':0'
0' :: s':0'
true' :: true':false'
false' :: true':false'
divides' :: s':0' → s':0' → true':false'
div' :: s':0' → s':0' → s':0' → true':false'
prime' :: s':0' → true':false'
test' :: s':0' → s':0' → true':false'
if1' :: true':false' → s':0' → s':0' → true':false'
if2' :: true':false' → s':0' → s':0' → true':false'
_hole_true':false'1 :: true':false'
_hole_s':0'2 :: s':0'
_gen_s':0'3 :: Nat → s':0'


Heuristically decided to analyse the following defined symbols:
gt', div', test'

They will be analysed ascendingly in the following order:
gt' < test'


Rules:
gt'(s'(x), 0') → true'
gt'(0', y) → false'
gt'(s'(x), s'(y)) → gt'(x, y)
divides'(x, y) → div'(x, y, y)
div'(0', 0', z) → true'
div'(0', s'(x), z) → false'
div'(s'(x), 0', s'(z)) → div'(s'(x), s'(z), s'(z))
div'(s'(x), s'(y), z) → div'(x, y, z)
prime'(x) → test'(x, s'(s'(0')))
test'(x, y) → if1'(gt'(x, y), x, y)
if1'(true', x, y) → if2'(divides'(x, y), x, y)
if1'(false', x, y) → true'
if2'(true', x, y) → false'
if2'(false', x, y) → test'(x, s'(y))

Types:
gt' :: s':0' → s':0' → true':false'
s' :: s':0' → s':0'
0' :: s':0'
true' :: true':false'
false' :: true':false'
divides' :: s':0' → s':0' → true':false'
div' :: s':0' → s':0' → s':0' → true':false'
prime' :: s':0' → true':false'
test' :: s':0' → s':0' → true':false'
if1' :: true':false' → s':0' → s':0' → true':false'
if2' :: true':false' → s':0' → s':0' → true':false'
_hole_true':false'1 :: true':false'
_hole_s':0'2 :: s':0'
_gen_s':0'3 :: Nat → s':0'

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

The following defined symbols remain to be analysed:
gt', div', test'

They will be analysed ascendingly in the following order:
gt' < test'


Proved the following rewrite lemma:
gt'(_gen_s':0'3(+(1, _n5)), _gen_s':0'3(_n5)) → true', rt ∈ Ω(1 + n5)

Induction Base:
gt'(_gen_s':0'3(+(1, 0)), _gen_s':0'3(0)) →RΩ(1)
true'

Induction Step:
gt'(_gen_s':0'3(+(1, +(_$n6, 1))), _gen_s':0'3(+(_$n6, 1))) →RΩ(1)
gt'(_gen_s':0'3(+(1, _$n6)), _gen_s':0'3(_$n6)) →IH
true'

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


Rules:
gt'(s'(x), 0') → true'
gt'(0', y) → false'
gt'(s'(x), s'(y)) → gt'(x, y)
divides'(x, y) → div'(x, y, y)
div'(0', 0', z) → true'
div'(0', s'(x), z) → false'
div'(s'(x), 0', s'(z)) → div'(s'(x), s'(z), s'(z))
div'(s'(x), s'(y), z) → div'(x, y, z)
prime'(x) → test'(x, s'(s'(0')))
test'(x, y) → if1'(gt'(x, y), x, y)
if1'(true', x, y) → if2'(divides'(x, y), x, y)
if1'(false', x, y) → true'
if2'(true', x, y) → false'
if2'(false', x, y) → test'(x, s'(y))

Types:
gt' :: s':0' → s':0' → true':false'
s' :: s':0' → s':0'
0' :: s':0'
true' :: true':false'
false' :: true':false'
divides' :: s':0' → s':0' → true':false'
div' :: s':0' → s':0' → s':0' → true':false'
prime' :: s':0' → true':false'
test' :: s':0' → s':0' → true':false'
if1' :: true':false' → s':0' → s':0' → true':false'
if2' :: true':false' → s':0' → s':0' → true':false'
_hole_true':false'1 :: true':false'
_hole_s':0'2 :: s':0'
_gen_s':0'3 :: Nat → s':0'

Lemmas:
gt'(_gen_s':0'3(+(1, _n5)), _gen_s':0'3(_n5)) → true', rt ∈ Ω(1 + n5)

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

The following defined symbols remain to be analysed:
div', test'


Proved the following rewrite lemma:
div'(_gen_s':0'3(+(1, _n875)), _gen_s':0'3(+(1, _n875)), _gen_s':0'3(c)) → _*4, rt ∈ Ω(n875)

Induction Base:
div'(_gen_s':0'3(+(1, 0)), _gen_s':0'3(+(1, 0)), _gen_s':0'3(c))

Induction Step:
div'(_gen_s':0'3(+(1, +(_$n876, 1))), _gen_s':0'3(+(1, +(_$n876, 1))), _gen_s':0'3(_c3991)) →RΩ(1)
div'(_gen_s':0'3(+(1, _$n876)), _gen_s':0'3(+(1, _$n876)), _gen_s':0'3(_c3991)) →IH
_*4

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


Rules:
gt'(s'(x), 0') → true'
gt'(0', y) → false'
gt'(s'(x), s'(y)) → gt'(x, y)
divides'(x, y) → div'(x, y, y)
div'(0', 0', z) → true'
div'(0', s'(x), z) → false'
div'(s'(x), 0', s'(z)) → div'(s'(x), s'(z), s'(z))
div'(s'(x), s'(y), z) → div'(x, y, z)
prime'(x) → test'(x, s'(s'(0')))
test'(x, y) → if1'(gt'(x, y), x, y)
if1'(true', x, y) → if2'(divides'(x, y), x, y)
if1'(false', x, y) → true'
if2'(true', x, y) → false'
if2'(false', x, y) → test'(x, s'(y))

Types:
gt' :: s':0' → s':0' → true':false'
s' :: s':0' → s':0'
0' :: s':0'
true' :: true':false'
false' :: true':false'
divides' :: s':0' → s':0' → true':false'
div' :: s':0' → s':0' → s':0' → true':false'
prime' :: s':0' → true':false'
test' :: s':0' → s':0' → true':false'
if1' :: true':false' → s':0' → s':0' → true':false'
if2' :: true':false' → s':0' → s':0' → true':false'
_hole_true':false'1 :: true':false'
_hole_s':0'2 :: s':0'
_gen_s':0'3 :: Nat → s':0'

Lemmas:
gt'(_gen_s':0'3(+(1, _n5)), _gen_s':0'3(_n5)) → true', rt ∈ Ω(1 + n5)
div'(_gen_s':0'3(+(1, _n875)), _gen_s':0'3(+(1, _n875)), _gen_s':0'3(c)) → _*4, rt ∈ Ω(n875)

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

The following defined symbols remain to be analysed:
test'


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


Rules:
gt'(s'(x), 0') → true'
gt'(0', y) → false'
gt'(s'(x), s'(y)) → gt'(x, y)
divides'(x, y) → div'(x, y, y)
div'(0', 0', z) → true'
div'(0', s'(x), z) → false'
div'(s'(x), 0', s'(z)) → div'(s'(x), s'(z), s'(z))
div'(s'(x), s'(y), z) → div'(x, y, z)
prime'(x) → test'(x, s'(s'(0')))
test'(x, y) → if1'(gt'(x, y), x, y)
if1'(true', x, y) → if2'(divides'(x, y), x, y)
if1'(false', x, y) → true'
if2'(true', x, y) → false'
if2'(false', x, y) → test'(x, s'(y))

Types:
gt' :: s':0' → s':0' → true':false'
s' :: s':0' → s':0'
0' :: s':0'
true' :: true':false'
false' :: true':false'
divides' :: s':0' → s':0' → true':false'
div' :: s':0' → s':0' → s':0' → true':false'
prime' :: s':0' → true':false'
test' :: s':0' → s':0' → true':false'
if1' :: true':false' → s':0' → s':0' → true':false'
if2' :: true':false' → s':0' → s':0' → true':false'
_hole_true':false'1 :: true':false'
_hole_s':0'2 :: s':0'
_gen_s':0'3 :: Nat → s':0'

Lemmas:
gt'(_gen_s':0'3(+(1, _n5)), _gen_s':0'3(_n5)) → true', rt ∈ Ω(1 + n5)
div'(_gen_s':0'3(+(1, _n875)), _gen_s':0'3(+(1, _n875)), _gen_s':0'3(c)) → _*4, rt ∈ Ω(n875)

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

No more defined symbols left to analyse.


The lowerbound Ω(n) was proven with the following lemma:
gt'(_gen_s':0'3(+(1, _n5)), _gen_s':0'3(_n5)) → true', rt ∈ Ω(1 + n5)