CSE 463/563, Spring 2003 ========================================================================= HW 9 ANSWERS ========================================================================= NOTE: There are no unique "correct" answers, since there are many ways to translate frames into other KR languages. What follows are merely some suggestions, as well as a discussion of some problems. ------------------------------------------------------------------------- 1. SNePS (straightforward answer) (assert frame hotel_room isa room location hotel contains (hotel_chair hotel_bed hotel_phone)) (assert frame hotel_chair isa chair comfort uncomfortable) (assert frame chair isa furniture use sitting legs 4 height "20-30 cm") (assert frame hotel_phone isa phone use (call_room_service call_friends) billing charge_to_room) (assert frame hotel_bed isa bed size king) (assert frame bed isa furniture use sleeping parts mattress) (assert frame mattress isa cushion firmness firm) ------------------------------------------------------------------------- Here's another possible way to do it in SNePS (incomplete solution, just to give you the idea): (assert member hotel_room class frame) (assert frame hotel_room slot isa filler room) (assert frame hotel_room slot location filler hotel) (assert frame hotel_room slot contains filler hotel_chair) (assert member hotel_chair class frame) (assert frame hotel_chair slot isa filler chair) etc. ------------------------------------------------------------------------- And here's yet another way, using "standard" SNePS case frames (also incomplete, just to give you the idea): (assert subclass hotel_room superclass room) (assert object hotel_room location hotel) (assert object hotel_room contains hotel_chair) (assert subclass hotel_chair superclass chair) (assert object hotel_chair property uncomfortable) etc. ------------------------------------------------------------------------- 2. FOL Ax[hotel_room(x) <-> isa(x, room) ^ location (x, hotel) ^ contains(x, hotel_chair) ^ contains(x, hotel_phone) ^ contains(x, hotel_bed)] Ax[hotel_chair(x) <-> isa(x, chair) ^ comfort(x, uncomfortable)] Ax[chair(x) <-> isa(x, furniture) ^ use(x, sitting) ^ legs(x, 4) ^ height(x, "20-40 cm")] Ax[hotel_phone(x) <-> isa(x, phone) ^ use(x, call_friends) ^ use(x, call_room_service) ^ billing(x, charge_to_room)] Ax[hotel_bed(x) <-> isa(x, bed) ^ size(x, king)] Ax[bed(x) <-> isa(x, furniture) ^ use(x, sleeping) ^ parts(x, mattress) ^ parts(x, bedframe)] Ax[mattress(x) <-> isa(x, cushion) ^ firmness(x, firm)] ------------------------------------------------------------------------- Alternatively: Ax[hotel_room(x) <-> isa(x) = room ^ location(x) = hotel ...] etc. ------------------------------------------------------------------------- HOWEVER: One student noted a problem with the above FOL notation, and proposed a better solution: | In your newsgroup post, you stated: | | > frame dog | > isa pet | > hasa tail | > says woof | > | > would become: | > | > Ax[Dog(x) <-> isa(x,pet) ^ hasa(x,tail) ^ says(x,woof)] | | However, it appears to me as it wouldn't be a smart idea to represent x | being a pet by isa(x,pet). If 'pet' is a constant, then it would only | refer to that one item, not the class of pets. Wouldn't it be a smarter | and more useful choice to say ( isa(x,y) ^ Pet(y) )? In the hotel_room | frame system, the 'hotel_room' contains 'hotel_chair', which has its own | frame. So if you made 'hotel_chair' a constant for | contains(x,hotel_chair), and then you wanted to use Hotel_chair(x), | Hotel_chair(x) would have to be equivalent to x = hotel_chair, it seems, | and in doing this, you're limiting yourself to one 'hotel_chair', rather | than a bunch of them, which Hotel_chair(x) could actually mean. I'm not | sure if you understand the point I'm trying to make, but it seems to me | that it is a poor approach to use constants for something that may have | its own frame. I'd rather see something like | | Ax[Dog(x) <-> EyEz[isa(x,y) ^ Pet(y) ^ hasa(x,z) ^ Tail(z) ^ | says(x,woof)]] | | Where 'woof' could still be a constant, because it wouldn't have its own | frame. | | I could then do something like | | Ax[ Hotel_room(x) <-> Ey[ isa(x,y) ^ Room(y) ] ^ Ez [ contains(x,z) ^ | Hotel_chair(z) ] ] | Ax[ Hotel_chair(x) <-> Ey[ isa(x,y) ^ Chair(y) ] ^ | comfort(x,uncomfortable) ] | | And then be able to substitute something similar to ( Ey[ isa(x,y) ^ | Chair(y) ] ^ comfort(x,uncomfortable) ) for Hotel_chair(z) in the first | one to get: | | Ax[ Hotel_room(x) <-> Ey[ isa(x,y) ^ Room(y) ] ^ Ez [ contains(x,z) ^ | Ew[ isa(z,w) ^ Chair(w) ] ^ comfort(z,uncomfortable) ] ] | | It doesn't make sense to me to mix and match Hotel_room(x) with x = | hotel_room. Stick to one or another, but don't use Dog(x) then use | isa(x,pet). Dogs and pets are not specific, and they both would have | their own frames, so don't use one as a contant and not the other. | | Here's the approach I took for converting frames to FOL: | | Ax[ Hotel_room(x) <-> Ey[ isa(x, y) ^ Room(y) ] ^ | Ey[ location(x, y) ^ Hotel(y) ] ^ | Ey[ contains(x, y) ^ Hotel_chair(y) ] ^ | Ey[ contains(x, y) ^ Hotel_phone(y) ] ^ | Ey[ contains(x, y) ^ Hotel_bed(y) ] | ] | | Ax[ Hotel_chair(x) <-> Ey[ isa(x, y) ^ Chair(y) ] ^ | comfort(x, uncomfortable) | ] | | Ax[ Chair(x) <-> Ey[ isa(x, y) ^ Furniture(y) ] ^ | use(x, sitting) ^ | legs(x, 4) ^ | height(x, '20-40 cm') | ] | | Ax[ Hotel_phone(x) <-> Ey[ isa(x, y) ^ Phone(y) ] ^ | use(x, call_friends) ^ | use(x, call_room-service) ^ | billing(x, charge_to_room) | ] | | Ax[ Hotel_bed(x) <-> Ey[ isa(x, y) ^ Bed(y) ] ^ | size(x, king) | ] | | Ax[ Bed(x) <-> Ey[ isa(x, y) ^ Furniture(y) ] ^ | use(x, sleeping) ^ | Ey[ part(x, y) ^ Mattress(y) ] ^ | Ey[ part(x, y) ^ Bedframe(y) ] | ] | | Ax[ Mattress(x) <-> Ey[ isa(x, y) ^ Cushion(y) ] ^ | firmness(x, firm) | ] | | By doing this, I can implement a procedure that can replace anything on | the left side of a <-> by anything on the right side, or vice versa... | with a change in the quantifier letters, of course. | | You couldn't do that the other way, "Ax[ Dog(x) <-> isa(x,pet) ...". If | you had a Ax[ x=pet <-> ... ] then it seems as if you'd be changing | semantics of the = sign.