Formal Languages
Formal Verification
Therac-25 was a medical particle accelerator. A race condition in its software killed three patients. The bug lived in the code for years and the tests never caught it. Formal verification would have found it in minutes.
- Amazon AWS verified 16 distributed systems in TLA+ and found 10 critical bugs in the specifications before implementation
- Intel adopted model checking for the FPU after the Pentium FDIV bug cost the company $475M. The Pentium 4 was formally verified
- NASA Deep Space 1 and Mars Pathfinder were verified with SPIN before launch
- Microsoft verified USB drivers and the NTFS file system using SLAM/SDV (Software Device Verifier)
- Airbus A380 fly-by-wire software was verified with Simulink Design Verifier and Polyspace
Model Checking
Model checking is the automatic verification of finite systems: the algorithm walks the state graph and checks whether the specification holds on every reachable path.
The core problem is state-space explosion: a system with 100 boolean variables has 2^100 states. BDDs (Binary Decision Diagrams) and symbolic model checking let you work with exponential state spaces compactly.
- Safety: 'something bad never happens' - invariants
- Liveness: 'something good eventually happens' - progress
- Fairness: 'a process gets the resource infinitely often' - scheduler
- SPIN: a Promela model verifier, used on the NASA Mars Pathfinder
- CBMC: a bounded model checker for C/C++, finds buffer overflows
Why is model checking limited to finite systems?