Combinatorics Puzzle – Enigma of Wizards, Dwarves, and Hats

combinatoricspuzzle

I've got quite a hard enigma that require extensive knowledge in mathematics, and I thought some might appreciate it.

An evil sorcerer holds in prison an infinite number of dwarves (countably infinite). He gathers them and tells them :
Tomorrow, I will align you so that the first of you will see all the other dwarves. The second one will see all of them but the first, etc…
Then, I will put a hat on each of your heads, black or white. No one can see his own hat, or the hat of those before him. But each dwarf can see the hats of those after him (they've got a good eyesight). And then, beginning with the first dwarf, I will ask each of you to tell me exactly one word, "Black" or "White". But you will have to whisper it in my ear, so that no one else can hear it.
Then, when it's done (the sorcerer is quite fast) I'll release the dwarves who rightly guess the color of their hat and keep the rest imprisonned.

The dwarves gather after the meeting, and they find a strategy so that only a finite number stay imprisonned. What did they decide?

P.S : There is no trick. There is no information given from one dwarf to the other when they say "Black" or "White" to the sorcerer. They don't grunt or wait a certain time. The dwarves can't escape or do anything fishy.

However, the math involve some… ambiguous math =)

Best Answer

Spoiler warning: This is a fun puzzle -- solution follows; don't read on if you want to try it yourself :-)

The dwarves, being rather pensive types, reflect deeply upon their predicament. Having been imprisoned for a long (infinite?) time, they realize that they can only liberate themselves externally if they first liberate themselves internally. They mustn't let their long captivity rob them of their inner freedom. Despite having been incarcerated for as long as they can remember, they realize that they can only escape if they truly believe that they have a choice. And so they embrace the axiom of choice.

Using the axiom of choice, they choose (beforehand) one representative from each class of (countably) infinite binary sequences under the equivalence relation that relates all sequences that differ only in finitely many places. Then each dwarf determines the equivalence class of the actual hat assignment and guesses that s/he is wearing the hat specified by the representative chosen for that class.

Related Question