home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / prolog / library / prolo_c / exampl01.pro next >
Text File  |  1986-10-06  |  1KB  |  37 lines

  1. /* Program 1 */
  2. /*
  3.    Enter the goal on page 18 of the manual.
  4.    Some valuable notes are at the bottom
  5.    of this program.
  6. */
  7.  
  8. domains
  9.     person, activity = symbol
  10.  
  11. predicates
  12.     likes(person,activity)
  13.  
  14. clauses
  15.     likes(ellen,tennis).
  16.     likes(john,football).
  17.     likes(tom,baseball).
  18.     likes(eric,swimming).
  19.     likes(mark,tennis).
  20.     likes(bill,X_var) if likes(tom,X_var).
  21.  
  22. /* Note that the first letter of a variable is
  23.    capitalized.
  24.  
  25.   Turbo Prolog returns NO SOLUTION when an
  26.   attempt to bind a variable fails. Prolog
  27.   searches for all bindings which satisfy the
  28.   goal. Each set of bindings that satisfies the
  29.   goal constitutes a solution. If there are no
  30.   variables, Turbo Prolog does not search for
  31.   all solutions, it looks for the first fact or
  32.   rule which matches the goal, and thereby
  33.   proves it true. Turbo Prolog returns TRUE if
  34.   there is a fact or rule that matches. If no
  35.   match is found, the fact cannot be proven and
  36.   Turbo Prolog returns FALSE.
  37. */