Why can't programs be proven?

前端 未结 30 2351
礼貌的吻别
礼貌的吻别 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 17:54

    Programs absolutely can be proven to be correct. Lousy programs are hard to prove. To do it even reasonably well, you have to evolve the program and proof hand-in-hand.

    You can't automate the proof because of the halting problem. You can, however, manually prove the post-conditions and preconditions of any arbitrary statement, or sequence of statements.

    You must read Dijsktra's A Discipline of Programming.

    Then, you must read Gries' The Science of Programming.

    Then you'll know how to prove programs correct.

提交回复
热议问题