dafny-lang / dafny

Dafny is a verification-aware programming language
https://dafny.org
Other
2.85k stars 257 forks source link

Standard library usability improvements #4878

Open robin-aws opened 7 months ago

robin-aws commented 7 months ago

Several ideas that came up while wrapping the standard libraries up for 4.4 and writing up a blog post about them:

keyboardDrummer commented 7 months ago

We haven't been super consistent about having two variants of most operations: a partial one with pre-conditions and a complete one that can fail. If we consider the problem holistically we might be able to just have complete versions with lemmas/smart compilation to avoid handling failures when they are not possible.

I'd expect you to have a partial version that is called by a complete version, so that if you can satisfy the precondition you can call the partial version to get the best performance, and otherwise you call the complete version.