TRƯỜNG ĐẠI HỌC BÁCH KHOA TP.HCM Khoa Khoa học & Kỹ thuật Máy tính TUTORIAL SESSION 4 PROPOSITIONAL LOGIC 1.. Getting an A on the final and doing every exercise in the book is sufficien
Trang 1TRƯỜNG ĐẠI HỌC BÁCH KHOA TP.HCM Khoa Khoa học & Kỹ thuật Máy tính
TUTORIAL SESSION 4 PROPOSITIONAL LOGIC
1 Let p, q, and r be the following propositions:
p: You get an A on the final exam
q: You do every exercise in the book
r: You get an A in this class
Write the following formulas using p, q, and r and logical connectives
a You get an A in this class, but you do not do every exercise in the book
b To get an A in this class, it is necessary for you to get an A on the final
c Getting an A on the final and doing every exercise in the book is sufficient for getting an A in this class
Solution:
a r ˄ ¬q
b r => p
c p ˄ q => r
2 Is the sentences valid, unsatisfiable, or neither?
a Smoke => Smoke
b Smoke => Fire
c ((Smoke Heat) => Fire) ((Smoke => Fire) ν (Heat => Fire))
Solution:
a valid
b neither
c neither
3 Express sentences in propositional logic:
a You can stay in dormitory only if you are an honor student or you are not a
graduate student
b You cannot pass the driver license exam if your knowledge exam’s score is under
60 unless you are older than 45 years old
c If the photo is digital or in black and white, then it is a portrait, else not
d If it is a portrait, then it is a picture of my friend
Solution:
a Symbolize the related predicates as follows:
Trang 2p: you can stay in dormitory
q: you are a honor student
r: you are a graduate student
Propositional logic representation: p => q ˅ ¬r
b Symbolize the related predicates as follows:
p: you can pass the driver license exam
q: your knowledge exam’s score is under 60
r: you are older than 45 years old
Propositional logic representation: ¬r => (q => ¬p) (or (p ˄ q) => r)
c Symbolize the related predicates as follows:
p: the photo is digital
q: the photo is in black and white
r: the photo is a portrait
t: the photo is a picture of my friend
Propositional logic representation: p ˅ q r
d Symbolize the related predicates as question 3c:
Propositional logic representation: r => t
4 Assuming that we have three propositional-logic-based KBs as follows:
a If the temperature and the pressure are constant then it does not rain
The temperature remained constant
It rained
Using resolution to answer the question: Did the pressure remain constant or not?
b Men eat when they are hungry
John always wears his best suit to eat
At this moment John is not hungry
Using resolution to answer the question: Is John wearing his best suit or not?
Solution:
a T: the temperature is constant
P: the pressure is constant
R: it’s rain
KB = {T ∧ P ⇒ ¬R, T, R} = {¬T ∨ ¬P ∨ ¬R, T, R}
Assume the pressure didn’t remain constant: α = ¬P
KB ∪ {¬α} = {¬T ∨ ¬P ∨ ¬R, T, R, P}
Resolution:
¬T ∨ ¬P ∨ ¬R T => ¬P ∨ ¬R
¬P ∨ ¬R R => ¬P
¬P P => []
Thus, the pressure didn’t remain constant
Trang 3b E: John eats
H: John is hungry
S: John wears his best suit
KB = {H ⇒ E, E ⇒ S, ¬H} = {¬H ∨ E, ¬E ∨ S, ¬H}
Assume John is wearing his best suit: α = S
KB ∪ {¬α} = {¬H ∨ E, ¬E ∨ S, ¬H, ¬S}
Resolution:
¬H ∨ E ¬E ∨ S => ¬H ∨ S
¬H ∨ S ¬S => ¬H
Assume John is not wearing his best suit: α = ¬S
KB ∪ {¬α} = {¬H ∨ E, ¬E ∨ S, ¬H, S}
Resolution:
¬H ∨ E ¬E ∨ S => ¬H ∨ S
Thus, we can’t conclude John is wearing his best suit or not