home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l217 / 2.ddi / EXAMPLES / CH05EX05.PRO < prev    next >
Encoding:
Prolog Source  |  1990-03-26  |  584 b   |  32 lines

  1. /*
  2.    Copyright (c) 1986, 90 by Prolog Development Center
  3. */
  4.    
  5. predicates
  6.    type(symbol, symbol)
  7.    is_a(symbol, symbol)
  8.    lives(symbol, symbol)
  9.    can_swim(symbol)
  10.  
  11. goal
  12.    can_swim(What) ,
  13.    write("A ", What, " can swim.").
  14.  
  15. clauses
  16.    type(ungulate, animal).
  17.    type(fish, animal).
  18.  
  19.    is_a(zebra, ungulate).
  20.    is_a(herring, fish).
  21.    is_a(shark, fish).
  22.  
  23.    lives(zebra, on_land).
  24.    lives(frog, on_land).
  25.    lives(frog, in_water).
  26.    lives(shark, in_water).
  27.  
  28.    can_swim(Y) :- 
  29.     type(X, animal) ,
  30.     is_a(Y, X) ,
  31.     lives(Y, in_water). 
  32.