-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
F* vs. Dafny #196
Comments
They are similar superficially, inasmuch as they are both languages designed with verification in mind and they both use SMT solving technology. But, there are many differences: F* is a higher order programming language in the ML tradition; Dafny is a first order imperative language in the style of Pascal (although some higher order support is coming in Dafny) F* has a dependently typed higher-order logic; Dafny uses a non-dependent first-order logic. F* has refinement types which are useful for stating invariants; Dafny does not (although some initial work on that has begun). F* has inductive type families useful for constructive proofs; Dafny has simple datatypes only. F* has no IDE support yet; Dafny has a very nice IDE in Visual Studio. F* has no coinduction; Dafny supports coinduction. F* is customizable by user-defined effects; Dafny is not. F* is available on multiple platforms; Dafny requires .NET. F* has no special support for object-oriented programming; Dafny provides object oriented constructs. ... This list is by no means exhaustive. But, I hope it gives you a general sense of what's available and not available in the two languages. I may add to and/or refine this list. |
Thanks for the detailed explanation. How are refinement types in F* different than pre- and post-conditions (requires/ensures) in Dafny? Edit: |
Top-level refinements on function argument and result types serve indeed the same purpose as pre- and post- conditions. In F* the two styles (refinements and pre- and post- conditions on functions) are possible and equivalent by subtyping. However, quoting our recent ICFP submission:
I think that in theory one might be able replace even nested refinements with pre- and post- conditions by turning all values into functions at all levels (remember that we only have pre- and post- conditions on functions). This kind of encoding would, however, be extremely inefficient and inconvenient in practice. |
Thanks, Catalin. I now understand the difference. Can you address my remark about higher-order logic? |
I don't know that much about Dafny, but adding higher-order functions to Pascal will probably not turn it into ML :) |
Dafny recently added higher-order, heap-reading functions. Higher orderness is pervasive in F*. You can write higher order pure functions (which you cannot in Dafny), as well as higher order functions with arbitrary effects. You can specify properties in higher order logic, etc. |
They seem quite similar.
How are they related? What are the similarities/dissimilarities?
What types of problems will be easy to tackle in one language, while hard on the other?
Thanks,
The text was updated successfully, but these errors were encountered: