Terminology
An argument is a sequence of statements that ends with a conclusion. The premises of an argument are the statements that are Inference Rules known/assumed/given. An argument is valid if the conclusion must follow from the premises. That How often have I said to you that when you have eliminated is, whenever the premises are T, the conclusion is also T; the premises the impossible, whatever remains, however improbable, must imply the conclusion. clear be the truth? (Sir Arthur Conan Doyle) An argument is if each statement is a premise or clearly follows from the previous statements. A rule of inference is a valid argument form.
Shadwell hated all southerners and, by CS 2233 Discrete Mathematical Structures Inference Rules – 2 inference, was standing at the North Pole. (Terry Pratchett) Inference Rules for Propositional Logic
Terminology...... 2 Rules1...... 3 ApplyingInferenceRules...... 4 ApplyingMoreInferenceRules...... 5 ModusPonensinPredicateLogic...... 6 Examples,Part1...... 7 Examples,Part2...... 8 ProgrammingExample1...... 9 ProgrammingExample2...... 10
CS 2233 Discrete Mathematical Structures Inference Rules – 3
1 2 Applying Inference Rules Modus Ponens in Predicate Logic Applying modus ponens in predicate logic: Example of applying modus ponens ∀x(P (x) → Q(x)), that is, P (x) implies Q(x) From: Joe took a college class. P (e), where e is an expression in the domain. And: Joe took a college class ∴ Q(e) (note substitution of x with e) → Joe has a high school diploma. Conclude: Joe has a high school diploma. Example 1: From: a = b and b = c implies a = c Example of applying modus tollens And: (x − y)2 = x2 − 2xy + y2 =(y − x)2 2 2 From: Joe does not have a high school diploma. Conclude: (x − y) =(y − x) And: Joe took a college class Example 2: → Joe has a high school diploma. From: a ≤ b implies a + c ≤ b + c Conclude: Joe has not taken a college class. And: 0 ≤ x2 − 2xy + y2 CS 2233 Discrete Mathematical Structures Inference Rules – 4 Conclude: 2xy ≤ x2 + y2 (add 2xy to both sides) CS 2233 Discrete Mathematical Structures Inference Rules – 6 Applying More Inference Rules Example of applying hypothetical syllogism Examples, Part 1 From: Joe has a PhD Which of the following are correct inferences and why (or why not)? → Joe took a college class. x > 0 implies x > 1. And: Joe took a college class x < 0 implies x < 1. → Joe has a high school diploma. x > 0 implies x +1 > 0. Conclude: Joe has a PhD x > 0 implies x − 1 > 0. → Joe has a high school diploma. x < 0 implies x +1 < 0. − Example of applying disjunctive syllogism x < 0 implies x 1 < 0. CS 2233 Discrete Mathematical Structures Inference Rules – 7 From: Joe is a plumber ∨ Joe took a college class. And: Joe is not a plumber. Conclude: Joe took a college class. CS 2233 Discrete Mathematical Structures Inference Rules – 5
3 4 Examples, Part 2
x > 0 implies x > 1. Incorrect, x =1 is a counterexample. x < 0 implies x < 1. Correct, x < 0 and 0 < 1 imply x < 1. x > 0 implies x +1 > 0. Correct, x > 0 implies x +1 > 1, with 1 > 0 implies x +1 > 0. x > 0 implies x − 1 > 0. Incorrect, x =1 is a counterexample. x < 0 implies x +1 < 0. Incorrect, x = −1 is a counterexample. x < 0 implies x − 1 < 0. Correct, x < 0 implies x − 1 < −1, with −1 < 0 implies x − 1 < 0.
CS 2233 Discrete Mathematical Structures Inference Rules – 8
Programming Example 1 The method successor is correct if and only if: whenever it is called with any int a, then it returns a +1. What can we conclude if successor(13) returns 14? What can we conclude if successor(1.5) returns 5.1? What can we conclude if successor(42) returns 13? What can we conclude if successor(2147483647) returns −2147483648? CS 2233 Discrete Mathematical Structures Inference Rules – 9
Programming Example 2 The method minArray is correct if and only if: whenever it is called with any int array with one or more elements, then it returns the minimum value in the array.
What can we conclude if minArray( (1, 3, −2) ) returns −2? What can we conclude if minArray( (1, 3, −2) ) returns 1? What can we conclude if minArray( () ) returns 0 or causes a run-time error? What can we conclude if 4 is returned by successor(minArray( (1, 3, −2) ))?
CS 2233 Discrete Mathematical Structures Inference Rules – 10
5