|
|
|
|
|
by bsaul
1721 days ago
|
|
in practice, what kind of proof are people building when building real world programs ? Are people writing only top level assertion ( such as "this main function always terminate") and the checker points at all the gaps ? Or does one has to write proofs for every single intermediate layer and functions ? In wich case, do people then have access to prebuilt "proven functions" in a stdlib ? such as "NeverEmptyList" or "AlwaysGreaterThanXVariable" ? |
|
Here's an example of a proof from a Turing machine simulator written in Idris [1]. The claim is that the length of the tape never decreases after taking a step.
The "claim" is stated in the type signature, and the "proof" is an implementation of that type. That's what "propositions as types" means. The whole thing looks like a regular function, except that it doesn't do anything and it never gets called. However, by virtue of having been accepted by the type-checker it verifies the claim about that piece of the program's behavior.
[1] https://github.com/nickdrozd/rado/blob/86790bbb218785e57ea88...