logic and discrete math lecture notes 3zhang/teaching/cse240/spring...truth of facts vs. validity of...
TRANSCRIPT
1
CSE 240Logic and Discrete Math
Lecture notes 3
Weixiong ZhangWashington University in St. Louis
http://www.cse.wustl.edu/~zhang/teaching/cse240/Spring10/index.html
2
Today
Refresher: Chapter 1.2
Chapter 1.3 : Arguments
All i
mag
es a
re c
opyr
ight
ed t
o th
eir
resp
ectiv
e co
pyrig
ht h
olde
rs a
nd r
epro
duce
d he
re fo
r ac
adem
ic p
urpo
ses
unde
r th
e co
nditi
on o
f “fa
ir us
ing”
.
3
Interpretation
In propositional logic interpretation is a mapping from variables in your formulae to {true, false}
Example:Formula: A v BInterpretation 1: A = true, B = falseInterpretation 2: A = false, B = false
4
Interpretations
How many interpretations do the following formulae allow?A B
4
(AB & A) B4
Why not 8 or 16?
The number of interpretations is 2N where Nis the number of independent variables
5
Questions?
6
ConditionsSuppose we care about statement X
X = “this assignment is copied”We want to evaluate X (true/false?)
Suppose we know A such that AXA is a sufficient conditionA=“the cheater is caught in the act”
Suppose we know B such that XBB is a necessary conditionB=“there was an original assignment to copy from”
7
Criteria
Suppose we know C such that CXC is a criterionC=“someone has copied this assignment”
Graphically:
X
A
B
C
8
Wanted : Criteria
Medical testsSoftware/hardware correctnessFraud/cheatingFinancial marketPsychology (e.g., in sales)Science : mathematics, physics, chemistry, etc.Logic :
If C is a criterion for X then C ≡ X !
9
PracticeIt 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 timeIn logic : the condition works all the time!
10
Derivation of Criteria
Logic/Mathematics/Theoretical sciences:Equivalent transformationsProofs by contradiction
Empirical sciences:Statistical testsFunction approximation
Artificial Intelligence:Machine learning
These methods are
notguaranteed to produce true
criteria…
11
Questions?
12
Logic EquivalencePropositions/statements/formulae A and B are logically equivalent when:
A holds if and only if B holdsNotation: A ≡ BExamples:
A v A is equivalent to:A
A v ~A is equivalent to:true
13
Challenge
Theorem 1.1.1 : Boolean AlgebraDerive the rest (e.g., #8) from the first 5 equivalences…
14
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!
15
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…
16
EntailmentA collection of statements P1,…,Pn (premises) entails statement Q (conclusion) if and only if:
Whenever all premises hold the conclusion holds
For every interpretation I that makes all Pj hold, I also makes Q hold
Example:Premises:
P1 = “If Socrates is human then Socrates is mortal”P2 = “Socrates is human”
Conclusion:Q = “Socrates is mortal”
17
Valid/Invalid Arguments
Suppose someone makes an argument:P1,..,PN therefore Q
The argument is called valid iff:P1,…,PN logically entail Q
That is:Q must hold if all Pi hold
Otherwise the argument is called invalid
18
Example
Sample argument:P1 = “If Socrates is human then Socrates is mortal”P2 = “Socrates is human”Therefore:Q = “Socrates is mortal”
Valid / invalid?
19
Entailment
Then is the following argument valid?P1
P2
entailsQ
Yes?Very well, but what if my interpretation I sets P1 and P2 to true but Q to false?
Then by definition Q is not entailed by P1 and P2
So do P1,P2 entail Q or do they not?
20
What Happened…We considered P1, P2, and Q under a particular(common sense) interpretation:
P1 = “If Socrates is human then Socrates is mortal” trueP2 = “Socrates is human” trueQ = “Socrates is mortal” true
Thus, they were merely logical constants to us:P1=trueP2=trueQ=true
21
Generality…Thus our argument was:
TrueTrueentailsTrue
Well, this is not very useful because it doesn’t tell us anything about validity of other arguments. For example:
P1=“If J.B. broke his leg then J.B. is in pain”P2=“J.B. broke his leg”entailsQ=“J.B. is in pain”
Is this argument valid?
22
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 P1 and P2 holdThen 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?
23
General Structure!Recall both arguments:
P1 “If Socrates is human then Socrates is mortal” “If J.B. broke his leg then J.B. is in pain”P2 “Socrates is human” “J.B. broke his leg”entailsQ “Socrates is mortal” “J.B. is in pain”
Note that P1, P2, and Q are related!Both arguments share the same structure:
P1 If X then YP2 XentailsQ Y
Then for any interpretation I as long as I satisfies P1and P2, interpretation I must satisfy Q
24
Modus PonensThe “generalized” argument
P1 = X YP2 = XentailsQ = Y
…is much more useful!Why?
Because it captures the essence of both arguments and can be used for infinitely many more
“method of affirming” (Lat.)
25
Valid Arguments (Revisited)Suppose someone makes an argument:
P1,..,PN therefore QThe argument is called valid iff:
P1,…,PN logically entail QThat is:
For any interpretation I that satisfies all Pj, interpretation I must necessarily satisfy Q
Usually: Pj and Q are somehow related formulae and P1 & … & PN can be true or false depending on the interpretation I
26
Logical Form
Since:we consider all possible interpretationsthe conjunction of premises:
P1 & … & PNis not always true or false
The conclusion Q must follow from / be entailed by the premises… …by logical form of Pj and Q alone(p. 29 in the text)
27
Questions?
28
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 Buddha2: Everybody likes someone
Prove that something is logically equivalent to something else:
1: Everybody likes cream and sugar2: Everybody likes cream and everybody likes sugar
Prove that there is a contradiction?
29
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”
30
Method #1
Section 1.3 in the text proves many arguments/inference rules using truth tables
Suppose the argument is:P1,…,PN therefore Q
Create a truth table for formulaF=(P1 & … & PN Q)
Check if F is a tautology
31
But Why? Recall:
Formula A entails formula Biff (A B) is a tautology
In general:premises P1,…,PN entail Qiffformula F=(P1 & … & PN Q)is a tautology
32
Example #1
P v Q v R~R entails P v Q
valid/invalid?
(example 1.3.1 in the book, p. 30)
33
Example #2
P v Q v R~R entails Q
valid/invalid?
34
Example #3
P QP entails Q
valid/invalid?Modus ponens
35
Example #4
P QQ entails P
valid/invalid?
36
Example #5
P Q~Q entails ~P
valid/invalid?Modus tollens
37
Example #6
P Qentails ~Q ~P
valid/invalid?
In fact, we proved last time that: (P Q) ≡ (~Q ~P)
38
Example #7
P v Q~P & ~Qentails P & Q
valid/invalid?
Any argument with a contradiction in its premises is valid by default…
39
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 infinitenumber of interpretations
40
Questions?
41
Method #2 : Derivations
To prove that an argument is valid:
Begin with the premises
Use valid/sound inference rules
Arrive at the conclusion
42
Inference Rules
But what are these “inference rules”?They are simply…
…valid arguments!
Example:X & Y X & Y Z & WthereforeZ & W by modus ponens
43
Example #1
(X&Y Z&W) & KX&YthereforeZ&WHow?(X&Y Z&W) & KX&Y Z&W by conjunctive simplificationX&YZ&W by modus ponens
44
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
45
Example #1
(X&Y Z&W) & KX&YthereforeZ&WHow?(X&Y Z&W) & KX&Y Z&W by conjunctive simplificationX&YZ&W by modus ponens
derivation
46
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
47
Questions?
48
Fallacies
An error in derivation leading to an invalid argumentVague formulations of premises/conclusionMissing stepsUsing non-sound inference rules, e.g.:
Converse errorInverse error
49
Converse Error
If John is smart then John makes a lot of moneyJohn makes a lot of moneyTherefore:John is smart
Tries to use this non-sound “inference rule”:AB, BThus: A
50
Inverse Error
If John is smart then John makes a lot of moneyJohn is not smartTherefore:John doesn’t make a lot of money
Tries to use this non-sound “inference rule”:AB, ~AThus: ~B
51
Questions?
52
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 womanJohn Lennon was a rock starThus:John Lennon was a woman
But the 1st premise doesn’t hold under the common sense interpretation
53
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
54
Summary
Equivalence:A ≡ BA holds iff B holdsA is a criterion for BB is a criterion for AA entails BB entails AA and B are “equivalently strong”Formula F=(AB) is a tautology
55
Summary
Entailment:A entails BB follows from AA∴B is a valid argumentA is a sufficient condition for BB is a necessary condition for AIf A holds then B holdsA may be “stronger than” BFormula F=(AB) is a tautology
56
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
57
Questions?