rec.puzzles Archive

Of a group of n men, some always lie, some never lie, and the rest sometimes lie.

logic/smullyan/liars.et.al Restored

This entry was in an earlier release of the archive and is restored here.

Problem

Of a group of n men, some always lie, some never lie, and the rest sometimes
lie.  They each know which is which.  You must determine the identity of each
man by asking the least number of yes-or-no questions.
Show solution
The real problem is to isolate the sometimes liars.

Consider the case of three men:
Ask man 1: "Does man 2 lie more than 3?"
If the answer is yes, then man 2 cannot be the sometimes liar.
Proof by analyzing the cases:
Case 1: Man 2 is not the sometimes liar.
Case 2: Man 2 is the sometimes liar, man 1 is the truth teller, and man 3 is
        the liar.  Then man 1 would not say that man 2 lies more than man 3.
Case 3: Man 2 is the sometimes liar, man 3 is the truth teller, and man 1 is
        the liar.  Then man 1 would not say that man 2 lies more than man 3.
QED.
Similarly, if the answer is no, then man 3 cannot be the sometimes liar.
Now ask the symmetric question of whichever man has been eliminated as the
sometimes liar.  The answer will now allow you to determine the identity
of the sometimes liar.  To determine the identity of the two remaining men, ask
some question like "Does 1=1?" which is always true.

This is not the only way to solve this problem.  You could have asked the
question which is always true (or false) second, which would now establish
the identity of either the liar or the truth teller.  Then ask the third
question of this man to find out which of the other two is the sometimes
liar.

This problem requires three questions, whether or not they are yes-or-no
questions.  In order to identify all three men, you must identify the
sometimes liar.  You cannot identify the sometimes liar in one question
since you may be asking it of the sometimes liar, and any answer from him
conveys no information at all.  Therefore at least two questions are
necessary to identify the sometimes liar.  Once the sometimes liar is
identified, you still need one more question at least to identify the
remaining men.  Therefore, three questions are required.

Suppose we have two truth-tellers, two liars, and two randomizers.
The answer is 8.  A proof follows.

For brevity, "T" means truth-teller, "L" liar, "R" randomizer, "P" predictable
(either T or L).  Define a _pattern_ to be one of the C(6,2)=15 permutations
of RRPPPP (each of which has C(4,2)=6 interpretations of the Ps as 2 Ts and 2
Ls).  For any question Q, let !Q denote the question "If I were to ask you Q,
would you answer Yes?".  Note that question !Q directed toward any P will
yield a truthful answer to question Q; in other words, a "Yes" answer to !Q
means that either Q is true or the respondent is an R, whereas "No" means that
either Q is false or the respondent is an R.

Ask #1, !"Are both Rs in the set {#2, #3, #4}?".  "No" implies that at most
one of {#2, #3, #4} is an R.  "Yes" implies that at most one of {#2, #5, #6}
is an R.  Without loss of generality, assume the former.

Ask #2, !"Is #3 an R?".  "No" implies that #3 is a P.  "Yes" implies that #4
is a P.

Having identified someone as a P, there are at most C(5,2)=10 possible
patterns, and hence at most 10*6=60 possible results.  We can determine which
one reflects reality with at most 6 more questions with a binary search.  (At
each step, bisect the set of possible answers, and ask the question !"Is the
correct pattern in the first subset?".)

Now, let's show that it can't be done in 7.

After asking your first two questions, renumber if necessary so that the first
question was directed to #1 and the second to #2.  (If you asked the same
person twice, you're even worse off than in the analysis below.)  You have no
way to rule out the possibility that both are Rs, so pattern RRPPPP yields 6
possibilities.  Of the four patterns RPRPPP RPPRPP RPPPRP RPPPPR, your first
question gave no information and the second had one bit; so at best you can
eliminate half of these 4*6 possibilities, leaving 12.  Similarly for the four
patterns PRRPPP PRPRPP PRPPRP PRPPPR there remain at least 12 possibilities.
Of the remaining 6 patterns PPRRPP PPRPRP PPRPPR PPPRRP PPPRPR PPPPRR, your
two bits of information can eliminate 3/4 of the 6*6, leaving 9.  Thus, after
two questions there are at least 6+12+12+9=39 arrangements that could have
given the answers you heard; your five remaining questions have only 32
possible replies, so you can't distinguish them.