CMPS 211 Homework Assignment 01 Solution, Fall 2014

American University of Beirut · Discrete Structures · 3 pages · with solution

All CMPS 211 files
CMPS 211 Homework Assignment 01 Solution, Fall 2014, page 1

Stuck on a question? A tutor can walk you through it.

CMPS 211 Homework Assignment 01 Solution, Fall 2014, page 2 CMPS 211 Homework Assignment 01 Solution, Fall 2014, page 3

More CMPS 211 files

Show the text of this homework
CMPS 211 -­‐ Fall 2014 1 Assignment 1 Solution Exercise 1: a) It is not a proposition b) It is a proposition, false: there are black flies in Maine. c) It is not a proposition d) If z belongs to R, this is a true proposition If z belongs to C, this is not a proposition e) It is not a proposition f) It is a proposition True: my money is spent on kittens False: my money is not spent on kittens Exercise 2: a) If I don’t run 5km each Sunday, then I’m not athletic. b) I don’t run 5km each Sunday and I’m not athletic. c) I’m either not athletic or I run 5km each Sunday and I am athletic. Exercise 3: a) ¬r → ¬q b) r ∧ q ∧ p c) p ∧ ¬r ∧ q d) p → r e) r → q f) (¬p → ¬q) ∧ (¬q → ¬r) Exercise 4: a) True b) True c) False d) True Exercise 5: a) Inclusive or b) Inclusive or c) Exclusive or d) Exclusive or CMPS 211 -­‐ Fall 2014 2 Exercise 6: a) Converse: if it is mind bogglingly complex, it looks easy. Contrapositive: if it is not mind bogglingly complex, it doesn’t look easy. Inverse: if it doesn’t look easy, it is not mind bogglingly complex. b) Converse: it is a sunny summer day whenever I go to the beach. Contrapositive: it is not a sunny summer day whenever I don’t go to the beach. Inverse: I don’t go to the beach whenever it is not a sunny summer day. c) Converse: when I sleep until noon, it is necessary that I stay up late. Contrapositive: when I don’t sleep until noon, it is necessary that I don’t stay up late. Inverse: when I don’t stay up late, it is necessary that I don’t sleep until noon. Exercise 7: a) ¬p → ¬q p q ¬p ¬q ¬p → ¬q T T F F T T F F T T F T T F F F F T T T b) p ↔ ¬p p ¬p p ↔ ¬p T F F T F F F T F F T F c) (¬p ∨ ¬q) → ( p ∧ ¬q) p q ¬p ¬q ¬p ∨ ¬q p ∧ ¬q (¬p ∨ ¬q) → ( p ∧ ¬q) T T F F F F T T F F T T T T F T T F T F F F F T T T F F d) ¬p ⊕ (p ∨ ¬q) p q ¬p ¬q p ∨ ¬q ¬p ⊕ (p ∨ ¬q) T T F F T T T F F T T T F T T F F T F F T T T F CMPS 211 -­‐ Fall 2014 3 e) (¬p ↔ ¬q) ↔ (q → p) p q ¬p ¬q ¬p ↔ ¬q q → p (¬p ↔ ¬q) ↔ (q → p) T T F F T T T T F F T F T F F T T F F F T F F T T T T T f) (p ↔ q) ⊕ (p ↔ ¬q) p q ¬q p ↔ q p ↔ ¬q (p ↔ q) ⊕ (p ↔ ¬q) T T F T F T T F T F T T F T F F T T F F T T F T Exercise 8: a) If x -­‐ 2 < 0 then x := (x+1)/2 -­‐1 < 0 => True. So x=2/2 = 1 b) If (2x +2 =3) OR (3x +1 = 3) then x := x*2 (2 + 2 ≠ 3) and (4 ≠ 3) => False or False => False. So x = 1 c) if (x +3 = 2) AND (3x +4 = 1) then x := x-­‐2 (4 ≠ 2) and (7≠1) => False and False => False. So x = 1 d) if (x > x) XOR (x < x) then x := x+2 (1=1) => False xor False => False. So x = 1 e) if x < 2 then x := x mod 2 (1 < 2) => True. So x = 1 mod 2 = 1 Exercise 9: a) Joyce is not angry: truth value = 1 -­‐ 0.9 = 0.1 Martha is not hungry: truth value = 1 -­‐ 0.3 = 0.7 b) Joyce is angry and Martha is hungry: truth value = 0.3 Neither Joyce is angry nor Martha is hungry: truth value = 0.1 c) Joyce is angry, or Martha is hungry: truth value = 0.9 Joyce is not angry, or Martha is not hungry: truth value = 0.7