Academy

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: p    qp \implies q
  • English: "If pp, then qq."
  • Terms: pp is the Hypothesis (Antecedent); qq is the Conclusion (Consequent).

The Secret of the Conditional: The only way to break the "promise" (p    qp \implies q) is if the hypothesis pp is True, but the conclusion qq is False. In every other case, the statement is considered True.

ppqqp    qp \implies q
TTT (Promise Kept)
TFF (Promise Broken)
FTT (Vacuously True)
FFT (Vacuously True)

2. The Biconditional (Double Implication)

The biconditional is a "two-way street." It is only True when both pp and qq have the same truth value.

  • Symbol: p    qp \iff q
  • English: "pp if and only if qq" (often shortened to iff).
ppqqp    qp \iff q
TTT
TFF
FTF
FFT

3. Visualizing Conditionals with Mermaid

We can think of a conditional as a "Switch" or a "Guard" in a flow-chart.

{`graph TD Start((Start)) --> P{Is P True?} P -- No --> True1[Result is True: Vacuous] P -- Yes --> Q{Is Q True?} Q -- Yes --> True2[Result is True: Valid] Q -- No --> False1[Result is False: Broken Promise]`}

4. Variations of "If-Then"

When we have p    qp \implies q, there are three related statements that students often confuse:

  1. Converse: q    pq \implies p (Flip the order)
  2. Inverse: ¬p    ¬q\neg p \implies \neg q (Negate both)
  3. Contrapositive: ¬q    ¬p\neg q \implies \neg p (Flip and Negate)

Critical Fact: A statement is always logically equivalent to its Contrapositive, but not necessarily to its Converse or Inverse.

{`graph LR A["p ⟹ q"] -- Equivalent --> B["¬q ⟹ ¬p (Contrapositive)"] A -- NOT Equivalent --> C["q ⟹ p (Converse)"]`}

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