Guarantees for Sound Abstractions for Generalized Planning (Extended Paper)

Guarantees for Sound Abstractions for Generalized Planning
(Extended Paper)

Blai Bonet111On sabbatical leave from Universidad Simón Bolívar.    Raquel Fuentetaja    Yolanda E-Martín    Daniel Borrajo
\affiliationsUniversidad Simón Bolívar, Venezuela
Universidad Carlos III de Madrid, Spain
\, {rfuentet,yescuder},

Generalized planning is about finding plans that solve collections of planning instances, often infinite collections, rather than single instances. Recently it has been shown how to reduce the planning problem for generalized planning to the planning problem for a qualitative numerical problem; the latter being a reformulation that simultaneously captures all the instances in the collection. An important thread of research thus consists in finding such reformulations, or abstractions, automatically. A recent proposal learns the abstractions inductively from a finite and small sample of transitions from instances in the collection. However, as in all inductive processes, the learned abstraction is not guaranteed to be correct for the whole collection. In this work we address this limitation by performing an analysis of the abstraction with respect to the collection, and show how to obtain formal guarantees for generalization. These guarantees, in the form of first-order formulas, may be used to 1) define subcollections of instances on which the abstraction is guaranteed to be sound, 2) obtain necessary conditions for generalization under certain assumptions, and 3) do automated synthesis of complex invariants for planning problems. Our framework is general, it can be extended or combined with other approaches, and it has applications that go beyond generalized planning.

Guarantees for Sound Abstractions for Generalized Planning
(Extended Paper)

Blai Bonetthanks: On sabbatical leave from Universidad Simón Bolívar., Raquel Fuentetaja, Yolanda E-Martín, Daniel Borrajo

Universidad Simón Bolívar, Venezuela
Universidad Carlos III de Madrid, Spain, {rfuentet,yescuder},

1 Introduction

Generalized planning is about finding plans that solve a whole collection of instances of planning problems rather than finding a plan for a single instance as in classical planning [?????]. In its simplest form, the instances in the collection share a common pool of actions and observable features [??], yet other formulations consider relational domains where the actions and features in the instances result of grounding a collection of actions and atom schemas with different sets of objects [????].

A recent proposal for handling relational domains casts the problem of generalized planning as the problem of solving a single abstraction, or reformulation, that captures all the instances in the collection [?]. This abstraction however involves qualitative numerical features, in addition to the standard boolean features, that are defined in terms of the objects in the states and their relationships. The actions in the abstraction tell how the features change their values when actions are applied. Qualitative rather than exact numerical features are used to avoid undecidability issues [?]. The change for such features is only qualitative as they only specify whether the numerical feature increases, decreases, or remain unchanged. Under such effects, the problem of solving the abstraction, and hence the generalized planning problem, can be reduced to the problem of solving a single fully observable non-deterministic (FOND) problem [?].

This formulation of generalized planning is appealing as it leverages the existing FOND planners to solve, in one shot, a complete (often infinite) class of problems, but it requires the right set of features and the right abstraction. ? [?] learn the abstraction inductively from a small sample of transitions from instances in the collection. The abstraction is guaranteed to generalize when the sample is sufficiently general and diverse, but, as far as we know, there have been no attempts to automatically check whether the learned abstraction is sound for the collection.

In this work we bridge this gap by providing a general framework for the synthesis of guarantees for generalization. The guarantees are in the form of first-order formulas that provide sufficient conditions for generalization: every instance whose reachable states satisfy the formulas is guaranteed to be handled correctly by the abstraction. We only address the synthesis of such formulas and defer to future work the problem of verifying whether the formulas are satisfied on the reachable states of a given instance. Nonetheless, the automatically synthesized formulas have a rich and complex structure, and they often express novel and interesting invariants on well-known benchmarks. For example, in Blocksworld, the classical problem of moving blocks with a gripper, one such formula says that every tower must end in a clear block, a formula that thus forbids the existence of “circular towers”; we are not aware of any other approach for invariant synthesis that is able to produce such a formula.

Our contributions are the following: 1) a crisp theoretical foundation for the synthesis of formulas only using as input the relational planning domain and the abstraction, 2) the obtained formulas define subcollections of instances that are guaranteed to be handled correctly by the abstraction, 3) under additional assumptions, necessary conditions for generalization are obtained, and 4) the synthesis also provides candidates for invariants that would then need to be verified.

The paper is organized as follows. The next section provides background on the feature-based account for generalized planning. First-order structures and abstractions are discussed in Sect. 3. The framework for generalization and the synthesis algorithm are given in Sect. 4 and 5. Sect. 6, discusses necessary conditions and the synthesis of invariants. The paper concludes with examples and a discussion.

2 Background

2.1 Collections of Instances

We consider collections of grounded STRIPS instances where is a set of atoms (propositions), is a set of actions, and and describe the initial and goal states of . It is assumed that all instances in result from grounding a common domain with a set of objects, particular to each instance, and descriptions of the initial and goal situations. As it is standard, specifies the constant and predicate symbols that define the propositions via the grounding process, and it also contains lifted action schemas that generate the set of grounded actions. denotes the class of all grounded instances for domain . Hence, as all instances in come from .

2.2 Abstractions

The boolean and numerical features are used to build uniform abstractions for the instances in . Such instances, although sharing a common relational domain, may differ substantially in the number of actions, objects, and observables.

A boolean feature for is a function that maps each instance and state for (reachable from the initial state of ) into a truth value . A numerical feature is a function that maps and into a non-negative integer . When or are clear from context we may simplify notation. The set of features for is denoted by . For boolean features , an -literal is either or , while for numerical features , an -literal is or .

An abstraction for is a tuple where is a set of features, is a set of abstract actions, and and describe the abstract initial and goal states in terms of the features. An abstract action is a pair where Pre is a collection of -literals, and Eff is a collection of effects for . Effects for boolean features are denoted by -literals, while effects for numerical features correspond to increments or decrements denoted by or respectively. The items and denote consistent sets of -literals. It is assumed that the effects of actions and are consistent sets of literals, and that is maximal consistent.111A set of -literals is consistent if for any boolean feature , excludes either or , and for any numerical feature , excludes either or . is maximal consistent if it is consistent, and is not consistent for any -literal .

The pair of initial and goal states in the abstraction complies with when complies with each instance in . The pair complies with the instance when the initial state of is consistent with , and if is a state in that is consistent with , then is a goal state for . A state in is consistent with (resp. ) iff (resp. ) is consistent, where denotes the boolean valuation of on ; i.e., . If the pair for the abstraction complies with , we write .

Following ? [?], an abstraction is sound for if it complies with and each action in is sound (for ). An abstract action is sound iff for each instance in and reachable state in where Pre holds in , represents at least one action from in . The abstract action represents the action in the state iff 1) the preconditions of and both hold in and respectively, and 2) the effects of and over are similar; namely,

  1. for any boolean feature in , if changes from true to false (resp. false to true) in the transition (where is the state that results of applying in ), then (resp. ),

  2. for any boolean feature in , if (resp. ) is in Eff, then is true (resp. false) in , and

  3. for each numerical feature in , (resp. ) appears in Eff if and only if (resp. ).

We write to denote that the abstract action represents the action in the (reachable) state of . In such a case, we also say that instantiates in . When there is no confusion about , we simplify notation to .

Soundness links plans for with generalized plans: if is a plan that solves an abstraction that is sound for and is an instance in , then any execution spawned by on reaches a goal state for . The execution is spawned by on iff 1)  instantiates in , for , 2)  is the boolean valuation of , for , 3) , for , and 4)  is the initial state of .

Example. Consider the collection with all Blocks-world instances with goal where is a fixed block. The domain has no explicit gripper, contains a single constant , and has two action schemas: to move block from block to the table, and to move block from block onto block . An abstraction for is where and is the feature that counts the number of blocks above , where , , and . It is easy to check that is sound and solved by the plan that executes whenever . An action or that “removes” a block from above in state is an action that instantiates in . Notice that since, for example, contains instances that have “circular towers”. ∎

2.3 Inductive Learning and Concepts

? [?] show how an abstraction can be learned from a sample of transitions and a collection of candidate features. In their approach, each feature in is associated with a concept that is obtained from a set of atomic concepts, and a concept grammar [?].222We do not consider the distance features [?] as it is not clear how to express them in first-order logic.

In general, a concept for may be thought of as a function that maps instances in and states in into sets of tuples of objects. Concepts define features: boolean features that denote whether is non-empty, and numerical features that denote the cardinality of . The concepts by ? are limited to denotations that are subsets of objects rather than object tuples.

3 First-Order Abstractions

We deal with formulas in first-order logic that are built from a signature given by the relational domain . The constants defined in appear as constant symbols in , and the predicates defined in appear as relational symbols of corresponding arity in . The signature also contains binary relations and for the binary predicates in . As usual, denotes the class of well-formed formulas over .

First-order formulas are interpreted over first-order structures, also called interpretations. We are only interested in structures that are associated with states. A state provides the universe of objects and the interpretations for the constant and relational symbols in . The interpretations for and , for the binary predicates , are provided by the transitive and reflexive-transitive closure of the interpretation of provided by . We write to denote a formula whose free variables are among those in . If is a formula, is a state in , and is a tuple of objects in of dimension , denotes that the interpretation provided by satisfies when the variables in are interpreted by the corresponding objects in .

For a concept characterized by , the extension of for in is . We assume that all features correspond to concepts whose characteristic functions are first-order definable:

Definition 1 (First-Order Abstraction).

Let be a planning domain and let be the signature for . A concept is (first-order) -definable if belongs to . A feature is -definable if is given by a concept that is -definable. An abstraction is a first-order abstraction for if each feature in is -definable.

When is clear from the context, we just say that is a first-order abstraction without mentioning . The applicability of an abstract action in a first-order abstraction on a state can be decided with a first-order formula .

Example. The abstraction is a first-order abstraction because and is the cardinality of the concept given by . However, is also given by . As usual, both representations may yield different results although being logically equivalent; more about this below. ∎

4 Conditions for Generalization

Let be a first-order abstraction for . We look for conditions to establish the soundness of for a generalized problem . In particular, we aim for conditions of the form where is associated with the abstract action and satisfies the following:

  1. is an action schema in ,

  2. is a tuple of variables that represent the parameters of the action schemas in (these are existentially quantified on the objects of the given state in problem ), and

  3. if is a tuple of objects of dimension such that , where is a reachable state in problem , then the ground action instantiates the abstract action in the state (i.e., ).

The idea is that suffices to establish directly from and the (lifted) domain without using any other information about the reachability of state (e.g., invariant information for reachable states). On the other hand, such formulas would be “accompanied” by assumed conditions on the reachable states that together with the above properties provide the guarantee:

Definition 2 (Guarantee).

Let be a planning domain and let be a first-order abstraction. A guarantee for is a set of formulas for each abstract action in . The guarantee is valid in instance iff for each state (reachable or not) and tuple of objects in , if then . The guarantee is valid for iff it is valid for each problem in .

Theorem 3 (Soundness).

Let be a planning domain, let be a first-order abstraction, and let be a guarantee for . If is valid, then is a sound abstraction for the generalized problem holds in the reachable states in .


Let be a problem in , let be a reachable state in , and let be an abstract action that is applicable in . Since , we only need to show for some action . By definition of , where . Hence, there is a tuple of objects such that for some schema in . Then, by Definition 2, . ∎

5 Synthesis

For a feature defined by concept we need to track its value along transitions . Let be a formula that defines at state the extension of in the state that results of applying in ; i.e.,

where is a tuple of objects. For example, a boolean feature defined by goes from true to false in iff and iff and iff .

Since the concept may be defined in terms of relations or that denote the transitive closure of , and that transitive closure is not first-order definable [?], it is not always possible to track in first-order logic the change of denotation for or after an action changes the denotation of . Hence, we settle for a “logical approximation” of in terms of necessary and sufficient conditions:

A base for synthesis provides approximations for all the atoms in the language :

Definition 4 (Base for Synthesis).

A base for synthesis for domain is a set that contains formulas for , action schemas , and predicates of arity . It also contains formulas for , action schemas , binary predicates , and at least one of or . These formulas should provide necessary and sufficient conditions as follows. For any problem in , state in , tuple such that is applicable at , tuple , objects and , and :

where and are the concepts associated with and respectively.

The approximation for the atoms in that is provided by the base is lifted over all first-order formulas. Indeed, the following structural induction gives necessary and sufficient conditions and for any concept defined in terms of formula . For :

  1. where is a predicate of arity , or for some binary predicate , and ,

  2. where ,

  3. and , and

  4. where .

The base provides approximations for either or , or both. In the former case, this is enough since one of the closures can be expressed in terms of the other; e.g., ).

Below we propose a general base for synthesis of formulas. With this base, the formulas and are identical except when contains a transitive closure. Hence, except for such , both formulas are necessary and sufficient.

Theorem 5 (Lift).

Let be a base for synthesis for domain , let be an schema in , and let be a first-order formula in . Then, for any instance in , state for , and tuples and of objects in :

As noted earlier, tracking the change of boolean features defined by concepts is easy since is true or false at iff is non-empty or empty respectively. Tracking the qualitative numerical changes is more challenging, however. For example, increases in the transition iff . This condition is difficult to capture because the extension of may increase size by the result of a small change, as simple as one new element entering the set, or by a large change involving many elements. The case of local, small, changes is common and easy to define:

Definition 6 (Monotonicity).

Let be a domain and let be an instance in . A concept for is monotone in if for every reachable state in , and action that is applicable in , either , , or for . A first-order abstraction is monotone for if each feature in is defined by a concept that is -definable and monotone.

Necessary and sufficient conditions for the change of value of monotone features along transitions , for action schema , are provided by the formulas:

where is the concept that defines , denotes a necessary or sufficient condition, and denote and respectively, and and .

For example, . If , there is object tuple such that ; i.e., and . For monotone features, the only possibility is which means that the feature decreases in the transition .

For obtaining sufficient conditions for general features, the first two formulas from above are strengthen as

where the added conjunct enforces that the feature defined by the concept is indeed monotone. For the remaining cases, the formulas for sufficiency correspond to those above.

Lemma 7.

Let be a concept characterized by formula , and let be a state in on which the action is applicable. Then,

where is the result of applying in .

Reference Formula
(action adds at most 1 -atom)
(action adds 2 or more -atoms)
Table 1: General base for synthesis of any domain . is abbreviated by Post. . There are two versions of the necessary condition for ; one for actions that add at most one atom , and the other for actions that add two or more atoms of this form. The first version uses a conjunction, , while the second version replaces it with a disjunction.

We have expressed how the value of individual features changes in transitions. Before providing the complete synthesis, we need to express the value of preconditions of abstract actions, and how the actions affect the different features.

Preconditions of abstract actions on features are expressed by if there is no precondition on , if is boolean (resp. numeric) and contains (resp. ), and if is boolean (resp. numeric) and contains (resp. ).

On the other hand, partitions the set of features according to their type and the effects of on them:

Definition 8 (Synthesis).

Let be a base for synthesis for domain , and let be a first-order abstraction for . For abstract action in and schema in , we define the formula as

where . The guarantee for is .

Theorem 9 (Main).

Let be a base for synthesis for domain , and let be a first-order abstraction. Then, is a valid guarantee for (cf. Definition 2).

We cannot yet provide a complete example because the synthesis requires the conditions for the atoms in the language that are given by the base for synthesis. We now provide one such base, and apply it to the running example.

5.1 A General Base for Synthesis

The synthesis framework is parametrized by the base. Trivial, non-informative, bases are easy to obtain: it is enough to define sufficient and necessary conditions as and respectively for each atom in the language. We provide a simple, general, and non-trivial base that can be used with any domain . The conditions provided by two different bases, or by the same base for different but logically equivalent formulas, do not need to be logically equivalent.

Table 1 shows a template for obtaining bases for any domain . No formula in the template involves the predicate ; i.e., all such predicates have been replaced by equivalent formulas involving . (Alternatively, we may define a base that only resolves and assumes that no formula contains .) Two versions for the necessary condition for are provided: one when the action adds at most one atom , and the other when adds two or more such atoms.

The formulas in Table 1 involve “bracket expressions” that instantiate to first-order formulas. For schema and tuple , a bracket expression reduces to either to a logical constant or , or to an expression involving equality over the variables in and , and the constant symbols in . For example, reduces to for the action since this action removes only .

Theorem 10 (General Base).

Let be a planning domain. The set is a base for synthesis for domain .

Corollary 11.

Let be a domain and let be a first-order abstraction for . The guarantee is valid for and, hence, is a sound abstraction for the generalized problem and holds in the reachable states in .

Example. The abstraction has a single feature for . has two schemas and . The condition for is equivalent (after simplification) to

The formula is this formula conjoined with . For action , is

The formula is this formula conjoined with , , and . The guarantee for is .

By Corollary 11, is sound for instances with goal and reachable states that satisfy . Namely, if there is a block above , then either there are blocks and such that is clear and on , is or above it, and mediates any “path of blocks” from to , or there are blocks , and such that is clear, on , and above , is clear and not equal to or above it, and mediates any path from to . This formula indeed holds in all “real instances” of Blocksworld.