ArXiv TLDR

KVerus: Scalable and Resilient Formal Verification Proof Generation for Rust Code

🐦 Tweet
2605.03822

Yuwei Liu, Xinyi Wan, Yanhao Wang, Minghua Wang, Lin Huang + 1 more

cs.SEcs.CR

TLDR

KVerus enables scalable and resilient formal verification for Rust code by bridging the Semantic-Structural Gap with a self-adaptive, retrieval-augmented system.

Key contributions

  • Bridges the Semantic-Structural Gap for scalable, resilient Rust formal verification.
  • Employs a dynamic knowledge base, dependency-aware analysis, and error-driven self-refinement.
  • Outperforms AutoVerus (80.2% vs 56.9%) and baselines on single-file and repo-level benchmarks.
  • Successfully verified 23 previously unverified functions in the Asterinas Rust OS kernel.

Why it matters

Formal verification is crucial but struggles with large, evolving systems. KVerus offers a solution by making proof generation robust to code changes and complex dependencies. This advances the practical application of formal verification, especially for security-critical software.

Original Abstract

Formal verification provides the highest assurance of software correctness and security, but its application to large-scale, evolving systems remains a major challenge. While large language models (LLMs) have shown promise in automating proof generation, they often fail in real-world settings due to their inability to handle complex cross-module dependencies or changes in the codebase or the verification toolchain. We identify the fundamental problem as the Semantic-Structural Gap: LLMs operate on semantic code patterns, whereas formal verification is governed by rigid structural dependencies, a disconnect that leads to brittle, unsustainable proofs. To bridge this gap, we propose a new paradigm of self-adaptive verification and present KVerus, a retrieval-augmented system for Verus-based Rust verification that can adapt to an evolving software environment. KVerus constructs a dynamic knowledge base of code metadata, lemma semantics, and toolchain specifics. By combining dependency-aware program analysis, semantic lemma indexing, and error-driven self-refinement, it can navigate intricate cross-file dependencies to synthesize proofs and automatically repair proofs when faced with common evolutionary changes. Across three single-file benchmarks, KVerus verifies 80.2% of tasks, outperforming the state-of-the-art AutoVerus (56.9%) and degrades less than AutoVerus under breaking Verus updates. On three repository-level benchmarks with cross-file dependencies, KVerus achieves a 51.0% success rate, compared to 4.5% for a multi-round prompting baseline. Finally, on the Asterinas Rust OS kernel, KVerus produces upstream-accepted proofs that verify 23 previously unverified functions (21.0% of proof code) in the memory-management module. KVerus represents a significant step towards making formal verification a scalable and sustainable practice for modern, security-critical software.

📬 Weekly AI Paper Digest

Get the top 10 AI/ML arXiv papers from the week — summarized, scored, and delivered to your inbox every Monday.