Upload
clifton-cameron
View
215
Download
2
Embed Size (px)
Citation preview
1
Discrete Structures
Lecture 5
Boolean Expressions and
Propositions
2
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
3
Metatheorem Duality
Part a:
P is valid iff ¬PD is valid.
Part b:
(P Q) is valid iff (PD QD) is valid.
4
Duality Review
For each expression P Q, write the expression PD QD.
(a) p p true
(b) p q p q p
5
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:1) Locate subpropositions:
It snowed today.I went skiing.
2) Assign these to boolean variables:st = It snowed todayws=I went skiing
3) Combine with obvious translation of joining words (and):st ws
6
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.......
7
Translation of English Words
and, while, but
inclusive or
exclusive or
not
if x then y
x y
x Vy
x y
x ¬y
¬ x
x y
8
Translation of English Words
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 x y can be replaced by y x
x y
x y
y x
x y
y x
9
problem 2.5
Translate 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.
rc V rd
rc rd s eh
r ¬s
10
The Tardy Bus Problem (2.9)
Has three assumptions and eight conjectures. Translate the assumptions and conjectures into boolean expressions.
11
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
12
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
13
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
14
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.