arXiv:2601.11840cs.AIcs.LO2026-01

用AI+符号推理精准分析代码逻辑,提升软件理解可靠性。

Imandra CodeLogician: Neuro-Symbolic Reasoning for Precise Analysis of Software Logic

  • 用大模型构建形式化代码模型,结合自动推理引擎分析程序行为。
  • 在测试中将推理准确率提升41至47个百分点,显著优于纯大模型。
  • 适合需要高可靠性的金融与安全关键系统代码分析场景。

大型语言模型在代码理解任务中表现优异,但缺乏对程序行为进行精确、全面的数学推理能力。现有基准要么聚焦于与现实软件脱节的数学证明自动化,要么关注不需语义严谨性的工程任务。本文提出CodeLogician,一种集成ImandraX(应用于金融与安全关键系统的工业级自动推理引擎)的神经符号代理,用于精确分析软件逻辑。不同于以往仅用形式方法验证LLM输出的做法,CodeLogician利用LLM构建软件系统的显式形式模型,使自动化推理能回答超越二元验证结果的丰富语义问题。为严格评估软件逻辑中的数学推理能力,我们引入code-logic-bench,一个介于定理证明与软件工程基准之间的新基准,衡量对程序状态空间、控制流、覆盖约束及边缘情况的推理正确性,其真值通过形式建模与区域分解定义。对比纯LLM推理与增强后的代码逻辑分析,形式增强使推理准确率提升41至47个百分点。结果表明,神经符号融合是实现可扩展、自主软件理解的关键。

原文摘要 · Abstract (English)

Large Language Models (LLMs) have shown strong performance on code understanding tasks, yet they fundamentally lack the ability to perform precise, exhaustive mathematical reasoning about program behavior. Existing benchmarks either focus on mathematical proof automation, largely disconnected from real-world software, or on engineering tasks that do not require semantic rigor. We present CodeLogician, a neurosymbolic agent for precise analysis of software logic, integrated with ImandraX, an industrial automated reasoning engine deployed in financial markets and safety-critical systems. Unlike prior approaches that use formal methods primarily to validate LLM outputs, CodeLogician uses LLMs to construct explicit formal models of software systems, enabling automated reasoning to answer rich semantic questions beyond binary verification outcomes. To rigorously evaluate mathematical reasoning about software logic, we introduce code-logic-bench, a benchmark targeting the middle ground between theorem proving and software engineering benchmarks. It measures reasoning correctness about program state spaces, control flow, coverage constraints, and edge cases, with ground truth defined via formal modeling and region decomposition. Comparing LLM-only reasoning against LLMs augmented with CodeLogician, formal augmentation yields substantial improvements, closing a 41-47 percentage point gap in reasoning accuracy. These results demonstrate that neurosymbolic integration is essential for scaling program analysis toward rigorous, autonomous software understanding.

神经符号代码分析形式化验证大模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。