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

diff(x, y) → cond1(equal(x, y), x, y)
cond1(true, x, y) → 0
cond1(false, x, y) → cond2(gt(x, y), x, y)
cond2(true, x, y) → s(diff(x, s(y)))
cond2(false, x, y) → s(diff(s(x), y))
gt(0, v) → false
gt(s(u), 0) → true
gt(s(u), s(v)) → gt(u, v)
equal(0, 0) → true
equal(s(x), 0) → false
equal(0, s(y)) → false
equal(s(x), s(y)) → equal(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:

diff'(x, y) → cond1'(equal'(x, y), x, y)
cond1'(true', x, y) → 0'
cond1'(false', x, y) → cond2'(gt'(x, y), x, y)
cond2'(true', x, y) → s'(diff'(x, s'(y)))
cond2'(false', x, y) → s'(diff'(s'(x), y))
gt'(0', v) → false'
gt'(s'(u), 0') → true'
gt'(s'(u), s'(v)) → gt'(u, v)
equal'(0', 0') → true'
equal'(s'(x), 0') → false'
equal'(0', s'(y)) → false'
equal'(s'(x), s'(y)) → equal'(x, y)

Rewrite Strategy: INNERMOST

Infered types.

Rules:
diff'(x, y) → cond1'(equal'(x, y), x, y)
cond1'(true', x, y) → 0'
cond1'(false', x, y) → cond2'(gt'(x, y), x, y)
cond2'(true', x, y) → s'(diff'(x, s'(y)))
cond2'(false', x, y) → s'(diff'(s'(x), y))
gt'(0', v) → false'
gt'(s'(u), 0') → true'
gt'(s'(u), s'(v)) → gt'(u, v)
equal'(0', 0') → true'
equal'(s'(x), 0') → false'
equal'(0', s'(y)) → false'
equal'(s'(x), s'(y)) → equal'(x, y)

Types:
diff' :: 0':s' → 0':s' → 0':s'
cond1' :: true':false' → 0':s' → 0':s' → 0':s'
equal' :: 0':s' → 0':s' → true':false'
true' :: true':false'
0' :: 0':s'
false' :: true':false'
cond2' :: true':false' → 0':s' → 0':s' → 0':s'
gt' :: 0':s' → 0':s' → true':false'
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:
diff', equal', gt'

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

Rules:
diff'(x, y) → cond1'(equal'(x, y), x, y)
cond1'(true', x, y) → 0'
cond1'(false', x, y) → cond2'(gt'(x, y), x, y)
cond2'(true', x, y) → s'(diff'(x, s'(y)))
cond2'(false', x, y) → s'(diff'(s'(x), y))
gt'(0', v) → false'
gt'(s'(u), 0') → true'
gt'(s'(u), s'(v)) → gt'(u, v)
equal'(0', 0') → true'
equal'(s'(x), 0') → false'
equal'(0', s'(y)) → false'
equal'(s'(x), s'(y)) → equal'(x, y)

Types:
diff' :: 0':s' → 0':s' → 0':s'
cond1' :: true':false' → 0':s' → 0':s' → 0':s'
equal' :: 0':s' → 0':s' → true':false'
true' :: true':false'
0' :: 0':s'
false' :: true':false'
cond2' :: true':false' → 0':s' → 0':s' → 0':s'
gt' :: 0':s' → 0':s' → true':false'
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:
equal', diff', gt'

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

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

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

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

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

Rules:
diff'(x, y) → cond1'(equal'(x, y), x, y)
cond1'(true', x, y) → 0'
cond1'(false', x, y) → cond2'(gt'(x, y), x, y)
cond2'(true', x, y) → s'(diff'(x, s'(y)))
cond2'(false', x, y) → s'(diff'(s'(x), y))
gt'(0', v) → false'
gt'(s'(u), 0') → true'
gt'(s'(u), s'(v)) → gt'(u, v)
equal'(0', 0') → true'
equal'(s'(x), 0') → false'
equal'(0', s'(y)) → false'
equal'(s'(x), s'(y)) → equal'(x, y)

Types:
diff' :: 0':s' → 0':s' → 0':s'
cond1' :: true':false' → 0':s' → 0':s' → 0':s'
equal' :: 0':s' → 0':s' → true':false'
true' :: true':false'
0' :: 0':s'
false' :: true':false'
cond2' :: true':false' → 0':s' → 0':s' → 0':s'
gt' :: 0':s' → 0':s' → true':false'
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:
equal'(_gen_0':s'3(_n5), _gen_0':s'3(_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:
gt', diff'

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

Proved the following rewrite lemma:
gt'(_gen_0':s'3(_n705), _gen_0':s'3(_n705)) → false', rt ∈ Ω(1 + n705)

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

Induction Step:
gt'(_gen_0':s'3(+(_\$n706, 1)), _gen_0':s'3(+(_\$n706, 1))) →RΩ(1)
gt'(_gen_0':s'3(_\$n706), _gen_0':s'3(_\$n706)) →IH
false'

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

Rules:
diff'(x, y) → cond1'(equal'(x, y), x, y)
cond1'(true', x, y) → 0'
cond1'(false', x, y) → cond2'(gt'(x, y), x, y)
cond2'(true', x, y) → s'(diff'(x, s'(y)))
cond2'(false', x, y) → s'(diff'(s'(x), y))
gt'(0', v) → false'
gt'(s'(u), 0') → true'
gt'(s'(u), s'(v)) → gt'(u, v)
equal'(0', 0') → true'
equal'(s'(x), 0') → false'
equal'(0', s'(y)) → false'
equal'(s'(x), s'(y)) → equal'(x, y)

Types:
diff' :: 0':s' → 0':s' → 0':s'
cond1' :: true':false' → 0':s' → 0':s' → 0':s'
equal' :: 0':s' → 0':s' → true':false'
true' :: true':false'
0' :: 0':s'
false' :: true':false'
cond2' :: true':false' → 0':s' → 0':s' → 0':s'
gt' :: 0':s' → 0':s' → true':false'
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:
equal'(_gen_0':s'3(_n5), _gen_0':s'3(_n5)) → true', rt ∈ Ω(1 + n5)
gt'(_gen_0':s'3(_n705), _gen_0':s'3(_n705)) → false', rt ∈ Ω(1 + n705)

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

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

Rules:
diff'(x, y) → cond1'(equal'(x, y), x, y)
cond1'(true', x, y) → 0'
cond1'(false', x, y) → cond2'(gt'(x, y), x, y)
cond2'(true', x, y) → s'(diff'(x, s'(y)))
cond2'(false', x, y) → s'(diff'(s'(x), y))
gt'(0', v) → false'
gt'(s'(u), 0') → true'
gt'(s'(u), s'(v)) → gt'(u, v)
equal'(0', 0') → true'
equal'(s'(x), 0') → false'
equal'(0', s'(y)) → false'
equal'(s'(x), s'(y)) → equal'(x, y)

Types:
diff' :: 0':s' → 0':s' → 0':s'
cond1' :: true':false' → 0':s' → 0':s' → 0':s'
equal' :: 0':s' → 0':s' → true':false'
true' :: true':false'
0' :: 0':s'
false' :: true':false'
cond2' :: true':false' → 0':s' → 0':s' → 0':s'
gt' :: 0':s' → 0':s' → true':false'
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:
equal'(_gen_0':s'3(_n5), _gen_0':s'3(_n5)) → true', rt ∈ Ω(1 + n5)
gt'(_gen_0':s'3(_n705), _gen_0':s'3(_n705)) → false', rt ∈ Ω(1 + n705)

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