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

f(0) → 0
f(s(0)) → s(0)
f(s(s(x))) → p(h(g(x)))
g(0) → pair(s(0), s(0))
g(s(x)) → h(g(x))
h(x) → pair(+(p(x), q(x)), p(x))
p(pair(x, y)) → x
q(pair(x, y)) → y
+(x, 0) → x
+(x, s(y)) → s(+(x, y))
f(s(s(x))) → +(p(g(x)), q(g(x)))
g(s(x)) → pair(+(p(g(x)), q(g(x))), p(g(x)))

Rewrite Strategy: INNERMOST

Renamed function symbols to avoid clashes with predefined symbol.

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

f'(0') → 0'
f'(s'(0')) → s'(0')
f'(s'(s'(x))) → p'(h'(g'(x)))
g'(0') → pair'(s'(0'), s'(0'))
g'(s'(x)) → h'(g'(x))
h'(x) → pair'(+'(p'(x), q'(x)), p'(x))
p'(pair'(x, y)) → x
q'(pair'(x, y)) → y
+'(x, 0') → x
+'(x, s'(y)) → s'(+'(x, y))
f'(s'(s'(x))) → +'(p'(g'(x)), q'(g'(x)))
g'(s'(x)) → pair'(+'(p'(g'(x)), q'(g'(x))), p'(g'(x)))

Rewrite Strategy: INNERMOST

Infered types.

Rules:
f'(0') → 0'
f'(s'(0')) → s'(0')
f'(s'(s'(x))) → p'(h'(g'(x)))
g'(0') → pair'(s'(0'), s'(0'))
g'(s'(x)) → h'(g'(x))
h'(x) → pair'(+'(p'(x), q'(x)), p'(x))
p'(pair'(x, y)) → x
q'(pair'(x, y)) → y
+'(x, 0') → x
+'(x, s'(y)) → s'(+'(x, y))
f'(s'(s'(x))) → +'(p'(g'(x)), q'(g'(x)))
g'(s'(x)) → pair'(+'(p'(g'(x)), q'(g'(x))), p'(g'(x)))

Types:
f' :: 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
p' :: pair' → 0':s'
h' :: pair' → pair'
g' :: 0':s' → pair'
pair' :: 0':s' → 0':s' → pair'
+' :: 0':s' → 0':s' → 0':s'
q' :: pair' → 0':s'
_hole_0':s'1 :: 0':s'
_hole_pair'2 :: pair'
_gen_0':s'3 :: Nat → 0':s'

Heuristically decided to analyse the following defined symbols:
g', +'

They will be analysed ascendingly in the following order:
+' < g'

Rules:
f'(0') → 0'
f'(s'(0')) → s'(0')
f'(s'(s'(x))) → p'(h'(g'(x)))
g'(0') → pair'(s'(0'), s'(0'))
g'(s'(x)) → h'(g'(x))
h'(x) → pair'(+'(p'(x), q'(x)), p'(x))
p'(pair'(x, y)) → x
q'(pair'(x, y)) → y
+'(x, 0') → x
+'(x, s'(y)) → s'(+'(x, y))
f'(s'(s'(x))) → +'(p'(g'(x)), q'(g'(x)))
g'(s'(x)) → pair'(+'(p'(g'(x)), q'(g'(x))), p'(g'(x)))

Types:
f' :: 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
p' :: pair' → 0':s'
h' :: pair' → pair'
g' :: 0':s' → pair'
pair' :: 0':s' → 0':s' → pair'
+' :: 0':s' → 0':s' → 0':s'
q' :: pair' → 0':s'
_hole_0':s'1 :: 0':s'
_hole_pair'2 :: pair'
_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:
+', g'

They will be analysed ascendingly in the following order:
+' < g'

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

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

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

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

Rules:
f'(0') → 0'
f'(s'(0')) → s'(0')
f'(s'(s'(x))) → p'(h'(g'(x)))
g'(0') → pair'(s'(0'), s'(0'))
g'(s'(x)) → h'(g'(x))
h'(x) → pair'(+'(p'(x), q'(x)), p'(x))
p'(pair'(x, y)) → x
q'(pair'(x, y)) → y
+'(x, 0') → x
+'(x, s'(y)) → s'(+'(x, y))
f'(s'(s'(x))) → +'(p'(g'(x)), q'(g'(x)))
g'(s'(x)) → pair'(+'(p'(g'(x)), q'(g'(x))), p'(g'(x)))

Types:
f' :: 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
p' :: pair' → 0':s'
h' :: pair' → pair'
g' :: 0':s' → pair'
pair' :: 0':s' → 0':s' → pair'
+' :: 0':s' → 0':s' → 0':s'
q' :: pair' → 0':s'
_hole_0':s'1 :: 0':s'
_hole_pair'2 :: pair'
_gen_0':s'3 :: Nat → 0':s'

Lemmas:
+'(_gen_0':s'3(a), _gen_0':s'3(_n5)) → _gen_0':s'3(+(_n5, a)), 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:
g'

Proved the following rewrite lemma:
g'(_gen_0':s'3(+(1, _n632))) → _*4, rt ∈ Ω(3n)

Induction Base:
g'(_gen_0':s'3(+(1, 0)))

Induction Step:
g'(_gen_0':s'3(+(1, +(_\$n633, 1)))) →RΩ(1)
pair'(+'(p'(g'(_gen_0':s'3(+(1, _\$n633)))), q'(g'(_gen_0':s'3(+(1, _\$n633))))), p'(g'(_gen_0':s'3(+(1, _\$n633))))) →IH
pair'(+'(p'(_*4), q'(g'(_gen_0':s'3(+(1, _\$n633))))), p'(g'(_gen_0':s'3(+(1, _\$n633))))) →IH
pair'(+'(p'(_*4), q'(_*4)), p'(g'(_gen_0':s'3(+(1, _\$n633))))) →IH
pair'(+'(p'(_*4), q'(_*4)), p'(_*4))

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