Live data from Hacker News

A liar who always lies says "All my hats are green."

theguardian.com

91–100 of 419 posts

Re: A liar who always lies says "All my hats are green."

#91
post #83

Earlier quoted context omitted.

I learned about Vacuous Truth the hard way recently when I found out that `every` method in JavaScript returns `true` for empty arrays as well.

But if you consider “liar” to be an object, > liar.hats.every((hat) => hat.color === "green") will throw a TypeError: Cannot read properties of undefined. That’s definitely not `true`.

[deleted]

Re: A liar who always lies says "All my hats are green."

#92
post #83

Earlier quoted context omitted.

I learned about Vacuous Truth the hard way recently when I found out that `every` method in JavaScript returns `true` for empty arrays as well.

But if you consider “liar” to be an object, > liar.hats.every((hat) => hat.color === "green") will throw a TypeError: Cannot read properties of undefined. That’s definitely not `true`.

You implemented the problem wrong, and thus got an error. If hats is a list of colors, then every hat != green is true if the list is empty.

Re: A liar who always lies says "All my hats are green."

#93

Earlier quoted context omitted.

Speaking mathematically , you are right. However, linguistically I disagree. Consider: Someone tells you that "all of their kids are doing great in school". Turns out they have no kids. They obviously were trying to deceive you, and make you think they do have kids - in fact, since plural, more than one kid. Hence, it is effectively a lie. So if the liar speaks of "all my hats" while having none, that is deceptive. I…

And that's why SO gets mad when I come home with six cartons of milk[1]. [1]: https://blog.bryanbibat.net/2013/01/02/programming-joke/

The joke, loosely, is :

A wife asks her programmer husband” on your way home, can you swing by the store and buy one carton of milk, and if they have eggs, get six?”

It’s funnier and more relatable to programming if he comes home empty handed, crashes the car into the garage door, and says, with perfect alacrity, “six what?”

Re: A liar who always lies says "All my hats are green."

#94
post #3
post #2

My take (possible spoiler): If he had no hats, then his statement would technically be true. Therefore he has at least one hat. He may have some green hats and some non-green hats, but must have at least one non-green hat. He could have any number of green hats, including zero, as long as he has at least one non-green hat. So the only derived statement that we can conclude to be true is A.

Yeah, I'm a bit confused there is no option "he has at least one non-green hat", which is what I would answer. Perhaps that means I'm wrong.

"Which, if any, of the following statements can we conclude from what the liar has said?"

Re: A liar who always lies says "All my hats are green."

#95
SPOILER

The statement translates to:

   ∀x  ( IsAHatOfMine(x) => Green(x))
That's just equivalent to

   ∀x  (~IsAHatOfMine(x) ∨  Green(x))
by the definition of implication (it's only false if the antecedent is true, and the conclusion false).

The negation of that is (by repeated application of De Morgan's):

  ~∀x  (~IsAHatOfMine(x) ∨  Green(x))
   ∃x ~(~IsAHatOfMine(x) ∨  Green(x))
   ∃x    IsAHatOfMine(x) ∧ ~Green(x))
Thus, the liar has at least one hat, that, furthermore, is not green, so A) [EDIT: but not D - I misread it].

In ordinary English, the meaning of the original phrase, thus the answer to the puzzle, is different.

Re: A liar who always lies says "All my hats are green."

#96
post #82

Earlier quoted context omitted.

One of the points of this puzzle is to see beyond your social intuition. So yes, this puzzle plays on being able to figure out the logic while it goes against common social intuition.

Fascinating. I think many people here have applied their own social intuition- - a programmer’s idea of an empty sets- to the puzzle.

True, but "programmer's intuition" is because most programming languages are more or less based on formal logic so they agree with the formal logic interpretation even if many programmers have never studied formal logic.

Re: A liar who always lies says "All my hats are green."

#97
post #30
post #6

Earlier quoted context omitted.

No, the liar having no hats would not make the statement true. ‘All my hats implies’ implies the liar stating they have hats. The liar either has zero hats or some amount of hats. The only thing we know for certain is that if they do have hats, there is at least one non Green hat.

No. In formal logic, if you have no hats, it is true that all your hats are green. You can claim anything about those hats, it is even true that each one of those hats is the same size as the universe, or that they are all completely green and completely red at the same time. In normal language, this would be different, but that is not the context here. > Note: this question was originally set in a maths exam, so the…

> In formal logic, if you have no hats, it is true that all your hats are green.

But told by someone who cannot make a true statement.

Re: A liar who always lies says "All my hats are green."

#98
post #20

The puzzle is referring to the concept of a vacuous truth ( https://en.wikipedia.org/wiki/Vacuous_truth ). In most logic frameworks, the All function (upside down A in standard logic notation) is true if and only if no statement within the set is false (i.e. All his hats are green if he has no hats). This is for several reasons: - it allows for more coherent empty set functions. For example if we take the power set o…

I learned about Vacuous Truth the hard way recently when I found out that `every` method in JavaScript returns `true` for empty arrays as well.

This is even what I expected, but I majored in math, so maybe that biased my response.

Re: A liar who always lies says "All my hats are green."

#99

Earlier quoted context omitted.

I learned about Vacuous Truth the hard way recently when I found out that `every` method in JavaScript returns `true` for empty arrays as well.

In programing, you can always rewrite that first rule as "all" and "some" must compose over set union. So, "all (A ∪ B) == all A && all B", and "some (A ∪ B) == some A || some B". That lets you discover the answer for the empty set.

Which leads to a funny fact that if all elements of the set S satisfy proposition P it doesn’t necessarily imply that some elements of the set S satisfy proposition P.

Re: A liar who always lies says "All my hats are green."

#100
post #78

The phrase “All my hats are green” implicitly carries the premise “I have hats” in conversational language. Thus, if this statement were to be expressed as a logical proposition, it should be: “I have hats, and all my hats are green.” This means there are two potential falsehoods in the statement: 1. “I have hats.” 2. “All my hats are green.” Therefore, what we can deduce is: • He might not have any hats. • If he doe…

In conversational language, "All my hats..." implies that the speaker has at least two hats, which theoretically means that the sentence could be a lie from them having exactly one hat (even a green one). However, in practice, I don't think anyone would actually call that a lie. I think we treat the "I have hats" part not as part of the sentence itself, but more as an underlying premise.

You could have a similar situation in pure logic or math - if I were to say "the largest prime number is odd", is that false? Or something else entirely? (This is what Hofstadter calls mu, from a related concept in Zen.)

Post reply on HN