home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / prolog / library / prolo_c / exampl04.pro < prev    next >
Text File  |  1986-10-06  |  842b  |  35 lines

  1. /* Program 4 */
  2. /*
  3.   Read page 26 very carefully. This is an important
  4.   part of the tutor. Note, that to test that
  5.   male(X) is not(smoker(X)) the value of X must
  6.   be bound before Prolog can tell that smoker(X)
  7.   is not a smoker. This means that you can not
  8.   write:  sophie_could_date(X) if
  9.           not(smoker(X)) and male(X).
  10. */
  11.  
  12. domains
  13.     person = symbol
  14.  
  15. predicates
  16.     male(person)
  17.     smoker(person)
  18.     vegetarian(person)
  19.     sophie_could_date(person)
  20.  
  21. goal
  22.     sophie_could_date(X) and
  23.     write("a possible date for sophie is ",X) and nl.
  24.  
  25. clauses
  26.     male(joshua).
  27.     male(bill).
  28.     male(tom).
  29.     smoker(guiseppe).
  30.     smoker(tom).
  31.     vegetarian(joshua).
  32.     vegetarian(tom).
  33.     sophie_could_date(X) if male(X) and not(smoker(X)).
  34.     sophie_could_date(X) if male(X) and vegetarian(X).
  35.