141 likes | 350 Views
Discrete Structures Lecture 5 Boolean Expressions and Propositions. Review of Duality. The dual P D of a boolean expression P is constructed from P by interchanging occurrences of true and false and V and and and . Metatheorem Duality.
E N D
Discrete Structures Lecture 5 Boolean Expressions and Propositions
Review of Duality The dual PD of a boolean expression P is constructed from P by interchanging occurrences of true and false and V and and and
Metatheorem Duality Part a: P is valid iff ¬PD is valid. Part b: (PQ) is valid iff (PDQD) is valid.
Duality Review For each expression P Q, write the expression PD QD. (a) p p true (b) p q p q p
Translating English into Boolean Expressions A proposition is a statement that can be true or false. Example: It snowed today and I went skiing. To translate into a boolean expression: Locate subpropositions: It snowed today. I went skiing. Assign these to boolean variables: st = It snowed today ws=I went skiing 3) Combine with obvious translation of joining words (and): st L ws
Translating English to “boolean-speak” To translate proposition p into a boolean expression: • Introduce boolean variables to denote subpropositions. • Replace these subpropositions by their corresponding boolean variables. • Translate the result of step 2 into a boolean expression, using the “obvious” translations of English words into operators. It seems easy.......
Translation of English Words and, while, but inclusive or exclusive or not if x then y • xy • x Vy • x y • x¬y • ¬ x • x y
Translation of English Words xy xy yx xy yx if x then y to x it’s necessary to y to x it’s sufficient to y x is sufficient for y x is necessary for y Note: any xy can be replaced by yx
problem 2.5Translate the following English statements into boolean expressions. eh: I’ll eat my hat, r: it’s raining, s: I’m going swimming, rc: it’s raining cats, rd: it’s raining dogs (b) If it’s raining I’m not going swimming. (d) It’s raining cats or dogs. (f) If it’s raining cats and dogs while I am going swimming, I’ll eat my hat. r ¬s rc V rd rc rd s eh
The Tardy Bus Problem (2.9) Has three assumptions and eight conjectures. Translate the assumptions and conjectures into boolean expressions.
The Tardy Bus Conjectures (1) If Bill takes the bus, then Bill misses his appointment if the bus is late. (2) Bill shouldn’t go home if Bill misses his appointment and Bill feels downcast. (3) If Bill doesn’t get the job, he feels downcast and shouldn’t go home. tb: Bill takes the bus, ma: Bill misses his appt., bl: the bus is late, gh: Bill should go home, fd: Bill feels downcast, gj: Bill gets the job
tb: Bill takes the bus, ma: Bill misses his appt.,bl: the bus is late, gh: Bill should go home,fd: Bill feels downcast, gj: Bill gets the job (1) If Bill takes the bus, then Bill misses his appointment if the bus is late. tb (bl ma) OR (tb bl) ma (2) Bill shouldn’t go home if Bill misses his appointment and Bill feels down cast. (ma fd) ¬gh (parens not needed) (3) If Bill doesn’t get the job, he feels downcast and shouldn’t go home. ¬gj fd ¬gh
tb: Bill takes the bus, ma: Bill misses his appt.,bl: the bus is late, gh: Bill should go home,fd: Bill feels downcast, gj: Bill gets the job (4) If Bill takes the bus, then Bill does get the job if the bus is late (tb bl) gj OR tb (bl gj) (6) If the bus is late and Bill feels downcast and he goes home, then he shouldn’t take the bus. (bl fd gh) ¬tb (parens not needed) (9) Bill feels downcast if the bus is late or Bill misses his appointment. bl V ma fd
Binary Counting and Truth tables Counting in base 2 (binary): decimal binary 0 0 1 1 2 10 3 11 4 100 5 101 6 110 7 111 8 1000 To find all the combinations for a truth table with n entries: 1. Write all the binary numbers from 0 to 2n-1 using n digits. 2. Convert 0 to F and 1 to T.