Program Termination and Well Partial Orderings

Program Termination and Well Partial Orderings

Program Termination and Well Partial Orderings ANDREAS BLASS University of Michigan and YURI GUREVICH Microsoft Research The following known observation is useful in establishing program termination: if a transitive relation R is covered by ¯nitely many well-founded relations U1;:::;Un then R is well-founded. A question arises how to bound the ordinal height jRj of the relation R in terms of the ordinals ®i = jUij. We introduce the notion of the stature kP k of a well partial ordering P and show that jRj · k®1 £ ¢ ¢ ¢ £ ®nk and that this bound is tight. The notion of stature is of considerable independent interest. We de¯ne kP k as the ordinal height of the forest of nonempty bad sequences of P , but it has many other natural and equivalent de¯nitions. In particular, kP k is the supremum, and in fact the maximum, of the lengths of linearizations of P . And k®1 £ ¢ ¢ ¢ £ ®nk is equal to the natural product ®1 ­ ¢ ¢ ¢ ­ ®n. Categories and Subject Descriptors: F.2.0 [Analysis of Algorithms and Program Complex- ity]: General General Terms: Algorithms, Theory Additional Key Words and Phrases: Program termination, Well partial orderings, Covering ob- servation, Game criterion 1. INTRODUCTION A program ¼, possibly nondeterministic, is terminating if every computation of ¼ from an initial state is ¯nite. If there is a computation of ¼ from state x to state y, we say that y is reachable from x and write y Á x. A state y is reachable if it is reachable from an initial state. In practice termination is often established by means of ranking functions. A ranking function for ¼ is an ordinal-valued function f on the reachable states of ¼ such that f(y) < f(x) whenever y Á x. Clearly ¼ is terminating if and only if the reachability relation Á over reachable states is well-founded if and only if ¼ admits a ranking function. If ¼ is terminating then Authors' addresses: Andreas Blass, Mathematics Department, University of Michigan, Ann Arbor, MI 48109{1043, U.S.A., ablass@umich:edu; Yuri Gurevich, Microsoft Research, One Microsoft Way, Redmond, WA 98052, U.S.A., gurevich@microsoft:com. The work of the ¯rst author was partially supported by NSF grant DMS{0070723 and by a grant from Microsoft Research. Permission to make digital/hard copy of all or part of this material without fee for personal or classroom use provided that the copies are not made or distributed for pro¯t or commercial advantage, the ACM copyright/server notice, the title of the publication, and its date appear, and notice is given that copying is by permission of the ACM, Inc. To copy otherwise, to republish, to post on servers, or to redistribute to lists requires prior speci¯c permission and/or a fee. °c 2006 ACM 1529-3785/06/1200-0001 $5.00 ACM Transactions on Computational Logic, Vol. V, No. N, December 2006, Pages 1{25. 2 ¢ A. Blass and Y. Gurevich the smallest ordinal ® such that ¼ admits a ranking function with values < ® is the ranking height of ¼. The following observation may be helpful in establishing termination. Lemma 1 (Covering Observation). Any transitive relation covered by ¯nitely many well-founded relations is well-founded. In other words, if relations U1;:::;Un are well-founded and R ⊆ U1 [ ¢ ¢ ¢ [ Un is a transitive relation, then R is well-founded. Apparently this observation was made independently a number of times, and each time it was related to the termination problem. As far as we know, the observation was made ¯rst by Alfons Geser in [1990, page 31]. A weaker form of the observation, in which the relations Ui are required to be transitive, had been proposed as a question on the web by Geser, and he informed us that he received proofs of it from Jean-Pierre Jouannaud, Werner Nutt, Franz Baader, George McNulty, Thomas Streicher, and Dieter Hofbauer; see [Lescanne, discussion list, items 38{42] for all but the last two of these. Both of our two referees pointed out that the observation was made independently in [Lee et al. 2001]. One of them wrote that \the covering observation lies at the heart of" [Lee et al. 2001] where it \is used implicitly in Theorem 4." The other referee pointed out that the covering observation was made independently in [Dershowitz et al. 2001] and in [Codish et al. 2003]; see [Bruynooghe et al. ] in this connection. Recently the covering observation was rediscovered in [Podelski and Rybalchenko 2004] and was used for proving termination in [Podelski and Rybalchenko 2005; Cook et al. 2006; Berdine et al. 2007]. A stronger version of the covering observation, using a hypothesis that is weaker (but more complicated) than transitivity of R, was given in [Doornbos and Von Karger 1998]. The covering observation is proved by a straightforward application of the in¯nite version of Ramsey's theorem. The transitivity of R is essential here. If a; b are distinct elements then the relation f(a; b); (b; a)g is covered by the well-founded relations f(a; b)g and f(b; a)g but is not well-founded. Example 2. Let ¼1 be the program while a · 1000 · b choose between a,b := a+2, b+1 a,b := a-1, b-1 with integer variables a; b. Initially, a and b could be any integers. Since ¼1's reachability relation y Á x is covered by well-founded relations ax < ay · 1002 and 999 · by < bx, ¼1 terminates. Obviously the ranking height of ¼1 isn't ¯nite. In fact it is !, the least in¯nite ordinal, because the function j3b ¡ 2aj is a ranking function for ¼1. (The absolute value is used to guarantee that all values of the function are natural numbers.) Let ¼2 be the following modi¯cation of ¼1. while a · 1000 · b choose between a := a+1 a,b := arbitrary integer, b-1 ACM Transactions on Computational Logic, Vol. V, No. N, December 2006. Program Termination and Well Partial Orderings ¢ 3 Again, the covering observation applies, with the well-founded covering relations ax < ay · 1001 and 999 · by < bx. It is easy to see that the ranking height of ¼2 2 is ! . In particular the function !b + j1000 ¡ aj is a ranking function for ¼2. Example 3. Let ¼3 be the program while F 6= N2 choose (a,b)2 N2 ¡ F F := F [ f(a0,b0)2 N2: a0 ¸ a and b0 ¸ bg where N is the set of natural numbers, F ⊆ N2, and initially F = ;. Think of F as the set of forbidden pairs. Initially, no pairs are forbidden, but once a pair becomes forbidden it remains so forever. As long as some pairs are not yet forbidden, the program nondeterministically chooses a non-forbidden pair (a; b) and forbids it and 0 0 0 0 all pairs (a ; b ) such that a ¸ a and b ¸ b. For every noninitial state x of ¼3 let A(x) = minfa :(a; b) 2 Fx for some bg: where Fx is F at state x. If x is the initial state, de¯ne A(x) = 1. De¯ne the 2 function B(x) similarly. De¯ne C(x) to be the number of points (a; b) 2 N ¡ Fx such that a ¸ A(x) and b ¸ B(x). It is not hard to see that C(x) is always ¯nite. ¼3's reachability relation y Á x is covered by the three well-founded relations A(y) < A(x), B(y) < B(x), and C(y) < C(x). By the covering observation, ¼3 is terminating. But this time the ranking height of the program is less obvious. It is !2 + 1; the initial state has rank !2, and the rank of a noninitial state x is ! ¢ (A(x) + B(x)) + C(x). In x 2.2, we recall the de¯nition of the ordinal height jRj of a well-founded relation R as well as the de¯nition of the ordinal height jxjR of any element x in the domain of R. If a program ¼ is terminating then the ordinal height jxjÁ is a ranking function, and jxjÁ · f(x) for any ranking function f for ¼. It follows that the ranking height of ¼ is the ordinal height j Á j of ¼'s reachability relation Á. Our colleague, Byron Cook, working on a program-termination prover [Cook et al. 2006], asked the following question [Cook 2005]. Question 4 (Covering Question). If a transitive relation R is covered by well- founded relations U1;:::;Un, what is the best bound on jRj in terms of the ordinals ®i = jUij? The covering question led us to investigate well partially ordered sets (in short, wpo sets). Recall that a sequence hx0; x1;:::i, ¯nite or in¯nite, of elements of a partially ordered set P is bad if there are no indices i < j with xi · xj and that a partially ordered set P is wpo if every bad sequence in P is ¯nite. In x 4, we introduce the key notion of this study, the stature kP k of a wpo set P . We de¯ne kP k as the ordinal height of the forest of nonempty bad sequences of P . We then give, in the same section, several alternative and equivalent de¯nitions of kP k. In particular, kP k is the height of the well-founded poset of proper ideals of P . In our view, the notion of stature is of central importance to the theory of wpo sets. ACM Transactions on Computational Logic, Vol. V, No. N, December 2006. 4 ¢ A. Blass and Y.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    25 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us