LISP


;;; This is one of the example programs from the textbook:
;;;
;;; Artificial Intelligence: 
;;; Structures and strategies for complex problem solving
;;;
;;; by George F. Luger and William A. Stubblefield
;;; 
;;; These programs are copyrighted by Benjamin/Cummings Publishers.
;;;
;;; We offer them for use, free of charge, for educational purposes only.
;;;
;;; Disclaimer: These programs are provided with no warranty whatsoever as to
;;; their correctness, reliability, or any other property.  We have written 
;;; them for specific educational purposes, and have made no effort
;;; to produce commercial quality computer programs.  Please do not expect 
;;; more of them then we have intended.
;;;

;;; This is the "trees" knowledge base for use with the expert system 
;;; shell in section14.4 as the text.  The code for the shell is in the file
;;; expert_system_shell.

(setq *assertions* '(
   
   (rule
      if (and (size (var x) tall ) (woody (var x)))
      then (tree (var x)) .9)

   (rule
      if (and (size (var x) small ) (woody (var x)))
      then (bush (var x)) .9)

   (rule 
      if (and (tree (var x)) (evergreen (var x))(color (var x) blue))
      then (kind (var x) spruce) .8)

   (rule 
      if (and (tree (var x)) (evergreen (var x))(color (var x) green))
      then (kind (var x) pine) .9)

   (rule
      if (and (tree (var x)) (deciduous (var x)) (bears (var x) fruit))
      then (fruit-tree (var x)) 1)

   (rule 
      if (and (fruit-tree (var x)) (color fruit red) (taste fruit sweet))
      then (kind (var x) apple-tree) .9)

   (rule 
      if (and (fruit-tree (var x)) (color fruit yellow) (taste fruit sour))
      then (kind (var x) lemon-tree) .8)

   (rule 
      if (and (bush (var x)) (flowering (var x)) (thorny (var x)))
      then (rose (var x)) 1)

   (rule
      if (and (rose (var x)) (color (var x) red))
      then (kind (var x) american-beauty) 1)))

(setq *askables* '(
   (size (var x) (var y))
   (woody (var x))
   (soft (var x))
   (color (var x) (var y))
   (evergreen (var x))
   (thorny (var x))
   (deciduous (var x))
   (bears (var x) (var y))
   (taste (var x) (var y))
   (flowering (var x))))


  

Close Window