Program specialisation as a preprocessing step for termination analysis

Previous works have shown that the structure information of a logic program can be used to transform it to another program such that the transformation is termination preserving and termination proof becomes easier and more precise [1,2]. In [2], a transformation which is based on partial evaluation and predicate renaming was proposed. However, this work was done specifically for the Terminweb’s setting with its focus on binary clauses. Another limitation of the work is that only few experiments were performed. In this paper, we present a transformation technique which consists of two simple steps: Predicate Renaming. Based on the different structural information of predicates collected in a given program, a predicate is split into different predicates and the program is transformed to a new one. This transformation process is termination and non-termination preserving. Program unfolding. Partial evaluation is applied to unfold the program in a way such that both termination and non-termination are preserved. It is done by using ECCE, a well-known off-the-shelf partial evaluator. The advantage of this technique is that it applies directly to logic programs without binarising them. Therefore, it can be considered as a pre-processing step for termination analysis in general and can be integrated into any termination analyser. In this paper, we use Polytool, a tool for automated termination proof which is based on polynomial interpretations but in its most simple form: only linear interpretations are used. First, we apply predicate renaming on the original program to generate a new program, and if the termination prover fails, then we apply program unfolding and do termination analysis again on the unfolded program. Note that these two steps are independent and can be applied individually and in any order. We have done an extensive experiment on a large number of benchmarks and the re-