% problem-set/puzzles/miscell/barber.ver1.in
% created :
% revised : 07/05/88 

% description:
%
% This run solves "The Barber Puzzle" using UR-resolution.
%
%                   The Barber Puzzle
%
% 	There is a barbers' club that obeys the following three conditions:
%	(1) If any member has shaved any other member -- whether himself or
%       another -- then all members have shaved him, though not necess-
%		arily at the same time.
%	(2) Four of the members are named Guido, Lorenzo, Petrucio, and 
%		Cesare.
%	(3) Guido has shaved Cesare.
%	Has Petrucio shaved Lorenzo or not?

% representation:
%
% Non-procedural version
% PREDICATES: MEMBER(x) : x is a member of the barbers club .
%    SHAVED(x,y) : x has shaved y .

set(UR_res).


list(axioms).

-MEMBER(x) |-MEMBER(y) | -SHAVED(x,y) | SHAVED(members,x).
-SHAVED(members,x) | -MEMBER(y) | SHAVED(y,x).
-SHAVED(Petruchio,Lorenzo) | ANSWER(Yes) .

end_of_list.


list(sos).

MEMBER(Guido).
MEMBER(Lorenzo).
MEMBER(Petruchio).
MEMBER(Cesare).
SHAVED(Guido,Cesare).

end_of_list.
