Why can't programs be proven?

前端 未结 30 2341
礼貌的吻别
礼貌的吻别 2020-12-22 17:06

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

30条回答
  •  攒了一身酷
    2020-12-22 18:06

    You can in fact write provably correct programs. Microsoft, for example, has created an extension of the C# language called Spec# which includes an automated theorem prover. For java, there is ESC/java. I'm sure there are many more examples out there.

    (edit: apparently spec# is no longer being developed, but the contract tools will become part of .NET 4.0)

    I see some posters hand-waving about the halting problem or incompleteness theorems which supposedly prevent the automatic verification of programs. This is of course not true; these issues merely tell us that it is possible to write programs which cannot be proven to be correct or incorrect. That does not prevent us from constructing programs which are provably correct.

提交回复
热议问题