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
Partially I agree. But when it comes to errors/not-happy path - I am talking about pesky issues, driver/hardware errors which can never be mapped to any "Type". There is a reason every statically-typed programming language has Root Error type. For eg. Java has `Throwable` with two subtypes - `Error` and `Exception`. A `RuntimeException` is type that does give handle to programmers and JVM guarantees that it will be thrown. But sometimes one has to catch root "Throwable" or "Error" types in order to prevent JVM crash. It will be tedius to have formal verification theorems referring to "Throwable" in order to be formally verifiable. I guess It can be done - only if languages like Lean are expressive enough - but only using LLMS, for humans it will be quite complex. IMO - not worth. It will be repeat of "elegant" functional programming languages failing to go mainstream.