I have a friend, let's say his name is "Paul". Paul thinks he is right no matter what. His logic is infallible and it is impossible for him to be wrong. His way of doing something is the right way and if you question him or contend with his methods he will make you feel like shit for doing so.
If he wears pants a certain way and you don't, he will say you are wrong and need to be educated in pants-wearing. If you don't eat food a certain way he will call you out and make you feel like a complete idiot for having your own tastes. I.e. if you leave something behind on your plate he will make sure you remember it for the rest of the day and call you wasteful. If you try to discuss something with him he will get argumentative the moment you voice your own opinions but his opinions are fact and set in stone.
Needless to say, Paul gets on a lot of people's nerves including my own. I used to hangout with him often but have refrained from doing so lately because I feel like the next thing he says will irritate me to the point where I will physically assault him. And I am not even a violent person.
If this happens then simply "unfriend" him/her. I would do that.
Can't stand these kind of people that know everything better than others.
My ex girlfriend was like that. I was always wrong, and she right. After a month I broke up. Problem solved.