Hacker News new | ask | show | jobs
by gpm 2784 days ago
Uniformly at random picking a number from the interval [0, 1] isn't possible with a turing machine (even giving it access to random coins). I.e. it's not a computable function.

It doesn't even really make sense, you can't represent uncountably many numbers on a turing machine, so it isn't even possible to return all but a tiny subset of the space.

You're imagining some turing machine that attempts to compute it anyways and thinking about the output. You seem to think that you can make a turing machine that

- In the probability 0 case that we should output a rational, will output that number

- Will otherwise infinite loop

This is randomized, so we are getting our randomness from some kind of "coin flip" like process. To know that we are in the that probability 0 case of outputting a rational, we will need to have seen infinitely many coin flips. If we've seen only n coin flips, there is still 1/2^n > 0 of the probability space that we haven't explored. So in fact any such turing machine has to loop infinitely in the rational case as well.

2 comments

I'd say it's perfectly possible for a Turing machine + a source of randomness to generate a random real number in [0, 1). We just lazily generate more and more digits to the required precision. It's no different from, say, pi being computable.

We can even prove that there's zero probability that a rational number is generated: the decimal representation of a rational always has a repeating group of digits, but since each digit is generated randomly with 100% probability there will be no periodic pattern.

Replace the role of Turing Machines with Type 2 Turing Machines. Then it is possible. And it's got absolutely nothing to do with computable functions.

[edit] The downvoters can't argue with facts. I am not deleting this comment.

Computers are not type 2 turing machines, nor are any other physically existing thing that we know of. They aren't really turing machines either because they have a finite tape, but since we are only interested in running the turing machine for a finite amount of time and thus accessing a finite amount of tape that distinction is unimportant.

The standard definition of computable is on a turing machine, not a type 2 turing machine. Of course we can define an alternate model where more things are computable. Edit: And the standard definition of computable is relevant because it happens to be the exact set of functions we can compute on real computers.

While Weihrauch [0] does introduce a different definition of the word computable, that would in a randomized setting allow for sampling from the interval [0, 1] (and not just for rationals as I understand it either). Any algorithm on his "oracle turing machines" will still have to take an infinite amount of time, even to return the rationals. He just allows that in his definition of computable.

[0] https://core.ac.uk/download/pdf/82440448.pdf

Type 2 Turing Machines are a conservative model of computation. They are as realistic as Type 1 Machines. Both models involve an infinite tape. Your previous comment used the Turing Machine abstraction, so my response was entirely valid, suggesting that replacing your abstraction with another equally valid, and I believe more appropriate for this purpose, abstraction eliminates the problem.

Also, by the way, the distinction between "complete" and "potential" infinity is useful here. The Type 2 Turing Machines features only a "potential" infinity, the same type that's common throughout Theoretical Computer Science. A real number is a only a "potential" infinity -- a process of sorts. You seem to be demanding that a real number be represented as a "complete" infinity, but this isn't needed for anything in physics or engineering or anything else. The demand you're making, which would imply that an infinite amount of time is needed, is unreasonable.

And by the way, the downvoter is somebody who can't argue with facts.

I suppose the argument you are trying to make here is basically "having a machine that if we run it for long enough, will tell us any particular digit of a number, is as good as having that number".

In the concrete example, you would argue that if a machine which after n time steps specifies which 1/2^n sized interval the randomly generated number lies in, then having that machine is equivalent to having the randomly generated number.

I disagree. If I come up with any property of the number that requires seeing arbitrarily many digits to specify (e.g. "is rational", "contains more 1s than 0s", etc) you can never tell me whether or not the number your machine specifies has that property. That said, I can see where you are coming from. There is at least some argument that under this model it's not the number which can't be computed, but the "is rational" function.

Personally, I wouldn't worry about the downvotes. Internet points aren't important in life anyways.

> There is at least some argument that under this model it's not the number which can't be computed, but the "is rational" function.

That's how I see it. I think this perspective results in a rich and natural theory, which has helped me in my studies.

What does "to have a number" mean?

A program isn't a black box. The number specified (in binary) by this program

    emit "0."
    loop forever:
        emit "110"
is both rational and contains more 1s than 0s. You no more need "run the program forever" to determine these of the number it presents than you need to perform an "infinite amount of long division" to determine it of the number presented by 6/7.
For arbitrary turing machines, determining what they will output solves the halting problem. E.g. the following machine is pi if M' halts else 0.

    simulate machine M'
    emit pi
Because of the halting problem you more or less do have to treat arbitrary machines as black boxes.
It seems to me that we should have a different measure than lebesgue measure when we speak of picking numbers from an interval.

I wonder if there is a measure under which computable numbers have measure 1 while the others have measure 0. Would it have all the correct properties?

That's not necessary with Type 2 Theory. You work with the usual set of real numbers.