You are on page 1of 11

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)IfitisSaturdaytoday,thenweplaysoccerorbasketball.(2)Ifthesoccerfieldisoccupied, wedontplaysoccer.(3)ItisSaturdaytoday,andthesoccerfieldisoccupied.Provethatweplay basketballorvolleyball. Firstweformalizetheproblem P:ItisSaturdaytoday. Q:Weplaysoccer. R:Weplaybasketball. S:Thesoccerfieldisoccupied. T:Weplayvolleyball. OurpremiseP(QR),SQ,P,S NeedtoproveRT

SCJ

UNIVERSITI TEKNOTOGI MALAYSIA 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.
Let p = "The lift is working" Q = "l am in the lift" r = "You are in the lift"

overweight" t = "The power is on"


s = "You are

Translate these formulae into English.


(q ->

-p)

(p -> (t

" -r)) ((-t v (q " r)) -> -p) (-p -> ((q ^ r) v (r ^ s)))

Equivalences For 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+q
Convert 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 parents No person is both male and female All people have one male parent and one female parent Ancestors 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,

r/aa"
=

/oog
x

owner(x))

/toVn

Likes(John, Owner(Fido)) Likes(x, Owner(y)) Likes(John, z) Likes(x, Owner(y)) Likes(Fido, Father(John))

Logic c Exercis se 5
The follo owing predic cates are defi fined: fr riend is " is i a friend of f mine" w wealthy is " is wealthy" cl lever is " is clever" boring is " is boring"

Write eac ch of the following prop positions usin ng predicate notation: 1 Jimmy is a friend of o mine. 2 Sue is wealthy w and clever. 3 Jane is wealthy but t not clever. 4 Both Mark M and Ela aine are frien nds of mine. 5 If Peter r is a friend of o mine, then n he is not boring. b 6 If Jimm my is wealthy y and not bo oring, then he e is a friend of mine.

Answ wers to Logic L Ex xercise 5


1 friend(J Jimmy) 2 wealthy y(Sue) clev ver(Sue) 3 wealthy y(Jane) clever(Jane) 4 friend(M Mark) frie end(Elaine) 5 friend(P Peter) boring(Peter) ) 6 (wealth hy(Jimmy) boring(Jim mmy)) fri iend(Jimmy) )

1 Using the sam U me predicates you define ed in Exercis se 5, symbol lise each of the t following g. (a a) Some of my m friends ar re clever. (b b) All clever r people are boring. b (c c) None of my m friends is wealthy. (d d) Some of my m wealthy friends f are clever. c (e e) All my cle ever friends are boring. (f f) All clever people are either e boring g or wealthy. .

2 Define suitab D ble propositio onal function ns, and henc ce symbolise e: (a a) All pop-st tars are overp paid. (b b) Some RA AF pilots are women. (c c) No studen nts own a Ro olls-Royce. (d d) Some doc ctors cannot write legibly y. 1 (a a) x, friend d(x) clever r(x) (b b) x, clever r(x) boring g( x ) (c c) x, friend d(x) weal lthy(x) O ( x, friend(x) we OR: ealthy(x)) (d d) x, friend d(x) wealthy hy(x) clever r(x) (e e) x, (cleve er(x) friend d(x)) borin ng(x) (f f) x, clever(x) (borin ng(x) weal lthy(x))

2 a) popstar(x) is "x is a po op-star" (a ov verpaid(x) is s "x is overp paid" x, popstar(x) overpai id(x)

(b b) pilot(x) is "x is an RA AF pilot" w woman (x) is "x is a woma an" x, pilot(x) woman(x)

(c c) student(x) is "x is a stu udent" ro olls(x) is "x owns o a Rolls s-Royce"

x, student(x) rolls(x) O ( x, student(x) ro OR: olls(x))

(d d) doctor(x) is "x is a doc ctor" write(x) is "x can write le w egibly" x, doctor(x) write(x)

Suppose:(1)IfitisSaturdaytoday,thenweplaysoccerorbasketball.(2)Ifthesoccerfieldisoccupied, wedontplaysoccer.(3)ItisSaturdaytoday,andthesoccerfieldisoccupied.Provethatweplay basketballorvolleyball. Firstweformalizetheproblem P:ItisSaturdaytoday. Q:Weplaysoccer. R:Weplaybasketball. S:Thesoccerfieldisoccupied. T:Weplayvolleyball. OurpremiseP(QR),SQ,P,S NeedtoproveRT

(1) P(QR) Premise (2) P Premise (3) QR Apply implication rule to (1)(2) (4) SQ Premise (5) S Premise (6) Q Apply implication rule to (4)(5) (7) R Apply disjunction rule to (3)(6) (8) RT Apply disjunction rule to (7)

UNIVERSITI TEKNOTOG! MATAYSIA SO 3553 : ARTIFICIAL INTEILIGENCE


IN-CLASS EXERCISE : LOGIC

formulae' Translate the foltowine Enelish context into propositional losic to me to t*ro*w's lecture without my friend who always insists on talking There is no way tt rt not well as may while she's talking I throughout the lecture. since I can't concentrate on the subject

lG

come.

ANSWER: x - I will come to tomorrow's lecture lecture Y - I understand mY z - My friend talks to me throughout class a - I concentrate on the subject *+ -x} { ( ( -(x -+ -Y) ,r z} n(z -+ :a} }

Let

I
t

= "The lift is working" = "1am in the lift"

r = "You are in the lift" s = "You are overweight"


= "The Power is on"

(q

+ -p) (p -+ (t n;r))

lf I am in the lift then it does not work' lift. lf the lift is working the power must be on but you are not in the ((-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' you are in (-p -+ ((q n r) v (r n s)))lf the lift isn't working then either both of us are in the lift or the lift and You are overweight.

Eouivalences

may be more symbolize the sentences and than one. (To determine if two sentences are equivalent to each other, determine if the symbolizations are equivalent to teach other.)

F"*..t

*"tence, determine which of the sentences beneath it are equivalent to it. There

-(--H v -F->T

R)

2) "Unless the class is full, she'll take F = The class is full. T = She'll take the class.

it."

iiijiif 6tl'.'- didl hta

.:[i;1;r':,

ffiruF-Ele-ffi;i-*g*l#M
ffiffiT;;ii
il;;Iffi;;;;;
Person (x) child (x)

fuil." ""tv"ii'r''e i, no. n"."rsary for the crass being

doesn't

ttf-':l

F-+-T

-(F -+ T)

Parent (x,

Y)

Male (x)
Female (x) ancestor (x, Y) sibling (x, Y)

parent(z' x) n v * n Person{z) n parent(v' x} n fllT:::Jl,.',"#lfli1ti",,r, female' No person is both male and Person(x} n Male(x} n Female(x}

z}

-{3x

parent and one female parent' All people have one male

VxPerson(x}+FyszPerson(y}nMale(y}^parent(y,x}nPerson(z}nFemale(z)nparent(z,x) or the person's parentd ancestors'


as the person's parents Ancestors of a person are defined parent(2, y) ancestor(x' z))) (x, y) <+ tparent(x, y) v (32 ^ person(y) ancestor -+ vxvy same two parents the have both they if One child is a sibling of another

vxvych,d(xlnchitd(y)n(3zrwz*wAparent(z,x)nparent(z,y)nparent(w,x)nparenttw'y)-+sibling(x'y)

tsa(Fido, Dog) lsa(x, Dog) lsa(x, Dog) lsa(y, z)

MGU = x/Fido

MGU = xly

,{Dog
2nd

Likes(r Owner(x))
Likes(John, Owne(Fido)) Likes(x, Owne(Y)) Likes(John, z) Likes(x, Owne(Y)) Likes(Fido, Father(John))

cannot unify because in the MGU = x/John' However they after substitution Fido x John argument
MGU = x/John, z/ownertY)

MGU = x/Fido, OwnertYllFather(lohn)