Skip to content

When is LLM-Based Program Reasoning Correct? A Completion Semantics for LLM-Based Code Inference

Jul 2026 · arXiv.org · Vol abs/2607.12490 · 0 citations · 45 references
Computer Science

TL;DR

The results show that witness generation effectively distinguishes inferences supported by plausible completions from those requiring unrealistic assumptions, providing a practical mechanism for validating reasoning over incomplete programs.

Abstract

Due to token and cognitive limits, Large Language Models (LLMs) typically perform program reasoning over incomplete code fragments/prompts rather than complete programs. Such reasoning therefore must rely on {assumptions about omitted code and context. As a result, the meaning of an inference over a program fragment is not absolute, but depends on an implicit completion model describing how the fragment may be refined into a complete program. In this paper, we introduce completion semantics for LLM-based program reasoning. We formalize incomplete programs as denoting a space of possible refinements and define the correctness of existential inferences relative to a completion model. Under this view, a reported bug is correct whenever there exists a completion within the model that witnesses the bug. This perspective explains why many LLM-generated reports are neither simply correct nor incorrect, but instead depend on assumptions about omitted context. We have instantiated our approach in the form of a witness-generation workflow that concretizes completions underlying an inference by constructing executable refinements of the original program fragment. Witnesses serve both as evidence for existential claims and as a mechanism for exposing the assumptions required to support them. We evaluate our approach on real-world LLM-generated bug reports and program-analysis tasks. Our results show that witness generation effectively distinguishes inferences supported by plausible completions from those requiring unrealistic assumptions, providing a practical mechanism for validating reasoning over incomplete programs.

View source

Similar papers

Preprint Jul 2026

Teaching Code LLMs to Reason with Intermediate Formal Specifications

This paper introduces SpecCoder, a verification-guided CodeLLM training framework that learns from validated reference programs, behavior-changing mutants, and multi-turn specification-refinement traces, and improves checkpoint-specification quality over base CodeLLMs, and introduces HumanExec, a benchmark built from r...

Minh Le-Anh, Cuong Chi Le, Tien N. Nguyen · 0 citations
Jul 2026

Mizzle: A Complete Concurrent Incorrectness Logic for Preventing False Alarms in Agentic Bug Finding

Mizzle is presented, an incorrectness separation logic for concurrent programs written in a substantial subset of OCaml, parametric in the notion of incorrectness, and it is proved that it is both sound and complete, so that no real bug is ruled out for want of a derivation.

Alexandre Moine, Sam Westrick, Joseph Tassarotti · 0 citations
2026

SAT Modulo Well-Founded Semantics

It is shown that the choice operator can be materialized by a SAT solver while propagating the consequences of choices through an extension of the alternating fixpoint algorithm for WFS with conflicts that are propagated back to the SAT solver.

Thomas Eiter, Tobias Nießen, Davide Soldà et al. · 0 citations
Jul 2026

AoA: Theorem Proving Agent over Abstract Syntax Tree of Redesigned Language

AoA lifts the agent off source text and onto the abstract syntax tree (AST): the model supplies proofs as JSON representations of Minilang's AST and drives the prover through a tree-edit model that fuses proof operations and states into one proof tree, so each operation carries its own subgoal's state, readable directl...

Qiyuan Xu, Joshua Ong Jun Leang, Renxi Wang et al. · 0 citations
Preprint Jul 2026

BeSpec: Behavior-Level Specification Alignment for Code Generation

BeSpec is presented, a behavioral model-based approach to specification alignment that treats the task description as partial evidence about the intended behavior of the correct program, and first builds an explicit behavioral model, which are checkable properties that valid outputs must satisfy.

Qinghua Xu, Guancheng Wang, Boxi Yu et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.