Skip to content
Tutorials Center
My learning

Topics

Lesson 9 of 68 ยท Logic

Rules of Inference and Formal Arguments

Learn valid arguments and the standard rules of inference: modus ponens, modus tollens, syllogism, resolution and common fallacies, checked in Python.

An argument is a list of statements, the premises, followed by a claim, the conclusion. Everyday reasoning, mathematical proofs and the rules inside a theorem prover all share one question: does the conclusion have to be true whenever the premises are? If yes, the argument is valid. This lesson names the standard valid patterns, called rules of inference, shows how to chain them into a proof, and gives you a mechanical test for validity.

Validity is about form, not about truth in the real world. "If the moon is cheese, then 2 + 2 = 5. The moon is cheese. So 2 + 2 = 5" is a valid argument (its premise is false, but the pattern is sound). A valid argument with true premises is called sound, and only sound arguments give you true conclusions.

Validity as a truth-table test

An argument with premises P1, ..., Pn and conclusion C is valid exactly when the statement (P1 โˆง ... โˆง Pn) โ†’ C is a tautology. Equivalently: there is no row of the truth table where all premises are true and the conclusion is false. Such a row is a counterexample. Python can search for one.

Python A validity checker

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

None means no counterexample exists, so the argument is valid. The two fallacies each print a concrete assignment that breaks them. For affirming the consequent, p false and q true makes both premises true and the conclusion false: "if it rains the street is wet; the street is wet; so it rained" fails because a street cleaner could have passed.

The standard rules

Each rule below is a valid argument form.

Rule Premises Conclusion
Modus ponens p โ†’ q, p q
Modus tollens p โ†’ q, ยฌq ยฌp
Hypothetical syllogism p โ†’ q, q โ†’ r p โ†’ r
Disjunctive syllogism p โˆจ q, ยฌp q
Addition p p โˆจ q
Simplification p โˆง q p
Conjunction p, q p โˆง q
Resolution p โˆจ q, ยฌp โˆจ r q โˆจ r

Four rules you use daily

Modus ponens If p then q. p holds. So q.
Modus tollens If p then q. Not q. So not p.
Hypothetical syllogism p to q and q to r give p to r.
Disjunctive syllogism p or q. Not p. So q.

Each one is a tautology you can verify with a truth table.

1 / 2

Modus ponens is the engine of every proof. Modus tollens is the logic behind proof by contrapositive (see Contradiction and Contrapositive). Resolution deserves special attention because one rule alone is enough to build a complete proof system.

Building a formal proof

A formal proof is a numbered list. Each line is a premise or follows from earlier lines by a named rule. Consider these premises:

  1. If I study, I pass the exam. (s โ†’ p)
  2. If I pass the exam, I graduate. (p โ†’ g)
  3. I do not graduate. (ยฌg)

Goal: show that I did not study (ยฌs).

  • Lines 1 and 2 give s โ†’ g by hypothetical syllogism (line 4).
  • Lines 4 and 3 give ยฌs by modus tollens (line 5).

Each step is small enough to check by eye, and the whole chain is guaranteed valid. The program below checks both the full argument and each step.

Python Checking a chained proof

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Resolution

Resolution works on clauses: disjunctions of literals, as in Normal Forms and SAT. If one clause contains p and another contains ยฌp, you may merge them into a single clause without p and ยฌp. To prove a statement, add its negation to the premises and try to derive the empty clause, a contradiction. This is how SAT solvers and logic programming languages reason.

Python Resolution refutation

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The first call finds the empty clause, so ยฌs follows. The second finds nothing, because s does not follow from the premises (they are consistent with studying never happening).

Quantified arguments

Predicate logic adds rules for โˆ€ and โˆƒ. Universal instantiation says that from โˆ€x P(x) you may conclude P(a) for any specific a. "All humans are mortal; Socrates is human; so Socrates is mortal" is universal instantiation followed by modus ponens. Existential generalization goes the other way: from P(a) conclude โˆƒx P(x). See Predicates and Quantifiers for the quantifier basics.

Rules of inference apply to whole statements, not to pieces of them. You cannot use modus ponens on part of a formula, and you cannot reason from "some" to "all". Always check that each line really follows from earlier lines using the stated rule.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which rule gives q from the premises p -> q and p?

    Modus ponens detaches the conclusion of a conditional when its hypothesis is known.
  2. 2. What is wrong with this argument: if it rains the grass is wet; the grass is wet; so it rained?

    The grass could be wet for another reason, so a row with p false and q true is a counterexample.
  3. 3. When is an argument valid?

    Validity means the conclusion is forced by the premises: there is no counterexample row.
  4. 4. To prove a goal by resolution, you add which clause to the premises?

    You show the premises plus the negated goal are contradictory by deriving the empty clause.

Summary

  • An argument is valid when no assignment makes every premise true and the conclusion false.
  • Core rules: modus ponens, modus tollens, hypothetical and disjunctive syllogism, addition, simplification, conjunction and resolution.
  • Affirming the consequent and denying the antecedent are invalid patterns.
  • A formal proof chains small valid steps; resolution refutation proves a goal by deriving the empty clause from the premises plus the negated goal.

Next, continue with Predicates and Quantifiers to apply these rules to statements about all and some.