Manuscript Offprint
arXiv:2610.35523Ranking Function Generation with LLMs for Termination
RONGKANG LI*, Key Laboratory of System Software (Chinese Academy of Sciences), China, Institute of Software, Chinese Academy of Sciences, China, and University of Chinese Academy of Sciences, China
JIAXIN HU†, Key Laboratory of System Software (Chinese Academy of Sciences), China, Institute of Software, Chinese Academy of Sciences, China, and University of Chinese Academy of Sciences, China
TAOLUE CHEN, School of Computing and Mathematical Sciences, Birkbeck, University of London, UK
YONG LI‡, Key Laboratory of System Software (Chinese Academy of Sciences), China, Institute of Software, Chinese Academy of Sciences, China, and University of Chinese Academy of Sciences, China
FU SONG§¶, Key Laboratory of System Software (Chinese Academy of Sciences), China, Institute of Software, Chinese Academy of Sciences, China, and University of Chinese Academy of Sciences, China
ZHILIN WU, Key Laboratory of System Software (Chinese Academy of Sciences), China, Institute of Software, Chinese Academy of Sciences, China, and University of Chinese Academy of Sciences, China
Ranking functions are a fundamental technique for proving loop termination, but constructing them manually is challenging and requires substantial expertise. Existing automated approaches are limited when handling, for instance, nonlinear updates and complex control flows in real-world programs. Meanwhile, large language models (LLMs) have recently demonstrated remarkable capabilities across a wide range of software engineering tasks. Motivated by these advances, we explore LLM-based ranking function generation for proving loop termination, a key component of establishing total program correctness.
We propose RAINFALL, a neuro-symbolic framework which follows the generate-verify-refine paradigm and tightly integrates LLMs with symbolic verification. RAINFALL formulates ranking function synthesis as a code-completion task by inserting placeholders into the input program and constraining the LLM to fill four predefined slots for each loop. The completed program is then checked by a symbolic verifier. If
*Also with Nanjing Institute of Software Technology.
†Also with Nanjing Institute of Software Technology.
‡Corresponding author.
§ Also with Nanjing Institute of Software Technology.
¶Corresponding author.
Authors' Contact Information: Rongkang Li, Key Laboratory of System Software (Chinese Academy of Sciences), Beijing, China and Institute of Software, Chinese Academy of Sciences, Beijing, China, lirongkang25@mails.ucas.ac.cn and University of Chinese Academy of Sciences, Beijing, China; Jiaxin Hu, Key Laboratory of System Software (Chinese Academy of Sciences), Beijing, China and Institute of Software, Chinese Academy of Sciences, Beijing, China, hjx18061369179@126.com and University of Chinese Academy of Sciences, Beijing, China; Taolue Chen, School of Computing and Mathematical Sciences, Birkbeck, University of London, London, UK, t.chen@bbk.ac.uk; Yong Li, Key Laboratory of System Software (Chinese Academy of Sciences), Beijing, China and Institute of Software, Chinese Academy of Sciences, Beijing, China, liyong@ios.ac.cn and University of Chinese Academy of Sciences, Beijing, China; Fu Song, Key Laboratory of System Software (Chinese Academy of Sciences), Beijing, China and Institute of Software, Chinese Academy of Sciences, Beijing, China, songfu@ios.ac.cn and University of Chinese Academy of Sciences, Beijing, China; Zhilin Wu, Key Laboratory of System Software (Chinese Academy of Sciences), Beijing, China and Institute of Software, Chinese Academy of Sciences, Beijing, China, wuzl@ios.ac.cn and University of Chinese Academy of Sciences, Beijing, China.
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org.
© 2026 Copyright held by the owner/author(s). Publication rights licensed to ACM.
ACM XXXX-XXXX/2026/10-ART
https://doi.org/10.1145/nnnnnnn.nnnnnnn
Li et al.
verification succeeds, a valid ranking function is obtained; otherwise, the verifier's diagnostics are translated into natural-language feedback that guides iterative refinement of the LLM's output.
We evaluate RAINFALL on two public benchmark suites comprising 358 terminating C programs. Using MiniMax V2.7, RAINFALL synthesizes verifiable ranking functions for 323 programs (90.22%), outperforming all promising baselines. In particular, it solves 12 more programs than PROTON 2.1, the best-performing baseline and winner of the SV-COMP 2026 Termination category. Furthermore, combining RAINFALL with PROTON 2.1 increases the success rate to 96.65% (346/358 programs). We also conduct ablation study confirming individual contributions of placeholder contracts, few-shot examples, symbolic verification, and diagnostic information feedback. Experiments across LLMs further confirm the effectiveness of RAINFALL.
Our results suggest a generic, sound framework for ranking-function synthesis and, beyond termination, LLM-assisted synthesis of formally checkable liveness certificates, both of which represent new directions of software engineering research.
CCS Concepts: • Software and its engineering → Software verification; • Theory of computation → Automated reasoning; Logic and verification; • Computing methodologies → Knowledge representation and reasoning.
Additional Key Words and Phrases: Program termination, Software verification, Large language model, Ranking function
ACM Reference Format:
Rongkang Li, Jiaxin Hu, Taolue Chen, Yong Li, Fu Song, and Zhilin Wu. 2026. Ranking Function Generation with LLMs for Termination. 1, 1 (October 2026), 24 pages. https://doi.org/10.1145/nnnnnnn.nnnnnnn
1 Introduction
Program termination is a fundamental liveness property for ensuring software reliability and total correctness [38], and plays an important role in software verification [10, 35, 79]. While program termination is undecidable in general [81], automated techniques have been developed over the years to prove termination for many classes of programs. A standard approach is to synthesize a ranking function that maps program states to a well-founded set such that the function value strictly decreases with each loop iteration and is bounded below by a constant. The existence of such a function (referred to as a valid ranking function) guarantees that the loop can execute only finitely many times when the bound entails the termination of the loop.
Classical symbolic techniques for ranking function synthesis typically formulate the problem as constraint solving over predefined parameterized ranking templates, such as linear expressions, lexicographic orders, or multiphase combinations [13, 15, 21, 47, 57, 62, 76, 77]. Instantiating the ranking template with a satisfying assignment gives rise to a ranking function. While these approaches have been largely successful, their effectiveness heavily depends on the availability of suitable templates. In practice, designing new ranking templates for diverse loop programs remains challenging and continues to be an active area of research (cf., e.g. [62]). In general, classical approaches often require substantial manual effort or expensive template exploration, which limits their scalability and degree of automation.
To address these limitations, recent work has explored leveraging machine learning, particularly (pre-trained) Large Language Models (LLMs), to generate ranking functions. This is motivated by the remarkable capabilities in assisting software development tasks [26, 45, 51, 78, 84], including specification and loop invariant generation [24, 33, 36, 41, 44, 54, 56, 64, 65, 68, 69, 71, 72, 75].
For instance, [8, 40] train neural networks as candidate ranking functions, which are subsequently verified via SMT solving to ensure soundness. These techniques heavily rely on the quality and quantity of execution traces for training neural networks. [39] trains neural networks to simultaneously represent ranking functions and inductive invariants. Unlike earlier approaches, they do not require execution traces. Instead, the neural networks are trained through a sequence of
MILP solving in a counterexample-guided inductive synthesis loop and are designed for hardware verification rather than proving termination of software programs. Note that the decision variant of MILP is NP-complete.
PROTON 2.1 [73] fine-tunes the Llama-3.2-1B-Instruct model to generate candidate ranking functions. Its effectiveness, however, is limited by the relatively small model size (1B-parameter), the small-scale fine-tuning dataset (321 programs) and the restricted reasoning context. LOOPY [53], in contrast, prompts LLMs to generate loop invariants and candidate ranking functions directly from natural-language definitions, and then identifies valid candidates using Frama-C [12]. As an early attempt, LOOPY primarily focuses on loop invariant generation and only utilizes the feedback produced by Frama-C to repair incorrect invariants. When a candidate ranking function is incorrect, LOOPY initiates a new interaction with the LLM without incorporating the verification feedback. Although LOOPY has demonstrated the potential of LLMs for ranking function generation, its effectiveness remains limited. Even after embedding expert knowledge (i.e., natural language description of lexicographic and multi-phase ranking functions) into prompts, LOOPY only solves 181 out of 281 benchmarks, much fewer than the state-of-the-art symbolic baseline UAutomizer [48], which solves 236 benchmarks.
There are two major challenges in effectively leveraging LLM for ranking function generation.
• Challenge 1: limited LLM capability. LLMs generate outputs based on statistical patterns learned from training data. As training data usually consists of large-scale natural language text and code corpora, LLMs typically perform well on tasks such as natural language processing and code generation. In contrast, ranking functions are relatively underexplored and is not supported by large or representative training datasets. Consequently, LLMs may have limited capability in reasoning about ranking functions and often struggle with complicated or subtle definitions expressed in natural language. Indeed, out-of-the-box Llama-1B failed to synthesize valid ranking functions even for trivial programs [73].
• Challenge 2: identifying and resolving incorrect outputs. Despite the promising performance of LLMs for code generation, they frequently generate incorrect code, often due to limited reasoning context. A particular serious issue is hallucinations [86] where LLMs generate outputs that appear plausible but fail to satisfy the intended specification [23, 43]. For instance, GPT-4 has been shown to generate incomplete assertions as post-conditions so that buggy programs do not violate them [36]. We indeed observe similar behavior in our experiments, highlighting the development of techniques that can effectively identify and correct such subtle errors with minimal interaction overhead.
Our work. To tackle these challenges, we propose a neuro-symbolic framework, RAINFALL (RAnkING Function generation with LLM), within the generate-verify-refine paradigm, which combines the generative capabilities of modern LLMs with the rigor of symbolic techniques. This integration enables RAINFALL to discover richer termination arguments and prove termination for a broader class of loop programs. We remark that LLM fine-tuning could also be adopted, as demonstrated by PROTON 2.1. We avoid fine-tuning because it is not only cost- and resource-intensive, but also requires large-scale, high-quality training datasets, which otherwise risks overfitting.
Specifically, to address the first challenge, RAINFALL first transforms the synthesis of ranking functions into a code-assertion generation problem, motivated by the observation that LLMs are very effective in code and specification generation. This transformation avoids requiring LLMs to interpret complicated definitions of ranking functions and improves the quality of the generated candidate ranking functions. Second, we embed expert knowledge about termination arguments (e.g., lexicographic and multi-phase ranking functions) with few-shot examples into structured
Li et al.
prompts which can enhance the reasoning ability and in-context learning of LLMs for code-assertion generation.
To address the second challenge, we present a symbolic verification pipeline which checks whether the LLM outputs satisfy the required correctness criteria, thereby providing soundness guarantees. In this pipeline, we first ensure that the LLM does not modify the original program by applying a lightweight, syntactic equivalence check. This step prevents potential cheating where the LLM modifies the program and generates assertions that hold only in the modified version. After this, we check the completeness of the generated code-assertion statements required to induce a ranking function (e.g., whether assertions include strict decrease, non-negativity and termination conditions). Without these conditions, valid ranking functions cannot be extracted even if the program satisfies the assertions (e.g., an LLM outputs true as the assertion, which would not be useful). Finally, we verify whether the program satisfies the assertions via safety checking. To repair incorrect outputs with minimal interactions, we re-prompt LLMs by incorporating fine-grained diagnostic information (e.g., the detected program modification, missing ranking function conditions, or counterexample produced by the safety verifier). The corresponding ranking functions can then be extracted and used as a witness to program termination. Remark that we do not copy the LLM-generated code-assertions into the original program and then verify them using the later checks because such code-assertions typically cannot induce a valid ranking function and subsequent checks would incur substantial computational overhead.
We evaluate RAINFALL on two public benchmark suites comprising 358 terminating C programs. Using MiniMax (V2.7) [5], RAINFALL generates verifiable ranking functions for 323 programs (90.22%), outperforming six state-of-the-art tools such as AProVE [66] (78.77%), UAutomizer (79.05%), LOOPY (73.74%) and PROTON 2.1 (86.87%). Ablation studies confirm that formulating ranking-function synthesis as a code-assertion generation task, together with few-shot examples and diagnostic information feedback is critical to this performance. We further show that RAINFALL remains effective across LLMs (e.g., proved more programs in less time using GPT V5.5 [4] and Claude-Opus V4.7 [2]) and complements other tools (e.g., a 96.65% success rate, solving 346 tasks when combined with the symbolic counterpart of PROTON 2.1).
This paper focuses on synthesizing ranking functions for proving termination of loop programs using three common classes of ranking functions. More broadly, however, our promising results point toward a generic, sound framework for ranking-function synthesis and, beyond termination, LLM-assisted synthesis of formally checkable liveness certificates, both of which represent frontiers of software engineering research.
First, the framework naturally accommodates new classes of ranking functions. Rather than developing specialized synthesis algorithms for each new class, one can extend the structured prompts with domain knowledge and few-shot examples, while adapting only the symbolic verification stage to the corresponding proof obligations. This substantially lowers the engineering effort required to support richer ranking-function templates.
Second, ranking functions have already been generalized beyond loop termination, serving as certificates for software progress properties [30] and, more recently, as neural certificates for liveness properties of hardware designs [39]. In this broader setting, RAINFALL illustrates a promising neuro-symbolic methodology in which LLMs propose expressive candidate proof artifacts, while symbolic verification guarantees soundness through validation and iterative refinement. The strong empirical performance of RAINFALL, together with its complementarity with existing symbolic termination tools, suggests that LLM-assisted certificate synthesis could extend beyond termination to the verification of progress, fairness, response, and other temporal properties of software systems.
Finally, although this paper considers only unconditional termination, the same framework could potentially be extended to infer termination conditions by integrating recent advances in conditional termination analysis [52].
Summary. This paper makes the following contributions:
-
A new perspective that reformulates ranking-function synthesis as a code-assertion generation task, enabling a seamless integration of LLM generation with sound symbolic techniques.
-
A novel neuro-symbolic framework within the generate-verify-refine paradigm, which combines expert knowledge, few-shot examples, symbolic checking, and diagnostic information to guide generation, suppress hallucinations and ensure soundness.
• An extensive evaluation showing that RAINFALL outperforms six state-of-the-art tools including LLM-based ones and top-3 tools of SV-COMP 2026 termination category.
Structure. Section 2 reviews the basic definition of rank functions. Section 3 reviews the related work, which also introduces more technical background. Section 4 presents the RAINFALL approach. Section 5 reports the experimental results and discusses potential threats to the validity of the work. Finally, Section 6 concludes the paper.
A binary relation over the set is well-founded if each non-empty subset has an -minimal element, i.e., there exists such that for each . Intuitively, this means that no infinite descending chain with respect to exists. The relation < over natural numbers is well-founded. In practice, one may also consider domains such as the set of finite-precision floating-point numbers, or the set of rational numbers, over which the relation < is also well-founded. In this work, we denote by a set of numbers over which the relation < is well-founded, and denote by the subset of whose elements are nonnegative.
In this paper, we focus on programs with a single while-loop. Programs with multiple or nested loops can be handled by reducing to a set of single loop programs [22, 49], and for-loops can be easily transformed into while-loops. The executions of such programs can be modeled as binary relations over program states. Let denote the vector of all program variables , representing the current program state, where . (Note that the program variables may have different types.) As a convention, we write for the variables in the next program state.
Definition 1. A program is modeled as a transition system , where denotes the countable (possibly infinite) set of program states, represents the set of initial states, and defines the transition relation over program states.
For program verification, the sets , , and are typically represented as predicates over the program variables , yielding , and , respectively. (We also identify these predicates with the corresponding sets of program states when the context is clear.) Intuitively, the initial states represent the reachable program states before entering the loop, and each pair indicates that executing one (loop) iteration from the program state results in the program state . For the sake of presentation, intermediate program states in each iteration are not modeled explicitly.
A computation of the program is either a finite or an infinite sequence of program states such that and for all . A program is terminating if all its computations are finite.
Li et al.
A standard approach for proving termination of is to synthesize a ranking function that maps program states to elements of a well-founded set such that the value strictly decreases along every transition. Since well-founded sets admit no infinite descending chains, the existence of such a ranking function guarantees that every computation of must be finite when the lower bound entails the termination of the loop (i.e., negation of the loop guard).
2.1 Common Classes of Ranking Functions
We recall three common classes of ranking functions [62].
Definition 2. A single ranking function for a program is a function such that there exists a constant satisfying that for each , .
Intuitively, maps each program state to a value which strictly decreases (by at least ) after each iteration. Since strictly decreases and is bounded below by 0, the relation < is well-founded over , the loop with guard can execute only finitely many iterations when entails . Therefore, serves as a witness to program termination.
However, single ranking functions are not always sufficient, or easy to construct. For example, consider the program P in Figure 1. For brevity, we omit (1) the declaration extern int __VERIFIER_nondet_int(void) which returns a nondeterministic integer, and (2) the effects of integer overflow and underflow when reasoning about the termination of P. This follows from prior work [15, 19, 57, 62, 76], since termination is otherwise undefined. Such issues are typically addressed separately by safety verification.
We claim that always terminates (assuming no integer overflow occurs). Intuitively, once becomes positive, strictly decreases in every subsequent iteration. Since cannot decrease indefinitely while satisfying the loop guard , the loop must eventually terminate. Nevertheless, there exists no single linear ranking function of the form , where and are constants, that proves the termination of , since such a function may fail to strictly decrease at every iteration.
To see this, let the current program state be . After one iteration, the program state is updated to . We have that .
-
When , for to be a valid ranking function, it holds that for all program states satisfying the loop guard, including and . But then we have , contradicting Definition 2 since does not strictly decrease at every iteration.
-
When , we require that for some according to Definition 2. It means that . However, for a fixed value , we have when , which contradicts the requirement in Definition 2.
Hence, the termination of cannot be proved by any single linear ranking functions. In contrast, this program admits a multiphase ranking function.
Definition 3. A multiphase ranking function is a vector of single ranking functions that decrease in successive phases of a loop execution. In particular, decreases until its value becomes negative; afterwards, starts to decrease until it becomes negative, and so on for the remaining components. Such a function is typically referred to as a k-phase ranking function.
As each phase admits a strictly decreasing ranking function and the number of phases is finite, multiphase ranking functions can witness program termination with the loop guard when entails . For instance, consider the 2-phase ranking function for the program in Figure 1. The first component strictly decreases after every iteration because is int main() { int x = __VERIFIER_nondet_int(); int y = __VERIFIER_nondet_int(); // >>> Infill Define << while (x > 0) { // >>> Infill Update Begin << x = x - y; y = y + 1; // >>> Infill Update End << // >>> Infill Assert << } return 0; }
Fig. 1. An example (terminating) loop program P.
incremented by one, while the second component x may increase during this phrase. Once (i.e., ), the first component strictly decreases, while the second component x begins to strictly decrease until the loop eventually terminates.
We now introduce another class of ranking functions, i.e., lexicographic ranking functions.
Definition 4. A lexicographic ranking function is a vector of single ranking functions that maps a program state to a tuple of values which is required to strictly decrease with respect to the lexicographic order after each loop iteration. is commonly referred to as a k-lexicographic ranking function.
The lexicographic order ensures that the sequence of program states is well-founded and therefore witnesses termination of the program with the loop guard , provided that entails . For instance, consider the 2-lexicographic ranking function for the program in Figure 1. When , the first component is , and thus the lexicographic value strictly decreases after every iteration, because is incremented by one. Once (i.e., ), the first component remains to be , and the second component begins to strictly decrease until the loop eventually terminates.
3 Related Work
Before presenting our approach, we briefly review related work for software programs, which also provides necessary background.
Single ranking function synthesis. The most standard approach to proving program termination is via ranking functions that decrease along every loop iteration. Podelski and Rybalchenko [76] gave a complete method for synthesizing linear ranking functions on linear loops. Later work relaxes the strict decrease requirement, e.g., by eventual linear ranking functions [11]. These approaches typically reduce the synthesis problem to constraint solving (via, e.g., Farkas' lemma), but are limited in expressiveness.
Template-based ranking function synthesis. Template-based approaches synthesize ranking functions by reducing the problem to constraint solving over predefined templates. For a chosen ranking function class, a parameterized template with unknown coefficients is fixed, and synthesis amounts to finding coefficient values that satisfy the required conditions. Common templates include linear [62], multiphase [15], and lexicographic ranking functions [9, 14, 19, 20], as introduced in Section 2. For example, to synthesize a single linear ranking function for a loop with guard , one can use an affine template , where and are unknown. The synthesis task reduces to determining and such that the ranking function conditions hold for all program transitions.
Li et al.
and . Leike and Heizmann [62] reduce the synthesis problem of common ranking functions above to solving nonlinear constraints via SMT. More expressive templates may use polynomial or rational expressions, or multiple components as in multiphase and lexicographic ranking functions. Thus, the effectiveness of template-based methods depends heavily on choosing suitable templates, a task that aligns well with the strengths of LLMs.
Data-driven techniques. Some learning-based approaches predict termination without formal guarantees [10], while others adopt a learn-and-check paradigm [63, 74, 83, 85]. Neural approaches, in particular, learn candidate functions from execution traces and validate them using SMT [8, 40]. However, these methods rely heavily on the availability of high-quality execution data.
Other symbolic approaches. Alternative approaches reason about transition relations and exploit transition invariants. Key techniques include size-change analysis [61], refinement [25, 31], variance analysis [16, 55, 77], abstract interpretation [34], temporal reasoning [59, 60], and interprocedural summarization [27]. Some techniques further address complex data structures, e.g., heaps [17], pointers [31], and lists [50].
Termination checking tools. AProVE [66] uses integer transition systems (ITS) and integrates KoAT [67] for inferring complexity bounds of ITS. Both UAutomizer [29, 49] and T2 (and its predecessor Terminator) [22, 31, 32] iteratively prove termination by analyzing cycles; UAutomizer employs automata-based reasoning to discover new cycles, while T2 reduces the problem to safety checking. FreqTerm [37] enumerates candidate ranking functions, whereas ddITerm [85] adopts a data-driven approach to learn loop bounds. PROTON 2.1 [73] leverages fine-tuned LLMs to handle cases not solved by PROTON 1.1.2 [70], a bounded model checking-based tool. Other tools include DynamiTe [58] and FuncTion [82]. Related work also addresses non-termination [28, 42, 46] and LLM-based prediction [80], which is not our focus.

Fig. 2. An overview of RAINFALL.
4 Our Approach
Figure 2 illustrates the overall workflow of RAINFALL. Given a C program P and resource constraints (e.g., budgets on LLM queries and execution time), RAINFALL aims to synthesize a ranking function f within these limits to prove the termination by generating a verified program . If successful, RAINFALL outputs Terminate along with the LLM-generated and symbolically verified program as a certificate of termination; otherwise it returns Unknown.
RAINFALL consists of two main phases: preprocessing and iterative generation-verification. In the preprocessing phase (cf. Section 4.1), RAINFALL performs program instrumentation and prompt construction. It first automatically instruments P by inserting four predefined code and assertion placeholders at selected locations for each loop, resulting in an instrumented program . This reduces ranking function synthesis to a code-assertion generation problem on . Next, it constructs a structured prompt based on , natural language descriptions and few-shot examples of ranking functions, and queries the LLM accordingly.
In the iterative generation-verification phase (cf. Section 4.2), RAINFALL generally alternates between symbolic verification and prompt construction with diagnostic feedback. It first queries system_prompt: You are an expert in program verification and termination analysis. Your task is to analyze the following C program and determine if it terminates. If it terminates, modify the code only at the exact locations marked with: //>>> Infill Define <<, //>>> Infill Update Begin <<, //>>> Infill Update End <<, //>>> Infill Assert <<. Do not modify any other part of the code; only replace or add code at these specific lines. IMPORTANT: Ranking function generation for multi-stage and lexicographical orders, Lexicographic: Requires that in each loop iteration, the tuple of ranking expressions strictly decreases in lexicographic order, with all components remaining non-negative throughout the loop execution. Multi-Phase: Allows phased decrease where the first expression strictly decreases while positive, then the second expression takes over and strictly decreases while positive, and so on, until all become non-positive and the loop terminates. For each marker: At //>>> Infill Define <<, replace it with necessary variable declarations for ranking variables before loops, (e.g., int old_rank; int new_rank); At //>>> Infill Update Begin <<, replace it with code to save the old values of ranking variables at the beginning of each loop iteration (e.g., old_rank = new_rank); At //>>> Infill Update End <<, replace it with code to update the ranking variables after modifying the relevant program variables (e.g., new_rank = ...); At //>>> Infill Assert <<, insert assertions ensuring that the ranking function strictly decreases, remains non-negative while the loop guard holds, and that the loop guard is false whenever the ranking function is negative. Important: Always include non-negativity checks for all ranking variables. After making these changes, output the entire C program code with these modifications, where assertions start with the prefix //@ in the form of UAutomizer. I will provide you with several examples. <few-shot examples with infilled code-assertions> Now, analyze the program and provide the appropriate response. Output only the modified code. Do not include any other text, comments, or explanations in your response. user_prompt: Conduct formal termination analysis for this C program: <program with placeholders> Variable names should use the prefixes old_rank and new_rank, with a numeric index appended (e.g., old_rank1, new_rank1, old_rank2, new_rank2). Please ensure that the expressions generated at the //>>> Infill Define << and //>>> Infill Update End << positions are consistent. You must strictly follow the lexicographic order and multi-phase format for generating assertions as shown in the example. Provide code.
Fig. 3. Initial prompt template.
the LLM with the initial prompt (from the preprocessing phase), to produce a candidate program by infilling the code/assertion placeholders. Despite the structured prompt, may still be incorrect or incomplete, and thus is analyzed by a symbolic verification pipeline.
The symbolic verification pipeline comprises three components: syntactic equivalence checking, which ensures that the original code in is not modified by the LLM; code-assertion completeness checking, which verifies that the generated assertions cover strict decrease, non-negativity, and termination conditions; and assertion checking, which validates the correctness of these assertions. If passes all three checks, the LLM-generated code-assertions induce a valid ranking function , and RAINFALL returns as . Otherwise, diagnostic information is incorporated into the , leading to the prompt for the subsequent iteration (a new interaction with the LLM using ), to refine the LLM output. This process repeats until a valid ranking function is found, or the resource budget is exhausted.
4.1 Preprocessing
The goal of the preprocessing phase is to instrument the input program with placeholders to be infilled by the LLM, and to build an initial prompt that guides the LLM in filling the placeholders so as to obtain a valid ranking function .
Program Instrumentation. We first construct the abstract syntax tree (AST) T of the program P and identify all loop structures (e.g., while and for loops) by traversing T. All for-loops are transformed into equivalent while-loops. For each loop, we insert four predefined placeholders at the designated locations, which are to be infilled by the LLM with code and assertions. More precisely, as illustrated in Figure 1 and Figure 4(a), we introduce the following four placeholders for each loop:
• // >>> Infill Define <<: Placed before the loop to declare auxiliary variables required by the ranking function (e.g., variables old_rank and new_rank are declared to record the
Li et al.
ranking value from the previous iteration and the current ranking value, i.e., before and after each loop iteration). Such auxiliary variables are referred to as ghost variables.
• // >>> Infill Update Begin <<:: Placed at the beginning of the loop body to insert statements that store the current ranking value before the start of the current iteration (e.g., old_rank=new_rank assigning the current value to the variable old_rank representing the previous value).
• // >>> Infill Update End <<:: Placed at the end of the loop body to insert statements that update the current ranking value after the current loop iteration (e.g., new_rank=x updates new_rank according to the value of the variable x).
• // >>> Infill Assert <<:: Placed at the end of the loop body to insert assertions that enforce the strict decrease and non-negativity of the ranking value, as well as termination of the loop (e.g., assert(old_rank>new_rank) enforces the strict decrease).
By these placeholders, we restrict the LLM to act as a constrained slot filler rather than a free-form code generator, aiming to prevent unintended modifications to other parts of the program logic and enhance the predictability and reliability of the generated results. The resulting instrumented program is denoted as .
Initial Prompt Construction. To guide the LLM in correctly infilling the placeholders, as illustrated in Figure 3, we construct a structured prompt , consisting of the following four key parts:
- System Role: Specifies that the current task is to synthesize a ranking function for termination analysis of C programs by filling the four predefined placeholders for each loop. It furthermore emphasizes strict placeholder replacement rules: only the predefined placeholders may be replaced, and all other parts of the program must remain unchanged.
• Semantic Mode Definition: Encodes domain knowledge (e.g., decreasing conditions for lexicographic and multiphase ranking functions) in natural language, guiding the LLM to correctly capture the semantics of complex termination arguments.
• Few-shot Examples: Provides fully instantiated programs including variable declarations, update statements and assertions. These examples illustrate the expected output format and implicitly convey common patterns of ranking function synthesis via code-assertion filling, thereby improving generation accuracy.
• Instrumented Program: The placeholder-instrumented program produced in the preprocessing phase, serving as the concrete context for generation.
The resulting prompt is used to query the LLM, which often generates a valid ranking function by filling the placeholders. However, incorrect or incomplete generations may still arise; such cases will be handled by the subsequent iterative generation-verification phase.
4.2 Iterative Generation-Verification
This phase repeatedly queries the LLM and verifies the LLM-generated candidate program via a designated symbolic verification pipeline, until satisfies the required correctness criteria (i.e., a valid ranking function is found) or the resource budget is exhausted. This process begins by querying the LLM using and iteratively refines the LLM output by incorporating diagnostic feedback extracted from the symbolic verification pipeline into the prompt for the subsequent iteration.
We first describe the three components of the symbolic verification pipeline, namely, syntactic equivalence checking, code-assertion completeness checking and assertion checking. We further explain how their diagnostic feedback is incorporated into the prompt to refine the LLM output.
#include <stdio.h>
int main() { int x = __VERIFIER nondet_int(); int y = __VERIFIER nondet_int(); int old_rank, new_rank = x; while (x > 0) { old_rank = new_rank; x = x - 1; y = y + 1; new_rank = x; //@ assert (old_rank > new_rank && old_rank >= 0); //@ assert (new_rank >= 0 || ! (x > 0)); } return 0; }
#include <stdio.h>
int main() { int x = __VERIFIER nondet_int(); int y = __VERIFIER nondet_int(); int old_rank1, old_rank2, new_rank1 = -y, new_rank2 = x; while (x > 0) { old_rank1 = new_rank1; old_rank2 = new_rank2; x = x - y; // x = (y > 0) ? x + y : x - y; y = y + 1; new_rank1 = -y; new_rank2 = x; //@ assert ((old_rank1 >= 0 && old_rank1 > new_rank1) || (old_rank1 < 0 && new_rank1 < 0 && old_rank2 >= 0)); //@ assert ((new_rank2 >= 0) || ! (x > 0)); } return 0; }
(a) Incorrectly modified program
#include <stdio.h>
int main() { int x = __VERIFIER nondet_int(); int y = __VERIFIER nondet_int(); int old_rank1, old_rank2, new_rank1 = -y, new_rank2 = x - 2; while (x > 0) { old_rank1 = new_rank1; old_rank2 = new_rank2; x = x - y; y = y + 1; new_rank1 = -y; new_rank2 = x - 2; //@ assert ((old_rank1 >= 0 && old_rank1 > new_rank1) || (old_rank1 < 0 && new_rank1 < 0 && old_rank2 >= 0 && old_rank2 > new_rank2)); //@ assert ((new_rank2 >= 0) || ! (x > 0)); } return 0; }
(c) Program with incorrect assertions
(b) Program with incomplete assertions
#include <stdio.h>
int main() { int x = __VERIFIER nondet_int(); int y = __VERIFIER nondet_int(); int old_rank1, old_rank2, new_rank1 = -y, new_rank2 = x; while (x > 0) { old_rank1 = new_rank1; old_rank2 = new_rank2; x = x - y; y = y + 1; new_rank1 = -y; new_rank2 = x; //@ assert ((old_rank1 >= 0 && old_rank1 > new_rank1) || (old_rank1 < 0 && new_rank1 < 0 && old_rank2 >= 0 && old_rank2 > new_rank2)); //@ assert ((new_rank2 >= 0) || ! (x > 0)); } return 0; }
(d) Program with valid ranking function
Fig. 4. Demonstration of RAINFALL on the program in Figure 1.
4.2.1 Syntactic Equivalence Checking. While the prompt explicitly restricts the LLM to be a slot filler and disallows modifications to the program logic, our experiments show that the LLM may still modify the code in in practice.
For instance, when querying the LLM with on the instrumented program in Figure 1, the model may generate a candidate ranking function by filling the four placeholders, as shown in Figure 4(a). We highlight the instantiated placeholders and the modified statement in red. In the first slot, two variables old_rank and new_rank are declared to record the previous and current ranking values, respectively, initializing new_rank with x. In the second slot, the assignment old_rank=new_rank is inserted to store the ranking value before the iteration. In the third slot, the ranking value is updated after the loop body via new_rank=x. In the fourth slot, two assertions are inserted: the first enforces strict decrease and non-negativity (i.e., old_rank>new_rank and old_rank>=0), while the second encodes termination by asserting that if the ranking value becomes negative, the loop guard must be false (i.e., (new_rank>=0) || ! (x>0)).
These code-assertions indeed induce a single ranking function , which is valid for the program in Figure 4(a), and would therefore pass the subsequent completeness checking and assertion checking. However, the statement in the original program code is incorrectly replaced by , meaning that is not a valid ranking function for the original program.
To detect such incorrect outputs, we adopt a lightweight syntactic equivalence checking to ensure that the original code in is not modified by the LLM. We build ASTs for both the original program and the LLM-generated program (after removing the code-assertions inserted by the LLM), and compare them for equivalence. proceeds to the next checking if it passes this equivalence checking; otherwise, diagnostic information is fed back to refine the LLM output.
We do not consider semantic equivalence checking as it is computationally expensive and, in our setting, LLMs rarely generate semantically equivalent programs when the program code is
Li et al.
modified. Moreover, we do not embed LLM-generated code-assertions into the original program P, since such code-assertions typically cannot induce a valid ranking function for P and subsequent assertion checking would incur substantial computational overhead.
4.2.2 Code-Assertion Completeness Checking. In practice, as observed in our experiments, the LLM may generate incomplete code-assertions. For instance, when querying the LLM with either or the diagnostic feedback augmented prompt on the instrumented program in Figure 1, the model may generate the candidate ranking function shown in Figure 4(b). In the first slot, four variables old_rank1, old_rank2, new_rank1 and new_rank2 are declared, with new_rank1 and new_rank2 initialized to -y and x, respectively. The second and third slots update these variables. In the fourth slot, two assertions are inserted to encode a 2-phase ranking function , where the first enforces the strict decrease and non-negativity of (with previous and current values stored in old_rank1 and new_rank1), and, once becomes negative, enforces non-negativity of (with values stored in old_rank2 and new_rank2); the second assertion encodes termination when becomes negative.
At first glance, these assertions appear to induce the following 2-phase ranking function
and would pass the assertion checking. However, the first assertion is incomplete: it fails to enforce strict decrease of after becomes negative. As a result, the non-terminating program obtained by replacing with ? : still satisfies both assertions, as strictly decreases while strictly increases when .
To detect such incomplete outputs, we perform code-assertion completeness checking as follows:
Checking the first slot. We first check the completeness of the ghost variable declarations in the first slot. We identify all declared ghost variables by parsing the declarations and partition them into two sets and , depending on whether they are initialized or not. Here, represents the components of the previous ranking value (i.e., before the start of the current iteration), while represents the components of the current ranking value ( is initialized with for ). We require that there is a one-to-one correspondence between and , so we check whether they have the same cardinality, i.e., ; otherwise, the declarations are incomplete. W.l.o.g., we assume that for each , and record the -th component of the ranking value, established by the one-to-one correspondence.
Checking the second slot. We then check the completeness of the statements in the second slot by parsing the filled statements. These statements should assign the previous values from the current ones before the current loop iteration, i.e., for all ; otherwise, the updates at the beginning of the loop body are incomplete.
Checking the third slot. Next, we check the completeness of the statements in the third slot by parsing the filled statements too. These statements should update the current ranking values after executing the current loop iteration, i.e., for all (the same expressions 's as in the first slot); otherwise, the updates at the end of the loop body are incomplete.
Checking the fourth slot. Finally, we check the completeness of the assertions, ensuring that they capture the strict decrease, non-negativity and termination conditions required by the target class of ranking functions. This checking is much involved and depends on the classes of ranking functions. Let bc denote the loop guard.
- Simple ranking function: To induce a simple ranking function, there should be only two ghost variables and , namely, . Therefore, we check if LLM-generated outputs assert the following three predicates:
Strict decrease condition:
Non-negativity condition:
Termination condition:
Following prior work (e.g., [62]), we fix lower bounds of ranking function components to 0, thus adopt the term “non-negativity”. We note that our approach can generalize to any constant lower bounds.
For example, the assertions in Figure 4(a) with the loop guard x > 0 conform to the following predicates
Thus, it is complete for a single ranking function.
• Multiphase ranking function: It can only induce a k-phase ranking function with . Therefore, we check if LLM-generated outputs assert the following two predicates:
Strict decrease
and non-negativity
conditions:
Termination condition:
For example, the assertions in Figure 4(c) and Figure 4(d) the loop guard is and conform to the following predicates, but the assertions in Figure 4(b) does not:
Thus, the programs in Figure 4(c) and Figure 4(d) are complete for a 2-phase ranking function while the other one is not.
• Lexicographic ranking function: It can only induce a k-lexicographic ranking function with . Therefore, we check if LLM-generated outputs assert the following three predicates:
Strict decrease condition:
Non-negativity condition:
Termination condition:
We note that the strict decrease and termination conditions are sufficient for lexicographic ranking functions to be complete, because if the loop does not terminate, then bc always holds (i.e., !bs is false), the condition will eventually be violated. We require LLMs to also generate the non-negativity condition so that our prompts are independent upon the classes of ranking functions.
If the LLM-generated assertions do not conform to any of these forms, they are deemed incomplete, and diagnostic feedback is generated and incorporated into the prompt. Otherwise, proceeds to assertion checking.
4.2.3 Assertion Checking. Both the equivalence checking and completeness checking are purely syntactic. To ensure soundness, a semantic assertion checking is therefore required.
Li et al.
For instance, when querying the LLM with either or the diagnostic feedback augmented prompt on the instrumented program in Figure 1, the model may generate the candidate ranking function in Figure 4(c). This program is similar to the one in Figure 4(b), aiming to encode a 2-phase ranking function instead of , where (1) old_rank2>new_rank2 is inserted in the first assertion to enforce strict decrease of once becomes negative, and (2) old_rank2 = x is changed to old_rank2 = x-2. (These changes are highlighted in green.) This program passes both the equivalence and code-assertion completeness checks. However, although generally is a 2-phase ranking function, the components of the ranking value are not lower-bounded by 0, thus is not a valid ranking function for the original program in Figure 1.
Semantic assertion checking is thus necessary to verify the LLM-generated code-assertions as a valid ranking function. Specifically, the program is verified using a safety verifier (e.g., UAutomizer). Intuitively, this step checks whether the original program terminates under the candidate ranking function induced by the code-assertions in . This procedure is sound because (1) the equivalence checking ensures that the original code of is not modified in , and (2) the completeness checking ensures that all the required code-assertions have been properly instantiated in . Consequently, if the assertions are valid in , they collectively induce a valid ranking function for proving termination of .
If passes this check, RAINFALL outputs Terminate together with the program , which serves as a certificate of termination for . Otherwise, a counterexample is typically reported by the safety verifier and fed back to improve the prompt. For instance, UAutomizer reported SAT when verifying the program in Figure 4(c), returning the violated assertion together with a counterexample, i.e., a sequence of statements leading to the violated assertion, along with the corresponding program states. In this case, the input is and the program executes
with corresponding ranking values
We observe that although the second assertion is not violated, the first assertion is violated at state with ranking value , since neither old_rank1 >=0 nor old_rank2 >=0 holds.
When querying the LLM with the counterexample augmented prompt , the model generates the program shown in Figure 4(d). This program passes all three checks and induces the valid 2-phase ranking function , which is now sufficient to prove termination of . The key difference is that the second component in the ranking function is changed from to so that it is lower-bounded by 0 and the termination assertion enforces that new_rank2 < 0 entails ! . Consequently, RAINFALL outputs Terminate along with the verified program , thereby completing the ranking function generation and verification task.
4.2.4 Prompt Augment with Diagnostic Information Feedback. To address the issues identified by the checks, we augment the initial prompt with the incorrectly generated program and the corresponding diagnostic information. This combined text forms a complete context for the next new interaction with the LLM. The diagnostic information is tailored to each type of check. For syntactic equivalence checking, it reports mismatched statements with their locations. For code-assertion completeness checking, it highlights the incorrect/incomplete variable declarations and code within each placeholder slot. For assertion checking, it provides the location of the violated assertion along with a counterexample, as reported by the underlying safety verifier.
For example, the equivalence checking on the program in Figure 4(a) may produce diagnostic information such as “the statement x=x-1 at location 10 in the generated program mismatches with the statement x=x-y at location 10 in the original program.” The completeness checking on the program in Figure 4(b) may report: “the first assertion misses the strict decreasing condition for the variables old_rank2 and new_rank2.” The assertion checking on the program in Figure 4(c) may yield: “We used UAutomizer, and it found a counterexample demonstrating that our program is incorrect. CounterExampleResult [Line: xx]: assertion can be violated. We found a FailurePath: …”. If the safety verifier fails to prove or disprove the assertions (e.g., it reports Unknown or runs out of execution time), the diagnostic information is “We used UAutomizer which reports Unknown/runs out of time.”
5 Evaluation
We implement RAINFALL using Clang [1] for AST construction and manipulation, and UAutomizer as the backend safety verifier. RAINFALL can configure, e.g., LLM model, the number of solving attempts, and the number of iterations in the generation-verification phase.
We systematically evaluate RAINFALL to answer the following research questions (RQs):
• RQ1 (Effectiveness): How does RAINFALL compare with state-of-the-art termination analysis tools in terms of effectiveness?
• RQ2 (Ablation study): What are the individual contributions of placeholder contracts, few-shot examples, symbolic verification, and diagnostic information feedback?
• RQ3 (Impact of LLMs): How robust is RAINFALL across different LLMs?
Benchmark. We consider two public benchmark suites provided by LOOPY and FreqTerm, denoted by BS-L and BS-F, respectively. BS-L consists of 188 terminating C programs (after deduplicating 93 programs with identical ASTs but different lines of code), while BS-F contains 170 terminating C programs, after removing a non-terminating instance. These benchmarks were originally collected from the termination category of SV-COMP, covering a range of typical loop patterns, including linear, non-linear and conditional branches. (Note that one of them uses a for-loop, which is transformed into an equivalent while-loop.) We do not evaluate on the entire SV-COMP Termination benchmarks mainly because of the high token cost of LLM-based experiments. Nevertheless, the selected benchmarks are sufficiently large and diverse for a meaningful evaluation. In particular, ddl-term [85] (ICSE 2022) evaluates exclusively on the BS-F benchmark suite; similarly, CondTerm [52] (ICSE 2026) uses only the 170 terminating programs from BS-F.
We use both BS-L and BS-F to answer RQ1, but only BS-F for RQ2 and RQ3 due to the high token cost of experiments.
Baselines. We consider six representative baselines: UAutomizer, ddlTerm, FreqTerm, AProVE, PROTON, and LOOPY. These tools encompass a rich variety of termination proving approaches. Notably, PROTON, UAutomizer and AProVE rank among the top three tools in the Termination Category of SV-COMP 2026 [18].
LLMs. We use MiniMax (V2.7) [5] to answer RQ1 and RQ2. For RQ3, we additionally consider DeepSeek (V4 Pro) [3], Qwen-Plus (V3.6) [7], Claude Opus (V4.7) [2] and GPT (V5.5) [4]. All models are accessed via the OpenRouter platform [6], except for DeepSeek, which is accessed via its official API. For all models, we use the default settings for maximum token limits and temperature in thinking mode.
Evaluation metrics. We report the number of programs for which termination is successfully proved (denoted by #Solved). We also measure the average number of input and output tokens
Li et al.
Table 1. Results of comparison over baselines (RQ 1), where the report time is the average time computed over the overall execution time of solved programs includes LLM latency and multiple verification attempts.
| Tool | BS-F (170) | BS-L (188) | Total (358) | |||
|---|---|---|---|---|---|---|
| #Solved | Time(s) | #Solved | Time(s) | #Solved | Time(s) | |
| AProVE | 123 | 23.52 | 159 | 18.33 | 282 | 20.59 |
| ddlTerm | 140 | 62.95 | N/A | N/A | N/A | N/A |
| UAutomizer | 116 | 11.50 | 167 | 5.26 | 283 | 7.82 |
| FreqTerm | 80 | 78.66 | 75 | 28.36 | 155 | 54.32 |
| LOOPY | 124 | 976.13 | 140 | 785.94 | 264 | 875.27 |
| PROTON | 148 | 148.65 | 163 | 130.46 | 311 | 139.12 |
| PRO-LLM | 11 | 52.26 | 4 | 46.11 | 15 | 50.62 |
| RAINFALL | 156 | 461.54 | 167 | 501.79 | 323 | 482.35 |
(#inTok and #outTok) used by each model per benchmark, and their average cost (in USD) based on the official pricing after discount.
Budgets. The solving time for each program is limited to 1,800 seconds (wall-clock time) for tools without LLMs. For tools with LLMs (i.e., RAINFALL, LOOPY and PROTON), we only restrict each safety verification task to 60 seconds and LLM queries to 12 times (unless otherwise stated):
-
RAINFALL: 2 solving attempts×6 LLM queries/attempt;
-
LOOPY: 6 solving attempts×2 LLM queries/attempt;
-
PROTON: 12 solving attempts×1 LLM query/attempt.
All experiments were conducted on a machine with an Intel(R) Xeon(R) Platinum 8368Q CPU (76 cores, 2.60 GHz) and running Ubuntu 22.04.5 LTS, with 1024 GiB of RAM available for evaluation.
5.1 RQ1: Effectiveness
To answer RQ1, we compare RAINFALL against all six baselines, as well as the fine-tuned LLM used in PROTON (denoted as PRO-LLM). Results are shown in Table 1, with average time computed over the overall execution time of solved programs includes LLM latency and multiple verification attempts. Note: (1) ddlTerm requires instrumented programs, but provides such instrumentation only for BS-F. Thus, we do not evaluate ddlTerm on BS-L. (2) FreqTerm originally supports three CHC solvers (FreqHorn, Z and Spacer). However, due to version compatibility issues between FreqTerm and the solvers, we can only run it with FreqHorn.
Overall, RAINFALL outperforms all baselines, solving the largest number of tasks across both benchmark suites. In particular, RAINFALL solves 12 more tasks than PROTON, the best-performing baseline and winner of the SV-COMP 2026 Termination Category. PRO-LLM solves only 11 tasks on BS-F and 4 on BS-L, all of which are already solvable by PROTON without invoking its fine-tuned LLM. Compared to the LLM-based tool LOOPY, which uses the same LLM (i.e., MiniMax) to generate ranking functions instead of code-assertions, RAINFALL solves 59 additional tasks. In terms of efficiency, RAINFALL not only solves more tasks but also requires fewer LLM queries than LOOPY.
As expected, RAINFALL is slower than the other baselines due to the overhead of remote LLM queries. We later show that RAINFALL can achieve both higher effectiveness and substantially lower runtime when paired with more advanced LLMs such as GPT and Claude-Opus.
Figure 5 depicts the distributions of tasks solved exclusively by RAINFALL, exclusively by each baseline, and by both. We observe that
-
the majority of programs are proved by both RAINFALL and the baseline,
-
RAINFALL uniquely solves significantly more programs than any baseline,

Fig. 5. Distributions of solved tasks, where UA.=UAutomizer.
- combining RAINFALL with the baselines yields the best results. In particular, the best combination (RAINFALL+PROTON) proves 167 (out of 170 programs) on BS-F and 179 (out of 188 programs) on BS-L, for a total of 346 out of 358 programs.
We manually analyze the 14 unsolved programs in BS-F by RAINFALL.
- For 3 programs, MiniMax generates correct loop bounds instead of ranking functions; although sufficient for proving termination, these fall outside the scope of our approach and fail in the iterative generation-verification phase.
• For 4 programs, MiniMax returns none under the initial prompt.
• For 5 programs, UAutomizer runs out of time (60s).
• For the remaining 2 programs, RAINFALL fails after using 12 LLM queries.
Among these 14 programs, 10 are solved by RAINFALL using GPT and 1 is solved by increasing the safety verification timeout to 100 seconds. As a result, RAINFALL equipped with MiniMax and GPT can solve 167 out of 170 programs in total, matching the best combination RAINFALL (MiniMax)+PROTON. Furthermore, RAINFALL (GPT)+PROTON can solve 169 programs, while RAINFALL(MiniMax+GPT)+PROTON solves all 170 programs.
5.2 RQ2: Ablation Study
To answer RQ2, we first evaluate RAINFALL on BS-F with and without few-shot examples, using a single MiniMax query per task. With few-shot examples, RAINFALL solves 110 tasks, compared to 70 without, demonstrating their effectiveness in guiding the code-assertion generation.
To further understand the role of few-shot examples and assess our symbolic verification pipeline, we count the number of errors reported by the three checks when analyzing all 170 programs. The results show that while few-shot examples reduce the number of errors, the pipeline is still essential for filtering and diagnosing invalid LLM outputs.
Without few-shot examples, syntactic equivalence, code-assertion completeness and assertion checkings report 5, 38 and 17 errors, respectively. With few-shot examples, the numbers drop to 4, 9 and 7, respectively, indicating that few-shot examples improve the quality of LLM outputs but do not eliminate all invalid ones. Under the full setting of 2 solving attempts×6 LLM queries/attempt with few-shot examples, the three checks report 10, 9 and 15 errors in total, respectively. These results highlight that the symbolic verification pipeline is a critical component of RAINFALL.
To understand the impact of the number of LLM queries and solving attempts, we count the number of solved programs as a function in the number of LLM queries under the full setting of 2 solving attempts, each with 6 LLM queries, using few-shot examples. The results are shown in Figure 6, where the y-axis (resp. x-axis) represents the number of proved programs (resp. LLM
Li et al.

Fig. 6. Number of solved instances along with LLM queries.
queries). Recall that LOOPY directly prompts LLMs to generate ranking functions, proved 124 programs in BS-F (cf. Table 1) using 12 LLM queries which drops to 107 when limited to 6 LLM queries, the least number of LLM queries required by LOOPY.
-
First, the number of proved programs increases steadily with the number of LLM queries, and rapidly exceeds 124. RAINFALL solved 129 programs, 22 more than LOOPY, using 6 LLM queries; and solved 156 programs, 32 more than LOOPY, using 12 LLM queries. These results confirm the effectiveness of our placeholder contracts and iterative generation-verification strategy.
-
Second, within each solving attempt (queries 1–6 and 7–12), the number of solved programs grows rapidly during the first few queries before gradually plateauing. This suggests that iterative feedback enables the LLM to correct many errors, while the remaining unsolved programs require more substantial reasoning than incremental refinement can provide.
-
Third, restarting the solving attempt produces another sharp increase in solved programs, indicating that a fresh generation trajectory can overcome limitations of the previous refinement process and explore alternative ranking-function candidates.
5.3 RQ3: Impact of LLMs
To answer RQ3, we evaluate RAINFALL on BS-F using four additional LLM beyond MiniMax. The results are presented in Table 2. Overall, RAINFALL outperforms all baselines with most LLMs. The only exception is RAINFALL(Qwen-Plus), which performs worse than ddITerm and PROTON despite higher token usage and longer runtime. Among the evaluated models, GPT and Claude-Opus solve the largest number of programs and achieve the lowest average time (over all 170 programs). Moreover, we observe that Claude-Opus incurs substantially higher cost (over 3 times that of GPT).
Although RAINFALL(Qwen-Plus) performs worse than ddITerm and PROTON, Table 3 shows that RAINFALL consistently improves all baselines across all LLMs, with GPT achieving the best overall performance. These results confirm the robustness of RAINFALL across different LLMs. While GPT and Claude-Opus are more effective and efficient, we do not use them when answering RQ1 and RQ2 due to their high cost.
Table 2. Results of RAINFALL using more LLMs (RQ3), where the report time is the average time computed over the overall execution time of programs including solved and unsolved. Note that model sizes for proprietary LLMs are not publicly disclosed.
| Model | Size | #Solved | #inTok | #outTok | Cost(USD) | Time(s) |
|---|---|---|---|---|---|---|
| Claude-Opus | N/A | 160 | 3600 | 10741 | 0.287 | 95.10 |
| DeepSeek | 1.6T | 156 | 2286 | 18659 | 522.70 | |
| GPT | N/A | 163 | 2065 | 2668 | 0.090 | 54.81 |
| MiniMax | 230B | 156 | 2778 | 32004 | 0.039 | 581.83 |
| Qwen-Plus | 397B | 138 | 7109 | 38132 | 0.077 | 741.94 |
Table 3. Results of baseline+RAINFALL.
| Baseline | Sole | Claude-Opus | DeepSeek | GPT | MiniMax | Qwen-Plus |
|---|---|---|---|---|---|---|
| AProVE | 123 | 162 | 162 | 165 | 164 | 159 |
| ddlTerm | 140 | 164 | 161 | 164 | 162 | 157 |
| UAutomizer | 116 | 161 | 159 | 164 | 161 | 155 |
| FreqTerm | 80 | 162 | 158 | 164 | 158 | 143 |
| LOOPY | 124 | 163 | 160 | 166 | 160 | 148 |
| PROTON | 148 | 167 | 167 | 169 | 167 | 164 |
5.4 Threats to validity
Our approach relies on both third-party safety verifiers and LLMs. We use UAutomizer [49] as the safety verifier because it has been actively maintained for over a decade and ranked first overall in SV-COMP from 2023 to 2026. Although other safety verifiers could be integrated into our framework, the overall effectiveness may vary depending on the verifier employed.
To mitigate the impact of LLMs, we evaluate RAINFALL using a diverse set of both open-source and proprietary models. RAINFALL outperforms all baselines with most LLMs; the only exception is Qwen-Plus, for which RAINFALL performs worse than ddlTerm and PROTON. Nevertheless, RAINFALL consistently improves upon all baselines across all evaluated LLMs.
We evaluate RAINFALL on two public benchmark suites, and its effectiveness may differ on other benchmarks or real-world programs. Because modern LLMs are typically trained on large corpora containing publicly available code, these benchmarks may have been included in their training data, raising the possibility of benchmark contamination. We mitigate this concern by synthesizing code assertions rather than directly generating ranking functions. To the best of our knowledge, no public benchmark contains the code assertions used by our framework. Evaluating RAINFALL on additional benchmark suites and real-world programs remains an important direction for future work.
6 Conclusion
We presented RAINFALL, a novel neuro-symbolic framework for ranking function synthesis. Our approaches formulates ranking function synthesis as a code-assertion generation problem using dedicated placeholders, enabling seamless integration of modern LLMs within an iterative generate-verify-refine workflow. We showed that incorporating expert knowledge of ranking functions, few-shot examples and diagnostic information into prompts can significantly enhance generation accuracy. To ensure soundness, we developed a symbolic verification pipeline tailored to our LLM-generated code-assertion. Experimental results show that RAINFALL outperforms state-of-the-art baselines and complements existing symbolic termination analysis tools.
https://www.ultimate-pa.org/automizer.
Li et al.
More broadly, this work demonstrates the promise of combining the generative capabilities of LLMs with the formal rigor of symbolic verification for ranking-function synthesis. As LLMs continue to improve, we expect this neuro-symbolic paradigm to become an increasingly effective approach to automated termination proving.
Data Availability Statement
All few-shot examples, the complete prompts and source code will be open-sourced soon.
References
[1] 2026. Clang. https://clang.llvm.org.
[2] 2026. Claude-Opus V4.7. https://www.anthropic.com/claude/opus.
[3] 2026. DeepSeek V4 Pro. https://www.deepseek.com/en.
[4] 2026. GPT V5.5. https://openai.com.
[5] 2026. MiniMax V2.7. https://www.minimax.io.
[6] 2026. OpenRouter: The Unified Interface For LLMs. https://openrouter.ai.
[7] 2026. Qwen-Plus V3.6. https://qwen.ai.
[8] Alessandro Abate, Mirco Giacobbe, and Diptarko Roy. 2021. Learning Probabilistic Termination Proofs. In Proceedings of the 33rd International Conference on Computer Aided Verification (CAV), Vol. 12760. 3–26. doi:10.1007/978-3-030-81688-9_1
[9] Christophe Alias, Alain Darte, Paul Feautrier, and Laure Gonnord. 2010. Multi-dimensional Rankings, Program Termination, and Complexity Bounds of Flowchart Programs. In Proceedings of the 17th International Symposium on Static Analysis (SAS), Vol. 6337. 117–133. doi:10.1007/978-3-642-15769-1_8
[10] Yoav Alon and Cristina David. 2022. Using graph neural networks for program termination. In Proceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE). 910–921. doi:10.1145/3540250.3549095
[11] Roberto Bagnara and Fred Mesnard. 2013. Eventual linear ranking functions. In Proceedings of the 15th International Symposium on Principles and Practice of Declarative Programming (PPDP). 229–238. doi:10.1145/2505879.2505884
[12] Patrick Baudin, François Bobot, David Bühler, Loïc Correnson, Florent Kirchner, Nikolai Kosmatov, André Maroneze, Valentin Perrelle, Virgile Prevosto, Julien Signoles, and Nicky Williams. 2021. The dogged pursuit of bug-free C programs: the Frama-C software analysis platform. Commun. ACM 64, 8 (2021), 56–68. doi:10.1145/3470569
[13] Amir M Ben-Amram and Samir Genaim. 2013. On the linear ranking problem for integer linear-constraint loops. ACM SIGPLAN Notices 48, 1 (2013), 51–62.
[14] Amir M. Ben-Amram and Samir Genaim. 2014. Ranking Functions for Linear-Constraint Loops. J. ACM 61, 4 (2014), 26:1–26:55. doi:10.1145/2629488
[15] Amir M. Ben-Amram and Samir Genaim. 2017. On Multiphase-Linear Ranking Functions. In Proceedings of the 29th International Conference on Computer Aided Verification (CAV), Vol. 10427. 601–620. doi:10.1007/978-3-319-63390-9_32
[16] Josh Berdine, Aziem Chawdhary, Byron Cook, Dino Distefano, and Peter W. O'Hearn. 2007. Variance analyses from invariance analyses. In Proceedings of the 34th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL). ACM, 211–224. doi:10.1145/1190216.1190249
[17] Josh Berdine, Byron Cook, Dino Distefano, and Peter W. O'Hearn. 2006. Automatic Termination Proofs for Programs with Shape-Shifting Heaps. In Proceedings of the 18th International Conference on Computer Aided Verification (CAV), Vol. 4144. 386–400. doi:10.1007/11817963_35
[18] Dirk Beyer and Jan Strejcek. 2026. Evaluating Software Verifiers for C, Java, and SV-LIB - (Report on SV-COMP 2026). In Proceedings of the 32nd International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS), Part II. Springer, 461–502. doi:10.1007/978-3-032-22749-2_23 https://github.com/sosy-lab/sv-benchmarks.
[19] Aaron R. Bradley, Zohar Manna, and Henny B. Sipma. 2005. Linear Ranking with Reachability. In Proceedings of the 17th International Conference on Computer Aided Verification (CAV), Vol. 3576. 491–504. doi:10.1007/11513988_48
[20] Aaron R. Bradley, Zohar Manna, and Henny B. Sipma. 2005. The Polyranking Principle. In Proceedings of the 32nd International Colloquium on Automata, Languages and Programming (ICALP), Vol. 3580. Springer, 1349–1361. doi:10.1007/11523468_109
[21] Aaron R Bradley, Zohar Manna, and Henny B Sipma. 2005. Termination analysis of integer linear loops. In Proceedings of the 16th International Conference on Concurrency Theory (CONCUR), Vol. 3653. 488–502. doi:10.1007/11539452_37
[22] Marc Brockschmidt, Byron Cook, Samin Ishtiaq, Heidy Khlaaf, and Nir Piterman. 2016. T2: Temporal Property Verification. In Proceedings of the 22nd International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS), Vol. 9636. 387–393. doi:10.1007/978-3-662-49674-9_22
[23] Yuhan Cao, Zian Chen, Kun Quan, Ziliang Zhang, Yu Wang, Xiaoning Dong, Yeqi Feng, Guanzhong He, Jingcheng Huang, Jianhao Li, Yixuan Tan, Jiafu Tang, Yilin Tang, Junlei Wu, Qianyu Xiao, Can Zheng, Shouchen Zhou, Yuxiang Zhu, Yiming Huang, Tian Xie, and Tianxing He. 2025. Can LLMs Generate Reliable Test Case Generators? A Study on Competition-Level Programming Problems. CoRR abs/2506.06821 (2025). arXiv:2506.06821 doi:10.48550/ARXIV.2506.06821
[24] Saikat Chakraborty, Shuvendu K. Lahiri, Sarah Fakhoury, Akash Lal, Madanlal Musuvathi, Aseem Rastogi, Aditya Senthilnathan, Rahul Sharma, and Nikhil Swamy. 2023. Ranking LLM-Generated Loop Invariants for Program Verification. In Findings of the Association for Computational Linguistics, Vol. EMNLP 2023. 9164–9175. doi:10.18653/V1/2023.FINDINGS-EMNLP.614
[25] Aziem Chawdhary, Byron Cook, Sumit Gulwani, Mooly Sagiv, and Hongseok Yang. 2008. Ranking Abstractions. In Proceedings of the 17th European Symposium on Programming (ESOP). 148–162. doi:10.1007/978-3-540-78739-6_13
[26] Bei Chen, Fengji Zhang, Anh Nguyen, Daoguang Zan, Zeqi Lin, Jian-Guang Lou, and Weizhu Chen. 2023. CodeT: Code Generation with Generated Tests. In The 11th International Conference on Learning Representations, ICLR. OpenReview.net.
[27] Hong-Yi Chen, Cristina David, Daniel Kroening, Peter Schrammel, and Björn Wachter. 2018. Bit-Precise Procedure-Modular Termination Analysis. ACM Trans. Program. Lang. Syst. 40, 1 (2018), 1:1–1:38. doi:10.1145/3121136
[28] Hong Yi Chen, Byron Cook, Carsten Fuhs, Kaustubh Nimkar, and Peter W. O'Hearn. 2014. Proving Nontermination via Safety. In Proceedings of the 20th International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS), Erika Abrahám and Klaus Havelund (Eds.). Springer, 156–171. doi:10.1007/978-3-642-54862-8_11
[29] Yu-Fang Chen, Matthias Heizmann, Ondrej Lengál, Yong Li, Ming-Hsien Tsai, Andrea Turrini, and Lijun Zhang. 2018. Advanced automata-based algorithms for program termination checking. In Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI). 135–150. doi:10.1145/3192366.3192405
[30] Byron Cook, Alexey Gotsman, Andreas Podelski, Andrey Rybalchenko, and Moshe Y. Vardi. 2007. Proving that programs eventually do something good. In Proceedings of the 34th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), Martin Hofmann and Matthias Felleisen (Eds.). ACM, 265–276. doi:10.1145/1190216.1190257
[31] Byron Cook, Andreas Podelski, and Andrey Rybalchenko. 2006. Termination proofs for systems code. In Proceedings of the ACM SIGPLAN 2006 Conference on Programming Language Design and Implementation (PLDI), Michael I. Schwartzbach and Thomas Ball (Eds.). ACM, 415–426. doi:10.1145/1133981.1134029
[32] Byron Cook, Abigail See, and Florian Zuleger. 2013. Ramsey vs. Lexicographic Termination Proving. In Proceedings of the 19th International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS), Nir Piterman and Scott A. Smolka (Eds.). Springer, 47–61. doi:10.1007/978-3-642-36742-7_4
[33] Matthias Cosler, Christopher Hahn, Daniel Mendoza, Frederik Schmitt, and Caroline Trippel. 2023. nl2spec: Interactively Translating Unstructured Natural Language to Temporal Logics with Large Language Models. In Proceedings of the 35th International Conference on Computer Aided Verification (CAV), Vol. 13965. 383–396.
[34] Patrick Cousot and Radhia Cousot. 2012. An abstract interpretation framework for termination. In Proceedings of the 39th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL). ACM, 245–258. doi:10.1145/2103656.2103687
[35] Vijay Victor D'Silva, Daniel Kroening, and Georg Weissenbacher. 2008. A Survey of Automated Techniques for Formal Software Verification. IEEE Trans. Comput. Aided Des. Integr. Circuits Syst. 27, 7 (2008), 1165–1178. doi:10.1109/TCAD.2008.923410
[36] Madeline Endres, Sarah Fakhoury, Saikat Chakraborty, and Shuvendu K. Lahiri. 2024. Can Large Language Models Transform Natural Language Intent into Formal Method Postconditions? Proc. ACM Softw. Eng. 1, FSE (2024), 1889–1912. doi:10.1145/3660791
[37] Grigory Fedyukovich, Yueling Zhang, and Aarti Gupta. 2018. Syntax-Guided Termination Analysis. In Proceedings of the 30th International Conference on Computer Aided Verification (CAV), Vol. 10981. 124–143. doi:10.1007/978-3-319-96145-3_7
[38] Robert W. Floyd. 1967. Assigning Meanings to Programs. In Proceedings of the Symposia on Applied Mathematics. 19–32.
[39] Mirco Giacobbe, Daniel Kroening, Abhinandan Pal, and Michael Tautschnig. 2025. Let a Neural Network be Your Invariant. In Annual Conference on Neural Information Processing Systems (NeurIPS).
[40] Mirco Giacobbe, Daniel Kroening, and Julian Parsert. 2022. Neural termination analysis. In Proceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE). 633–645. doi:10.1145/3540250.3549120
[41] George Granberry, Wolfgang Ahrendt, and Moa Johansson. 2024. Specify What? Enhancing Neural Specification Synthesis by Symbolic Methods. In Proceedings of the 19th International Conference on Integrated Formal Methods (IFM), Vol. 15234. 307–325.
Li et al.
[42] Ashutosh Gupta, Thomas A. Henzinger, Rupak Majumdar, Andrey Rybalchenko, and Ru-Gang Xu. 2008. Proving non-termination. In Proceedings of the 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), George C. Necula and Philip Wadler (Eds.). ACM, 147–158. doi:10.1145/1328438.1328459
[43] Thilo Hagendorff. 2024. Deception abilities emerged in large language models. Proceedings of the National Academy of Sciences 121, 24 (2024), e2317967121.
[44] Christopher Hahn, Frederik Schmitt, Julia J. Tillman, Niklas Metzger, Julian Siber, and Bernd Finkbeiner. 2022. Formal Specifications from Natural Language. CoRR abs/2206.01962 (2022).
[45] Yewei Han and Chen Lyu. 2025. Multi-stage guided code generation for Large Language Models. Eng. Appl. Artif. Intell. 139 (2025), 109491. doi:10.1016/J.ENGAPPAI.2024.109491
[46] Zhilei Han and Fei He. 2023. Data-driven Recurrent Set Learning For Non-termination Analysis. In Proceedings of the 45th IEEE/ACM International Conference on Software Engineering (ICSE). IEEE, 1303–1315. doi:10.1109/ICSE48619.2023.00115
[47] William R Harris, Akash Lal, Aditya V Nori, and Sriram K Rajamani. 2010. Alternation for termination. In International Static Analysis Symposium. Springer, 304–319.
[48] Matthias Heizmann, Yu-Fang Chen, Daniel Dietsch, Marius Greitschus, Jochen Hoenicke, Yong Li, Alexander Nutz, Betim Musa, Christian Schilling, Tanja Schindler, and Andreas Podelski. 2018. Ultimate Automizer and the Search for Perfect Interpolants - (Competition Contribution). In Proceedings of the 24th International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS), Vol. 10806. 447–451. doi:10.1007/978-3-319-89963-3_30
[49] Matthias Heizmann, Jochen Hoenicke, and Andreas Podelski. 2014. Termination Analysis by Learning Terminating Programs. In Proceedings of the 26th International Conference on Computer Aided Verification (CAV), Vol. 8559. 797–813. doi:10.1007/978-3-319-08867-9_53
[50] Jera Hensel and Jürgen Giesl. 2023. Proving Termination of C Programs with Lists. In Proceedings of the 29th International Conference on Automated Deduction (CADE), Vol. 14132. 266–285. doi:10.1007/978-3-031-38499-8_16
[51] Xinyi Hou, Yanjie Zhao, Yue Liu, Zhou Yang, Kailong Wang, Li Li, Xiapu Luo, David Lo, John Grundy, and Haoyu Wang. 2024. Large Language Models for Software Engineering: A Systematic Literature Review. ACM Trans. Softw. Eng. Methodol. 33, 8 (2024), 220:1–220:79. doi:10.1145/3695988
[52] Biting Huang, Zhilei Han, and Fei He. 2026. Accurate Inference of Termination Conditions. In Proceedings of the 48th IEEE/ACM International Conference on Software Engineering. 1–13. doi:10.1145/3744916.3764568
[53] Adharsh Kamath, Nausheen Mohammed, Aditya Senthilnathan, Saikat Chakraborty, Pantazis Deligiannis, Shuvendu K Lahiri, Akash Lal, Aseem Rastogi, Subhajit Roy, and Rahul Sharma. 2024. Leveraging LLMs for program verification. In Formal Methods in Computer-Aided Design (FMCAD). 107–118.
[54] Adharsh Kamath, Aditya Senthilnathan, Saikat Chakraborty, Pantazis Deligiannis, Shuvendu K. Lahiri, Akash Lal, Aseem Rastogi, Subhajit Roy, and Rahul Sharma. 2023. Finding Inductive Loop Invariants using Large Language Models. CoRR abs/2311.07948 (2023). doi:10.48550/ARXIV.2311.07948
[55] Daniel Kroening, Natasha Sharygina, Aliaksei Tsitovich, and Christoph M. Wintersteiger. 2010. Termination Analysis with Compositional Transition Invariants. In Proceedings of the 22nd International Conference on Computer Aided Verification. 89–103. doi:10.1007/978-3-642-14295-6_9
[56] Shuvendu K. Lahiri. 2024. Evaluating LLM-driven User-Intent Formalization for Verification-Aware Languages. In Formal Methods in Computer-Aided Design. IEEE, 142–147. doi:10.34727/2024/ISBN.978-3-85448-065-5_19
[57] Daniel Larraz, Albert Oliveras, Enric Rodríguez-Carbonell, and Albert Rubio. 2013. Proving termination of imperative programs using Max-SMT. In Formal Methods in Computer-Aided Design. IEEE, 218–225.
[58] Ton Chanh Le, Timos Antonopoulos, Parisa Fathololumi, Eric Koskinen, and ThanhVu Nguyen. 2020. DynamiTe: dynamic termination and non-termination proofs. Proc. ACM Program. Lang. 4, OOPSLA (2020), 189:1–189:30. doi:10.1145/3428257
[59] Ton Chanh Le, Cristian Gherghina, Aquinas Hobor, and Wei-Ngan Chin. 2014. A Resource-Based Logic for Termination and Non-termination Proofs. In Proceedings of the 16th International Conference on Formal Engineering Methods (ICFEM). Springer, 267–283. doi:10.1007/978-3-319-11737-9_18
[60] Ton Chanh Le, Shengchao Qin, and Wei-Ngan Chin. 2015. Termination and non-termination specification inference. In Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), David Grove and Stephen M. Blackburn (Eds.). ACM, 489–498. doi:10.1145/2737924.2737993
[61] Chin Soon Lee, Neil D. Jones, and Amir M. Ben-Amram. 2001. The size-change principle for program termination. In Proceedings of the 28th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL). ACM, 81–92. doi:10.1145/360204.360210
[62] Jan Leike and Matthias Heizmann. 2015. Ranking Templates for Linear Loops. Log. Methods Comput. Sci. 11, 1 (2015). doi:10.2168/LMCS-11(1:16)2015
[63] Yi Li, Xie Li, Yong Li, Xuechao Sun, Andrea Turrini, and Lijun Zhang. 2022. Synthesizing ranking functions for loop programs via SVM. Theor. Comput. Sci. 935 (2022), 1–20. doi:10.1016/J.TCS.2022.07.002
[64] Yue Chen Li, Stefan Zetzsche, and Siva Somayayjula. 2025. Dafny as Verification-Aware Intermediate Language for Code Generation. arXiv:2501.06283 [cs.SE]
[65] Ye Liu, Yue Xue, Daoyuan Wu, Yuqiang Sun, Yi Li, Miaolei Shi, and Yang Liu. 2025. PropertyGPT: LLM-driven Formal Verification of Smart Contracts through Retrieval-Augmented Property Generation. In Proceedings of the 32nd Annual Network and Distributed System Security Symposium (NDSS).
[66] Nils Lommen and Jürgen Giesl. 2025. AProVE(KoAT+LoAT) - (Competition Contribution). In Proceedings of the 31st International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS), Vol. 15698. 205–211. doi:10.1007/978-3-031-90660-2_13
[67] Nils Lommen and Jürgen Giesl. 2026. Modular Automatic Complexity Analysis of Recursive Integer Programs. In Proceedings of the 34th European Symposium on Programming on Programming Languages and Systems (ESOP).
[68] Lezhi Ma, Shangqing Liu, Lei Bu, Shangru Li, Yida Wang, and Yang Liu. 2024. SpecEval: Evaluating Code Comprehension in Large Language Models via Program Specifications. CoRR abs/2409.12866 (2024).
[69] Lezhi Ma, Shangqing Liu, Yi Li, Xiaofei Xie, and Lei Bu. 2025. SpecGen: Automated Generation of Formal Program Specifications via Large Language Models. In Proceedings of the 47th IEEE/ACM International Conference on Software Engineering (ICSE). IEEE, 16–28. doi:10.1109/ICSE55347.2025.00129
[70] Ravindra Metta, Hrishikesh Karmarkar, Kumar Madhukar, R. Venkatesh, and Supratik Chakraborty. 2024. PROTON: PRObes for Termination Or Not (Competition Contribution). In Proceedings of the 30th International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS). 393–398. doi:10.1007/978-3-031-57256-2_27
[71] Md Rakib Hossain Misu, Cristina V. Lopes, Iris Ma, and James Noble. 2024. Towards AI-Assisted Synthesis of Verified Dafny Methods. Proc. ACM Softw. Eng. 1, FSE (2024), 812–835.
[72] Eric Mugnier, Emmanuel Anaya Gonzalez, Ranjit Jhala, Nadia Polikarpova, and Yuanyuan Zhou. 2024. Laurel: Generating Dafny Assertions Using Large Language Models. CoRR abs/2405.16792 (2024).
[73] Diganta Mukhopadhyay, Ravindra Metta, Hrishikesh Karmarkar, and Kumar Madhukar. 2025. PROTON 2.1: Synthesizing ranking functions via fine-tuned locally hosted LLM (competition contribution). In International Conference on Tools and Algorithms for the Construction and Analysis of Systems. 242–247.
[74] Aditya V. Nori and Rahul Sharma. 2013. Termination proofs from tests. In Proceedings of the Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering (ESEC/FSE). ACM, 246–256. doi:10.1145/2491411.2491413
[75] Muhammad A. A. Pirzada, Giles Reger, Ahmed Bhayat, and Lucas C. Cordeiro. 2024. LLM-Generated Invariants for Bounded Model Checking Without Loop Unrolling. In Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering. 1395–1407.
[76] Andreas Podelski and Andrey Rybalchenko. 2004. A complete method for the synthesis of linear ranking functions. In International Workshop on Verification, Model Checking, and Abstract Interpretation. Springer, 239–251.
[77] Andreas Podelski and Andrey Rybalchenko. 2005. Transition predicate abstraction and fair termination. In Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL). ACM, 132–144. doi:10.1145/1040305.1040317
[78] Merlijn Sevenhuijsen, Khashayar Etemadi, and Mattias Nyberg. 2025. VeCoGen: Automating Generation of Formally Verified C Code With Large Language Models. In Proceedings of the 13th IEEE/ACM International Conference on Formal Methods in Software Engineering. 101–112. doi:10.1109/FORMALISE66629.2025.00017
[79] Xiuhan Shi, Xiaofei Xie, Yi Li, Yao Zhang, Sen Chen, and Xiaohong Li. 2022. Large-scale analysis of non-termination bugs in real-world OSS projects. In Proceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE). 256–268. doi:10.1145/3540250.3549129
[80] Oren Sultan, Jordi Armengol-Estapé, Pascal Kesseli, Julien Vanegue, Dafna Shahaf, Yossi Adi, and Peter W. O'Hearn. 2026. LLMs versus the Halting Problem: Revisiting Program Termination Prediction. CoRR abs/2601.18987 (2026). arXiv:2601.18987 doi:10.48550/ARXIV.2601.18987
[81] Alan Mathison Turing et al. 1936. On computable numbers, with an application to the Entscheidungsproblem. J. of Math 58, 345-363 (1936), 5.
[82] Caterina Urban. 2015. FuncTion: An Abstract Domain Functor for Termination - (Competition Contribution). In Proceedings of the 21st International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS). Springer, 464–466. doi:10.1007/978-3-662-46681-0_46
[83] Caterina Urban, Arie Gurfinkel, and Temesghen Kahsai. 2016. Synthesizing Ranking Functions from Bits and Pieces. In Proceedings of the 22nd International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS). Springer, 54–70. doi:10.1007/978-3-662-49674-9_4
[84] Haoze Wu, Clark W. Barrett, and Nina Narodytska. 2024. Lemur: Integrating Large Language Models in Automated Program Verification. In The 12th International Conference on Learning Representations.
[85] Rongchen Xu, Jianhui Chen, and Fei He. 2022. Data-driven loop bound learning for termination analysis. In Proceedings of the 44th International Conference on Software Engineering. 499–510. doi:10.1145/3510003.3510220
Li et al.
[86] Ziyao Zhang, Chong Wang, Yanlin Wang, Ensheng Shi, Yuchi Ma, Wanjun Zhong, Jiachi Chen, Mingzhi Mao, and Zibin Zheng. 2025. LLM Hallucinations in Practical Code Generation: Phenomena, Mechanism, and Mitigation. Proc. ACM Softw. Eng. 2, ISSTA (2025), 481–503. doi:10.1145/3728894
Received XX XXXX 20XX; revised XX XXXX 20XX; accepted XX XXXX 20XX