I never liked this type of puzzle. It is not formal logic but more about the idiosyncrasies and conventions of the English language. I put this puzzle on par with Agatha Christie’s murder mysteries. It requires a suspension of disbelief and logic to be believable. Someone who always lies means in the purest sense means you cannot trust anything they say. Even the word “hat” could mean they are talking about their pet…
This is generally the case for the vast majority of puzzles, and it equally drives me mad in those areas where academics set "puzzles" and conclude that people's inabilty to "solve" them is some cognitive deficiency. I've rarely encountered a case where it is isnt an extreme lack of self-awareness in the questioner -- eg., being extremely overfit to language/notation/etc. localised to their own area of expertise.
A liar who always lies says "All my hats are green."
161–170 of 419 posts
Re: A liar who always lies says "All my hats are green."
#162Earlier quoted context omitted.
Puzzles like this are to make more people interested in formal logic. The "gateway drug" of formal logic. Just like the barber paradox isn't literally Russell's paradox, but it made more people to look up the history of it and perhaps learned what Russell's paradox is. Hopefully 0.1% of them turn out to be mathematicians.
Why not hopefully more? Less? Is mathematics this inaccessible to the other 99.9%?
Some is good, but more isn’t necessarily better.
Re: A liar who always lies says "All my hats are green."
#163I never liked this type of puzzle. It is not formal logic but more about the idiosyncrasies and conventions of the English language. I put this puzzle on par with Agatha Christie’s murder mysteries. It requires a suspension of disbelief and logic to be believable. Someone who always lies means in the purest sense means you cannot trust anything they say. Even the word “hat” could mean they are talking about their pet…
the one I hate the most is the Monty Hall Problem.
Re: A liar who always lies says "All my hats are green."
#164things.every(thing => thing.type == 'hat' && thing.color == 'green') now negating this gives: things.some(things => thing.type != 'hat' || thing.color != 'green') So liar has something that is not a hat OR has something that is not green So only "E) The liar has no green hats" is true
The statement "All my hats are green" would map to
things.every(thing => thing.type != 'hat' || thing.color == 'green')
i.e., everything the person owns must either be green or, if it isn't green, it must not be a hat since all hats are green.The negated form would then be
things.some(thing => thing.type == 'hat' && thing.color != 'green')
i.e., there are some hats that are not green.Re: A liar who always lies says "All my hats are green."
#165SPOILER 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 a…
Wait a second. If the liar says, "All ten-foot tall men have brown hair," we cannot conclude that there must exist a ten-foot tall man. EDIT: I'll clarify to say I wasn't taking issue with the derivation , but rather with the translation of the English statement into first-order predicate logic. No non-logician would conclude that there must be a ten-foot tall man if "All ten-foot-tall men have brown hair" is false.…
Re: A liar who always lies says "All my hats are green."
#166Earlier quoted context omitted.
This is generally the case for the vast majority of puzzles, and it equally drives me mad in those areas where academics set "puzzles" and conclude that people's inabilty to "solve" them is some cognitive deficiency. I've rarely encountered a case where it is isnt an extreme lack of self-awareness in the questioner -- eg., being extremely overfit to language/notation/etc. localised to their own area of expertise.
Logic itself is a relatively new invention, and is symbolic itself. That is to say, logic is a map not the territory. That said, if someone can't fathom the most widely used symbolic languages humans use (math, logic, language, etc) they probably do have a cognitive deficit of some sort when compared to those who can.
- the local Russell hater
Re: A liar who always lies says "All my hats are green."
#167One complication is that in typical English, if you say "All my hats....", you are simultaneously making an existence statement that you have at least one hat... but the usual formal logic "forall" quantifier does NOT presume existence. Here's a formal proof that "forall" has a "surprise" meaning for those not well-versed in formal logic: https://us.metamath.org/mpeuni/alimp-surprise.html I propose that when translat…
It does not. All my unicorns fly. There is no assumption that I have a unicorn. There is an assumption, based on the claim but it is not a fact.
The puzzle also assumes that "my" implies there is some ownership (we'll take for granted "my" means "has" for simplicity), which is another quibble that unravels the whole thing.
E is correct. I don't see how A comes to be the accepted answer.
Re: A liar who always lies says "All my hats are green."
#168I never liked this type of puzzle. It is not formal logic but more about the idiosyncrasies and conventions of the English language. I put this puzzle on par with Agatha Christie’s murder mysteries. It requires a suspension of disbelief and logic to be believable. Someone who always lies means in the purest sense means you cannot trust anything they say. Even the word “hat” could mean they are talking about their pet…
That's the reason natural languages are not very well suited to formal logic, and one of the reasons programmers use programming languages. If we reframe it using C++ "std::all_of" function over an array of strings called "hats", and say that the following must be false (because he is a liar): std::all_of(hats.begin(), hats.end(), [](std::string hat) { return hat == "green"; }) Then we can answer the questions withou…
[1] https://www.boost.org/sgi/stl/MonoidOperation.html
[2] note: Monoid, not Monad, and yes, category theory left its mark in C++ as well.
Re: A liar who always lies says "All my hats are green."
#169Earlier quoted context omitted.
Uninitialized variables are 90% of our bugs, or so I've been told. I don't consider a boolean "and" or "or" of a list of bools to be automatically true or false of an empty set, my friend. To me, the specific case for a boolean function applied to an empty list of bools would have to be explicitly stated in the design. Thanks for explaining how mathematicians and logicians treat the empty set. I have more pragmatic s…
Consider iterative code to sum a collection of ints: sum = 0 for value in collection: sum += value return sum For every non-empty collection this returns the correct result, and for the empty collection it returns 0. Now the product: product = 1 for value in collection: product *= value return product For every non-empty collection this returns the correct result, and for the empty collection it returns 1. Now the AN…
What I'm saying is that you always need to specify that default value to handle the empty set properly. In no way would I consider ANDing or ORing an empty set's boolean values to be automatically True or False, (no pun intended). You have chosen to specify them, and in real world programming, not having any elements of that specific set's specific kinds of values could well mean that the default results could be any combination of False and True, (NPI, again).
And, yes, I understand that you must initialize the temporary processing value (that you then return) to True and False in order to properly AND and OR the set's values, but that is different from the semantics of the set's cardinality.
I programmed professionally in C# (with the help of F# for its fsi.exe command-line utility) for a number of years, so I am well aware of how fold et al work. They were a very useful aspect to functional programming, making a lot of processing tasks very straightforward, as you have.
To apply my thinking to your FOLDR function, I would add a parameter that specifies the value to return for the empty set, because I would want to specify its semantics for that specific set such that they do not depend upon the value needed for computation to define it.
Def FOLDR( emptysetval, initial, OP, collection )
if length( collection ) == 0 then
return emptysetval
result = initial
for value in collection:
result = result OP value
return result
In a similar vein, I also used to specify my db wrapper functions to add special error conditions for specific cases. Let's say you're using a select statement that is only going to return 0 or 1 rows, my select wrapper would have a parameter that would say its valid result cardinality is specifically 0 or 1 and nothing else. Yes, the select statement would succeed, but the situation in the table might not be semantically correct, and it's better IMO to catch the problem when it is issued. It also standardizes the handling of such error conditions by the caller of the wrapper.The same occurs with a "select count(*) ..."; it must return a single row, or it is an error in semantics if not for the db engine. It can also be a problem if your update statement affects more than one row. And there are other situations where the cardinality must be "> 0" or ">= 0". All these cases were my own error conditions that were not SQL errors, but merely semantic errors caused by db data problems.
I used these this style of manual ORM from perl to VB to C# and F# for 15+ years, to great success.
SEPARATELY
In a db/stats context, the empty set should count as a NULL value, and I don't like to AND or OR actual boolean values with NULL values. Sure, the semantics are defined but I find it's better to catch the NULL value's presence before it gets to being involved in operations.
That's why I always specified NOT NULL in my column defs, because all hell breaks loose once a NULL gets put into a column's values.
Statistics also has such difficulties, as I was many, many years ago helping grad students with their SAS and SPSS data sets and processing. It's always just better to get rid of NULLs, unless the stats you need use are built to handle them. Once again, properly producing the required semantics are the end goal.
Re: A liar who always lies says "All my hats are green."
#170One complication is that in typical English, if you say "All my hats....", you are simultaneously making an existence statement that you have at least one hat... but the usual formal logic "forall" quantifier does NOT presume existence. Here's a formal proof that "forall" has a "surprise" meaning for those not well-versed in formal logic: https://us.metamath.org/mpeuni/alimp-surprise.html I propose that when translat…
> All my hats....", you are simultaneously making an existence statement that you have at least one hat It does not. All my unicorns fly. There is no assumption that I have a unicorn. There is an assumption, based on the claim but it is not a fact. The puzzle also assumes that "my" implies there is some ownership (we'll take for granted "my" means "has" for simplicity), which is another quibble that unravels the whol…
"All my hats are green" is still false even when I own a red hat and a green hat.