Cognitive Dissonance

It's not just two opposite ideas

A white raven. Which is close enough to a crow. They're both corvids.
Not just a hypothetical example.

Cognitive dissonance is often defined as a kind of discomfort in the mind when someone has two beliefs that contradict each other. However, to really understand cognitive dissonance, you need to know that at least one of the ideas has to be something that a person considers to be defining of their character.

If you believed all crows are black, and then were confronted with evidence of a white crow, you would probably not experience any cognitive dissonance. The white crow is just a new fact that changes what you know about crows, and there's probably nothing about what kind of birds there are in the world that really matters to you. It's all just arbitrary facts.

Real cognitive dissonance happens when you encounter a new fact that conflicts with what you assume to be true about you, or, at least, about something really important to you. The classic example of cognitive dissonance is with police who later discover that they have put an innocent person in jail. Even when the evidence that overturns the conviction is absolutely incontrovertible, such as rock solid DNA evidence, studies have shown that most, if not all, police and prosecutors will continue to believe they did the right thing by putting that person in jail.

Putting criminals in prison is part of how these law enforcement agents define themselves as people. That they are agents of good, doing something beneficial for society, and deserving of respect. Discovering that they put good people as well as bad people in prison threatens their self identity by making it seem like maybe they're merely cogs in an oppressive state machine, or something like that. The harsher the punishment, the more clearly innocent the accused turned out the be, the more the average law enforcement officer will resist the facts and cling to ideas that help them preserve the sense of self that they feel good about. They can achieve that end by grasping at alternate justifications for what they did, such as saying that the suspect was probably guilty of something else anyway.

The definitive book on cognitive dissonance, and where I derive my definition from, is Mistakes Were Made (but Not By Me), by Carol Tavris and Eliot Aronson . If you're interested in the topic, I recommend it.