(0) Obligation:

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

f(x, y, z) → g(<=(x, y), x, y, z)
g(true, x, y, z) → z
g(false, x, y, z) → f(f(p(x), y, z), f(p(y), z, x), f(p(z), x, y))
p(0) → 0
p(s(x)) → x

Q is empty.