From Natural Language to Verified Code: Toward AI Assisted Problem-to-Code Generation with Dafny-Based Formal Verification
Department of Computer Science, The University of Alabama(阿拉巴马大学计算机科学系);The University of Alabama(阿拉巴马大学);Alabama Water Institute, The University of Alabama(阿拉巴马水研究院,阿拉巴马大学)
Md Erfan, Md Kamal Hossain Chowdhury, Ahmed Ryan, Md Rayhanur Rahman
Large Language Models (LLMs) show promise in automated software engineering, yet their guarantee of correctness is frequently undermined by erroneous or hallucinated code. To enforce model honesty, formal verification requires LLMs to synthesize implementation logic alongside formal specifications that are subsequently proven correct by a mathematical verifier. However, the transition from informal natural language to precise formal specification remains an arduous task. Our work addresses this by providing the NaturalLanguage2VerifiedCode (NL2VC)-60 dataset: a collection of 60 complex algorithmic problems. We evaluate 11 randomly selected problem sets across seven open-weight LLMs using a tiered prompting strategy: contextless prompts, signature prompts providing structural anchors, and self-healing prompts utilizing iterative feedback from the Dafny verifier. To address vacuous verification, where models satisfy verifiers with trivial specifications, we integrate the uDebug platform to ensure functional validation. Our results show that while contextless prompting leads to near-universal failure, structural signatures and iterative self-healing facilitate a dramatic performance turnaround. Specifically, Gemma 4-31B achieved a 90.91\% verification success rate, while GPT-OSS 120B rose from zero to 81.82\% success with signature-guided feedback. These findings indicate that formal verification is now attainable for open-weight LLMs, which serve as effective apprentices for synthesizing complex annotations and facilitating high-assurance software development.
VerMCTS: Synthesizing Multi-Step Programs using a Verifier, a Large Language Model, and Tree Search
Kempner Institute at Harvard University(哈佛大学肯普纳研究所);Harvard University(哈佛大学);TU München(慕尼黑工业大学);Northeastern University(东北大学);University of Alabama at Birmingham(阿拉巴马大学伯明翰分校);University of Oxford(牛津大学)
MutDafny: A Mutation-Based Approach to Assess Dafny Specifications
INESC TEC, Faculdade de Engenharia, Universidade do Porto(波尔图大学工程学院);Faculdade de Engenharia, Universidade do Porto & LASIGE, Universidade de Lisboa(波尔图大学工程学院)
Trustworthy Software Project Generation : a Case Study with an Interactive Theorem Prover
Key Laboratory of High Confidence Software Technologies (Peking University), Ministry of Education(教育部高可信软件技术重点实验室;北京大学计算机学院);School of Computer Science Peking University
Vero: Can AI Agents Build Formally Verified Software Repositories?
University of Chicago(芝加哥大学);California Institute of Technology(加州理工学院);Stanford University(斯坦福大学);UC Berkeley(加州大学伯克利分校);Amazon Web Services(亚马逊云计算服务);Apodex