It's impossible to prove by brute-forcing the states of an arbitrary program, but it's possible on practice for programs that were built with verification in mind: pure functions wherever applicable, state invariants defined and verified for every stateful part. If you aren't able to prove a specific invariant at compile-time, you leave it as assertion which means you can still prove that either you get the correct output or an error, but never the wrong output or crash/vulnerability.
I think today it's actually more possible than ever. Writing programs in this way is hard and tedious but LLM can excel at that. I also think that a hybrid of Z3+LLM is orders of magnitude stronger than pure Z3. LLMs generated a formal proof of GRH, surely than can prove banking app correct.
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.
> 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)