QiMeng-TheoremV: Agentic Theorem Proving with Speculated IRs for Large-Scale RTL Formal Verification
Authors: Chenrui Cao, Chongxiao Li, Yutong Wu, Hongqin Lyu, Di Huang, Chuanhao Wang, Lei Zhang, Chao Wang, Tian Zhi, Rui Zhang, Zidong Du, Qi Guo, Xing Hu, Yunji Chen
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 · Institute of AI for Industries, Chinese Academy of Sciences, Nanjing, China
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
TABLE I: Comparing TheoremV with recent RTL theorem proving work.
Fig. 1: Comparison of proof decomposition strategies for fma_f32 . (a) Speculated IR decomposition. (b) Structural decomposition.
Fig. 2: Overview of TheoremV. (1) Front-end translation: Verilog/SystemVerilog DUVs and C/Sail reference models are translated into executable Lean 4 state machines. (2) Agentic proof decomposition: A counterexample-guided workflow proposes, differentially filters, and revises Speculated IRs to decompose the equivalence proof into local refinement lemmas, which subagents prove in parallel for the main agent to compose the whole proof.
Fig. 3: Semantic decomposition of FDIV via Speculated IR models: (a) SoftFloat REF; (b) Fudian radix-4 DUV; (c) IRSRT (purple, SRT integer contract) and IR754 (blue, exact division and IEEE 754 rounding); (d) full-design equivalence for all inputs, rounding modes.
Fig. 4: Eliminating false combinational loops via per-output evaluation. (a) Monolithic invocation creates a false a→x cycle; (b) Inside add , x is constant and y=a+b , with no path from a to x ; (c) Per-output evaluation computes xout first (defaulting unused inputs to 0 ) and then yout with a=xout .
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 ( >24 h)
Build TO ( >1 h)
8h 34m
6.12M
7h 58m
6.94M
fdiv
TO ( >24 h)
Build TO ( >1 h)
20h 34m
13.04M
10h 46m
12.42M
fma
TO ( >24 h)
Build TO ( >1 h)
TO ( >48 h)
29h 39m
63.61M
CMAC
TO ( >24 h)
Unsup. Verilog syntax
10h 01m
7.25M
6h 48m
9.31M
TABLE II: Verification capabilities and resource overhead across benchmarks. TO denotes timeout (exceeding the respective wall-clock limits); Unsup. denotes unsupported.
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
TABLE III: Scale of Lean models and proofs across benchmarks.
Constructing helper assertions is a major challenge in scaling formal verification (FV) to complex RTL designs. Target properties can remain unresolved even if running the engine for months, and recent LLM-based approaches have had limited success on large designs. We study this challenge through proof graphs that capture dependencies among target properties and helper assertions. Our analysis identifies three recurring failure modes of LLM agents. To address them, we combine behavioral modeling and spurious-loop search to construct proofs with high depth and dense connectivity. We further define a progress measure on the proof graph and use it as a dense reward to train a customized model. Across 587 target properties spanning 13 design families, our approach proves 80.5% of targets on average across families, compared with 36.4% for the strongest baseline. It is also the only evaluated method to prove all 104 targets of a 68.4K-line production design. On production targets, helper-strengthened proofs have a median checking time of 7.3 minutes, while the proof engine alone leaves these targets unresolved after 12 hours.
Large language models (LLMs) have shown strong promise in specification-to-RTL generation. Among the explorations, the self-correction paradigm has significantly advanced LLM-based RTL generation. However, two challenges limit further progress. Existing benchmarks are saturated by advanced LLMs, leaving little room to evaluate the agentic self-correction framework. The monolithic self-correction paradigm rewrites the entire design at once, where LLMs are susceptible to error confusion and corruption of originally correct code. To address the benchmark challenge, we contribute ScaleBench, a more challenging benchmark of 200 complex RTL designs. To address the challenge in methodology, we propose CorrectRTL, an agentic framework that realizes a new decompose-then-correct paradigm, in which the LLM agent explicitly decouples scaffold construction from detailed implementation. CorrectRTL contributes three core techniques: (1)Structure-oriented decomposition, (2)Snippet-based RAG, and (3)~SVA-based self-correction. On ScaleBench, CorrectRTL improves Pass@1 from 20.5% to 49.0% (+28.5%). On VerilogEval, CorrectRTL achieves up to 96.1% Pass@1, demonstrating consistent improvements across both simple and complex designs.
Jing Wang, Shang Liu, Hangan Zhou +4
Hong Kong University of Science and Technology Clear Water Bay, Hong Kong
Verification consumes the majority of modern chip design effort, yet the formal verification tools that provide mathematical guarantees of correctness remain expensive and restrictively licensed. While large language models (LLMs) have shown promise for hardware design, existing approaches to RTL repair validate their results through simulation - which exercises only a subset of inputs - or rely on commercial tools, and few combine formal proof with an entirely open-source toolchain. In this paper, we present a multi-agent pipeline that couples an LLM with an open-source formal backend (Yosys, SymbiYosys, and Z3) to repair RTL through counterexample-guided iteration: the framework generates formal properties, verifies the design, and feeds counterexamples back to the LLM until the design is proved correct by k-induction or an iteration budget is exhausted. Through an ALU case study, we show that the pipeline can detect and repair a real functional bug with a formal proof of correctness. Across a six-benchmark suite, one design is repaired reliably, and we characterize four distinct failure modes: bounded-cover vacuity, specification ambiguity, temporal-logic bugs, and multi-property pressure. We frame this work as a feasibility study with a detailed failure analysis, and additionally report a practical limitation of the Yosys bind directive relevant to the open-source formal verification community.