Rewriting an expression in terms of other expressions or functions
I'd like to know if there is a way to ask Sage to write a given expression in terms of other expressions or functions. The user could have an insight about the latter while the CAS would be stuck. What I want is something like
write(a^2 - b^2, a-b)
write(cos(x+y), (cos(x), sin(x), cos(y), sin(y)))
write(gamma(p+1), gamma(p)) # or any other recurrence relation the user wants to check
Something like directed simplification, but not wholesale.