This blog post is my attempt to explain these topics: implication, conditional, equivalence and biconditional.
I’ll also try to discuss examples both in natural language and code.
In natural language we often hear expressions or statements like this one:
If Athletic Bilbao wins, I’ll take a beer
This sentence (S) has the following propositions:
p = “Athletic Bilbao wins”
q = “I take a beer”
With this sentence, we mean that first proposition (p) causes or brings about the second proposition (q).
There is a causal relationship between p and q. The truth of q is set by p, so being p TRUE, q has to be TRUE in order to make the sentence valid or TRUE as a whole. With the same reasoning, if p is TRUE and q is FALSE, the sentence would be FALSE, which in natural language would be: “Athletic Bilbao wins and I don’t take a beer”
However, think about this: Is q only TRUE when p is TRUE? Let’s see this case:
Athletic Bilbao does not win and I take a beer
Is this case against S? Not really, as S does not state what happens if p is not TRUE so we could think that if p is FALSE anything can happen.
So in natural language or in common way of thinking, if p is FALSE, according to S we could simply think that we don’t know whether it’s TRUE of FALSE. S just tells us that if p is TRUE, we can be sure that q follows so it’s TRUE too. That way “Athletic Bilbao wins and I take a beer” is certainly FALSE whereas “Athletic Bilbao does not win and I take a beer” could be TRUE or FALSE.
There are two problems with the implication: we need to be precise and decide a value for that “unknown” case as a proposition is expected to evaluate as being TRUE or FALSE, there is no “unknown” value. The same happens in computer science where we just have 2 values (0 and 1).
In order to be precise, we need to leave causality apart and focus on the truth values. We need an unambiguous meaning that depends only on truth and falsity, and we’ll use a different name for it: conditional.
We separate the notion of implication into two parts: the truth part and the causation part:
implication = conditional + causation
So now we’ll focus on the truth part known as conditional, also called material conditional or material implication.
We’ll use the arrow symbol (→) for implication and the double arrow (⇒) for conditional.
Any expression of the form p ⇒ q is a conditional, p being the antecedent and q being the consequent: antecedent ⇒ consequent
We can define the truth or falsity of a conditional entirely by the truth or falsity of antecedent and consequent, leaving apart whether there is a semantic relation between antecedent and consequent.
So it can happen that there is no actual semantic relation (no causation) between antecedent and consequent so we would have a conditional but not an implication. In that case be aware that we can see counterintuitive or absurd cases.
This would be a conditional example given in Introduction to Mathematical Thinking book:
(Julius Caesar is dead) ⇒ (π > 3)
There is no relationship between that antecedent being true and that consequent being true, no causality. We can say this conditional p ⇒ q does not fully capture p → q.
So, let’s focus on truth values and let’s fill this truth table:
|p||q||p ⇒ q|
We already talked about the first one, the implication clearly states it as the truth of p implies the truth of q:
|p||q||p ⇒ q|
The same way the implication stated that being p TRUE q has to be TRUE, if q is FALSE we consider the statement is FALSE.
|p||q||p ⇒ q|
Now we need to fill the other two rows, we cannot leave them as unknown, they need to be TRUE or FALSE. The key to filling this is remembering that we’re working with the conditional (⇒), not with the whole implication so that we can leave aside the causality.
Conditional states that if p is TRUE, q has to be true. What would its negation imply?
p ⇏ q
We would read it as “p does not imply q” but leaving causality aside. So in term of truth values, p will not imply q if it is the case that although p is true, q is nevertheless false.
It would be true precisely for that case:
|p||q||p ⇏ q|
So we have defined the truth table of p ⇏ q so we can fill p ⇒ q as it’s just the negation:
|p||q||p ⇒ q|
We can say that conditional is a notion that extends implication defining those cases where the antecedent is FALSE or there is no causality between antecedent and consequent (e.g (Julius Caesar is dead) ⇒ (π > 3) )
When there is a semantic relationship between p and q and in addition p is true (first two rows of truth table), the truth value of the conditional will be the same as the truth value of the implication.
This would be an example of Vacuous Truth: “If 4 is odd, then 3=3″
Another way to understand the 2 last rows is by the Principle of Explosion.
In Set Theory we would represent conditional as 𝑝 ⊃ 𝑞
Let’s try to understand the Venn Diagram we can see on the Wikipedia page:
We have P and Q sets and we’re painting in blue the TRUE value for the conditional.
We’ll first fill the first row of the p ⇒ q truth table:
We skip the second row as it’s FALSE (nothing to pain) and we paint the third row:
And the last row:
Now let’s see the different ways we can describe a conditional in natural language trying to understand which part is the antecedent and which part is the consequent:
- p implies q
- if p then q
- p is sufficient for q
- p only if q (or p only when q)
- Not the same as “if q then p”.
- e.g “You can be in F1 only if you have a car” vs “If you have a car you can be in F1”
- Not the same as “if q then p”.
- q if p
- q whenever p
- q is necessary for p
You need to be careful with the “necessary” word. q being necessary for p does not mean that q on its own is enough for p. It means q will have to hold before having any question of p holding and for that p must imply q.
Equivalence and biconditional
Now that we understand the implication and conditional, understanding equivalence (⟷) and biconditional (⟺) is easy. Equivalence is the implication in both ways.
“p is equivalent to q” is itself equivalent to:
- p is equivalent to q
- p is necessary and sufficient for q
- p if and only if q (abbreviated “iff”)
|p||q||p ⇒ q||q ⇒ p||p ⟺ q|
Just some examples:
- “The team wins only when Ivan is playing” (The team wins being p)
- “When Ivan plays the team wins” (Ivan plays being the antecedent)
See that “if/when” goes with the antecedent unless it includes “only” word.
- p ⇒ (q ⇒ r) and (p and q) ⇒ r are equivalent, think about it or make the truth table…
- p ⇒ q is equivalent to [ (¬ p) or q ]
- p ⟺ q is equivalent to (p ⇒ q) and (q ⇒ p)
Remember: when you need to make a proof of an equivalence, it needs to be proved with the conditional in both directions.
Some more related propositions related to conditional that you should know:
- q ⇒ p (reciprocal)
¬ p ⇒ ¬ q (inverse)
- p ⇒ q ⟺ [¬ q ⇒ ¬ p] (contrapositive)
- One way to prove an implication is to verify the contrapositive
- [p ⟺ q] ⟺ [¬ p ⟺ ¬ q]
Conditional in code
Now that you understand how we went from the implication to the conditional concept, how would you write a program that prints the truth table for the conditional?
You might think something like this:
def conditional(a,b): if a: return b
But, are you sure it’s correct? Let’s complete it with a run example:
def conditional(a,b): if a: return b print("\tp\tq\tp =>q") for p in (True, False): for q in (True, False): print("%10s %10s %s" %(p,q, conditional(p, q)))
You can run that python code and see it outputs:
p q p =>q
True True True
True False False
False True None
False False None
“None”? That’s not ok, the conditional is not well defined. This would be the correct script:
def conditional(a,b): if a: return b else: return True print("\tp\tq\tp =>q") for p in (True, False): for q in (True, False): print("%10s %10s %s" %(p,q, conditional(p, q)))
See the difference?
Hope you’ve liked this blog post, comments are welcomed 🙂