Search arXiv⌕ Search

arXiv · 2611.07882

Compositional Loop Invariant Inference for Multiphase Programs via Structured Neurosymbolic Reasoning

Abstract

Loop invariants are essential for deductive program verification, yet automatically inferring them for {multiphase programs}, whose loops contain conditional branches that induce multiple execution phases with distinct behaviors, remains an open problem. Existing LLM-based methods either reason about loops as a whole or use explicit branch information to generate atomic assertions jointly across branches, without maintaining complete candidate sub-invariants for independent generation and targeted repair. We present CLOVER, a structured neurosymbolic reasoning framework for multiphase invariant inference built on two interlinked mechanisms. First, compositional inference: CLOVER statically decomposes a loop into symbolic {loop branch sequences}, conjunctions of the loop guard and branch conditions that characterize distinct execution scenarios, and guides the LLM to generate candidate sub-invariants for each one independently, so that each LLM query focuses on a single execution scenario rather than the entire loop. Second, counterexample-guided localized refinement: when SMT verification rejects a composed disjunctive invariant, CLOVER traces the counterexample back through the branch structure to identify which specific loop branch sequence caused the failure and repairs only that sub-invariant, preserving all correct components. Both mechanisms are unified by a shared symbolic structure derived from the loop's branch semantics, which guides what the LLM generates, how candidates are composed, and where refinement is directed. We evaluate CLOVER on 316 linear arithmetic, 50 nonlinear arithmetic, and 54 multiphase benchmarks. CLOVER solves 35 of 54 multiphase benchmarks, outperforming the best LLM-based baseline (29) by 20.7\% and the best traditional method (22) by 59.1\%. On linear/nonlinear benchmarks, CLOVER remains competitive, solving 355 of 366 programs overall.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Mingxiu Wang, Jiawei Wang, Shuangxiang Kan, Angela Huo, Yuekang Li, Xi Zheng, Xiao Cheng. 2026-11-05. Compositional Loop Invariant Inference for Multiphase Programs via Structured Neurosymbolic Reasoning. https://arxiv.org/abs/2611.07882

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related papers

Characterizing Robustness in Semantic Code Clone Detection

Semantic code clone detection seeks to recognize shared functionality across different implementations, making robustness to behavior-preserving changes central to its effectiveness. Prior studies have exposed failures under such changes, motivating a systematic examination of how sensitivity varies with the rewrites used for evaluation. We present Systematic Code Transformation (SCT), a framework organizing 51 operators by code level, target, and edit category, and evaluate 14 token, tree, graph, and prompt-based detectors on BigCloneBench, Google Code Jam, and OJClone. By comparing transformation groups, repeated application, and alternative constructions, we connect overall performance changes with specific rewriting conditions. Of 25 token, tree, and graph detector and dataset combinations starting above 90% F1, 21 lose at least 10 percentage points under the composition of all operators. These losses vary with transformation type and application intensity, but are not determined by edit counts or code growth alone. Even at matched locations and edit counts, alternative constructions can expose different errors despite similar aggregate losses. Further analysis distinguishes reduced score separability from changed fixed-threshold decisions with retained ranking ability, revealing different scope for threshold recovery. Overall, these findings show why benchmark effectiveness needs to extend to stable discrimination across equivalent implementations and how systematic transformation testing can assess that capability.

cs.SE↗

Vibe Coding in Software Development: A Multivocal Literature Review

Vibe coding is an AI-assisted software development approach in which developers express intent in natural language and large language models generate code. To our knowledge, no review has synthesized academic and practitioner sources under a common protocol. We conducted a multivocal literature review of publications from January 2022 to 9 September 2026, identified through searches in October 2025 and September 2026. After assessing source quality and credibility, we analyzed 266 sources (76 peer-reviewed, 190 grey) across eight research questions: 146 were direct, 93 adjacent, and 27 background. Presence and outcome findings receive reporting-support and evidence-strength labels, respectively. The second author conducted twelve checks; pre-reconciliation agreement was low in several, but substantial for the final directness rule and moderate for the outcome fields, which were checked in full. Sources describe a generation-evaluation-revision loop, with developer work shifting from writing code toward directing, supervising, and validating. Productivity is reported in 109 of the 159 sources contributing to the outcome question, of which 22 provide assertions only; these counts indicate reporting, not effect size. Most comparable sources report short-term productivity gains and long-term maintainability costs, but both receive Weak evidence-strength labels because some comparable sources report opposing directions. Short-term quality and defects are labeled Weak. Long-term productivity, long-term quality, and short-term reproducibility are labeled Moderate. Prototyping is reported more often than production use, and user-interface work more often than data and machine-learning work, but task-domain evidence is sparse. Future work should evaluate safeguards, session-level dynamics, long-term maintainability, and production use.

cs.SE↗

How Should Agents See Code? Rethinking Code Representations for Agentic Software Engineering

LLM agents are increasingly used for repository-level software engineering tasks. However, most agents still access repositories through raw files, lexical search, and shell commands, treating code primarily as text. This paper investigates map-based code-representation workflows as a design variable in agentic software engineering, examining how different repository views change agents' retrieval behavior, task success, token use, and latency. In this paper, we study five code-representation workflows: abstract syntax trees, call graphs, module dependencies, documentation-enriched search, and a hybrid workflow that combines them. Each workflow exposes a repository map that the agent can query during a task. We evaluate Claude Code with Haiku 4.5 against a raw-tool baseline on four repository-level tasks: fault localization with LinuxFLBench, repository-level code generation and repair with SWE-bench Pro, test generation with SWT-bench, and security patching with SecBench. The results show that representation workflows are most useful as token-saving tools when localization is the bottleneck, while their success gains narrow when the decisive step is patch or test authoring. On LinuxFLBench, all five workflows improve recall@10 over the baseline (0.757-0.829 vs. 0.717) and reduce token usage by 25-39%. On SWE-bench Pro, resolution remains close to the baseline (44.3-50.6% vs. 49.0%) while token usage drops by 17-26%. On SecBench, Callgraph has the highest patch-resolution rate in this sample (34.3% vs. 28.9%) and uses fewer tokens, but all workflows increase latency. On SWT-bench, Hybrid and Docs have the highest reproducing-test rates in this sample (47.8% and 47.2% vs. 44.7%), but all workflows use more tokens and take longer. Overall, map-based workflows change both what the agent inspects and how much it spends, but their benefits are task-dependent rather than universal.

cs.SE↗