1 CMSC 421, Spring 2017 – EXAM II *PrInT*YouR*NamE

CMSC421,Spring2017–EXAMII
*PrInT*YouR*NamE*:_______________________**SOLUTIONS**___________________________
Pleasesignthefollowingpledge:IpledgeonmyhonorthatIhavenotgivenor
receivedanyunauthorizedassistanceonthisassignment/examination.
Signed:_____________________________________________________________
==================DONOTWRITEBELOWTHISLINE===================
page2_____/20
page3_____/20
page4_____/20
page5_____/20
page6_____/20
total_____/100
1
RobbieRobot(RR)isthirsty,andwouldloveabottleofwine.RRbreaksthisdowninto
two problems: figure out where there is wine, and then how to get to it. (usymbols
showwhereyouneedtodosomething.)
PartIWhereisthewine?
A.(20pts)AssumeRR’sknowledgebase(KB)hasencodingsofthefollowing:
(1)Wine-bottlesarestoredinchilledlocations.
(2)Chilledlocationsareeitherthebasementorthefreezer.
(3)Ifawine-bottleisstoredinthefreezerthenitisnotdrinkable.
(4)Thereisadrinkablewine-bottle.
u State in intuitive mathematical English how (1-4) above can be used to conclude
therethereisadrinkablewine-bottleinthebasement;indoingso,pointoutwhere
youareusingeachof(1-4).
From (4), let dwb be a drinkable wine-bottle. From (1) and (2) dwb must be
eitherinthebasementorthefreezer.Butfrom(3)itcannotbeinthefreezerso
itisinthebasement.
Below,represent(1-4)aboveinFOL.Usethesesymbols:
W(x)tomeanxisawine-bottle
S(x,y)tomeanxisstorediny
Ch(y)tomeanyisachilledlocation
D(x)tomeanxisdrinkable
bforbasement;fforfreezer
=for“is”(asiny=fforyisthefreezer)
u Hereisastart;youdo2-4:
1. (Forallx){W(x)à(Existsy)[S(x,y)^Ch(y)]}
2. (Forally)(Ch(y)à y=bvy=f)
3. (Forallx){(W(x)^S(x,f))à ~D(x)}
4. (Existsx)(W(x)^D(x))
u Rewrite1aboveinCNF–besuretouseaSkolemfunctiontodealwith(Existsy):
[~W(x)vS(x,g(x))]&[~W(x)vCh(g(x))]
2
B.(20pts)Supposeinsteadof(1)inPartA,RRhasthebeliefthatwine-bottlesare
usually(typically,generally)storedinachilledlocation,butthattherecanberare
exceptions.
u LettingAb(x)meanxisabnormal(anexceptiontothe“wine-bottlesarestoredina
chilled location”) rule, write a new version 1* of 1 above in FOL, using Ab
appropriatelyforcircumscription.Hint:ItshouldlookmuchliketheFOLwfffor1we
gaveyouabove,exceptthatitwillinadditionhave~Ab(x)includedsomewhere.
1*:(Forallx){(W(x)^~Ab(x))à (Existsy)[S(x,y)^Ch(y)]}
Furthersupposethatinsteadofyourwff4.above,RRhasthewff4*: W(w)^D(w),
which states that a particular (constant) object w is a drinkable wine-bottle.
Circumscriptioncanbeusedtoshowthatwisnotabnormal,andthatwisstoredin
thebasement.Youwillnotdothisindetailhere;simplydescribemorefullywhat
needstobeshownaboutpossiblesubstitutewffsAb’,Ch’,S’,andD’,wherewewant
Ab’toapplytoasfewthingsaspossible,inthenexttwosteps:
u WhatneedstobeshownifwesubstituteAb’,Ch’,S’,andD’forAb,Ch,SandDinto
RR’sKB(1*,2,3,4*)?(Don’tshowit,juststatewhathastobeshown;Englishisfine.)
OnehastoprovethesubstitutedversionoftheKB(withtheprimedpredicates),
usingtheoriginalunprimedversions.
u WhatneedstobeshownabouttherelationshipbetweenAb(x)andAb’(x)? (Again,
juststateit,don’tshowit.)
Onehastoshowthat(Forallx)(Ab’(x)à Ab(x));i.e.,thatAb’“shrinks”Ab.
CircumscriptionthenallowsonetoactuallyuseAb’asifitwereAb,tomakeuseful
conclusions; for instance letting Ab’(x) be x=/=x and carrying out the above steps,
onecanfirstshow~Ab(w)andthenS(w,b).(Donotdothis.)
u SupposenowthattheKBalsohasafifthaxiominadditionto1*,2,3,and4*namely
~S(w,b).CIRCLEALLTHATAPPLYregardinguseofcircumscriptioninthiscase:
(a)Onecaninfertheexactlysamethingsasbefore
(b)Acontradictionarises
à (c)Onecannolongerinfer~Ab(w)
à (d)OnecannolongerinferS(w,b)
(e) Adding new axioms falls outside the scope of nonmonotonic or commonsense
reasoning
3
C. (20 pts)Anotherwaytotrytocapturethetypicalityaboveiswithprobabilities.
Suppose that the probability that a wine-bottle is chilled (C) is P(C)=0.8; that
P(C|R)=0.6,whereRstandsforredwine;andfurtherthatP(R)=0.5(abottlehas
a 50-50 chance of being red). In working the problems below, you may find these
generalfactsuseful,foranyeventsXandY:
P(X|Y)=P(X&Y)/P(Y)
P(Y|X)=P(X|Y)P(Y)/P(X)
P(X)=P(X&Y)+P(X&-Y)
P(X)+P(-X)=1
u Findtheseprobabilities:
P(C&R)=P(C|R)P(R)=0.6x0.5=0.3
P(C&-R)=P(C)–P(C&R)=0.8–0.3=0.5
P(C|-R)=P(C&-R)/P(-R)=0.5/0.5=1
P(R|C)=P(C|R)P(R)/P(C)=0.6x0.5/0.8=3/8
P(-R|C)=P(-R&C)/P(C)=0.5/0.8=5/8
4
PartII(20pts)HowcanRRgetthewine?
Havingfiguredout(asinPartIAabove)thatdrinkablewineisinthebasement,RR
needstofindaplantogettoit.RRcanusesituationcalculus,butneedsyourhelpin
formulatingappropriateaxioms.AssumeinthispartthatRR’s“world”consistsofa
basementb,groundfloorg,andtopfloort.Intheinitial(starting)situations_0,
RRisonthetopfloor.Thuss_0canbedescribedas:
At(RR,t,s_0)
In this simplified world, RR has three possible actions (to be represented via
function-symbols): go_up_one_floor (goup), go_down_one_floor (godown), and
drink_wine (drink).RRcannotgoupwhenalreadyatt,nordownwhenatb,nor
drink unless at b. (Assume goup, godown, and drink each take only a situation
variable;thatis,RRisunderstoodtobetheagent.)
u Writetwosit-calclogicchangeaxiomsexpressingtheresultsofeachoftheactions
goupandgodown,dependingonwhereRRis;wehavegivenyouthepreconditions:
Forgodown:
At(RR,t,s)àAt(RR,g,godown(s))
At(RR,g,s)àAt(RR,b,godown(s))
Forgoup:
At(RR,b,s)àAt(RR,g,goup(s))
At((R,g,s)àAt(RR,t,goup(s))
u Writeasit-calclogicframe axiomexpressingthatdrinkingdoesnotchangeRR’s
location;includeanyrelevantpreconditions.
At(RR,b,s)à At(RR,b,drink(s))
u Asit-calrepresentationofaplanRRmightusetodrinkthewine,startingins_0,is
(CIRCLEONE):
(a)At(RR,b,drink) (b)godown(godown(drink(s_0)))
à (c)drink(godown(godown(s_0)))
(d)alloftheabove (e) none of the
above
5
PartIII(20pts)ResolvingtoGetSomeFreshAir
RRisfeelingalittlewoozyafterdrinkingthewine,andgoesoutdoorsforfreshairand
toplaywithaballoon.One possible action is to grasp the balloon. A fluent in this
world is Holds. Below are two relevant axioms (all that are needed to do this
simplified problem), where b now stands for the balloon. [If you wish, you may
abbreviate Holds as H, and grasp as g, and may also omit arguments RR and b, to
keepnotationeasytowrite/read.]
Initialsituations_0:
1.~Holds(RR,b,s_0)[abbrev:~H(s_0)]
Changeaxiom:
2.~Holds(RR,b,s)àHolds(RR,b,grasp(RR,b,s))[abbrev:~H(s)àH(g(s))]
u WritethetwoaxiomsaboveinCNF.
1.~Holds(RR,b,s_0)[or~H(s_0)]
2.H(s)vH(g(s))
RRwantstobeholdingtheballoon;ourgoalwffGthenis(Existss)Holds(RR,b,s).
u WriteitsnegationNGinCNF[againfeelfreetouseaboveabbreviations]:
~H(s)
u Derive a plan for RR to hold the balloon, using answer-extraction in refutationresolutionformat;underlinetheplanthatresults.HINT:StartbyresolvingtheCNFs
forAxioms1and2;thenresolvetheresultwithNGvAns(s).[Abbreviationsaboveare
finetouse.]
Ax_1andAx_2resolve[ifthesinAx_2isboundtos_0]toyieldH(g(s_0)).
Thisresultthenresolveswith~H(s)vAns(s),yieldingthefinalresult[wheresis
nowboundtog(s_0)]:Ans(g(s_0)).
6