Academy

Rules of Inference

The mathematical foundation of logical deduction and building valid arguments.

Rules of Inference

In logic, an Argument is a sequence of statements. The last statement is the Conclusion, and the others are Premises. An argument is Valid if the conclusion must be true whenever all the premises are true.

Think of these rules as the "Legal Moves" you can make in a mathematical proof.


1. Modus Ponens (The Law of Detachment)

The most fundamental rule of deduction. If you have a conditional statement and you know the hypothesis is true, the conclusion must follow.

  • Premise 1: p    qp \implies q
  • Premise 2: pp
  • Conclusion: q\therefore q

Example: "If it rains, the ground gets wet. It is raining. Therefore, the ground is wet."


2. Modus Tollens (The Law of Contraposition)

If a conditional is true, and the conclusion is false, then the hypothesis must also be false.

  • Premise 1: p    qp \implies q
  • Premise 2: ¬q\neg q
  • Conclusion: ¬p\therefore \neg p

3. Essential Rules Table

Rule NamePremisesConclusion
Additionpppq\therefore p \lor q
Simplificationpqp \land qp\therefore p
Conjunctionp,qp, qpq\therefore p \land q
Hypothetical Syllogismp    q,q    rp \implies q, q \implies rp    r\therefore p \implies r
Disjunctive Syllogismpq,¬pp \lor q, \neg pq\therefore q

4. Visualizing a Syllogism

A Hypothetical Syllogism acts like a chain reaction. If AA leads to BB, and BB leads to CC, then AA leads directly to CC.

{`graph LR A[p] --> B[q] B --> C[r] A -. "By Syllogism" .-> C`}

5. Valid vs. Invalid Arguments (Fallacies)

Just because an argument sounds logical doesn't mean it follows the rules.

  • Affirming the Consequent (Invalid): p    qp \implies q and qq does not mean pp.

    • Example: "If I have the flu, I have a fever. I have a fever. Therefore, I have the flu." (Wrong! You could have a cold.)
  • Denying the Antecedent (Invalid): p    qp \implies q and ¬p\neg p does not mean ¬q\neg q.


6. Logic in Software: Inference Engines

In Artificial Intelligence and automated theorem provers, we use these rules to derive new facts from a database of known truths.

# A simple Inference check for Modus Ponens
def modus_ponens(if_p_then_q, p):
    if if_p_then_q and p:
        return True # q must be True
    return None # We cannot conclude anything

# Known facts
rains_implies_wet = True
it_is_raining = True

# Deduction
ground_is_wet = modus_ponens(rains_implies_wet, it_is_raining)
print(f"Can we conclude the ground is wet? {ground_is_wet}")

Summary You have now completed Level 1: Propositional Calculus! You have moved from simple sentences to complex algebraic simplifications and finally to the rules of human and machine reasoning.

Next Step: Prepare for Level 2: Predicate Logic, where we introduce Quantifiers (,\forall, \exists) to handle infinite sets and variables.