I've been skimming over some papers on formal analysis and robust software. It started with a
brow beating from Dijkstra that I ran across. He says some pretty amusing stuff which hits pretty close to home, such as "testing by random sampling is hopelessly inadequate as well, because even the most vigorous exercising possible will only cover a truly negligible fraction of the possible number of cases, and whole classes of in some sense critical cases can --and will!-- be missed: only the most obvious blunders will show up." Thats pretty much what I do for a living!
So 36 years later what are we doing about it? Turns out there are some people working on interesting things.
I've already mentioned the
QuickCheck project earlier, which lets you do fuzz testing on small units of code to get better coverage. You specify properties in a declarative fashion and it uses random inputs to verify the declarations. Even better, there's
Extended Static Checking for Haskell which lets you specify pre- and post- conditions and uses static analysis to prove that the declarations hold. This augments the strong static checking (which can catch a lot of bugs in its own right) with user-specified properties that can also be verified statically to prevent runtime errors from occuring.
There are two operating system projects which are using formal methods to attempt to build a high-assurance operating system to provide a solid foundation for other programs. The first,
seL4 is an L4 variant. This
paper talks about how they wrote a formal specification in Haskell (this formal spec is executable!), translated it into the Isabelle theorem prover to verify properties formally and eventually will translate the result into a real implementation in C.
The
coyotos project is building a microkernel using formal methods. They're using a new scheme-like language called BitC that has formally specified semantics and has the nifty property that a useable subset of the language doesn't require dynamic allocation (and hence doesn't need garbage collection -- this is cool because you can use it for low-level code without having to piggyback on a large GC implemented in C).
Wouldn't it be cool if people wrote high-assurance versions of security-sensitive software that we need to use every day? Things like SSL, ssh and httpd? Here's
one project that's writing some of these in OCaml, a functional programming language with a strong type system. Definitely a step in the right direction.