Blogroll

Misc

The Dafny Tutorial at SPLASH’13

By Dave, on November 1st, 2013

Today I was attending the Dafny tutorial given by Rustan Leino at SPLASH’13. I have to say that this was the highlight of the conference for me. In case you haven’t come across it before, Dafny is a programming language designed for software verification. It has a lot in common with Whiley, although Dafny is certainly more mature. You can try it out in your web-browser on the rise4fun site.

During the tutorial, we went through a number of examples, including several focusing on loop invariants. For example, here’s the Dafny code for the absolute function:

You can find the code for this here, where you can run it directly in your browser and play around with it. In fact, the browser version is surprisingly good, and seems to have improved a lot lately. Dafny statically verifies (automatically) that this method does indeed meet its specification.

Again, you can run the code directly from here. This example is pretty neat! Although, it’s worth mentioning that it doesn’t suffer from the hidden overflow bug which plagued Java because Dafny, like Whiley, uses unbound arithmetic (i.e. it never overflows).