I'm trying to write a delayed replacement rule that is capable of matching both the functions and their parameters, like
h[1, k[2, x]] /. {f[n_, g[m_, x] _] _ :> f[0, g[m + n, x]]} The idea would be that I get the output h[0,k[3,x]] for the example I give here. However, obviously the point is that I want the rule to also match, for example f[3,g[5,x]] and give the answer f[0,g[8,x]]. Is it possible to write such a rule?
Thanks.