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

f(0, 1, x) → f(g(x), g(x), x)
f(g(x), y, z) → g(f(x, y, z))
f(x, g(y), z) → g(f(x, y, z))
f(x, y, g(z)) → g(f(x, y, z))

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', 1', x) → f'(g'(x), g'(x), x)
f'(g'(x), y, z) → g'(f'(x, y, z))
f'(x, g'(y), z) → g'(f'(x, y, z))
f'(x, y, g'(z)) → g'(f'(x, y, z))

Rewrite Strategy: INNERMOST

Infered types.

Rules:
f'(0', 1', x) → f'(g'(x), g'(x), x)
f'(g'(x), y, z) → g'(f'(x, y, z))
f'(x, g'(y), z) → g'(f'(x, y, z))
f'(x, y, g'(z)) → g'(f'(x, y, z))

Types:
f' :: 0':1':g' → 0':1':g' → 0':1':g' → 0':1':g'
0' :: 0':1':g'
1' :: 0':1':g'
g' :: 0':1':g' → 0':1':g'
_hole_0':1':g'1 :: 0':1':g'
_gen_0':1':g'2 :: Nat → 0':1':g'

Heuristically decided to analyse the following defined symbols:
f'

Rules:
f'(0', 1', x) → f'(g'(x), g'(x), x)
f'(g'(x), y, z) → g'(f'(x, y, z))
f'(x, g'(y), z) → g'(f'(x, y, z))
f'(x, y, g'(z)) → g'(f'(x, y, z))

Types:
f' :: 0':1':g' → 0':1':g' → 0':1':g' → 0':1':g'
0' :: 0':1':g'
1' :: 0':1':g'
g' :: 0':1':g' → 0':1':g'
_hole_0':1':g'1 :: 0':1':g'
_gen_0':1':g'2 :: Nat → 0':1':g'

Generator Equations:
_gen_0':1':g'2(0) ⇔ 1'
_gen_0':1':g'2(+(x, 1)) ⇔ g'(_gen_0':1':g'2(x))

The following defined symbols remain to be analysed:
f'

Proved the following rewrite lemma:
f'(_gen_0':1':g'2(+(1, _n4)), _gen_0':1':g'2(b), _gen_0':1':g'2(c)) → _*3, rt ∈ Ω(n4)

Induction Base:
f'(_gen_0':1':g'2(+(1, 0)), _gen_0':1':g'2(b), _gen_0':1':g'2(c))

Induction Step:
f'(_gen_0':1':g'2(+(1, +(_\$n5, 1))), _gen_0':1':g'2(_b2151), _gen_0':1':g'2(_c2152)) →RΩ(1)
g'(f'(_gen_0':1':g'2(+(1, _\$n5)), _gen_0':1':g'2(_b2151), _gen_0':1':g'2(_c2152))) →IH
g'(_*3)

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

Rules:
f'(0', 1', x) → f'(g'(x), g'(x), x)
f'(g'(x), y, z) → g'(f'(x, y, z))
f'(x, g'(y), z) → g'(f'(x, y, z))
f'(x, y, g'(z)) → g'(f'(x, y, z))

Types:
f' :: 0':1':g' → 0':1':g' → 0':1':g' → 0':1':g'
0' :: 0':1':g'
1' :: 0':1':g'
g' :: 0':1':g' → 0':1':g'
_hole_0':1':g'1 :: 0':1':g'
_gen_0':1':g'2 :: Nat → 0':1':g'

Lemmas:
f'(_gen_0':1':g'2(+(1, _n4)), _gen_0':1':g'2(b), _gen_0':1':g'2(c)) → _*3, rt ∈ Ω(n4)

Generator Equations:
_gen_0':1':g'2(0) ⇔ 1'
_gen_0':1':g'2(+(x, 1)) ⇔ g'(_gen_0':1':g'2(x))

No more defined symbols left to analyse.

The lowerbound Ω(n) was proven with the following lemma:
f'(_gen_0':1':g'2(+(1, _n4)), _gen_0':1':g'2(b), _gen_0':1':g'2(c)) → _*3, rt ∈ Ω(n4)