Logic Handout

advertisement
LOGIC UNIT (REVISED WINTER 2005)
Introduction
The English language is at the same time both simple and complicated, both vapid and expressive. Consider the
three sentences:
Buffalo!
Buffalo buffalo.
Buffalo buffalo buffalo.
With various inflections, consider how many different meanings could be given to the sentence:
I didn’t say John stole the book.
In this unit, our goal is to set up a formal language modeling some of the aspects of the English language within
which the idea of logical deduction can be examined. Applications can be practical as well as whimsical (for
instructive as well as for humorous intent). Without logic, computers would be chaotic. Deep questions of halting
and correctness of computer programs involve logic.
In logic, a simple statement, or proposition, is a declarative sentence to which it is meaningful to assign a truth
value (either true or false).
The following are examples of statements:
George Washington fought at Waterloo.
The earth is round like a ball.
Steve is 6 feet tall. (Here the context would clarify what the truth value would be.)
The following are not statements:
Open the door.
Is this class interesting?
Drive safely.
Definition: A tautology is a statement which is always true.
Logical Connectives
Logical connectives are used to combine or modify simple statements.
The more common logical connectives are as follows: and, or, negation, conditional, and biconditional. In the
development given, p, q, r, etc represent statements.
The logical connectives are summarized in the table that follows. Note that most of them coincide reasonably well
with their English analogs. One exception is that in English, “or” can be used in two different ways. One is the
“inclusive or” and the other is the “exclusive or.” The “inclusive or” can be thought of as “at least one” and the
“exclusive or” can be thought of as “one but not the other.” For example, if you order a baked potato and you are
asked, “would you like butter or sour cream?”, it is understood that you may have both. This is a use of the
“inclusive or.” On the other hand, in a restaurant, when you are told that with a certain special, you may choose “a
soup or a salad,” it is understood that this is a use of the “exclusive or.” You may not choose both (unless you are
prepared to pay extra!). Both of these are used in logic, but we will use only the “inclusive or” in this handout. So
in this handout, “p or q” is defined to be “true” when at least one of p and q are true. Note that the English
connective “but” is equivalent (logically) to “and”, although one is a subordinating conjunction and the other is a
coordinating conjunction.
1
The statement “if p then q” promises that if p is true, then q will also be true. Thus the conditional is false only
when p is true and q is false. Note that in the cases where p is false, no promise has been made, so the statement is
true. (In this case, the conditional is true by default, or vacuously true.) In a conditional “if p then q”, the p (or
whatever is playing the same role) is called the antecedent and q is called the consequent.
The biconditional “p if and only if q” means that “if p then q” and also “if q then p”. Thus the biconditional is true
only when either both of p and q are true or both are false. For example, Euler’s Theorem could have been stated as
follows: A graph G has an Euler circuit if and only if G is connected and each vertex of G has even valence.
Connective
Terminology
Notation
p and q
conjunction
pq
p or q
disjunction
pq
not p
negation
p (or ~ p )
if p then q
p if and only if q
conditional
biconditional
Meaning
Truth table
p
q
T
T
F
F
T
F
T
F
p
q
and only if at least
one of p and q are
true.
T
T
F
F
T
F
T
F
p has the
opposite truth
value as p.
p
p
T
F
F
T
p
q
T
T
F
F
T
F
T
F
p
q
T
T
F
F
T
F
T
F
p  q is true if
and only if both p
and q are true.
p  q is true if
pq
(or p  q )
The statement “if p
then q” is false
only when p is true
and q is false.
pq
(or p  q )
The statement “p if
and only if q” is
true when p and q
are either both true
or p and q are both
false.
pq
T
F
F
F
pq
T
T
T
F
pq
T
F
T
T
pq
T
F
F
T
For each connective, a truth table is given. A truth table lists all possible combinations of inputs and gives the
output for each combination of inputs. In order to make it easy to talk about various truth tables, the standard
setup of cases should be used. The standard setup is to have the simple statements listed in alphabetical order and
the cases arranged as shown.
2
For a table whose only input is, say, p,
there are two cases: p is true or p is false:
For tables involving p and q, there are 2 choices for p and
2 choices for q, giving 4 cases total:
p
T
T
F
F
p
T
F
q
T
F
T
F
For tables with 3 inputs, say p, q, and r, you need 8 lines or cases, since there are 2 choices for p, two
choices for q, and 2 choices for r. The usual setup is obtained by making the first half of the first column TRUE
followed by FALSE for the 2nd half of that column. In the second column, we have 14 T’s, followed by 14 F’s,
followed by
p
T
T
T
T
F
F
F
F
q
T
T
F
F
T
T
F
F
1
4
T’s, and
1
4
F’s. The next column is done in one-eighths.
r
T
F
T
F
T
F
T
F
For tables involving say p, q, r, s, you need 16 lines or cases. The standard setup is the first column
TTTTTTTTFFFFFFFF, the second column TTTTFFFFTTTTFFFF, the third column
TTFFTTFFTTFFTTFF, and the fourth TFTFTFTFTFTFTFTF.
For larger tables, a process like this can be continued.
Truth tables can also be used when several logical connectives are combined. Note that when combining logical
connectives, there is an order of operations to be followed:
Parentheses,  ,  ,  ,  ,  .
Example 1: Construct the truth table for ( p  q) .
Solution: Note that there are two inputs: p and q, so there will be 4 lines in the truth table as discussed above. Also
note that, by order of operations, p  q needs to be done before ( p  q) can be done, so we start with:
p
q
T
T
F
F
T
F
T
F
pq
( p  q)
We then fill in the truth table column by column. The truth values for the third column follows from the definition
of p  q , and the fourth column is obtained by taking the opposite of the truth values in the third column. Our final
result is:
p
q
T
T
F
F
T
F
T
F
pq
T
T
T
F
( p  q)
F
F
F
T
3
Another way of producing a truth table (which in many instances is more compact) is as follows:
p
q

T
T
F
F
T
F
T
F
F
F
F
T
( p  q)
T
T
T
F
Note that the final result of this truth table appears in the 3rd column rather than the last column.
Example 2: Construct the truth table for p  ( p  q) .
Solution: Note that there are two inputs: p and q, so there will be 4 lines in the truth table. Also note that, by order
of operations, ( p  q ) needs to be done before p  ( p  q) , and q needs to be done before ( p  q ) , so we
start with:
p
q
T
T
F
F
T
F
T
F
q
( p  q )
p  ( p  q)
The truth values for q , are the opposites of the truth values for q:
p
q
q
T
T
F
F
T
F
T
F
F
T
F
T
( p  q )
p  ( p  q)
To obtain the truth values for ( p  q ) , look only at the “p” column and the “ q ”column. By definition of  ,
( p  q ) is true only when both p and q are true. In the first row, p is true but q is false, so ( p  q ) is
false. In this way we obtain:
p
q
q
( p  q )
T
T
F
F
T
F
T
F
F
T
F
T
F
T
F
F
p  ( p  q)
To complete the final column, look only at the “p” column and the “ ( p  q ) ” column. By definition of  ,
p  ( p  q) is true when at least one of p and ( p  q ) is true. Thus, our final result is
p
q
q
( p  q )
T
T
F
F
T
F
T
F
F
T
F
T
F
T
F
F
p  ( p  q)
T
T
F
F
Exercise 1: Construct the truth table for p  q . Compare it to the example above. Note that by order of
operations, the two negation columns will need to be completed before the “and” column can be done.
Exercise 2: Construct truth table for p  q . Note the negation applies only to the p. Compare the results to the
column for p  q .
4
Note that if p represents the statement “you don’t eat your peas” and if q represents the statement “you won’t get
dessert”, then:
p  q becomes: You eat your peas, or you won’t get dessert!


p  q becomes: If you don’t eat your peas, you won’t get dessert!
Do these mean the same thing?
Exercise 3: In view of the comparison in Exercise 2, what truth values would you expect to have in the main
column for  p  q   p  q  ? Construct its truth table.
Exercise 4: Construct a truth table for p  (q  r )  ( p  q)  ( p  r ) .
(Note the “or” on the left will need to be done before the “and” on the left can be done. The two “ands” will need to
be done on the right before the “or” can be done. The biconditional will use the “and” column on the left and the
“or” column on the right.)
Properties
The following properties can be proved with truth tables. (In fact, you proved one of them in Exercise 4!) The
associative and distributive laws have obvious algebraic counterparts.
Associative Laws
p  (q  r )  ( p  q)  r
p  (q  r )  ( p  q)  r
Distributive Laws
p  (q  r )  ( p  q)  ( p  r )
p  (q  r )  ( p  q)  ( p  r )
( p  q )  p  q
( p  q )  p  q
DeMorgan’s Laws
Quantified Statements
These are examined here to clarify what is meant when they are used, but even more to examine how their
negations are so often misconstructed. The two types of quantifiers are universal and existential. Universal
quantifiers convey the idea of “all” or “every”. Existential quantifiers convey the idea of “some” or “there exists at
least one”.
Suppose p is the universal statement “All birds are small.” This means that of any bird it could be said that
“it is small.” English versions of p (the negation of p) include:

Not all birds are small.

Some bird is not small.

At least one bird is not small.

It is not the case that all birds are small. (This one is not as satisfying as the others).
A common error in forming p is to say that “all birds are not small.” This would mean that there are no small
birds. (Don’t tell the hummingbird!)
Suppose q is the existential statement “Some men are tall.” English versions of q (the negation of q) include:
 No man is tall.
 All men are not tall.
Quantified statements will be explored in more depth in the section on arguments.
5
Important Related Conditionals
Given the conditional p  q , three important related conditionals are its converse, inverse, and contrapositive.
Its converse is q  p .
Its inverse is p  q .
Its contrapositive is q  p .
Example 3: Form the converse, inverse, and contrapositive for the conditional: “If cows can fly, then I’m the
Easter Bunny.”
Solution: Here we have
p: cows can fly
q: I’m the Easter Bunny
Thus the converse is - If I’m the Easter Bunny, then cows can fly.
The inverse is - If cows can’t fly, then I’m not the Easter Bunny.
The contrapositive is - If I’m not the Easter Bunny, then cows can’t fly.
Exercise 5: Compare the truth tables for p  q , q  p , p  q , and q  p .
From Exercise 5, you should see that p  q and q  p share the same truth values. In other words, the
original conditional is true if and only if its contrapositive is true. You should also see that q  p and
p  q share the same truth values. In other words, the converse of a conditional is true if and only if the
inverse of that conditional is true.
Exercise 6: Use p: I study hard and q: I will make a good grade.
Express in words: p , q , p  q , q  p , p  q , and q  p .
Exercise 7: For each of the following, assign some letter to each simple statement and symbolize the conditional.
Write its converse, inverse, and contrapositive in symbolic form and in verbal form.
a. If today is Friday, then I am happy.
b. If I buy a new car or I buy a used car, then I must buy gasoline.
ARGUMENTS:
An argument consists of a set of statements called premises, or hypotheses, and a statement called the
conclusion. An argument is said to be valid if whenever all the premises are true then so is the conclusion. An
argument is not valid if a set of truth values for the simple statements can be found which makes all the premises
true and the conclusion false.
An example of an argument is
If I study hard, then I will make a good grade.
I study hard.
 I will make a good grade.
(The “ ” sign means “therefore”.)
pq
Symbolized as follows:
p
q
6
Another example is
If I study hard, then I will make a good grade.
I don’t study hard.
 I won’t make a good grade.
pq
p
Symbolized as follows:
 q
Three methods of determining and proving validity will be used in this unit.
1. The first method considered is one which uses truth tables. For a valid argument, the conditional “if
(conjunction of premises), then the (conclusion)”, will be a tautology and thus the main column of its truth table
will have only T’s. For an argument with several simple statements, this is a time-consuming task. For
example, (( p  q)  p)  q would produce all T’s in its main column:
p
q
T
T
F
F
T
F
T
F
pq
T
F
T
T
( p  q)  p
(( p  q)  p)  q
T
F
F
F
T
T
T
T
Note that the last column would have a truth value of “false” only in a row where ( p  q)  p is true and q is
false.
An invalid argument would produce at least one F in the main column. The second argument when examined
this way would produce an F in at least one spot of the main column. For example, (( p  q)  p)  q would
produce an F in its main column and hence is an example of an invalid argument.
p
q
T
T
F
F
T
F
T
F
pq
T
F
T
T
p
( p  q )  p
q
(( p  q)  p)  q
F
F
T
T
F
F
T
T
F
T
F
T
T
T
F
T
2. Another method of testing the validity of an argument is the method of contradiction. To prove that an
argument is valid we must show that if the conclusion is false, then one or more of the premises would have to
be false. On the other hand, if the conclusion can be false while all the premises are true, the argument is not
valid. The truth values will identify a line in the truth table which would produce an F in the main column. The
set of values of the simple statements would then constitute a counterexample to the assertion that the
conclusion follows. If the conclusion can be false in several different ways, this method can be laborious.
However, if there is only one way the conclusion can be false, then this method can be rather quick.
Remember that when we use this method, we start by assuming that the conclusion is false.
7
In the following examples, some of the arguments are valid and some are not. Deduce which are valid and which
are not.
Example 4:
Example 5:
Example 6:
pq
qr
pq
q
p
 p
pq
p
q
q
Solution to Example 4:
Using truth tables:
p
T
T
F
F
q
T
F
T
F
pq
T
F
T
T
p
F
F
T
T
(pq) p
F
F
T
T
((pq) p) q
T
T
T
F
The argument is not valid.
Using the method of contradiction: Assign the truth value F to the conclusion. Thus q is false. Now we attempt
to make each premise true. Since q is false, in order for p  q to be true, p must be false. But then p must be
true. Hence the argument is not valid because we were able to make both premises true, but yet the conclusion is
false.
Solution to Example 5:
Using truth tables:
p
T
T
T
T
F
F
F
F
q
T
T
F
F
T
T
F
F
r
T
F
T
F
T
F
T
F
pq
T
T
F
F
T
T
T
T
qr
T
F
T
T
T
F
T
T
(pq) ( qr) p
T
F
F
F
F
F
F
F
((pq) ( qr) p) q
T
T
T
T
T
T
T
T
The argument is valid.
Using the method of contradiction: Assign the truth value F to the conclusion. This means that q is false. Now we
attempt to make all the premises true. Since q is false, in order to make p  q true, p must be false. Hence the
argument is valid because it is impossible to make all the premises true while the conclusion is false.
Solution to Example 6:
Using truth tables:
p
T
T
F
F
q
T
F
T
F
pq
T
F
T
T
q
F
T
F
T
(pq) q
F
F
F
T
p
F
F
T
T
((pq) q) p
T
T
T
T
The argument is valid.
8
Using the method of contradiction: Assign the truth value F to the conclusion. This means that p is
false so that p must be true. Now we try to make each of the premises true. Since p is true in order to
make the first premise p  q true, q must be true. But this means that the 2nd premise q is false. Thus
the argument is valid.
Exercise 8: Four men, one of whom was known to have committed a crime, made the following statements when
questioned by the police:
Archie: “Dave did it.”
Dave: “Tom did it.”
Gus: “I didn’t do it.”
Tom: “Dave lied when he said I did it.”
a. If only one man is telling the truth, who is the man guilty of the crime?
b. If only one man is lying, who is the man guilty of the crime?
Hint: For each of these, consider four cases. In each part, you can find inherent contradictions in three of the cases.
The remaining case will establish who is guilty.
3. Still another method to prove validity is to use a set of standard arguments or basic rules of inference to reduce
an argument to a simpler argument. (The basic rules of inference can be easily proved using truth tables.) We
will use the following set of basic arguments or rules of inference:
DOUBLE NEGATION
IMPLICATION
SIMPLIFICATION
p
(p )
p  q
pq
pq
pq
 (p)
p
pq
 p  q
q
p
MODUS PONENS
MODUS TOLLENS
pq
p
pq
q
q
 p
DISJUNCTIVE SYLLOGISM
HYPOTHETICAL SYLLOGISM
pq
pq
pq
p
q
qr
q
p
pr
CONTRAPOSITION
pq
 q  p
De MORGAN’S LAWS
 p  q 
 p  q 
 p  q
 p  q
9
Example 7:
Example 8:
pq
s  r
tr
qu
ut
s
 p  q 
r  q
s  r
s
 p
Solution to Example 7:
s  r
s
Modus Ponens
tr
r
Modus Tollens
ut
t
 r
 t
 u
qu
u
Modus Tollens
q
 q
 p
Modus Tollens
pq
Modus Tollens
Note: an entirely different selection of steps could have been made. After showing a different format for the
solution given above, a different selection of steps will be shown using the first format. Further note, you
don’t need to use both formats for the same problem.
An Alternate Format:
1)
2)
3)
4)
5)
6)
7)
8)
9)
10)
11)
Statement
pq
s  r
tr
qu
ut
s
r
t
u
q
p
Justification
Hypotheses
(6) + (2) + M.P.
(7) + (3) + M.T.
(8) + (5) + M.T.
(8) + (4) + M.T.
(10) + (1) + M.T.
An Alternate Approach Using the First Format on Example 7:
pq
qu
Hyp. Syl.
pu
pu
ut
pt
pt
Hyp. Syl.
tr
pr
Hyp.Syl.
s  r
s
M.P.
 r
pr
r
M.T.
 p
10
Solution to Example 8:
Using First Format:
r  q
r  q
Implication
r  q Hyp.Syl.
s  q
s  q
q
s  r
Modus Tollens
 (s )
(s )
s
 p  q 
p  q
p  q
De Morgan
 q
Simplification
Double Negation
Alternate Format Using a Different Selection of Steps:
1)
2)
3)
4)
5)
6)
7)
8)
Statement
(p  q)
r  q
s  r
p  q
q
r
(s)
s
Justification
Hypotheses
(1) + De Morgan
(4) + Simplification
(5) + (2) + D.S.
(6) + (3) + M.T.
Double Negation
Exercise 9: Assign letters to the simple statements and symbolize the following arguments:
a.
If the cup is gold, then it is lighter than water.
If the cup is lighter than water, then Janie can carry it.
 If the cup is gold, then Janie can carry it.
b.
If the package is not properly addressed or it is too large, then it will not be accepted by the Post Office.
This package is not too large.
If Thomas addressed this package, then it is properly addressed.
 If Thomas addressed this package, then it will be accepted by the Post Office.
Exercise 10: Using the basic rules of inference, prove the validity of the following:
a.
p
p  q
qr
r
b.
p  q
rs
s  q
r  u
p
 u
11
Exercise 11: Determine the validity of the following arguments. If the argument is not valid, construct a
counterexample case. If it is valid, prove validity using one of the last two methods.
a.
rs
b.
pq
r p
s  q
r p
rs
pq
s
c.
t  r
s
tw
rs
w
q
Arguments using Quantified Statements:
We can use Venn Diagrams (or Circle Diagrams) to test the validity of arguments with quantified statements.
In these diagrams, sets are denoted by circles, and individuals are denoted by points or names. The idea of all is
conveyed by one circle inside another. The idea of some is conveyed by one circle overlapping with another. The
idea of no is conveyed by two non-overlapping circles.
To decide if a quantified argument is valid or invalid, draw pictures, as described above, so that the premises are
true. Sometimes there is more than one way to draw a picture so that the premises are true. If there is even one
way to draw the picture so that the premises are true and the conclusion is false, the argument is INVALID. If this
cannot be done, then the argument is VALID.
In the following examples, we use Venn Diagrams to test the validity of the given arguments.
Example 9: All German shepherds are dogs
All dogs bark.
 All German shepherds bark
Example 10: All teachers are rich.
All rich people are snobs.
 All teachers are snobs.
Solutions to Examples 9 and 10:
9.
Valid
Example 11: All teachers are rich.
Tim is a teacher
 Tim is rich.
10. Valid
Example 12: No airline pilots eat carrots.
Jill does not eat carrots
 Jill is an airline pilot.
12
Solution to Examples 11 and 12:
11: valid
12: not valid
Jill could be an airline pilot with these
premises, but she isn’t necessarily one.
Example 13:
No mathematicians eat licorice
All college graduates eat licorice.
 No mathematicians are college graduates.
Solution to Example 13: valid
Exercise 12: Use Venn Diagrams to determine whether the following quantified arguments are valid or invalid.
a. All mathematicians like green beans.
No one who likes green beans can play the banjo.
Tycho plays the banjo.
 Tycho is not a mathematician.
b. No dancing hippopotamus is allergic to raisins.
No one who is allergic to raisins can pass a math test.
Hilda didn’t pass a math test.
 Hilda is not a dancing hippopotamus.
13
Download