Rules of Inference
# CHAPTER 6
Rules of Inference
1. Introduction
If you have 5 variables ($p, q, r, s, t$), generating a Truth Table to prove a compound logic statement requires $2^5 = 32$ rows. If you have 10 variables, you need 1,024 rows! Truth Tables rapidly become mathematically impossible to calculate by hand. To bypass the explosion of Truth Tables, mathematicians and computer scientists use Rules of Inference. These are universally proven logical "shortcuts." By chaining these verified shortcuts together, we can construct formal Proofs—deducing absolute new truths purely from existing data without ever drawing a table.2. Learning Objectives
By the end of this chapter, you will be able to:- Define what constitutes a valid Logical Argument and a Proof.
- Master the fundamental Rules of Inference (Modus Ponens, Modus Tollens, etc.).
- Construct a step-by-step mathematical proof.
- Identify common logical fallacies that destroy algorithmic integrity.
3. Arguments and Validity
An Argument is a sequence of propositions ending with a conclusion.- Premises: The facts we assume to be absolutely True (e.g., $p \rightarrow q$).
- Conclusion: The final statement we are trying to prove is True (indicated by the symbol $\therefore$, meaning "therefore").
An argument is Valid if, whenever all the premises are True, the conclusion is mathematically guaranteed to be True.
4. Modus Ponens (The Law of Detachment)
The most famous and fundamental rule of logic. If we know that an implication is true, and we know the hypothesis actually happened, the conclusion must be true.The Rule:
- 1. $p \rightarrow q$ (If you study, you pass)
- 2. $p$ (You studied)
*Code Application:* This is the exact definition of a standard if block. If the condition triggers, the block executes.
5. Modus Tollens (The Law of Contraposition)
Based on the Contrapositive (Chapter 4). If an implication is true, but the conclusion NEVER happened, the hypothesis could not have happened either.The Rule:
- 1. $p \rightarrow q$ (If you study, you pass)
- 2. $\neg q$ (You DID NOT pass)
*Code Application:* Reverse debugging. If the final database entry is missing ($\neg q$), we logically prove that the initial API call must have failed ($\neg p$).
6. Hypothetical Syllogism (The Chain Rule)
If Cause A triggers Effect B, and Effect B triggers Effect C, then Cause A mathematically guarantees Effect C.The Rule:
- 1. $p \rightarrow q$ (If it rains, the grass is wet)
- 2. $q \rightarrow r$ (If the grass is wet, I will slip)
*Code Application:* Transitive routing in networks. If Server A connects to Server B, and B connects to C, Server A can route packets to C.
7. Other Core Rules
- Disjunctive Syllogism:
- 1. $p \lor q$ (I will eat pizza OR tacos)
- 2. $\neg p$ (I did NOT eat pizza)
- Addition:
- 1. $p$ (I have an Apple)
- Simplification:
- 1. $p \land q$ (I have an Apple AND a Banana)
8. Constructing a Formal Proof
Let's prove a conclusion using a chain of rules. Premises Given:- 1. $p \rightarrow q$
- 2. $\neg q$
- 3. $p \lor r$
Goal: Prove that $r$ is True.
The Proof: Step 1: $p \rightarrow q$ (Given Premise 1) Step 2: $\neg q$ (Given Premise 2) Step 3: $\therefore \neg p$ (Applying Modus Tollens to Steps 1 and 2). Step 4: $p \lor r$ (Given Premise 3) Step 5: $\therefore r$ (Applying Disjunctive Syllogism to Steps 3 and 4: We know it must be $p$ or $r$, but Step 3 proved it is NOT $p$. Therefore, it MUST be $r$!). *Proof Complete!*
9. Common Mistakes (Fallacies)
- Fallacy of Affirming the Consequent:
- 1. $p \rightarrow q$ (If you study, you pass)
- 2. $q$ (You passed)
10. Exercises
- 1. State the Rule of Inference used here: "If $x > 10$, then $x > 5$. We know $x > 10$. Therefore, $x > 5$."
- 2. Write a formal 3-step proof. Premises: $A \rightarrow B$, $B \rightarrow C$, $A$. Prove: $C$.
11. MCQs with Answers
What severe geometric limitation associated with Truth Tables directly necessitates the deployment of Rules of Inference in discrete mathematics?
When constructing a formal mathematical proof, what explicitly defines a "Valid" argument?
Which legendary Rule of Inference governs the fundamental execution logic of a standard programming if-then statement (e.g., Premises: $p \rightarrow q$ and $p$; Conclusion: $q$)?
If an engineer knows that "If the database crashes, the server halts" ($p \rightarrow q$), and observes that the server is currently running perfectly ($\neg q$), what Rule of Inference proves the database did not crash ($\neg p$)?
When routing global internet packets, if Node A maps to Node B ($A \rightarrow B$), and Node B maps to Node C ($B \rightarrow C$), which Rule of Inference proves that Node A can successfully reach Node C ($A \rightarrow C$)?
What logical conclusion is mathematically proven by applying "Disjunctive Syllogism" to the premises: ($p \lor q$) and ($\neg p$)?
If an API verifies that a user is both an Admin AND verified ($p \land q$), what Rule of Inference allows the system to securely authorize the isolated statement that the user is an Admin ($p$)?
What catastrophic structural error defines the "Fallacy of Affirming the Consequent"?
Is it mathematically legal to use the "Addition" Rule of Inference to transform the premise "$p$" into the conclusion "$p \lor Z$", where $Z$ is a completely random, undefined variable?
12. Interview Preparation
Top Interview Questions:- *Logical Deduction:* "You are debugging a server. Rule 1: If the Cache fails, the Database handles the load. Rule 2: If the Database handles the load, latency spikes. You observe that latency did NOT spike. Did the Cache fail?" *(Answer: No! Apply Modus Tollens to Rule 2 to prove the DB did NOT handle the load. Then apply Modus Tollens to Rule 1 to prove the Cache did NOT fail!)*