logic programs with monotone abstract constraint atomsin many respects the theory we built in this...

32
Under consideration for publication in Theory and Practice of Logic Programming 1 Logic programs with monotone abstract constraint atomsVictor W. Marek Department of Computer Science, University of Kentucky, Lexington, KY 40506, USA (e-mail: [email protected]) Ilkka Niemel¨ a Department of Computer Science and Engineering Helsinki University of Technology, P.O.Box 5400, FI-02015 TKK, Finland (e-mail: [email protected]) Miroslaw Truszczy´ nski Department of Computer Science, University of Kentucky, Lexington, KY 40506, USA (e-mail: [email protected]) Abstract We introduce and study logic programs whose clauses are built out of monotone con- straint atoms. We show that the operational concept of the one-step provability operator generalizes to programs with monotone constraint atoms, but the generalization involves nondeterminism. Our main results demonstrate that our formalism is a common general- ization of (1) normal logic programming with its semantics of models, supported models and stable models, (2) logic programming with weight atoms (lparse programs) with the semantics of stable models, as defined by Niemel¨a, Simons and Soininen, and (3) of dis- junctive logic programming with the possible-model semantics of Sakama and Inoue. 1 Introduction In this paper, we introduce and study logic programs whose clauses are built of generalized atoms expressing constraints on sets. We propose a generalization of normal logic programming to this extended setting. Our generalization uses the assumption of the monotonicity of constraints and it employs the nondeterminism in deriving ways to satisfy constraints. In our approach the basic concepts, meth- ods, semantics and results of normal logic programming generalize to the proposed context. Our work provides a theoretical framework to a recent extension of logic programming with weight constraints (also known as pseudo-boolean constraints) (Niemel¨ a et al. 1999; Simons et al. 2002), and to an earlier formalism of disjunctive logic programs with the semantics of possible models (Sakama and Inoue 1994), but applies to a much broader class of programs. In the 1990s researchers demonstrated that normal logic programming with the * Parts of this paper appeared earlier in conference papers (Marek et al. 2004; Marek and Truszczy´ nski 2004).

Upload: others

Post on 30-Jan-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

  • Under consideration for publication in Theory and Practice of Logic Programming 1

    Logic programs with monotone abstract

    constraint atoms∗

    Victor W. Marek

    Department of Computer Science, University of Kentucky, Lexington, KY 40506, USA

    (e-mail: [email protected])

    Ilkka Niemelä

    Department of Computer Science and Engineering

    Helsinki University of Technology,

    P.O.Box 5400, FI-02015 TKK, Finland

    (e-mail: [email protected])

    Miros law Truszczyński

    Department of Computer Science, University of Kentucky, Lexington, KY 40506, USA

    (e-mail: [email protected])

    Abstract

    We introduce and study logic programs whose clauses are built out of monotone con-straint atoms. We show that the operational concept of the one-step provability operatorgeneralizes to programs with monotone constraint atoms, but the generalization involvesnondeterminism. Our main results demonstrate that our formalism is a common general-ization of (1) normal logic programming with its semantics of models, supported modelsand stable models, (2) logic programming with weight atoms (lparse programs) with thesemantics of stable models, as defined by Niemelä, Simons and Soininen, and (3) of dis-junctive logic programming with the possible-model semantics of Sakama and Inoue.

    1 Introduction

    In this paper, we introduce and study logic programs whose clauses are built of

    generalized atoms expressing constraints on sets. We propose a generalization of

    normal logic programming to this extended setting. Our generalization uses the

    assumption of the monotonicity of constraints and it employs the nondeterminism

    in deriving ways to satisfy constraints. In our approach the basic concepts, meth-

    ods, semantics and results of normal logic programming generalize to the proposed

    context. Our work provides a theoretical framework to a recent extension of logic

    programming with weight constraints (also known as pseudo-boolean constraints)

    (Niemelä et al. 1999; Simons et al. 2002), and to an earlier formalism of disjunctive

    logic programs with the semantics of possible models (Sakama and Inoue 1994),

    but applies to a much broader class of programs.

    In the 1990s researchers demonstrated that normal logic programming with the

    ∗ Parts of this paper appeared earlier in conference papers (Marek et al. 2004; Marek andTruszczyński 2004).

  • 2 V.W. Marek, I. Niemelä and M. Truszczyński

    stable-model semantics is an effective knowledge representation formalism. It pro-

    vides solutions to problems arising in such contexts as planning, reasoning about

    actions, diagnosis and abduction, product configuration, and modeling and reason-

    ing about preferences. Moreover, due to the emergence of fast methods to compute

    stable models (Niemelä and Simons 1997; Babovich and Lifschitz 2002; Lin and

    Zhao 2002; Leone et al. 2004), the importance of the formalism increased signifi-

    cantly as it became possible to use it not only as a modeling language but also as a

    practical computational tool. The contributions of (Baral 2003; Gelfond and Leone

    2002) provide a detailed discussion of the formalism and its applications.

    In the last few years, researchers proposed extensions of the language of normal

    logic programming with means to model constraints involving aggregate operations

    on sets. (Simons et al. 2002) proposed a formalism integrating logic programming

    with weight constraints, known in the SAT community as pseudo-boolean con-

    straints, generalized the concept of stable models to this extended setting, and de-

    veloped fast algorithms to compute them. (Denecker et al. 2001; Pelov et al. 2004),

    introduced a formalism allowing for more general aggregates. They extended to this

    new setting several semantics of normal logic programs, including the stable-model

    semantics and the well-founded semantics. A related recent work (Dell’Armi et al.

    2003; Faber et al. 2004; Calimeri et al. 2005), incorporated aggregates into the

    formalism of disjunctive logic programs with the answer-set semantics. Yet another

    extension of normal logic programming has been proposed in (Marek and Remmel.

    2004) as set-based constraints. Such extensions are important as they simplify the

    task of modeling problem specifications, typically result in more direct and concise

    encodings, and often significantly improve the computational effectiveness of the

    formalism as a problem-solving tool.

    Our goal is to propose an abstract formalism of logic programs extended with

    means to model constraints on sets, preserving as much as possible analogies be-

    tween our theory and normal logic programming. We introduce the notion of an

    abstract constraint and its linguistic counterpart — an abstract constraint atom.

    We then use abstract constraint atoms as building blocks of program clauses in

    the same way propositional atoms form clauses of normal logic programs. For the

    most part, we restrict our attention to monotone constraints, as monotonicity is

    essential for preserving the notion of a logic program as a computational device.

    We show that basic concepts, techniques, and results of normal logic programming

    have direct generalizations for the class of programs built of monotone abstract con-

    straints. What distinguishes our work from other recent approaches to integrating

    logic programming with aggregates is that we allow constraint atoms in the heads

    of clauses, while formalisms proposed and studied in (Denecker et al. 2001; Pelov

    et al. 2004; Dell’Armi et al. 2003; Faber et al. 2004; Calimeri et al. 2005) do not.

    In many respects the theory we built in this paper mirrors closely an operator-

    based treatment of normal logic programs. There is, however, a basic difference.

    Abstract constraint atoms are inherently nondeterministic. They can be viewed as

    shorthands for certain disjunctions and, in general, there are many ways to make an

    abstract constraint atom true. This nondeterminism has a consequence. The one-

    step provability operator, which generalizes the one-step provability operator of (van

  • Theory and Practice of Logic Programming 3

    Emden and Kowalski 1976) defined for normal programs, is no longer deterministic.

    It assigns to an interpretation M a set T (M ) of interpretations. Each interpretation

    in the set T (M ) is regarded as possible and equally likely outcome of applying the

    operator to M .

    The nondeterministic one-step provability operator is a key tool in our work. It

    generalizes the one-step provability operator of (van Emden and Kowalski 1976).

    Thanks to close parallels between these two concepts, we are able to reconstruct

    operator-based characterizations of models, supported models, and the concept of a

    bottom-up computation for programs with abstract constraints that generalize Horn

    programs. We then extend to programs with abstract monotone constraints the

    definitions of the Gelfond-Lifschitz reduct and a stable model (Gelfond and Lifschitz

    1988). We also distinguish and discuss the class of deterministic programs (programs

    with clauses whose heads can be satisfied in one way only). For these programs the

    one-step provability operator becomes deterministic and the theory of normal logic

    programming extends to deterministic programs without any significant change. In

    particular, it follows that normal logic programming with all its major 2-valued

    semantics can be viewed as a special case of logic programming with monotone

    abstract constraints.

    In addition, we show that programs with abstract constraints provide a formal

    account of a class of logic programs with weight (pseudo-boolean) atoms introduced

    in (Simons et al. 2002). We call programs in the syntax proposed in that paper lparse

    programs. (Simons et al. 2002) defined for lparse programs the notion of a stable

    model and showed that lparse programs generalize normal logic programming with

    the stable-model semantics of Gelfond and Lifschitz (Gelfond and Lifschitz 1988).

    However, the notion of the reduct underlying the definition of a stable model given

    in (Simons et al. 2002) is different from that proposed in (Gelfond and Lifschitz

    1988) and the precise nature of the relationship between normal logic programs and

    lparse programs was not clear.

    Our work explicates this relationship. On one hand, the formalism of programs

    with abstract constraints parallels normal logic programming. In particular, major

    concepts, results and techniques in normal logic programming have counterparts

    in the setting of programs with abstract constraints. On the other hand, under

    some simple transformations, lparse programs can be viewed as a special case of

    programs with abstract constraints. Thus, through this connection, the theory of

    normal logic programming can be lifted to the setting of lparse programs leading,

    in particular, to new characterizations of stable models of lparse programs.

    Finally, we show that programs with monotone abstract constraints generalize

    the formalism of disjunctive logic programs with the semantics of possible models

    (Sakama and Inoue 1994). In fact, as we point out, several ideas that are stated in

    abstract terms in our paper have their roots in (Sakama and Inoue 1994).

    2 Basic concepts, motivation, examples

    We consider a language determined by a fixed set At of propositional atoms. An

    abstract constraint is a collection C ⊆ P(At) (if X is a set, by P(X ) we denote

  • 4 V.W. Marek, I. Niemelä and M. Truszczyński

    the family of all subsets of X ). We say that elements of C satisfy the constraint

    C or have the property C . An abstract constraint atom (or ac-atom, for short)

    is an expression C (X ), where X ⊆ At is finite and C is an abstract constraint.

    An ac-literal is an expression of the form C (X ) or not(C (X )), where C (X ) is an

    ac-atom. We call X the atom set of an ac-literal A of the form C (X ) or not(C (X ))

    and denote it by aset(A).

    An intended meaning of an ac-atom C (X ) is to represent a requirement on subsets

    of X that they must satisfy the constraint C . Formally, we interpret ac-atoms by

    means of propositional interpretations (truth assignments), which we represent as

    subsets of At: an atom is true in an interpretation M ⊆ At if p ∈ M , otherwise,

    p is false in M . An interpretation M ⊆ At satisfies an ac-atom C (X ), written

    M |= C (X ), if M ∩ X ∈ C (that is, if the set of atoms in X that are true in

    M satisfies the constraint C ). Otherwise, M does not satisfy C (X ), written M 6|=

    C (X ). In that case, we also say that M satisfies the ac-literal not(C (X )) and write

    M |= not(C (X )). An ac-atom C (X ) is consistent if there is an interpretation M

    such that M |= C (X ) or, equivalently, if C contains at least one subset of X . We

    will now illustrate these concepts with several examples of common constraints.

    Pseudo-boolean constraints. These constraints are also known as weight con-

    straints. Given a real number w and a function W , assigning to each atom in At

    a real number (its weight), a pseudo-boolean constraint PB(w ,W ,≤) imposes a

    restriction that “the total weight of atoms in a set is at least w”. Formally, we set

    PB(w ,W ,≤) = {A ⊆ At: w ≤∑

    a∈A W (a)} (comparison relations , ≥ give

    rise to other types of weight constraints).

    Cardinality constraints. They are pseudo-boolean constraints in which a bound

    w is a non-negative integer and a weight of every atom is 1. Throughout the pa-

    per, we use cardinality constraints to illustrate concepts we study. To simplify the

    notation and to make it consistent with the notation used in (Simons et al. 2002),

    we write kX to denote an ac-atom C (X ), where C = PB(k ,W ,≤) and W (a) = 1

    for every a ∈ At.

    Product constraints. They differ from weight constraints in that they restrict

    the product of individual weights of atoms in allowed sets, depending on the type

    of the comparison relation used. Selecting the relation ≤ and assuming the same

    notation as before, we express product constraints as abstract constraints of the

    form Π(w ,W ,≤) = {A ⊆ At: w ≤ Πa∈AW (a)}.

    Maximum constraints. Given a weight function W on the set of atoms and a

    real bound w , the maximum constraint restricts allowed sets of atoms to those with

    the maximum weight at least w . Formally, we express them as abstract constraints

    of the form Max(w ,W ,≤) = {A ⊆ At: w ≤ max{W (a): a ∈ A}} (or its variants,

    depending on the comparison relation).

    Even- and odd-cardinality constraints. They impose a parity requirement on

    the cardinality of allowed sets. Formally, we express them as abstract constraints

    E = {A ⊆ At: |A| is even} and O = {A ⊆ At: |A| is odd}.

    Containment constraints. Such constraints require that allowed sets contain

    some prespecified configurations (subsets). We capture them by abstract constraints

  • Theory and Practice of Logic Programming 5

    C (A) that consist of all subsets of At that contain at least one set from a prespec-

    ified collection A of finite subsets of At.

    Each of these constraints determines associated ac-atoms. Let At = {p1, p2, . . .}

    and let us consider a weight function W such that for every integer i ≥ 1, W (pi) =

    i . The expression PB(6,W ,≤) is an example of a pseudo-boolean constraint. If

    we denote it by C1, then C1({p1, p2, p5, p6}) is an example of a pseudo-boolean

    constraint atom. A set M ⊆ At satisfies C1({p1, p2, p5, p6}) if and only if the total

    weight of atoms in M ∩{p1, p2, p5, p6} is at least 6 (that is, if and only if M contains

    p6, or p5 together with at least one other atom). Similarly, Max(5,W ,≤) is an

    example of a maximum constraint and, if we denote it by C2, C2({p2, p4, p6, p8})

    is a maximum constraint atom that enforces the restriction on sets of atoms to

    contain p6 or p8. An abstract constraint atom E ({p1, p7}) (E stands for the even-

    cardinality constraint) forces allowed sets of atoms to contain none or both of p1and p7. All these constraint atoms are consistent. An atom C3({p1, p2, p3}), where

    C3 = PB(7,w ,≤) is an example of an inconsistent constraint atom. No selection of

    atoms from {p1, p2, p3} satisfies it and, consequently, it has no models.

    These examples demonstrate that abstract constraints and abstract constraint

    atoms express a broad range of common constraints. In this paper, we show that

    abstract constraint atoms can be combined into logic program clauses to repre-

    sent even more complex constraints, and that much of the theory of normal logic

    programs generalizes to the extended setting.

    3 Logic programs built of F-atoms

    Let F be a class of abstract constraints over At. By an F-atom we mean an abstract

    constraint atom A(X ) such that A ∈ F and X ⊆ At. An F-literal (or simply, a

    literal, if the context is clear) is an expression of the form A(X ) or not(A(X )),

    where A(X ) is an F-atom. An F-clause is an expression

    A(X )← B1(X1), . . . ,Bm(Xm),not(C1(Y1)), . . . ,not(Cn(Yn)) (1)

    where A(X ), Bi(Xi) and Cj (Yj ) are F-atoms. An F-clause (1) is called a constraint

    clause if A(X ) is not consistent. An F-program is a finite collection of F-clauses1.

    If r is a clause of the form (1), A(X ) is the head of r , denoted by hd(r), and

    X is the head set of r , denoted by hset(r). We also call the conjunction of literals

    B1(X1), . . . ,Bm(Xm),not(C1(Y1)), . . . ,not(Cn(Yn)), the body of r and denote it

    by bd(r). Occasionally, we use the same term to denote the set of all literals in the

    body of a clause. Finally, for an F-program P , we define hset(P) to be the union

    of sets hset(r), for r ∈ P .

    An interpretation M ⊆ At satisfies a set (conjunction) L of literals, if it satisfies

    every literal in L. We say that M satisfies an F-clause r if M satisfies the head of

    the clause whenever it satisfies the body of r . Finally, M satisfies an F-program P

    1 We note that the assumption of the finiteness of programs is not essential. The entire theory ofF-programs extends to the case when we admit infinite programs. However, additional means ofproof, such as Zorn Lemma, may be required in some arguments (for instance, in the argumentfor the existence of minimal models of F-programs).

  • 6 V.W. Marek, I. Niemelä and M. Truszczyński

    if it satisfies all clauses in P . We write M |= L, M |= r and M |= P to denote these

    three types of the satisfaction relation. We will often write “is a model of” instead

    of “satisfies”. F-programs that have models are called consistent.

    Clauses of normal logic programs are typically regarded as computational de-

    vices: assuming that preconditions of a clause have been established, the clause

    provides a justification to establish (compute) its head. Crucial concepts behind

    formal accounts of that intuition are those of a Horn program, the corresponding

    bottom-up computation, and a least Herbrand model, which defines the result of the

    computation. Computations and their results are well defined due to the monotone

    behavior of Horn programs.

    To extend normal logic programming to the class of programs with abstract con-

    straint atoms, one needs a generalization of the class of Horn programs supporting

    an appropriate notion of a computation, with the results of computations playing

    the same role as that played by the least Herbrand model. In order to accomplish

    that, it is not enough simply to disallow the negation operator in the bodies of

    F-clauses. It is also necessary to restrict the class of constraints to those that are

    monotone (that is, intuitively, once true in an interpretation, they remain true in

    every superset of it). Without that assumption, the monotonicity of normal Horn

    programs does not generalize and there is no straightforward way to define the

    concept of a computation. (We refer to (Marek 2005) for a study of properties of

    monotone constraints.)

    Formally, we say that an abstract constraint C is monotone if for every A,A′ ⊆

    At, if A ∈ C and A ⊆ A′ then A′ ∈ C (in other words, monotone constraints

    are precisely upward-closed families of subsets of At). An abstract constraint atom

    C (X ) is monotone if its constraint C is monotone.

    Proposition 1

    Let C be an abstract monotone constraint over At, X ⊆ At, and let M ,M ′ ⊆ At

    be two interpretations. If M |= C (X ) and M ⊆ M ′, then M ′ |= C (X ).

    We note that if all the individual weights used by a weight function are non-

    negative, the corresponding pseudo-boolean constraints are monotone. The maxi-

    mum constraints are monotone for every weight function. On the other hand, we

    note that some common constraints, for instance, even- and odd-cardinality con-

    straints E and O , are not monotone.

    ¿From now on we restrict our attention to constraints that are monotone. We

    will write a monotone F-clause and a monotone F-program to make it explicit that

    all constraints in F are monotone.

    An important consequence of the monotonicity assumption is that monotone

    F-programs without constraint clauses have models (and so, also minimal models).

    Proposition 2

    Let P be a monotone F-program without constraint clauses. Then the set At of all

    atoms in the language is a model of P .

  • Theory and Practice of Logic Programming 7

    Proof

    Let r ∈ P . Since the constraint hd(r) is consistent, there is a set of atoms M ⊆ At

    such that M |= hd(r). By the monotonicity of constraints in F , At |= hd(r). Thus,

    At |= P .

    Another important consequence of the monotonicity assumption is that the con-

    cept of a Horn program has an obvious direct generalization.

    Definition 1

    A monotone F-program that contains no occurrences of the operator not is a Horn

    F-program. 2

    Horn F-programs defined in this way have many properties that generalize well-

    known properties of normal Horn programs. We will state and prove several of them

    later in the paper.

    4 Nondeterministic one-step provability operator

    Following a fundamental idea underlying normal logic programming, we assign to

    F-clauses a procedural interpretation, which views them as derivation clauses. In

    the discussion that follows we do not assume that constraints in F are monotone.

    Intuitively, if an F-clause r has its body satisfied by some set of atoms M , then

    r provides support for deriving from M any set of atoms M ′ such that

    1. M ′ consists of some atoms from the headset of r (r provides no grounds for

    deriving atoms that do not appear in its headset)

    2. M ′ satisfies the head of r (since r “fires”, the constraint imposed by its head

    must hold).

    Clearly, the process of deriving M ′ from M by means of r is nondeterministic in

    the sense that, in general, there are several sets that are supported by r and M .

    This interpretation of F-clauses extends to F-programs. Given an F-program

    P and a set of atoms M , each clause r ∈ P such that M satisfies the body of r

    provides a support for a subset of the head set of r . The union, say M ′, of such

    sets — each supported by some clause r , with r ranging over those clauses in P

    whose body is satisfied by M — can be viewed as “derived” from M by means of

    P . In general, given P and M , there may be several such derived sets. Thus the

    notion of derivability associated with a program is nondeterministic, as in the case

    of individual clauses.

    We describe formally this intuition of derivability in terms of a nondeterministic

    one-step provability operator. Before we give a precise definition, we note that by a

    nondeterministic operator on a set D we mean any function f : D → P(D). One can

    view the set f (d) as the collection of all possible outcomes of applying f to d one of

    which, if f (d) 6= ∅, can be selected nondeterministically as the actual outcome of f .

    We emphasize that we allow f (d) to be empty, that is, nondeterministic operators

    are, in general, partial — for some elements of the domain they do not assign any

    possible outcomes.

  • 8 V.W. Marek, I. Niemelä and M. Truszczyński

    Definition 2

    Let F be a class of constraints (not necessarily monotone). Let P be an F-program

    and let M ⊆ At.

    1. A clause r ∈ P is M -applicable, if M |= bd(r). We denote by P(M ) the

    set of all M -applicable clauses in P .

    2. A set M ′ is nondeterministically one-step provable from M by means of

    P , if M ′ ⊆ hset(P(M )) and M ′ |= hd(r), for every clause r in P(M ).3. The nondeterministic one-step provability operator TndP , is a function

    from P(At) to P(P(At)) such that for every M ⊆ At, TndP (M ) consists

    of all sets M ′ that are nondeterministically one-step provable from M

    by means of P . 2

    Since an abstract constraint forming the head of an F-clause may be inconsistent,

    there exist programs P and interpretations M ⊆ At such that TndP (M ) is empty.

    The concepts introduced above have especially elegant properties for monotone

    F-programs. First, to illustrate them, let us consider a simple example involving a

    program with cardinality constraints (cf. Section 2). The program discussed in this

    example is not a Horn program.

    Example 1

    Let P be a program with cardinality constraints consisting of the following clauses:

    r1 = 2{a} ← 2{b, d}r2 = 1{b, c} ← not(1{e})r3 = 1{a, d} ← 2{b, c}

    We note that the cardinality atom in the head of the first clause is inconsistent.

    Let us consider a set M = {b, c, e}. Since M 6|= 2{b, d}, r1 is not M -applicable.

    Similarly, M 6|= not(1{e}) and r2 is not M -applicable, either. On the other hand,

    M |= 2{b, c} and so, r3 is M -applicable.

    There are three subsets of {a, d} that satisfy the constraint 1{a, d} in the head of

    the clause r3: {a}, {d} and {a, d}. Thus, each of these sets is nondeterministically

    one-step provable from M and, consequently,

    TndP (M ) = {{a}, {d}, {a, d}}.

    We also note that if |M | = 1 and e /∈ M then r2 is the only M -applicable clause in

    P . For such sets M , TndP (M ) = {{b}, {c}, {b, c}}. On the other hand, if M contains

    both b and d , then r1 is M -applicable and since the head of r1 is inconsistent,

    TndP (M ) = ∅ (no set is nondeterministically one-step provable from such a set M ).

    2

    The example shows, in particular, that it may be the case that TndP (M ) = ∅. If,

    however, P is a monotone F-program without constraint clauses, then it is never

    the case.

    Proposition 3

    Let P be a monotone F-program without constraint clauses. For every M ⊆ At,

    hset(P(M )) ∈ TndP (M ). In particular, TndP (M ) 6= ∅.

  • Theory and Practice of Logic Programming 9

    Proof

    Let us consider r ∈ P(M ). Then, hset(P(M )) ∩ hset(r) = hset(r). Since hd(r) is

    consistent, it follows by the monotonicity of constraints in F that hset(r) |= hd(r).

    Thus, hset(P(M )) |= hd(r) and, consequently, hset(P(M )) ∈ TndP (M ).

    The operator TndP plays a fundamental role in our research. It allows us to for-

    malize the procedural interpretation of F-clauses and identify several classes of

    models.

    Our first result characterizes models of monotone F-programs. Models of a nor-

    mal logic program P are prefixpoints of the one-step provability operator TP (van

    Emden and Kowalski 1976). This characterization lifts to the class of monotone

    F-programs, with the operator TndP replacing TP .

    Theorem 1

    Let P be a monotone F-program and let M ⊆ At. The set M is a model of P if

    and only if there is M ′ ∈ TndP (M ) such that M′ ⊆ M .

    Proof

    Let M be a model of P and M ′ = M ∩ hset(P(M )). Let r ∈ P(M ). Since M is

    a model of r , M |= hd(r). Clearly, hset(r) ⊆ hset(P(M )). Thus, M ∩ hset(r) =

    M ′ ∩ hset(r) and, consequently, M ′ |= hd(r). It follows that M ′ ∈ TndP (M ). Since

    M ′ ⊆ M , the assertion follows.

    Conversely, let us assume that there is M ′ ∈ TndP (M ) such that M′ ⊆ M . Let

    r ∈ P be a clause such that M |= bd(r). Since M ′ ∈ TndP (M ), M′ |= hd(r). We recall

    that the constraint involved in hd(r) is monotone (as we consider only monotone

    constraints). Thus, by Proposition 1, M |= hd(r), as well. It follows that M is a

    model of every clause in P and, consequently, of P .

    5 Supported models of F-programs

    For a set M of atoms, we say that M -applicable clauses in an F-program P provide

    support to atoms in the heads of these clauses. In general, a model M of an F-

    program may contain elements that have no support in a program and M itself,

    that is, cannot be derived from M by means of clauses in the program.

    Example 2

    Let P be a program with cardinality constraints consisting of a single clause:

    1{p, q} ← not(1{q}),

    where p and q are two different atoms. Let M1 = {q}. Clearly, M1 is a model of

    P . However, M1 has no support in P and itself. Indeed, TndP (M1) = {∅} and so, P

    and M1 do not provide support for any atom. Similarly, another model of P , the

    set M2 = {p, s}, where s ∈ At is an atom different from p and q , has no support

    in P and itself. We have TndP (M2) = {{p}, {q}, {p, q}} and so, p has support in P

    and M2, but s does not. Finally, the set M3 = {p}, which is also a model of P , has

    support in P and itself. Indeed, TndP (M3) = {{p}, {q}, {p, q}} and there is a way

    to derive M3 from P and M3. 2

  • 10 V.W. Marek, I. Niemelä and M. Truszczyński

    For M to be a model of P , M must satisfy the heads of all applicable clauses.

    To this end, M needs to contain some of the atoms appearing in the headsets of

    these clauses (atoms with support in M and P) and, possibly, also some atoms

    that do not have such support. Models that contain only atoms with support form

    an important class of models generalizing the class of supported models for normal

    logic programs (Clark 1978; Apt 1990).

    Definition 3

    Let F be a class of constraints (not necessarily monotone) and let P be an F-

    program. A set of atoms M is a supported model of P if M is a model of P and

    M ⊆ hset(P(M )). 2

    Supported models have the following characterization generalizing a character-

    ization of supported models of normal logic programs as fixpoints of the the van

    Emden-Kowalski operator (the characterizing condition is commonly used as a defi-

    nition of a fixpoint of a nondeterministic operator).

    Theorem 2

    Let F be a class of constraints (not necessarily monotone). Let P be an F-program.

    A set M ⊆ At is a supported model of P if and only if M ∈ TndP (M ).

    Proof

    If M is a supported model of P then it is a model of P (by the definition). Moreover,

    M ⊆ hset(P(M )). Thus, M ∈ TndP (M ). Conversely, if M ∈ TndP (M ), then M ⊆

    hset(P(M )) and M |= hd(r), for every r ∈ P(M ). Thus, M |= r , for every r ∈

    P(M ). If r ∈ P \ P(M ), then M 6|= bd(r) and so, M |= r . Thus, M is a model of

    P . Since M ∈ TndP (M ) also implies M ⊆ hset(P(M )), M is a supported model of

    P .

    In Section 8 we show that the use of the term supported for the class of models de-

    fined in this section is not a misnomer; supported models of F-programs generalize

    supported models of normal logic programs.

    6 Horn F-programs

    For the concepts of the one-step provability and supported models we did not

    need a restriction to monotone constraints. To properly generalize the notion of a

    stable model, however, this restriction is essential. Thus, from this point on, we will

    consider only monotone F-programs.

    First, we will study Horn F-programs (we recall that the notion of a Horn F-

    program assumes that F consists of monotone constraints only) viewing them as

    representations of certain nondeterministic computational processes. We will later

    use the results of this section to extend to the class of F-programs the concept of

    a stable model.

  • Theory and Practice of Logic Programming 11

    Definition 4

    Let P be a Horn F-program. A P -computation is a sequence (Xn)n=0,1,... such that

    X0 = ∅ and, for every non-negative integer n:

    1. Xn ⊆ Xn+1, and

    2. Xn+1 ∈ TndP (Xn).

    Given a computation t = (Xn)n=0,1,..., we call⋃∞

    n=0 Xn the result of the computa-

    tion t and denote it by Rt . 2

    Our stipulations that P -computations have length ω does not restrict the gener-

    ality. Since atom sets of ac-atoms are finite, if a clause is applicable with respect

    to the result of the computation, it is applicable at some step n of the computa-

    tion. Consequently, like in the case of normal Horn programs, all possible results

    of computations of arbitrary transfinite lengths can be reached in ω steps, even in

    the case of infinite programs.

    Results of computations are supported models.

    Theorem 3

    Let P be a Horn F-program and let t be a P -computation. Then Rt is a supported

    model of P , that is, Rt is a model of P and Rt ⊆ hset(P(Rt)).

    Proof

    Let t = (Xn)n=0,1,.... Clearly X0 = ∅ ⊆ hset(P(Rt)). Let n be a non-negative inte-

    ger. Since Xn+1 ∈ TndP (Xn), Xn+1 ⊆ hset(P(Xn)). Since P is a Horn F-program,

    it follows that if r ∈ P , X ⊆ Y and X |= bd(r), then Y |= bd(r). Thus, since

    Xn ⊆ Rt , we have

    Xn+1 ⊆ hset(P(Xn)) ⊆ hset(P(Rt))·

    By induction, Rt =⋃∞

    n=0 Xn ⊆ hset(P(Rt)).

    Conversely, let us consider a clause r ∈ P . If Rt 6|= bd(r) then Rt |= r . Let us then

    assume that Rt |= bd(r). Since r has finitely many F-atoms in the body, and since

    each F-atom is of the form C (X ), where X is finite, there is a non-negative integer

    i such that Xi |= bd(r). By the definition of a P -computation, Xi+1 ∈ TndP (Xi).

    Thus, Xi+1 |= hd(r) and, since Xi+1 ⊆ Rt , Rt |= hd(r) (by the monotonicity of

    hd(r)). It follows that Rt |= r in the case when Rt |= bd(r), as well. Thus, Rt is

    a model of P . Since Rt is a model of P and Rt ⊆ hset(P(Rt)), Rt is a supported

    model of P .

    We will now show that having a model (being consistent) is a necessary and

    sufficient condition for a Horn F-program to have a computation. To this end, we

    will first introduce a certain class of computations.

    Definition 5

    Let M be a model of P . A canonical P -computation with respect to M is a sequence

    tP,M = (XP,Mn )n=0,1,... defined as follows:

    1. XP,M0 = ∅ and,

    2. XP,Mn+1 = hset(P(XP,Mn )) ∩M , for every n ≥ 0. 2

  • 12 V.W. Marek, I. Niemelä and M. Truszczyński

    We observe that canonical computations involve no nondeterminism. At each

    stage there is exactly one way in which we can continue. This continuation is de-

    termined by the model M . Before we proceed further, we illustrate the concept of

    a canonical computation with a simple example.

    Example 3

    Let us assume that At = {a, b, c, d} and let us consider a Horn program with

    cardinality constraints, say P , consisting of the following clauses:

    r1 = 1{a, d} ← 2{b, d}r2 = 1{b, c} ←r3 = 1{a} ← 2{b, c}

    Let M = {a, b, c, d}. It is easy to check that M is a model of P (it also follows from

    Proposition 2, as the constraint atoms in the heads of clauses in P are consistent).

    We will now construct a canonical P -computation with respect to M . By the

    definition XP,M0 = ∅. The only XP,M0 -applicable clause in P is r2. Since {b, c}∩M =

    {b, c}, XP,M1 = {b, c}. The clauses r2 and r3 are XP,M1 -applicable and r1 is not.

    Since {a} ∩ M = {a} and {b, c} ∩ M = {b, c}, XP,M2 = {a, b, c}. Since r2 and

    r3 are the only XP,M2 -applicable clauses in P , it follows that X

    P,Mk = X

    P,M2 , for

    k = 3, 4, . . ..

    By the definition, the union of all sets in the canonical computation is included

    in M . Our example demonstrates that canonical computations with respect to M ,

    in general, do not reconstruct all of M . 2

    The use of the term P -computation in Definition 5 is justified. The following

    theorem shows that the sequence tP,M is indeed a P -computation.

    Theorem 4

    Let P be a Horn F-program and let M ⊆ At be a model of P . Then the sequence

    tP,M is a P -computation.

    Proof

    We need to show that the conditions (1) and (2) from the definition of a P -

    computation hold for the sequence tP,M . To prove (1), we proceed by induction

    on n. For n = 0, the condition (1) is, clearly, satisfied. Let us assume that for some

    non-negative integer n, XP,Mn ⊆ XP,Mn+1 holds. Then

    hset(P(XP,Mn )) ⊆ hset(P(XP,Mn+1 ))·

    It follows that

    XP,Mn+1 = hset(P(X

    P,Mn )) ∩M ⊆ hset(P(X

    P,Mn+1 )) ∩M = X

    P,Mn+2 ·

    To prove (2), let us consider a non-negative integer n. By the definition, XP,Mn+1 ⊆

    hset(P(XP,Mn )). It remains to prove that XP,Mn+1 |= P(X

    P,Mn ). Let r ∈ P(X

    P,Mn ).

    Then XP,Mn |= bd(r) and, since XP,Mn ⊆ M , M |= bd(r). We recall that M is a

    model of P . Thus, M |= hd(r). It follows that M ∩ hset(r) |= hd(r) and, con-

    sequently, M ∩ hset(P(XP,Mn )) |= hd(r). Since XP,Mn+1 = M ∩ hset(P(X

    P,Mn )), it

    follows that XP,Mn+1 |= P(XP,Mn ).

    We now have the following corollary to Theorems 3 and 4 that characterizes Horn

    F-programs that have computations.

  • Theory and Practice of Logic Programming 13

    Corollary 1

    Let P be a Horn F-program. Then, P has a model if and only if it has a P -

    computation. In particular, every Horn F-program P without constraint clauses

    possesses at least one P -computation.

    Proof

    If M is a model of P then the canonical computation tP,M is a P -computation

    (Theorem 4). Conversely, if P has a P -computation t , then Rt is a model of P

    (Theorem 3). The second part of the assertion follows from the fact that Horn

    F-programs without constraint clauses have models (Proposition 2).

    We use the concept of a computation to identify a certain class of models of Horn

    F-programs.

    Definition 6

    Let P be a Horn F-program. We say that a set of atoms M is a derivable model of

    P if there exists a P -computation t such that M = Rt . 2

    Derivable models play in our theory a role analogous to that of the least model of

    a normal Horn program. The basic analogy is that they are the results of bottom-up

    computations, as is the case for the least model of a normal Horn program.

    Theorems 3 and 4 entail several properties of Horn F-programs, their computa-

    tions and models. We gather them in the following corollary. Properties (1) and (3)

    - (6) generalize properties of the least model of a normal Horn logic program.

    Corollary 2

    Let P be a Horn F-program. Then:

    1. If P is consistent then P has at least one derivable model.

    2. For every model M of P there is a largest derivable model M ′ of P such

    that M ′ ⊆ M .

    3. A model M of P is derivable if and only if M = RtP,M .

    4. If P contains no constraint clauses then P has a largest derivable model.

    5. Every minimal model of P is derivable.

    6. Every derivable model of P is a supported model of P .

    Proof

    (1) Since P has a model, it has a P -computation (Theorem 4). The result of this

    computation is a model of P (Theorem 3). By the definition, this model is derivable.

    (2) Let M be a model of P and let t = (Xn)n=0,1,... be the canonical P -computation

    for M . Then, Rt is a derivable model of P and Rt ⊆ M . Let s = (Yn)n=0,1,... be

    a P -computation such that Rs ⊆ M . Clearly, we have Y0 ⊆ X0. Let us consider

    an integer n > 0 and let us assume that Yn−1 ⊆ Xn−1. Since Rs ⊆ M , Yn ⊆ M .

    Thus, by the definition of a P -computation,

    Yn ⊆ hset(P(Yn−1)) ∩M ·

  • 14 V.W. Marek, I. Niemelä and M. Truszczyński

    Since P is a Horn F-program and since Yn−1 ⊆ Xn−1, hset(P(Yn−1)) ⊆ hset(P(Xn−1)).

    Thus,

    Yn ⊆ hset(P(Xn−1)) ∩M = Xn ·

    It follows now by induction that Rs ⊆ Rt . Thus, Rt is the largest derivable model

    contained in M .

    (3) Let M be a model of P . The argument we used in (2) shows that the result

    of the canonical computation from P with respect to M is the greatest derivable

    model contained in M . If M is derivable, then M = RtP,M . The converse implication

    follows by the definition.

    (4) The set At is a model of P . Let R be the result of the canonical P -computation

    for At. Clearly, R is a derivable model of P . We will show that every derivable model

    of P is a subset of R. Let M be a derivable model of P . By (3), M is the result of a

    canonical computation for M . Since M ⊆ At, it follows by an induction argument

    that for every non-negative integer n, XP,Mn ⊆ XP,Atn (we omit the details, as the

    argument is similar to that in the proof of (2)). Consequently, M ⊆ R.

    (5) This assertion follows directly from (2).

    (6) This assertion follows directly from Theorem 3.

    Despite analogies with the least model of a normal Horn program, derivable mod-

    els are not, in general, minimal. For instance, a program with cardinality constraints

    consisting of a single clause

    1{a, b} ←

    has three derivable models: {a}, {b} and {a, b}, only two of which are minimal.

    Horn F-programs generalize Horn normal logic programs (see Section 8 for de-

    tails.). For a Horn F-programs without constraint clauses, the canonical computa-

    tion with respect to the set of all atoms is a counterpart to the bottom-up compu-

    tation determined by a normal Horn program.

    7 Stable models of monotone F-programs

    We will now use the results of the two previous sections to introduce and study the

    class of stable models of monotone F-programs.

    Definition 7

    Let P be a monotone F-program and let M ⊆ At. The reduct of P with respect to

    M , PM in symbols, is a Horn F-program obtained from P by (1) removing from P

    every F-clause containing in the body a literal not(A) such that M |= A, and (2)

    removing all literals of the form not(A) from all the remaining clauses in P . A set

    of atoms M is a stable model of P if M is a derivable model of the reduct PM . 2

    The following result is easy to show (and so we omit its proof) but useful.

    Lemma 1

    Let P be a monotone F-program. If M is a model of P , then M is a model of PM .

    2

  • Theory and Practice of Logic Programming 15

    Example 4

    We illustrate the concept of stable models of monotone F-programs with examples

    underlining some aspects of their properties. The class F we use in this example

    consists of all cardinality constraints which, we recall, are monotone (Section 2).

    Let P be a program consisting of the following two clauses:

    1{a, b} ← 1{d},not(1{b, c})1{a, d} ←

    We will now investigate properties of some sets with respect to this program.

    (1) The set M1 = ∅ is not a model of our program P . As we will see soon (Proposition

    4), stable models are supported models and, consequently, also models. Thus ∅ is

    not a stable model of P .

    (2) The set M2 = {a, b, c} is a model of P . But M2 is not a stable model of P .

    Indeed, let us compute PM2 . It consists of just one clause: 1{a, d} ←. Since M2 is

    not a derivable model of PM2 (it contains an atom not occurring in any head of the

    clause of PM2), M2 is not a stable model of P

    (3) The set M3 = {a, d} is a stable model of P . The reduct PM3 consists of two

    clauses:

    1{a, b} ← 1{d}1{a, d} ←

    The sequence ∅, {a, d}, {a, d}, . . . is a PM3-computation. Thus, M3 is a derivable

    model of PM3 and hence M3 is a stable model of P

    (4) The set M4 = {a} is a stable model of P . The reduct PM4 consists of two

    clauses:

    1{a, b} ← 1{d}1{a, d} ←

    The sequence ∅, {a}, {a}, . . . is a PM4 -computation. Thus {a} is a stable model of

    P .

    In our example M4 ⊂ M3. Thus, in contrast to normal logic programs (but not to

    lparse programs), stable models of abstract constraint programs can nest. That is,

    they do not satisfy the antichain (minimality with respect to inclusion) property.

    The program P that we considered above has stable models. It is easy to con-

    struct examples of programs that have no stable models. For instance, a program

    consisting of just one clause: 2{a, b, c} ← not(1{a, b}) has models but no stable

    models. 2

    Stable models of a monotone F-program P are indeed models of P . Thus, the use

    of the term “model” in their name is justified. In fact, a stronger property holds:

    stable models of monotone F-programs are supported. This again generalizes a

    well-known property of normal logic programs2.

    2 Incidentally, in the case of programs with weight constraints in the lparse syntax, no suchproperty has been established as supported models have not been defined for that formalism.

  • 16 V.W. Marek, I. Niemelä and M. Truszczyński

    Proposition 4

    Let P be a monotone F-program. If M ⊆ At is a stable model of P then M is a

    supported model of P .

    Proof

    First, it follows directly from the corresponding definitions that TndP (M ) = TndPM

    (M ).

    Next, since M is a derivable model of PM , M is a supported model of PM (Corol-

    lary 2(6)). Thus, by Theorem 2, M ∈ TndPM

    (M ) and, consequently, M ∈ TndP (M ). It

    follows that M is a supported model of P .

    With the notion of a stable model in hand, we can strengthen Theorem 3.

    Theorem 5

    Let P be a Horn F-program. A set of atoms M ⊆ At is a derivable model of P if

    and only if M is a stable model of P .

    Proof

    The assertion is a direct consequence of the fact that for every Horn F-program P

    and for every set of atoms M , P = PM .

    We will now prove yet another result that generalizes a property of stable models

    of normal logic programs (cf. work on extending the semantics of stable models to

    logic programs with integrity constraints (Lifschitz 1996)).

    Proposition 5

    Let P and Q be two monotone F-programs.

    1. If M is a stable model of P and a model of Q then M is a stable model

    of P ∪Q .

    2. If Q consists of constraint clauses and M is a stable model of P ∪ Q

    then M is a stable model of P .

    Proof

    (1) Since M is a stable model of P , M is a derivable model of PM . By Corollary

    2(3), M is the result of the canonical PM -computation with respect to M . Since

    M is a model of P ∪ Q , by Lemma 1 M is a model of (P ∪ Q)M = PM ∪ QM .

    Therefore, the canonical (PM ∪QM )-computation with respect to M is well defined.

    Its result is clearly contained in M . On the other hand, it contains the result of the

    canonical PM -computation with respect to M , which is M . Therefore, the result

    of the canonical (PM ∪ QM )-computation with respect to M is M . Thus, M is a

    derivable model of (P ∪Q)M and a stable model of P ∪Q .

    (2) Since M is a stable model of P ∪Q , M is the result of a (P ∪Q)M -computation,

    say t . Since Q consists of constraint clauses, t is a PM -computation (constraint

    clauses, having inconsistent heads, do not participate in computations). Thus, M

    is also a result of a PM -computation, that is, M is a stable model of P .

  • Theory and Practice of Logic Programming 17

    8 Monotone F-programs and normal logic programming

    A main goal of this paper is to propose a way to integrate abstract constraints

    into normal logic programming. In this section, we show that our formalism of F-

    programs contains normal logic programming (modulo a very simple encoding) so

    that all major two-valued semantics are preserved.

    To this end, let us consider an abstract constraint:

    PB = {X ⊆ At: X 6= ∅}·

    We note that PB is identical with the pseudo-boolean constraint (we introduced

    pseudo-boolean constraints in Section 2):

    PB = PB(1,W ,≤),

    where W is a weight function on At such that W (a) = 1, for every a ∈ At. Clearly,

    the constraint PB is monotone. We will show that normal logic programs can be

    encoded as {PB}-programs or, more generally, as monotone F-programs, for every

    class F of monotone abstract constraints such that PB ∈ F . In what follows, if

    a ∈ At, we will write PB(a) for a {PB}-atom PB({a}).

    We note that for every a ∈ At and every interpretation M ⊆ At, M |= a if

    and only if M |= PB(a). That is, a propositional atom a is logically equivalent

    to an abstract constraint atom PB(a). This equivalence suggests an encoding of

    a normal logic program P as {PB}-program Ppb . Namely, if r is a normal logic

    program clause

    a ← b1, . . . , bm ,not(c1), . . . ,not(cn)

    we define rpb to be a {PB}-clause

    PB(a)← PB(b1), . . . ,PB(bm),not(PB(c1)), . . . ,not(PB(cn))·

    For a normal logic program P , we define Ppb = {rpb : r ∈ P}. By our earlier

    comments, Ppb is a monotone F-program, for every class of monotone constraint

    atoms containing the constraint PB .

    We note that due to the equivalence of a and PB(a), which we noted above, for

    every interpretation M ⊆ At we have

    M |= bd(r) if and only if M |= bd(rpb)· (2)

    (here and in other places we use symbols such as bd(r), hd(r) and hd(P) also in

    the context of normal logic programs, and assume their standard meaning).

    Our first result involves operators associated with programs. Let P be a normal

    logic program. We recall that the one-step provability operator TP (van Emden and

    Kowalski 1976) is defined as follows: for every M ⊆ At,

    TP (M ) = {hd(r): r ∈ P and M |= bd(r)}·

    We have the following basic property of the translation P 7→ Ppb .

    Proposition 6

    Let P be a normal logic program. Then for every M ⊆ At(P), TndPpb

    (M ) = {TP (M )}.

  • 18 V.W. Marek, I. Niemelä and M. Truszczyński

    Proof

    We will write r and r ′ for a pair of corresponding clauses in P and Ppb . That is, if

    r ∈ P then r ′ = rpb is the counterpart of r in Ppb . Conversely, if r ′ ∈ Ppb , r is the

    clause in P such that rpb = r ′. Clearly, we have hset(r ′) = {hd(r)}.

    By the equivalence (2), a clause r ∈ P is M -applicable if and only if r ′ is M -

    applicable. Thus, we have

    hset(Ppb(M )) = hd(P(M )) = TP (M )· (3)

    Let r ′ ∈ Ppb(M ) and let a = hd(r). It follows that r ∈ P(M ) and a ∈ TP (M ). Since

    hd(r ′) = PB(a), TP (M ) |= hd(r′). Thus, TP (M ) is one-step nondeterministically

    provable from M and Ppb , that is, TP (M ) ∈ TndPpb

    (M ).

    Next, let us consider M ′ ∈ TndPpb

    (M ). By the definition, M ′ ⊆ hset(Ppb(M )).

    Thus, by (3), we have M ′ ⊆ TP (M ). Let us now consider a ∈ TP (M ). It follows

    that there is a clause r ∈ P(M ) such that hd(r) = a. Consequently, r ′ ∈ Ppb(M )

    and hd(r ′) = PB(a). Since M ′ ∈ TndPpb

    (M ), M ′ |= hd(r ′). Thus, a ∈ M ′. It follows

    that M ′ = TP (M ) and, consequently, TndPpb

    (M ) = {TP (M )}.

    This result entails a proposition concerning Horn programs.

    Proposition 7

    Let P be a normal Horn logic program. Then M is a least model of P if and only

    if M is a derivable model of Ppb .

    Proof

    We first observe that the sequence {TP ↑ n(∅)}n=0,1,... is a Ppb-computation (one

    can show this by an easy inductive argument, using the relationship between TPand Tnd

    Ppbestablished by Proposition 6). Since M is the limit of the sequence {TP ↑

    n(∅)}n=0,1,..., M is a derivable model of Ppb .

    Conversely, if M is a derivable model of Ppb , then M is the result of a deriva-

    tion {Xn}n=0,1,... from Ppb . Thus, for every n = 0, 1, . . ., Xn+1 ∈ T

    ndPpb

    (Xn). By

    Proposition 6, Xn+1 = TP (Xn). Since X0 = ∅, it follows that for every n = 0, 1, . . .,

    Xn = TP ↑ n(∅). Consequently, M =⋃∞

    n=0 TP ↑ n(∅) and so, M is the least model

    of P .

    We can now prove the main result of this section demonstrating that the embed-

    ding P 7→ Ppb preserves all the semantics considered in the paper.

    Theorem 6

    Let P be a normal logic program and let M be a set of atoms. Then M is a model

    (supported model, stable model) of P if and only if M is a model (supported model,

    stable model) of Ppb .

    Proof

    It is well known that M is a model of P if and only if TP (M ) ⊆ M (Apt 1990).

    By Proposition 6, the latter condition is equivalent to the condition that there is

    M ′ ∈ TndPpb

    (M ) such that M ′ ⊆ M . By Theorem 1, this last condition is equivalent

  • Theory and Practice of Logic Programming 19

    to M being a model of Ppb . Thus, M is a model of P if and only if M is a model

    of Ppb .

    The proof for the case of supported models is essentially the same. It relies on

    the fact that M is a supported model of P if and only if M = TP (M ) (Apt 1990)

    and uses Proposition 6 and Theorem 2.

    Let us assume now that M is a stable model of P . It follows that M is the least

    model of PM . By Proposition 7, M is a derivable model of [PM ]pb . It follows from

    the definitions of the reducts of normal logic programs and {PB}-programs that

    [PM ]pb = [Ppb ]M . Thus, M is a stable model of Ppb . The converse implication can

    be proved in the same way.

    There are other ways to establish a connection between normal logic programs

    and programs with abstract constraints. We will now define a class of monotone

    F-programs, which offers a most direct extension of normal logic programming.

    Definition 8

    An F-atom C (X ) is definite if X is a minimal element in C . An F-clause r is

    definite if hd(r) is a definite F-atom. An F-program is definite if every clause in P

    is definite. 2

    We use the term definite following the logic programming tradition (cf. (van Em-

    den and Kowalski 1976), for instance), where it is used for clauses whose heads

    provide “definite” information (as opposed to being disjunctions and so listing sev-

    eral possible alternatives).

    Example 5

    Let F consist of two monotone constraints, C1 and C2 where:

    C1 = {X ⊆ At: {a, b} ⊆ X or {a, c} ⊆ X or |X | is infinite}

    and

    C2 = {X ⊆ At: {d , e} ⊆ X }·

    The constraint C1 has two minimal elements: {a, b} and {a, c}. The constraint C2has just one minimal element: {d , e}.

    These constraints generate three definite atoms C1({a, b}), C1({a, c}), and C2({d , e}).

    An F-program consisting of the following clauses is definite:

    C1({a, b})←C1({a, c})← C1({a, b, c}),not(C2({a, b, d , e})C2({d , e})←

    We note that some monotone constraints do not yield any definite constraint

    atoms. It happens when they have no finite minimal elements. A constraint C

    consisting of all infinite subsets of At offers a specific example. 2

    Definite F-atoms have the following simple properties.

    Proposition 8

    Let X ⊆ At and let C (X ) be a definite F-atom. Then C (X ) is consistent and, for

    every M ⊆ At, M |= C (X ) if and only if X ⊆ M .

  • 20 V.W. Marek, I. Niemelä and M. Truszczyński

    Proof

    If M |= C (X ) then M ∩ X ∈ C . Since C (X ) is a definite F-atom, X is a minimal

    element in C . It follows that M ∩ X = X and so, X ⊆ M . Conversely, if X ⊆ M

    then M ∩ X = X . Since X ∈ C , M ∩ X ∈ C . Thus, M |= C (X ). This argument

    proves the second part of the assertion. In particular, it follows that X |= C (X ).

    Thus, C (X ) is consistent.

    The intuition behind the notion of a definite F-atom is now clear. Given a definite

    F-program and an interpretation M , there is always a way to satisfy the heads of

    all M -applicable clauses (due to consistency of definite F-atoms). Moreover, there

    is only one way to do so if we want only to use atoms appearing in the headsets

    of M -applicable clauses (due the the second property from Proposition 8). Thus,

    computing with definite F-programs does not involve nondeterminism. Indeed, we

    have the following result.

    Proposition 9

    Let P be a definite F-program. Then, for every set of atoms M , |TndP (M )| = 1.

    Proof

    Let r ∈ P(M ). Since hd(r) is a definite F-atom, then hset(r) |= hd(r). We now

    observe that hset(r) ⊆ hset(P(M )). Thus, for every r ∈ P(M ), hset(P(M )) |=

    hd(r). By the definition of the one-step nondeterministic provability, hset(P(M )) ∈

    TndP (M ). Thus, |TndP (M )| ≥ 1.

    Next, let us consider M ′ ∈ TndP (M ). From the definition of TndP (M ), it follows

    that M ′ ⊆ hset(P(M )). To prove the converse inclusion, let r ∈ P(M ). Again

    by the definition of TndP (M ), we have that M′ |= hd(r). Since hd(r) is a definite

    F-atom, Proposition 8 implies that hset(r) ⊆ M ′. Thus, hset(P(M )) ⊆ M ′.

    It follows that hset(P(M )) = M ′ and so, |TndP (M )| = 1.

    Thus, for a definite F-program P , the operator TndP is deterministic and, so, can

    be regarded as an operator with both the domain and codomain P(At). We will

    write T dP , to denote it. Models, supported models and stable models of a definite

    monotone F-program (for supported models we do not need the monotonicity as-

    sumption) can be introduced in terms of the operator T dP in exactly the same way

    the corresponding concepts are defined in normal logic programming. In particular,

    the algebraic treatment of logic programming developed in (Fitting 2002; Przy-

    musinski 1990; Denecker et al. 2000) applies to definite F-programs and results

    in a natural and direct extension of normal logic programming. We note that this

    comment extends to 3- and 4-valued semantics of partial models, supported models

    and stable models (including the Kripke-Kleene semantics and the well-founded

    semantics)3.

    We will explicitly mention just one result on definite monotone F-programs (in

    fact, definite Horn programs) here, as it will be used later in the paper.

    3 Results in (Denecker et al. 2001; Pelov et al. 2004; Pelov. 2004) are related to this observation.They concern programs with aggregates, whose clauses have heads consisting of single atomsand so, are definite.

  • Theory and Practice of Logic Programming 21

    Proposition 10

    Let P be a definite Horn F-program. Then P has exactly one derivable model and

    this model is the least model of P .

    Proof

    Since P is definite, it contains no constraint clauses and so, it has a model (Proposi-

    tion 2). Thus, it has at least one P -computation. Let (Xn)n=0,1,... and (Yn)n=0,1,...be two P -computations. By the definition, X0 = ∅ = Y0. Let us assume that for

    some n ≥ 0, Xn = Yn . By the definition of P -computations,

    Xn+1 ∈ TndP (Xn) and Yn+1 ∈ T

    ndP (Yn)·

    By the induction hypothesis, Xn = Yn . Thus, TndP (Xn) = T

    ndP (Yn). Since P is

    definite, |TndP (Xn)| = |TndP (Yn)| = 1 and so, Xn+1 = Yn+1. Thus, both computa-

    tions coincide and P has exactly one P -computation and so, exactly one derivable

    model. Since every model of P contains a derivable model, it follows that the unique

    derivable model of P is also a least model of P .

    9 Encoding lparse programs as monotone F-programs

    We will now investigate the relation between lparse programs (Niemelä et al. 1999;

    Simons et al. 2002) and programs with monotone abstract constraints. We start by

    reviewing the syntax and the semantics of lparse programs.

    A weighted set of literals is a function W : X → {. . . ,−1, 0, 1, . . .}, where X ⊆

    At ∪ {not(a) | a ∈ At} is finite. We call X the literal set of W and denote it by

    lset(W ). The set of atoms that appear in literals in lset(W ) is the atom set of W .

    We denote it by aset(W ). Sometimes it will be convenient to write W explicitly.

    To this end, we will write W as

    {a1 = w1, . . . , am = wm ,not(b1) = w′1, . . . ,not(bn) = w

    ′n}, (4)

    where the domain of the function W is {a1, . . . , am ,not(b1), . . .not(bn)}, and w1 =

    W (a1), . . . ,w′n = W (not(bn)), loosely following the lparse notation. Thus, when

    the domain of W is {a, b, c} and W (a) = 1,W (b) = 2, and W (c) = 1, then we

    write W as {a = 1, b = 2, c = 1}.

    An lparse atom (l-atom, for short) is an expression of the form kWl , where W is

    a weighted set of literals, and k and l are integers such that k ≤ l . By the literal

    set of an l-atom A = kWl we mean lset(W ) and write lset(A) to denote it (in a

    similar way, we extend the definition and the notation of the atoms set to the case

    of l-atoms).

    We say that a set of atoms (interpretation) M satisfies an l-atom kWl if

    k ≤∑

    p ∈ lset(W )p ∈ M

    W (p) +∑

    not(p) ∈ lset(W )p 6∈ M

    W (p) ≤ l

    (M |= kWl , in symbols). We note that it is easy to give an example of an incon-

    sistent l-atom. For instance, 2{a = 1}2 is inconsistent. We will use I to denote

  • 22 V.W. Marek, I. Niemelä and M. Truszczyński

    any inconsistent constraint (it does not matter which, as all are equivalent to each

    other).

    An lparse clause (l-clause, for short) is an expression r of the form

    A← B1, . . . ,Bn ,

    where A and Bi , 1 ≤ i ≤ n, are l-atoms. We call A the head of r and {B1, . . . ,Bn}

    the body of r . We denote them by hd(r) and bd(r), respectively. An lparse program

    is a finite set of l-clauses.

    We say that a set M ⊆ At satisfies an l-clause r if M satisfies hd(r) whenever it

    satisfies each l-atom in the body of r . We say that M satisfies an lparse program

    P if M satisfies each l-clause in P . We write M |= r and M |= P in these cases,

    respectively.

    We note that lparse programs allow both negative literals and negative weights

    in l-atoms. However, in (Simons et al. 2002) it is argued that negative weights can

    be expressed using negative literals and vice versa and, hence, one is inessential

    when the other is available. In fact, in (Simons et al. 2002) an l-atom with negative

    weights is treated simply as a shorthand for the corresponding constraint with non-

    negative weights. We follow this approach here and from now on consider only

    l-atoms kWl , where W assigns non-negative weights to literals.

    Before we continue, let us define PB to be a set of all pseudo-boolean constraints

    of the form PB(k ,W ,≤), where k is a non-negative integer and W a weight function

    assigning to elements of At non-negative integers (cf. Section 2). Directly from the

    definition it follows that every constraint in PB is monotone.

    Let us consider an l-atom lW which contains no negative literals (and, as it is

    evident from the notation, no upper bound). In particular, lset(W ) = aset(W ).

    Let W ′ be an extension of W , which assigns 0 to every atom p ∈ At \ aset(W ).

    We observe that a set M ⊆ At is a model of lW if and only if M is a model of

    the PB-atom A(X ), where A = PB(l ,W ′,≤) and X = aset(W ). Therefore, we

    will regard such an l-atom lW as a PB-atom or, speaking more formally (but with

    some abuse of notation) we will denote by lW the PB-atom A(X ).

    If W = {a = 1} and l = 2, then the corresponding PB-atom is inconsistent (it

    is one of many inconsistent PB-atoms). As in the case of l-atoms, we will write I

    to denote (any) inconsistent PB-atom.

    This discussion suggests that lparse programs built of l-atoms without negative

    literals and upper bounds can be viewed as Horn PB-programs. We will exploit that

    relationship below in the definition of the reduct, and will subsequently extend it

    to all lparse programs.

    Let P be an lparse program and let M ⊆ At. An lparse-reduct of P with respect

    to M is a PB-program obtained by:

    1. eliminating from P every clause r such that M 6|= B , for at least one l-atom

    B ∈ bd(r).

    2. replacing each remaining l-clause r = kWl ← k1W1l1, . . . , knWn ln with PB-

    clauses of the form

    1{a = 1} ← k ′1W′1, . . . , k

    ′nW

    ′n ,

  • Theory and Practice of Logic Programming 23

    where a ∈ lset(W ) ∩M , W ′i is Wi restricted to lset(Wi) ∩At, and

    k ′i = ki −∑

    not(p) ∈ lset(Wi )p 6∈ M

    Wi(not(p))

    (by our comments above, expressions of the form l ′W ′ denote here PB-atoms).

    With some abuse of notation, we denote the reduct of P with respect to M by PM

    (the type of the program, an lparse program or a PB-program, determines which

    reduct we have in mind). By our comments above, PM can be regarded as a definite

    Horn PB-program. Thus, PM has a least model, lm(PM ) (Proposition 10). This

    model is the result of the canonical computation from PM with respect to M .

    Definition 9

    Let P be an lparse program. A set M ⊆ At is an lparse-stable model of P if

    M = lm(PM ) and M |= P . 2

    We will now show that all lparse programs can be viewed as PB-programs. This

    task involves two steps. First, we show how to translate lparse programs to not-free

    lparse programs so that lparse-stable models are preserved. Second, we show that

    for not-free lparse programs the two definitions of stable models presented in the

    paper (Definitions 7 and 9) are equivalent.

    An lparse program P can be translated in the following way to a not-free lparse

    program P ′, where for each l-atom kWl , aset(W ) ⊆ At. We recall that by our earlier

    comments, we need to consider only lparse programs with no negative weights. For

    each negated literal not(b) appearing in P , introduce a new propositional atom

    b̄ and an l-clause b̄ ← 0{b = 1}0. Then we replace each l-atom kWl where the

    weighted set of literals W is of the form (4) with an l-atom

    k{a1 = w1, . . . , am = wm , b̄1 = w′1, . . . , b̄n = w

    ′n}l ·

    It is straightforward to show that this transformation preserves lparse-stable

    models in the following sense.

    Proposition 11

    Let P be an lparse program, P ′ a not-free lparse program obtained by the trans-

    lation above, and B the set of new atoms introduced in the translation. Then,

    • if M is an lparse-stable model of P then M ∪{b̄ | b ∈ B \M } is a lparse-stable

    model of P ′ and• if M ′ is a lparse-stable model of P ′ then M = M ′\B is an lparse-stable model

    of P . 2

    Now we show that not-free lparse programs can be translated to PB-programs.

    To simplify the description of the encoding and make it uniform, we assume that

    all bounds are present. Let r be an l-clause

    kWl ← k1W1l1, . . . , kmWm lm ·

    We represent this l-clause by a pair of PB-clauses, e1(r) and e2(r) that we define

    as

    kW ← k1W1, . . . , kmWm ,not((l1 + 1)W1), . . . ,not((lm + 1)Wm),

  • 24 V.W. Marek, I. Niemelä and M. Truszczyński

    and

    I ← (l + 1)W , k1W1, . . . , kmWm ,not((l1 + 1)W1), . . . ,not((lm + 1)Wm),

    respectively. We recall that the symbol I , appearing in the clause e2(r), stands for

    the inconsistent PB-atom introduced above.

    Now, given a not-free lparse program P , we translate it into a PB-program

    e(P) =⋃

    r∈P

    {e1(r), e2(r)}·

    Theorem 7

    Let P be a not-free lparse program. A set M ⊆ At is an lparse-stable model of P

    if and only if M is a stable model of e(P), as defined for PB-programs.

    Proof

    In the proof we will use the notation:

    P1 =⋃{e1(r): r ∈ P} and P2 =

    ⋃{e2(r): r ∈ P}·

    Let us assume first that M is an lparse-stable model of a not-free lparse program

    P . We will show that M is a stable model of the PB-program e(P), which in our

    terminology is equal to P1 ∪ P2.

    Since M is an lparse-stable model of P , it is a model of P (Definition 9). Conse-

    quently, M is a model of P2. By Proposition 5 to complete this part of the proof, it

    suffices to show that M is a stable model of the program P1. To this end, we note

    that the definitions of the respective reducts imply that a clause

    1{a = 1} ← k1W1, . . . kmWm

    belongs to the lparse-reduct PM if and only if the reduct PM1 contains a clause

    kW ← k1W1, . . . kmWm

    such that a ∈ aset(W ) and M |= kiWi for all 1 ≤ i ≤ m.

    ¿From this relationship it follows that the results of the canonical computations

    from PM and PM1 with respect to M coincide (we recall that both reducts are Horn

    PB-programs). Since M is the least model of PM , it is the result of the canonical

    computation from PM with respect to M . Thus, M is also the result of the canonical

    computation from PM1 with respect to M . In other words, M is a derivable model

    of P1 and, consequently, a stable model of P1.

    Conversely, let us assume that M is a stable model of P1 ∪P2. It follows that M

    is a model of P1 ∪P2 and, consequently, a model of P . Next, we note that since M

    is a stable model of P1 ∪ P2, it is a stable model of P1 (by Proposition 5). Thus,

    it is a derivable model of its reduct PM1 and, therefore, it is also the result of the

    canonical computation from PM1 with respect to M . Our observation about the

    relationship between the reducts PM1 of and PM holds now, as well. Consequently,

    M is the result of the canonical computation from PM with respect to M . Thus,

    M is a derivable model of PM . Since PM is a definite Horn PB-program, it has

    only one derivable model — its least model. It follows that M is the least model of

    PM and, consequently, an lparse-stable model of P .

  • Theory and Practice of Logic Programming 25

    Theorem 7 shows that PB-programs can express arbitrary not-free lparse pro-

    grams with only linear growth in the size of the program. The converse relationship

    holds, too: not-free lparse programs can represent arbitrary PB-programs without

    increasing the size of the representation. Let r be a PB-clause

    kW ← k1W1, . . . , kmWm ,not(l1V1), . . . ,not(lnVn)·

    We define f (r) as follows. If there is i , 1 ≤ i ≤ n, such that li = 0, we set

    f (r) = kW ← kW (in fact any tautology would do). Otherwise, we set

    f (r) = kW ← k1W1, . . . , kmWm , 0V1(l1 − 1), . . . , 0Vn(ln − 1)·

    Given a PB-program P , we define f (P) = {f (r): r ∈ P}.

    Theorem 8

    Let P be a PB-program. A set of atoms M is a stable model of P (as defined for

    PB-programs) if and only if M is an lparse-stable model of f (P).

    Proof

    First, we observe that P and f (P) have the same models. Next, similarly as before,

    we have that the lparse-reduct [f (P)]M contains a clause

    1{a = 1} ← k1W1, . . . kmWm , 0V1, . . . , 0Vn

    if and only if PM contains a clause of the form

    kW ← k1W1, . . . kmWm

    such that a ∈ aset(W ) and M |= kiWi for all 1 ≤ i ≤ m. Since in the clauses

    of the first type l-atoms Vi are always true, as before, the results of the canonical

    computations from PM and [f (P)]M with respect to M of P coincide (we recall

    that both reducts are Horn PB-programs). Using this observation one can complete

    the proof by reasoning as in the previous proof.

    Theorems 7 and 8 establish the equivalence of not-free lparse programs and PB-

    programs with respect to the stable model semantics. The translations e and f

    also preserve models. The equivalence between not-free lparse programs and PB-

    programs extends to supported models under the following concept of supportedness

    for lparse-programs.

    Definition 10

    Let P be a not-free lparse program. A set of atoms M is a supported model of P if

    M is a model of P and if for every atom a ∈ M there is an l-clause A← B1, . . . ,Bnin P such that a ∈ aset(A) and M |= Bi , 1 ≤ i ≤ n.

    Indeed, we have the following two theorems (we only sketch a proof of one of

    them; the proof of the other one is similar).

    Theorem 9

    Let P be a not-free lparse program. A set M ⊆ At is an lparse-supported model of

    P if and only if M is a supported model of e(P), as defined for PB-programs.

  • 26 V.W. Marek, I. Niemelä and M. Truszczyński

    Proof

    Let us denote Q = e(P). Let M be an lparse-supported model of P . We will show

    that M is a supported model of Q . By our earlier observations, P and Q have the

    same models. Thus, M is a model of Q . To complete the argument, we need to

    show that M ⊆ hset(Q(M )). Let a ∈ M . Since M is an lparse-supported model

    of P , there is an l-clause r ∈ P such that r = A ← B1, . . . ,Bn , a ∈ aset(A) and

    M |= Bi for every i , 1 ≤ i ≤ n. It follows that a ∈ aset(hd(e1(r))) and that

    M |= bd(e1(r)). Since e1(r) ∈ Q , e1(r) ∈ Q(M ). Thus, a ∈ hset(Q(M )). It follows

    that M ⊆ hset(Q(M )) and so M is a supported model of Q .

    Conversely, let us assume that M is a supported model of Q . Then M is a model

    of Q and so M is a model of P , as well. Let a ∈ M . It follows that a ∈ hset(Q(M )).

    Since each clause of the form e2(r) (r ∈ P) is a constraint, there is an l-clause r ∈ P

    such that clause e1(r) ∈ Q such that M |= bd(e1(r)) and a ∈ hset(hd(e1(r))). Let

    r = A ← B1, . . . ,Bn . It follows that a ∈ aset(A) and that M |= Bi , 1 ≤ i ≤ n.

    Thus, M is an lparse-supported model of P .

    Theorem 10

    Let P be a PB-program. A set of atoms M is a stable model of P (as defined for

    PB-programs) if and only if M is an lparse-stable model of f (P).

    It follows from the results in this section that the translations e and f uniformly

    preserve basic semantics of not-free lparse and PB-programs, and allow us to view

    not-free lparse programs as PB-programs and vice versa.

    We also note that this equivalence demonstrates that lparse programs with the

    semantics of stable models as defined in (Niemelä et al. 1999) can be viewed as

    a generalization of normal logic programming. It follows from Theorems 6 and 8

    that the encoding of normal logic programs as lparse programs, defined as the

    composition of the translation P 7→ Ppb described in Section 8 (we note that

    the constraint PB belongs to the class PB) and the translation f , preserves the

    semantics of models, supported models and stable models (an alternative proof of

    this fact, restricted to the case of stable models was first given in (Simons et al. 2002)

    and served as a motivation for the class of lparse programs and its stable-model

    semantics). This result is important, as it is not at all evident that the reduct used

    in (Simons et al. 2002), leads to fixpoints that generalize the semantics of stable

    models as defined in (Gelfond and Lifschitz 1988).

    Given that the formalisms of not-free lparse and PB-programs are equivalent,

    it is important to stress what differentiates them. The advantage of the formalism

    of not-free lparse programs is that it does not require the negation operator in

    the language. The strength of the formalism of PB-programs lies in the fact that

    its syntax so closely resembles that of normal logic programs, and that the devel-

    opment of the theory of PB-programs so closely follows that of the normal logic

    programming.

  • Theory and Practice of Logic Programming 27

    10 Monotone F-programs and disjunctive logic programs

    (Sakama and Inoue 1994) introduced and investigated a semantics of possible mod-

    els of disjunctive logic programs. It turns out that this semantics is different from

    the semantics proposed by Minker (Minker 1982) and from that of Gelfond and

    Lifschitz (Gelfond and Lifschitz 1991; Przymusinski 1991). In this section, we will

    show that the formalism of monotone F-programs generalizes the semantics of

    possible models. For the purpose of our discussion, we will extend the use of the

    terms head, body, M -applicability, and notation PM , hd(r), bd(r) to the case of

    disjunctive programs.

    Definition 11

    (Sakama and Inoue 1994) Let P be a disjunctive logic program. A split program

    for P is any normal logic program that can be obtained by the following procedure.

    First, we select for each clause r in P , a set Sr ⊆ hd(r). Next, we replace r with

    clauses of the form A ← body, where A ∈ Sr , if Sr 6= ∅, and with the (constraint)

    clause ← bd(r), if Sr = ∅.

    A set M of atoms is a possible model of P if M is a stable model (in the sense of

    Gelfond and Lifschitz (Gelfond and Lifschitz 1988)) of a split program for P . 2

    We point out that we allow for disjunctive clauses to have empty heads (that is,

    we allow constraint clauses). We also allow that sets Sr be empty. Consequently,

    split programs may contain constraints even if the original program does not.

    Example 6

    Let P be the disjunctive program:

    P = {a ∨ b ∨ c ←, a ∨ c ← not(b), b ← not(c), c ← not(a)}·

    Then, the program Q :

    Q = {a ←, a ← not(b), c ← not(b), b ← not(c), ← not(a)}·

    is an example of a split program for P (given by the following subsets of the sets of

    atoms in the heads of the clauses: {a}, {a, c}, {b} and ∅, respectively). Moreover,

    since {a, b} is a stable model of Q , {a, b} is a possible model of P . 2

    If M is a model of a disjunctive program P , by s(P ,M ) we denote the split

    program of P determined by sets Sr = M ∩ hd(r). We have the following simple

    characterization of possible models.

    Proposition 12

    Let P be a disjunctive program. A set of atoms M is a possible model of P if and

    only if M is a stable model of the split program s(P ,M ).

    Proof

    If M is a possible model of P , then M is a stable model of a split program of P ,

    say Q . Let us assume that Q is determined by sets Sr ⊆ hd(r), where r ∈ P .

    For every clause r ∈ P , if r is M -applicable then all clauses it contributes to Q

  • 28 V.W. Marek, I. Niemelä and M. Truszczyński

    are M -applicable, too, as they have the same body as r . Since M is a model of Q

    (being a stable model of Q), we obtain that Sr ⊆ M . Thus, Q(M ) ⊆ s(P ,M ).

    Directly from the definition of s(P ,M ) we obtain that M is a model of s(P ,M ).

    Thus, M is a model of [s(P ,M )]M and, consequently, lm([s(P ,M )]M ) exists. More-

    over, it follows that lm([s(P ,M )]M ) ⊆ M (indeed, all non-constraint clauses in

    s(P ,M ) have heads from M ).

    Since M is a stable model of Q , M = lm(QM ). Thus, it follows that M =

    lm([Q(M )]M ) and so, we obtain:

    M = lm([Q(M )]M ) ⊆ lm([s(P ,M )]M ) ⊆ M ·

    Thus, lm([s(P ,M )]M ) = M or, in other words, M is a stable model of s(P ,M ).

    The converse implication follows by the definition.

    Let r be a disjunctive logic program clause of the form:

    c1 ∨ . . . ∨ ck ← a1, . . . , am ,not(b1), . . . ,not(bn),

    where all ai , bi and ci are atoms. We encode this clause as a program clause with

    cardinality atoms:

    rca = 1{c1, . . . , ck} ← 1{a1}, . . . , 1{am},not(1{b1}), . . . ,not(1{bn})·

    (If all ai and bi are distinct, the following translation could be used instead:

    1{c1, . . . , ck} ← m{a1, . . . , am},not(1{b1, . . . , bn}).) We note that if k = 0, that

    is, the head of r is empty, the rule rca has the constraint 1∅ in the head, which is

    inconsistent. In this case, rca is a constraint clause.

    For a disjunctive logic program P , we define Pca = {rca : r ∈ P} (ca in the sub-

    script stands for “cardinality atoms”). Since cardinality constraints are monotone,

    the concept of a stable model of the program Pca is well defined. We have the

    following theorem.

    Theorem 11

    Let P be a disjunctive logic program. A set of atoms M is a possible model of P

    if and only if M is a stable model of the program Pca (in the sense, we defined in

    this paper).

    Proof

    We first note that [s(P ,M )]M = s(PM ,M ). Thus, by Proposition 12, it follows

    that M is a possible model of P if and only if M is a least model of s(PM ,M ). We

    also note that [Pca ]M = [PM ]ca . Thus, M is a stable model of Pca if and only if

    M is a derivable model of [PM ]ca .

    It follows that in order to prove the assertion it suffices to show that for every

    positive (no negation in the bodies of clauses) disjunctive program P , M is a least

    model of s(P ,M ) if and only if M is a derivable model of Pca . We will now prove

    this claim. To simplify notation, we will write Q instead of Pca .

    First, we note P and Q have the same models. Thus, each side of the equivalence

    implies that M is a model of Q . In particular, it follows (no matter which implication

  • Theory and Practice of Logic Programming 29

    we are proving) that Q has a canonical computation tQ,M = (XQ,Mn )n=0,1,.... Next,

    we observe that for every X ⊆ M , the definitions of Q and s(P ,M ) imply that

    hset(Q(X )) ∩M = hd(s(P ,M )(X )) = Ts(P,M )(X )·

    In particular, since XQ,Mn+1 = hset(Q(XQ,Mn )) ∩M , for every n = 0, 1, . . ., we have

    XQ,Mn+1 = Ts(P,M )(X

    Q,Mn )·

    These identities imply that the result of the canonical Q-computation for M and

    the least model of s(P ,M ) coincide. Consequently, M is a derivable model of Q if

    and only if M is a least model of s(P ,M ) as claimed.

    11 Discussion

    In the paper, we introduced and studied the formalism of F-programs. When all

    constraints in F are monotone, this formalism offers an abstract framework for

    integrating constraints into logic programming. It exploits and builds on analogies

    with normal logic programming. Most concepts and techniques for monotone F-

    programs are closely patterned after their counterparts developed there and so,

    normal logic programming can be viewed as a fragment of the theory of monotone

    F-programs. Importantly, the same is the case for other nonmonotonic systems

    namely, the disjunctive logic programming with the possible-model semantics of

    (Sakama and Inoue 1994), and for the formalism of logic programs with weight

    constraints (Simons et al. 2002). For these two formalisms, monotone F-programs

    help to explain the nature of their relationship with normal logic programming,

    hidden by their original definitions.

    In this paper, we developed the foundation for the theory of monotone F-programs.

    Recently, the theory of monotone F-programs was developed further. (Liu and

    Truszczyński 2005b) demonstrated that Fages lemma (Fages 1994), and the con-

    cepts of the program completion and a loop formula extend to the setting of mono-

    tone F-programs. The latter two properties allow one to reduce stable-model com-

    putation for programs with weight constraints to the problem of computing models

    of propositional theories extended with weight atoms (referred to as pseudo-boolean

    constraints in the satisfiability community). (Liu and Truszczyński 2005a) exploited

    this reduction and developed an algorithm to compute stable models of programs

    with weight constraints by using off-the-shelf solvers of pseudo-boolean constraints

    such as those described in (Barth 1995; Walser 1997; Aloul et al. 2002; Liu and

    Truszczyński 2003; East and Truszczyński 2004).

    There are strong analogies between the approach we propose and develop here

    and some of the techniques discussed in (Sakama and Inoue 1994) in the context of

    disjunctive programs with the semantics of possible models. One way to look at the

    results of our paper is that it extends the way (Sakama and Inoue 1994) handles

    nondeterminism, inherent in disjunctive logic programs, to the abstract setting of

    monotone F-programs. In particular, (Sakama and Inoue 1994) presents a compu-

    tational procedure for disjunctive programs without negation, which can be shown

    to be closely related to our notion of a P -computation. That paper also introduces

  • 30 V.W. Marek, I. Niemelä and M. Truszczyński

    a nondeterministic provability operator, defined for positive disjunctive programs.

    Three aspects differentiate our work from (Sakama and Inoue 1994). Most impor-

    tantly, we study here a much broader class of programs than disjunctive ones.

    Secondly, we define a provability operator on the class of all monotone F-programs

    and not just positive ones. Finally, we consistently exploit properties of this op-

    erator, and align our approach with the standard operator-based development of

    normal logic programming (Apt 1990; Fitting 2002).

    The emergence of a nondeterministic one-step provability operator warrants ad-

    ditional comments. Nondeterministic provability operators were considered before

    in the context of logic programming. We already noted that (Sakama and Inoue

    1994) proposed a provability operator similar to the one we introduced here (al-

    though only for the class of positive disjunctive programs). (Sakama and Inoue 1995)

    proposed another operator designed to capture a different computational process

    arising in the context of paraconsistent systems. Finally, (Pelov and Truszczynski.

    2004) presented a characterization of answer sets of disjunctive logic programs in

    terms of yet another nondeterministic provability operator. However, the operator

    we proposed here exhibits the closest parallels with the van Emden-Kowalski oper-

    ator and opens up a possibility of generalizing the approximation theory proposed

    in (Denecker et al. 2000) to the case of monotone F-programs. However, for that

    to happen, one will need techniques for handling nondeterministic operators on lat-

    tices, similar to those presented for the deterministic operators in (Denecker et al.

    2000; Denecker et al. 2004). Developing such techniques is an open problem.

    Acknowledgments

    The authors wish to thank the anonymous reviewers for their detailed comments

    and suggestions, which helped improve the paper. The second author was supported

    by the Academy of Finland grant 211025. The other two authors were supported

    by the NSF grants IIS-0097278 and IIS-0325063.

    References

    Aloul, F., Ramani, A., Markov, I., and Sakallah, K. 2002. PBS: a backtrack-search pseudo-boolean solver and optimizer. In Proceedings of the 5th InternationalSymposium on Theory and Applications of Satisfiability, (SAT-02). 346 – 353.

    Apt, K. 1990. Logic programming. In Handbook of theoretical computer science, J. vanLeeuven, Ed. Elsevier, 493–574.

    Babovich, Y. and Lifschitz, V. 2002. Cmodels package. http://www.cs.utexas.edu/users/tag/cmodels.html.

    Baral, C. 2003. Knowledge representation, reasoning and declarative problem solving.Cambridge University Press.

    Barth, P. 1995. A Davis-Putnam based elimination algorithm for linear pseudo-booleanoptimization. Tech. Rep., Max-Planck-Institut für Informatik. MPI-I-95-2-003.

    Calimeri, F., Faber, W., Leone, N., and Perri, S. Declarative and ComputationalProperties of Logic Programs with Aggregates. In Proceedings of the 19th InternationalJoint Conference on Artificial Intelligence (IJCAI-05), 406–411.

  • Theory and Practice of Logic Programming 31

    Clark, K. 1978. Negation as failure. In Logic and data bases, H. Gallaire and J. Minker,Eds. Plenum Press, 293–322.

    Dell’Armi, T., Faber, W., Ielpa, G., Leone, N., and Pfeifer, G. 2003. Aggregatefunctions in disjunctive logic programming: semantics, complexity, and implementationin DLV. In Proceedings of the 18th International Joint Conference on Artificial Intelli-gence (IJCAI-2003). Morgan Kaufmann, 847–852.

    Denecker, M., Marek, V., and Truszczyński, M. 2000. Approximations, stable opera-tors, well-founded fixpoints and applications in nonmonotonic reasoning. In Logic-BasedArtific