exercise logic with ans
DESCRIPTION
Exercise Logic With AnsTRANSCRIPT
Logic Exercise 1
The following predicates are defined:
friend is "… is a friend of mine" wealthy is "… is wealthy" clever is "… is clever" boring is "… is boring"
Write each of the following propositions using predicate notation:
1 Jimmy is a friend of mine.
2 Sue is wealthy and clever.
3 Jane is wealthy but not clever.
4 Both Mark and Elaine are friends of mine.
5 If Peter is a friend of mine, then he is not boring.
6 If Jimmy is wealthy and not boring, then he is a friend of mine.
Logic Exercise 2
1
Using the same predicates you defined in Exercise 1, symbolise each of the following. (a) Some of my friends are clever. (b) All clever people are boring. (c) None of my friends is wealthy. (d) Some of my wealthy friends are clever. (e) All my clever friends are boring. (f) All clever people are either boring or wealthy.
2
Define suitable propositional functions, and hence symbolise: (a) All pop-stars are overpaid. (b) Some RAF pilots are women. (c) No students own a Rolls-Royce. (d) Some doctors cannot write legibly.
Exercise 3 (homework)
Suppose: (1) If it is Saturday today, then we play soccer or basketball. (2) If the soccer field is occupied, we don’t play soccer. (3) It is Saturday today, and the soccer field is occupied. Prove that we play basketball or volleyball.
First we formalize the problem:
P: It is Saturday today.
Q: We play soccer.
R: We play basketball.
S: The soccer field is occupied.
T: We play volleyball.
Our premise:P→(Q R), S→¬Q, P, S
Need to prove:R T
UNIVERSITI TEKNOTOGI MALAYSIA
SCJ 3553 : ARTIFICIAL !NTELLIGENCE
lN-CIASS EXERCISE : LOGIC
Translate the following English context into propositional logic formulae.There is no way that I'll get to tomorrow's lecture without my friend who always insists on talking to me
throughout the lecture. Since I can't concentrate on the subject while she's talking I may as well not
come.
Letp = "The lift is working"
Q = "l am in the lift"r = "You are in the lift"s = "You are overweight"t = "The power is on"
Translate these formulae into English.(q -> -p)(p -> (t " -r))((-t v (q " r)) -> -p)(-p -> ((q ^ r) v (r ^ s)))
EquivalencesFor each sentence, determine which of the sentences beneath it are equivalent to it. There may be more
than one. (To determine if two sentences are equivalent to each other, symbolize the sentences and
determine if the symbolizations are equivalent to teach other.)
1) "Being rich is not sufficient for being happy."R = Some is rich.H = Someone is happy.
a) "someone can be rich but not happy."b) "someone can be happy but not rich."c) "lt isn't the case that either someone isn't rich or they are happy."
d) "lt isn't the case that either someone is happy or they aren't rich."
e) "lt isn't the case that either someone isn't happy or they are rich."f) "Not being rich is sufficient for not being happy."
2) "Unless the class is full, she'll take it."F = The class is full.T = She'll take the class.
a) "Either the class is full or she'll take it."b) "lf she doesn't take the class then it's full."c) "lf she does take the class then it isn't full."d) "lt's not the case that the class isn't full and she won't take it."e) "The class is full only if she doesn't take it."f) "Her taking the class is not necessary for the class being full."
k+qConvert the following to standard predicate togic using the predicates indicated
Person (x)
child (x)
parent (x, y)
Male (x)
Female (x)
ancestor (x, y)
sibling (x, y)
All people have two parentsNo person is both male and femaleAll people have one male parent and one female parentAncestors of a person are defined as the person's parents or the person's parents, ancestors.one child is a sibling of another if they both have the same two parents
Find a MGU (most generatunifier) for the foilowing pairs if one exists
lsa(Fido, Dog)
lsa(x, Dog)
lsa(x, Dog)
lsa(y, z)
Likes(x, owner(x)) x /toVnLikes(John, Owner(Fido))
Likes(x, Owner(y))
Likes(John, z)
Likes(x, Owner(y))
Likes(Fido, Father(John))
r/aa"
= /oog
LogicThe follo
frwclb
Write eac
1 Jimmy
2 Sue is w
3 Jane is
4 Both M
5 If Peter
6 If Jimm
Answ1 friend(J
2 wealthy
3 wealthy
4 friend(M
5 friend(P
6 (wealth
c Exercisowing predic
riend is "… iwealthy is "…lever is "… oring is "…
ch of the fol
is a friend o
wealthy and
wealthy but
Mark and Ela
r is a friend o
my is wealthy
wers to LJimmy)
y(Sue) clev
y(Jane) ¬c
Mark) frie
Peter) ¬b
hy(Jimmy)
se 5 cates are defi
is a friend of… is wealthy
is clever" is boring"
lowing prop
of mine.
clever.
t not clever.
aine are frien
of mine, then
y and not bo
Logic Ex
ver(Sue)
lever(Jane)
end(Elaine)
oring(Peter)
¬boring(Jim
fined:
f mine" "
positions usin
nds of mine.
n he is not b
oring, then he
xercise 5
)
mmy)) fri
ng predicate
boring.
e is a friend
5
iend(Jimmy)
notation:
of mine.
)
1
U(a(b(c(d(e(f
2
D(a(b(c(d
1
(a(b(cO(d(e(f
2
(aov
(bw
(cro
Using the sama) Some of mb) All cleverc) None of md) Some of me) All my clef) All clever
Define suitaba) All pop-stb) Some RAc) No studend) Some doc
a) x, friendb) x, cleverc) x, friend
OR: ¬( x, frd) x, friende) x, (clevef) x, clever
a) popstar(x)verpaid(x) isx, popstar(x
b) pilot(x) is woman(x) is "
x, pilot(x)
c) student(x)olls(x) is "x o
me predicatemy friends arr people are bmy friends ismy wealthy fever friends people are e
ble propositiotars are overp
AF pilots are nts own a Roctors cannot
d(x) cleverr(x) boringd(x) ¬wealiend(x) we
d(x) wealthyer(x) friend(x) (borin
) is "x is a pos "x is overpx) overpai
"x is an RA"x is a womawoman(x)
) is "x is a stuowns a Rolls
s you definere clever. boring. wealthy. friends are care boring.
either boring
onal functionpaid. women.
olls-Royce. write legibly
r(x) g(x) lthy(x) ealthy(x)) hy(x) cleverd(x)) borinng(x) weal
op-star" paid" id(x)
AF pilot" an"
udent" s-Royce"
ed in Exercis
clever.
g or wealthy.
ns, and henc
y.
r(x) ng(x) lthy(x))
se 5, symbol
.
ce symbolise
lise each of t
e:
the followingg.
O
(dw
x, student(xOR: ¬( x, st
d) doctor(x) write(x) is "x
x, doctor(x)
x) ¬rolls(xudent(x) ro
is "x is a doccan write le
) ¬write(x)
x) olls(x))
ctor" egibly" )
Suppose: (1) If it is Saturday today, then we play soccer or basketball. (2) If the soccer field is occupied, we don’t play soccer. (3) It is Saturday today, and the soccer field is occupied. Prove that we play basketball or volleyball.
First we formalize the problem:
P: It is Saturday today.
Q: We play soccer.
R: We play basketball.
S: The soccer field is occupied.
T: We play volleyball.
Our premise:P→(Q R), S→¬Q, P, S
Need to prove:R T
(1) P→(Q∨R) Premise (2) P Premise (3) Q∨R Apply implication rule to (1)(2) (4) S→¬Q Premise (5) S Premise (6) ¬Q Apply implication rule to (4)(5) (7) R Apply disjunction rule to (3)(6) (8) R∨T Apply disjunction rule to (7)
UNIVERSITI TEKNOTOG! MATAYSIA
SO 3553 : ARTIFICIAL INTEILIGENCE
IN-CLASS EXERCISE : LOGIC
Translate the foltowine Enelish context into propositional losic formulae'
There is no way tt rt lG to t*ro*w's lecture without my friend who always insists on talking to me
throughout the lecture. since I can't concentrate on the subject while she's talking I may as well not
come.ANSWER: x - I will come to tomorrow's lecture
Y - I understand mY lecture
z - My friend talks to me throughout class
a - I concentrate on the subject
{ ( ( -(x -+ -Y) ,r z} n(z -+ :a} } *+ -x}
Let P = "The lift is working"
I = "1am in the lift"r = "You are in the lift"s = "You are overweight"t = "The Power is on"
((-t v (q n r)) + -p) lf either the power is off or both of us are in the lift then it won't work'
(-p -+ ((q n r) v (r n s)))lf the lift isn't working then either both of us are in the lift or you are in
the lift and You are overweight.
EouivalencesF"*..t *"tence, determine which of the sentences beneath it are equivalent to it. There may be more
than one. (To determine if two sentences are equivalent to each other, symbolize the sentences and
determine if the symbolizations are equivalent to teach other.)
-(--H v R)
2) "Unless the class is full, she'll take it."F = The class is full.T = She'll take the class.
(q + -p)(p -+ (t n;r))
lf I am in the lift then it does not work'
lf the lift is working the power must be on but you are not in the lift.
-F->T
iiijiif 6tl'.'- didl hta .:[i;1;r':,
ffiffiT;;ii ""tv"ii'r''e doesn't ttf-':l
il;;Iffi;;;;; i, no. n"."rsary for the crass being fuil." -(F -+ T)
Person (x)
child (x)
Parent (x, Y)
Male (x)
Female (x)
ancestor (x, Y)
sibling (x, Y)
fllT:::Jl,.',"#lfli1ti",,r, n Person{z) n parent(v' x} n parent(z' x) n v * z}
No person is both male and female'
-{3x Person(x} n Male(x} n Female(x}
All people have one male parent and one female parent'
VxPerson(x}+FyszPerson(y}nMale(y}^parent(y,x}nPerson(z}nFemale(z)nparent(z,x)Ancestors of a person are defined as the person's parents or the person's parentd ancestors'
vxvy person(y) -+ ancestor (x, y) <+ tparent(x, y) v (32 parent(2, y) ^
ancestor(x' z)))
One child is a sibling of another if they both have the same two parents
vxvych,d(xlnchitd(y)n(3zrwz*wAparent(z,x)nparent(z,y)nparent(w,x)nparenttw'y)-+sibling(x'y)
ffiruF-Ele-ffi;i-*g*l#M
tsa(Fido, Dog)
lsa(x, Dog)
lsa(x, Dog)
lsa(y, z)
Likes(r Owner(x))
Likes(John, Owne(Fido))
Likes(x, Owne(Y))
Likes(John, z)
Likes(x, Owne(Y))
Likes(Fido, Father(John))
F-+-T
MGU = x/Fido
MGU = xly ,{Dog
MGU = x/John' However they cannot unify because in the 2nd
argument after substitution Fido x John
MGU = x/John, z/ownertY)
MGU = x/Fido, OwnertYllFather(lohn)