Can Haskell functions be proved/model-checked/verified with correctness properties?

后端 未结 11 1105
挽巷
挽巷 2021-01-29 18:46

Continuing on from ideas in: Are there any provable real-world languages?

I don\'t know about you, but I\'m sick of writing code that I can\'t guarantee.

11条回答
  •  深忆病人
    2021-01-29 18:54

    It's certainly possible to prove some properties of Haskell programs formally. I've had to do so at my FP exam: given two expressions, prove that they denote the same function. It's not possible to do this in general since Haskell is Turing-complete, so any mechanical prover would either have to be a proof assistant (semi-automatic with user guidance) or a model checker.

    There have been attempts in this direction, see e.g. P-logic: property verification for Haskell programs or Proving the correctness of functional programs using Mizar. Both are academic papers describing methods more than implementations.

提交回复
热议问题