Why Undecidable Problems Must Exist
While it is tricky to prove that a specific problem, such as the “hello- world problem” discussed here, must be undecidable, it is quite easy to see why almost all problems must be undecidable by any system that involves programming. Recall that a “problem” is really membership of a string in a language. The number of different languages over any alphabet of more than one symbol is not countable. That is, there is no way to assign integers to the languages such that every language has an integer, and every integer is assigned to one language.
On the other hand programs, being finite strings over a finite alphabet (typically a subset of the ASCII alphabet), are countable. That is, we can order them by length, and for programs of the same length, order them lexicographically. Thus, we can speak of the first program, the second program, and in general, the ¿th program for any integer i.
As a result, we know there are infinitely fewer programs than there are problems. If we picked a language at random, almost certainly it would be an undecidable problem. The only reason that most problems appear to be decidable is that we rarely are interested in random problems. Rather, we tend to look at fairly simple, well-structured problems, and indeed these are often decidable. However, even among the problems we are interested in and can state clearly and succinctly, we find many that are undecidable; the hello-world problem is a case in point.
about a single, 22-line program, then the general problem of telling whether a given program, on a given input, prints hello, world must be hard indeed. In fact, any of the problems that mathematicians have not yet been able to resolve can be turned into a question of the form “does this program, with this input, print hello, world? Thus, it would be remarkable indeed if we could write a program that could examine any program P and input I for P, and tell whether P, run with I as its input, would print hello, world. We shall prove that no such program exists.
đang được dịch, vui lòng đợi..