## TPTP Problem File: PUZ035-2.p

View Solutions - Solve Problem

%--------------------------------------------------------------------------
% File     : PUZ035-2 : TPTP v8.1.0. Released v2.0.0.
% Domain   : Puzzles
% Problem  : Knights and Knaves #36
% Version  : [Sto95] axioms : Augmented.
% English  : On an island, there live exactly two types of people: knights
%            and knaves. Knights always tell the truth and knaves always
%            lie. I landed on the island, met two inhabitants, asked one of
%            them: "Is one of you a knight?" and he answered me. What can
%            be said about the types of the asked and the other person
%            depending on the answer I get?

% Refs     : [Smu78] Smullyan (1978), What is the Name of This Book? The Ri
%          : [Sto95] Stolzenburg (1995), Email to Geoff Sutcliffe.
%          : [BFS97] Baumgartner et al. (1997), Computing Answers with Mode
% Source   : [Sto95]
% Names    :

% Status   : Unsatisfiable
% Rating   : 0.00 v2.1.0
% Syntax   : Number of clauses     :   16 (   2 unt;   6 nHn;  16 RR)
%            Number of literals    :   42 (   0 equ;  24 neg)
%            Maximal clause size   :    4 (   2 avg)
%            Maximal term depth    :    1 (   1 avg)
%            Number of predicates  :    5 (   5 usr;   0 prp; 1-2 aty)
%            Number of functors    :    6 (   6 usr;   6 con; 0-0 aty)
%            Number of variables   :   12 (   6 sgn)
% SPC      : CNF_UNS_EPR_NEQ_NHN

% Comments : Contains one redundant clause. The query allows for
%            disjunctive answer A/X/Y = no/knave/knight;yes/knave/knave;
%            yes/knight/knave;yes/knight/knight
%--------------------------------------------------------------------------
%----Everyone's either a knight or a knave
cnf(everyone_a_knight_or_knave,axiom,
( ~ person(X)
| isa(X,knight)
| isa(X,knave) ) ).

cnf(not_both_a_knight_and_knave,axiom,
( ~ isa(X,knight)
| ~ isa(X,knave) ) ).

cnf(knights_make_true_statements,axiom,
( ~ isa(X,knight)
| tell_the_truth(X) ) ).

cnf(knaves_make_false_statements,axiom,
( ~ isa(X,knave)
| lies(X) ) ).

cnf(statements_are_true_or_false,axiom,
( ~ tell_the_truth(X)
| ~ lies(X) ) ).

%----This is redundant
cnf(statements_are_true_or_false2,axiom,
( ~ person(X)
| tell_the_truth(X)
| lies(X) ) ).

cnf(true_one_is_a_knight,axiom,
| isa(other,knight)
| ~ response(yes)

cnf(lie_one_is_a_knight,axiom,
| isa(other,knight)
| ~ response(no)

( ~ response(yes)
| ~ isa(Anyone,knight) ) ).

( ~ response(no)
| ~ isa(Anyone,knight) ) ).

( response(yes)
| ~ isa(Anyone,knight) ) ).

( response(no)
| isa(other,knight)

( response(yes)
| response(no) ) ).

%----Two people