Replace product of variables to zero

It seems very simple question, I wish to get rid of the higher order by product of a*b. Any help is appreciated!

f = a^4 + 4 a^3 b + 6 a^2 b^2 + 4 a b^3 + b^4
f /. a b -> 0
(*output*)
a^4 + 4 a^3 b + 6 a^2 b^2 + 4 a b^3 + b^4
(*I want to have*)
a^4+b^4

Looking at FullForm, it seems this pattern will do it

pat0 = Times[_. , a | Power[a, _], b | Power[b, _]]

Examples:

f = a^4 + 4 a^3 b + 6 a^2 b^2 + 4 a b^3 + b^4;
f1 = 3 (a b - 2 c);
f2 = (a b - 2 c)/(c - a b)
DeleteCases[f, pat0, Infinity]
DeleteCases[f1, pat0, Infinity]
DeleteCases[f2, pat0, Infinity] • Thank you for the answer! Can I ask one more case? it works nicely with no denominator, but with it ,(a b - 2 c )/(c - a b), it does not work.How can I do it for the denominator? – Saesun Kim Sep 3 '16 at 22:31
• @SaesunKim added option Infinity. This seems to work now on the new expression you added. Infinity tells it to keep searching for the pattern. – Nasser Sep 3 '16 at 23:17
• Thank you so much. It is really amazing! I really appreciate your help :D – Saesun Kim Sep 3 '16 at 23:26
• Wouldn't it be nice if your solution works on the equivalent expression f=(a + b)^4 ? – yarchik Sep 4 '16 at 17:36
• @yarchik it will work, but need to expand first. This works: DeleteCases[Expand[(a + b)^4], pat0, Infinity] gives a^4+b^4. – Nasser Sep 5 '16 at 8:20

I would use an algebraic function for an algebraic operation, similar to what I did in the similar question, Replacement rules and algebra:

PolynomialMod[f, a b]
(*  a^4 + b^4  *)

Works with the rational function from a comment by the OP:

Block[{f = (a b - 2 c)/(c - a b)},
PolynomialMod[f, a b]
]
(*  -2  *)
• Thank you for introducing cool command! I can see that polynomialMod can be really useful! – Saesun Kim Sep 5 '16 at 17:36
f /. a^(_:1) b^(_:1) :> 0

a^4 + b^4

• (a + b)^4 /. a^(_ : 1) b^(_ : 1) :> 0 yields the same expression... – yarchik Sep 4 '16 at 17:37