I'm trying to write a fairly general replacement rule that will pull expressions independent of the variable of integration outside of Integrate, since Simplify and FullSimplify do not seem to do this.
So as an example I try
Integrate[f[x] Log[y], {x, r, s}] /.
Integrate[q_*r_, {v_, l_, h_}] /; FreeQ[r, v] ->
r*Integrate[q, {v, l, h}]
and that returns
(* (-r f[x] + s f[x]) Log[y] *)
Trace shows it correctly recognized the Log as independent of z and pulled it outside but then, even though it recognizes that f[x] depends on x, it incorrectly does the integration and finally assembles the result.
If f[x] is previously defined, say Sin[x], then this problem does not appear.
Is there a way to write this rule that would be correct in all circumstances?