Hacker News new | past | comments | ask | show | jobs | submit login

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.




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.


If set of his hats is the empty set then it contains no hat which is not green, which would make his statement true. As siblings have said, this is a “vacuous truth” in formal logic.

Edit to add: if you find this problematic consider that the statement “All my hats are green” in formal logic is identically equivalent to

For all hats h in my hats, h is green.

So for this statement to be false there needs to be a hat in the set “my hats” which does not have the property that it is green. If “my hats” is empty or indeed if somehow contrary to the rules of the game “my hats” only contains things which are not hats or all the hats it contains are green then the statement is true.

Since the speaker is a liar the statement cannot be true. Therefore there is at least one hat in “my hats” which does not have the property that it is green.

The maths students will be learning this in the context of negation and will have learned that the negation of a universal (“for all”) statement in predicate logic is an existential (“there exists”) statement. Since we have a liar we have to negate what the liar says so since the liar says

“For all hats h in my hats, h is green.”

We negate this and deduce

“There exists at least one hat h in my hats such that h is not green.”

In the context of old-fashioned predicate logic this is not ambiguous.


If you add "using old-fashioned predicate logic" or "using classical logic" to the question, I agree with you. Vacuous truth is generally useful, but it's still an arbitrary choice. It's not a thing you can test like gravity.

This is why the problem statement bothers me. If you're going to contrive a puzzle out of pure logic, you had better constrain the world (ie, what logic system the "liar" uses). It's like formulating a geometry problem (behavior of parallel lines, sum of angles of a triangle, etc) and just assuming Euclidian space.


Is there not a convention within formal logic defining this type of statement to be true or false?


There is, it's the "Vacuous Truth", generally any affirmation about elements of the empty set is true. It's very useful as it allows you to convert any statement "All elements of x are Y" in "No element in x is Not Y".


There is.

  [].all(x => whatever(x)) == true
At least that's how math usually thinks about it.


> 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.


If you want to allow undefined statements that’s actually fine from an inferential point of view even though in predicate logic statements are always either true or false.

He’s a liar so his statement has to be specifically false.




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

Search: