No, it is never OK as it is physical abuse. In addition, thinking the word 'consequence' is much more positive than the negative connotation that the word 'punish' has.
Violence will only generate more violence and that violence can pass along for generations. It is up to us right here, right now to STOP the cycle of violence.
Why would you want to teach violence anyway?
All it will do is build their tolerance for even more violence and they'll start becoming so used to the initial violence that your violence would only need to increase to have an effect. And that's Not the effect you want to have any way. Besides, if they learn violence, then you'll have even more bad behavior to deter because they'll learn that violence is OK and therefore have even more violent behavior. I think one must ask, if following this model, when would it stop?
Remember that positive will generate more positive and that will deter poor behavior much more effectively in the long run because they are learning positive rather than violence.
And if you are wondering, I do have a 4 year old.