News for hackers. Stuff that matters.
Re:A liar who always lies says "All my hats are green." by ColinWright on Monday December 09, 2024 @06:03PM (#42371563)
This turns out not to be the case.

Let's play this game exactly once.

You choose two unequal real numbers. I don't know what they are, and I don't know the distribution from which you choose them. You write them down and put them in separate envelopes.

I'm allowed to choose one envelope and open it to see the number inside, and my job is then to say which envelope holds the larger number.

I claim I have a strategy now which lets me win strictly more than 50% of the time. My strategy is this.

I choose a real number R at random from a distribution that has dense support. In other words, for any two reals, L and U with L<U, P(L<R<U) > 0. This is easy to do ... one method is to list the rationals, positive and negative, then roll a die, discarding numbers until you get a 6.

Now I flip a coin and thereby choose an envelope at random. I proceed by assuming my chosen number is between your two numbers. There is a non-zero chance this is true ... call it e. So e>0.

If I'm wrong then my choice is 50% ... probability is 1-e.

If I'm right then my choice is 100%. ... probability is e.

Combined, my chance of being right is 0.5(1-e) + e = 0.5+e/2, which is strictly greater than 50%.

You can make it as small as you like, and if we play the game repeatedly then you can make it approach 50%. But as it stands, with a one-off game, I can win with a probability that depends on your chosen numbers, but which is strictly bigger than 50%.

Re:A liar who always lies says "All my hats are green." by hansvm on Monday December 09, 2024 @07:34PM (#42372285)
Why, exactly, are you allowed to know why some random guess is between the two numbers or not when computing your choice?
Re:A liar who always lies says "All my hats are green." by hansvm on Monday December 09, 2024 @09:57PM (#42373256)
Sorry, too late to edit, I see you're describing how you know your choice was good/bad (I thought you were describing a probabilistic choice).
Re:A liar who always lies says "All my hats are green." by ajnin on Tuesday December 10, 2024 @03:25AM (#42374924)
I'm not a mathematician so please bear with me here, but I think a problem stems from the fact that the set of reals is "infinite". So, whatever interval you choose, there are infinitely more reals outside the interval as inside (by that I mean that you can fit an infinite number of copies of that interval up to infinity). So the probability e is not >0, it is effectively 0. The second problem is, what does it mean to choose a real at random ? There is an implication that you can choose such number, but as a human living in the finite universe there are limitations to your choice. Any number you can write using all the atoms in the universe is infinitely outnumbered by all numbers that you can't. So effectively it is impossible to pick a random real number. You have to pick a real in some interval, implicitly the interval of reals you can write in an envelope. Which is a different problem than stated originally and for which your "e" can be >0.
Re:A liar who always lies says "All my hats are green." by ColinWright on Tuesday December 10, 2024 @04:58AM (#42375378)
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, whatever interval you choose, there are infinitely more reals outside the interval as inside (by that I mean that you can fit an infinite number of copies of that interval up to infinity). So the probability e is not >0, it is effectively 0.

One you have chosen the two numbers, L and U, I note that there are rational numbers in between. Choose one of those numbers, call it M.

M is in my list above. Now I roll a die, discarding numbers from the list until I get a 6. There is a non-zero probability that the number retained is M, so there is a non-zero probability that my chosen number is between L and U. So e is definitely non-zero.

The second problem is, what does it mean to choose a real at random?

It doesn't have to be uniformly at random -- that's the mistake nearly everyone makes -- and the above process does it perfectly well. It only ever chooses a rational number, but that's OK. It's still a real number, it's still a random number, and for any non-empty interval, there is a non-zero chance the chosen number is inside.

... as a human living in the finite universe there are limitations to your choice.

Yes, but that is accounted for in the explicit description of how to choose the number.

Any number you can write using all the atoms in the universe is infinitely outnumbered by all numbers that you can't.

Again, this is accounted for by the fact that we are not choosing uniformly at random.

[0] https://en.wikipedia.org/wiki/Calkin%E2%80%93Wilf_tree

Re:A liar who always lies says "All my hats are green." by vbarrielle on Tuesday December 10, 2024 @12:12PM (#42378795)
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.
Re:A liar who always lies says "All my hats are green." by ColinWright on Wednesday December 11, 2024 @03:19PM (#42392439)
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." by raincole on Tuesday December 10, 2024 @07:36AM (#42376269)
> The second problem is, what does it mean to choose a real at random ?... So effectively it is impossible to pick a random real number

Yes, it's established there isn't "uniform distribution over all real numbers" without violating axiom of probability. You're 100% correct on this.

But it doesn't make Colin's solution wrong, because e > 0 for any* well-defined distribution.

> Which is a different problem than stated originally

There are two ways to inteprete the original problem:

A. The numbers are truly randomly picked over all real numbers.

B. The numbers are picked from a well-defined distribution which is unknown to the player.

Since A. is invalid mathematically speaking (without changing the commonly accepted definition of probability), it's reasonable to only consider B., in which case, Colin's solution is correct.

I made a more intuitive explantion on why a strategy better than coin toss exists here: https://news.ycombinator.com/item?id=42372972

*: More strictly, any distribution that guarantees the probability that the two numbers in envelope are the same = 0.

Re:A liar who always lies says "All my hats are green." by btilly on Tuesday December 10, 2024 @10:49AM (#42377938)
How the numbers in the envelopes were picked doesn't matter. What's important is that they exist, and are specific numbers.