Discrete Mathematics Lecture 2. Dr.Bassant Mohamed El-Bagoury firstname.lastname@example.org Module Logic (part 2 --- proof methods)
Outline • 1. Mathematical Reasoning • 2. Arguments Examples – Predicate Logic • 3. Rules of Inference – Knowledge Engineering • 4. Rules of Inference for Quantifiers • 4. Methods for Theorem Proving
Mathematical Reasoning • We need mathematical reasoning to • determine whether a mathematical argument is correct or incorrect and • construct mathematical arguments. • Mathematical reasoning is not only important for conducting proofs and program verification, but also for artificial intelligence systems (drawing inferences).
Arguments • Example: • Gary is either intelligent or a good actor. • If Gary is intelligent, then he can count from 1 to 10. • Gary can only count from 1 to 2. • Therefore, Gary is a good actor. • i: “Gary is intelligent.” • a: “Gary is a good actor.” • c: “Gary can count from 1 to 10.”
Arguments • i: “Gary is intelligent.”a: “Gary is a good actor.”c: “Gary can count from 1 to 10.” • Step 1: c Hypothesis • Step 2: i c Hypothesis • Step 3: i Modus Tollens Steps 1 & 2 • Step 4: a i Hypothesis • Step 5: a Disjunctive SyllogismSteps 3 & 4 • Conclusion: a (“Gary is a good actor.”)
Arguments • Another example: • “If it rains today, then we will not have a barbeque today. If we do not have a barbeque today, then we will have a barbeque tomorrow.Therefore, if it rains today, then we will have a barbeque tomorrow.” • This is a valid argument: If its hypotheses are true, then its conclusion is also true.
AI research × Software Engineering Intelligent Behaviour Requirements Specification Functional Specification Knowledge Level System Implementation System Level Symbol Level
A small Expert System ( Inference System ) of rules for analysis of automotive problems. Rule 1:if the engine is getting gas, and the engine will turn over, then the problem is spark plugs. Rule 2:if the engine does not turn over, and the lights do not come on then the problem is battery or cables. Rule 3:if the engine does not turn over, and the lights do come on then the problem is the starter motor. Rule 4:if there is gas in the fuel tank, and there is gas in the carburetor then the engine is getting gas.
Fig The Inference System at the start of a consultation in the car diagnostic example.
The and/or graph searched in the car diagnosis example, with the conclusion of Inference Rule 4 matching the first premise of Inference Rule 1.
The following dialogue begins with the computer asking the user about the goals present in working memory. Gas in fuel tank? Yes Gas in carburetor? Yes Engine will turn over? Why It has been established that: 1. The engine is getting gas, 2. The engine will turn over, Then the problem is the spark plugs. How the engine is getting gas This follows from rule 4: if gas in fuel tank, and gas in carburetor then engine is getting gas. gas in fuel tank was given by the user gas in carburetor was given by the user
Terminology • An axiom is a basic assumption about mathematical structures that needs no proof. • We can use a proof to demonstrate that a particular statement is true. A proof consists of a sequence of statements that form an argument. • The steps that connect the statements in such a sequence are the rules of inference. • Cases of incorrect reasoning are called fallacies. • A theorem is a statement that can be shown to be true.
Terminology • A lemma is a simple theorem used as an intermediate result in the proof of another theorem. • A corollary is a proposition that follows directly from a theorem that has been proved. • A conjecture is a statement whose truth value is unknown. Once it is proven, it becomes a theorem.
Arguments • Just like a rule of inference, an argument consists of one or more hypotheses and a conclusion. • We say that an argument is valid, if whenever all its hypotheses are true, its conclusion is also true. • However, if any hypothesis is false, even a valid argument can lead to an incorrect conclusion.
Arguments • Example: • “If 101 is divisible by 3, then 1012 is divisible by 9. 101 is divisible by 3. Consequently, 1012 is divisible by 9.” • Although the argument is valid, its conclusion is incorrect, because one of the hypotheses is false (“101 is divisible by 3.”). • If in the above argument we replace 101 with 102, we could correctly conclude that 1022 is divisible by 9.
Theorems, proofs, and rules of inference • When is a mathematical argument (or “proof”) correct? • What techniques can we use to construct a mathematical argument? • Theorem– statement that can be shown to be true. • Axioms or postulates or premises– statements which are given and assumed to be true. • Proof– sequence of statements, a valid Argument, to show that a theorem is true. • Rules of Inference– rules used in a proof to draw conclusions from assertions known to be true.
Valid Arguments (reminder) • Recall: • An argument is a sequence of propositions. The final proposition is called the conclusion of the argument while the other propositions are called the premises or hypotheses of the argument. • An Argument is valid whenever the truth of all its premises implies the truth of its conclusion. • How to show that q logically follows from the hypotheses (p1 p2 …pn)? Show that (p1 p2 …pn) q is a tautology One can use the rules of inference to show the validity of an argument. Vacuous proof - if one of the premises is false then (p1 p2 …pn) q is vacuously True, since False implies anything.
Methods of Proof • 1) Direct Proof • 2) Proof by Contraposition • 3) Proof by Contradiction • 4) Proof of Equivalences • 5) Proof by Cases • 6) Existence Proofs • 7) Counterexamples
1) Direct Proof • Proof statement : p q • by: • Assume p • From p derive q.
((M C) (D C) (D S) (M)) S ? Direct proof --- Example 1 • Here’s what you know: Mary is a Math major or a CS major. If Mary does not like discrete math, she is not a CS major. If Mary likes discrete math, she is smart. Mary is not a math major. • Can you conclude Mary is smart? Let M - Mary is a Math major C – Mary is a CS major D – Mary likes discrete math S – Mary is smart Informally, what’s the inference chain of reasoning? M C D C D S M
((M C) (D C) (D S) (M)) S ? • In general, to prove p q, assume p and show that q follows.
See Table 1, p. 66, Rosen. Reminder: Propositional logic Rules of Inference or Method of Proof Subsumes MP
5. C 6. D 7. S Mary is smart! Example 1 - direct proof • 1. M C Given (premise) • 2. D C Given • 3. D S Given • 4. M Given DS (disjunctive syllogism; 1,4) MT (modus tollens; 2,5) MP (modus ponens; 3,6) QED QED or Q.E.D. --- quod erat demonstrandum
Direct Proof --- Example 2 • Theorem: • If n is odd integer, then n2 is odd. • Looks plausible, but… • How do we proceed? How do we prove this? • Start with • Definition: An integer is even if there exists an integer k such that n = 2k, • and n is odd if there exists an integer k such that n = 2k+1. • Properties: An integer is even or odd; and no integer is • both even and odd. (aside: would require proof.)
Example 2: Direct Proof • Theorem: • (n) P(n) Q(n), • where P(n) is “n is an odd integer” and Q(n) is “n2 is odd.” • We will show P(n) Q(n)
Theorem: • If n is odd integer, then n2 is odd. • Proof: • Let P --- “n is odd integer” • Q --- “n2 is odd” • we want to show that P Q • Assume P, i.e., n is odd. • By definition n = 2k + 1, where k is some integer. • Therefore n2 = (2k + 1)2 = 4k2 + 4k + 1 = 2 (2k2 + 2k ) + 1, • which is by definition is an odd number (use k’ = (2k2 + 2k ) ). • QED Proof strategy hint: Go back to definitions of concepts and start by trying direct proof.
The Foundations: Logic and Proofs Chapter 1
Propositional Logic Proposition is a declarative statement that is either true of false • Baton Rouge is the capital of Louisiana True • Toronto is the capital of Canada False • 1+1=2 True • 2+2=3 False Statements which are not propositions: • What time is it? • x+1 = 2
Negation: truth table
Conjunction: truth table
Disjunction: truth table
Exclusive-or: one or the other but not both truth table
(hypothesis) (conclusion) Conditional statement: if p then q p implies q q follows from p p only if q p is sufficient for q truth table
Conditional statement: equivalent (same truth table) Contrapositive: Converse: equivalent Inverse:
Biconditional statement: p if and only if q p iff q If p then q and conversely p is necessary and sufficient for q truth table
Compound propositions Precedence of operators higher lower
Propositional Equivalences Compound proposition Tautology: always true Contradiction: always false tautology contradiction Contingency: not a tautology and not a contradiction
Rules of Inference If you have a current password, then you can log onto the network You have a current password Therefore, you can log onto the network Modus Ponens Valid argument: if premises are true then conclusion is true
Modus Ponens If and then
Rules of Inference Modus Ponens Modus Tollens Hypothetical Syllogism Disjunctive Syllogism
Rules of Inference Addition Simplification Conjunction Resolution
It is below freezing now Therefore, it is either below freezing or raining now Addition
It is below freezing and raining now Therefore, it is below freezing now Simplification
If it rains today then we will not have a barbecue today If we do not have a barbecue today then we will have a barbecue tomorrow Therefore, if it rains today then we will have a barbecue tomorrow Hypothetical Syllogism
it is not snowing or Jasmine is skiing It is snowing or Bart is playing hockey Therefore, Jasmine is skiing or Bart is playing hockey Resolution