(0) Obligation:

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

f(g(x), g(y)) → f(p(f(g(x), s(y))), g(s(p(x))))
p(0) → g(0)
g(s(p(x))) → p(x)

Q is empty.