# Solving Word Problems II

## Presentation on theme: "Solving Word Problems II"— Presentation transcript:

Solving Word Problems II
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. 9

Does Superman Exist? continued
a: 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 9

Does Superman Exist? cont.
How will we know we're done? When we get to something true, either an axiom, theorem or problem fact. 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 3

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) 3

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 > 3

Problem 5.1 (a) Three Assertions: Conclusion:
(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. 3

Problem 5.1 (a) continued T: The program terminates, N: n becomes 0,
(¬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 6

Problem 5.1 (a) continued (¬T V N)  (N  M)  T  M
= < (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 6

Problem 5.1 (d) Two Assertions: Conclusion:
(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. 3

Problem 5.1(d) continued F0  F1  C J: Joe loves Mary, M: Mom is mad,
F: Father is sad. F0: F1: C: (J  M V F) F M  ¬J 6

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. 6

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 6

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.

Problem 5.3 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. Since the maid said it, we must be careful about how we formulate our variables and expressions. 3

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. 6

(MT  BL)  LK  ((LK  BL)  BH)  (BT  ¬BH)  (MT  ¬BT)
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: LK F2: (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 6

Problem 5.3 continued (MT  BL)  LK  ((LK  BL)  BH)  (BT  ¬BH)  (MT  ¬BT)
 < 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) BL  < (3.77) Modus Ponens, F1, F2; p,q := LK  BL, BH > OR < New hint F2' > BH Another suggestion for this hint: Make a new rule Fi with BL and LK, so BL  LK = < (3.39) p  true  p; F1: LK with p: Bl and true := LK> So, substitute in the BL into F2 and get F2': BL  BH and use this as the hint for the above.  < (3.77) Modus Ponens > ¬BT 6

Knights always tell the truth and knaves always lie.
Problem 5.6 This set of questions concern an island of knights and knaves. Knights always tell the truth and knaves always lie. 3

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) 6

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. 3

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. 6

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