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
Let us assume a purely functional language (ie Haskell). Side effects can be taken quite cleanly into account in such languages.
Proving that a program produces the right result requires you to specify:
This set of specifications is called denotational semantics. They allow you to prove the reason about programs using mathematics.
The good news is that the "structure of programs" (point 3 above) and the "structure of mathematical sets" are quite similar (the buzzword is topos, or cartesian closed category), so 1/ the proofs you do on the math side will easily be transferred into programmatic constructions 2/ the programs you write are easily shown to be mathematically correct.