Live data from Hacker News

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

theguardian.com

411–419 of 419 posts

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

#411
post #37

Earlier quoted context omitted.

by the same following, this would mean that any statement on the members of an empty set can be made and it would be logically true? e.g. "all my lamborghinis have magical goat skin seat covers" is true if 1) I have no lamborghinis or 2) All the ones I own have magical goat skin seat covers. (fr I have no logical or mathematical background)

Correct. Common source of confusion/trickery/divergence between ordinary language and formal logic. Edit: Logically speaking, the following two are equivalent: They married and had kids. They had kids and married.

> Edit: Logically speaking, the following two are equivalent:

Depends on your logical system! There are temporal logics to allow one to capture logically the difference between the two.

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

#412
post #108

Earlier quoted context omitted.

You don't write 1+2+3, but (1+2)+3?

The same operators don't need precedence rules; each language is processed left-to-right or vice versa. Usually it's left-to-right, in my experience with maybe a dozen languages professionally, maybe twice that in exploration.

With the same operator, the rule is not called precedence, but associativity (left or right; consider 2^3^4 where it matters), but you still need a rule - unless you use parentheses, which you said you always do.

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

#413

Earlier quoted context omitted.

You are talking about the colloquial meaning of these words.

At most people reading The Guardian would?

The article states that "this question was originally set in a maths exam, so the answer assumes some basic assumptions about formal logic." This is a funny way of phrasing it, but should make it sufficiently clear to any perceptive reader of The Guardian that they are supposed to ignore the colloquial interpretation of the phrase.

At any rate, it would hardly qualify as a puzzle if the answer was so obvious

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

#414

Earlier quoted context omitted.

I'm not a mathematician so please bear with me here I am a mathematician, so please bear with me when I try to explain how this can work. The rational numbers are countable, and that means that I can write a list of them. There are several ways of doing this, but personally I like the Calkin-Wilf tree[0]. That only gives the positive ones, but we can include zero and the negative ones by interleaving them. So, whatev…

Am I right to assume one could also sample from a Gaussian distribution for the method to work? Of course, the probability e of sampling between the two real numbers would be very small, but it would be nonzero.

Yes, any distribution with dense support works. Your problem is to prove that your method of number selection really does have a non-zero probability of being between any two distinct reals.

So ... yes, choose from a Gaussian, but then you have to tell me exactly how.

That's tricky.

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

#415

Earlier quoted context omitted.

Perhaps it'll be more intuitive to you if you scale the number of doors up. If there are 100 doors, only one containing a car, you pick one, the host reveals 98/99 remaining doors as goats, it's obvious the correct choice is to switch. The correct answer is a mathematically provable probability. 1% chance you picked the right door, 99% chance the door was in the remaining pool, therefore 99% chance the last remaining…

If you will try to play this game in real life, with such logic it will be easy to trick you 100% of the time.

You can write a simulation that does this (as MIT and several others have) and Monte Carlo it. You will find that the logic is 100% correct. The prize MUST be either the door you picked initially or the one you can switch to. There is a 99% chance it's not the one you picked.

https://web.mit.edu/rsi/www/2013/files/MiniSamples/MontyHall...

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

#416
post #48

Earlier quoted context omitted.

This is the contentious, formal-logicy part of the puzzle. "All my hats are green" as a logical statement, in most formal logic systems, would be true if I didn't own any hats (a so-called vacuous truth, because it doesn't mean anything, for similar reasons any statement conditioned on a false statement is true, e.g. "if 2+2=5, then I am god" is similarly vacuously true). So if I'm a liar and that statement is false,…

Thanks for breaking that down for me. I guess, to me, a programmer logician not a mathematician logician, the real problem for me here is the definition of "liar" as it applies to how we parse the problem statement's facts.

I'd argue that this bit of mathematical logic carries over to many programming languages. For example using LINQ expressions in C#:

https://dotnetfiddle.net/3QGurc

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

#417
post #412

Earlier quoted context omitted.

The same operators don't need precedence rules; each language is processed left-to-right or vice versa. Usually it's left-to-right, in my experience with maybe a dozen languages professionally, maybe twice that in exploration.

With the same operator, the rule is not called precedence, but associativity (left or right; consider 2^3^4 where it matters), but you still need a rule - unless you use parentheses, which you said you always do.

Touche!

If there's a case where one computation needs to occur before others, then that's where I always use parens.

I'm also never doing a^b^c, either as a^(b^c) or (a^b)^c, but if I did, there would be parens.

Readibility in one's code is necessary for those of us who must re-read our code when we need to refamiliarize ourselves with it before making changes. It is said that programmers spend far more time reading code than writing it, and I have found that to be true. As someone who has developed large pieces of software, my strategies include clarity for the reader, who is, first of all, myself.

As to what it's called, yeah, 'associativity' is the math term, but if you think I don't understand the concept, then you don't understand the depth that precedence goes to the heart of parsing source code to produce executable code. And I do understand that, friend, for four decades now.

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

#418

Earlier quoted context omitted.

But you have specifically initialized your AND and OR results to be True and then False, respectively, thus specifying the resulting value for their processing of the empty set. 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 ch…

But you have specifically initialized your AND and OR results to be True and then False, respectively, thus specifying the resulting value for their processing of the empty set. I've read through your reply several times, and I think you've missed the point. The code here is the code that produces the right result for non-empty collections. It's the shortest, cleanest, clearest code that does so. These aren't random…

Sure, but as a programmer, my job is to specify and code out the semantics of the system. ANDing and ORing a set of bools may very well be different for one list's semantics than another's.

So, the initial value that forms the basis for those computations -- to my mind and experience -- is as related to the value computed for the empty set as the programmer decides it should be. I don't think that function's default will necessarily be the proper semantic result when applied to the empty set.

As an example, why should "Are all hats green?" have the same result as "Are all hats NOT green?"? If the logical computation's initial value is the automatic result, then you have merely answered the mathematical-logic answer to a question about sets, not about the list of real-world things being modeled.

If one is writing pure math software, then the answer will be the pure math logical result. When one is modeling a real-world system, the semantics require another level of specification, in my experience and opinion.

(Good morning. I've never replied to such an old comment before. I do not yet have software to monitor my active conversations around here, and am only just beginning to entertain undertaking such a project, so it is merely luck of the universe that I found your interesting comment this morning. Thanks. It's like a mental warm-up as I begin my day.)

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

#419

I tried to figure it out but got stuck on the linguistic dilemma if he's lying about the concept of himself existing ("All of MY hats"). Then I decided I have better things to do.

Right? There's more: Perhaps he exists, but he's denying that concept of ownership exists. He may also be claiming that the hats are ecologically friendly. Are we also to assume that if all the hats were each mainly green on the outside but had brown linings, they are, or are not, each said to be "all green"?! I need a pint.

A friend of mine at university once showed me how presumptuous those "Verbal Reasoning" tests are. You know, the kind that high-powered consultancy companies love to give internship candidates as if it tests for anything meaningful.

The tests typically begin by instructing the sitter to try not to assume anything in each question. They presumably mean that you shouldn't assume something like women liking the colour pink more than men.

But actually, there often are a bunch of assumptions you need to make, such as that there are seven days of the week with the standard name and sequence. That the word for each number has not been switched with some other. Etc...

Post reply on HN