Conditional Logic
Understanding the 'If-Then' flow and Biconditional statements in Propositional Calculus.
Conditional Logic: The Flow of Truth
In the previous lesson, we looked at "Glue" (AND, OR, NOT). Now, we look at Direction. Conditional statements allow us to describe relationships where one event depends on another.
1. The Conditional (Implication)
The conditional statement is the foundation of mathematical proofs. it expresses a "promise."
- Symbol:
- English: "If , then ."
- Terms: is the Hypothesis (Antecedent); is the Conclusion (Consequent).
The Secret of the Conditional: The only way to break the "promise" () is if the hypothesis is True, but the conclusion is False. In every other case, the statement is considered True.
| T | T | T (Promise Kept) |
| T | F | F (Promise Broken) |
| F | T | T (Vacuously True) |
| F | F | T (Vacuously True) |
2. The Biconditional (Double Implication)
The biconditional is a "two-way street." It is only True when both and have the same truth value.
- Symbol:
- English: " if and only if " (often shortened to iff).
| T | T | T |
| T | F | F |
| F | T | F |
| F | F | T |
3. Visualizing Conditionals with Mermaid
We can think of a conditional as a "Switch" or a "Guard" in a flow-chart.
4. Variations of "If-Then"
When we have , there are three related statements that students often confuse:
- Converse: (Flip the order)
- Inverse: (Negate both)
- Contrapositive: (Flip and Negate)
Critical Fact: A statement is always logically equivalent to its Contrapositive, but not necessarily to its Converse or Inverse.
5. Programming the "If-Then"
In Python, we use these for control flow. Note that if statements in code are slightly different from formal logic, but the underlying Boolean check is identical.
# Conditional Logic in Python
def check_p_implies_q(p, q):
# Logic: p -> q is equivalent to (not p) or q
return (not p) or q
print(check_p_implies_q(True, False)) # Results in False