Advanced Topic 44 of 50 Software Engineering
Formal Verification
Mathematically proving software meets its specification.
How it works
Formal verification uses mathematical methods to prove that a system satisfies a specification, rather than testing sample inputs. Techniques include model checking, which exhaustively explores the state space against properties in temporal logic, theorem proving with proof assistants such as Coq, Isabelle and Lean, SMT-based verification and static analysis with abstract interpretation. Specifications state invariants, preconditions and postconditions.
Step-by-step walkthrough
- Write the property precisely, such as the lock is never held by two threads.
- Model the program mathematically.
- A proof assistant or model checker examines all behaviors.
- It proves the property or finds a counterexample.
- It gives stronger guarantees than tests, but takes effort.
Where it is used
Safety-critical and security-critical systems use it: processor designs, the seL4 microkernel, cryptographic libraries, aircraft control, railway interlocking and smart contracts.
Common pitfall
It is expensive and demands expertise. A proof is only as good as its specification, so wrong or incomplete specs give false assurance, and the model may differ from the real system or hardware. State explosion limits model checking. Use it for the small, critical core and combine it with testing and review.
Where it fits in the course
Formal Verification is topic 44 of 50 in Software Engineering, rated Advanced. It follows Performance Profiling. The next topic is Mutation Testing.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Software Engineering quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Software Engineering quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Formal Verification?
Where do people use Formal Verification?
What is the most common mistake with Formal Verification?
What should I learn before this topic?
How can I practice it?
Is Formal Verification hard to learn?
How long does it take to learn Formal Verification?
Which topics are related to Formal Verification?
What should I study after Formal Verification?
Related topics
- Performance Profiling (Software Engineering)
- Mutation Testing (Software Engineering)
- Cyclomatic Complexity (Software Engineering)
- Property-Based Testing (Software Engineering)