(0) Obligation:

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

tail(cons(X)) → Y
if(true) → X
if(false) → Y
primessieve(from(s(s(0))))
from(X) → cons(X)
head(cons(X)) → X
filter(s(s(X)), cons(Y)) → if(divides(s(s(X)), Y))
sieve(cons(X)) → cons(X)