QiMeng-TheoremV: Agentic Theorem Proving with Speculated IRs for Large-Scale RTL Formal Verification
Organizations: University of Science and Technology of China, Hefei, China · State Key Lab of Processors, Institute of Computing Technology, Chinese Academy of Sciences, Beijing, China · University of Chinese Academy of Sciences, Beijing, China · Cambricon Technologies, Beijing, China ·
Abstract
As LLMs speed up automated Register-Transfer Level (RTL) code generation, verifying that generated designs meet their specs has become a key bottleneck. We present TheoremV, an agentic framework that uses Lean 4 theorem proving to automatically build complete proofs of end-to-end functional equivalence between large-scale RTL designs and high-level reference models. TheoremV bridges two gaps: the abstraction gap between cycle-accurate RTL and high-level reference models, and the representation gap between RTL and proof languages. For the abstraction gap, TheoremV introduces Speculated IRs: an LLM agent proposes candidate intermediate models, quickly filters out bad ones via differential simulation, and revises them using proof feedback, breaking an end-to-end proof across abstraction levels into a chain of equivalence lemmas. For the representation gap, a Yosys-based RTL-to-Lean compiler keeps industrial frontend coverage while preserving word-level signals and module hierarchy, and port-level dependency analysis removes false combinational loops at module interfaces. On tasks where commercial high-level equivalence checkers time out and existing automated provers fail, TheoremV proves the functional equivalence of silicon-proven floating-point and matrix units (XiangShan Fudian and NVDLA CMAC) against high-level reference models, as well as the PicoRV32 core against the official RISC-V Sail spec, finding a real RISC-V spec bug (in the FENCE instruction) in PicoRV32.
Figures & tables
| Aspect | Chicala [ 1 ] | Rtl2lean [ 2 ] | Circuit-Prover [ 3 ] | Infini-Verif [ 4 ] | TheoremV (Ours) |
| Frontend | Chisel | PySlang | Chisel | CIRCT | Yosys |
| Syntax cov. | Narrow | Narrow | Narrow | Medium | Large |
| End-to-end equiv. | ✗ | ✗ | ✗ | ✗ | ✓ |
| Automated | ✗ | ✓ | ✓ | ✓ | ✓ |
| Abstraction | Manual inv. | 4-tier split | Lemma reuse | Circuit semantic lifting | Speculated IRs |
| Benchmarks | Xiangshan / Rocket Mul/Div | 6 RTL designs from Opencores | 63 circuits, Xiangshan / Rocket Mul/Div | MIPS, Ibex, Spatz | Fudian, CMAC, PicoRV32 |
| Benchmark | HEC | Rtl2lean | Ours (w/o Speculated IR) | Ours | ||
| Time | Time | Time | Tokens | Time | Tokens | |
| fadd | 25s | Lean syntax error | 8h 51m | 7.62M | 8h 03m | 2.39M |
| fmul | TO ( h) | Build TO ( h) | 8h 34m | 6.12M | 7h 58m | 6.94M |
| fdiv | TO ( h) | Build TO ( h) | 20h 34m | 13.04M | 10h 46m | 12.42M |
| fma | TO ( h) | Build TO ( h) | TO ( h) | 29h 39m | 63.61M | |
| CMAC | TO ( h) | Unsup. Verilog syntax | 10h 01m | 7.25M | 6h 48m | 9.31M |
| Benchmark | DUV LoC | REF LoC | Proof LoC | Theorems |
| fadd | 762 | 1,438 | 1,826 | 74 |
| fmul | 1,318 | 1,238 | 21,782 | 1,355 |
| fdiv | 2,233 | 1,337 | 35,026 | 1,631 |
| fma | 2,186 | 5,367 | 170,923 | 5,605 |
| CMAC | 35,320 | 561 | 121,175 | 15,521 |
| PicoRV32 | 1,240 | 56,482 | 77,580 | 2,609 |
Formal Hardware Verification
Formal hardware verification uses mathematical methods to prove that RTL designs satisfy safety, temporal, security, and equivalence properties.
See all 38 papers