Two Islanders, One Accusation: Which Role Pairs Work?
Math & Bit ManipulationModel answerLast updated
One islander accuses the other of always lying. Test all four role pairings and decide which ones are logically possible.
Every inhabitant of a certain island is either a truth-teller, whose statements are always true, or a liar, whose statements are always false.
You meet two inhabitants, P and Q. Q turns to P and says: "You never tell the truth."
There are four ways the roles could be handed out:
- P is a liar, Q is a truth-teller
- P is a truth-teller, Q is a liar
- P is a liar, Q is a liar
- P is a truth-teller, Q is a truth-teller
Task: Decide which of these assignments can actually occur given Q's remark, and justify each verdict. Then say what, if anything, you can conclude for certain about P and Q, and whether the remark is enough to tell you who is who.
A good answer states the underlying rule explicitly, checks every case rather than stopping at the first one that works, and is careful not to claim more than the evidence supports.
Hints
Hint 1
Rewrite Q's sentence as a plain claim about P's type. Remember that Q is the one speaking, so Q's type decides whether that claim is true or false.
Hint 2
A speaker's claim is true exactly when the speaker is a truth-teller. Write this as a single equivalence relating Q's type and the claim about P, then test each of the four pairings against it.
Hint 3
After finding the consistent pairings, look for what they share. Ask whether the remark pins down one specific person as the truth-teller, or only describes how the two relate.
Model answer
Easy Try it yourself first — then compare your approach, complexity and edge cases.
Approach
Turn the puzzle into one precise logical constraint, then check all four assignments mechanically.
Step 1: Formalize
Let P be true if P is a truth-teller, and Q be true if Q is a truth-teller.
Q says "You never tell the truth" to P. Since every inhabitant is one of the two types, this is the claim "P is a liar", which is ¬P.
The island rule is that a statement is true exactly when its speaker is a truth-teller. So the single constraint is:
Q ⟺ ¬P
This is the same as P XOR Q: exactly one of them is a truth-teller.
Step 2: Check every assignment
| P | Q | Claim "P is a liar" is | Q's type requires it to be | Possible? |
|---|---|---|---|---|
| liar | truth-teller | true | true | Yes |
| truth-teller | liar | false | false | Yes |
| liar | liar | true | false | No |
| truth-teller | truth-teller | false | true | No |
In words:
- P liar, Q truth-teller. Q must speak truly. "P is a liar" is true, so there is no problem.
- P truth-teller, Q liar. Q must speak falsely. "P is a liar" is false, because P is honest, so there is no problem.
- Both liars. Q must speak falsely, but "P is a liar" is true. A liar has just said something true, which is a contradiction.
- Both truth-tellers. Q must speak truly, but "P is a liar" is false. A truth-teller has just said something false, which is a contradiction.
Step 3: Conclusion
- Possible: (P liar, Q truth-teller) and (P truth-teller, Q liar).
- Impossible: both liars, and both truth-tellers.
What is certain is that P and Q are of opposite types. What is not determined is which one is the truth-teller. The remark alone does not give a unique answer, and saying so is part of a complete solution.
A general shortcut: whenever one islander calls another a liar, the two must differ. If the speaker is honest, the accusation is true. If the speaker lies, the accusation is false, so the target is honest.
Verifying by brute force
For larger puzzles, enumerate all 2^n assignments and keep those where each statement's truth value equals its speaker's type.
from itertools import product
def consistent():
out = []
for p_honest, q_honest in product([True, False], repeat=2):
claim = not p_honest # Q says: "P is a liar"
if claim == q_honest: # honest speakers say true things, liars false
out.append((p_honest, q_honest))
return out
print(consistent()) # [(True, False), (False, True)]
Complexity is O(2^n * s) for n people and s statements. That is trivial here and becomes a SAT problem at scale.
Likely follow-ups
- Can one yes/no question identify the honest one? Asking "Are you honest?" fails, since everyone answers yes. Asking P "Is Q honest?" also fails: since they are opposite types, an honest P says no and a lying P also says no. A question with a known answer, such as "Is 2 + 2 = 4?", works: yes means honest, no means liar. Because the two are opposite, identifying one identifies both.
- What if P then says "We are both liars"? If P were honest, that would be false, a contradiction. So P is a liar, the statement is false, and Q must be the truth-teller. The solution becomes unique: P liar, Q truth-teller.
- What if someone says "I am a liar"? Nobody can say it. An honest speaker would be lying, and a liar would be telling the truth.
Common mistakes
- Stopping at the first consistent case. Reasoning "Q is honest, so P is a liar" and quitting misses the second valid assignment.
- Confusing speaker and subject. Q's type determines the truth value of the sentence, and the sentence is about P.
- Over-claiming. Declaring "P is the liar" is wrong. The rigorous conclusion is "exactly one is honest, and which one is undetermined."
- Overcomplicating a liar's statement. A liar's statement is simply false. Here that means P is honest. There is no need for stacked negations.
- Skipping the rule. Writing
statement true ⟺ speaker honestup front makes the case analysis mechanical.
A concise spoken answer
"Q's sentence means 'P is a liar.' A statement is true exactly when its speaker is honest, so Q is honest if and only if P is a liar. Checking the four cases: liar/honest and honest/liar both work. Both liars fails because Q would be saying something true, and both honest fails because Q would be saying something false. So they are definitely opposite types, but without more information we can't say which is which."