% problem-set/puzzles/truth_lies/tandl31.ver1.in % created : 09/03/86 % revised : 07/14/88 % description: % % This run solves "Truthtellers and Liars Puzzle #31" using hyper- % resolution. % % Truthtellers and Liars Puzzle #31 % % There is an island with exactly two types of people--truthtellers who % always tell the truth and liars who always lie. % There are a group of three people, A, B, and C on the island. % A and B make the following statements. A: All of us are liars; B: % Exactly one of us is a truthteller. What are A, B, and C ? % representation: % % declare_predicate(1,P). % declare_predicate(3,PER). % declare_functions(1,[atr,liar]). % declare_function(2,asaid). % declare_variables([x,y,z]). % declare_constants([a,b,c,oneofus,allofus]). % % Meanings of significant predicates and functions % P(x) means "x is true" % PER(x,y,z) means x,y, and z are persons under consideration % in this puzzle . % Said(x,y) means "x made the statement y " % atr(x) means "x is a truthteller" % liar(x) means "x is a liar" set(hyper_res). list(axioms). % x is either a truthteller or a liar P(atr(x)) | P(liar(x)). % If x is a truthteller, he cannot be a liar -P(atr(x)) | -P(liar(x)). % If x is a truthteller and he says that one of us is a truthteller % then obviously, he is the only one % it it important to define the meaning of "exactly one of us" % The following clauses define this term and the negation of the same -P(Said(x,oneofus)) |-PER(x,y,z) |-P(atr(x))| -P(atr(y)) | -P(atr(z)) . -P(oneofus) |-PER(x,y,z) |P(atr(x))| P(atr(y)) | P(atr(z)) . -P(oneofus) |-PER(x,y,z) |-P(atr(y))| -P(atr(x)) | -P(atr(z)) . -P(oneofus) |-PER(x,y,z) |-P(liar(x)) |-P(atr(y)) | P(liar(z)). P(oneofus) |-PER(x,y,z) |-P(liar(x)) |-P(atr(y)) | P(atr(z)). P(oneofus) |-PER(x,y,z) |-P(liar(x)) |-P(liar(y)) | P(liar(z)). % If x says that 'all of us' are liars then, all the persons. % indicated by PER may be liars. -P(Said(x,allofus)) |-PER(x,y,z) |-P(atr(x)). P(allofus) | -PER(x,y,z) | P(atr(x)) | P(atr(y)) |P(atr(z)). % A truthteller always says the truth. -P(atr(x)) | -P(Said(x,y)) | P(y). -P(y) |-P(Said(x,y)) |P(atr(x)). % A liar always lies. -P(liar(x)) | -P(Said(x,y)) | -P(y). P(y) |-P(Said(x,y)) | P(liar(x)). end_of_list. list(sos). PER(b,c,a). PER(a,c,b). PER(c,b,a). P(Said(a,allofus)). P(Said(b,oneofus)). end_of_list.