Problem. On an island live perfect logicians; of them have blue eyes, the rest brown. Nobody knows their own eye colour, there are no mirrors and no talking about eyes; anyone who learns their own colour must leave at midnight, and everyone sees who left. One day a visitor announces publicly: “at least one of you has blue eyes”. What happens?
Answer. Nothing for nights; on night all blue-eyed islanders leave. (If everyone also knows that only blue and brown exist, the brown-eyed leave on night .) For the visitor told everyone something they already knew; what changed is that it became common knowledge.
Muddy children is the same puzzle: of children have mud on their foreheads, the father says “at least one of you is muddy” and asks repeatedly “do you know whether you are muddy?”; the muddy children answer “yes” in round .
| Notion | Meaning | With blue-eyed islanders before the announcement |
|---|---|---|
| ”someone has blue eyes” | true | |
| (mutual knowledge) | everyone knows | true iff |
| everyone knows that everyone knows … ( times) | true iff | |
| (common knowledge) | for every | false; the announcement makes it true |
The code below models knowledge explicitly with possible worlds (Kripke semantics): a world is a bitmask of eye colours, islander cannot distinguish from , and public events delete worlds.
// eyes[i] = 1 blue, 0 brown; only these two colours exist (common knowledge). After "someone is blue",
// every islander who knows their colour leaves that night; departures are public. Returns each one's night (0 = stays).
vector<int> leaveNights(const vector<int>& eyes) {
int n = sz(eyes), W = 1 << n, actual = 0;
for (int i = 0; i < n; i++) actual |= eyes[i] << i;
vector<char> possible(W, 1); possible[0] = 0; // the announcement deletes the all-brown world
vector<vector<int>> hist(W); // public departure history if w were the real world
vector<int> gone(W, 0), night(n, 0);
for (int d = 1; d <= n + 1; d++) {
vector<int> leave(W, 0);
for (int w = 0; w < W; w++) if (possible[w])
for (int i = 0; i < n; i++) if (!(gone[w] >> i & 1)) {
int v = w ^ 1 << i; // the only world islander i cannot rule out by sight
if (!possible[v] || hist[v] != hist[w]) leave[w] |= 1 << i; // v is excluded: i knows
}
for (int w = 0; w < W; w++) if (possible[w]) hist[w].push_back(leave[w]), gone[w] |= leave[w];
for (int i = 0; i < n; i++) if (leave[actual] >> i & 1) night[i] = d;
}
return night;
}Proof: the blue-eyed leave on night k
Work in the possible-worlds model of the code: islander in world knows their colour on night iff the alternative was deleted by the announcement or had a different departure history on nights .
(P) Nobody leaves early. For every : in every world with at least blue-eyed islanders, nobody leaves on nights . Induction on ; is empty. Let have blue and fix islander . The alternative has blue, so it is not the deleted all-brown world, and by the hypothesis for nobody leaves on nights in or in . The histories agree, so on night islander cannot rule out and stays.
(Q) The blue-eyed leave on night . Induction on the number of blue-eyed. By (P) nobody leaves on nights . A blue islander considers with brown, which has blue: if , is the deleted world; otherwise, by (Q) for , the blue-eyed of leave on night , whereas in nobody did. Either way knows on night . A brown islander considers a world with blue, where by (P) nobody leaves on nights ; its history up to night equals that of , so they stay on night .
Brown on night (two-colour knowledge): the brown islander’s alternative has blue and, by (P), no departure on night , but in the blue-eyed left on night . The histories differ, so they know their colour is not blue, hence brown. Without the two-colour assumption they only learn “not blue” and stay forever.
The function checks this world by world: verified for every eye assignment with (blue leave on night , brown on night , nobody earlier).
Proof: before the announcement, E^(k-1) holds but E^k does not
In the possible-worlds model, holds at iff holds at every world reachable from by steps, where a step from goes to for some islander (what considers possible). Each step changes one bit, so after steps from a world with blue there are at least blue; for at least one remains, so holds. For , let the blue-eyed flip their own bits one after another: the chain reaches the all-brown world, where is false; so fails. The announcement deletes the all-brown world from the model, which is exactly what makes (and ) true, and exactly what the induction above uses at its base.
Related notes
- Proof Techniques (induction)
- Prisoners and Hats
- Sum and Product Puzzle (another knowledge puzzle)