September 15, 1995 cs330 - Discrete Structures =========================== Fall 1995 Hw #1 - Solutions ================= 6/11 ==== a) If you have the flu then you miss the final examination. b) You do not miss the final examination if and only if you pass the course. c) If you miss the final examination then you don't pass the course. d) You have the flu or you miss the final exam or you pass the course. e) Either if you have the flu then you don't pass the course, or if you miss the final exam then you don't pass the course. f) Either you have the flu and you miss the final exam, or you don't miss the final exam and you pass the course. 8/11 ==== a) r ^ ~q (^ stands for conjunction, ~ stands for negation) b) p ^ q ^ r c) p -> r d) p ^ ~q ^ r e) (p ^ q) -> r f) r <-> (q V p) (V stands for disjunction) 18/12 ===== a) p q r | p V q | (p V q) V r ------+-------+---------- 0 0 0 | 0 | 0 0 0 1 | 0 | 1 0 1 0 | 1 | 1 0 1 1 | 1 | 1 1 0 0 | 1 | 1 1 0 1 | 1 | 1 1 1 0 | 1 | 1 1 1 1 | 1 | 1 ------+-------+--------- b) p q r | p V q | (p V q) ^ r ------+-------+---------- 0 0 0 | 0 | 0 0 0 1 | 0 | 0 0 1 0 | 1 | 0 0 1 1 | 1 | 1 1 0 0 | 1 | 0 1 0 1 | 1 | 1 1 1 0 | 1 | 0 1 1 1 | 1 | 1 ------+-------+--------- c) p q r | p ^ q | (p ^ q) V r ------+-------+---------- 0 0 0 | 0 | 0 0 0 1 | 0 | 1 0 1 0 | 0 | 0 0 1 1 | 0 | 1 1 0 0 | 0 | 0 1 0 1 | 0 | 1 1 1 0 | 1 | 1 1 1 1 | 1 | 1 ------+-------+--------- d) p q r | p ^ q | (p ^ q) ^ r ------+-------+---------- 0 0 0 | 0 | 0 0 0 1 | 0 | 0 0 1 0 | 0 | 0 0 1 1 | 0 | 0 1 0 0 | 0 | 0 1 0 1 | 0 | 0 1 1 0 | 1 | 0 1 1 1 | 1 | 1 ------+-------+--------- e) p q r | p V q | (p V q) ^ ~r ------+-------+---------- 0 0 0 | 0 | 0 0 0 1 | 0 | 0 0 1 0 | 1 | 1 0 1 1 | 1 | 0 1 0 0 | 1 | 1 1 0 1 | 1 | 0 1 1 0 | 1 | 1 1 1 1 | 1 | 0 ------+-------+---------- f) p q r | p ^ q | (p ^ q) V ~r ------+-------+---------- 0 0 0 | 0 | 1 0 0 1 | 0 | 0 0 1 0 | 0 | 1 0 1 1 | 0 | 0 1 0 0 | 0 | 1 1 0 1 | 0 | 0 1 1 0 | 1 | 1 1 1 1 | 1 | 1 ------+-------|---------- 20/12 ===== a) x will be 2 b) x will be unchanged c) x will be 2 d) x will be unchanged e) x will be 2 22/13 ===== a) 11000 b) 01101 c) 11001 d) 11011 28/13 ===== p = "the file system is not locked" q = "new messages will be queued" r = "the system is functioning normally" s = "new messages will be sent to the message buffer" The specification is then as follows: p -> q p <-> r p -> s ~s With the assignment p = F and s = F all the above propositions will be true; therefore the specifications are consistent. 6/19 ==== p q | (p ^ q) | ~(p ^ q) | ~p | ~q | ~p V ~q ----+---------+----------+----+----+-------- 0 0 | 0 | 1 | 1 | 1 | 1 0 1 | 0 | 1 | 1 | 0 | 1 1 0 | 0 | 1 | 0 | 1 | 1 1 1 | 1 | 0 | 0 | 0 | 0 ----+---------+----------+----+----+-------- ^ ^ |-------------------|--- same truth table; therefore the two propositions are equivalent. 8/19 ==== a) p q | ~p | (p V q) | ~p ^ (p V q) | ~p ^ (p V q) -> q ----+----+---------+--------------+------------------- 0 0 | 1 | 0 | 0 | 1 (0 -> 0) 0 1 | 1 | 1 | 1 | 1 (1 -> 1) 1 0 | 0 | 1 | 0 | 1 (0 -> 0) 1 1 | 0 | 1 | 0 | 1 (0 -> 1) ----+----+---------+--------------+------------------- b) p q r | p -> q | q -> r | (p->q) ^ (q->r) | p->r | ((p->q)^(q->r)) -> (p->r) ------+--------+--------+-----------------+------+-------------------------- 0 0 0 | 1 | 1 | 1 | 1 | 1 0 0 1 | 1 | 1 | 1 | 1 | 1 0 1 0 | 1 | 0 | 0 | 1 | 1 0 1 1 | 1 | 1 | 1 | 1 | 1 1 0 0 | 0 | 1 | 0 | 0 | 1 1 0 1 | 0 | 1 | 0 | 1 | 1 1 1 0 | 1 | 0 | 0 | 0 | 1 1 1 1 | 1 | 1 | 1 | 1 | 1 ------+--------+--------+-----------------+------+-------------------------- c) p q | p->q | p ^ (p->q) | (p^(p->q)) -> q ----+------+------------+---------------- 0 0 | 1 | 0 | 1 (0 -> 0) 0 1 | 1 | 0 | 1 (0 -> 1) 1 0 | 0 | 0 | 1 (0 -> 0) 1 1 | 1 | 1 | 1 (1 -> 1) ----+------+------------+---------------- d) p q r | p V q | p->r | q->r | (pVq)^(p->r)^(q->r) | ((pVq)^(p->r)^(q->r)) -> r ------+-------+------+------+---------------------+--------------------------- 0 0 0 | 0 | 1 | 1 | 0 | 1 (0 -> 0) 0 0 1 | 0 | 1 | 1 | 0 | 1 (0 -> 1) 0 1 0 | 1 | 1 | 0 | 0 | 1 (0 -> 0) 0 1 1 | 1 | 1 | 1 | 1 | 1 (1 -> 1) 1 0 0 | 1 | 0 | 1 | 0 | 1 (0 -> 0) 1 0 1 | 1 | 1 | 1 | 1 | 1 (1 -> 1) 1 1 0 | 1 | 0 | 0 | 0 | 1 (0 -> 0) 1 1 1 | 1 | 1 | 1 | 1 | 1 (1 -> 1) ------+-------+------+------+---------------------+--------------------------- 12/20 ===== W = (~p ^ ( p->q )) -> ~q W(p/T) = (~T ^ (T -> q)) -> ~q <=> ( F ^ q) -> ~q <=> F -> ~q <=> T W(p/F) = (~F ^ (F -> q)) -> ~q <=> (T ^ T) -> ~q <=> T -> ~q <=> ~q this is not a tautology Therefore W is not a tautology. 14/20 ===== p q | p<->q | p^q | ~p ^ ~q | (p ^ q) V (~p ^ ~q) ----+-------+-----+---------+-------------------- 0 0 | 1 | 0 | 1 | 1 0 1 | 0 | 0 | 0 | 0 1 0 | 0 | 0 | 0 | 0 1 1 | 1 | 1 | 0 | 1 ----+-------+-----+---------+-------------------- ^ ^ |-----------------------------|-------- same truth table; therefore they equivalent. 24/20 ===== p ^ q ^ ~r 41/20 ===== p = "the directory data base is open" q = "the monitor is put in a closed state" r = "the system is not in its initial state" Then the specification is: r -> (p -> q) Using p -> q <=> ~p V q we get r -> (p -> q) <=> r -> (~p V q) <=> ~r V (~p V q) <=> ~r V ~p V q which reads "The system is in its initial state and the directory data base is not open and the monitor is pu in a closed state." Note: the solution in the textbook refers to a different problem.