Why can\'t a computer program be proven just as a mathematical statement can? A mathematical proof is built up on other proofs, which are built up from yet more proofs and
If the program has a well defined objective and initial assumptions (ignoring Godel...) it can be proven. Find all primes,x, for 6<=x<=10, your answer is 7 and that can be proven. I wrote a program that plays NIM (the first Python program I ever wrote) and in theory the computer always wins after the game falls into a state in which the computer can win. I haven't been able to prove it as true, but it IS true (mathematically by a digital binary sum proof) I believe unless I made an error in the code. Did I make an error, no seriously, can someone tell me if this program is beatable?
There are some mathematical theorems that have been "proven" with computer code like the four color theorem. But there are objections, because like you said, can you prove the program?
proving a program correct can only be done relative to the specification of the program; it is possible but expensive/time-consuming
some CASE systems produce programs more amenable to proofs than others - but again, this relies on a formal semantics of the specification...
...and so how do you prove the specification correct? Right! With more specifications!
Further, what are the axioms of programming? The very atomic truths of the field?
Are the opcodes the "atomic truths"? For example on seeing ...
mov ax,1
... mightn't a programmer assert as axiomatic that, barring a hardware problem, after executing this statement the CPU's ax
register would now contain 1
?
If you write a computer program, how is it that you can take previous proven works and use them to show the truth of your program?
The "previous work" then might be the run-time environment in which the new program runs.
The new program can be proven: apart from formal proofs, it can be proven "by inspection" and by various forms of "testing" (including "acceptance testing").
How do you prove a Picasso?
If software is more like industrial design or engineering than like art, a better question might be "how do you prove a bridge, or an airplane?"
As others pointed out, (some) programs can indeed be proven.
One problem in practice however is that you first need something (i.e. an assumption or theorem) that you want to prove. So to prove something about a program you first need a formal description of what it should do (e.g. pre- and post-conditions).
In other words, you need a formal specification of the program. But getting even a reasonable (much less a rigorous formal) specification is already one of the hardest things in software development. Therefore it is generally very difficult to prove interesting things about a (real-world) program.
There are however some things which can be (and have been) more easily formalized (and proven). If you can at least prove that your program will not crash, that's already something :-).
BTW, some compiler warnings/errors are essentially (simple) proofs about a program. E.g., the Java compiler will prove that you never access an uninitialized variable in your code (otherwise it will give you a compiler error).
First, why are you saying "programs CAN'T be proven"?
What do you mean by "programs" anyway?
If by programs you're meaning algorithms don't you know Kruskal's? Dijkstra's? MST? Prim's? Binary Search? Mergesort? DP? All those things have mathematical models that describe their behaviors.
DESCRIBE. Math doesn't explain the why of things it simply draws a picture of the how. I can't prove to you that the Sun will rise tomorrow on the East but I can show the data where it has been doing that thing on the past.
You said: "If you write a computer program, how is it that you can take previous proven works and use them to show the truth of your program? You can't since none exist"
Wait? You CAN'T? http://en.wikipedia.org/wiki/Algorithm#Algorithmic_analysis
I can't show you "truth" I a program as much as I can't show you "truth" on language. Both are representations of our empirical understanding of the world. Not on "truth". Putting all gibberish aside I can demonstrate to you mathematically that a mergesort algorith will sort the elements on a list with O(nlogn) performance, that a Dijkstra will find the shortest path on a weighted graph, or that Euclid's algorithm will find you the greatest common divisor between two numbers. The "truth in my program" in that last case maybe that I'll find you the greatest common divisor between two numbers, don't you think?
With a recurrence equation I can delineate to you how your Fibonacci program works.
Now, is computer programming an art? I sure think it is. As much as mathematics.
They can. I spent many, many hours as a college freshman doing program correctness proofs.
The reason it's not practical on a macro scale is that writing a proof of a program tends to be a lot harder than writing the program. Also, programmers today tend to build systems, not write functions or programs.
On a micro scale, I sometimes do it mentally for individual functions, and tend to organize my code to make them easy to verify.
There's a famous article about the space shuttle software. They do proofs, or something equivalent. It's incredibly costly and time-consuming. That level of verification may be necessary for them, but for any kind of consumer or commercial software company, with current techniques, you'll get your lunch eaten by a competitor who delivers a 99.9% solution at 1% of the cost. Nobody's going to pay $5000 for an MS Office that's marginally more stable.