(0) Obligation:

Q restricted rewrite system:
The TRS R consists of the following rules:

g(s(x)) → f(x)
f(0) → s(0)
f(s(x)) → s(s(g(x)))
g(0) → 0

Q is empty.