TRANSMISSION // 2610.35523v2

How an LLM and a verifier team up to prove loops stop

Source published

RAINFALL asks a language model to propose loop-termination proofs, checks them symbolically and uses diagnostics to guide revisions. On two benchmark suites, it proved termination for 333 of 358 programs.

AI-generated conceptual illustration for How an LLM and a verifier team up to prove loops stop
AI-generated conceptual illustration; not documentary evidence.

A language model can suggest why a computer-program loop should eventually stop. But a plausible explanation is not a proof. RAINFALL pairs model-generated candidates with symbolic checks intended to verify them, then feeds failures back for another attempt.

A loop that runs forever can stall software, but proving that a loop always stops is not straightforward. One established approach is to find a ranking function: a measure of the program’s state that decreases with each loop iteration and cannot decrease forever. The challenge is finding a suitable measure, especially when a loop’s behavior changes in stages or a simple formula does not work.

The paper introduces RAINFALL, a system that uses a large language model (LLM) to propose ranking functions and a symbolic verifier to check them. Its central question is whether structuring the model’s task around verification and revision can help it produce more valid termination proofs than the evaluated alternatives.

From code completion to checked proof

Rather than asking the LLM to invent a proof in an open-ended response, RAINFALL inserts four marked slots into a C program containing a loop. The model fills in declarations for auxiliary variables, code to record and update proposed ranking values, and assertions expressing the conditions needed for a termination argument. The paper describes this as a constrained code-completion task.

The system checks the completed program in stages. First, it compares the original and generated programs’ abstract syntax trees (ASTs), after removing inserted assertions, to check that the original code was not syntactically modified. It also checks that the inserted code and assertions are complete. A safety verifier then checks whether the assertions hold. If a check fails, RAINFALL turns the diagnostic—such as a counterexample showing where an assertion breaks—into natural-language feedback for another model attempt. The process stops when a candidate passes verification or the available query or time budget runs out.

The AST comparison is not a general proof that the instrumentation preserves behavior. The authors note that instrumentation can still alter program behavior in some cases, for example if assignments to auxiliary “ghost” variables have side effects. They add checks intended to rule out such effects, but acknowledge that these cases should be considered. More broadly, the model proposes a candidate; its output is not treated as proof merely because it looks reasonable. A candidate that passes the framework’s checks provides a verified ranking function under the framework’s assumptions. If the system cannot establish that, it returns “Unknown,” rather than claiming the loop terminates.

What the evaluation reports

The authors tested RAINFALL on two public benchmark suites containing 358 terminating C programs. With DeepSeek-V4.1-Flash, it produced verified ranking functions for 333 programs, or 93.02%, in the reported setup. The paper reports that this exceeded every evaluated baseline: PROTON 2.1 proved 311 programs and LOOPY 314 across the combined suites. Pairing RAINFALL with PROTON 2.1 raised the total to 346 of 358, or 96.65%.

The team also ran component tests on one suite, containing 170 programs. In a one-query comparison, removing few-shot examples reduced the number solved from 145 to 140. A version that fed back only a rejection, rather than detailed diagnostics, solved six fewer programs than the full system in the reported comparison. The authors tested other LLMs too: performance varied, and RAINFALL with Qwen-Plus did worse than several evaluated tools. The results therefore depend in part on which model supplies candidates.

Scope and uncertainty

These benchmark results do not guarantee that RAINFALL will handle arbitrary software. The evaluation covers selected public suites, not the full SV-COMP termination benchmark or a broad collection of real-world programs. The paper notes possible benchmark contamination: models may have encountered publicly available benchmark code during training. The authors say they know of no public benchmark containing RAINFALL’s particular code-assertion format, but that does not rule out contamination.

The system also depends on its symbolic verifier. The authors use UAutomizer and acknowledge that performance could differ with another verifier. Some attempts failed because verification timed out, even when the generated candidate may have been valid. Thus, “not proved” does not necessarily mean “does not terminate.” The method focuses on programs with a single while-loop; other loop structures are outside its main evaluation.

The supplied manuscript has an IEEE Transactions on Software Engineering header with placeholder volume and acceptance details. The source is an arXiv preprint, so these findings should be understood as the authors’ reported results, not as confirmation of peer-reviewed publication. The comparisons offer evidence for a generate-check-revise approach on these benchmarks; broader testing would be needed to show how well it transfers to other programs and verification settings.

Reviewed cross-references

These connections were reviewed by a model, not independently fact-checked by a human. Similarity does not imply agreement; consult the original papers and the evidence below.

  • Whiel checks AI-assisted proofs of database program correctness

    Shared method: Both systems use iterative neural proposals checked by symbolic tools, with verifier feedback guiding further search: RAINFALL refines candidate ranking functions using verification diagnostics, while Whiel sends rejected clauses and verification results back to its proposer. The shared method is bounded to this generate-check-refine pattern; the systems address different verification tasks, and Whiel additionally describes a separate Lean certification stage.

    Model review: · openai-codex/gpt-6-luna

    Evidence and provenance

    Selected excerpts, not complete papers. PDF extraction can omit figures or damage equations, tables and reading order; sources may be preprints.

    • 2610.35523v2 — Original paper

      Excerpt reference: static/papers/2610.35523v2.md:177-241
      Basis: Paper text
      Source SHA-256: e7bf258708583c5dfb928da062ecb64ca5c857c4e794035d2dab9af50c9fd553

    • 2611.05612v1 — Original paper

      Excerpt reference: static/papers/2611.05612v1.md:1431-1503
      Basis: Paper text
      Source SHA-256: 21ae94009eb51a0e44975994a121a47d311f227bf4c7dd980b672690f897d5d4

Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.