(0) Obligation:

Generalized rewrite system (where rules with free variables on rhs are allowed):
The TRS R consists of the following rules:

sel(s(X), cons(Y)) → sel(X, Z)
f(X) → cons(X)
g(0) → s(0)
g(s(X)) → s(s(g(X)))
sel(0, cons(X)) → X