[net.lang.prolog] Puzzle Solution { Liar - Truthteller }

Risch@SRI-AI@sri-unix.UUCP (08/02/83)

From:  Tore Risch <Risch@SRI-AI>

% My solution uses the standard Prolog interpreter by adding minimal
% information for such goals wich cannot be proved by the standard
% interpreter. ( Since Prolog a.o. cannot distinguish between 'not
% provable' and 'false' ) One extra predicate is needed ( see below ).
% This predicate is deduced from the fact that noone can be both
% a truthteller and a liar at the same time.
% To avoid looping the extra predicate replaces some other predicates.

notp(says(X,l(X))).           % This is the extra predicate.
notp(Y):- p(says(X,Y)),p(l(X)).
p(says(b,says(a,l(a)))).
p(says(c,l(b))).
p(l(X)):- p(says(X,Y)),notp(Y).
p(t(X)):- p(says(X,Y)),p(Y).
% p(Y):-p(says(X,Y)),p(t(X)).  % Removed