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:
input
 
/projects/snwiz/bin/sneps
 
(snepslog)
 
demo "input"
or
demo "input" avto have SNePSLOG pause after every input.
: 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)  
: