Arc-Consistency for Quantified Constraints

5 downloads 0 Views 201KB Size Report
Abstract. The generalization of the satisfiability problem with arbi- trary quantifiers is a challenging problem of both theoretical and prac- tical relevance.
Appears in: Proc. of the 8th Int. Conf. on Constraint Programming (CP) — Springer LNCS, 2002

Beyond NP: Arc-Consistency for Quantified Constraints Lucas Bordeaux and Eric Monfroy Institut de Recherche en Informatique de Nantes (IRIN), France {bordeaux,monfroy}@irin.univ-nantes.fr

Abstract. The generalization of the satisfiability problem with arbitrary quantifiers is a challenging problem of both theoretical and practical relevance. Being PSPACE-complete, it provides a canonical model for solving other PSPACE tasks which naturally arise in AI. Effective SAT-based solvers have been designed very recently for the special case of boolean constraints. We propose to consider the more general problem where constraints are arbitrary relations over finite domains. Adopting the viewpoint of constraint-propagation techniques so successful for CSPs, we provide a theoretical study of this problem. Our main result is to propose quantified arc-consistency as a natural extension of the classical CSP notion.

1

Introduction

Many problems arising in Artificial Intelligence or engineering can be modelled as Constraint Satisfaction Problems (CSPs), but some are beyond the scope of the usual, existentially quantified satisfiability framework. For instance, a typical problem in game algorithms is to find a winning strategy for a two-player game. Intuitively, the question a player would like answered at any moment is stated as follows: Does there exist a move, s.t. for any move of the opponent, there exists a move s.t. for any move . . .

I win?

This problem can be modelled as a logical formula with alternating quantifiers of the form ∃x1 ∀x2 ∃x3 . . . winning(x1 , . . . , xn ), where predicate winning is a boolean formula which encodes the rules of the game, and number n bounds the number of moves of the game. Such a problem, where some constraints relate arbitrarily quantified variables ranging over finite domains, shall be referred to as a Quantified Constraint Problem (QCP)1 . 1

As for CSPs, this name shall be used both for particular instances (“a QCP”) and for the general decision problem (“the QCP”).

The truth value of a QCP can be determined by a straightforward generalization of backtracking. This algorithm runs in polynomial space, but the central question is to prune its computation tree to avoid exponential runtimes. The connections between the QCP and Polynomial-Space are not fortuitous since this problem is indeed complete for PSPACE, a complexity class which contains NP and is a subset of Exponential Time2 [20, 16]. PSPACE is the natural class for some important problems in AI, some instances being STRIPS-planning [6], reasoning tasks in various logics [11, 15], search on state graphs [3], as well as many games [19]. Heuristics have been proposed for some of these problems (e.g., A⋆ for graph-search), but the QCP plays a central role. Just as constraintsatisfaction is a good prototypical problem to design algorithms for NP, the QCP is a natural representative of PSPACE (see [11] for recent applications which use a direct encoding of some PSPACE problems as QCPs). Despite their potential applications, quantified constraints have remained objects of purely theoretical interest for years, and it is only very recently that solvers have been implemented to solve Quantified Boolean Formulae (QBF). All of the algorithms we are aware of either rely on or generalize SAT algorithms, such as resolution [5], Davis-Putnam and DLL [7, 18], or backtracking and improvements [14] (due to space restrictions we do not cite all recent related publications). In this paper, we propose to study the general problem of quantified constraints over arbitrary finite domains, of which the boolean case is a particular instance. We attempt to apply to this problem some of the tools which have proved successful for CSPs, most notably the notions of local consistency. Our main contribution is to propose a notion of quantified arc consistency, which generalizes the usual CSP notion. Stronger notions of consistency are also suggested; hence arbitrary levels of filtering can be obtained, at the cost of a higher, but polynomial complexity. The paper attempts to give a complete overview of the approach and of its similarities and differences with the usual CSP framework. The concepts introduced are exemplified on two classes of problems: Quantified Boolean Formulae, and a class of quantified numerical constraints for which we know of no other published algorithm. Outline A presentation of the basic logical material and of the problem considered is given in the next section (2). Section 3 discusses notions of local consistency which are adapted from CSPs. The purpose of local consistency is to define filtering methods, on which further details are given in Section 4, and which are exemplified on boolean and numerical domains. Section 5 briefly discusses issues regarding the search algorithm. Section 6 provides additional discussions, and next comes the conclusion (7). 2

These two inclusions are strongly suspected, but not proved, to be strict.

An illustration of our approach To give a taste of our approach, consider the (rather simple) logical statement ∃x ∈ [1..100] ∀y ∈ [1..100] (x + y ≤ 101), which is obviously true.

step A > : x D  x ⊇ {1}, Dy ⊇ {1}

Dx ⊇ {0}, Dy ⊆ {0} D  x ⊇ {1}, Dy ⊆ {1} Dy ⊇ {0} ∃x∀y (¬x = y) 8Dy ⊇ {1} Dx ⊆ {1} > > < D ⊆ {0} x ∃x∃y (¬x = y) Dy ⊆ {1} > > : Dy ⊆ {0} ∀x∃y (¬x = y)

=⇒ =⇒ =⇒ =⇒ =⇒ =⇒ =⇒ =⇒ =⇒ =⇒ =⇒ =⇒

f ail f ail f ail f ail f ail f ail x 6= 0 x 6= 1 y 6= 1 y 6= 0 x 6= 1 x 6= 0

8 < Dx ⊆ {1} ∃x∀y∃z (x ∨ y = z)

=⇒ z 6= 0 Dz ⊆ {1}, Dy ⊇ {0} =⇒ x 6= 0 : Dz ⊆ {0}, Dy ⊇ {1} =⇒ f ail

Fig. 6. Boolean propagation: rules for ¬ and ∨.

4.3

Numerical constraints

Constraint propagation over numerical domains may be expressed using, for example, the formalism developed by Codognet and Diaz [8]. To conclude our section on filtering, we use a similar framework to suggest how interval constraintpropagation may be adapted to quantifiers. Using the notations of the interval community, we note x = [x, x] the interval associated to variable x. Once again, we do not represent the program obtained for each of the 9 combinations of quantifiers: ∀x∀y∃z (x + y = z) =⇒ z = [x + y, x + y]

 ∃x∀y∃z (x + y = z) =⇒

z ⊆ [x + y, x + y] x ⊆ [z − y, z − y] ∩ [z − y, z − y]

 ∃x∀y∀z (x + y = z) =⇒ z ⊆

max{z − y, z − y, z − y, z − y}, min{z − y, z − y, z − y, z − y}



Fig. 7. A taste of quantified interval propagation.

The reading of these consequences is not as easy as in the boolean case; hence we prove each of them in detail: – The constraints of the first line of the table (∀∀∃) have similar trees to that of Fig. 2. As for this figure, the promising values for z are S all S those which are sums or the previous branches, i.e., those of the form x y x + y. The bounds of this set are exactly what is computed by the interval addition [x, x] + [y, y] = [x + y, x + y]

– The propagation over x for formula ∃x∀y∃z is more complicated. The simplest justification for it is that the set of allowed T values S for x is {x | ∀y ∈ [y, y], ∃z ∈ [z, z], x + y = z} which is precisely y z z − y. The bounds S S of this set are computed by ( z z − y) ∩ ( z z − y), which is equal to ([z, z] − y) ∩ ([z, z] − y), which we wrote [z − y, z − y] ∩ [z − y, z − y]. – Last, the values allowed for x in the third constraint (∃∀∀) are obtained as the intersection ∩{z − y, z − y, z − y, z − y}, which is empty as soon as either y 6= y or z 6= z. Much more place would be required to give a full description of a quantified interval arithmetics for constraint propagation, and this will be the subject of some of our future work, but we found it important to show by these examples that the framework developed in this paper is general enough to allow this kind of reasoning. In particular, we now have all elements to explain the computation suggested in example 1. Example 5. (cf. Fig. 1) The formula ∃x ∈ [1, 100] ∀y ∈ [1, 100] (x + y ≤ 101) is decomposed into the QCP ∃x ∈ [1, 100] ∀y ∈ [1, 100] ∃z (x + y = z, z ≤ 101). Arc-consistency considers the two QCPs (A) ∃x ∈ [1, 100] ∀y ∈ [1, 100] ∃z (x + y = z) and (B) ∃z (z ≤ 101). Using rule 2 of Fig. 7 on QCP A, we get the bounds [2, 200] for z, which we reduce to [2, 101] by existential propagation on QCP B. Using the QCP A to propagate on x, we get x = ([2, 101]−1)∩([2, 101]−100) = [1, 100] ∩ [−98, 1] = [1, 1].

5

Maintaining Consistency During the Search

The core of the paper was focused on the propagation framework. Local consistency is maintained at each node of the search tree to avoid combinatorial explosion. The search algorithm is straightforward, but two questions remain a little tricky; we briefly discuss them. truth value(q) : % (prune the variables by propagation) V ; if q is of the form ∀xQ⋆ (C) then Wv∈D truth value (Q⋆ (σx=v (C))) if q is of the form ∃xQ⋆ (C) then v∈D truth value (Q⋆ (σx=v (C))) otherwise eval(q) % no more quantifiers Fig. 8. General algorithm for solving the QCP.

5.1

Primal and Dual consistency

Arc-consistency allows to reduce the domains of existentially quantified variables by proving that some choices are inconsistent. Clearly, we also need to define some kind of filtering for universal variables, otherwise the runtime shall be exponential in the number of these variables. In particular, we need to be able to detect that a QCP be tautological. The most natural idea is that this

pruning can be achieved using classical propagation on a dual problem, which models the negation of the statement. This dual problem is easily computed since the negation of a formula Q1 x1 . . . Qn xn (C1 ∧ . . . ∧ Cm ) is defined as Q′1 x1 , . . . Q′n xn (C1 ∨ . . . ∨ Cm ), where each quantifier is reversed and Ci denotes the complement of Ci . Local inconsistency of the dual proves that the original problem is true. Of course, proving universal statements is not easy, and the disjunction obtained can be hard to disprove. 5.2

Incrementality

Incrementality is a well-known desirable feature in constraint-programming. In usual CSPs, incrementality means that when an existential quantifier is eliminated during the search, the information deduced previously still holds, and the propagation can hence be optimized. Questions regarding incrementality are not as easy when universal quantifiers are allowed. Due to lack of space, we just suggest the fact that algorithm 8 is actually incremental. The reason is that even for a universal statement, the set of consistent values is the union of the consistent values for each leaf. Hence the fact of eliminating a universal quantifier necessarily preserves all the inconsistencies computed previously.

6

Discussion

Since the problem of Quantified Constraints has not been considered in the literature yet, we find it essential to insist on related work and perspectives. 6.1

Connections to other works

Though quantifiers have been considered in several research fields, the QCP viewpoint presents some particularities. The QBF problem deals with propositional logic (variables are seen as proposition symbols), unlike the more general problem of first-order quantified logic with predicate symbols, which is a central issue in the field of automated reasoning. Note that this problem is recursively enumerable, while the QCP is a decidable, and purely combinatorial problem. In our approach, a key feature is that we propose solutions to handle quantified numerical problems. Closely related is the literature initiated by Tarski’s work on the decidability of first-order theorems over the real numbers, with such techniques as Cylindrical Algebraic Decomposition. The problem of first-order, real-valued constraints is indeed very different from the discrete constraints discussed in this paper, since the problem is not even solvable in exponential time (at least to our knowledge). Nevertheless, recent effort to mix these techniques with continuous constraint satisfaction [4, 17] could help bridging the two research areas. In particular, the relaxed problem of solving quantified equations over the finite-precision approximations of the real numbers induced by the floating-point machine representation is obviously in PSPACE, and hence closer to our concerns.

Last, quantified constraints have been considered by several independent authors in the CP literature, including a work on quantified rational trees [9] (a problem not even elementary) and a work on a generalization of interval propagation with exotic quantifiers [21]. 6.2

Further developments

This paper has suggested some of the possibilities opened up by constraintpropagation on a new class of problems. Much work remains to be done on both the practical and theoretical sides: – Our framework defines constraint-propagation in operational terms, using considerations on the search-tree itself to provide pruning. The question of defining consistency in more logical terms is still open; – We have seen that the definition of constraint propagation rules in Section 4 is a tedious task. This problem legitimates the use of automated solver generation techniques [1], which we plan to experiment; – Intensive experiments and benchmarking are now needed to determine the practical relevance of the notions of arc-consistency and of stronger consistency; in particular, the comparison to existing, specialized techniques for QBFs shall be informative, since this recent community has already developed a set of benchmarks.

7

Conclusion

In this paper, we have proposed the Quantified Constraint Problem as a generalization of usual CSPs with arbitrary quantifiers. This framework generalizes a class of boolean problems which has recently received a lot of attention. The technical contribution of the paper was to introduce quantified arcconsistency as a tool to model the propagation of information among quantified variables. We have tried to clarify the theoretical foundations of quantified constraint-propagation, and we have exemplified the class of local deductions obtained on boolean problems and on a new class of numerical problems.

Acknowledgments This paper received helpful comments from Evgueni Petrov and other colleagues at IRIN. Information provided by A. G. D. Rowley is also gratefully acknowledged. Last, we are indebted to the authors of [13], whose title we somewhat plagiarized.

References 1. K. Apt and E. Monfroy. Automatic generation of constraint propagation algorithms for small finite domains. In Proc. of the 5th Int. Conf. on Principles and Practice of Constraint Programming (CP), pages 58–72, Alexandria, Virginia, 1999. Springer.

2. K. R. Apt. The essence of constraint propagation. Theoretical Computer Science, 221(1-2):179–210, 1999. 3. J. L. Balc´ azar. The complexity of searching implicit graphs. Artificial Intelligence, 86(1):171–188, 1996. 4. F. Benhamou and F. Goualard. Universally quantified interval constraints. In Proc. of the 6th Int. Conf. on Principles and Practice of Constraint Programming (CP), LNCS, pages 67–82, Singapore, 2000. Springer. 5. H. K. Buening, M. Karpinski, and A. Flogel. Resolution for quantified boolean formulas. Information and Computation, 117(1):12–18, 1995. 6. T. Bylander. The computational complexity of propositional STRIPS planning. Artificial Intelligence, 69(1-2):165–204, 1994. 7. M. Cadoli, A Giovanardi, and M. Schaerf. An algorithm to evaluate quantified boolean formulae. In Proc. of the 15th Nat. Conf. on AI (AAAI), pages 262–267, Madison, USA, 1999. AAAI/MIT Press. 8. P. Codognet and D. Diaz. Compiling constraints in CLP(FD). J. of Logic Programming, 27(3):185–226, 1996. 9. A. Colmerauer and T. Dao. Expressiveness of full first order constraints in the algebra of finite or infinite trees. In Proc. of the 6th Int. Conf. on Principles and Practice of Constraint Programming (CP), LNCS, pages 172–186, Singapore, 2000. Springer. 10. R. Dechter and P. van Beek. Local and global relational consistency. Theoretical Computer Science, 173(1):283–308, 1997. 11. U. Egly, T. Eiter, H. Tompits, and S. Woltran. Solving advanced reasoning tasks using quantified boolean formulas. In Proc. of the 17th Nat. Conf. on AI (AAAI), pages 417–422, Austin, TX, 2001. AAAI/MIT Press. 12. T. W. Fruehwirth. Theory and practice of Constraint Handling Rules. J. of Logic Programming, 37(1-3):95–138, 1998. 13. I. P. Gent and T. Walsh. Beyond NP: the QSAT phase transition. In Proc. of the 15th Nat. Conf. on AI (AAAI), pages 648–653, Madison, USA, 1999. AAAI/MIT Press. 14. E. Giunchiglia, M. Narizzano, and A. Tacchella. Learning for quantified boolean logic satisfiability. In Proc. of the 18th Nat. Conf. on AI, Edmonton, Alberta, 2002. AAAI/MIT Press. To appear. 15. G. Gottlob. Complexity results for nonmonotonic logics. J. of Logic and Computation, 2(3):397–425, 1992. 16. C. Papadimitriou. Computational Complexity. Addison Wesley, 1994. 17. S. Ratschan. Continuous first-order constraint satisfaction. In Artificial Intelligence, Automated Reasoning, and Symbolic Computation, number 2385 in LNCS, Marseille, France, 2002. Springer. 18. J. Rintanen. Improvements to the evaluation of quantified boolean formulae. In Proc. of the 16th Int. Joint Conf. on AI (IJCAI), pages 1192–1197, Stockholm, Sweden, 1999. Morgan Kaufmann. 19. T. J. Schaefer. Complexity of decision problems based on finite two-person perfectinformation games. J. of Computer and System Sciences, 16(2):185–225, 1978. 20. L. J. Stockmeyer and A. R. Meyer. Word problems requiring exponential time: Preliminary report. In Conf. Record of the 5th Symp. on the Theory of Computing (STOC), pages 1–9, Austin, TX, 1973. ACM. 21. A. C. Ward, T. Lozano-Perez, and W. P. Seering. Extending the constraint propagation of intervals. In Proc. of the 11th Int. Joint Conf. on AI (IJCAI), pages 1453–1460, Detroit, Michigan, 1989. Morgan Kaufmann.