Abstract

We present a complete method for synthesizing lexicographic linear ranking functions (and thus proving termination), supported by inductive invariants, in the case where the transition relation of the program includes disjunctions and existentials (large block encoding of control flow). Previous work would either synthesize a ranking function at every basic block head, not just loop headers, which reduces the scope of programs that may be proved to be terminating, or expand large block transitions including tests into (exponentially many) elementary transitions, prior to computing the ranking function, resulting in a very large global constraint system. In contrast, our algorithm incrementally refines a global linear constraint system according to extremal counterexamples: only constraints that exclude spurious solutions are included. Experiments with our tool Termite show marked performance and scalability improvements compared to other systems.

Highlights

  • IntroductionProgram termination is shown by exhibiting a ranking function — a function from program states to a well-founded ordering, such that taking any transition in the program makes the function decrease

  • Program termination is shown by exhibiting a ranking function — a function from program states to a well-founded ordering, such that taking any transition in the program makes the function decrease.Because the problem of finding a ranking function is equivalent to that of proving termination, which is undecidable, automated approaches are incomplete: they typically search for ranking functions in restricted classes: if a ranking function is found, the program necessarily terminates, but it may still terminate even though no function is found within the class

  • Various methods for the automated synthesis of such functions have been proposed [16]; they build a constraint system in the unknowns αi,p and solve it. This class is extended to lexicographic linear ranking functions: instead of a single function ρ(x), one uses a tuple of them ρ1(x), . . . , ρm(x), which is shown to be strictly decreasing with

Read more

Summary

Introduction

Program termination is shown by exhibiting a ranking function — a function from program states to a well-founded ordering, such that taking any transition in the program makes the function decrease. Various methods for the automated synthesis of such functions have been proposed [16]; they build a constraint system in the unknowns αi,p and solve it This class is extended to lexicographic linear ranking functions: instead of a single function ρ(x), one uses a tuple of them ρ1(x), . There exists loops such that there is a linear lexicographic ranking function that decreases along each path inside the loop, from one loop iteration to the but such that there is no lexicographic linear ranking function that decreases at each step along these paths For these reasons, it is tempting to treat each path inside a loop as a single transition [11]; the number of paths may be exponential in the size of the program (e.g. if the loop consists in t successive if--else tests, the number of paths is 2t), the constraint system may become very large, even though it features fewer variables.

Preliminary definitions
Closed convex polyhedra
Transitions
Monodimensional weak ranking functions of maximal termination power
Maximal “termination power” and strict ranking functions
A wrong but intuitive algorithm
Termination problems
Non termination due to the absence of a strict ranking function
SMT formulas with unbounded domain
Implementation
LLVM and SSA
Algorithm modifications for SSA
Architecture
Extensions and Future works
Conclusion

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.