Lecture 15

advertisement
Discrete Structures
Lecture 15
Solving Word Problems II
1
Does Superman Exist?
If Superman were able and willing to prevent
evil, he would do so. If Superman were
unable to prevent evil, he would be impotent;
if he were unwilling to prevent evil, he would
be malevolent. Superman does not prevent
evil. If Superman exists, he is neither
impotent nor malevolent. Therefore,
Superman does not exist.
2
Does Superman Exist? continued
a: Superman is able to prevent evil.
w:
i:
m:
p:
e:
Superman
Superman
Superman
Superman
Superman
is willing to prevent evil.
is impotent.
is malevolent.
prevents evil.
exists.
F0:
a  w  p
F1:
F2:
(¬a  i)  (¬w  m)
¬p
F3:
e  ¬i  ¬m
F0  F1  F2  F3  ¬e
3
Does Superman Exist? cont.
How will we know we're done?
When we get to something true,
Assume F0, F1, F2, F3
either an axiom, theorem or
¬e
problem fact.

< Contrapositive of F3 ¬(¬i  ¬m)  ¬e >
< The only other place e appears >
¬(¬i  ¬m)
=
< (3.47a)DeMorgan >
< Choice of DeMorgan is obvious to simplify. Further,
i and m, the only variable of the formula above,
appear only in F1, and as consequents of
implications. This simplification makes further
steps possible. >
¬¬i V ¬¬m
=
< (3.12) Double Negation, twice >
i V m
4
Does Superman Exist? cont.
i V m

< First conjunct of F1 and (4.2) Monotonicity
-- i is used in only one formula, and this
is the obvious way to eliminated it. >
¬a V m

< Second conjunct of F1 and
(4.2) Monotonicity -- m is used in only one
formula, and we can eliminate it. >
¬a V ¬w

< (4.47a) DeMorgan yields an expression that
is part of the antecedent of F0. >
¬(a  w)
5
Does Superman Exist? cont.
¬(a  w)

< Contrapositive of F0 is ¬p  ¬(a  w), so
this is the way to get rid of (a  w) >
¬p
< This is F2, so done >
6
Problem 5.1 (a)
Three Assertions:
(F0:) Either the program does not terminate or n
eventually becomes 0.
(F1:) If n becomes 0, m will eventually be 0.
(F2:) The program terminates.
Conclusion:
(C) Therefore, m will eventually be 0.
7
Problem 5.1 (a) continued
(¬T V N)  (N  M)  T  M
T: The program terminates,
N: n becomes 0,
M: m becomes 0.
F0:
F1:
F2:
C:
(¬T V N)
(N  M)
T
M
8
Problem 5.1 (a) continued
(¬T V N)  (N  M)  T  M
(¬T V N)  (N  M)  T
=
< (3.44a) Absorption, p:= T; q:=N
p  (¬p V q)  p  q >
N  (N  M)  T
< (3.66) p  (p  q)  p  q >
=
N  M  T

< (3.76b) Weakening p  q  p >
M
9
Problem 5.1 (d)
Two Assertions:
(F0) If Joe loves Mary, then either mom is mad
or father is sad.
(F1) Father is sad.
Conclusion:
(C) Therefore, if mom is mad then Joe
doesn’t love Mary.
10
Problem 5.1(d) continued
F0  F1  C
J: Joe loves Mary,
M: Mom is mad,
F: Father is sad.
F0: (J  M V F)
F1: F
C: M  ¬J
11
Problem 5.1 (d) continued
(J  M V F)  F  (M  ¬J)
At first glance this does not look
promising. Recall, to find a
counterexample, want something that
makes the antecedent true and the
consequent false.
12
Problem 5.1 (d)
Finding a Counter Example
For C: to be false, what values of M and J are needed?
C:
M  ¬J
true  false
false
Can we find a value for F that makes F0: and F1: true
with M and J having the above values?
F0: (J  M V F)
(true  true V true)
true
F1:
F
true
13
Adding Axioms (or theorems) to
an expression
Suppose you have an expression, P, and a theorem or axiom Q.
You can substitute P  Q for P, as follows:
P
=
=
<(3.39)Identity of , p  true  p>
P  true
<Metatheorem (3.7) all theorems are equivalent, Q>
PQ
We will use this in the next proof.
14
Problem 5.3
Prove that if the maid told the truth,
Since the maid said it, we must be
the butler lied.
careful about how we formulate our
variables and expressions.
The maid said she saw the butler in the living
room. The living room adjoins the kitchen. The
shot was fired in the kitchen and could be heard
in all adjoining rooms. The butler, who had
good hearing, said he did not hear the shot.
15
Problem 5.3 continued
MT: The maid told the truth,
BT: The butler told the truth,
BL: The butler was in the living room,
LK: The living room adjoins the kitchen,
BH: The butler heard the shot.
16
Problem 5.3 continued
(MT  BL)  LK  ((LK  BL)  BH)  (BT  ¬BH)  (MT  ¬BT)
F0:
MT  BL
i.e. if the maid told the truth, then the butler was in the living room.
F1:
F2:
LK
(LK  BL)  BH
i.e. if the kitchen adjoins the living room and the butler is in the
living room, then the butler could hear the shot.
F3:
BT  ¬BH
i.e. if the butler told the truth, he did not hear the shot.
C:
MT  ¬BT
17
Problem 5.3 continued
(MT  BL)  LK  ((LK  BL)  BH)  (BT  ¬BH)  (MT  ¬BT)
MT

< F0, MT  BL >
BL
=

=
=
<(3.39) Identity of , (3.7), F1, F2>
LK  BL  (LK  BL  BH)
<(3.77) Modus Ponens; p,q:=LKBL, BH >
BH
<(3.39) Identity of ,(3.7), F3>
BH  (BT  ¬BH)
< (3.61) Contrapositive, (3.12) Double neg.>
BH  (BH  ¬BT)

< (3.77) Modus Ponens >
¬BT
18
Problem 5.6
This set of questions concern an
island of knights and knaves.
Knights always tell the
truth and knaves always
lie.
19
Problem 5.6 continued
b: B is a knight.
c: C is a knight.
d: D is a knight.
If B says a statement “X”,
this gives rise to the expression:
b  X,
since if b, then B is a knight and tells the truth,
(so X is true)
and if ¬b, B is a knave and lies.
(so X is false)
20
Problem 5.6 (d)
Three inhabitants are standing together in the
garden. A non-inhabitant passes by and asks B,
“Are you a knight or a knave?” B answers, but so
indistinctly that the stranger cannot understand. The
stranger then asks C. “What did B say?” C replies,
“B said that he is a knave.” At this point, the third
man, D, Says, “Don’t believe C; he’s lying!” What
are C and D? Hint: Only C’s and D’s statements
are relevant to the problem. Also, D’s remark that
C is lying is equivalent to saying C is a knave.
21
Problem 5.6 (d) continued
The statement “B said that he is a knave” is
equivalent to “b is a knight exactly when B is
a knave, so we translate is as b  ¬b. Since
C said it, we take as true the expression
c  b  ¬b.
D’s statement “C is lying” is translated as ¬c.
Hence, we take as true the expression
d  ¬c.
We take the conjunction of these two
predicates and simplify.
22
Problem 5.6 (d) continued
(c  b  ¬b)  (d  ¬c)
(c  b  ¬b)  (d  ¬c)
=
< (3.11) ¬p  q  p  ¬q >
¬c  (d  ¬c)
=
< (3.50) p  (q  p)  p  q >
¬c  d
Hence, C is a knave and D is a knight.
23
Download