The answer is the next:
We outline the notion of a category of infinite sequence of hats. All sequences on this class differ from one another by solely a finite variety of parts. There are an infinite variety of lessons, every containing a infinite variety of parts.
Why? As variations between lessons are of infinite size, there may be an infinite quantity of attainable distances, which implies there may be an infinite quantity of lessons.
For every such class we choose a “consultant” which is a single ingredient of the category (a single infinite sequence of hats). So suppose we now have the category “infinitely alternating purple and blue, with a finite variety of nonalternating hats within the first 20 parts”. We will set the consultant to be:
EDIT: Apparently, after digging a bit, a great way to outline the lessons is:
Two sequences are equal if they’re an identical after a finite variety of gadgets
Selection of a consultant may be simply outlined as selecting the sequence the place the variations seem firstly of the sequence and are lexicographically smaller.
For instance, the sequence
rbrbrbrbrbrb...
And, the sequence:
r[r]rb[br]rbrbrb... ([] denotes mismatches)
is a member of that class. Every dwarf can see the infinite sequence of hats in entrance of it and may acknowledge the category. The dwarves can see the mismatches in entrance of them, however have no idea if their very own hat will not be a mismatch.
However, the distinction is finite, and a modification of the usual guidelines for guessing a finite sequence may be utilized. The primary dwarf says “purple” if there may be an odd variety of hats which can be totally different within the “sequence”, in comparison with the “consultant” (or “blue” if the mismatches are even). From there on, every dwarf has adequate information to inform the color of their hat.
Word that, the variety of lessons is infinite, nevertheless, since we’re speaking about infinite dwarves, I assume that is acceptable.
Lastly, because the first dwarf “guesses”, the primary dwarf has a 50% probability of survival, all different dwarves survive.
Oh, and due to the infinite variety of lessons, this may be straight utilized to the issue with an infinite variety of colors.
Abstract for the naysayers

Two sequences are equal if they’re an identical after a finite variety of gadgets.

Selection of a consultant may be simply outlined as selecting the sequence the place the variations seem firstly of the sequence and are lexicographically smaller.

Because the sequence is infinite, and variations are finite, there exists an infinite subsequence, that may uniquely outline the category of the sequence.