Beyond NP: Quantifying over Answer Sets
Giovanni Amendola, Francesco Ricca, Mirek Truszczynski

TL;DR
This paper introduces ASP with Quantifiers (ASP(Q)), an extension of Answer Set Programming that enables modeling of problems in the Polynomial Hierarchy by adding quantifiers over stable models, thus expanding ASP's expressiveness.
Contribution
The paper proposes ASP(Q), a novel extension of ASP that incorporates quantifiers over stable models, allowing direct modeling of problems beyond NP in the Polynomial Hierarchy.
Findings
ASP(Q) can model problems in the Polynomial Hierarchy.
ASP(Q) demonstrates natural encodings for complex AI and number theory problems.
Comparison shows ASP(Q) extends ASP's modeling capabilities significantly.
Abstract
Answer Set Programming (ASP) is a logic programming paradigm featuring a purely declarative language with comparatively high modeling capabilities. Indeed, ASP can model problems in NP in a compact and elegant way. However, modeling problems beyond NP with ASP is known to be complicated, on the one hand, and limited to problems in {\Sigma}^P_2 on the other. Inspired by the way Quantified Boolean Formulas extend SAT formulas to model problems beyond NP, we propose an extension of ASP that introduces quantifiers over stable models of programs. We name the new language ASP with Quantifiers (ASP(Q)). In the paper we identify computational properties of ASP(Q); we highlight its modeling capabilities by reporting natural encodings of several complex problems with applications in artificial intelligence and number theory; and we compare ASP(Q) with related languages. Arguably, ASP(Q) allows…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
\jdate
March 2003
\pagerangeBeyond NP: Quantifying over Answer Sets–Beyond NP: Quantifying over Answer Sets
Beyond NP: Quantifying over Answer Sets
GIOVANNI AMENDOLA1
FRANCESCO RICCA1
MIREK TRUSZCZYNSKI2
1University of Calabria
Rende
Italy
2University of Kentucky
{amendola,ricca}@mat.unical.it
KY
USA
(2003)
Abstract
Answer Set Programming (ASP) is a logic programming paradigm featuring a purely declarative language with comparatively high modeling capabilities. Indeed, ASP can model problems in NP in a compact and elegant way. However, modeling problems beyond NP with ASP is known to be complicated, on the one hand, and limited to problems in on the other. Inspired by the way Quantified Boolean Formulas extend SAT formulas to model problems beyond NP, we propose an extension of ASP that introduces quantifiers over stable models of programs. We name the new language ASP with Quantifiers (ASP(Q)). In the paper we identify computational properties of ASP(Q); we highlight its modeling capabilities by reporting natural encodings of several complex problems with applications in artificial intelligence and number theory; and we compare ASP(Q) with related languages. Arguably, ASP(Q) allows one to model problems in the Polynomial Hierarchy in a direct way, providing an elegant expansion of ASP beyond the class NP. Under consideration for acceptance in TPLP.
doi:
S1471068401001193
keywords:
ASP, Quantified Logics, Polynomial Hierarchy
1 Introduction
Answer Set Programming (ASP) [Brewka et al. (2011)] is a logic programming paradigm for modeling and solving search and optimization problems. It is supported by a purely declarative formalism of logic programs with the semantics of stable models [Gelfond and Lifschitz (1991)] (also known as answer sets [Lifschitz (2002)]), and by several systems able to compute them [Gebser et al. (2018)]. ASP was primarily aimed at problems whose decision versions are in the class NP. Indeed, ASP can model problems in NP in a compact and elegant way by means of an intuitive and easy to follow methodology known as generate-define-test [Lifschitz (2002)] (also known as guess and check [Eiter et al. (2000)]). Furthermore, implementations such as clasp [Gebser et al. (2015)], and wasp [Alviano et al. (2015)] have been shown to be effective in solving problems of practical interest on industrial-grade instances [Erdem et al. (2016)].
Modeling problems beyond the class NP with ASP is possible to some extent. Namely, when disjunctions are allowed in the heads of rules, every decision problem in the class can be modeled in a uniform way by a finite program [Dantsin et al. (2001)]. However, modeling problems beyond NP with ASP is complicated and the generate-define-test approach is no longer sufficient in general. Additional techniques such as saturation [Eiter and Gottlob (1995)] are needed but they are difficult to use, and may introduce constraints that have no direct relation to constraints of the problem being modeled. As stated explicitly in [Gebser et al. (2011)] “unlike the ease of common ASP modeling, […] these techniques are rather involved and hardly usable by ASP laymen.”
The primary goal of our work is to address the shortcomings of ASP in modeling problems beyond NP. Building on the way Quantified Boolean formulas (QBFs) extend SAT formulas to model problems from PSPACE, we propose a generalization of ASP that introduces quantifiers over stable models of programs. We name the new language ASP with Quantifiers (ASP(Q)) and refer to programs in that language as quantified programs.
In the paper we formally introduce the language ASP(Q) and its semantics. We identify computational properties of ASP(Q). In particular, we show that every problem in the Polynomial Hierarchy can be uniformly modeled by a quantified program. Moreover, we show that no loss of expressivity results if we restrict programs defining quantifiers to be normal. An important consequence of that observation is that when using ASP(Q) to model problems, one can resort to the generate-define-test approach to specify these “quantifying” programs. This typically simplifies modeling and verifying correctness. We illustrate these claims by presenting natural encodings of several complex problems with applications in artificial intelligence and mathematics.
In the last part of the paper, we compare ASP(Q) with alternative approaches for modeling problems beyond NP. Earlier efforts in this direction include: the stable-unstable formalism [Bogaerts et al. (2016)], various program transformations [Eiter and Polleres (2006), Redl (2017), Faber and Woltran (2011)], applications of meta-programming [Redl (2017), Gebser et al. (2011)] and more.111For example, weak constraints allow to model decision problems that are -complete [Buccafurri et al. (2000)]. In particular, we deepen the comparison with disjunctive programs and the stable-unstable formalism, indicating key differences and their implications by means of additional modeling examples. We also extensively compare ASP(Q) with the language of QBFs, which served as a direct inspiration for our work. A single sentence summary of our work is: ASP(Q) allows one to model problems in the Polynomial Hierarchy in a direct way, providing an elegant expansion of ASP beyond the class NP.
2 Formal Framework
We start by recalling syntax and semantics of Answer Set Programming (ASP). We then introduce syntax and semantics of ASP with Quantifiers (ASP(Q)).
2.1 Answer Set Programming
Let be a set of predicates, a set of constants, and a set of variables. A term is a constant or a variable. An atom of arity is of the form , where is a predicate from and are terms. A disjunctive rule is of the form
[TABLE]
where all , , and are atoms; and ; represents negation-as-failure, also known as default negation. The set is the head of ; the sets and are the sets of the positive body and the negative body atoms of , respectively. A rule is safe if each of its variables occurs in some positive body atom. We restrict attention to programs built of safe rules only. A rule is a fact, if (we then omit from the notation); a constraint, if ; normal, if ; and positive, if . A (disjunctive logic) program is a finite set of disjunctive rules. is called normal [resp. positive] if each is normal [resp. positive]. We define , that is the set of all atoms occurring in the program . A program is stratified if there is a level mapping of such that for every rule of : For any predicate occurring in , and for any occurring in , , and For any predicate occurring in , and for any occurring in , .
The Herbrand universe of , denoted by , is the set of all constants appearing in , except that when no constants appear in , we take , where is an arbitrary constant. The Herbrand base of , denoted as , is the set of all ground atoms that can be obtained from the predicate symbols appearing in and the constants of . Given a rule occurring in a program , a ground instance of is a rule obtained from by replacing every variable in by , where is a substitution mapping the variables occurring in to constants in . The ground instantiation of , denoted by , is the set of all the ground instances of the rules occurring in . Any set is an interpretation; it is a model of a program (denoted ) if for each rule , we have whenever and (in such case, is a model of , denoted ). A model of is minimal if no model of exists. We denote by the set of all minimal models of .
For a program without constraints we write for the well-known Gelfond-Lifschitz reduct [Gelfond and Lifschitz (1991)] with respect to interpretation , that is, the set of rules , obtained from rules such that . An answer set (or stable model) of a program without constraints is an interpretation such that . For the general case, we write for the set of constraints of a disjunctive logic program . We denote by the set of all answer sets (or stable models) of such programs , that is, the set of all answer sets of that are models for .
We say that a program is coherent, if it has at least one answer set (that is, ), otherwise, is incoherent.
2.2 Answer Set Programming with Quantifiers
An ASP with Quantifiers (ASP(Q)) program is an expression of the form:
[TABLE]
where, for each , , is an ASP program, and is a stratified normal ASP program.222This condition is sufficient to model compactly constraints by exploiting the modeling advantages of inductive definitions. is contemplated in the definition of ASP(Q) just because it makes more natural the modeling of problems. Symbols and are named existential and universal answer set quantifiers, respectively. An ASP(Q) program of the form (2) is existential (universal, respectively) if (, respectively). If for each the ASP program is normal, then is called a normal ASP(Q) program. Given a logic program and an intepretation over , and an ASP(Q) program the form (2), we denote by the set of facts and constraints , and by the ASP(Q) program of the form (2), where is replaced by , that is, . We now define coherence of ASP(Q) programs by induction on the number of quantifiers in the program.
- •
is coherent, if there exists such that is coherent;
- •
is coherent, if for every , is coherent;
- •
is coherent, if there exists such that is coherent;
- •
is coherent, if for every , is coherent.
For instance, an ASP(Q) program is coherent if there exists an answer set of such that for each answer set of there is an answer set of there is an answer set of such that for each answer set of , there is an answer set of , where , and , if .
For an ASP(Q) program of the form (2) such that , we say that is a quantified answer set of , whenever is coherent, in case of , and whenever is coherent, in case of . We denote by the set of all quantified answer sets of . Finally, note that the definition of quantified answer set can be naturally extended to programs with strong negation, choice rules, aggregates and other extensions [Gebser and Schaub (2016)]. Thus, in the examples we resort also to these extensions that are part of the ASPCore standard input language [Gebser et al. (2018)].
Example 1
Consider the ASP(Q) program , where , , and . The program has two answer sets and . Hence, to establish the coherence of , we have to check if at least one of and is a quantified answer set of . Considering , we have . Under the notation used above, . Thus, . For we have , and it is clear that the program is not coherent. Therefore, is not a quantified answer set of . On the other hand, a similar analysis for the other answer set of , , shows that it is a quantified answer set of .
ASP(Q) is a straightforward generalization of ASP in a sense made formal in the following theorem.
Theorem 1
Let be an ASP program, and let be the ASP(Q) program of the form (2), where , , , and . Then, .
Proof 2.2**.**
By definition, is a quantified answer set of if and only if is an answer set of and is coherent. The latter condition is trivially true as is an answer set of .
3 Complexity issues
We now study the computational properties of the ASP(Q) language. As it is customary in the literature we focus on the ground case, that is we assume that no variable occurs in programs.
Because it is possible to alternate universal and existential answer set quantifiers, it is clear that ASP(Q) can model probelms beyond NP. In particular, each problem in PSPACE can be modeled by using an ASP(Q) program. Formally, we define the Coherence problem as follows: Given an ASP(Q) program as input, decide whether is coherent.
Theorem 3.3**.**
The Coherence problem is PSPACE-complete, even under the restriction to normal ASP(Q) programs.
Proof 3.4**.**
(Membership) It is well known that answer sets of a disjunctive logic program can be enumerated in polynomial space in the size of the program. Let us assume that is a polynomial providing that bound. We prove that the coherence of an program of the form (2) can be decided in space , where is the size of , and is the number of quantifiers in .
To this end, we consider the following recursive algorithm. It consists of enumerating all answer sets of . If , we have . To decide coherence, for each enumerated answer set of , we decide whether is coherent. Depending on whether or , if for some (every) answer set of , is coherent, we return that is coherent. Otherwise, we return that is not coherent. For , for each enumerated answer set of , we recursively check whether is coherent, and decide about coherence of similarly as in the case , depending on the outermost quantifier.
By the comment above, we can enumerate all answer sets of in space (indeed, ). Moreover, if , testing coherence of can be accomplished in time and so, also in space . Thus, if , the algorithm requires space, establishing the base case of the induction. If , we need space for enumerating answer sets and, using the induction hypothesis, space for each recursive call. Thus, the total space requirement is , completing the inductive step.
We now observe that , which shows that the algorithm we described runs in space . This implies the assertion.
(Hardness) We give a reduction from the problem of deciding the validity of a QBF formula , where for every , and is a propositional variable, and where is a propositional formula over . The problem is PSPACE-complete even when is in 3-CNF. Thus, let us assume that , where and , for each . We construct an ASP(Q) program as follows. For each , we define and . We also define , where if , and if . It is easy to see that is coherent iff is valid. Moreover, as each program is normal, is a normal ASP(Q) program.
As for QBFs, there is a direct correspondence between the number of alternating quantifiers and the level of the Polynomial Hierarchy (PH) for which we have competeness of the coherence problem.
Theorem 3.5**.**
The Coherence problem is -complete for normal existential ASP(Q) programs with quantifiers in the prefix; and -complete for normal universal ASP(Q) programs with quantifiers in the prefix.
Proof 3.6**.**
(Membership) We proceed by induction on . We start with . If then deciding coherence amounts to checking whether there is an answer set of such that is coherent. This problem is in NP () because one can check coherence of a normal stratified program with constraints in polynomial time [Dantsin et al. (2001)]. If then deciding coherence amounts to checking whether there is no answer set of such that is not coherent. This problem is in co-NP () because its complement, the problem to decide whether there is an answer set of such that is not coherent, is in NP (indeed, one can check coherence of a normal stratified program with constraints in polynomial time).
Next, let us assume that . Further, let be a normal ASP(Q) program of the form (2). If , then to decide coherence of we have to decide whether there is an interpretation such that is an answer set of and is coherent. Checking that is an answer set of is a polynomial-time task (we recall that is normal). Checking that is coherent can be accomplished with a call to an oracle for a problem in or in depending on whether in is or . Indeed, by the induction hypothesis, the problem of deciding coherence for normal programs with quantifiers and with the outermost quantifier fixed to (, respectively) is in (, respectively).
If , to decide coherence of we have to decide that for every answer set of , is coherent. The complement to this problem consists of deciding whether there is an an answer set of such that is not coherent. By a similar argument as above, this problem is in (observe that an oracle deciding whether an program is coherent, can be used to decide whether an program is not coherent). It follows that deciding coherence for programs with quantifiers in the prefix and with as the outermost quantifier is in .
(Hardness) Let us consider a QBF , where are disjoint sets of propositional variables, each or , the quantifiers alternate, and is a 3-CNF or 3-DNF formula over the variables in . We encode as an program of the form (2) as follows. For every , we set and (similarly as in the previous proof). If is a 3-CNF formula, we define a normal stratified program with constraints as in the previous proof. So, assume is a 3-DNF formula, say , where and , for each . In this case, we set , where if , and if .
It is easy to see that in both cases is valid iff is coherent. Moreover, both encodings can be obtained by a polynomial-time procedure. Now, according to well-known complexity results [Stockmeyer (1976)] the problem to decide validity for QBFs such that (1) , is in 3-DNF, and is even; (2) , is in 3-CNF, and is odd; (3) , is in 3-CNF, and is even; (4) , is in 3-DNF and is odd is -complete for the cases (1) and (2), and -complete for the cases (3) and (4). Thus, the hardness follows.
We note that, for classes of disjunctive programs that can be translated in polynomial time to normal ones, such as Head-Cycle Free (HCF) [Ben-Eliyahu and Dechter (1996)], the correspondence between quantifier alternations and the level of the Polynomial Hierarchy is preserved.
We also note that the theorem concerns, in each of the two cases, the corresponding class of all ASP(Q) programs with quantifiers. In particular, the membership part is proved for that class. The proof of hardness explicitly usues special programs in that class, the ones in which quantifiers alternate.
4 Modeling in ASP(Q)
In this section, we focus on the modeling capabilities of our language. Thus, we study some well-known problems that are computationally beyond NP, and show how to solve them in ASP(Q).
4.1 Minmax Clique
Minmax problems play a key role in various fields of research, including game theory, combinatorial optimization and computational complexity [Cao et al. (1995)]. A minimax problem can be formulated as , where is a function defined on the product set of and . Here, we focus on the so-called Minmax Clique problem [Ko (1995)], but our approach can be easily adapted to model other minmax problems.
Let be a graph, and two finite sets of indices, and a partition of . We write for the set of all total functions from to . For every total function we denote by the subgraph of induced by . We define the Minmax Clique problem as follows: Given a graph , sets of indices and , a partition (all as above), and an integer , decide whether
[TABLE]
It is known that this problem is -complete [Ko (1995)].
Consider the following ASP(Q) program . The ASP program is given by:
P_{1}=\left\{\begin{array}[]{rcll}\mathit{edge}(a,b)&&&\forall(a,b)\in E\\ \mathit{node}(a)&&&\forall a\in N\\ v(i,j,a)&&&\forall i\in I,\ j\in J,\ a\in A_{i,j}\\ setI(X)&\leftarrow&v(X,\_,\_)\\ setJ(X)&\leftarrow&v(\_,X,\_)\\ 1\{f(X,Y):setJ(Y)\}1&\leftarrow&setI(X)\end{array}\right\}
Informally, the role of is to specify the input graph, the sets and of indices, a partition , and the search space of all total functions from to . Specifically, the first two sets of facts encode the graph by using two predicates: a binary one named , collecting all edges of the graph; and a unary one named collecting all nodes of the graph. Then, the third set of facts encodes the partition by using a ternary predicate . Projections applied to (rules four and five) define elements of the sets and , respectively. Finally, the last rule defines the space of all total functions from to . The ASP program is defined as follows:
P_{2}=\left\{\begin{array}[]{rcl}\mathit{inInduced}(Z)&\leftarrow&v(X,Y,Z),\ f(X,Y)\\ \mathit{edgeP}(X,Y)&\leftarrow&\mathit{edge}(X,Y),\ \mathit{inInduced}(X),\ \mathit{inInduced}(Y)\\ \{\mathit{inClique}(X)\,:\,\mathit{inInduced}(X)\}&&\\ &\leftarrow&\mathit{inClique}(X),\ \mathit{inClique}(Y),\ not\ \mathit{edgeP}(X,Y)\end{array}\right\}
Its role is to define the subgraph of determined by a total function , and to select a clique in this subgraph. In particular, the first rule defines the set of nodes of the subgraph (whenever a node belongs to the set , and the function maps to , then is a node of ). The second rule ensures that whenever there is an edge from to , and both and are nodes of , then the edge is an edge of ( is the induced subgraph). The third rule allows to select nodes of the partition as candidates for a clique. The final constraint requires that it is not possible that two nodes and are in a clique and there is no edge in the subgraph from to . Finally, the program is defined as follows.
C=\left\{\begin{array}[]{cl}\leftarrow&\#\mbox{count}\{X:\mathit{inClique}(X)\}<k\end{array}\right\}
The constraint forces the number of nodes in a clique to be greater or equal to .
Intuitively, we check if for each answer set of , that is for each total function from to , there exists an answer set of , that is a clique in the subgraph of induced by , such that its cardinality is not less than . If so, a quantified answer set of exists.
Theorem 4.7**.**
Let be an instance of the Minmax Clique problem. Then,
[TABLE]
if and only if the ASP(Q) program , defined as above, has a quantified answer set.
4.2 Pebbling Number
Graph pebbling is a well-known mathematical game [Hurlbert (1999)]. It was first suggested as a tool for solving a particular problem in number theory [Chung (1989)]. The game consists of a graph with pebbles placed on (some of) its nodes. The goal is to place a pebble on a target node by performing a sequence of pebbling moves. More formally, let be a directed graph whose nodes may contain pebbles. A pebbling move along an edge requires that node contains at least two pebbles; the move removes two pebbles from and adds one pebble to . The pebbling number, denoted by , is the smallest number of pebbles such that for every assignment of pebbles to nodes of and for every node (the target), some sequence (possibly empty) of pebbling moves results in a pebble on . The Pebbling number problem asks whether is less than or equal to . This problem is -complete, and it remains so also when the target node is part of the input [Milans and Clark (2006)]. (For the latter version,we redefine accordingly.)
To capture the definition of the Pebbling number problem we construct an ASP(Q) program . Its program is defined as follows:
P_{1}=\left\{\begin{array}[]{rcll}edge(a,b)&&\forall(a,b)\in E\\ node(a)&&\forall a\in N\\ pebble(i)&&\forall i=0,1,\ldots,k\\ 1\{onNode(X,N):pebble(N)\}1&\leftarrow&node(X)\\ &\leftarrow&\#\mbox{sum}\{N,X:onNode(X,N)\}\neq k&\\ 1\{target(X):node(X)\}1&&\end{array}\right\}
The first two sets of facts encode the input graph, and the third one the set of integers that can serve as the number of pebbles a node can have. The first rule of the program (line 4) selects, for each node , the number of pebbles on . The second rule (line 5) ensures the total number of pebbles on all nodes of is . The last rule selects exactly one node as the target allowing any node to be selected. Thus, answer sets of capture all possible “input configurations” for , each configuration defined by a distribution of pebbles among nodes of and the target node.
The ASP program in is defined as follows:
P_{2}=\left\{\begin{array}[]{rcl}\step(i)&&\forall i=0,1,\ldots,k-1\\ 1\{\mathit{endstep}(S):\step(S)\}1\\ \mathit{onNode}(X,N,0)&\leftarrow&\mathit{onNode}(X,N)\\ 1\{\mathit{move}(X,Y,S):\mathit{edge}(X,Y)\}1&\leftarrow&\step(S),\mathit{endstep}(T),1\leq S,\ S\leq T\\ &\leftarrow&\mathit{move}(X,Y,S),\ \mathit{onNode}(X,N,S),\ N<2\\ \mathit{affected}(X,S)&\leftarrow&\mathit{move}(X,Y,S)\\ \mathit{affected}(Y,S)&\leftarrow&\mathit{move}(X,Y,S)\\ \mathit{onNode}(X,N-2,S)&\leftarrow&\mathit{onNode}(X,N,S-1),\mathit{move}(X,Y,S)\\ \mathit{onNode}(Y,M+1,S)&\leftarrow&\mathit{onNode}(Y,M,S-1),\mathit{move}(X,Y,S)\\ \mathit{onNode}(X,N,S)&\leftarrow&\mathit{onNode}(X,N,S-1),\textit{not}\ \mathit{affected}(X,S)\\ \end{array}\right\}
The first set of facts (line 1) encodes all integers that can serve as the number of pebbling moves. Since each pebbling move removes one pebble, any successful sequence of pebbling moves has length at most . Consequently, we may (and do) restrict these integers to . The first rule of (line 2) selects a single integer to represent the number of pebbling moves. The second rule of (the next line) defines the initial state of the graph (before any pebbling moves). It is given by the initial distribution of pebbles obtained from an answer set of the program (we overload the notation here; the predicate defining the intial configuration in is binary, while the predicate defined in is ternary; it has an additional argument to represent the step). The third rule selects an edge for the pebbling move step , where is the end step (defined via ). The constraint that follows imposes the pebbling move precondition: there must be at least two pebbles on the node where the pebbling move originates. The next two rules define the two nodes affected by the move. The last three rules define the state of the graph after the pebbling move in step (applied to the graph after pebbling moves). The first two of these three rules describe how the number of pebbles change on the nodes that are involved in the move. The last rule is the inertia rule that keeps the number of pebbles unchanged on all nodes unaffected by the move. Informally, answer sets of correspond to all valid sequences of pebbling moves that do not eliminate all pebbles and start in the initial state of the graph, together with the corresponding sequence of states of the graph.
Finally, the program in is defined as follows.
C=\left\{\begin{array}[]{rcl}ok(W)&\leftarrow&onNode(W,N,S),\ target(W),\mathit{endstep}(T)\ N>0\\ &\leftarrow&target(W),\ not\ ok(W)\end{array}\right\}
First rule defines to hold whenever is a target node and there is a pebble on it after the last pebbling move . The constraint ensures no answer set if has not been inferred.
Intuitively then, is coherent precisely when for each assignment of pebbles to nodes of a given graph and for every choice of a target node (that is, for every answer set of ) there is a sequence of pebbling moves of length at most (that is, there is an answer set for ) such that the target node has a pebble on it (that is, has an answer set).
Theorem 4.11**.**
Let be an instance of the Pebbling Number Problem. Then, if and only if the ASP(Q) program , defined as above, is coherent.
4.3 Vapnik-Chervonenkis Dimension
The Vapnik-Chervonenkis dimension (VC dimension) is a fundamental concept in machine learning theory [Vapnik and Chervonenkis (2015)]. The VC dimension is a measure of the capacity of a space of functions that can be learned by a statistical classification algorithm [Blumer et al. (1989)]. In particular, it is the cardinality of the largest set of points that the algorithm can shatter. In statistical learning theory, the VC dimension can predict probabilistic upper bounds on the test error of a classification model [Vapnik (1998)]. Further applications include finite automata, complexity theory, computability theory, and computational geometry.
Here, we focus on the so-called discrete VC dimension problem, where the considered universe is finite. The problem concerns families of subsets that are represented by Boolean circuits. However, we assume that the representation is given by a logic program capturing the corresponding formula. Specifically, we assume that a program representing a family of subsets of contains a unary predicate , and that extensions of the predicate in answer sets of are precisely the elements of . Constructing a program from a Boolean circuit representing is a matter of routine and can be accomplished in linear time. Let be an integer, a finite set, and a collection of subsets of represented by a program . The VC Dimension problem asks whether there is a subset of of size at least , such that for each subset of , there exists such that . The VC dimension of is defined as maximum size of such a set and is denoted by . Hence, the VC Dimension problem asks whether . It is known that this problem (assuming a circuit or a program representation of ) is -complete [Schaefer (1999)]. We will show that the problem can be described by an ASP(Q) program . The ASP program is defined as follows:
P_{1}=\left\{\begin{array}[]{rcll}inU(x)&&\forall x\in U\\ k\{inX(X):inU(X)\}&&\end{array}\right\}
The set of facts in line 1 encodes the elements of the set , while the choice rule in line 2 selects a subset of with at least elements. It is clear that answer sets of are all subsetes of with at least elements.
The ASP program consists of a single choice rule:
P_{2}=\left\{\begin{array}[]{c}\{inS(X):inX(X)\}\end{array}\right\}
Thus, answer sets of are subsets of a set (determined by a selected answer set of ).
For we simply take . Wlog, we may assume that shares no vocabulary elements with and . Thus, for every possible “input” from and , answer sets of , that is, extended with the input from and , determine elements of via extensions of the predicate .
Finally, the program is defined as follows (understanding as defined above):
C=\left\{\begin{array}[]{rcl}inIntersection(X)&\leftarrow&true(X),\ inX(X)\\ &\leftarrow&inIntersection(X),\ not\ inS(X)\\ &\leftarrow¬\ inIntersection(X),\ inS(X)\\ \end{array}\right\}
The first rule collects into predicate , the intersection of the selected set from (represented by an answer set of by means of the predicate ) and , a subset of selected via an answer set of . The two constraints force this intersection to coincide with the subset of (an answer set of extended with a selected answer set of as input representing ).
Intuitively, the program is coherent when there exists an answer set of (that is, a subset of of size at least ) such that for each answer set of (that is, for each subset of ), there exists an answer set of (that is, an element of ), such that is coherent (that is, is equal to ).
Theorem 4.12**.**
Let be an instance of the VC dimension problem. Then, if and only if the ASP(Q) program defined as above has a quantified answer set.
5 Related Work and Discussion
We now compare ASP(Q) with related work discussing pros and cons of the various approaches.
ASP(Q) vs QBF.
We first compare our proposal with Quantified Boolean Formulas (QBF) [Biere et al. (2009)]. QBF is a natural extension of propositional formulas with quantifiers (existential) and (universal) operating on propositional variables. QFB was motivated by questions arising from computational complexity [Stockmeyer and Meyer (1973)]. The problem of checking the satisfiability of a propositional formula (SAT) is the canonical problem for the complexity class NP. The addition of quantifiers increases the complexity of satisfiability problem (QSAT) to PSPACE [Stockmeyer (1976)], and prefixes of alternating quantifiers yield problems that are complete for each complexity class of the Polynomial Hierarchy. For this reason the satisfiability problem of QBF formulas with prefixes of alternating quantifiers (- becomes the canonical problem for the -th level of the Polynomial Hierarchy). More precisely, - restricted to prefixes of length starting with an existential (resp. universal) quantifier is complete for (resp. ). ASP(Q) and QBF share the same motivation and intuition, indeed ASP(Q) extends ASP with quantifiers (as QBF extends SAT) to increase the modeling capabilities of the language beyond NP. As studied in Section 3, propositional ASP(Q) and QBF have similar computational properties. In particular, the coherence problem for both is PSPACE-complete and an even tighter correspondence holds between propositional normal ASP(Q) and QSAT. Nonetheless, there are important differences among the two languages, some inherited form the relation between SAT and ASP, and other concerning the semantics of quantifiers.
First, ASP(Q) supports variables, which gives a modeling advantage, and supports rapid prototyping, program optimization and maintenance of problem solution. Indeed, variables allow one to encode uniform compact representation of a problem over varying instances, while in QBF (as in SAT) each instance of a problem needs to be encoded in a specific formula by means of an encoding procedure. Second, even if in general QBF and ASP(Q) can solve the same computational problems, ASP(Q) inherits from ASP the possibility of encoding inductive definitions [Denecker and Vennekens (2014)], which are useful in modeling properties such as reachability in graphs (inductive definitions require larger instances in SAT and QBF that slow down modeling and solving). Next, ASP supports modeling extensions such as aggregates, choice rules, strong negation, and disjunction in rule heads that significantly simplify encodings used in SAT [Brewka et al. (2011)]. We have made extensive use of inductive definitions and aggregates in our examples in Section 4. Finally, we note that in QBF quantifiers range over variable assignments, whereas in ASP(Q) they quantify over the answer sets of each subprogram. This is yet another difference and a reason that ASP(Q) cannot be seen as a straightforward porting of the ideas behind QBF.
ASP(Q) vs ASP.
One of the distinguishing features of ASP is the capability of modeling problems in . This is possible because of the additional expressive power provided by disjunctive rules. Modeling in problems with ASP is rather natural if one can use only positive rules. For example, let us consider the strategic companies problem [Cadoli et al. (1997)]. In that problem, one has to compute a set of companies that cover the production of a set of goods also controlling other companies. A set of companies is said to be strategic if it: () covers the productions of all goods; () is subset-minimal; and, () every company controlled by at most three strategic companies is also strategic. In the setting in which each product is produced by at most two companies the problem is -complete and can be modeled as follows [Leone et al. (2006)]:
\begin{array}[]{rcl}strat(Y)\vee strat(X)&\leftarrow&prod\_by(P,X,Y)\\ strat(W)&\leftarrow&contr\_by(W,X,Y,Z),strat(X),strat(Y),strat(Z)\\ \end{array}
The first rule models condition , the second rule models condition (), and the minimality of answer sets ensures (). It is clear that this encoding of the problem can be directly translated to a single-quantifier disjunctive ASP(Q).
When problem constraints to be modeled involve negation, ASP modeling becomes less intuitive. In particular one has to resort to an encoding technique called saturation [Eiter and Gottlob (1995)]. It allows one to simulate a co-NP check in the program reduct. Saturation is at the basis of the celebrated encoding of 2-QBF by Eiter and Gottlob 1995 used to prove the complexity of checking existence of answer sets in presence of disjunction in rule heads. Given a 2-QBF formula , where is a DNF, and and are literals over , we encode in an ASP program as follows. First introduce a fresh atom modeling satisfiability, and a fresh atom for every atom ; and set and for every . Then write the program P_{\Phi}=\{z\vee nz|\forall z\in X\cup Y\}\cup\{y\leftarrow sat|\forall y\in Y\}$$\cup\{ny\leftarrow sat|\forall y\in Y\}\cup\{sat\leftarrow\sigma(L_{i,1}),\ldots,\sigma(L_{i,k_{i}})|i=1,\ldots,m\}\cup\{sat\leftarrow not\ sat\}.
Here the atoms corresponding to universally quantified variables are “saturated” (i.e., they are forced to be true in any answer set), and since the last rule is always removed while computing the reduct, must be derived for all assignments of truth values to to have an answer set. This trick ensures that is satisfiable if and only if has an answers set. Again, one could reformulate the program above into a disjunctive program with a single quantifier. However, using saturation in modeling is considered difficult. ASP(Q) offers an alternative and more intuitive approach, It uses normal quantified programs with two quantifiers that also capture (see Theorem 3.5). Indeed, let us consider a normal quantified program where
[TABLE]
[TABLE]
Here, a satisfiability of an existential 2-QBF is encoded directly. Indeed guesses an assignment to s.t. for all assignments to generated by , must be derived by satisfying at least one conjunct in , i.e., is satisfiable iff is. This discussion suggests that ASP(Q) improves on ASP modeling capabilities. It keeps the advantages of ASP in modeling concisely problems with positive programs, as for strategic companies, but also allows us to model other problems without resorting to difficult to use encoding techniques.
ASP(Q) vs Stable-Unstable.
To handle problems beyond NP, Bogaerts et al. 2016 proposed an extension of ASP inspired by an internal working principle of ASP solvers Gebser et al. (2018). Usually, in ASP solvers designed for problems in one procedure generates model candidates and another one, acting as an oracle, tests minimality of the candidates produced by the first procedure. It does so by verifying that a certain subprogram (in some cases, a SAT formula) has no stable models (is not satisfiable). Following this principle, Bogaerts et al. 2018 introduced combined logic programs, in which two normal logic programs play a role analogous to the one of the two procedures of ASP solvers mentioned above. A combined logic program is a pair of normal logic programs. Its semantics is given by parameterized stable models Oikarinen and Janhunen (2006); Denecker et al. (2012); a stable-unstable model of a combined program is a parameterized stable model of , say , such that no parameterized stable model of exists that coincides with in the intersection of the signatures of the two programs.
Comparing ASP(Q) programs with combined programs, we first note that combined programs involve the concept of parameters. In applications, the parameters of the generator program are used to represent problem instances (are “extensional”). This use of parameters is quite natural to ASP programmers and does not pose a conceptual difficulty. It is also used implicitly in ASP(Q) (stable models from each quantifier are passed on as “input” parameters to the next one).333We could also distinguish extensional predicates to specify “parameters,” that is, input instances, That would allow us to keep instance specification separate from the program. We decided not to do so here to simplify our presentation. However, the stable-unstable approach applies the notion of a parameterized stable model also in the checking phase using “negation,” that is, referring to non-existence of a certain parameterized stable model. This, arguably, makes the formalism much less direct than ASP(Q). It is especially clear when we move beyond the second level of the PH and the non-existence conditions become nested (incidentally, the stable-unstable paper contains no examples of modeling such problems).
If we factor out the issue of parameters, and limit ourselves to problems in , combined programs and ASP(Q) are closely related. Indeed, in ASP(Q) one has direct means to model “testing” conditions of the form “for all stable models (answer sets) of some program, a certain property holds.” In contrast, combined programs provide direct means to model “testing” conditions of the form “there exists no stable model of some program such that a certain property holds.” Switching between ASP(Q) and combined programs amounts then to simulating conditions of one form with conditions of the other and vice versa (effectively, negating constraints in a program). Such simulations are easy to design with the use of a small number of auxiliary variables (often one such new variable suffices). Consequently, both formalisms are on par for modeling problems that are complete for . However, for problem in , the difference between ASP(Q) and combined programs becomes evident. As an example, let us consider a 2-QBF formula , where is a 3-CNF formula. This problem can be naturally represented in ASP(Q) by using the encoding employed in the proof of Theorem 3.3. However once we try to encode it using a combined logic program (for well-known complexity reasons) we have either to adopt an exponential encoding, something analogous to quantifier expansion in QBF, or we have to use an additional nesting of programs (i.e., we are have to push the entire computation in the oracle). In both cases, the modeling would not result in a solution as natural and direct as the one provided by ASP(Q). The reason is that combined programs (as well as their generalizations beyond the second level) represent existential statements. Hence, they model complements of problems and not the problems themselves. In contrast, ASP(Q) can be used for such problems in a direct way providing representations closely following original problem descriptions (our examples illustrate this).
A related aspect concerns modeling itself, the process of mapping natural language specifications to formal expressions, which surfaces when one considers problems that require more than one quantifier alternation. It is important to note that combined logic programs were extended to deal with problems from any level of the PH in Bogaerts et al. (2016) by resorting to a recursive definition. This definition forces the programmer to think in terms of “nested oracles”, instead of translating problem description directly into a formal expression. Whereas for problems at the second level of the polynomial hierarchy it roughly corresponds to searching for a counterexample, for problems at higher levels, the recursion and the negation (needed because of the absence of direct means to represent universal statements), makes it harder to maintain the connection between problem description and oracles forming nested combined programs. In contrast, the interface between natural language problem description and ASP(Q) programs is transparent (in the same way as it is for QBF), as it is explicitly supported by the quantifiers, which may be existential or universal, as needed. In particular, the difficulty of modeling problems in , noted above, appears in the general setting of problems in , for : the stable-unstable formalism is not designed to directly express universal statements that characterize problems in .
The discussion above compares at an intutive informal level the modeling freatures of the two formalisms. It also suggests how the two are formally related. In the statement specifying the relation, the depth of the basic combined program is defined as 2. Each next level of nesting increments the depth by 1.
Theorem 5.13**.**
*(i) There is a polynomial-time reduction that assignes to every propositional nested combined program of depth , a normal existential ASP(Q) program with quantifiers such that answer sets of and , correspond to each other.
(ii) There is a polynomial-time reduction that assignes to every propositional normal existential ASP(Q) program with quantifiers in the prefix, a propositional nested combined program of depth such that answer sets of and correspond to each other.*
Thus, at the level of expressive power, combined programs of depth and existential programs with quantifiers are formally equivalent, even if from the modeling point of view, as we argued, ASP(Q) programs seem to have an advantage. However, unless the polynomial hierarchy collapses, no reduction from universal programs with quantifiers to combined nested programs of depth is possible. The following proposition specifies this property for the particular case of the validity of 2-QBFs, which we discussed above.
Proposition 5.14**.**
Unless the polynomial hierarchy collapses, there exists no polynomial reduction that encodes formulas , where is a 3-CNF formula, as a combined program , where and are normal logic programs, such that is valid iff admits stable unstable models.
A trivial consequence of Theorem 3.3 is that this limitation is absent from ASP(Q).
Finally, we note that combined programs under stable-unstable semantics have been implemented in a proof of concept prototype Bogaerts et al. (2016) that can only handle problems at the second level of the polynomial hierarchy. A similar prototype implementation for ASP(Q) (programs with at most two quantifiers) is possible, too. However, devising efficient implementations for either formalism in their full generality remains a non-trivial open research problem.
Further related work.
The problem of modeling in a natural way problems with ASP was also addressed by Eiter and Polleres 2006. They model problems combining “guess” program and “check” program , which are transformed into a single disjunctive ASP program such that its answer sets encode the solutions of the original problem by means of a polynomial-time transformation. The programs and must be HCF and propositional, thus limiting this approach to the modeling capabilities of propositional ASP. An idea analogous to that developed by Eiter and Polleres 2006 was also proposed by Redl 2017. Redl’s proposal appears to be conceptually simpler than the earlier one because of the use of conditional literals but suffers from the same limitations. A general technique to reuse existing ASP systems to evaluate problems of higher complexity (such as various forms of qualitative preferences among answer sets) was proposed by Gebser et al. 2011. The idea there was to use a meta program encoding the saturation technique which, in this way, became transparent to the user. As in the approach by Eiter and Polleres 2006, the resulting program is a plain ASP program which can be evaluated by a standard ASP system. Thus, the approach of Gebser et al. 2011 cannot be used to model problems beyond the second level of the polynomial hierarchy. Another solution that allows for reasoning within a program over the answer sets of another program, and thus encode reasoning tasks beyond NP, is provided by manifold programs Faber and Woltran (2011, 2009). In manifold programs the calling and the called program are encoded into a single program using weak constrains. The answer sets of the called program are thus represented within each answer set of the calling program. Also this approach is limited to the second level of the polynomial hierarchy, and might generate large specifications.
HEX-programs are an extension of ASP with external sources such as description logic ontologies and Web resources Eiter et al. (2008). In HEX-programs external atoms can exchange information from the logic program to eternal theories in terms of predicate extensions and constants.
Redl 2017 studied a way to avoid saturation for modeling problems with HEX-programs. In particular, the author proposes the modeling technique of query answering over subprograms. While encoding a problem on the second level of the polynomial hierarchy, one has to provide two components. A first program modeling the NP part, and a second one modeling the co-NP check. The first program, , is a HEX program that can query on the answer sets of the normal ordinary ASP program using specific external atoms. This modeling approach avoids saturation without introducing quantifiers, but this nice modeling behavior is limited to problems. Indeed, the focus of query answering over subprograms is on overcoming saturation and not on reaching high expressibility Redl (2017). A recent proposal of an extension of propositional ASP to model planning problems was described in Romero et al. (2017). The main difference with ASP(Q) is on the nature of quantifiers allowed in the two specifications. Indeed, the proposal of Romero et al. (2017), mimicking 2QBF, allows quantifiers over propositional atoms, whereas in ASP(Q) quantifiers are over answer sets.
As a final mention, we observe that the idea of extending the base language with quantifiers has been applied also in the neighboring area of Constraint Satisfaction Problems (CSP) Rossi et al. (2006), obtaining Quantified CSP (QCSP) Bordeaux and Monfroy (2002).
6 Conclusions
In this paper we approached the modeling of problems beyond NP with ASP programs. Inspired by the way QBFs extend SAT formulas, we have introduced ASP(Q), which extends ASP via quantifiers over stable models of programs. We have studied the computational properties of the language, provided a number of examples to demonstrate its modeling capabilities, and compared alternative approaches to the same problem. The analysis provided in the paper suggests that ASP(Q) is able to model uniformly problems in the Polynomial Hierarchy in the same compact and elegant way as ASP models problems in NP.
The definition of ASP(Q) allows for disjunctive programs, thus all the features of the basic language are retained. However, by limiting to normal (or HCF) programs (extended with aggregates and other useful modeling constructs) in ASP(Q), one can take advantage of the classic generate-define-test modular programming methodology and other modeling techniques developed for these best understood classes of programs to model any problem in the Polynomial Hierarchy. Indeed, the presence of quantifiers allows one to model complex properties in a direct way, without the need of recasting them in terms of checking the minimality of a model, e.g., using saturation. The examples provided in the paper, indeed, employ normal programs, and the solutions follow directly from the definition in natural language of the problem at hand.
The key task for the future is to implement ASP(Q). In this respect many possible solutions are possible, from encoding ASP(Q) in QBF and resorting to QBF solvers, to evolving ASP solvers to handle quantifiers over stable models.
Acknowledgements
The work of the third author has been partially supported by the NSF grant IIS-1707371. This work has been partially supported by MIUR under PRIN 2017 project n. (CUP ).
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1Alviano et al . (2015) Alviano, M. , Dodaro, C. , Leone, N. , and Ricca, F. 2015. Advances in WASP. In LPNMR . LNCS, vol. 9345. Springer, 40–54.
- 2Ben-Eliyahu and Dechter (1996) Ben-Eliyahu, R. and Dechter, R. 1996. On computing minimal models. Ann. Math. Artif. Intell. 18, 1, 3–27.
- 3Biere et al . (2009) Biere, A. , Heule, M. , van Maaren, H. , and Walsh, T. , Eds. 2009. Handbook of Satisfiability . Frontiers in Artificial Intelligence and Applications, vol. 185. IOS Press.
- 4Blumer et al . (1989) Blumer, A. , Ehrenfeucht, A. , Haussler, D. , and Warmuth, M. K. 1989. Learnability and the Vapnik-Chervonenkis dimension. J. ACM 36, 4, 929–965.
- 5Bogaerts et al . (2016) Bogaerts, B. , Janhunen, T. , and Tasharrofi, S. 2016. Stable-unstable semantics: Beyond NP with normal logic programs. TPLP 16, 5-6, 570–586.
- 6Bordeaux and Monfroy (2002) Bordeaux, L. and Monfroy, E. 2002. Beyond NP: arc-consistency for quantified constraints. In CP . LNCS, vol. 2470. Springer, 371–386.
- 7Brewka et al . (2011) Brewka, G. , Eiter, T. , and Truszczynski, M. 2011. Answer set programming at a glance. Commun. ACM 54, 12, 92–103.
- 8Buccafurri et al . (2000) Buccafurri, F. , Leone, N. , and Rullo, P. 2000. Enhancing disjunctive datalog by constraints. IEEE Trans. Knowl. Data Eng. 12, 5, 845–860.
