Implications, Converses and Contrapositives
"If p then q" is a promise, and the only way to break it is for p to happen while q doesn't. Flipping it around to "if not q then not p" (the contrapositive) says exactly the same thing, but "if q then p" (the converse) is a different claim.
What the symbols mean
- Implication
If p then q: false only when p is true and q is false.
- Equivalent or-form
Either p fails or q holds.
- Contrapositive
If q fails, then p fails. Always equivalent to the implication.
Explanation
An implication is simply an "if this, then that" sentence, and the big question is when such a sentence counts as a lie. The name comes from "imply": says that being true forces to be true too. Every theorem has this shape ("if a function is differentiable, then it's continuous"), so it's worth getting exactly right. The formula looks dense, but it's three ways of saying one thing: (if p happens, q happens), (either p doesn't happen, or q does) and (if q didn't happen, p didn't either). It's just one promise said three ways.
So far our connectives have been symmetric: and mean the same thing. "If ... then" is different, and it's the connective every theorem is built on.
Think of as a promise: "if you finish your homework (), you can play ()." When is the promise broken? Only if you finish and still can't play. If you don't finish, nobody can accuse the promise of lying, whether you end up playing or not. It just wasn't tested. So in those rows the implication counts as true, and we call it vacuously true:
| T | T | T |
| T | F | F |
| F | T | T |
| F | F | T |
Notice that the only F row has true and false. That gives a second way to write the implication: either fails or holds, which is .
By shuffling and negating the two parts of you can form three related statements:
- the converse ,
- the inverse ,
- the contrapositive .
Why is the contrapositive the same as the original? Think about the promise again. If you can't play, then you must not have finished your homework, because finishing would have guaranteed playing. Both statements rule out exactly the same situation: true and false. The converse and inverse rule out a different one ( true, false), so they agree with each other but not with the original.
A common mistake. It's tempting to think that if is true, then must be too, because they sound so similar. It isn't. "If a number is divisible by 4, it's even" is true, but its converse "if a number is even, it's divisible by 4" fails for 6. Proving the converse when you meant to prove the original is one of the most common errors in proofs.
When both directions do hold, we write the biconditional ("p if and only if q"). It means and together, so the two statements always agree.
See it
Worked examples
Write the converse and the contrapositive of "if a number is divisible by 4, then it is even." Which are true?
- 1
Converse: swap the two parts to get "if a number is even, then it is divisible by 4." This one is false, since 6 is even but not divisible by 4.
Practice
Type your answer and check it. Solve them all to complete the lesson.
When is false?
"If it rains, the ground is wet." Which statement is logically equivalent?
In how many rows of its truth table is true?
Is "if , then the moon is made of cheese" true or false?
A thermostat's firmware should obey the rule "if the temperature is below 18 °C, the heater is on." Which log entry proves the firmware breaks the rule?
In how many rows of its truth table is true?
The hardest one here. Get it, and you've got this lesson.
Four cards each have a number on one side and a color on the other. You see 3, 8, red and brown. The rule to test: "if a card shows an even number, its other side is red." Which cards must you turn over to check the rule, and no others?
Where it's used
If-statements in code, database constraints and security policies are implications, and testers often check the contrapositive: if the output is wrong, which condition failed?