Rules of inference form the logical backbone of discrete mathematics, providing the rigorous framework required to construct valid arguments and prove theorems. Plus, without these standardized patterns of reasoning, mathematical proofs would lack the structural integrity necessary to guarantee truth. So naturally, in computer science, these rules translate directly into the logic gates that power processors, the algorithms that verify software correctness, and the inference engines driving artificial intelligence. Understanding them is not merely an academic exercise; it is the acquisition of a precise language for truth Easy to understand, harder to ignore. Practical, not theoretical..
What Are Rules of Inference?
At their core, rules of inference are syntactical transformation rules used to deduce a conclusion from a set of premises. And a premise is a proposition assumed to be true for the sake of the argument, while the conclusion is the proposition derived from those premises. An argument is considered valid if and only if it is impossible for all the premises to be true and the conclusion false. Crucially, validity depends entirely on the form of the argument, not the specific content of the propositions.
These rules operate within propositional logic and predicate logic. In predicate logic, we introduce quantifiers and variables, allowing for reasoning about objects and their properties. In propositional logic, we deal with simple statements connected by logical connectives (AND, OR, NOT, IMPLIES). Mastering these rules allows a mathematician or computer scientist to move from known truths to new, verified knowledge with absolute certainty.
Fundamental Rules of Inference for Propositional Logic
The following rules constitute the standard toolkit for propositional reasoning. Each can be verified via a truth table, confirming that the conclusion is a tautological consequence of the premises.
1. Modus Ponens (Law of Detachment)
This is perhaps the most intuitive and frequently used rule. It captures the essence of conditional reasoning.
- Form: $p \rightarrow q, \quad p \quad \therefore \quad q$
- Reading: "If $p$ implies $q$, and $p$ is true, then $q$ must be true."
- Example: "If the program compiles, then the syntax is correct. The program compiles. Because of this, the syntax is correct."
2. Modus Tollens (Law of Contrapositive)
This rule allows us to deny the antecedent by denying the consequent. It is logically equivalent to the contrapositive The details matter here..
- Form: $p \rightarrow q, \quad \neg q \quad \therefore \quad \neg p$
- Reading: "If $p$ implies $q$, and $q$ is false, then $p$ must be false."
- Example: "If the server is online, the website loads. The website does not load. Because of this, the server is not online."
3. Hypothetical Syllogism
This rule chains conditional statements together, enabling transitive reasoning.
- Form: $p \rightarrow q, \quad q \rightarrow r \quad \therefore \quad p \rightarrow r$
- Reading: "If $p$ implies $q$, and $q$ implies $r$, then $p$ implies $r$."
- Example: "If it rains, the ground gets wet. If the ground gets wet, the game is cancelled. That's why, if it rains, the game is cancelled."
4. Disjunctive Syllogism
This rule handles "OR" statements. If one option is false, the other must be true And it works..
- Form: $p \lor q, \quad \neg p \quad \therefore \quad q$
- Reading: "$p$ or $q$ is true. $p$ is false. That's why, $q$ is true."
- Example: "The error is in the frontend or the backend. The error is not in the frontend. Which means, the error is in the backend."
5. Addition
This rule allows the introduction of a disjunction. If a statement is true, it remains true when joined by OR with any other statement.
- Form: $p \quad \therefore \quad p \lor q$
- Reading: "$p$ is true. Which means, $p$ or $q$ is true."
- Note: This often feels counterintuitive to beginners because $q$ can be entirely unrelated or even false, yet the disjunction holds true because $p$ is true.
6. Simplification
This rule breaks a conjunction down into its components The details matter here. That's the whole idea..
- Form: $p \land q \quad \therefore \quad p$
- Reading: "$p$ and $q$ are true. So, $p$ is true."
7. Conjunction
The inverse of simplification; it combines two true statements into a single conjunction.
- Form: $p, \quad q \quad \therefore \quad p \land q$
- Reading: "$p$ is true. $q$ is true. Because of this, $p$ and $q$ are true."
8. Resolution
Resolution is the powerhouse of automated theorem proving and logic programming (like Prolog). It eliminates contradictory literals.
- Form: $p \lor q, \quad \neg p \lor r \quad \therefore \quad q \lor r$
- Reading: "Either $p$ or $q$. Either not $p$ or $r$. That's why, either $q$ or $r$."
- Significance: This single rule, combined with conversion to Conjunctive Normal Form (CNF), forms a complete inference system for propositional logic. It is the algorithmic heart of SAT solvers.
Rules of Inference for Quantified Statements (Predicate Logic)
Propositional logic cannot express statements like "All humans are mortal." Predicate logic introduces universal quantifiers ($\forall$, "for all") and existential quantifiers ($\exists$, "there exists"), requiring four additional rules to manipulate them Most people skip this — try not to..
1. Universal Instantiation (UI)
If a property holds for everything in the domain, it holds for any specific thing.
- Form: $\forall x P(x) \quad \therefore \quad P(c)$ (where $c$ is a specific element in the domain).
- Example: "All students in this class passed the exam. Alice is a student in this class. So, Alice passed the exam."
2. Universal Generalization (UG)
If we can prove a property holds for an arbitrary element (with no special assumptions about it), it holds for all elements.
- Form: $P(c)$ for arbitrary $c \quad \therefore \quad \forall x P(x)$.
- Critical Restriction: $c$ must be truly arbitrary. You cannot use UG on a specific known constant (e.g., "Alice passed, therefore everyone passed").
3. Existential Instantiation (EI)
If something exists with a property, we can give it a new, temporary name (a Skolem constant) to reason about it.
- Form: $\exists x P(x) \quad \therefore \quad P(c)$ (where $c$ is a new constant not used elsewhere in the proof).
- Restriction: The constant $c$ must be fresh. Reusing an existing constant implies we know which specific object it is, which the existential quantifier does not guarantee.
4. Existential Generalization (EG)
If a specific object has a property, then there exists at least one object with that property.
- Form: $P(c) \quad \therefore \quad \exists x P(x)$.
- Example: "Alice passed the exam. That's why, there exists a student who passed the exam."
Constructing Formal Proofs: A Step-by-Step Approach
A formal proof is a sequence
Building a Proof Step by Step
When you begin a formal proof, the first task is to state the goal clearly. Consider this: write down the premise(s) you are given and the conclusion you must derive. This makes it easy to see which rules will be useful and where you might need to introduce auxiliary lemmas Small thing, real impact..
A typical workflow looks like this:
- List the premises in the order they appear (or as they are most convenient to work with).
- Apply instantiation rules (UI, EI) to replace quantified statements with concrete instances that you can manipulate.
- Use propositional inference rules (modus ponens, resolution, etc.) to combine literals.
- Introduce new quantified statements via EG or UG only when the proof’s structure demands them.
- Check for contradictions or apply indirect techniques (reductio ad absurdum) if a direct route stalls.
- Close the proof by ensuring the final line matches the desired conclusion.
Example: Proving a Simple Syllogism
Premises
- ∀x (H(x) → M(x)) “All humans are mortal.”
- H(s)
Continuing the Example: Deriving “Socrates Is Mortal”
With the premises in hand we can now apply the rules of natural deduction to reach the desired conclusion, (M(s)) Most people skip this — try not to..
| Line | Formula | Justification |
|---|---|---|
| 1 | (\forall x,(H(x)\rightarrow M(x))) | Premise |
| 2 | (H(s)) | Premise |
| 3 | (H(s)\rightarrow M(s)) | Universal Instantiation (UI) on line 1 with (c = s) |
| 4 | (M(s)) | Modus Ponens on lines 2 and 3 |
The proof is complete: the conclusion (M(s)) follows directly from the two premises Easy to understand, harder to ignore..
Tackling More Complex Quantified Arguments
The simple syllogism above illustrates the core idea, but real‑world proofs often involve nested quantifiers, multiple existential witnesses, and indirect reasoning. Below are two illustrative patterns that frequently arise That's the whole idea..
1. From an Existential Statement to a Universal Conclusion
Goal: From (\exists x,P(x)) and (\forall x,(P(x)\rightarrow Q(x))) infer (\exists x,Q(x)).
| Line | Formula | Justification |
|---|---|---|
| 1 | (\exists x,P(x)) | Premise |
| 2 | (\forall x,(P(x)\rightarrow Q(x))) | Premise |
| 3 | (P(c)) | Existential Instantiation (EI) on line 1 (introduce a fresh constant (c)) |
| 4 | (P(c)\rightarrow Q(c)) | UI on line 2 with (c) |
| 5 | (Q(c)) | Modus Ponens on lines 3, 4 |
| 6 | (\exists x,Q(x)) | Existential Generalization (EG) on line 5 |
Notice the careful handling of the fresh constant (c). Because it does not appear elsewhere, the existential witness remains unnamed until the final EG step Took long enough..
2. Proving a Statement by Contradiction (Reductio ad Absurdum)
Goal: Show that (\neg\forall x,P(x)) holds given the assumption that every element satisfies (P(x)) leads to a contradiction.
| Line | Formula | Justification |
|---|---|---|
| 1 | (\forall x,P(x)) | Assumption for reductio |
| 2 | (P(a)) | UI on line 1 (choose any arbitrary element (a)) |
| 3 | (\neg P(a)) | Premise (or derived elsewhere) |
| 4 | (\bot) | Contradiction from lines 2, 3 |
| 5 | (\neg\forall x,P(x)) | Negation Introduction, discharging the assumption on line 1 |
This pattern demonstrates how indirect proofs can be built on top of the basic quantifier rules.
Integrating Auxiliary Lemmas
Often a proof benefits from introducing a temporary lemma that isolates a sub‑argument. In a Fitch‑style system the lemma is introduced with a sub‑proof and later discharged when its conclusion is needed elsewhere No workaround needed..
Example Lemma: From ( \forall x,(A(x)\rightarrow B(x))) and (\exists x,A(x)) infer (\exists x,B(x)) And that's really what it comes down to. No workaround needed..
1 ∀x (A(x) → B(x)) premise
2 ∃x