10.07.2015 Views

A New Look at the Automatic Synthesis of Linear Ranking Functions$

A New Look at the Automatic Synthesis of Linear Ranking Functions$

A New Look at the Automatic Synthesis of Linear Ranking Functions$

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>the</strong>refore, ranking functions on <strong>the</strong> n<strong>at</strong>urals are sufficient, for instance, whenmodeling <strong>the</strong> input <strong>of</strong> values for commonly available built-in d<strong>at</strong>a types. However,<strong>the</strong> use <strong>of</strong> more general well-founded orderings can simplify <strong>the</strong> search fora ranking function (see, e.g., [3, Example 1.2]). Moreover, such a generaliz<strong>at</strong>ionis mand<strong>at</strong>ory when dealing with unbounded nondeterminism [2] (see also [4,Section 10]).The termin<strong>at</strong>ion <strong>of</strong> a set <strong>of</strong> comput<strong>at</strong>ions and <strong>the</strong> existence <strong>of</strong> a rankingfunction for such a set are thus completely equivalent. On <strong>the</strong> one hand, thismeans th<strong>at</strong> trying to prove th<strong>at</strong> a ranking function exists is, <strong>at</strong> least in principle,not less powerful than any o<strong>the</strong>r method we may use to prove termin<strong>at</strong>ion.On <strong>the</strong> o<strong>the</strong>r hand, undecidability <strong>of</strong> <strong>the</strong> termin<strong>at</strong>ion problem implies th<strong>at</strong> <strong>the</strong>existence <strong>of</strong> a ranking function is also undecidable. An obvious way to prove<strong>the</strong> existence <strong>of</strong> a ranking function is to syn<strong>the</strong>size one from <strong>the</strong> program textand a description <strong>of</strong> <strong>the</strong> initial st<strong>at</strong>es: because <strong>of</strong> undecidability, <strong>the</strong>re exists noalgorithm th<strong>at</strong> can do th<strong>at</strong> in general.The use <strong>of</strong> ranking functions as a tool to reason about termin<strong>at</strong>ion can betraced back to <strong>the</strong> seminal work <strong>of</strong> R. W. Floyd in [5], where <strong>the</strong>y are introducedunder <strong>the</strong> name <strong>of</strong> W -functions. Since <strong>the</strong>n, several vari<strong>at</strong>ions <strong>of</strong> <strong>the</strong> methodhave been proposed so as to extend its applicability from <strong>the</strong> realm <strong>of</strong> classicalsequential programs to more general constructs (e.g., concurrency). In particular,in [4], seven different ‘à la Floyd’ induction principles for nondeterministictransition systems are formally shown to be sound, semantically complete andequivalent. For instance, it is shown th<strong>at</strong> it is sufficient to consider a single,global ranking function, instead <strong>of</strong> a different ranking function for each programcontrol point, as originally proposed in [5]; and th<strong>at</strong> <strong>the</strong> decrease <strong>of</strong> sucha global ranking function need not be verified <strong>at</strong> all program control points, butit is enough to consider a minimal set <strong>of</strong> loop cut-points; moreover, when tryingto prove properties th<strong>at</strong> only depend on <strong>the</strong> current st<strong>at</strong>e <strong>of</strong> <strong>the</strong> system (e.g.,termin<strong>at</strong>ion <strong>of</strong> a deterministic program), it is always possible to find a rankingfunction depending on <strong>the</strong> current st<strong>at</strong>e only, i.e., independent <strong>of</strong> <strong>the</strong> initialst<strong>at</strong>e <strong>of</strong> <strong>the</strong> system. Note th<strong>at</strong> <strong>the</strong>se results have been implicitly exploited in<strong>the</strong> examples above so as to simplify <strong>the</strong> present<strong>at</strong>ion <strong>of</strong> <strong>the</strong> method.In this paper we present, in very general terms so as to encompass any programmingparadigm, <strong>the</strong> approach to termin<strong>at</strong>ion analysis based on <strong>the</strong> explicitsearch <strong>of</strong> ranking functions. We <strong>the</strong>n restrict <strong>at</strong>tention to linear ranking functionsobtained from linear approxim<strong>at</strong>ions <strong>of</strong> <strong>the</strong> program’s semantics. For thisrestriction, we present and fully justify two methods to prove <strong>the</strong> existence <strong>of</strong> linearranking functions: one, based on work d<strong>at</strong>ed 1991 by Sohn and Van Gelder,th<strong>at</strong> is almost unknown outside <strong>the</strong> field <strong>of</strong> logic programming even though, aswe demonstr<strong>at</strong>e in <strong>the</strong> present paper, it is completely general; <strong>the</strong> o<strong>the</strong>r, dueto Podelski and Rybalchenko, d<strong>at</strong>ed 2004, was proved correct by <strong>the</strong> authorsbut <strong>the</strong> reasons why it works were never presented. We <strong>the</strong>n provide a pro<strong>of</strong> <strong>of</strong>equivalence <strong>of</strong> <strong>the</strong> two methods, thus providing an independent assessment <strong>of</strong><strong>the</strong>ir correctness and rel<strong>at</strong>ive completeness. We also compare <strong>the</strong>ir <strong>the</strong>oreticalcomplexity and practical efficiency on three rel<strong>at</strong>ed problems:4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!