Answer set programming (ASP) as an alternative logic programming paradigm has been demonstrated to be an effective knowledge representation formalism for solving combinatorial search problems arising in many application areas such as planning, reasoning about actions, diagnosis, abduction, and so on [Baral (2003), Gelfond and Leone (2002), Lifschitz (2002), Marek and Truszczynski (1999), Niemela (1999)]. In recent years, researchers have paid particular attention to extensions of ASP with means to model aggregate constraints in particular, and constraints on sets in general [Calimeri et al. (2005), Dell’Armi et al. (2003), Denecker et al. (2001), Elkabani et al. (2004), Elkabani et al. (2005), Faber et al. (2004), Ferraris (2005), Liu et al. (2007), Liu and Truszczynski (2005), Liu and Truszczynski (2006), Marek et al. (2008), Marek and Remmel (2004), Marek and Truszczynski (2004), Pelov (2004), Pelov et al. (2003), Pelov et al. (2007), Pelov and Truszczynski (2004), Shen and You (2007), Simons et al. (2002), Son and Pontelli (2007), Son et al. (2006), Son et al. (2007)]. Logic programs with constraint atoms were introduced as a general framework for representing, and reasoning with, sets of atoms [Marek et al. (2008), Marek and Remmel (2004), Marek and Truszczynski (2004)]. This is in contrast with traditional logic programs, which are used primarily to reason with individuals.
The abstract form of a constraint atom takes the form , where is a finite set of atoms and a collection of subsets from the power set of , which expresses a constraint on the domain with the collection of admissible solutions.
By allowing constraint atoms to appear anywhere in a rule, the framework of logic programs has become a highly expressive knowledge representation language. For example, many constraints can be conveniently and compactly represented with constraint atoms such as weight and cardinality constraints and aggregates (see, e.g. [Calimeri et al. (2005), Dell’Armi et al. (2003), Denecker et al. (2001), Faber et al. (2004), Marek and Truszczynski (2004), Pelov (2004), Simons et al. (2002)]). In fact, any constraint studied in the context of constraint satisfaction problem (CSP) can be represented by a constraint atom. In this way, the framework of logic programs with constraint atoms can express complex constraint satisfaction problems, such as those involving conditional constraints [Mittal and Falkenhainer (1990)] (called dynamic CSPs), which are useful in modeling configuration and design problems. When the head of a rule is allowed to be a disjunction of constraint atoms, logic programs become capable of expressing, not only conditional constraints, but also disjunctive constraints, both of which have been investigated by the constraint programming community outside of logic programming (see, e.g. [Baptiste and Pape (1996), Cohen et al. (2000), Marriott et al. (2001)]). For example, disjunctive constraints have been widely used in scheduling to ensure that the time intervals over which activities require the same resource do not overlap in time [Baptiste and Pape (1996)]. Although practical ASP languages and systems typically incorporate concrete, predefined constraint atoms, such as weight constraint atoms [Simons et al. (2002)] and aggregate atoms [Dell’Armi et al. (2003)], the adoption of the abstract form of constraint atoms has made it possible to study the semantics and properties of these programs in an abstract setting.
In this paper, we characterize and define stable models for logic programs with constraint atoms by introducing a succinct abstract representation of constraint atoms. In the current literature as mentioned above, a constraint atom is expressed as a pair , where is a finite set of ground atoms and a collection of sets of atoms in . We call this a power set form representation (w.r.t. ) of constraint atoms, as may involve the whole power set of . This is the case even for special classes of constraint atoms such as monotone constraint atoms (a constraint atom is monotone if for any , whenever all of its supersets in are in ).
For instance, suppose we have a monotone constraint atom . Semantically, this constraint atom is a tautology, since for any set of atoms, it is a fact that satisfies , in the sense that . A clever representation would just need to express two pieces of information, the “bottom element” and the “top element” ; two elements together implicitly cover all the sets in between. So, instead of using the power set representation to express all the admissible solutions of this constraint atom, we could use a pair of sets. As another example, consider a monotone constraint atom . A minimal element (set inclusive) in is a singleton in . In this case, any minimal element in and form a pair with being the bottom element and being the top. So, we could represent this constraint atom by a collection of pairs, one for each singleton in . The number of such pairs in this case equals to the size of .
In this paper, we introduce such an abstract representation. In general, the abstract representation of a constraint atom is expressed as , where consists of what will be called abstract prefixed power sets, denoted , with and . Intuitively, represents a collection of sets of the form with , all of which are in .
The abstract representation of constraint atoms not only yields a compact representation, but also captures the essential information embodied in constraint atoms appearing in the bodies of rules. To substantiate this claim, we show two applications.
In the first application, we restore the power of the Gelfond-Lifschitz transformation by generalizing it for logic programs with constraint atoms. The key idea is that given an interpretation , each constraint atom under our abstract representation can be concisely characterized by a set of abstract satisfiable sets of the form such that covers . Therefore, the standard Gelfond-Lifschitz transformation can be naturally generalized to logic programs with constraint atoms by representing each constraint atom by its abstract satisfiable sets. We then use the generalized Gelfond-Lifschitz transformation to define stable models for disjunctive logic programs with constraint atoms. It turns out that, for non-disjunctive logic programs with arbitrary constraint atoms, the stable models defined this way are precisely those defined by Son et al. [Son et al. (2006), Son et al. (2007)] for logic programs with arbitrary constraint atoms, and the equivalent semantics, called the ultimate stable semantics, for aggregate logic programs [Denecker et al. (2001)]. These semantics are defined by a substantially different approach, the fixpoint approach.
One advantage of our approach is that the semantics is defined for disjunctive programs where a constraint atom can appear anywhere in a disjunctive rule. This is due to the power of the Gelfond-Lifschitz transformation. Roughly speaking, for a non-disjunctive program with constraint atoms, a stable model is just the least model of the reduct by the generalized Gelfond-Lifschitz transformation, while for a disjunctive program with constraint atoms, a stable model is a minimal model of the reduct. We show that logic programs whose constraint atoms appearing in disjunctive rule heads are elementary possess the minimality property; i.e., for such logic programs, all stable models under the generalized Gelfond-Lifschitz transformation are minimal models. Thus, by the known relationships among different definitions of stable models, the stable model semantics defined in this paper extends the semantics of conventional disjunctive logic programs [Gelfond and Lifschitz (1991)], the semantics defined by Marek and Truszczynski [Marek and Truszczynski (2004)] for non-disjunctive logic programs with monotone constraint atoms, the semantics by Son et al. [Son et al. (2006), Son et al. (2007)], and others equivalent to it [Denecker et al. (2001), Pelov et al. (2003)].
In the second application, we show that our abstract representation of constraint atoms provides a means to characterize the dependency relation among ordinary atoms in a program with constraint atoms. This dependency relation in the past is defined using a dependency graph. One question for logic programs with constraint atoms is how this dependency graph may be constructed so that the means to characterize the properties of programs by odd cycles, even cycles, call-consistency, acyclic programs in the traditional context is applicable to the new context. We show that the information captured in our abstract representation is essential in constructing the dependency graph for a program with constraint atoms. As we will see, this is due to a simple way to represent a logic program with constraint atoms by a normal logic program.
To summarize, the main contributions of this paper are:
We introduce an abstract yet compact representation of constraint atoms, independent of any programs in which they appear.
Using this abstract representation, we present a generalized form of Gelfond-Lifschitz transformation and apply it to define stable models for disjunctive logic programs with constraint atoms. For non-disjunctive programs, the semantics defined this way coincides with the one based on conditional satisfaction [Son et al. (2006), Son et al. (2007)], and with the ones equivalent to it [Denecker et al. (2001)].
We show that our abstract representation of constraint atoms encodes the information needed to capture the atom dependency relation in a given program, thus the means to characterize the properties for normal programs can still be applied to programs with constraint atoms, and in the process, the unfolding approach [Son and Pontelli (2007)] is made simple.
The paper is structured as follows. Following the preliminaries in the next section, in Section 3 we present our abstract representation of constraint atoms. In Section 4, we show some characterization of constraint atoms under this abstract representation. In Section 5, we introduce a generalized Gelfond-Lifschitz transformation and apply it to define stable models for disjunctive logic programs with constraint atoms. In Section 6, we prove the relationship of our approach with Son et al.’s fixpoint approach [Son et al. (2006)]. Then in Section 7, we show that our abstract representation of constraint atoms encodes precisely the needed information to define the dependency graph of a program with constraint atoms. In Section 8, we discuss the related approaches. Finally in Section 9, we provide conclusions and discuss future work.
Proofs of theorems and lemmas will be delayed to Appendix.
Some results of this paper have been reported in [Shen and You (2007)]. The current paper, however, contains substantial new results.
We consider propositional (ground) logic programs and assume a fixed propositional language with a countable set of propositional atoms (atoms for short). Any subset of is called an interpretation. A literal is an atom (a positive literal) or its negation (a negative literal). For a set of atoms, we use to denote and to denote the size of . For convenience, when appears in a logic expression, it represents a conjunction ; when appears in a logic expression, it represents a conjunction .
An abstract constraint atom (or c-atom following [Son et al. (2006), Son et al. (2007)]) is a pair , where is a finite set of atoms in and a collection of sets of atoms in , i.e., . For convenience, we use and to refer to the components and of , respectively. As a general framework, c-atoms can be used to represent any constraints with a finite set of admissible solutions over a finite domain .
A c-atom is elementary if it is of the form , where is an atom. Due to the equivalence in satisfaction, an elementary c-atom may be simply written by the atom in it. is monotone if it has the property that for any , if then all of its supersets in are in . is nonmonotone if it is not monotone. is antimonotone if is closed under subsets, i.e., for every , if and then . is convex if for any such that and , we have .
A disjunctive constraint program, or a disjunctive (logic) program with c-atoms, is a finite set of rules of the form
where , and , and are either an atom or a c-atom (“” is omitted when ). is a normal constraint program if for all of its rules; is a positive constraint program if for all of its rules; is a positive basic program if and with being an elementary c-atom for all of its rules. As usual, is a normal program if is a normal constraint program where all c-atoms are elementary; is a disjunctive program if is a disjunctive constraint program where all c-atoms are elementary.
In the sequel, if not specifically quantified, a logic program (or simply a program) refers to a disjunctive constraint program. To make it explicit, when a program contains only elementary c-atoms, it may be called a program with ordinary atoms, or just a program without c-atoms.
Let be a rule of the above form. We define which will be referred to as the head and the body of the rule, respectively, where denotes the conjunction of the elements in the set and the disjunction. Without confusion, we may use the set notation in a rule to express the body as well as the head. For example, given a rule , we may write .
We will use to denote the set of atoms that appear in a program .
The satisfaction relation is defined as follows. An interpretation satisfies an atom if ; if . satisfies a c-atom if ; if . This relation extends to arbitrary expressions mentioning negation , conjunction and disjunction , in a usual way. We will use to denote that satisfies , and to denote that does not satisfy . We say is true (resp. false) in if and only if satisfies (resp. does not satisfy) .
satisfies a rule if it satisfies or it does not satisfy . is a model of a logic program if it satisfies all rules of . is a minimal model of if it is a model of and there is no proper subset of which is also a model of . is a supported model of if for any , there is such that and .
As commented earlier, atoms can be viewed as elementary c-atoms. This is due to the fact that for an atom , an interpretation satisfies iff iff .
Sometimes we say a model M restricted to the atoms appearing in a program . By this we mean , and denote it by .
Note that c-atoms of the form are not satisfied by any interpretation. We will use a special symbol to denote any such c-atom.
Following [Son et al. (2007)], for any c-atom , its negation is interpreted by its complement, which is a c-atom where .111Note that this is consistent with our definition of satisfaction of negated c-atoms. But not all semantics are based on the complement approach. A detailed comparison can be found in [Son et al. (2007)]. So a logic program with negated c-atoms can be rewritten to a logic program free of negated c-atoms by replacing all occurrences of negated c-atoms with their respective complement c-atoms. Due to this assumption, in the sequel we only consider logic programs without negated c-atoms in rule bodies.
Given a disjunctive program (where c-atoms are elementary) and an interpretation , the standard Gelfond-Lifschitz transformation of w.r.t., written as , is obtained from by performing two operations: (1) remove from all rules whose bodies contain a negative literal such that , and (2) remove from the remaining rules all negative literals. Since is a positive constraint program where c-atoms are elementary, it has a set of minimal models. is defined to be a stable model of if it is a minimal model of [Gelfond and Lifschitz (1988), Gelfond and Lifschitz (1991), Przymusinski (1991)].
The cardinality and weight constraints can be represented by c-atoms. In some of the example programs of this paper we may write weight constraints instead of c-atoms. We will adopt the notation proposed in [Simons et al. (2002)]. A weight constraint is an expression of the form
where and are atoms and is the weight of atom and is the weight of negative literal . The numbers and are lower and upper bounds of the constraint, respectively. A weight constraint is satisfied by a set of atoms if the sum of the weights of the literals in the set that are satisfied by is between and (inclusive).
A cardinality constraint is a special case of weight constraint where each weight is one. In writing a cardinality constraint, we will omit the weights. A choice constraint is a cardinality constraint of the form , where and . In writing a choice constraint, we will omit the bounds.
3 Abstract Representation of Constraint Atoms
In this section, we present a compact representation of c-atoms. In the current literature, for any c-atom its admissible solutions are all explicitly enumerated and written in . In many cases, may involve a large portion of . It is then of great interest if we can represent using some abstract structure so that its size can be substantially compressed. We begin by introducing a notion of prefixed power sets.
Let and be two sets of atoms.
The -prefixed power set of , denoted by , is the collection ; i.e., each set in the collection consists of all s in plus zero or more s in . For any set of atoms , we say is covered by (or covers ) if and .
For any two abstract prefixed power sets and , is included in if any set covered by is covered by .
When is included in , we have and . If is included in and is included in , then is included in .
Given a c-atom , let and . is called I-maximal in (or just maximal) if all sets covered by are in and there is no with such that all sets covered by are in .
Let be a c-atom and . The collection of abstract -prefixed power sets of is .
For instance, consider a c-atom , where
For , the collection of abstract -prefixed power sets of is ; for , the collection is ; for , the collection is . Note that is included in . It is easy to check that all abstract prefixed power sets for are included in and all those for are included in .
When a collection contains two abstract prefixed power sets, and with being included in , we say is redundant in this collection.
For instance, consider where and , and where and . Then, is redundant in a collection that contains , since every set covered by is covered by .
The abstract representation of a c-atom is a pair where is the collection , where is the collection of abstract -prefixed power sets of , with all redundant abstract prefixed power sets removed.
Observe that when is in , all sets in the collection are in . Conversely, when , there exist such that and , and , i.e., is included in . In other words, is the collection of maximal sublattices of the lattice , of which all elements are in . For such a maximal sublattice , the bottom element is and the top element is .
Consider the above example c-atom again. Its abstract representation is with .
Let be a c-atom.
has a unique abstract form .
For any interpretation , if and only if contains an abstract prefixed power set covering .
For some special classes of c-atoms, their abstract representations are much simpler and can be stated more structurally.
We need a terminology: given a set of sets, we say that is minimal (resp. maximal) in if there is no such that (resp. ).
Let be a c-atom.
is monotone if and only if if and only if for each .
is antimonotone if and only if if and only if for each .
is convex if and only if .
By this theorem, given , to check if is monotone (resp. antimonotone) it suffices to check if (resp. ) for each . This process takes linear time in the size of . Let and . To check if is convex, it suffices to check (i) there are no with , and (ii) there are no with . Case (i) guarantees that is minimal while case (ii) guarantees is maximal in , for each . The time for the two cases is bounded by , where each subset check is assumed to take time . This leads to the following complexity result.
Given the abstract representation of a c-atom , the time to check if is monotone or antimonotone is linear in the size of , while the time to check if is convex is bounded by .
We now discuss the issue of compactness. Given a c-atom , its abstract representation is more compact than when contains some relatively large abstract prefixed power sets. This can be seen from the special classes of c-atoms in Theorem 3.3. Since the admissible solutions in such a c-atom are tightly clustered together, they easily form large abstract prefixed power sets. For example, since a monotone c-atom is closed under its supersets in , for any minimal set in , all the sets in between and must be in . Therefore, is an abstract -prefixed power set. The bigger is the difference between and , the more information is captured compactly. As another example, we know that weight constraints without negative literals or negative weights are convex. That is, these constraints are of the form , where , for all . Let denote such a weight constraint. Then, and consists of all subsets of where the sum of the weights of the atoms in such a subset is between and . Thus, if the sets and are such that , and is minimal and is maximal in , then forms an abstract -prefixed power set, representing all the sets in between.
Apparently, c-atoms that are nearly monotone (or antimonotone or convex) can greatly benefit from the abstract representation. For example, given a set , a c-atom that expresses all subsets of except some in between and can easily fall outside of the above special classes. For instance, suppose and let . Then .
It should also be clear that there are situations where may not be strictly more compact than . This is typically the case where the admissible solutions in are largely unrelated. We say that two sets and are unrelated if either no one is a subset of the other, or and is not singleton.
For example, consider a c-atom where consists of all subsets of with an equal size. In this case, no set in is a subset of another in . The abstract representation of such a c-atom is where , which trivially enumerates all admissible solutions in . As another example, consider a c-atom . In this case, for any , if is a superset of , then is not singleton. The abstract representation of is , where . Again, essentially enlists all admissible solutions in .
Although all the evidence indicates that for any c-atom the number of abstract prefixed power sets in is less than or equal to the number of admissible solutions in , i.e. , a rigorous proof for this claim seems challenging. We leave this proof as an interesting open problem.
Finally in this section, we comment that for a c-atom , it takes polynomial time in the size of to construct . This result will be useful in determining the complexity of the semantics defined by the generalized Gelfond-Lifschitz transformation later in this paper.
Below, we give a bound for the construction.
Let be a c-atom. The time to construct from is bounded by .
4 Characterizations of C-Atoms under Abstract Representation
In this section, we present some characterizations of c-atoms under the abstract representation. Essentially, these characterizations are related to the fact that a c-atom can be semantically represented by a propositional formula.
Recall that the standard semantics of a c-atom is defined by its satisfaction: for any set of atoms , if and only if . For nonmonotone c-atoms, a difficulty with this interpretation of the meaning of a c-atom is that the iterative construction by the one-step provability operator [Liu and Truszczynski (2006), Marek et al. (2008)] may lead to an undesirable situation - there is no guarantee that once a c-atom is satisfied by a set of atoms , it remains to be satisfied by an extension of .
However, by definition, a set of atoms satisfies a c-atom if and only if satisfies the propositional formula that corresponds to the admissible solutions in . This formula is a disjunction of conjunctions, each of which represents an admissible solution in . As a propositional formula, it can be simplified to a logically equivalent one. It turns out that this simplification process is significant as it reveals the nature of the information encoded in our abstract representation. Therefore, the main result of this section is to show that the abstract representation of a c-atom encodes the “simplest” propositional formula, in the form of a disjunctive normal form (DNF). We then use this insight to define what are called abstract satisfiable sets, which make it possible to define a new form of Gelfond-Lifschitz transformation.
Below, we make it precise as what the formula is, and state some facts which easily follow from the definition.
Let be a c-atom with , and be an interpretation. The DNF for is defined as: each is a conjunction .
satisfies if and only if is true in .
satisfies if and only if is true in .
Given a c-atom , the DNF for can be simplified. In propositional logic, we have , for any formulas and .
Consider a monotone c-atom Its corresponding DNF is , which can be simplified as follows: Note that in the second line above a disjunct in the previous DNF is added.
What is interesting is that the resulting propositional formula corresponds to the abstract representation of , where . This correspondence is made precise in the following theorem.
Let be a c-atom and be a set of atoms. if and only if satisfies
The proof of this theorem requires the following lemma.
Let be a set of atoms and be a DNF covering all possible interpretations on the s, i.e.
can be simplified to in propositional logic by applying the following rule:
Note that rule (2) is like the resolution rule in its underlying pattern, but it applies to a DNF while resolution applies to CNFs.
As a slightly more involved example, consider a c-atom
The DNF for this c-atom is:
which can be simplified to
each disjunct of which corresponds to a prefixed power set in the abstract representation of , i.e., .
We say that a DNF is maximally simplified if it cannot be further simplified by applying rule (2).
The following theorem shows that (1) is maximally simplified.
The semantic characterization (1) of a c-atom is maximally simplified.
Theorems 4.2 and 4.4 suggest that the satisfaction of c-atom can be described by its simplest DNF given in (1), independently of any interpretations. When we generalize the standard Gelfond-Lifschitz transformation for constraint programs, we can apply a given interpretation to further simplify this DNF. In the following, and in the rest of the paper, given an interpretation , for any c-atom we use to denote and to denote .
We are ready to define abstract satisfiable sets.
Let be a c-atom and an interpretation. is an abstract satisfiable set of w.r.t. if covers . In this case, is called a satisfiable set of w.r.t. . We use to denote the set of abstract satisfiable sets of w.r.t. .
The next two theorems characterize some properties of abstract satisfiable sets as well as satisfiable sets.
Let be a c-atom and an interpretation. if and only if .
Let be a c-atom and an interpretation. If is a satisfiable set of w.r.t. , then for every with , we have .
5 A Generalization of the Gelfond-Lifschitz Transformation
In this section we show that the characterizations of c-atoms presented in the last section can be used to generalize the standard Gelfond-Lifschitz transformation for logic programs with c-atoms.
In the following, special atoms of the forms , and will be used, where is a c-atom. Unless otherwise stated, we assume that these special atoms will not occur in any given logic programs or interpretations. Let and be the sets of special atoms prefixed with and , respectively. Let .
Given a logic program and an interpretation , the generalized Gelfond-Lifschitz transformation of w.r.t. , written as , is obtained from by performing the following four operations:
Remove from all rules whose bodies contain either a negative literal such that or a c-atom such that .
Remove from the remaining rules all negative literals.
Replace each c-atom in the body of a rule with a special atom and introduce a new rule for each satisfiable set of w.r.t. .
Replace each c-atom in the head of a rule with if , or replace it with a special atom and introduce a new rule for each , a new rule for each , and a new rule .
In the first operation, we remove all rules whose bodies are not satisfied in because of the presence of a negative literal or a c-atom that is not satisfied in . In the second operation, we remove all negative literals because they are satisfied in . The last two operations transform c-atoms in the body and head of each rule, respectively.
Each c-atom in the body of a rule is substituted by a special atom . By Theorem 4.5, can be defined by introducing a new rule for each abstract satisfiable set . Since the negative part is true in , it can be removed from the rule body following the standard Gelfond-Lifschitz transformation. Note that the remaining part is a satisfiable set. Therefore, in the third operation, is defined by introducing a new rule for each satisfiable set of w.r.t. .
When , each c-atom in the head of a rule is replaced by a special atom . Note that represents a conclusion that every is true and every is false in . Such a conclusion is formulated, in the fourth operation, by introducing a new rule for each , a new rule for each , and a new rule . is a special atom meaning . The last rule comes from the rule , where the negative part is true in and thus is removed following the standard Gelfond-Lifschitz transformation. When , we replace with . In the case that appears in a disjunction with , can be removed, as the satisfaction of the disjunction is determined by the s.
Apparently, the generalized Gelfond-Lifschitz transformation coincides with the standard Gelfond-Lifschitz transformation when contains no c-atoms.
Since the generalized transformation is a positive logic program without c-atoms, it has minimal models. We then define the stable model semantics of a constraint program in the same way as that of a logic program with ordinary atoms.
For any logic program , an interpretation is a stable model of if , where is a minimal model of the generalized Gelfond-Lifschitz transformation .
Immediately, if is a normal constraint program, then is a stable model of if and is the least model of the generalized Gelfond-Lifschitz transformation . In other words, the extension to disjunctive constraint programs from normal constraint programs follows the same way as the extension to disjunctive programs from normal programs.
Again, stable models of under the generalized Gelfond-Lifschitz transformation coincide with stable models under the standard Gelfond-Lifschitz transformation when has no c-atoms. In the following, unless otherwise stated, by stable models we refer to stable models under the generalized Gelfond-Lifschitz transformation.
Consider the following program: . The aggregate constraint can be represented by a c-atom where
Its abstract representation is with
Let us check if is a stable model of using the generalized Gelfond-Lifschitz transformation. The first two operations do not apply. Since with , has only one abstract satisfiable set , and thus it has only one satisfiable set w.r.t. . So, in the third operation is replaced by a special atom , followed by a new rule . Hence we have . . The only minimal model of is , so is not a stable model of .
It is easy to check that this program has no stable model.
Consider a disjunctive constraint program: . where is a c-atom and .
Let . After performing the fourth operation, we obtain has only one minimal model, ; hence, is not a stable model of .
Let . After performing the fourth operation, we obtain has one minimal model, ; hence, is a stable model of .
The introduction of disjunction into the head of a rule increases the expressiveness of the language, and allows natural representation using disjunction.
In scheduling, combinatorial counting or grouping is often needed. For example, a shift either has in it, or not. If is in it, then either goes along with exactly one in , or any two in . This can be represented by a disjunctive program with cardinality constraints.
The semantics of this program can be understood by the semantics of the corresponding constraint program: This program has the following stable models: , , , , , and .
Once c-atoms are allowed to appear in the disjunctive head of a rule, disjunctive aggregates may be expressed.
Suppose the set of atoms in our propositional language is .222Note that we assume a fixed propositional language that includes all the atoms appearing in a given program. Consider the following program.
Its stable models are: , , and .
As commented in [Simons et al. (2002)], a weight constraint can be transformed to one with negative weights but without negative literals. The weight constraints of this kind in fact express linear inequations. Thus, a disjunction of weight constraints can be viewed as specifying a disjunction of linear inequations. For instance, the second rule in the above example can be expressed using weight constraints. To encode the SUM aggregate constraint above, let denote , where and are the lower and upper bounds, respectively. When (resp. ) is omitted, it means (resp. ). Then, we can write the following rule
where the right hand side encodes the COUNT aggregate constraint.
We argue that disjunctive logic programming with constraint atoms provides a rich knowledge representation language for modeling conditional as well as disjunctive constraints, which have been studied in the past in constraint programming (see, e.g., [Baptiste and Pape (1996), Cohen et al. (2000), Marriott et al. (2001)]).333But note that disjunction in rule heads is epistemic disjunction [Gelfond and Lifschitz (1991)], not the classic disjunction in propositional logic.
5.1 Properties of stable models
We now show some properties of stable models.
Any stable model of a logic program is a model of .
A stable model may not be a minimal model for some constraint
To illustrate, consider a logic program
It is easy to check that , and are all stable models of . We see that is not minimal.
It turns out that logic programs whose c-atoms appearing in rule heads are elementary possess the minimality property.
Let be a logic program such that c-atoms appearing in the heads of its rules are all elementary. Any stable model of is a minimal model of .
Recall that any atom can be expressed as a c-atom and any negative literal can be expressed as a c-atom , such that for any interpretation , (resp. ) if and only if (resp. ). The following result further justifies our generalization of the standard stable model semantics to logic programs with c-atoms.
Let be a logic program with ordinary atoms and be with each positive literal replaced by a c-atom , and each negative literal replaced by a c-atom . An interpretation is a stable model of if and only if it is a stable model of .
If all c-atoms are coded in the abstract representation, the time complexity of the generalized Gelfond-Lifschitz transformation is as follows.
Let be a logic program with different c-atoms that are coded in the abstract representation and be an interpretation. Let be a c-atom such that .
The time complexity of computing all satisfiable sets of w.r.t. is linear in the size of .
The time complexity of the generalized Gelfond-Lifschitz transformation is bounded by , where and are the maximum sizes of and of a c-atom in , respectively.
The following result is immediate.
The size of is bounded by .
Finally, we show the complexity of the major decision problem, namely the stable model existence problem. In the following, we assume the explicit representation of c-atoms in the form in a given program .
The problem of deciding whether a stable model exists for a normal constraint program