Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah, I haven't quite got the hang of it myself. The encoding of formal logic in English sentences is fraught with ambiguity until you grok the specific style used.

Here's an example (SPOILER ALERT: with solution) of what I mean. The English version is just a verbose translation of a simple Boolean table.

    ==================================
    Black-Hat Chuck
    ==================================

    :date: 2014-02-01 10:56
    :summary: A solution to the Three Hats puzzle.

    I recently ran across a `cool puzzle site`_. Here is one of the puzzles
    and a solution:


        There are 3 black hats and 2 white hats in a box. Three men (we will
        call them A, B, & C) each reach into the box and place one of the
        hats on his own head. They cannot see what color hat they have
        chosen. The men are situated in a way that A can see the hats on B &
        C's heads, B can only see the hat on C's head and C cannot see any
        hats. When A is asked if he knows the color of the hat he is wearing,
        he says no. When B is asked if he knows the color of the hat he is
        wearing he says no. When C is asked if he knows the color of the hat
        he is wearing he says yes and he is correct. What color hat and how
        can this be?


    .. class:: attribution caption

    ~ `Three Hats`_


    Solution
    ------------

    I'm going to call the three men Alan, Bob, and Chuck.

    First, let's imagine what Alan might be able to see. There are four
    possibilities.


    ===========  =============
     Bob's Hat    Chuck's Hat
    ===========  =============
     White        White
     Black        White
     White        Black
     Black        Black
    ===========  =============

    Since there are only two white hats, if Alan sees that both Bob's and
    Chuck's hats are white his own hat would have to be black.  In other
    words, by admitting that he can't tell which hat he is wearing Alan is
    saying that either or both of Bob's and Chuck's hats are black.  If we
    eliminate the case of both hats being white we are left with three
    possibilities.

    ===========  =============
     Bob's Hat    Chuck's Hat
    ===========  =============
     Black        White
     White        Black
     Black        Black
    ===========  =============

    From this it should be easy to see that if Bob sees that Chuck's hat is
    white his own hat would have to be black.  Bob would be uncertain of the
    color of his own hat only if Chuck's hat is black.  So Chuck, being no
    dummy, can conclude that his own hat is black.

    It's an elegant puzzle with a very simple and satisfying solution.


    .. _cool puzzle site: http://wuriddles.com/

    .. _Three Hats: http://wuriddles.com/easy.shtml#3hats


Here's a nice variation to the problem, and the solution: https://www.youtube.com/watch?v=N5vJSNXPEwA




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: