CS676: Knowledge Representation Fall, 1999

Homework 4
Due at start of class, Tuesday, November 9, 1999

Stuart C. Shapiro
Department of Computer Science
State University of New York at Buffalo


Formalize the following argument in SNePSLOG, and run it.

No person believes what is said by anyone he believes to be a liar. When there's danger, if person A warns person B, then B takes evasive action if and only if he believes A. If there's danger, anyone who doesn't take evasive action gets injured. Whenever there's danger, Larry warns Bob. Larry warns Bob by saying something to him. If someone says something, you believe what they say if and only if you believe them. Bob is a person. Larry is a person. Bob thinks that Larry is a liar. There's danger. Therefore, Bob gets injured.

Instructions and Advice:

  1. To run SNePSLOG:
    1. Prepare the input in SNePSLOG format in a file named, for example, input

    2. Run Lisp

    3. Load /projects/snwiz/bin/sneps

    4. Evaluate (snepslog)

    5. Enter
      demo "input"
      or
      demo "input" av      to have SNePSLOG pause after every input.

  2. The current version of SNePS cannot backchain through an explicit negation. Notice the following does not work:
    : clearkb
    Knowledge Base Cleared
    
    : all(x)(~predator(x) => prey(x))
      all(X)((~PREDATOR(X)) => PREY(X))  
    
    : all(x)(andor(1,1){eatsgrass(x), predator(x)})
      all(X)(andor(1,1){PREDATOR(X),EATSGRASS(X)})  
    
    : eatsgrass(deer)
      EATSGRASS(DEER)  
    
    : prey(deer)?
    
    I wonder if  PREY(DEER)  
    holds within the BS defined by context DEFAULT-DEFAULTCT 
    
    I wonder if  ~PREDATOR(DEER)  
    holds within the BS defined by context DEFAULT-DEFAULTCT 
    : 
    

    So, instead, we have to introduce a negated-predicate, and say that one and only one of them can be asserted:

    : clearkb
    Knowledge Base Cleared
    
    : all(x)(notpredator(x) => prey(x))
      all(X)(NOTPREDATOR(X) => PREY(X))  
    
    : all(x)(andor(1,1){eatsgrass(x), predator(x)})
      all(X)(andor(1,1){PREDATOR(X),EATSGRASS(X)})  
    
    : all(x)(andor(1,1){notpredator(x), predator(x)})
      all(X)(andor(1,1){PREDATOR(X),NOTPREDATOR(X)})  
    
    : eatsgrass(deer)
      EATSGRASS(DEER)  
    
    : prey(deer)?
    
    I wonder if  PREY(DEER)  
    holds within the BS defined by context DEFAULT-DEFAULTCT 
    
    I wonder if  NOTPREDATOR(DEER)  
    holds within the BS defined by context DEFAULT-DEFAULTCT 
    
    I wonder if  PREDATOR(DEER)  
    holds within the BS defined by context DEFAULT-DEFAULTCT 
    
    I wonder if  EATSGRASS(DEER)  
    holds within the BS defined by context DEFAULT-DEFAULTCT 
    
    I know  EATSGRASS(DEER)  
    
    Since  all(X)(andor(1,1){PREDATOR(X),EATSGRASS(X)})  
    and  EATSGRASS(DEER)  
    I infer it is not the case that  PREDATOR(DEER)  
    
    Since  all(X)(andor(1,1){PREDATOR(X),NOTPREDATOR(X)})  
    and it is not the case that  PREDATOR(DEER)  
    I infer  NOTPREDATOR(DEER)  
    
    Since  all(X)(NOTPREDATOR(X) => PREY(X))  
    and  NOTPREDATOR(DEER)  
    I infer  PREY(DEER)  
    
      PREY(DEER)  
    
    : 
    

  3. Include your run in the paper you hand in. Also discuss syntax, semantics, etc. Make sure this paper is formatted nicely so it is easy to read.


Stuart C. Shapiro <shapiro@cse.buffalo.edu>