← All papers
First page of QiMeng-TheoremV: Agentic Theorem Proving with Speculated IRs for Large-Scale RTL Formal Verification

QiMeng-TheoremV: Agentic Theorem Proving with Speculated IRs for Large-Scale RTL Formal Verification

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

cs.AR Nov 27, 2026 · v1 cs.AI cs.LO
Compiles RTL designs and reference models into executable Lean 4 models, then uses LLM agents to generate machine-checked Lean equivalence proofs.
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.

Checking that LLM-generated or industrial RTL designs are functionally equivalent to high-level reference models is hard. Model checkers and equivalence checkers hit state-space explosion, and existing automated provers handle only local properties or small blocks.

TheoremV is an agentic framework that compiles RTL (via a Yosys/RTLIL-based RTL-to-Lean compiler preserving word-level signals and module hierarchy) and reference models (via C-to-Lean and Sail-to-Lean translators) into executable Lean 4 models. An LLM agent proposes Speculated IRs, intermediate executable models that are filtered by differential simulation and revised using proof feedback. These IRs split the end-to-end proof into a chain of equivalence lemmas, which are dispatched to subagents in parallel. Port-level dependency analysis removes false combinational loops so the generated Lean state machines are purely functional.

TheoremV proved end-to-end equivalence for the XiangShan Fudian FPU units (fadd, fmul, fdiv, fma), the NVDLA CMAC unit, and the PicoRV32 core against the RISC-V Sail spec. Commercial checkers timed out on most of these and Rtl2lean failed on all of them. The largest proof reached 170,923 lines of Lean, and the work uncovered a real FENCE spec bug in PicoRV32.

BenchmarkHECTheoremV TimeProof LoCTheorems
fadd25s8h 03m1,82674
fdivTO (>24h)10h 46m35,0261,631
fmaTO (>24h)29h 39m170,9235,605
CMACTO (>24h)6h 48m121,17515,521
PicoRV32Unsup.12h 59m77,5802,609
Verification time and Lean proof size per benchmark (TO = timeout; HEC = commercial high-level equivalence checker)