23
1 Discrete Structures Lecture 15 Solving Word Problems II

1 Discrete Structures Lecture 15 Solving Word Problems II

Embed Size (px)

Citation preview

Page 1: 1 Discrete Structures Lecture 15 Solving Word Problems II

1

Discrete Structures

Lecture 15

Solving Word Problems II

Page 2: 1 Discrete Structures Lecture 15 Solving Word Problems II

2

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.

Page 3: 1 Discrete Structures Lecture 15 Solving Word Problems II

3

Does Superman Exist? continueda: Superman is able to prevent evil.

w: Superman is willing to prevent evil.

i: Superman is impotent.

m: Superman is malevolent.

p: Superman prevents evil.

e: Superman exists.

F0: a w p

F1: (¬a i) (¬w m)F2: ¬p

F3: e ¬i ¬m

F0 F1 F2 F3 ¬e

Page 4: 1 Discrete Structures Lecture 15 Solving Word Problems II

4

Does Superman Exist? cont.

Assume F0, F1, F2, F3 ¬e

< 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

How will we know we're done?When we get to something true, either an axiom, theorem or problem fact.

Page 5: 1 Discrete Structures Lecture 15 Solving Word Problems II

5

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)

Page 6: 1 Discrete Structures Lecture 15 Solving Word Problems II

6

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 >

Page 7: 1 Discrete Structures Lecture 15 Solving Word Problems II

7

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.

Problem 5.1 (a)

Page 8: 1 Discrete Structures Lecture 15 Solving Word Problems II

8

Problem 5.1 (a) continued

T: The program terminates,

N: n becomes 0,

M: m becomes 0.F0:

F1:

F2:

C:

(¬T V N) (N M) T M

(¬T V N)

(N M)T

M

Page 9: 1 Discrete Structures Lecture 15 Solving Word Problems II

9

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

Page 10: 1 Discrete Structures Lecture 15 Solving Word Problems II

10

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.

Problem 5.1 (d)

Page 11: 1 Discrete Structures Lecture 15 Solving Word Problems II

11

Problem 5.1(d) continued

J: Joe loves Mary,

M: Mom is mad,

F: Father is sad.

F0:

F1:

C:

F0 F1 C

(J M V F)

F

M ¬J

Page 12: 1 Discrete Structures Lecture 15 Solving Word Problems II

12

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.

Page 13: 1 Discrete Structures Lecture 15 Solving Word Problems II

13

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) F1: F

(true true V true)true

true

Page 14: 1 Discrete Structures Lecture 15 Solving Word Problems II

14

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.

Page 15: 1 Discrete Structures Lecture 15 Solving Word Problems II

15

Prove that if the maid told the truth, the butler lied.

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.

Problem 5.3

Since the maid said it, we must be careful about how we formulate our variables and expressions.

Page 16: 1 Discrete Structures Lecture 15 Solving Word Problems II

16

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.

Page 17: 1 Discrete Structures Lecture 15 Solving Word Problems II

17

Problem 5.3 continued

F0: MT BLi.e. if the maid told the truth, then the butler was in the living room.

F1: LK

F2: (LK BL) BHi.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 ¬BHi.e. if the butler told the truth, he did not hear the shot.

C: MT ¬BT

(MT BL) LK ((LK BL) BH) (BT ¬BH) (MT ¬BT)

Page 18: 1 Discrete Structures Lecture 15 Solving Word Problems II

18

MT

< F0, MT BL >BL

= <(3.39) Identity of , (3.7), F1, F2>LK BL LK BL BH)

<(3.77) Modus Ponens; p,q:=LKBL, BH >BH

= <(3.39) Identity of ,(3.7), F3>BH (BT ¬BH)

= < (3.61) Contrapositive, (3.12) Double neg.>

BH (BH ¬BT)

Problem 5.3 continued (MT BL) LK ((LK BL) BH) (BT ¬BH) (MT ¬BT)

< (3.77) Modus Ponens >

¬BT

Page 19: 1 Discrete Structures Lecture 15 Solving Word Problems II

19

This set of questions concern an island of knights and knaves.

Knights always tell the truth and knaves always lie.

Problem 5.6

Page 20: 1 Discrete Structures Lecture 15 Solving Word Problems II

20

Problem 5.6 continuedb: 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)

Page 21: 1 Discrete Structures Lecture 15 Solving Word Problems II

21

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.

Problem 5.6 (d)

Page 22: 1 Discrete Structures Lecture 15 Solving Word Problems II

22

Problem 5.6 (d) continuedThe 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.

Page 23: 1 Discrete Structures Lecture 15 Solving Word Problems II

23

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.