Script started on Thu 23 Sep 2004 10:04:39 AM EDT wasat/F04> mlisp International Allegro CL Enterprise Edition 6.2 [Solaris] (Aug 13, 2004 11:31) Copyright (C) 1985-2002, Franz Inc., Berkeley, CA, USA. All Rights Reserved. This development copy of Allegro CL is licensed to: [4549] SUNY/Buffalo, N. Campus ;; Optimization settings: safety 1, space 1, speed 1, debug 2. ;; For a complete description of all compiler switches given the ;; current optimization settings evaluate (explain-compiler-settings). ;;--- ;; Current reader case mode: :case-sensitive-lower cl-user(1): :ld /projects/snwiz/bin/sneps ; Loading /projects/snwiz/bin/sneps.lisp Loading system SNePS...10% 20% 30% 40% 50% 60% 70% 80% 90% 100% SNePS-2.6 [PL:1a 2004/08/26 23:05:27] loaded. Type `(sneps)' or `(snepslog)' to get started. cl-user(2): (sneps) Welcome to SNePS-2.6 [PL:1a 2004/08/26 23:05:27] Copyright (C) 1984--2004 by Research Foundation of State University of New York. SNePS comes with ABSOLUTELY NO WARRANTY! Type `(copyright)' for detailed copyright information. Type `(demo)' for a list of example applications. 9/23/2004 10:05:03 * (demo "sneps-passage.demo")q File /web/faculty/rapaport/740/F04/sneps-passage.demo is now the source of input. CPU time : 0.01 * ; ======================================================================== ; SNePS representation of: ; ; (1) Anna knows that John bought a dog. ; (2) The dog is a German Shepherd. ; (3) John paid $300 for the dog. ; (4) Anna also knows that Stu sold his dog. ; (5) Anna believes that John bought Stu's dog. ; ; From: Martins, Jo\~{a}o Pav\~{a}o (2002), _Knowledge Representation_ ; ======================================================================== ; First, we define some SNePS relations: (define agent act action object iobject member class lex propername class-mod class-head rel possessor equiv) act is already defined. action is already defined. (agent act action object iobject member class lex propername class-mod class-head rel possessor equiv) CPU time : 0.00 * ; 1. Anna knows that John bought a dog. ; 1a. Something has the proper name "John" (describe (assert object #john propername "John") = someone-is-named-john) (m1! (object b1) (propername John)) (m1!) CPU time : 0.00 * [1] 24939 ; Show the network: (show *someone-is-named-john) (0) CPU time : 0.00 * ; unrepresented prior knowledge (UPK): ; "John" is typically the name of a male human. ; Note: I put lexical entries in double-quotes for ; the sake of clarity, but this is not necessary. ; 1b. Something is a dog. (describe (assert member #dog class (build lex "dog") = dog-concept) = something-isa-dog) (m3! (class (m2 (lex dog))) (member b2)) (m3!) CPU time : 0.01 * [1] 24944 (show *something-isa-dog) (0) CPU time : 0.00 * ; UPK: information about dogs. ; 1c. John bought a [i.e., that] dog. (describe (assert agent *john act (build action (build lex "buy") object *dog)) = john-bought-a-dog) (m6! (act (m5 (action (m4 (lex buy))) (object b2))) (agent b1)) (m6!) CPU time : 0.00 * [1] 24948 (show *john-bought-a-dog) (0) CPU time : 0.00 * ; UPK: info (a "script") about the act of buying, exchanging money, etc. ; Note: I have ignored the past tense. ; 1d. Something has the proper name "Anna" (describe (assert object #anna propername "Anna") = someone-is-named-anna) (m7! (object b3) (propername Anna)) (m7!) CPU time : 0.00 * [1] 24953 (show *someone-is-named-anna) (0) CPU time : 0.01 * ; UPK: "Anna" is typically the name of a female human. ; 1d. Anna knows that John bought a dog. ; Note: If an agent knows that P, then P is true. ; So, if Cassie believes that someone knows that P, ; then Cassie believes that P. ; Therefore, we *assert* the object of Anna's act of knowing. ; See Rapaport, Shapiro, & Wiebe 1997. (describe (assert agent *anna act (build action (build lex "know") = knows-that object *john-bought-a-dog)) = anna-knows-that-john-bought-a-dog) (m10! (act (m9 (action (m8 (lex know))) (object (m6! (act (m5 (action (m4 (lex buy))) (object b2))) (agent b1))))) (agent b3)) (m10!) CPU time : 0.00 * [1] 24959 (show *anna-knows-that-john-bought-a-dog) (0) CPU time : 0.01 * ; Note: Should we represent that Anna knows that *john is named "John"? ; Etc.? Probably. For discussion of this, see Rapaport et al. 1997. ; UPK: Information about the act of buying. ; 2. The dog is a German Shepherd. (describe (assert member *dog class (build class-mod (build lex "German") class-head (build lex "Shepherd"))) = the-dog-isa-GS) (m14! (class (m13 (class-head (m12 (lex Shepherd))) (class-mod (m11 (lex German))))) (member b2)) (m14!) CPU time : 0.00 * [1] 24963 (show *the-dog-isa-GS) (0) CPU time : 0.00 * ; Possible UPK: Info about German Shepherds. ; For discussion of why this might not be necessary, see ; Johnson-Laird 1987. ; 3. John paid $300 for the dog. (describe (assert agent *john act (build action (build lex "pay") object (build class-mod 300 class-head (build lex "dollars")) iobject *dog)) = john-paid-300) (m19! (act (m18 (action (m15 (lex pay))) (iobject b2) (object (m17 (class-head (m16 (lex dollars))) (class-mod 300))))) (agent b1)) (m19!) CPU time : 0.00 * [1] 24968 (show *john-paid-300) (0) CPU time : 0.00 * ; Notes: (a) This is probably better represented as part of a "buying" ; script. ; (b) The semantics for the "iobject" relation needs to be ; given; see end of demo file. ; (c) The notion of "$300" needs to be explicated ; (i.e., an "ontology" for money needs to be developed) ; (d) The representation of numbers needs to be explicated ; (i.e., an "ontology" of numbers is needed) ; 4. Anna also knows that Stu sold his dog. ; ; 4a. Someone is named "Stu". (describe (assert object #stu propername "Stu") = someone-is-named-stu) (m20! (object b4) (propername Stu)) (m20!) CPU time : 0.00 * [1] 24973 (show *someone-is-named-stu) (0) CPU time : 0.01 * ; 4b. Stu possesses a dog. (describe (assert possessor *stu rel *dog-concept object #stus-dog) = stu-owns-a-dog) (m21! (object b5) (possessor b4) (rel (m2 (lex dog)))) (m21!) CPU time : 0.00 * [1] 24978 (show *stu-owns-a-dog) (0) CPU time : 0.01 * ; UPK: Stu's dog is a dog. ; 4c. Stu sold his dog. (describe (assert agent *stu act (build action (build lex "sell") object *stus-dog)) = stu-sold-his-dog) (m24! (act (m23 (action (m22 (lex sell))) (object b5))) (agent b4)) (m24!) CPU time : 0.00 * [1] 24982 (show *stu-sold-his-dog) (0) CPU time : 0.00 * ; UPK: The script for buying and selling, as mentioned above. ; 4d. Anna (also) knows that Stu sold his dog. (describe (assert agent *anna act (build action *knows-that object *stu-sold-his-dog)) = anna-knows-stu-sold-his-dog) (m26! (act (m25 (action (m8 (lex know))) (object (m24! (act (m23 (action (m22 (lex sell))) (object b5))) (agent b4))))) (agent b3)) (m26!) CPU time : 0.02 * [1] 24989 (show *anna-knows-stu-sold-his-dog) (0) CPU time : 0.00 * ; Note: "also" does not need to be represented. ; 5. Anna believes that John bought Stu's dog. ; 5a. John bought Stu's dog. (full-describe (build agent *john act (build action (find lex "buy") object *stus-dog)) = john-bought-stus-dog) (m28 (act (m27 (action (m4 (lex buy))) (object b5))) (agent b1)) (m28) CPU time : 0.00 * [1] 24993 (show *john-bought-stus-dog) (0) CPU time : 0.00 * ; Note: This is "built", not "asserted", since it is merely ; one of Anna's *beliefs*, and it is not made clear ; whether Cassie believes it or not. ; 5b. Anna believes that John bought Stu's dog. (describe (assert agent *anna act (build action (build lex "believe") object *john-bought-stus-dog)) = anna-believes-john-bought-stus-dog) (m31! (act (m30 (action (m29 (lex believe))) (object (m28 (act (m27 (action (m4 (lex buy))) (object b5))) (agent b1))))) (agent b3)) (m31!) CPU time : 0.01 * [1] 24997 (show *anna-believes-john-bought-stus-dog) (0) CPU time : 0.00 * ; Note: This is "asserted", not merely "built", since it *is* ; one of Cassie's beliefs that Anna believes that John ; bought Stu's dog. ; Exercise for the reader: Represent (5) using the "equiv-equiv" ; case frame. I.e., represent that Anna believes that the dog ; that John bought is the dog that Stu sold. ; Finally, look at the entire network: (describe *nodes) (m31! (act (m30 (action (m29 (lex believe))) (object (m28 (act (m27 (action (m4 (lex buy))) (object b5))) (agent b1))))) (agent b3)) (m26! (act (m25 (action (m8 (lex know))) (object (m24! (act (m23 (action (m22 (lex sell))) (object b5))) (agent b4))))) (agent b3)) (m21! (object b5) (possessor b4) (rel (m2 (lex dog)))) (m20! (object b4) (propername Stu)) (m19! (act (m18 (action (m15 (lex pay))) (iobject b2) (object (m17 (class-head (m16 (lex dollars))) (class-mod 300))))) (agent b1)) (m14! (class (m13 (class-head (m12 (lex Shepherd))) (class-mod (m11 (lex German))))) (member b2)) (m10! (act (m9 (action (m8)) (object (m6! (act (m5 (action (m4)) (object b2))) (agent b1))))) (agent b3)) (m7! (object b3) (propername Anna)) (m3! (class (m2)) (member b2)) (m1! (object b1) (propername John)) (m31! m30 m29 believe m28 m27 m26! m25 m24! m23 m22 sell m21! b5 m20! Stu b4 m19! m18 m17 m16 dollars 300 m15 pay m14! m13 m12 Shepherd m11 German m10! m9 m8 know m7! Anna b3 m6! m5 m4 buy m3! m2 dog b2 m1! John b1) CPU time : 0.01 * ; And a dump of the network: (dump *nodes) (m31! (act (m30) agent (b3))) (m30 (act- (m31!) action (m29) object (m28))) (m29 (action- (m30) lex (believe))) (believe (lex- (m29))) (m28 (object- (m30) act (m27) agent (b1))) (m27 (act- (m28) action (m4) object (b5))) (m26! (act (m25) agent (b3))) (m25 (act- (m26!) action (m8) object (m24!))) (m24! (object- (m25) act (m23) agent (b4))) (m23 (act- (m24!) action (m22) object (b5))) (m22 (action- (m23) lex (sell))) (sell (lex- (m22))) (m21! (object (b5) possessor (b4) rel (m2))) (b5 (object- (m27 m23 m21!))) (m20! (object (b4) propername (Stu))) (Stu (propername- (m20!))) (b4 (agent- (m24!) object- (m20!) possessor- (m21!))) (m19! (act (m18) agent (b1))) (m18 (act- (m19!) action (m15) iobject (b2) object (m17))) (m17 (object- (m18) class-head (m16) class-mod (300))) (m16 (class-head- (m17) lex (dollars))) (dollars (lex- (m16))) (300 (class-mod- (m17))) (m15 (action- (m18) lex (pay))) (pay (lex- (m15))) (m14! (class (m13) member (b2))) (m13 (class- (m14!) class-head (m12) class-mod (m11))) (m12 (class-head- (m13) lex (Shepherd))) (Shepherd (lex- (m12))) (m11 (class-mod- (m13) lex (German))) (German (lex- (m11))) (m10! (act (m9) agent (b3))) (m9 (act- (m10!) action (m8) object (m6!))) (m8 (action- (m25 m9) lex (know))) (know (lex- (m8))) (m7! (object (b3) propername (Anna))) (Anna (propername- (m7!))) (b3 (agent- (m31! m26! m10!) object- (m7!))) (m6! (object- (m9) act (m5) agent (b1))) (m5 (act- (m6!) action (m4) object (b2))) (m4 (action- (m27 m5) lex (buy))) (buy (lex- (m4))) (m3! (class (m2) member (b2))) (m2 (class- (m3!) rel- (m21!) lex (dog))) (dog (lex- (m2))) (b2 (iobject- (m18) member- (m14! m3!) object- (m5))) (m1! (object (b1) propername (John))) (John (propername- (m1!))) (b1 (agent- (m28 m19! m6!) object- (m1!))) (m31! m30 m29 believe m28 m27 m26! m25 m24! m23 m22 sell m21! b5 m20! Stu b4 m19! m18 m17 m16 dollars 300 m15 pay m14! m13 m12 Shepherd m11 German m10! m9 m8 know m7! Anna b3 m6! m5 m4 buy m3! m2 dog b2 m1! John b1) CPU time : 0.00 * [1] 25002 ; and graphically: (show *nodes) (0) CPU time : 0.01 * ; Syntax and semantics for the agent-act-action-object-iobject case ; frame: ; ; Syntax: ; ------- ; (build agent AGENT ; act (build action ACTION ; object DIRECT_OBJECT ; iobject INDIRECT_OBJECT)) ; ; builds a well-formed SNePS network, m. ; ; Semantics: ; ---------- ; ; [[m]] is the proposition that [[AGENT]] does [[ACTION]] ; with direct object [[DIRECT_OBJECT]] and indirect object ; [[INDIRECT_OBJECT]] ; ; Example: See above. End of /web/faculty/rapaport/740/F04/sneps-passage.demo demonstration. CPU time : 0.11 * (lisp) "End of SNePS" cl-user(3): :ex ; Exiting wasat/F04> x exit script done on Thu 23 Sep 2004 10:06:51 AM EDT