> The most vulnerable part that will remain will be the formalization of requirements. That's impossible to solve fully because you never know what the human had in mind exactly when he ordered the program to be written.
I don't think it necessarily needs to be solved. You can combine formal verification with tests! Use tests to show that the program occasionally does what you want. Use verification to show that the program never does what you don't want (e.g. crash). The formal requirements can be quite weak this way, yet you still get a high level of assurance overall.
And you'll be surprised how many invariants you'll actually need for the simple "don't crash" requirement -- to prove anything at all in a complex program, underlying components need to be correct, or it becomes hard/impossible to prove anything at all about the code using those components.
So (admittedly without any personal experience other than studying this area an university more than decade ago) I expect even a simple "don't crash" requirement gets you the majority of the formal verification benefits. (as long as you have some tests to ensure the implementation isn't just returning a constant)
Tests still encode requirements. The problem is exactly the same there. You can’t write tests if you don’t know the intended behaviour.
Depends on the goal. If you just want software to be generally safer, with less bugs and higher quality then this is sufficient, yes.
If you want actual guarantees that e.g. money won't disappear from your account some day or your messages won't be read by a third-party, then formal verification alone doesn't grant that.
Consider that Wifi WPA2 encryption was formally verified and yet broken. In simple terms the bug was in the protocol specification [1]. The "code is the law" crypto folks have even more fun stories to share.
[1] https://www.galois.com/articles/formal-methods-krack-vulnera...