(0) Obligation:

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

if(true) → X
if(false) → Y
fact(X) → if(zero(X))
add(0, X) → X
add(s(X), Y) → s(add(X, Y))
prod(0, X) → 0
prod(s(X), Y) → add(Y, prod(X, Y))
zero(0) → true
zero(s(X)) → false
p(s(X)) → X