A Best-First Planner for Rippling Moa Johansson M.K.Johansson@sms.ed.ac.uk University of Edinburgh, Appleton Tower, Crichton St, Edinburgh EH8 9LE 1 Introduction Rippling [2] is a heuristic for reducing the differences between formulas, typically between some given and a goal. It was originally designed to help solve step-cases of inductive proofs. To ensure progress is made, rippling requires each rewriting step to be skeleton preserving, meaning that the parts of the goal that is similar to the given must be preserved through the rippling process. Termination is ensured by defining a ripple-measure, which must decrease in each step. If these requirements are not fulfilled the step is regarded as invalid. There are however a number of occasions where these invalid ripple-steps would be useful or necessary for the success of rippling. In proofs about mutual recursion, the skeleton might be temporarily disrupted but restored in a later step [2] (section 5.9). Another example is proofs where it is necessary to perform a rewrite inside the wave-front, which may not decrease the ripple measure [1]. Best-first rippling is an extension of rippling that recasts the measure decrease and skeleton preservation requirements as heuristic scores instead of strictly enforcing them. Best-first search is used to decide which state to consider next. Previously illegal steps may now be considered if nothing better is available, allowing rippling to smoothly turn towards regular rewriting. 2 Implementation Best-first rippling has been implemented in the IsaPlanner proof-planner [3]. A fuller description of the implementation can be found in [5]. We have used IsaPlanner’s higher-order dynamic rippling [4] as a starting point, with extensions to assign heuristic scores to non-measure decreasing and non-skeleton preserving states, instead of discarding them. IsaPlanner’s generic best-first search is supplied with a heuristic function and used to guide the search. The heuristic function for comparing reasoning states during the rippling process can be summarised as follows: • Skeleton preserving states are always given a better score than non-skeleton preserving states. • If both reasoning states preserve the skeleton, a state that improves the ripple measure with respect to its parent state is preferred to a state that does not improve over its parent. • When both or neither of the states improves over their parents, the state with the best ripple measure is given the higher score. If the states have the same ripple measure, they are given equal heuristic scores. • If neither state preserves the skeleton, the reasoning state with the smallest goal-term scores better. 1 The price for the greater flexibility of best-first rippling is that the guarantee of termination for rippling is lost. As a partial solution to this problem, we implement a cache for visited states, avoiding the possibility of looping by applying the same rewrite rule in opposite directions, which may happen as non-measure decreasing steps are allowed. Another source of non-termination arise in proofs about mutual recursion where some rewrites potentially increase the size of the subgoal infinitely. To avoid this, the heuristic function gives preference to non-skeleton preserving states with smaller goal-terms. 3 Results Best-first rippling was tested and compared to ordinary depth-first rippling on a set of 71 problems, including 41 benchmark problems from IsaPlanner and 30 problems known to be difficult for depthfirst rippling. Best-first rippling successfully solved 32 of 41 benchmark problems and all of the additional problems while ordinary rippling solved 30 of the benchmarks and only 8 problems from the additional set. None of the test-problems were solvable by standard rippling but not by best-first rippling. The runtimes for best-first rippling was on average somewhat longer than for depth-first rippling. This was expected as the search space for best-first rippling is increased and heuristic scores need to be computed and compared at each step. The differences in runtime are however not very large, and in some cases even considerably better, thanks to the improved heuristic guidance from the best-first search. A limitation of the current implementation is that it does not always terminate, in particular if the original conjecture is actually false and involve mutually recursive functions. A possible solution is to restrict the maximum depth of the search and to disallow states that can embed a previous state, as these represent unproductive rewrites just blowing up the size of the goal term. We also plan to improve on the current implementation by adding support for assigning heuristic scores to critics and weak fertilisation. Best-first rippling does not become blocked as often as ordinary rippling. It would be desirable to sometimes fire a critic before rippling has failed completely, if the critic has a better heuristic score than continued rippling. References [1] A. Bundy. The termination of rippling + unblocking. Informatics research paper 880, University of Edinburgh, 1998. [2] A. Bundy, D. Basin, D. Hutter, and A. Ireland. Rippling: Meta-level Guidance for Mathematical Reasoning. Cambridge University Press, 2005. [3] L. Dixon and J. Fleuriot. IsaPlanner: A prototype proof planner in Isabelle. In Proceedings of CADE’03, pages 279–283, 2003. [4] L. Dixon and J. Fleuriot. Higher-order rippling in IsaPlanner. In Proceedings of TPHOLs’04, pages 83–98, 2004. [5] M. Johansson. A best-first planner for rippling. Unpublished undergraduate dissertation, University of Edinburgh, 2005. 2