Week 1 Problem Set Due at start of class Monday 12-Jan-2009 (Many thanks to Prof. Song, as questions 1-6 are modified from his class problem sets.) Question 1 Write a Boolean logic statement representing the following sentence: 'He will come on the 8:15 or the 9:15 train; if the former, he will have time to visit us', where p means 'He will come on the 8:15' q means 'He will come on the 9:15' r means 'He will have time to visit us' (p & r) | q Question 2 Which of the following propositional formulas is a tautology? Recall that a tautology is a formula that evaluates to T for all possible assignments of truth values. 1. ( p | r) (p | r) !(!p|r) | (p|!r) == p&!r | p | !r NO (p=F,r=T) 2. (p (p & q)) !(!p | (p&q)) == p&!(p&q) == p&(!p | !q) == p&!p | p&!q NO (p=F,q=T) 3. r (p & r) !r | (p&!r) NO (r=F) 4. p &T NO (p=T) 5. (p q) | (p q) Answer by elimination. But see work below. Recall that p q is an abbreviation for (p q)& (q p). (p->q) & (q->p) | (p->!q) & (!q->p) == (!p | q) & (!q | p) | (!p | !q) & (q | p) |= (!p&!q | q&!q | !p&p | q&p) | (!p&q | !p&p | !q&q | !q&p) |= !p&!q | q&p | !p&q | !q&p == TAUTOLOGY! Question 3 In this question, assume the following predicate and constant symbols: W(x,y) : x wrote y L(x,y) : x is longer than y N(x) : x is a novel h : Hardy a : Austen j : Jude the Obscure p : Pride and Predjudice Given these specifications, which of the predicate logic formulas below represent the sentence, 'Hardy wrote a novel which is longer than any of Austen's' in predicate logic? 1. 2. 3. 4. 5. x (W(h,x) L(x,a))) x y (L(x,y) W(h,y) &W(a,x)) x y (W(h,x) &W(a,y) L(x,y))) x (N(x) & W(h,x) & y (N(y) &W(a,y) x y (W(h,x) W(a,y) &L(x,y)) L(x,y))) #4. There exists X such that (X is a novel & Hardy wrote X & (for all Y, if Y is a novel by Austen, X is longer than Y)) Question 4 Which of the following sets of sentences is satisfiable? 1. { x Q(x), x (Q(x) R(x)), x R(x)}. No— If any X has Q(x), that implies R(x), contradicting the third stmt. 2. { y x P(x,y), x P(x,x)}. No—some y cannot always satistfy P(x,y), if P(y,y) must be false. 3. { x y (P(x,y) P(y,y)), x P(x,x), x y (P(x,y)}. No—1st 2 cannot both be true if existence in 3rd is true. 4. { x y P(x,y), x P(x,x)}. Yes—all P(x,x) can be false while some P(x,y) are true to satisfy the first stmt. 5. { x Q(x), x Q(x)}. No—existence in first stmt contradicts condition in 2nd. Question 5 Which of the specifications in plain English below convey the mathematical meaning of the LTL formula G (p X[q U r]) ? 1. After any reachable state in which p is true, r is eventually true, and until then q is true. NO— assuming statements are weak by default, r is not required to be true. But answer may be acceptable since strong/weak not clearly specified here. 2. If p is true in every reachable state, then afterwards q is continuously true, until r becomes true. 3. If p is true in every reachable state, and q is continuously true, r will eventually become true. 4. For any reachable state in which p is true, afterwards q is continuously true until r becomes true. YES. 5. If p is true in every reachable state, then there is always a later state at which r is true, and q is true continuously until then. Question 6 Which of the following is a reduced, ordered BDD representing the formula (x & y) |z ? (Note that these BDD diagrams use the convention where a dotted line is the 0 transition, and a solid line is the 1 transition.) 1. This is the answer. Paths to ‘1’ node are z, (!z & !y & x) 2. not ordered 3. not ordered 4. not ordered 5. None of the above. Question 7-9 Assume we have a design with an output modeled by the following Boolean expression: Out = (a | ~b | c) & (b | c ) Show that the property P=(~a & ~c) cannot be true in this system, by each of the following methods: Boolean algebra equations (using distributive laws to express in sum-ofproduct terms) (a|!b|c) & (b|c) & (!a & !c) == (a|!b|c) & ((b&!a&!c) | (c&!a&!c)) == (a&b&!a&!c) | (!b&b&!a&!c) | (c&b&!a&!c) == F BDDs (Use Apply algorithm to AND the BDDs of P and Out) See scanned jpeg in ~eseligma/week1_solution. (Sorry, BDDs are a pain to type!) A DPLL SAT algorithm (show that the system of the P and Out expressions cannot be satisfied) Sys = (a|!b|c) & (b|c) & !a &!c DPLL (sys, null_assignment) … Choose var c DPLL (sys, c==1) CONFLICT: cannot satisfy expression !c DPLL (sys, c==0) Necessary: b == 1 Necessary: a == 1 CONFLICT: cannot satisfy expression !a Question 10 Make sure you have the computing infrastructure in place for the first half of the class, since starting next week we will be using real CAD tools instead of pen-&-paper calculations! - Send a ‘hello’ email to me: erik@erikseligman.com, and wait for a reply (should receive within 1 day.) If you don’t get a reply, my spam filter may have decided you are trying to sell Personal Enhancement Formulas… so call me at 503-312-1665 (or twitter me @erikseligman) to tell me to fix this. - Run the Cadence Conformal LEC tool. To do this, login to an ECE machine such as andy.ece.pdx.edu. (NOTE: this tool is only on ECE, not CECS, machines.) Then start the ‘zsh’ shell. Copy ~eseligma/startup.cadence to your home directory and source it. Then you should be able to type ‘lec’, and see a GUI come up. If this doesn’t work for you, contact me ASAP for further assistance.