Doc2Spec: Synthesizing Formal Programming Specifications from Natural Language via Grammar Induction
Not on the map. Why?
Abstract (arXiv)
Ensuring that API implementations and usage comply with natural language programming rules is critical for software correctness, security, and reliability. Formal verification can provide strong guarantees but requires precise specifications, which are difficult and costly to write manually. To address this challenge, we present Doc2Spec, a multi-agent framework that automatically induces a domain-specific grammar from natural-language API rules and uses it to guide specification generation. Doc2Spec fixes a domain-agnostic logical skeleton as a grammar template, prompts LLMs to infer domain-specific predicates and sorts, and formalizes each rule within the resulting grammar, turning an unreliable one-shot translation into a sequence of constrained, checkable steps. Across six benchmarks spanning Solidity and Rust, Doc2Spec improves precision by 0.28 and recall by 0.37 over baselines that lack grammar induction or perform it in one unstaged step, demonstrating the benefits of grammar-guided formalization and the staged pipeline. Moreover, its formalized rules enable symbolic-execution tools to uncover 142 previously unknown rule violations, confirming the rules' correctness and practical usefulness.
Key facts. Cited by 2 papers in the map (data through 7 Oct 2026). Builds on 39 of its 65 references that are in the map. First posted on arXiv 30 Jan 2026.
Builds on
39 of 65 references.
References · 39
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2023Large Language Models Can Be Easily Distracted by Irrelevant Contextcited by 820
- 2023LeanDojo: Theorem Proving with Retrieval-Augmented Language Modelscited by 414
- 2023Llemma: An Open Language Model For Mathematicscited by 385
- 2023Logic-LM: Empowering Large Language Models with Symbolic Solvers for Faithful Logical Reasoningcited by 379
- 2022Autoformalization with Large Language Modelscited by 252
- 2023Large Language Models are Versatile Decomposers: Decompose Evidence and Questions for Table-based Reasoningcited by 177
- 2025Which Agent Causes Task Failures and When? On Automated Failure Attribution of LLM Multi-Agent Systemscited by 170
- 2023LINC: A Neurosymbolic Approach for Logical Reasoning by Combining Language Models with First-Order Logic Proverscited by 161
- 2023Multilingual Machine Translation with Large Language Models: Empirical Results and Analysiscited by 156
- 2022Formal Mathematics Statement Curriculum Learningcited by 141
- 2023Baldur: Whole-Proof Generation and Repair with Large Language Modelscited by 118
27 more
- 2023Clover: Closed-Loop Verifiable Code Generationcited by 62
- 2024Towards AI-Assisted Synthesis of Verified Dafny Methodscited by 58
- 2023NL2TL: Transforming Natural Languages to Temporal Logics using Large Language Modelscited by 57
- 2024Enchanting Program Specification Synthesis by Large Language Models using Static Analysis and Program Verificationcited by 55
- 2024DafnyBench: A Benchmark for Formal Software Verificationcited by 54
- 2024SpecGen: Automated Generation of Formal Program Specifications via Large Language Modelscited by 51
- 2023Lemur: Integrating Large Language Models in Automated Program Verificationcited by 49
- 2024Offline Training of Language Model Agents with Functions as Learnable Weightscited by 47
- 2024AutoVerus: Automated Proof Generation for Rust Codecited by 46
- 2023Finding Inductive Loop Invariants using Large Language Modelscited by 35
- 2022Formal Specifications from Natural Languagecited by 33
- 2019TypeWriter: Neural Type Prediction with Search-based Validationcited by 32
- 2024Automated Proof Generation for Rust Code via Self-Evolutioncited by 31
- 2024Divide and Translate: Compositional First-Order Logic Translation and Verification for Complex Logical Reasoningcited by 27
- 2024Towards Neural Synthesis for SMT-Assisted Proof-Oriented Programmingcited by 19
- 2024LOGIC-LM++: Multi-Step Refinement for Symbolic Formulationscited by 14
- 2023Leveraging Large Language Models for Automated Proof Synthesis in Rustcited by 11
- 2025ClassInvGen: Class Invariant Synthesis using Large Language Modelscited by 11
- 2024Laurel: Unblocking Automated Verification with Large Language Modelscited by 10
- 2025VeriStruct: AI-assisted Automated Verification of Data-Structure Modules in Veruscited by 8
- 2025Bridging Natural Language and Formal Specification--Automated Translation of Software Requirements to LTL via Hierarchical Semantics Decomposition Using LLMscited by 8
- 2024Evaluating Large Language Models in Semantic Parsing for Conversational Question Answering over Knowledge Graphscited by 7
- 2020Towards making formal methods normal: meeting developers where they arecited by 2
- 2025SymGPT: Auditing Smart Contracts via Combining Symbolic Execution with Large Language Modelscited by 2
- 2017Automating Deductive Verification for Weak-Memory Programscited by 1
- 2019Towards A Broader Acceptance Of Formal Verification Tools: The Role Of Educationcited by 1
- 2019What should I document? A preliminary systematic mapping study into API documentation knowledgecited by 1
Built on by
Citing papers per year: 2026: 2.
2 papers.