logoalt Hacker News

seanhunter12/09/20243 repliesview on HN

Yes. It isn’t ambiguous and is entirely solvable using old school formal logic of the “All Cretans are liars” sort.

If the liar owns no hats the statement “All my hats are green” would be true. Under the parameters of the question it must be a lie and therefore cannot be true. So the liar owns at least one hat which is not green. They may own additional hats which can be of any colour.

People who are saying “if they are a liar they might not even be talking about hats” are somewhat missing the point:

1) Whether or not they are talking about hats they have made a statement about hats and under the “rules of the game” of formal logic it must be untrue because we are given they are a liar. That’s enough to answer the question.

2) The “rules of the game” are about predicates and properties and inference. The language is plenty precise enough to convey both the question and to deduce the solution.


Replies

stickfigure12/09/2024

I think there's a sort of divide-by-zero problem here. Does an empty set of hats have a color? You could arbitrarily define "all my hats are green" for the empty set as either true or false as part of a consistent logical system. There isn't enough information in the question to know whether we should pick one or the other, though there's probably a colloquial preference for true.

show 2 replies
oneshtein12/09/2024

> If the liar owns no hats the statement “All my hats are green” would be true.

Color of non existing object is undefined.

The correct solution is:

!(all && my && hats && are && green) == !all || !my || !hats || !are || !green.

show 1 reply