In order to understand the relationship between Imam Ali and the previous 3 Khalifs, one needs to understand how Imam Ali prioritised the importance of safeguarding Islam as opposed to his personal interest. When Imam Ali realised that Islam was under threat, he let go of anything personal and went full on to protecting Islam. In doing so he had to be present in the life of the first three in order to ensure that Islam was neither eroded nor altered. Yes he cooperated with them, yes he worked along their side and yes he did lend his sincere advice to them to ensure that Islam remains intact and we today as his followers should follow his example when it comes to dealing with our brothers from other school of thought.