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

后端 未结 11 1119
挽巷
挽巷 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:53

    Your seemingly simple example, add(a,b), is actually difficult to verify - floating point, overflow, underflow, interrupts, is the compiler verified, is the hardware verified, etc.

    Habit is a simplified dialect of Haskell that allows for proving program properties.

    Hume is a language with 5 levels, each more limitedand therefore easier to verify:

    Full Hume
      Full recursion
    PR−Hume
      Primitive Recursive functions
    Template−Hume
      Predefined higher−order functions
      Inductive data structures
      Inductive  Non−recursive first−order functions
    FSM−Hume
      Non−recursive data structures
    HW−Hume
      No functions
      Non−recursive data structures
    

    Of course, the most popular method today for proving program properties is unit testing, which provides strong theorems, but these theorems are overly specific. "Types Considered Harmful", Pierce, slide 66

提交回复
热议问题