Hacker News new | ask | show | jobs
by gr_norm 2 days ago
It's a quite reasonable question! Whereas unit tests are stated for just one or a few inputs at a time, formal verification validates properties of programs for all possible inputs. So, for instance, you can show that a web application can never be crashed with a crafted input. Or that there is no sequence of actions one user can take to modify or view certain fields on another's account.

Only formal verification can feasibly talk about certain classes of properties. Many important concerns in security (like confidentiality and integrity) and distributed systems (certain consistency properties) fall into this camp.

1 comments

Well crafted unit tests cover all "interesting" inputs and behaviors and what they don't cover is expected to be fine too by informal interpolation arguments.

Granted, most testing out there isn't really that well constructed. And trying to make your arguments formal often leads to discovering the relevant corner cases, even without running a checker, e.g. trying to think through some loop invariants. For that purpose, formal methods have a place in education even if they are not used on every little piece of software out there. In the end it's about deeply caring about quality and correctness of your software. Whether you actually employ formal verification or not is not really substantial in the end, at least considering the current state of software quality.