in reply to Re: (OT) Where is programming headed? in thread (OT) Where is programming headed?
Programmers will be necessary until someone solves the halting problem.
The automatic programming problem (writing a program that writes
programs for you) has been proven NPcomplete.
Even then, programmers will be necessary, because what programmers really do is translate human assumptions into symbols that a computer can manipulate. OOP, declarative programming, functional programming, descriptive programming.. they're all just frameworks on which to arrange our thoughts. Perl, C, C++, Java, Lisp.. they're just collections of symbols and primitive operations that we hang on a particular framework.
The really hard part of programming is learning to think without contradicting oneself. When you tell a computer to contradict itself, it can extrapolate that contradiction into a database full of gibberish right smart quick. Humans, OTOH, are so good at dealing with ambiguity that we can hold selfcontradictory opinions without ever noticing.
Human thought is by nature fuzzy and illdefined. We can identify a bear well enough to run away from it, while we're still far enough away that running will work. We don't care about its exact weight, or how many hairs are in its pelt, because finding out has never been a major survival trait.
Computers, by contrast, are excruciatingly precise. the C code:
float x, y;
x = 1;
y = 1;
if (x == y) {
printf ("they match.\n");
} else {
printf ("close, but no cigar.\n");
}
will fail as often as not, due to microscopic differences in the interpreted values of those two variables.
Programmers take ideas from the fuzzy, human, "oh crap, a bear!" realm, and polish them until they work in the meticulous, "can't tell if 1 really equals 1" computer realm.
That's not easy.
You can always find people who'll say that computers should be able to write programs that whatever we tell them we want, and in a sense, that's true. The problem is that most people don't know what they want well enough to explain it to another human, let alone a computer.
mike
.
Re: (OT) Where is programming headed?
by Dominus (Parson) on Dec 15, 2001 at 00:24 UTC

I think I might agree with your main point, but I'd suggest that in the future
you avoid using technical jargon when you're not exactly sure what it means.
For example:
Says mstone:
Programmers will be necessary until someone solves the halting problem. The
automatic programming problem (writing a program that writes programs for you)
has been proven NPcomplete.
I'm not sure what you mean here, and most of the obvious interpretations
are false. If you mean that it's impossible to write a program
that writes programs, that's wrong, because I have a
program here that I use every day that takes an input specification and
writes a machine language program to implement that specification;
it's called gcc. Programs write other programs
all the time.
I doubt if there's any meaningful sense in which
"the automatic programming problem" (whatever that is)
can be shown to be NPcomplete.
If you mean that it's equivalent to the halting problem,
you might also want to note that the halting problem is not NPcomplete, and
revise accordingly.
You said that the C code will fail "as often as not":
float x, y;
x = 1;
y = 1;
if (x == y) {
...
}
But you're mistaken; the result of the test is guaranteed to be true.
Certain float values can be compared exactly,
and 1 is among those values.
In general,
if two floats both happen to represent rational numbers
whose denominators are both powers of 2, and if neither float's
significand exceeds the available precision, then the values
are represented exactly and can be compared exactly.
In particular, integral values less than about 2^{53}
will be represented and compared exactly.
So while I think you may have good points, the factual errors in
your note spoiled its persuasiveness for me.
Hope this helps.

Mark Dominus
Perl Paraphernalia
 [reply] [d/l] 

Dominus
>> integral values less than about 2^{53} will be represented and compared exactly
Since this OT is turning into a C refresher course, factual accuracy should be in order. Your statement is true of C/C++ double, which is also what Perl uses for numeric values. The example float x, y; declares a couple of singleprecision floats, which can represent exactly integral values of up to about 2^{25}. A summary of IEEE754 format can be found here and an interactive converter here.
Rudif
 [reply] [d/l] [select] 

Says rudif:
Your statement is true of C/C++ double, which is also what Perl uses for numeric values.
The example float x, y;
Oops! You are absolutely right. My brain is so stuck on doubles that
I often forget about singleprecision floats.
Anyway, my main point, which was that the number 1
is exactly representable, is still correct.
Thanks for the correction.

Mark Dominus
Perl Paraphernalia
 [reply] 

> > Programmers will be necessary until someone solves the halting
> > problem. The automatic programming problem (writing a program that
> > writes programs for you) has been proven NPcomplete.
>
> I'm not sure what you mean here, and most of the obvious
> interpretations are false. If you mean that it's impossible to
> write a program that writes programs, that's wrong, because I have
> a program here that I use every day that takes an input
> specification and writes a machine language program to implement
> that specification; it's called gcc. Programs write other programs
> all the time.
gcc doesn't 'write programs' per se, it just translates programs you've written in
one formal language (C) to another formal language (machine code).
Automatic programming boils down to the deep theoretical
question of whether all programming can be reduced to a finite set of
generative postulates, the way, say, algebra can.
If that were true, programmers would be unnecessary. A few
supercomputers with theoremproving software could sift their way
through all the permutations, spitting out every possible wellformed
program along the way.
> I doubt if there's any meaningful sense in which "the automatic
> programming problem" (whatever that is) can be shown to be
> NPcomplete. If you mean that it's equivalent to the halting problem,
> you might also want to note that the halting problem is not
> NPcomplete, and revise accordingly.
I misspoke.. the automatic programming problem is AIcomplete,
not NPcomplete. The halting problem is, indeed, impossible to solve with a Turning machine, which I believe Von Neumann classified as a 'type0' computer.
However, a Von Neumann 'type1' computer (if I've got the numbers
right), can solve the halting problem. A type1 Von Neumann
machine has an infinite tape full of ones and zeros, where the address
of each cell corresponds to a unique C program, and the value of each cell is a boolean that says whether the program halts or not. In other words, it's a giant lookup table.
Right now, we don't know if that binary sequence can be found by any
means other than bruteforce examination of every possible program.
However, if programming can be reduced to a finite set of
generative postulates, it may be possible to calculate
the value of any given bit in finite time.
It might even be possible to calculate that value with a Turing machine.. in which case, we could sidestep the current proof for the halting problem's
unsolvability without actually contradicting it.
Either way, my original assertion still stands. A solution to the halting problem would
generate a solution to automatic programming, and vice versa.
> But you're mistaken; the result of the test is guaranteed to be true.
> Certain float values can be compared exactly, and 1 is among those
> values.
Point taken, though one could probably call that a compiler issue.. IIRC, the ANSIC spec defines all floatingpoint representations in terms of a minimal error variable elim.
Please insert the code necessary to calculate the square root of 2.
mike
.
 [reply] [d/l] 

use Math::BigInt;
my $N = Math::BigInt>new(shift @ARGV);
while (1) {
$N += 1;
next unless prime($N);
next unless prime($N+2);
print "$N\n";
exit;
}
sub prime {
my $n = shift;
for (my $i = Math::BigInt>new(2); $i * $i <= $n; $i += 1) {
return 0 if $n % $i == 0;
}
return 1;
}
You can't tell me whether this program will halt on all inputs.
Not by "brute force examination" or by any other method.
Why not? Because you don't know how to figure that out.
Neither does anyone else.
I won't address your assertion that a solution to the halting problem
will provide a solution to "the automatic programming problem",
because you still haven't said what "the automatic programming problem"
is, and I'm starting to suspect that you don't have a very clear idea of it yourself.
It might even be possible to calculate that value with a Turing
machine.. in which case, we could sidestep the current proof for the halting problem's
unsolvability without actually contradicting it.
No, you couldn't. The proof completely rules out this
exact possibility.
I don't think you could understand the proof and still believe this.
Point taken, though one could probably call that a compiler issue.. IIRC, the ANSIC
spec defines all floatingpoint representations in terms of a minimal error variable elim.
You're the one that brought it up; if you wanted to leave compilerdependent
issues out of the discussion, you should have done that.
As for the square root of 2, what of it? Are you now saying
that code to compute the square root of 2 will fail "as often as not"?
That isn't true either.
The term elim does not appear in the 1999 C language
standard, which I consulted before posting my original reply.

Mark Dominus
Perl Paraphernalia
 [reply] [d/l] 




