How many times in the course of a project have you heard the term formal verification? This short article assumes you know the basic definition of formal verification, and looks at what theorem proving is and how it relates to the other formal methods.
What theorem proving is
Theorem proving techniques state the relationship between a specification and an implementation as a theorem in logic, and then prove that theorem within a proof calculus. The implementation provides the axioms and assumptions for the proof. Like the mathematics classes we had in school, the work involves proving lemmas and theorems by deduction, rewriting and induction.
Theorem proving is mainly used for verification at a higher level of abstraction, usually in algorithmic verification. It is most successful on complex problems and systems such as distributed algorithms, real-time systems and arithmetic units, where simulation can never cover every case.
How it differs from simulation and model checking
Simulation checks a design against chosen test cases. It finds bugs, but it can never show their absence, because the number of possible inputs is astronomically large. Model checking explores every reachable state of a finite design automatically, which is powerful but runs out of memory as designs grow. Theorem proving works with symbols rather than states: a single proof can cover every operand of a 64-bit divider, or a parameterized design of any width, at once. The price is that a person has to guide the proof.
The tools
The first tools for this method appeared in the 1970s. Today there is a variety of tools, some more automatic than others. Well-known ones include:
- ACL2 (A Computational Logic for Applicative Common Lisp), a successor to the Boyer-Moore prover NQTHM
- NQTHM, the earlier Boyer-Moore theorem prover
- PVS, the Prototype Verification System from SRI
- HOL (the original post listed this as "HOLY"), a family of higher-order logic provers
- Isabelle, a generic proof assistant most often used with higher-order logic
- STeP, the Stanford Temporal Prover
This technique requires strong user expertise and time-intensive guidance of the proof. The usual theorem provers are based on first-order predicate logic, higher-order predicate logic, recursive functions and induction. ACL2, for example, is a first-order logic of total recursive functions with mathematical induction.
Brush up on the basics
First-order predicate logic: predicate logic in which predicates take only individuals as arguments and quantifiers bind only individual variables.
Induction: a powerful technique for proving that a theorem holds for all cases in a large or infinite set. The proof has two steps, the basis and the induction step. Roughly, the basis proves the theorem for the "ancestor" case, and the induction step proves that if it holds for one case it holds for the "descendant" cases.
Higher-order predicate logic: predicate logic in which predicates take other predicates as arguments and quantifiers bind predicate variables. For example, second-order predicates take first-order predicates as arguments, and order-n predicates take order n−1 predicates as arguments (n > 1).
In summary
Theorem proving tools use a sophisticated combination of decision procedures, conditional rewriting, induction and recursion, propositional simplification, and heuristics to orchestrate all of it. A tool such as ACL2 also gets stronger over a project, because every lemma the user proves becomes a rule it can use automatically in later proofs.
Bottom line: very powerful, mainly at the algorithmic level. However, you should go get an expert.
Deep dive: the numbers and details
This part holds a small worked proof, a real industrial case and a comparison table. Skip it if the overview is all you need.
A worked induction proof: a ripple-carry adder of any width
Here is the kind of statement a theorem prover handles well and a simulator cannot: an n-bit ripple-carry adder computes the right sum for every n.
- Definitions. Let the bit vectors a and b have value An = Σ ai2i and Bn = Σ bi2i for i from 0 to n−1. The adder produces sum bits si and a carry ci+1 from a full adder at each position, with si + 2ci+1 = ai + bi + ci.
- Theorem. For every n ≥ 0: Sn + 2ncn = An + Bn + c0, where Sn is the value of the sum bits.
- Basis (n = 0). All sums are empty, so the statement reads c0 = c0. True.
- Induction step. Assume it holds for n. Then Sn+1 + 2n+1cn+1 = Sn + 2n(sn + 2cn+1) = Sn + 2n(an + bn + cn) = (Sn + 2ncn) + 2nan + 2nbn, which by the hypothesis equals An+1 + Bn+1 + c0.
One proof covers an 8-bit, a 64-bit and a 1,024-bit adder. Exhaustive simulation of just the 64-bit case would need 2129 input combinations, about 6.8 × 1038. At a billion test vectors per second, that would take on the order of 1022 years.
An industrial case: AMD K5 floating-point division
In 1994, Thomas Nicely found that Intel's Pentium gave wrong results for some floating-point divisions. According to the account of the Pentium FDIV bug, five entries of the division lookup table that should have held +2 held zero, and on January 17, 1995 Intel announced a pretax charge of $475 million to replace the flawed processors.
Shortly afterwards, J Strother Moore, Tom Lynch (the designer of the algorithm) and Matt Kaufmann used ACL2 to prove the AMD K5 floating-point division microcode correct: for every pair of double-extended operands with a non-zero divisor and every supported rounding mode, the result equals the correctly rounded quotient, and every intermediate value fits the hardware allocated to it. The work was published in IEEE Transactions on Computers in September 1998. It is a classic example of theorem proving applied to exactly the kind of arithmetic where simulation fails.
Theorem proving compared with other formal methods
| Property | Equivalence checking | Model checking | Theorem proving |
|---|---|---|---|
| Question answered | Are two designs the same? | Does a property hold in every reachable state? | Does the implementation satisfy the specification, as a theorem? |
| Automation | Fully automatic | Mostly automatic | Interactive, needs guidance |
| Design size limit | Very large netlists | Limited by state explosion | No hard limit; limited by human effort |
| Parameterized designs | No | Usually fixed size | Yes, any width or depth |
| Typical use | RTL versus netlist after synthesis | Control logic, protocols, assertions | Arithmetic units, algorithms, protocols, processor models |
When to use it
- When a bug escape would be very expensive, such as arithmetic in a processor or a security-critical block.
- When the design is parameterized and you need a guarantee for every size.
- When the algorithm can be specified cleanly in mathematics, so the theorem is meaningful.
Common mistakes
- Proving the wrong theorem. A proof is only as good as its specification, so review the specification as carefully as the design.
- Proving a model that does not match the RTL. Tie the model to the real design, for example by equivalence checking or by translating the RTL directly.
- Starting without an expert. Proof effort grows quickly when the lemma library is weak.

Your comments will be moderated before it appears here.