This might be a stupid question, but why a separate programming language rather than aiming to verify/synthesize invariants in languages people use?
Dafny: Verification-Aware Programming Language
11–20 of 35 posts
Re: Dafny: Verification-Aware Programming Language
#12This might be a stupid question, but why a separate programming language rather than aiming to verify/synthesize invariants in languages people use?
Dafny can compile to and interface with a few languages, including C#.
Re: Dafny: Verification-Aware Programming Language
#13Looks interesting. I saw some C# files, from which it seems it is implemented in C#. Is there going to be an implementation in Dafny?
Re: Dafny: Verification-Aware Programming Language
#14Try writing a^b in integers and proving its correctness. The simple version works (based on a x a^(b-1)). But if you write an "optimised one" using (with handwaved details) (a^(b/2))^2 .... pulled some serious hair trying to prove this function works.
Re: Dafny: Verification-Aware Programming Language
#15I quite like Dafny, despite my first run up with it (verification aspect) being frustrating. The language is well designed for this. Also, it looks like it is a great candidate as a code generation target for LLMs because you can generate the proof of correctness and run a feedback loop with Dafny's checker. Try writing a^b in integers and proving its correctness. The simple version works (based on a x a^(b-1)). But…
Re: Dafny: Verification-Aware Programming Language
#16Looks interesting. I saw some C# files, from which it seems it is implemented in C#. Is there going to be an implementation in Dafny?
Re: Dafny: Verification-Aware Programming Language
#17https://glados-michigan.github.io/verification-class/fall202...
Re: Dafny: Verification-Aware Programming Language
#18This might be a stupid question, but why a separate programming language rather than aiming to verify/synthesize invariants in languages people use?
The semantics of Dafny is carefully designed to make verification efficient. Dafny can compile to and interface with a few languages, including C#.
Are there benchmarks showing dafny is faster than other inefficient options ?
Re: Dafny: Verification-Aware Programming Language
#19This might be a stupid question, but why a separate programming language rather than aiming to verify/synthesize invariants in languages people use?
> … verify/synthesize invariants in languages people use? Good question. This is the holy grail. This is what everyone in PL research would love. This is where we want to get to. Turns out a language as “simple” as C has sufficiently complicated semantics as to limit rigorous analysis to the basics. One example is loop analysis: it’s very useful to know that a loop will terminate eventually; if a loop is modifying so…
I assume if you were to develop such a system for C, C++, or Rust you'd similarly expect the user to do this.
Re: Dafny: Verification-Aware Programming Language
#20This might be a stupid question, but why a separate programming language rather than aiming to verify/synthesize invariants in languages people use?
Most existing mainstream languages aren’t expressive enough to encode these invariants. For languages outside of the mainstream, Lean 4 is a language supporting verification, and it’s also a full programming language, so you can write your proofs/theorems in the same language that you program in.
I'd have assumed, by virtue of being Turing complete, you could express any invariant in almost any language?