Hacker News new | ask | show | jobs
by cix_pkez 2781 days ago
Hey, non-mathematician computer science type here.

If I follow correctly, the issue with randomly picking any real number in that interval is that irrational numbers would require infinite computational steps to resolve. So the probability is really 0 that you'll get an irrational. If you have a finite number of computations, you're guaranteed to resolve to a rational, while if you have an infinite number of computations, you never resolve to anything.

Is that a decent lay interpretation?

4 comments

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.

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.
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.
The opposite is true. Take the interval [0, 1], "sample a random real number x" from it. P(x is rational) = 0, P(x is irrational) = 1.

Informally, the overwhelming majority of real numbers are irrational.

What's weird is there's always a rational number between any 2 irrational numbers, yet there are way more irrational numbers
All this becomes pretty intuitive if you think about numbers in terms of their decimal expansions. A "random number" is one with a random digit in each of its (infinitely long) list of decimal digits. A rational number is one where, at some finite point, all of the digits start to repeat in some finite pattern. The odds of that happening by chance are zero.

Likewise, if you take any two randomly generated list of decimal digits, at some point there will be a digit in the same place that is different between the two. At that point, you can construct a rational between the two by choosing the smaller digit and then adding "1000....".

But yeah, it's kind of weird.

Corollary: rational numbers must serve double duty separating many different pairs of irrational numbers.

You can keep going with things that sound weird:

There are infinitely many rationals between any two irrational numbers.

There are as many rational numbers between any two finite irrational numbers as there are between positive and negative infinity.

Can you clarify that last point? I don't think it's strictly true. Aside from countable and uncountable infinities, you can have larger and smaller infinites as well. Unless every set S of all rational numbers between any irrational x and irrational y is isomorphic to the set P of all rational numbers, I don't see that this is correct. And I don't immediately see that you can put them into 1-1 correspondence.
Do you agree both sets are countable? If so, any two countable sets can be put into bijection by composing their bijections to the naturals.
Oh, right. Yeah I guess that makes sense by definition.
Any infinite set is either countable or uncountable.
I'm aware, but that's not what I meant.
> If I follow correctly, the issue with randomly picking any real number in that interval is that irrational numbers would require infinite computational steps to resolve.

In mathematics, doing things an infinite number of times is generally no problem, in fact it’s almost always done.

Of course, there are also many different sizes of infinity, and doing things a larger infinite size number of times requires some extra steps... but most branches of math only do things a countable infinite number of times (the smallest infinity).

"Rational" numbers are those that can be expressed as a fraction of two integers. For example, a square root of two is not rational.

"Computable" numbers are those that can be calculated by a computer (with unlimited memory, but finite speed) with arbitrary (not infinite) precision in finite time. As a rule of thumb, anything you can express using words like "plus", "minus", "square root", "logarithm" etc. is going to be computable.

> irrational numbers would require infinite computational steps to resolve

No, this is not the real reason. Both "1/3" and "square root of 2" have infinite number of decimal places, so neither can be fully written by a computer program. However, each of them can be approximated to e.g. one billion decimal places.

To show you how most numbers are not rational, consider only numbers of form "A + B * square root of two", where A and B are rational. Each different pair of A and B gives you a unique number. Among them, the numbers with B = zero are rational, and numbers with B <> zero are irrational. (Furthermore, all rational numbers can be expressed like this, but many irrational numbers, such as "square root of three" are outside of this set.) This should make it intuitively obvious why a randomly picked number is infinitely unlikely to be rational.

But the rabbit hole goes much deeper.

Let's ignore all technical details, and take a set of all numbers you can describe (unambiguously, and without any paradox) by a sentence of a finite length (including any finite number of equations of a finite length). If you need a whole book to define a number, so be it. Take all numbers humans can describe.

The point is that all these numbers are just an infinite minority in the vast ocean of real numbers.

How can that be? What else is missing? This seems tricky, because -- by definition -- I should be unable to give you an example of a number that cannot be described. But even if I can't give you a specific number, I can point you towards a concept: the numbers whose decimal digits are all randomly generated.

Any number that can be described by a finite description, contains a finite amount of information. A number with infinitely many randomly generated digits contains an infinite amount of information. To put it differently, when you generate numbers with infinite number of random decimal digits, you would have to be infinitely lucky to generate a number which only happens to contain a finite amount of information (for example, when all randomly generated digits happen to be zeroes). But the former are the real numbers, and the latter are the computable numbers. So if you take a random real number, you have to be infinitely lucky to get a computable one.

There is actually more, because "infinitely more" does not adequately describe the difference between comparing "rational" with "irrational, but still computable" numbers (both infinities have the same cardinality), and "computable" with "real" numbers (infinities of a different cardinality)... but this part, I am afraid, is beyond lay interpretations and requires paying attention to some technical definitions. A simple version is that the rational numbers and the computable numbers can both be numbered by integers, if we choose a sufficiently smart numbering scheme; but for real numbers, even this is impossible. But it takes some technical details to explain why it is so, and why it matters so much.