Are you an EPFL student looking for a semester project?
Work with us on data science and visualisation projects, and deploy your project as an app on top of Graph Search.
We address the problem of conditional termination, which is that of defining the set of initial configurations from which a given program always terminates. First we define the dual set, of initial configurations from which a non-terminating execution exists, as the greatest fixpoint of the function that maps a set of states into its pre-image with respect to the transition relation. This definition allows to compute the weakest non-termination precondition if at least one of the following holds: (i) the transition relation is deterministic, (ii) the descending Kleene sequence over-approximating the greatest fixpoint converges in finitely many steps, or (iii) the transition relation is well founded. We show that this is the case for two classes of relations, namely octagonal and finite monoid affine relations. Moreover, since the closed forms of these relations can be defined in Presburger arithmetic, we obtain the decidability of the termination problem for such loops. We show that the weakest non-termination precondition for octagonal relations can be computed in time polynomial in the size of the binary representation of the relation. Furthermore, for every well-founded octagonal relation, we prove the existence of an effectively computable well-founded witness relation for which a linear ranking function exists. For the class of linear affine relations we show that the weakest non-termination precondition can be defined in Presburger arithmetic if the relation has the finite monoid property. Otherwise, for a more general subclass, called polynomially bounded affine relations, we give a method of under-approximating the termination preconditions. Finally, we apply the method of computing weakest non-termination preconditions for conjunctive relations (octagonal or affine) to computing termination preconditions for programs with complex transition relations. We provide algorithms for computing transition invariants and termination preconditions, and define a class of programs, whose control structure has no nested loops, for which these algorithms provide precise results. Moreover, it is shown that, for programs with no nested control loops, and whose loops are labeled with octagonal constraints, the dual problem i. e. the existence of infinite runs, is NP-complete.
Annalisa Buffa, Pablo Antolin Sanchez, Margarita Chasapi