CSE 240 Logic and Discrete Math Lecture notes 3 Weixiong Zhang Washington University in St. Louis http://www.cse.wustl.edu/~zhang/teaching /cse240/spring10/index.html 1
Today Refresher: Chapter 1.2 Chapter 1.3 : Arguments All images are copyrighted to their respective copyright holders and reproduced here for academic purposes under the condition of fair using. 2
Interpretation In propositional logic interpretation is a mapping from variables in your formulae to {true, false} Example: Formula: Interpretation 1: Interpretation 2: A v B A = true, B = false A = false, B = false 3
Interpretations How many interpretations do the following formulae allow? A B 4 (A B & A) B 4 Why not 8 or 16? The number of interpretations is 2 N where N is the number of independent variables 4
Questions? 5
Conditions Suppose we care about statement X X = this assignment is copied We want to evaluate X (true/false?) Suppose we know A such that A X A is a sufficient condition A= the cheater is caught in the act Suppose we know B such that X B B is a necessary condition B= there was an original assignment to copy from 6
Criteria Suppose we know C such that C X C is a criterion C= someone has copied this assignment Graphically: A X B C 7
Wanted : Criteria Medical tests Software/hardware correctness Fraud/cheating Financial market Psychology (e.g., in sales) Science : mathematics, physics, chemistry, etc. Logic : If C is a criterion for X then C X! 8
Practice It is frequently non-trivial to derive a criterion for a real-life property X Then we have to settle for: Sufficient conditions: If this quality test passes then the product is fine Necessary conditions: If the patient breaks a leg they will be in pain Statistical validity : the condition works most of the time In logic : the condition works all the time! 9
Derivation of Criteria Logic/Mathematics/Theoretical sciences: Equivalent transformations Proofs by contradiction Empirical sciences: Statistical tests Function approximation Artificial Intelligence: Machine learning These methods are not guaranteed to produce true criteria 10
Questions? 11
Logic Equivalence Propositions/statements/formulae A and B are logically equivalent when: A holds if and only if B holds Notation: A B Examples: A v A is equivalent to: A A v ~A is equivalent to: true 12
Challenge Theorem 1.1.1 : Boolean Algebra Derive the rest (e.g., #8) from the first 5 equivalences 13
Use of Equivalences Deriving equivalent formulae! Of course, but why do we care? Simplification of formula Simplification of code Simplification of hardware (e.g., circuits) Derivation of criteria! 14
Limitations Not all statements are equivalent! Of course not, but what else is there? Some formulae are stronger than others They imply or entail other formula but not the other way around Equivalences cannot directly help us proving such entailments 15
Entailment A collection of statements P 1,,P n (premises) entails statement Q (conclusion) if and only if: Whenever all premises hold the conclusion holds For every interpretation I that makes all P j hold, I also makes Q hold Example: Premises: P 1 = If Socrates is human then Socrates is mortal P 2 = Socrates is human Conclusion: Q = Socrates is mortal 16
Valid/Invalid Arguments Suppose someone makes an argument: P 1,..,P N therefore Q The argument is called valid iff: P 1,,P N logically entail Q That is: Q must hold if all P i hold Otherwise the argument is called invalid 17
Example Sample argument: P 1 = If Socrates is human then Socrates is mortal P 2 = Socrates is human Therefore: Q = Socrates is mortal Valid / invalid? 18
Entailment Then is the following argument valid? P 1 P 2 entails Q Yes? Very well, but what if my interpretation I sets P 1 and P 2 to true but Q to false? Then by definition Q is not entailed by P 1 and P 2 So do P 1,P 2 entail Q or do they not? 19
What Happened We considered P 1, P 2, and Q under a particular (common sense) interpretation: P 1 = If Socrates is human then Socrates is mortal true P 2 = Socrates is human true Q = Socrates is mortal true Thus, they were merely logical constants to us: P 1 =true P 2 =true Q=true 20
Generality Thus our argument was: True True entails True Well, this is not very useful because it doesn t tell us anything about validity of other arguments. For example: P 1 = If J.B. broke his leg then J.B. is in pain P 2 = J.B. broke his leg entails Q= J.B. is in pain Is this argument valid? 21
Extracting the Essence How do we know it is valid? Because regardless of who J.B. is and what happened to him/her, we somehow know that: If P 1 and P 2 hold Then Q will hold But how do we know that? How can we extract the essence of the dead Socrates and J.B. in pain arguments? 22
General Structure! Recall both arguments: P 1 If Socrates is human then Socrates is mortal If J.B. broke his leg then J.B. is in pain P 2 Socrates is human J.B. broke his leg entails Q Socrates is mortal J.B. is in pain Note that P 1, P 2, and Q are related! Both arguments share the same structure: P 1 P 2 entails Q If X then Y X Y Then for any interpretation I as long as I satisfies P 1 and P 2, interpretation I must satisfy Q 23
Modus Ponens The generalized argument P 1 = X Y P 2 = X entails Q = Y is much more useful! Why? method of affirming (Lat.) Because it captures the essence of both arguments and can be used for infinitely many more 24
Valid Arguments (Revisited) Suppose someone makes an argument: P 1,..,P N therefore Q The argument is called valid iff: P 1,,P N logically entail Q That is: For any interpretation I that satisfies all P j, interpretation I must necessarily satisfy Q Usually: P j and Q are somehow related formulae and P 1 & & P N can be true or false depending on the interpretation I 25
Logical Form Since: we consider all possible interpretations the conjunction of premises: P 1 & & P N is not always true or false The conclusion Q must follow from / be entailed by the premises by logical form of P j and Q alone (p. 29 in the text) 26
Questions? 27
How Do We: Tell between a valid argument and an invalid argument: People are mortal. Socrates is a man. Socrates is mortal. Ducks fly. F-16 flies. F-16 is a duck. Prove that something logically follows from something else: 1: Everybody likes Buddha 2: Everybody likes someone Prove that something is logically equivalent to something else: 1: Everybody likes cream and sugar 2: Everybody likes cream and everybody likes sugar Prove that there is a contradiction? 28
Propositional Logic Method #1: Go through all possible interpretations and check the definition of valid argument Method #2: Use derivation rules to get from the premises to the conclusion in a logically sound way derive the conclusions from premises 29
Method #1 Section 1.3 in the text proves many arguments/inference rules using truth tables Suppose the argument is: P 1,,P N therefore Q Create a truth table for formula F=(P 1 & & P N Q) Check if F is a tautology 30
But Why? Recall: Formula A entails formula B iff (A B) is a tautology In general: premises P 1,,P N entail Q iff formula F=(P 1 & & P N Q) is a tautology 31
Example #1 P v Q v R ~R entails P v Q valid/invalid? (example 1.3.1 in the book, p. 30) 32
Example #2 P v Q v R ~R entails Q valid/invalid? 33
Example #3 P Q P entails Q valid/invalid? Modus ponens 34
Example #4 P Q Q entails P valid/invalid? 35
Example #5 P Q ~Q entails ~P valid/invalid? Modus tollens 36
Example #6 P Q entails ~Q ~P valid/invalid? In fact, we proved last time that: (P Q) (~Q ~P) 37
Example #7 P v Q ~P & ~Q entails P & Q valid/invalid? Any argument with a contradiction in its premises is valid by default 38
Pros & Cons Method #1: Pro: straight-forward, not much creativity machines can do Con: the number of interpretations grows exponentially with the number of variables cannot do for many variables Con: in predicate and some other logics even a small formula may have an infinite number of interpretations 39
Questions? 40
Method #2 : Derivations To prove that an argument is valid: Begin with the premises Use valid/sound inference rules Arrive at the conclusion 41
Inference Rules But what are these inference rules? They are simply valid arguments! Example: X & Y X & Y Z & W therefore Z & W by modus ponens 42
Example #1 (X&Y Z&W) & K X&Y therefore Z&W How? (X&Y Z&W) & K X&Y Z&W by conjunctive simplification X&Y Z&W by modus ponens 43
Derivations The chain of inference rules that starts with the premises and ends with the conclusion is called a derivation: The conclusion is derived from the premises Such a derivation makes a proof of argument s validity 44
Example #1 (X&Y Z&W) & K X&Y therefore Z&W How? (X&Y Z&W) & K derivation X&Y Z&W by conjunctive simplification X&Y Z&W by modus ponens 45
Pros & Cons Method #2: Pro: often can get a dramatic speed-up over truth tables. Con: requires creativity and intuition harder to do by machines Con: semi-decidable : there is no algorithm that can prove any first-order predicate logic argument to be valid or invalid 46
Questions? 47
Fallacies An error in derivation leading to an invalid argument Vague formulations of premises/conclusion Missing steps Using non-sound inference rules, e.g.: Converse error Inverse error 48
Converse Error If John is smart then John makes a lot of money John makes a lot of money Therefore: John is smart Tries to use this non-sound inference rule : A B, B Thus: A 49
Inverse Error If John is smart then John makes a lot of money John is not smart Therefore: John doesn t make a lot of money Tries to use this non-sound inference rule : A B, ~A Thus: ~B 50
Questions? 51
Truth of facts vs. Validity of Arguments The premises are assumed to be true ONLY in the context of the argument The following argument is valid: If John Lennon was a rock star then he was a woman John Lennon was a rock star Thus: John Lennon was a woman But the 1 st premise doesn t hold under the common sense interpretation 52
Inference Rules Table 1.3.1 on page 39 If practice with the rules then will be more fluent using them If are more fluent using them then will be more likely to get a better mark on exams 53
Summary Equivalence: A B A holds iff B holds A is a criterion for B B is a criterion for A A entails B B entails A A and B are equivalently strong Formula F=(A B) is a tautology 54
Summary Entailment: A entails B B follows from A A B is a valid argument A is a sufficient condition for B B is a necessary condition for A If A holds then B holds A may be stronger than B Formula F=(A B) is a tautology 55
The Big Picture Logic is being used to verify validity of arguments An argument is valid iff its conclusion logically follows from the premises Derivations are used to prove validity Inference rules are used as part of derivations 56
Questions? 57