I don't think only verification is enough for safe programs. How program behaves when error happens is probably more important than happy path logic. Programming is layers of abstraction on top several more - unless all of them are formally verified - program can be never be truly verified. Think of different hardware, software, time, timezone, os/drivers/shell/vm/container/language runtime versions etc.
That is the wrong way to think about Formal Methods/Specification/Verification.
Verification is not about "happy path logic" but all computation paths (happy, error, cross-layer etc.) over the entire state space of a "system".
The system can include everything from hardware circuits all the way to distributed applications if needed. Across layers/components it works by composition of contracts where a higher-layer guarantees based on its lower layer's contract guarantees. The book i listed gives examples.
See also my comment here - https://news.ycombinator.com/item?id=50664740
> Think of different hardware, software, time, timezone, os/drivers/shell/vm/container/language runtime versions etc.
The original comment was about industrial automation and in that environment a lot of those issues are not that relevant. Unless we're talking really big systems, a lot of it is very well specified controllers which run without shell/VM/container/runtime. They just talk to some fancy general GUI on a different chip/board to load the data/config. But the state space of a lot of actual practical hardware doing the work is not that complex. Bare metal, careful io timing, state transitions and some control loops gets you very very far.
To be clear, there are bigger, complicated systems, but simpler devices with a clock, PID loop and I2C outnumber them by likely a few orders of magnitude - we can start there.