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

  1. /*
  2.    Copyright (c) 1986, 90 by Prolog Development Center
  3. */
  4.    
  5. domains
  6.    d = integer
  7.  
  8. predicates
  9.    not_(D, D)
  10.    and_(D, D, D)
  11.    or_(D, D, D)
  12.    xor(D, D, D)
  13.  
  14. clauses
  15.    not_(1, 0).       not_(0, 1).
  16.    and_(0, 0, 0).    and_(0, 1, 0).
  17.    and_(1, 0, 0).    and_(1, 1, 1).
  18.    or_(0, 0, 0).     or_(0, 1, 1).
  19.    or_(1, 0, 1).     or_(1, 1, 1).
  20.  
  21.    xor(Input1, Input2, Output) :- 
  22.       not_(Input1, N1), not_(Input2, N2),
  23.       and_(Input1, N2, N3), and_(Input2, N1, N4),
  24.       or_(N3, N4, Output).
  25.