News for hackers. Stuff that matters.
Re:Dafny – A programming language with a program verifier by didibus on Thursday January 19, 2017 @08:01PM (#13440936)
What are the competitors to this language? Can someone provide a list. I'd like to start learning a provable language, not sure if Dafny is the one I should start with though.
Re:Dafny – A programming language with a program verifier by SilasX on Thursday January 19, 2017 @10:04PM (#13441473)
Per this reddit comment [1], the languages supporting some kind of compile-time constraint-checking/proving include Why3, Dafny, Fstar, Coq, Agda, and Idris.

Also, some languages have been extended to support it: LiquidHaskell, Frama-C, and Spark/Ada. I also recall some Java extension but can't find it atm.

[1] https://www.reddit.com/r/ProgrammingLanguages/comments/4ref8...

Re:Dafny – A programming language with a program verifier by igravious on Friday January 20, 2017 @06:38AM (#13443087)
Per the Wikipedia page for Whiley[1] the languages akin to Dafny are mentioned when explaining what Whiley is: “The primary purpose of such a tool is to improve software quality by ensuring a program meets a formal specification. In other words, to help identify and eliminate software bug in the programs being developed. Whiley follows many attempts to develop such tools, including notable efforts such as SPARK/Ada, ESC/Java, Spec#, Dafny, Why3 and Frama-C.”

I'm thinking there must be a reason they do not mention F*, Coq, Agda, and Idris, perhaps because they are proof assistants[2] rather than automatic provers of programs with formal specifications. See also Isabelle and others. Regarding Idris (which you mention but is not on that page) and Epigram (which is noteworthy and again not on that page), neither are production ready and the latter is unmaintained.

[1] https://en.wikipedia.org/wiki/Whiley_(programming_language)#...

[2] https://en.wikipedia.org/wiki/Proof_assistant

Re:Dafny – A programming language with a program verifier by tom_mellior on Friday January 20, 2017 @06:59AM (#13443180)
> I'm thinking there must be a reason they do not mention F* , Coq, Agda, and Idris

The ones they do mention are all imperative languages with added deductive verification in a Hoare calculus style (think loop invariants). The ones you mention are functional languages with a different style of proof (think inductive proofs).

Of course there are overlaps between the two styles (notably in Why3), but there are pronounced differences between them.

Re:Dafny – A programming language with a program verifier by igravious on Friday January 20, 2017 @08:09AM (#13443502)
Ok. But that's not what I was getting at.
Re:Dafny – A programming language with a program verifier by tom_mellior on Friday January 20, 2017 @04:38AM (#13442602)
> I also recall some Java extension but can't find it atm.

You might be thinking of JML (Java Modeling Language): http://www.eecs.ucf.edu/~leavens/JML//index.shtml Apparently JML-annotated programs can passed to Why3 using a confusingly documented set of tools: http://krakatoa.lri.fr/

There is also the Cheker Framework for Java: http://types.cs.washington.edu/checker-framework/ But as far as I understand it's less general than all the other tools you mention.

Re:Dafny – A programming language with a program verifier by tom_mellior on Friday January 20, 2017 @06:52AM (#13443147)
Also, and probably even more likely than the ones I mentioned above, there is KeY for Java verification: http://www.key-project.org/index.php
Re:Dafny – A programming language with a program verifier by Devagamster on Thursday January 19, 2017 @08:46PM (#13441144)
Coq is the one I use most. I've heard of lean as well though.

Those are both proof assistants not theorem provers. Dafny uses z3 to attempt to automatically prove theorems about your code. Lean or Coq (for the most part) require that you write the proofs manually in a special language they provide and they will tell you whether or not your proof has errors.

In general these languages lie on a spectrum between more automatic to more manual with the automatic ones taking potentially more time and being more limited but requiring less of you and the manual ones such as lean or coq are more expressive but harder to use because you have to provide all of the proofs.

I should say all this with the caveat that I'm only learning these things now so I've probably said something wrong. Please correct me if that is the case.

Re:Dafny – A programming language with a program verifier by nickpsecurity on Thursday January 19, 2017 @09:15PM (#13441262)
Re:Dafny – A programming language with a program verifier by profquail on Thursday January 19, 2017 @09:14PM (#13441259)
Isabelle is another language for program verification / theorem proving, similar to Dafny and Coq:

https://isabelle.in.tum.de/

Re:Dafny – A programming language with a program verifier by qznc on Friday January 20, 2017 @07:27AM (#13443294)
It is a gradual range from untyped (assembly) to proof-anything (Isabelle, Coq). The more interesting question is: Where are the sweet spots?

The current mainstream (Java,C++,etc) form a big cluster "sweetrange" of roughly equivalent type safety. Rust with its ownership type system goes one step towards more proofs. ATS is even further. Agda and Idris want to be useable programming languages while providing as much proof as possible. Isabelle can generate code, but is also used as just a theorem prover.

Re:Dafny – A programming language with a program verifier by tom_mellior on Friday January 20, 2017 @07:39AM (#13443354)
> Rust with its ownership type system goes one step towards more proofs.

Does it really, though? The ownership system only talks about ownership, which you only need to reason about due to the artificial choice of avoiding garbage collection. So yes, you get closer to proofs, but only to proofs of properties that are not necessary to prove for Java, say.

You might use the ownership and lifetime system to derive must-not-alias guarantees that might help with some verification tasks, but I'm not sure how much it would help.

I'd love to see a deductive verification system for Rust, but I wouldn't expect it to be the silver bullet for verification.

Re:Dafny – A programming language with a program verifier by qznc on Friday January 20, 2017 @10:33AM (#13444503)
There is a convert-Rust-to-Lean-for-verification project. The not-aliasing guarantees did help tremendously there.

https://kha.github.io/2016/07/22/formally-verifying-rusts-bi...

Re:Dafny – A programming language with a program verifier by tom_mellior on Friday January 20, 2017 @01:52PM (#13446034)
My reading of that is that everything is made immutable, at which point aliasing isn't an issue anymore. I might be wrong though.
Re:Dafny – A programming language with a program verifier by derkha on Friday January 20, 2017 @06:48PM (#13447888)
Author of that project here, it's the other way around - I'm using the absence oft aliasing to turn mutable Rust code immutable, which I can then embed in Lean. But you're right that ownership (ie, affine types) per se doesn't help.
Re:Dafny – A programming language with a program verifier by Sean1708 on Friday January 20, 2017 @10:32AM (#13444495)
Ownership is used for more than just memory management though, concurrent memory access for example.
Re:Dafny – A programming language with a program verifier by tom_mellior on Friday January 20, 2017 @10:47AM (#13444604)
True! I wasn't thinking beyond verification of single-threaded programs, which is hard enough as it is ;-)
Re:Dafny – A programming language with a program verifier by gergoerdi on Thursday January 19, 2017 @10:55PM (#13441630)
There's the so-called 'B Method', which seems very similar to this on the programming language side. I haven't checked the proof language so that may be very different.

I've got a two-parter on my blog giving a glimpse of B's programming language[1] and proof language[2].

[1] https://gergo.erdi.hu/blog/2010-02-16-the_b_method_for_progr... [2] https://gergo.erdi.hu/blog/2010-02-22-the_b_method_for_progr...

Re:Dafny – A programming language with a program verifier by tomp on Friday January 20, 2017 @06:49AM (#13443134)
One of the most serious competitors is F* - it's even based on the same underlying technology (Z3) but uses a more ML-like syntax.

https://fstar-lang.org/

Re:Dafny – A programming language with a program verifier by didibus on Saturday January 21, 2017 @03:52AM (#13449412)
F* looks pretty neat. I might try to learn that one.
Re:Dafny – A programming language with a program verifier by xearl on Friday January 20, 2017 @04:33AM (#13442595)
Perfect Developer [1] is another one not yet mentioned. You write and verify your "specifications" (program-parts to be verified) using a language called "Perfect" and generate C++, C#, or Java from that (SPARK Ada generator in progress).

[1] http://www.eschertech.com/products/perfect_developer.php

Re:Dafny – A programming language with a program verifier by Kametrixom on Thursday January 19, 2017 @08:48PM (#13441159)
Check out Idris maybe
Re:Dafny – A programming language with a program verifier by ivcha on Thursday January 26, 2017 @02:16PM (#13494337)
Leon (http://lara.epfl.ch/w/leon) -- effectively, a verification/synthesis framework around Scala
Re:Dafny – A programming language with a program verifier by bjz_ on Friday January 20, 2017 @02:14AM (#13442178)
http://whiley.org/ is another similar language that uses an SMT solver for testing program invariants.
Re:Dafny – A programming language with a program verifier by mrefj on Tuesday January 24, 2017 @08:04AM (#13470967)