Hitori Solution
Hitori Solution
Hitori Solution
by
Paolo Ferraris
2007
The Dissertation Committee for Paolo Ferraris
certifies that this is the approved version of the following dissertation:
Committee:
Anna Gál
Nicola Leone
Vijaya Ramachandran
Expressiveness of Answer Set Languages
by
Dissertation
in Partial Fulfillment
of the Requirements
Doctor of Philosophy
August 2007
To my Parents
Acknowledgments
Studying for a PhD — and finally achieving it — has been a wonderful experience. I
am usually not good at expressing gratitude, but I do really need to thank Vladimir
Lifschitz for his advising, for his encouragements in starting this “adventure”, and
for the freedom that he left me in doing the research that I wanted.
The experience of living for six years in another country is something that
can be hardly described. Beside the initial difficulties, what you learn by living in a
different environment, with different rules and different culture is priceless. This is
especially true in a multi-cultural country such as the United States, and especially
in a university with people from all parts of the world. The city of Austin has been
a wonderful place to live, and I will miss it.
I need to thank some other people for my choice of studying in the United
States. First of all, my Laurea Thesis supervisor Enrico Giunchiglia, who introduced
me to research and who was the first of suggesting me the idea of a PhD in the
United States. Professor Massimo Ancona, coach of the University of Genova for
the ACM programming contests, also supported me in this choice. But the person
who convinced me was Vittorio Badalassi, a friend from high school, with his stories
as a PhD student in Santa Barbara, CA.
I need to thank all the people I did research with in these six years. Be-
side Vladimir Lifschitz, they are Yuliya Babovich/Lierler, Pedro Cabalar, Semra
Doğandağ, Esra Erdem, Selim Erdoğan, Joohyung Lee and Wanwan Ren. With
v
most of them I also shared the life as a PhD student, with its highs and lows.
Participating in the world finals of the ACM programming contest has been a
great and rewarding experience. This was possible only by having smart teammates
such as Brian Peters, Andrew Hudson and Jeffrey Yasskin and great coaches such
as Jean-Philippe “JP” Martin and Douglas Van Wieren. Thanks also go to the
participants from other teams, who also helped us preparing for the contests.
I want to say Ciao to all the people that I have met at La Dolce Vita on
Thursday nights. You are too many to be listed here, but I’d like to remember,
in particular, our “presidentessa” Sylvia Leon Guerrero, Anthony Palomba, Paolo
Bientinesi and Stefano e Chiara Masini.
I want to spend a few words to my Italian friends. Life evolves and priorities
change. And distance makes things more difficult. I am really happy to know that I
still have friends in Italy: (in no particular order) Manuela Marconi, Renato Cattani,
Marco Lauciello, Chiara Iperti, Chiara Tixi, Paolo Predonzani, Tiziana Parodi and
other people still in email contact and others that I may forget right now. Thanks
a lot.
Le mie ultime parole — le più importanti, in italiano — le ho riservate ai miei
genitori. Mi hanno sempre supportato nelle mie scelte, anche in una scelta difficile
— soprattutto per loro — come quella di vivere a più di 8000 chilometri di distanza
da loro. Molti miei amici hanno avuto le loro aspirazioni frenate dall’inconscio
“egoismo” dei propri genitori, ma questo non e‘ stato il mio caso. Se ho ottenuto
questo risultato è anche per merito loro. Non ci sono e non ci saranno mai parole
sufficienti per esprimere la mia gratitudine.
(I have reserved the last words — the most important ones, in Italian — to
my parents. They always supported me in my choices, even in a difficult choice —
especially for them — such as living 5000+ miles away from them. Several friends
of mine had their aspirations blocked by the unconscious “egoism” of their parents,
vi
but this was not my case. I have achieved this result also because of them. There
aren’t and there will never be words that are sufficient to express my gratitude.)
Paolo Ferraris
vii
Expressiveness of Answer Set Languages
Publication No.
viii
our syntax allows constructs defined in many other extensions of the answer sets
semantics. This fact, together with (iii), allows us to study the expressiveness of
those constructs. We also compare the answer set semantics with another important
formalism developed by Norm McCain and Hudson Turner, called causal logic.
ix
Table of Contents
Acknowledgments v
Abstract viii
List of Figures xv
Chapter 1 Introduction 1
Chapter 2 History 6
2.1 The Origins of Answer Set Programming . . . . . . . . . . . . . . . . 6
2.1.1 The Answer Set Semantics for Traditional Programs . . . . . 6
2.1.2 Relationship with Prolog . . . . . . . . . . . . . . . . . . . . 8
2.1.3 The Answer Set Programming Paradigm . . . . . . . . . . . . 8
2.2 Extensions to the Traditional Syntax . . . . . . . . . . . . . . . . . . 14
2.2.1 Propositional Extensions . . . . . . . . . . . . . . . . . . . . . 15
2.2.2 Programs with Weight Constraints . . . . . . . . . . . . . . . 17
2.2.3 Aggregates . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.3 Strong Equivalence . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Chapter 3 Background 23
3.1 Semantics of Programs with Nested Expressions . . . . . . . . . . . . 23
3.2 Semantics of Programs with Weight Constraints . . . . . . . . . . . 25
x
3.3 PDB-aggregates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.4 FLP-aggregates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.5 Logic of Here-and-There . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.6 Equilibrium Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.7 Proving Strong Equivalence . . . . . . . . . . . . . . . . . . . . . . . 37
xi
6.2 Relationship to equilibrium logic and to the traditional definition of
reduct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
6.3 Properties of propositional theories . . . . . . . . . . . . . . . . . . . 86
6.4 Computational complexity . . . . . . . . . . . . . . . . . . . . . . . . 88
6.5 Proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
6.5.1 Proofs of Theorem 4 and Proposition 7 . . . . . . . . . . . . 89
6.5.2 Proofs of Propositions 8–10 . . . . . . . . . . . . . . . . . . . 91
6.5.3 Proofs of Propositions 11 and 13 . . . . . . . . . . . . . . . . 94
6.5.4 Proof of Proposition 12 . . . . . . . . . . . . . . . . . . . . . 97
6.5.5 Proof of Proposition 14 . . . . . . . . . . . . . . . . . . . . . 100
xii
Chapter 8 Modular Translations and Strong Equivalence 127
8.1 Modular Transformations and Strong Equivalence . . . . . . . . . . 130
8.2 Applications: Negational Disjunctive Rules . . . . . . . . . . . . . . 132
8.3 Applications: Cardinality Constraints . . . . . . . . . . . . . . . . . 134
8.4 Proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
8.4.1 Properties of Strong Equivalence . . . . . . . . . . . . . . . . 136
8.4.2 Proof of Theorem 7 . . . . . . . . . . . . . . . . . . . . . . . 137
8.4.3 Proofs of Propositions 21 and 22 . . . . . . . . . . . . . . . . 140
8.4.4 Proof of Theorem 8 . . . . . . . . . . . . . . . . . . . . . . . 141
8.4.5 Definition of a Tight Program . . . . . . . . . . . . . . . . . . 142
8.4.6 Proofs of Propositions 23 and 24 . . . . . . . . . . . . . . . . 143
8.4.7 Proofs of Propositions 25–27 . . . . . . . . . . . . . . . . . . 144
xiii
9.10.2 Proof of Theorem 10 . . . . . . . . . . . . . . . . . . . . . . . 175
9.10.3 Proof of Proposition 28 . . . . . . . . . . . . . . . . . . . . . 177
9.10.4 Proof of Theorems 11 and 12 . . . . . . . . . . . . . . . . . . 178
9.10.5 Proof of Theorem 13 . . . . . . . . . . . . . . . . . . . . . . . 186
Bibliography 190
Vita 202
xiv
List of Figures
xv
9.2 Robby’s apartment is a 3 × 3 grid, with a door between every pair of
adjacent rooms. Initially Robby is in the middle, and all doors are
locked. The goal of making every room accessible from every other
can be achieved by unlocking 8 doors, and the robot will have to move
to other rooms in the process. . . . . . . . . . . . . . . . . . . . . . . 158
9.3 Two gears domain. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
9.4 Translation of the two gears domain. . . . . . . . . . . . . . . . . . . 160
xvi
Chapter 1
Introduction
1
traditional programs (1988)
extensions with aggregates
PDB−aggregates (2003)
"propositional" extensions
FLP−aggregates (2004)
more and more similar to arbitrary propositional formulas. To a large degree, this
was motivated by the desire to make the syntax of logic programs more uniform and
elegant. On the right side, we see the introduction of the concept of an aggregate in
logic programs. Aggregates are motivated by applications of ASP. They allow us, for
instance, to talk about the number of atoms in a set that are true. In the figure, we
mention three proposals of this kind that have been at least partially implemented.
The four definitions differ from each other both syntactically and semantically. One
reason for that is the lack of a common understanding of what an aggregate should
be.
Part of this dissertation is devoted to comparing programs with weight con-
straints with the formalisms on the left side of Fig 1.1. The fact that this is possible
is not surprising as, in case of PDB-aggregates, a relationship is well-known: the
semantics of programs with PDB-aggregates is defined in terms of a translation into
traditional programs.
First of all, we will show that weight constraints can be seen as abbreviations
for nested expressions. Our theorem shows that if we replace, in any program with
weight constraints, each weight constraint with a corresponding nested expression,
2
we obtain a program with nested expressions that has exactly the same answer sets
of the original program. This also allows us to study properties of programs with
weight constraints (such as strong equivalence, reviewed later in this introduction)
using mathematical tools developed for programs with nested expressions.
We will also show how to rewrite a program with weight constraints as a
traditional program. This procedure is similar to the procedure used in polynomial
time clausifications of propositional formulas; the “signature” of the language is
extended, the answer sets of the output program may contain auxiliary atoms,
and the translation can be computed in polynomial-time in most cases of practical
interest. Finally, we show that this conversion can always be done polynomially, by
a more complicated procedure.
We will prove that nested expressions are not expressive enough to represent
FLP-aggregates. In fact, it is generally not possible to replace FLP-aggregates with
nested expressions without changing the answer sets, as we did for programs with
weight constraints. This fact led us to extend the syntax of programs with nested
expressions.
We will define the concept of an answer set for a “propositional theory”.
Syntactically, we discarded the idea that a “program” consists of “rules”, by allowing
arbitrary “propositional formulas” in it. We also propose a new definition of an
aggregate inside propositional formulas. (The picture of the evolution of answer
set semantics can be updated as in Figure 1.2.) For it we propose two equivalent
semantics: one of them considers an aggregate as a primitive construct of the syntax,
and the other as an abbreviation for a propositional formula. The first semantics is
important computational-wise, the second because there are several theorems about
propositional formulas that can be used for formulas with aggregates as well (see
below). The new definition of an aggregate is more general than the definition of
weight constraints and of PDB- and FLP-aggregates. This, for instance, allows us to
3
traditional programs (1988)
extensions with aggregates
PDB−aggregates (2003)
propositional theories FLP−aggregates (2004)
see under what conditions a weight constraint and an FLP-aggregate with the same
intuitive meaning are actually equivalent to each other. Moreover, our definition of
an aggregate seems to have the most intuitively correct properties.
Our definition of an answer set for propositional theories has other interesting
properties. For instance, it is closely related to another formalism called equilib-
rium logic [Pearce, 1997]. This allows us to apply mathematical theorems about
equilibrium logic to propositional theories and vice versa.
An important concept in the theory of logic programs is strong equivalence.
Two logic programs are said to be strongly equivalent if they have the same answer
sets even after we append any third logic program to both of them [Lifschitz et al.,
2001]. Strong equivalence between propositional theories can be defined similarly.
We propose a method to check strong equivalence between propositional theories,
similar to the one from [Turner, 2003] for logic programs, but simpler. We will extend
other important theorems about programs with nested expressions to propositional
theories as well.
We will also show that strong equivalence plays an important role if we
4
want to translate logic programs (or propositional theories) in one language into
another, in a modular way (i.e., so that each rule/formula in the first language is
independently replaced by a set of rules/formulas in the second language). In fact, it
turns out that in most cases a transformation of this kind is guaranteed to preserve
the answer sets if and only if each rule/formula is replaced by a strongly equivalent
set of rules/formulas. We will use this fact to compare the expressiveness — in terms
of modular translations — of some of the languages of Figure 1.1 and some of their
subclasses, verifying if strongly equivalent transformations exist between them. As
there are ways to check strong equivalence, we will use the above property to study
the expressiveness of languages in terms of the presence of modular transformations.
Finally, we compare the expressiveness of answer set languages with another
important formalism: causal logic [McCain and Turner, 1997], [Giunchiglia et al.,
2004a] . Causal logic defines the models of “causal theories”, and has been used to
encode several domains involving actions and their effects. A method of translating
causal theories into logic programs was known for causal theories of a very simple
form. We show how we can translate every causal theory into a logic program that
is not much larger that the original causal theory.
After a historical overview in Chapter 2 and the necessary background infor-
mation in Chapter 3, Chapters 4 and 5 describe how we can translate programs with
weight constraints into programs with nested expressions and traditional programs,
respectively.
Next we discuss the definition of an answer set for propositional theories (Chap-
ter 6), how we can represent aggregates under this new syntax, and the relationship
with FLP-aggregates (Chapter 7).
Finally, in Chapter 8 we investigate modular translations between logic pro-
grams and the relationship with strong equivalence, and in Chapter 9 we show how
we can translate causal theories into logic programs.
5
Chapter 2
History
The answer set (stable model) semantics was defined in [Gelfond and Lifschitz, 1988]
for logic programs with rules of the form
A0 ← A1 , . . . , Am (2.2)
6
(such programs are called positive). We say that a set X of atoms is closed under a
positive program Π if, for each rule (2.2) in Π, A0 ∈ X whenever A1 , . . . , Am ∈ X.
It is easy to see that there is a unique minimal set of atoms closed under Π. That
is, there is exactly one set X of atoms such that
This set is defined to be the only answer set for Π. The definition resembles the
semantics for positive programs given in [van Emden and Kowalski, 1976].
To define the answer sets for a generic traditional program Π, we first define
a positive program ΠX , called the reduct of Π relative to a set of atoms X: ΠX is
obtained from Π by dropping
• the part not Am+1 , . . . , not An from every other rule (2.1).
p ← not q
(2.3)
q ← not r
relative to {q} is
q (2.4)
A set X of atoms is an answer set for Π if X is the answer set for ΠX . For instance,
{q} is an answer set for program (2.3), because {q} is an answer set for (2.4). It is
easy to check that no other set of atoms is an answer set for (2.3).
From the point of view of computational complexity, the problem of the
existence of an answer set for a traditional logic program is NP-complete [Marek
and Truszczyński, 1991].
7
Set of rules are often described by “schematic rules” that involve variables.
Each schematic rule can be seen as an abbreviation for rules without variables, ob-
tained by replacing each variable with one of the constants occurring in the program.
This process is called grounding. For instance, the expression
p(X) ← q(X)
q(a) (2.5)
r(b)
The answer set semantics was originally proposed as a semantics for Prolog. A well-
written (unambiguous and consistent) Prolog program has — after grounding — a
unique answer set. This answer set is the collection of all atoms that are answered
“yes” by Prolog queries. For instance, if we write (2.5) as a Prolog program, the
only atoms that are answered “yes” in queries are p(a), q(a) and r(b); these are the
three atoms in the only answer set for (2.6).
The answer set programming paradigm was proposed in [Marek and Truszczyński,
1999] and [Niemelä, 1999]. A combinatorial search problem is encoded in a logic
program so that the program’s answer sets are the solutions of the problem. An
example of a puzzle game that can be solved using answer set programming is hitori.
8
Figure 2.1: An hitori puzzle and its solution
• among uncancelled cells, the same number cannot occur twice in the same row
or column; (for instance, in Figure 2.1, a 4 and a 3 had to be cancelled from
the first column)
• there cannot be two horizontal or vertical adjacent cells both canceled; (for
instance, we cannot cancel out both cells (1,1) and (1,2))
• all undarkened cells are connected to each other, through horizontal and ver-
tical connections.
9
1 {dark(X, Y )} ← a(X, Y, V )
2 ← dark(X, Y ), dark(X, Y + 1)
3 ← dark(X + 1, Y ), dark(X, Y )
10
The first line is called a “choice rule”: it says that, for each cell (X, Y ), we
can either choose that dark(X, Y ) holds or not. More precisely, if n is the number
of cells, it generates 2n candidate answer sets, each of them containing a different
collection of atoms of the form dark(X, Y ). Each of those “candidate” answer sets
corresponds to a set of darkened cells. The goal of the remaining lines is to remove
the answer sets that do not satisfy the three conditions in the definition of a valid
hitori puzzle solution.
Line 2 is an example of a “constraint” 1 . It tells us that dark(X, Y ) and
dark(X, Y + 1) cannot both belong to an answer set. That is, two horizontally
adjacent cells cannot be both darkened. Similarly, line 3 expresses the same concept
for vertically adjacent cells. Lines 4 and 5 prohibits that two undarkened cells on
the same column or row contain the same value.
To encode the last condition on a hitori puzzle solution — that all undarkened
cells are connected — we introduce, in our program, a predicate expressing that two
undarkened cells (X, Y ) and (X1 , Y1 ) are connected. We define this concept using
atoms of the form conn(X, Y, X1 , Y1 ), by the following recursive definition:
Finally, line 11 imposes the condition that every two undarkened cells are connected
to each other.
By merging the 11 lines above with any puzzle description as in Figure 2.2,
we get a program whose answer sets is in a 1–1 correspondence to a solution to
the puzzle. Indeed, each solution of the puzzle corresponds to the answer set that
contains an atom of the form dark(X, Y ) iff (X, Y ) is a darkened cell.
1
Not to be confused with cardinality or weight constraints.
11
We can notice that, unlike most other programming languages (including
Prolog and many implementations of constraint programming), answer set program-
ming is completely declarative: in particular, the order of rules in a program and the
order of elements in the body of each rule are completely irrelevant. Moreover, the
semantics is well-defined and simple; this makes it easier to develop mathematical
tools for proving the correctness of a logic program. Some of the tools discussed in
this dissertation are strong equivalence and the splitting set theorem.
Answer set programming is possible because there are systems, called answer
set solvers, that compute the answer sets of logic programs. An incomplete list of
the currently developed answer set solvers is
12
Answer set programming is similar to the use of satisfiability to solve combi-
natorial search problems: in that approach, a problem is first encoded as a propo-
sitional formula whose models (interpretations that satisfy the formula) correspond
to the solutions of the problem ([Kautz and Selman, 1992]). Then a satisfiability
solver is used to find such models. Both formalisms are declarative, and answer sets
can be seen as truth assignments to atoms just like models in propositional logic.
Moreover, the computational mechanism of answer set solvers doesn’t rely on the
definition of an answer set directly but it is similar to the one used in satisfiability
solvers.
On the other hand, answer set programming is different from satisfiability in
a number of ways.
• The language of answer set programming allows the use of variables. The
language accepted by satisfiability solvers (propositional formulas, usually
clauses) doesn’t allow variables, and higher level languages that can express
variables are generally domain-dependent and not compatible with each other.
• We can easily express recursive definitions, such as the one of conn in the
hitori example, in answer set programming. Recursive definitions are usually
difficult to express in other formalisms. For instance, it is commonly believed
the definition of conn in Figure 2.3 can be expressed in classical propositional
logic — in view of [Spira, 1971], under some commonly believed conjecture
in computational complexity, and without the use of auxiliary atoms — only
with an exponentially large formula. On the other hand, after the elimination
of variables, lines 6-10 of Figure 2.3 turn into a polynomially large set of rules.
13
normally closed, or that a piece on a chess-board remains in the same position
unless it moves or its position is taken by an opponent piece. Those concepts
are important, for instance, in commonsense reasoning and in planning.
Answer set programming has been used to solve combinatorial search prob-
lems in various fields, such as planning 10 [Dimopoulos et al., 1997; Lifschitz, 1999],
diagnosis [Eiter et al., 1999; Gelfond and Galloway, 2001], model checking [Liu
et al., 1998; Heljanko and Niemelä, 2001], reachability analysis [Heljanko, 1999],
product configuration [Soininen and Niemelä, 1998], dynamic constraint satisfac-
tion [Soininen et al., 1999], logical cryptanalysis [Hietalahti et al., 2000], network
inhibition analysis [Aura et al., 2000], workflow specification [Trajcevski et al., 2000;
Koksal et al., 2001], learning [Sakama, 2001], reasoning about policies [Son and Lobo,
2001], circuit design [Balduccini et al., 2000; Balduccini et al., 2001], wire routing
problems [Erdem et al., 2000], phylogeny reconstruction problems [Erdem et al.,
2003], query answering [Baral et al., 2004], puzzle generation [Truszczynski et al.,
2006], data mining [Ruffolo et al., 2006] and spacial reasoning [Cabalar and Santos,
2006].
In the introduction, in Figure 1.1, we showed that the original syntax of the answer
set semantics has been extended several times. In this section we present the syntax
of the propositional extensions and of programs with weight constraints and the
concept of an aggregate. The semantics of weight constraints, as well as the syntax
and semantics of PDB- and FLP-aggregates are given in the next chapter.
10
The idea of relating planning to answer sets was first proposed in [Subrahmanian and Zaniolo,
1995].
14
2.2.1 Propositional Extensions
The first important generalizations of traditional rules were given in [Gelfond and
Lifschitz, 1991]. An alternative negation symbol ¬ (classical negation) was intro-
duced. A literal is either an atom A or ¬A. A rule, as defined in [Gelfond and
Lifschitz, 1988], is extended to have the form
15
is called a constraint, 11 and intuitively it imposes the requirement that at least one
of L1 , . . . , Lm , not Lm+1 , . . . , not Ln be false. Lines 2–5 and 10 of Figure 2.3 are
examples of rules of such a kind.
Negation as failure was first allowed in the head of a rule in [Lifschitz and
Woo, 1992]: literals in the head can be preceded by the symbol not. As a result of
this extension, answer sets for a program can be subsets of one another: for instance,
the answer sets for the single rule program
p; not p (2.10)
are ∅ and {p}. No program in the sense of [Gelfond and Lifschitz, 1991] has both
∅ and {p} as its answer sets. One of the results of the research presented in Chap-
ter 4 shows that there is a close relationship between choice rules, mentioned in
Section 2.1.3 above, and rules with negation as failure in the head. For instance,
the first line of Figure 2.3 can be alternatively written as
p, not(q; r).
where both Body and Head are nested expressions. The rule ← Body is a shorthand
for ⊥ ← Body, and the nested expression Head stands for rule Head ← ⊤. It is easy
11
not to be confused with weight and cardinality constraints.
16
to see that rules with nested expressions are a generalization of all kinds of rules
described so far.
A program with nested expressions is any set of rules with nested expressions.
Version 2.0 of answer set solver smodels supported a new construct, called weight
constraints. Their syntax and semantics were first described in [Niemelä et al., 1999].
Our presentation mostly follows [Niemelä and Simons, 2000]. A rule element is a
literal (positive rule element) or a literal prefixed with not (negative rule element).
A weight constraint is an expression of the form
L ≤ {c1 = w1 , . . . , cm = wm } ≤ U (2.12)
where
• each of L, U is (a symbol for) a real number or one of the symbols −∞, +∞,
The intuitive meaning of (2.12) is that the sum of the weights wi for all the ci
that are true is not lower than L and not greater than U . The part L ≤ can be
omitted if L = −∞; the part ≤ U can be omitted if U = +∞. A rule with weight
constraints is an expression of the form
C0 ← C1 , . . . , Cn (2.13)
17
This syntax becomes a generalization of traditional programs if we identify
a rule element c with the weight constraint
1 ≤ {c = 1}.
By
← C1 , . . . , Cn
can be abbreviated as
L ≤ {c1 , . . . , cm } ≤ U. (2.14)
It becomes clear that the rules in Figure 2.3 are rules in the syntax of weight
constraints. For instance, line 1 is, without abbreviations,
l1 ; . . . ; ln (n > 0) (2.15)
(intuitively: one of l1 , . . . , ln must hold) seems to have the same meaning as the
cardinality constraint
1 ≤ {l1 , . . . , ln }. (2.16)
However, this is not true. For instance, according to the definitions of answer sets in
the next chapter, the answer sets for (2.15) are the singletons {l1 }, . . . , {ln }, while
18
the answer sets for (2.16) are arbitrary nonempty subsets of {l1 , . . . , ln }. Represent-
ing (2.15) as
1 ≤ {l1 , . . . , ln } ≤ 1 (2.17)
is generally not adequate either. Indeed, if we append the two facts l1 , l2 to (2.15)
we get a program with the unique answer set {l1 , l2 }, while by appending the same
facts to (2.17) we get a program that has no answer sets. The fact that programs
with weight constraints don’t generalize disjunctive programs has a theoretical jus-
tification: checking if a logic program with weight constraints has answer sets is an
NP-complete problem, and not ΣP2 as for disjunctive programs.
2.2.3 Aggregates
oph{F1 = w1 , . . . , Fn = wn }i ≺ N (2.18)
where
19
op(W ) ≺ N . For example,
6 1.
sumh{p = 1, q = 1}i =
intuitively expresses the condition that either both p are q are “true” or none of
them is.
It is clear that a weight constraint of the form L ≤ S has the same intuitive
meaning of aggregate sumhSi ≥ L, and that S ≤ U has the same intuitive meaning
of aggregate sumhSi ≤ U .
The syntax and semantics of PDB- and FLP-aggregates are reviewed in Sec-
tions 3.3 and 3.4 respectively.
In logic programming with the answer set semantics we distinguish between two
kinds of equivalence between logic programs 13 .
We say that two programs are weakly equivalent if they have the same answer
sets. For instance, each of the one-rule programs
a and a ← not b
has a unique answer set: {a}, so they are weakly equivalent. However, if we append
the rule b to each program then the answer sets don’t remain the same for both
programs: in the first case, we have the answer set {a, b}; in the second, {b}.
For this reason, another relationship between programs has been defined. We
say that two programs with nested expressions Π1 and Π2 are strongly equivalent if,
for any program Π with nested expressions, Π1 ∪ Π and Π2 ∪ Π have the same answer
sets [Lifschitz et al., 2001]. Strong equivalence implies weak equivalence: take Π to
be empty.
13
To be precise, other kinds of equivalences have been defined, but we don’t discuss them in this
thesis.
20
For instance, it can be proved that (2.10) is strongly equivalent to the rule
F ←G
F ← H.
Similarly,
F, G ← H
F ←H
G←H
21
always a counterexample Π that is a positive traditional program of a very simple
form: the bodies of its rules consist of at most one element. Such programs, called
unary programs, consists of facts and of rules of the form l1 ← l2 , where l1 and l2 are
literals. Consequently, whether two logic programs are strongly equivalent doesn’t
depend on the syntax of logic programs that we are considering, as long as all unary
programs are allowed.
Several characterizations of strong equivalence exist: for programs with nested
expressions, we will review in Section 3.5 the original one from [Lifschitz et al., 2001]
and another equivalent from [Turner, 2003]. This last paper covers also programs
with weight constraints (in this case, Π ranges over the set of programs with weight
constraints). Finally, [Turner, 2004] defines the concept of strong equivalence be-
tween causal theories, presented in Chapter 9. Later in this thesis we will present
yet another characterization of strong equivalence, based on the definition of an
answer set for propositional theories.
22
Chapter 3
Background
The syntax of programs with nested expressions [Lifschitz et al., 1999] is described
in Section 2.2.1. The semantics of these programs is characterized by defining when
a consistent set X of literals is an answer set for a program Π. As a preliminary
step, we define when a consistent set X of literals satisfies a nested expression F
(symbolically, X |= F ), as follows:
• for a literal l, X |= l if l ∈ X
• X |= ⊤
• X 6|= ⊥
• X |= (F, G) if X |= F and X |= G
• X |= (F ; G) if X |= F or X |= G
• X |= not F if X 6|= F .
We say that X satisfies a program Π (symbolically, X |= Π) if, for every rule (2.11)
in Π, X |= Head whenever X |= Body .
23
The reduct1 F X of a nested expression F with respect to a consistent set X
of literals is defined recursively as follows:
• if F is a literal, ⊤ or ⊥, then F X = F
• (F, G)X = F X , GX
• (F ; G)X = F X ; GX
⊥ , if X |= F ,
X
• (not F ) =
⊤ , otherwise.
Head X ← Body X
for each rule (2.11) in Π. For instance, the reduct of (2.19) with respect to X is
p←⊤ (3.1)
if p ∈ X, and
p←⊥ (3.2)
otherwise.
The concept of an answer set is defined first for programs not containing
negation as failure: a consistent set X of literals is an answer set for such a program
Π if X is a minimal set (relative to set inclusion) satisfying Π. For an arbitrary
program Π, we say that X is an answer set for Π if X is an answer set for the reduct
ΠX .
For instance, the reduct of (2.19) with respect to {p} is (3.1), and {p} is a
minimal set satisfying (3.1); consequently, {p} is an answer set for (2.19). On the
other hand, the reduct of (2.19) with respect to ∅ is (3.2), and ∅ is a minimal set
satisfying (3.2); consequently, ∅ is an answer set for (2.19) as well.
1
This definition of reduct is the same as the one in [Lifschitz et al., 2001], except that the
condition X |= F X is replaced with X |= F . It is easy to check by structural induction that the
two conditions are equivalent.
24
3.2 Semantics of Programs with Weight Constraints
The syntax of programs with weight constraints [Niemelä and Simons, 2000] is
reviewed in Section 2.2.2. The semantics of such programs was defined for programs
whose weight constraints contain positive weight only. Indeed, [Niemelä and Simons,
2000] proposed to eliminate weight constraints with negative weights as follows:
consider any weight constraint L ≤ S ≤ U and an element l = w of S where w is
negative: this element can be replaced by not l = |w| if we add w to both L and U .
For instance,
0 ≤ {p = 2, p = −1} (3.3)
can be rewritten as
1 ≤ {p = 2, not p = 1}. (3.4)
p ← 1 ≤ {p = 2, not p = 1} (3.5)
has answer set ∅. We will see later, in Section 7.6.1, a different way of considering
negative weights that solves this problem.
The semantics of programs with weight constraints with nonnegative weights
uses the following auxiliary definitions. A consistent set X of literals satisfies a
weight constraint (2.12) if the sum of the weights wj for all j such that X |= cj is
25
not less than L and not greater than U . For instance, X satisfies the cardinality
constraint
1 ≤ {a = 1, b = 1} ≤ 1 (3.7)
L ≤ {c1 = w1 , . . . , cm = wm }.
• LX is L minus the sum of the weights w for all pairs c = w in S such that c
is negative and X |= c.
1 ≤ {not a = 3, not b = 2}
relative to {a} is
−1 ≤ { }.
L0 ≤ S0 ≤ U0 ← L1 ≤ S1 ≤ U1 , . . . , Ln ≤ Sn ≤ Un (3.8)
26
• the set of rules of the form
l ← (L1 ≤ S1 )X , . . . , (Ln ≤ Sn )X
where l is a positive head element of (3.8) such that X |= l, if, for every i
(1 ≤ i ≤ n), X |= Si ≤ Ui ;
The reduct ΩX of a program Ω with respect to X is the union of the reducts of the
rules of Ω.
Consider, for example, the one-rule program
Since the only head element of (3.9) is a, the reduct of this rule with respect to a
set X of atoms is empty if a 6∈ X. Consider the case when a ∈ X. Since
X |= {not a = 3, not b = 2} ≤ 4,
It is clear from the definition of the reduct of a program above that every
rule in a reduct satisfies two conditions:
• every member of its body has the form L ≤ S where S does not contain
negative rule elements.
27
Finally, a consistent set X of literals is an answer set for a program Ω if
X |= Ω and cl (ΩX ) = X.
To illustrate this definition, assume that Ω is (3.7). Set {a, b} is not an answer
set for Ω because it does not satisfy Ω. Let us check that every proper subset of
{a, b} is an answer set. Clearly, every such subset satisfies Ω. It remains to show
that each of these sets is the deductive closure of the corresponding reduct of Ω.
To give another example, let Ω be (3.9). Set {b} is not an answer set for Ω
because it does not satisfy Ω. The other subsets of {a, b} satisfy Ω. Consider the
corresponding reducts.
• Ω{a} is
a ← −1 ≤ {}.
• Ω{a,b} is
a ← 1 ≤ {}
Consequently, cl(Ω{a,b} ) = ∅ =
6 {a, b}.
We conclude that the answer sets for (3.9) are ∅ and {a}.
28
3.3 PDB-aggregates
The semantics of aggregates that we call “PDB” has been invented by Pelov, Deneker
and Bruynooghe (2003).2 We review the syntax of program with PDB-aggregates
using the notation from Section 2.2.3. We also allow classical negation. A (ground)
PDB-aggregate is an expression of the form (2.18) where each of F1 , . . . , Fn is a rule
element (that is, a literal possibly prefixed by not).
A program with PDB-aggregates is a set of rules of the form
l ← A1 , . . . , Am ,
29
with the following nested expression Atr (WI stands for the multiset {wi : i ∈ I})
; G(I1 ,I2 )
I1 ,I2 :I1 ⊆I2 ⊆{1,...,n} and for all I such that I1 ⊆ I ⊆ I2 , op(WI ) ≺ N
The use of the “big comma” and the “big semicolon” in the formulas above to
represent a multiple conjunction and a multiple disjunction is similar to the familiar
V W
use of and . In particular, the empty conjunction is understood as ⊤, and the
empty disjunction as ⊥.
For instance, for a PDB-aggregate A = sumh{p = −1, q = 1}i ≥ 0, if we
take F1 = p, F2 = q then the pairs (I1 , I2 ) that “contribute” to the disjunction of
Atr are
(∅, ∅) ({2}, {2}) ({1, 2}, {1, 2}) (∅, {2}) ({2}, {1, 2}).
and their disjunction is equivalent, in the logic of here and there, to not p; q.
PDB-aggregates seem to have the same problems of weight constraints in
case of negative weights. For instance, program
(the way of writing (3.5) using a PDB-aggregate) has no answer sets, while
30
In addition to this, PDB aggregates seem to give some other unintuitive
results when negation as failure occurs in an aggregate. Consider the following Π:
and Π′ :
p ← sumh{not p = 1}i < 1 → p
(3.13)
q ← not p
Intuitively, the two programs should have the same answer sets. Indeed, the op-
eration of replacing q with ¬p in the first rule of Π should not affect the answer
sets since the second rule “defines” q as ¬p: it is the only rule with q in the head.
However, under the semantics of [Pelov et al., 2003], Π has answer {p} and Π′ has
answer set {q} also.
3.4 FLP-aggregates
A semantics for aggregates that we call “FLP” has been invented by Faber, Leone
and Pfeifer (2004). Here again we use the notation from Section 2.2.3, and we allow
classical negation, not allowed in the usual definition.
An FLP-aggregate is an expression of the form (2.18) where each of F1 , . . . , Fn
is a conjunction l1 , . . . , lm of literals. A program with FLP-aggregates is a set of rules
of the form
l1 ; . . . ; ln ← A1 , . . . , Am , not Am+1 , . . . , not Ap (3.14)
31
The satisfaction of an aggregate A of the form
oph{F1 = w1 , . . . , Fn = wn }i ≺ N
p ← sumh{p = 2}i ≥ 0
is the empty set. Indeed, since the empty set doesn’t satisfy the aggregate, Π∅ = ∅,
which has ∅ as the unique minimal model; we can conclude that ∅ is an answer set
for Π. On the other hand, Π{p} = Π because {p} satisfies the aggregate in Π. Since
{p} |= Π, {p} is not a minimal model of Π{p} and then it is not an answer set for Π.
This definition of a reduct is different from the other definitions of reducts
for traditional programs, with nested expressions and with weight constraints, in the
sense that it may leave negative rule elements in the body of a rule. For instance, the
reduct of a ← not b relative to {a} is, accordingly to the other definitions, essentially
the fact a. In the definition of this section, the reduct doesn’t modify the rule. On
the other hand, this definition of an answer set is equivalent to the definition of an
syntax of [Faber et al., 2004] classical negation doesn’t occur, and the word “literal” is used there
to denote an atom possibly prefixed by not, i.e. what we call “rule element”. We don’t need such
concept since we view rule elements as abbreviations for FLP-aggregates: see Section 2.2.3.
32
answer set in the sense of [Gelfond and Lifschitz, 1991] and of [Lifschitz et al., 1999]
when applied to disjunctive programs.
FLP-aggregates probably are the best proposal for a definition of an ag-
gregate, as they don’t have the same problems as weight constraints and PDB-
aggregates in the case of sums with negative weights. For instance, both (3.10)
and (3.11) have answer set {p}.
Under the semantics of [Faber et al., 2004], an expression of the form
not ophSi ≺ N
and Π′ :
p ← not q
q ← sumh{q = 1}i < 1
If the negation in the first rule of Π is negation as failure then the two programs
should have the same answer sets. Indeed, the operation of replacing sumh{q =
1}i < 1 with q in the first rule of Π should be safe since the second rule “defines”
q as sumh{q = 1}i < 1: it is the only rule with q in the head. However, under the
semantics of [Faber et al., 2004], Π has answer {p} only, while Π′ has answer set {q}
also.
33
3.5 Logic of Here-and-There
In this section we introduce the logic of here-and-there, which is needed for defining
equilibrium logic and for a characterization of strong equivalence.
A propositional formula is any combination of atoms formed using the con-
nectives ⊥ (false), ∨, ∧, and →. An expression of the form ¬F stands for F → ⊥,
⊤ for ⊥ → ⊥ and F ↔ G for (F → G) ∧ (G → F ). As usual, a propositional theory
is a (possibly infinite) set of propositional formulas. We identify an interpretation
in classical logic with the set of atoms satisfied by it. That means that for every
interpretation X and any atom a, X satisfies a iff a ∈ X. Satisfaction of non-atomic
formulas is defined recursively in terms of truth-tables, as usual in classical logic.
The logic of here-and-there was originally defined in [Heyting, 1930]. The
semantics of the logic of here-and-there is defined as follows. An HT-interpretation
is a pair (X, Y ) of sets of atoms (respectively called “here” and “there”) such that
X ⊆ Y . Each HT-interpretation intuitively “assigns” one of three possible values
to each atom: atoms in X are considered to be true, atoms not in Y are considered
to be false, and the rest (Y − X) are thought to be undefined. We say that an HT-
interpretation (X, Y ) is total when X = Y (no undefined atoms). In this section
and all the others where the logic of here-and-there is discussed we will drop the
suffix “HT-” from “HT-interpretation”.
We recursively define4 when an interpretation (X, Y ) satisfies a formula F ,
written (X, Y ) |= F , as follows:
• (X, Y ) 6|= ⊥,
4
We have slightly simplified the definition in comparison with the usual definition of satisfaction
in the logic of here-and-there which is typically provided in terms of a Kripke structure as in
intuitionistic logic, but under the assumption that it consists of only two worlds. It can be easily
seen that both definitions are equivalent.
34
• (X, Y ) |= F ∧ G if (X, Y ) |= F and (X, Y ) |= G,
Although we use the same symbol ‘|=’ for satisfaction in logic programs,
classical logic and the logic of here-and-there, this will not lead to ambiguity if we
note with object serve as the operands of |=. It is clear, for instance, that the
expression Y |= F → G in the last line of the definition above refers to satisfaction
in the sense of classical logic.
For instance, formula F = (p → q) → q is satisfied by ({q}, {q}). Indeed, first
we notice that, in the “there” world, {q} |= F . It remains to notice that ({q}, {q})
satisfies the consequent q of F . It is also easy to check that interpretation, (∅, {q})
is not a model of F , because (∅, {q}) |= p → q but (∅, {q}) 6|= q.
As usual, an interpretation is a model of a theory T if it satisfies all the
formulas in T . Two formulas (theories) are equivalent if they have the same models.
Note that when the interpretation is total (X=Y ), (Y, Y ) |= F simply col-
lapses into classical satisfaction Y |= F . Another interesting property is that
(X, Y ) |= F implies (Y, Y ) |= F (that is, Y |= F ). Finally, using the definition
of ¬F as F → ⊥, it also follows that (X, Y ) |= ¬F iff Y |= ¬F .
Axiomatically, the logic of here-and-there is intermediate between intuition-
istic and classical logic. A natural deduction system for intuitionistic logic can be
obtained from the corresponding classical system [Bibel and Eder, 1993, Table 3] by
dropping the law of the excluded middle
F ∨ ¬F
from the list of postulates. The logic of here-and-there, on the other hand, is the
result of replacing the excluded middle in the classical system with the weaker axiom
35
schema [De Jongh and Hendriks, 2003]:
F ∨ (F → G) ∨ ¬G. (3.15)
¬(F ∧ G) ↔ ¬F ∨ ¬G
((F → G) → G) ∧ ((G → F ) → F ).
Equilibrium logic [Pearce, 1997] defines when a set Y of atoms (i.e., an interpretation
in the sense of classical logic) is an equilibrium logic for a propositional theory Γ.
A set Y is an equilibrium model of Γ if
36
For instance, consider a propositional theory Γ consisting of the single for-
mula F = (p → q) → q. We have seen in the previous section that ({q}, {q}) |= F
and that (∅, {q}) 6|= F . Consequently, {q} is an equilibrium model of Γ.
A logic program with nested expressions without classical negation can be
written as a propositional theory by substituting, in each nested expression, each
comma with ∧, each semicolon by ∨, the negation not by ¬; then we consider each
rule F ← G as the implication G → F . The equilibrium models of the propositional
theory obtained in this way are the answer sets of the original logic program [Pearce,
1997; Lifschitz et al., 2001] .
When classical negation occurs in the logic program, to translate it into
equilibrium logic we first replace each occurrence of a negative literals ¬a by a new
atom ∼ a. The symbol ∼ is called strong negation. We say that a set of atoms
is coherent if it doesn’t contain pairs of “complementary” atoms a, ∼ a. When
the logic program contains classical negation, coherent equilibrium models of the
corresponding propositional theory become the answer sets of the logic program
after having replaced each ¬a with ∼ a [Pearce, 1997].
Recall that two logic programs Π1 and Π2 are said to be strongly equivalent to
each other if, for every program Π, the union Π1 ∪ Π has the same answer sets as
Π2 ∪ Π (Section 2.3).
The first characterization of strong equivalence is applicable to programs
with nested expressions, and it is based on the logic of here-and-there. Let Π1
and Π2 be two programs with nested expressions, and S the set of negative literals
occurring in any of the two programs. Let Γ1 and Γ2 be the two propositional
theories obtained from Π1 and Π2 as explained in Section 3.6. Program Π1 and Π2
are strongly equivalent iff Γ1 and Γ2 are equivalent in the logic of here-and-there
37
under the set of hypotheses
{¬(a∧ ∼ a) : ¬a ∈ S}
[Lifschitz et al., 2001]. Note that if Π1 and Π2 don’t contain classical negation then
the set of hypotheses is empty.
In addition to this, [Lifschitz et al., 2001] shows that equivalence between two
propositional theories Γ1 and Γ2 in the logic of here-and-there characterizes strong
equivalence in equilibrium logic as well, if we define this relation as follows: Γ1 is
strongly equivalent to Γ2 if, for every propositional theory Γ, Γ1 ∪ Γ has the same
equilibrium models of Γ2 ∪ Γ.
The second characterization of strong equivalence between logic programs
with nested expressions is in terms of satisfaction of the reduct [Turner, 2003], and
we will rephrase it as follows. Let A be the set of atoms occurring in programs Π1
and Π2 . Programs Π1 and Π2 are strongly equivalent iff, for every consistent set Y
of literals subset of A,
The same paper showed that this characterization of strong equivalence holds also
if Π1 and Π2 are programs with weight constraints. The characterization of strong
equivalence between causal theories (see Chapter 9) is similar [Turner, 2004].
38
Chapter 4
{p}
shows that in the presence of cardinality constraints the anti-chain property does
not hold either.
39
We show that there is indeed a close relationship between these two forms
of the answer set semantics: cardinality and weight constraints can be viewed as
shorthand for nested expressions of a special form. We define a simple, modular
translation that turns any program Ω with weight constraints into a program [Ω]
with nested expressions that has the same answer sets as Ω. Furthermore, every rule
of [Ω] can be equivalently replaced with a set of nondisjunctive rules: rules whose
head is a literal or ⊥. This will lead us to a nondisjunctive version [Ω]nd of the basic
translation.
The translations defined in this chapter can be of interest for several rea-
sons. First, the definition of an answer set for programs with weight constraints
(Section 3.2) is technically somewhat complicated. Instead of introducing that def-
inition, we can treat any program Ω with weight constraints as shorthand for its
translation [Ω].
Second, the definition of program completion from [Clark, 1978] has been ex-
tended to nondisjunctive programs with nested expressions [Lloyd and Topor, 1984],
and this extension is known to be equivalent to the definition of an answer set when-
ever the program is “tight” [Erdem and Lifschitz, 2003]. In view of this fact, answer
sets for a tight logic program can be generated by running a satisfiability solver
on the program’s completion [Babovich et al., 2000]. Consequently, answer sets for
a program Ω with weight constraints can be computed by running a satisfiability
solver on the completion of the translation [Ω]nd if it is tight. This idea has led to
the development of the answer set solver cmodels (see Chapter 5 below).
Third, this translation can be used to reason about strong equivalence. We
will show that the translations [Ω1 ] and [Ω2 ] of two programs with weight constraints
Ω1 and Ω2 are strongly equivalent iff Ω1 and Ω2 are strongly equivalent. Since strong
equivalence of two programs with nested expressions can be expressed in terms of
the logic of here-and-there, we can use this logic to reason about strong equivalence
40
between Ω1 and Ω2 .
The following abbreviation is used in the definition of the translation [Ω] in Sec-
tion 4.2. For any nested expressions F1 , . . . , Fn and any set X of subsets of {1, . . . , n},
by
hF1 , . . . , Fn i : X
; , F . i (4.1)
I∈X i∈I
The use of the “big comma” and the “big semicolon” in (4.1) to represent a multiple
V W
conjunction and a multiple disjunction is similar to the familiar use of and . In
particular, the empty conjunction is understood as ⊤, and the empty disjunction
as ⊥.
For instance, if X is the set of all subsets of {1, . . . , n} of cardinality ≥ 3,
then (4.1) expresses, intuitively, that at least 3 of the nested expressions F1 , . . . , Fn
are true. It is easy to check, for this X, that a consistent set Z of literals satisfies (4.1)
iff Z satisfies at least 3 of the nested expressions F1 , . . . , Fn . This observation can
be generalized:
Z |= hF1 , . . . , Fn i : X iff {i : Z |= Fi } ∈ X.
41
Proof.
As a last remark, note that, by the absorption property of the logic of here-
and-there, if we take a program containing a multiple disjunction of the form (4.1)
and restrict this disjunction to the sets I that are minimal in X, then the answer
sets of the program will remain the same.
4.2 Translations
In this section, we give the description of a translation from the language of weight
constraints to the language of nested expressions, and state a theorem about the
soundness of this translation. The definition of the translation consists of 4 parts.
L ≤ {c1 = w1 , . . . , cm = wm } (4.2)
(4.3)
P
hc1 , . . . , cm i : I : L ≤ i∈I wi
where I ranges over the subsets of {1, . . . , m}. We denote the translation of L ≤ S
by [L ≤ S].
{c1 = w1 , . . . , cm = wm } ≤ U (4.4)
42
is the nested expression
(4.5)
P
not hc1 , . . . , cm i : I : U < i∈I wi .
where I ranges over the subsets of {1, . . . , m}. We denote the translation of S ≤ U
by [S ≤ U ].
[L ≤ S ≤ U ] = [L ≤ S], [S ≤ U ].
4. For any program Ω with weight constraints, its translation [Ω] is the program
with nested expressions obtained from Ω by replacing each rule (2.13) with
The conjunctive terms in (l1 ; not l1 ), . . . , (lp ; not lp ) express, intuitively, that
we are free to decide about every positive head element of the rule whether or not
to include it in the answer set.
To illustrate this definition, let us apply it first to program (3.7). The trans-
lation of the cardinality constraint 0 ≤ {a, b} ≤ 1 is
43
which equals
⊤; a; b; (a, b)
(a; not a), (b; not b), not (a, b). (4.8)
Theorem 1. For any program Ω with weight constraints, Ω and [Ω] have the same
answer sets.
[L < {c1 = w1 , . . . , cm = wm }]
44
understood as shorthand for
(4.9)
P
hc1 , . . . , cm i : I : L < i∈I wi .
For any program Ω with weight constraints, its nondisjunctive translation [Ω]nd is
the nondisjunctive program obtained from Ω by replacing each rule (2.13) with p + 1
rules
lj ← not not lj , [C1 ], . . . , [Cn ] (1 ≤ j ≤ p),
(4.10)
⊥ ← not [C0 ], [C1 ], . . . , [Cn ],
where l1 , . . . , lp are the positive head elements of (2.13).
For example, if Π is (3.7) then [Π], as we have seen, is (4.8); the nondisjunctive
translation [Π]nd of the same program is
a ← not not a,
b ← not not b, (4.11)
⊥ ← not not (a, b).
Proposition 2. For any program Ω with weight constraints, [Ω]nd is strongly equiv-
alent to [Ω].
45
Proof of Proposition 2. We will show that formula (4.6) is equivalent to the conjunc-
tion of the formulas (4.10) in the logic of here-and-there. By Fact 1, the formula
is entailed by the formulas c ∨ ¬c for all head elements c of rule (2.13). For every
negative c, c ∨ ¬c is provable in the logic of here-and-there. It follows that (4.12)
is derivable in the logic of here-and-there from the formulas c ∨ ¬c for all positive
head elements c, that is, from the formulas l1 ∨ ¬l1 ,. . . ,lp ∨ ¬lp . Consequently,
¬¬[C0 ] ↔ [C0 ] is derivable from these formulas as well. Hence (4.6) is equivalent in
the logic of here-and-there to the rule
The first line is equivalent to the first line of (4.10) in the logic of here-and-there.
The second line is intuitionistically equivalent to the second line of (4.10).
For programs with weight constraints, the definition of strong equivalence is similar
to the definition given in Section 2.3 above: Ω1 and Ω2 are strongly equivalent
to each other if, for every program Ω with weight constraints, the union Ω1 ∪ Ω
has the same answer sets as Ω2 ∪ Ω. The method of proving strong equivalence of
programs with weight constraints discussed in this section is based on the following
proposition:
46
Proposition 3. Ω1 is strongly equivalent to Ω2 iff [Ω1 ] is strongly equivalent to [Ω2 ].
Proof. Assume that [Ω1 ] is strongly equivalent to [Ω2 ]. Then, for any program with
weight constraints Ω, [Ω1 ] ∪ [Ω] has the same answer sets as [Ω2 ] ∪ [Ω]. The first
program equals [Ω1 ∪ Ω], and, by Theorem 1, has the same answer sets as Ω1 ∪ Ω.
Similarly, the second program has the same answer sets as Ω2 ∪ Ω. Consequently
Ω1 is strongly equivalent to Ω2 .
Assume now that [Ω1 ] is not strongly equivalent to [Ω2 ]. Consider the cor-
responding programs [Ω1 ]′ , [Ω2 ]′ without classical negation, formed as described at
the end of Section 3.5, and let Cons be the set of nested expressions ¬(a ∧ a′ ) for
all new atoms a′ occurring in these programs. By Theorem 2 from [Lifschitz et al.,
2001], [Ω1 ]′ ∪ Cons is not equivalent to [Ω2 ]′ ∪ Cons in the logic of here-and-there.
It follows by Theorem 1 from [Lifschitz et al., 2001] that there exists a unary pro-
gram Π such that [Ω1 ]′ ∪ Cons ∪ Π and [Ω2 ]′ ∪ Cons ∪ Π have different collections of
answer sets. (A program with nested expressions is said to be unary if each of its
rules is an atom or has the form a1 ← a2 where a1 , a2 are atoms.) Let Π∗ be the
program obtained from Π by replacing each atom of the form a′ by ¬a. In view of
the convention about identifying any literal l with the weight constraint 1 ≤ {l = 1}
(Section 2.2.2), Π∗ can be viewed as a program with weight constraints, and it’s
easy to check that [Π∗ ]′ is strongly equivalent to Π. Then, for i = 1, 2, the program
[Ωi ]′ ∪ Cons ∪ Π has the same answer sets as the program [Ωi ]′ ∪ Cons ∪ [Π∗ ]′ , which
can be rewritten as [Ωi ∪Π∗ ]′ ∪Cons. By the choice of Π, it follows that the collection
of answer sets of [Ω1 ∪ Π∗ ]′ ∪ Cons is different from the collection of answer sets of
[Ω2 ∪ Π∗ ]′ ∪ Cons. Consequently, the same can be said about the pair of programs
[Ω1 ∪ Π∗ ] and [Ω2 ∪ Π∗ ], and, by Theorem 1, about Ω1 ∪ Π∗ and Ω2 ∪ Π∗ . It follows
that Ω1 is not strongly equivalent to Ω2 .
47
As an example, let us check that the program
1 ≤ {p, q} ≤ 1
(4.13)
p
is strongly equivalent to
←q
(4.14)
p.
Rules (4.13), translated into the language of nested expressions and written in the
syntax of propositional formulas, become
¬q
(p ∨ ¬p) ∧ p.
It is clear that each of these sets of formulas is intuitionistically equivalent to {p, ¬q}.
The fact that programs (4.13) and (4.14) are strongly equivalent to each
other can be also proved directly, using the definition of strong equivalence and the
definition of an answer set for programs with weight constraints. But this proof
would not be as easy as the one above. Generally, to establish that a program Ω1
is strongly equivalent to a program Ω2 , we need to show that for every program Ω
and every consistent set Z of literals,
(a1 ) Z |= Ω1 ∪ Ω and
if and only if
(a2 ) Z |= Ω2 ∪ Ω and
48
(b2 ) cl ((Ω2 ∪ Ω)Z ) = Z.
Sometimes we may be able to check separately that (a1 ) is equivalent to (a2 ) and
that (b1 ) is equivalent to (b2 ), but in other cases this may not work. For instance,
if Ω1 is (4.13) and Ω2 is (4.14) then (b1 ) may not be equivalent to (b2 ).
An alternative method of establishing the strong equivalence of programs
with weight constraints is proposed in [Turner, 2003, Section 6]. According to that
approach, we check that for every consistent set Z of literals and every subset Z ′ of
Z,
(a3 ) Z |= Ω1 and
(b3 ) Z ′ |= ΩZ
1
if and only if
(a4 ) Z |= Ω2 and
(b4 ) Z ′ |= ΩZ
2.
Lemma 1. For any weight constraint C and any consistent set Z of literals, Z |= [C]
iff Z |= C.
Proof. It is sufficient to prove the assertion of the lemma for constraints of the forms
L ≤ S and S ≤ U . Let S be {c1 = w1 , . . . , cm = wm }. Then, by Proposition 1
(Section 4.1),
P
Z |= [L ≤ S] iff {i : Z |= ci } ∈ I : L ≤ i∈I wi
7
P
iff L ≤ i:Z|=ci wi
iff Z |= L ≤ S.
49
Similarly,
P
Z |= [S ≤ U ] iff {i : Z |= ci } 6∈ I : U < i∈I wi
P
iff U ≥ i:Z|=ci wi
iff Z |= S ≤ U.
Z
hF1 , . . . , Fn i : X = hF1Z , . . . , FnZ i : X. (4.15)
P
For any subset J of I, let ΣJ stand for i∈J wi . Using (4.15) and Proposition 1,
we can rewrite the left-hand side of the equivalence to be proved as follows:
Z ′ |= [L ≤ S]Z iff Z ′ |= hcZ Z
1 , . . . , cm i : {J ⊆ I : L ≤ ΣJ}
iff {i ∈ I : Z ′ |= cZ
i } ∈ {J ⊆ I : L ≤ ΣJ}
iff L ≤ Σ{i ∈ I : Z ′ |= cZ
i }
Let I ′ be the set of all i ∈ I such that the rule element ci is positive, and let I ′′ be
the set of all i ∈ I \ I ′ such that Z |= ci . It is clear that cZ ′
i is ci for i ∈ I , ⊤ for
50
i ∈ I ′′ , and ⊥ for all other values of i. Consequently
Z ′ |= [L ≤ S]Z iff L ≤ Σ{i ∈ I ′ : Z ′ |= ci } + ΣI ′′
iff L − ΣI ′′ ≤ Σ{i ∈ I ′ : Z ′ |= ci }
iff Z ′ |= (LZ ≤ S ′ )
where LZ and S ′ are defined as in Section 3.2. It remains to notice that (L ≤ S)Z =
(LZ ≤ S ′ ).
• ⊥, otherwise.
and
⊥ ← not [C0 ], [C1 ], . . . , [Cn ]. (4.17)
51
We will denote the set of rules (4.16) corresponding to all rules of Ω by Π1 , and the
set of rules (4.17) corresponding to all rules of Ω by Π2 , so that
[Ω]nd = Π1 ∪ Π2 . (4.18)
Fact 2. Let Π1 , Π2 be programs with nested expressions such that the head of every
rule in Π2 is ⊥. A consistent set Z of literals is an answer set for Π1 ∪ Π2 iff Z is
an answer set for Π1 and Z |= Π2 .
Proof. It is sufficient to consider the case when Ω consists of a single rule (2.13). In
this case, Z |= Ω iff
Proof. It is sufficient to consider the case when Ω consists of a single rule (3.8).
Then ΠZ
1 consists of the rules
52
for all positive head elements l of (3.8).
Case 1: for every i (1 ≤ i ≤ n), Z |= Si ≤ Ui . Then, by Lemma 3, each of the
formulas [S1 ≤ U1 ]Z , . . . , [Sn ≤ Un ]Z is ⊤. Note also that if l 6∈ Z then (not not l)Z
is ⊥, so that (4.19) is satisfied by any consistent set of literals. Consequently Z ′
satisfies ΠZ
1 iff, for each positive head element l ∈ Z,
On the other hand, according to the definition of the reduct from Section 3.2, ΩZ
is the set of rules
l ← (L1 ≤ S1 )Z , . . . , (Ln ≤ Sn )Z
for all positive head elements l satisfied by Z. Then Z ′ |= ΩZ iff, for each positive
head element l ∈ Z,
Lemma 7. If set cl (ΩZ ) is consistent then it is the only answer set for ΠZ
1 ; other-
wise, ΠZ
1 has no answer sets.
Proof. Recall that cl (ΩZ ) is defined as the unique minimal set satisfying ΩZ (Sec-
tion 3.2). The answer sets for a program with nested expressions that does not
contain negation as failure are defined as the minimal consistent sets satisfying that
program (Section 3.1). It remains to notice that ΩZ and ΠZ
1 are satisfied by the
53
Theorem 1. For any program Ω with weight constraints, Ω and [Ω] have the same
answer sets.
Proof. By the definition of an answer set for programs with weight constraints (Sec-
tion 3.2), a consistent set Z of literals is an answer set for Ω iff
cl (ΩZ ) = Z and Z |= Ω.
By the definition of an answer set for programs with nested expressions (Section 3.1)
and by Lemma 4, this is further equivalent to saying that Z is an answer set for
[Ω]nd . By Proposition 2, [Ω]nd has the same answer sets as [Ω].
54
Chapter 5
55
be seen as the result of eliminating nested expressions in [Ω]nd (see Section 4.2.2)
in favor of additional atoms. This translation is implemented by Yuliya Lierler in
the answer set solver cmodels to eliminate weight constraints [Giunchiglia et al.,
2004b].
The possibility of translating programs with cardinality constraints into the
language of nonnested programs at the price of introducing new atoms was first es-
tablished by Marek and Remmel [2002]. Our nonnested translation is more general,
because it is applicable to programs with arbitrary weight constraints. Its other
advantage is that, in the special case when all weights in the program are expressed
by integers of a limited size (in particular, in the case of cardinality constraints) the
translation can be computed in polynomial time. 1
Each of the new atoms introduced in the nonnested translation [Ω]nn below is, intu-
itively, an “abbreviation” for some nested expression related to the nondisjunctive
translation [Ω]nd . For instance, to eliminate the nesting of negations from the first
line of the nondisjunctive translation (4.10), we will introduce, for every j, a new
1
The fast algorithm for transforming such a program Ω into [Ω]nd does not go through the
intermediate step of constructing [Ω]nn : that program can be exponentially larger than Ω.
56
atom qnot lj , and replace that line with the rules
qnot lj ← not lj ,
lj ← not qnot lj , [C1 ], . . . , [Cn ]
(1 ≤ j ≤ p). The first of these rules tells us that the new atom qnot lj is used to
“abbreviate” the nested expression not lj . The second rule is the first of rules (4.10)
with this subexpression replaced by the corresponding atom. For instance, the
nondisjunctive translation (4.11) of program (3.7) turns after this transformation
into
qnot a ← not a,
a ← not qnot a ,
qnot b ← not b, (5.1)
b ← not qnot b ,
⊥ ← not not (a; b).
Introducing the atoms qnot lj brings us very close to the goal of eliminating
nesting altogether, because every rule of the program obtained from [Ω]nd by this
transformation is strongly equivalent to a set of nonnested rules. One way to elim-
inate nesting is to convert the body of every rule to a “disjunctive normal form”
using De Morgan’s laws, the distributivity of conjunction over disjunction, and, in
the case of the second line of (4.10), double negation elimination.2 After that, we
can break every rule into several nonnnested rules, each corresponding to one of the
disjunctive terms of the body. For instance, the last rule of (5.1) becomes
⊥ ← a; b
57
after the second.
The definition of [Ω]nn below follows a different approach to the elimination of
the remaining nested expressions. Besides the “negation atoms” of the form qnot lj ,
it introduces other new atoms, to make the translation of weight constraints more
compact in some cases. These “weight atoms” have the forms qw≤S and qw<S , where
w is a number and S is an expression of the form {c1 = w1 , . . . , cm = wm } for some
rule elements c1 , . . . , cm and nonnegative numbers w1 , . . . , wm . They “abbreviate”
the nested expressions [w ≤ S] and [w < S] respectively.
In the following definition, {c1 = w1 , . . . , cm = wm }′ , where m > 0, stands for
{c1 = w1 , . . . , cm−1 = wm−1 }. Consider a nonnested program Π that may contain
atoms of the forms qw≤S and qw<S . We say that Π is closed if
• for each atom of the form qw≤S that occurs in Π, Π contains the rule
qw≤S (5.2)
qw≤S ← qw≤S ′ ,
(5.3)
qw≤S ← cm , qw−wm≤S ′
if 0 < w ≤ w1 + · · · + wm ;
• for each atom of the form qw<S that occurs in Π, Π contains the rule
qw<S (5.4)
qw<S ← qw<S ′ ,
(5.5)
qw<S ← cm , qw−wm<S ′
if 0 ≤ w < w1 + · · · + wm .
58
We define the nonnested translation [L ≤ S ≤ U ]nn of a weight constraint
L ≤ S ≤ U as the conjunction
of Ω, the rules
qnot l ← not l (5.6)
and
l ← not qnot l , [C1 ]nn , . . . , [Cn ]nn (5.7)
qnot a ← not a,
a ← not qnot a ,
qnot b ← not b,
(5.9)
b ← not qnot b ,
⊥ ← not q0≤{a,b} ,
⊥ ← q1<{a,b} .
To make this program closed, we add to it the following “definitions” of the weight
atoms q0≤{a,b} and q1<{a,b} , and, recursively, of the weight atoms that are used in
59
these definitions:
q0≤{a,b} ,
q1<{a,b} ← q1<{a} ,
q1<{a,b} ← b, q0<{a} ,
(5.10)
q0<{a} ← q0<{} ,
q0<{a} ← a, q−1<{} ,
q−1<{} .
The nonnested translation of (3.7) consists of rules (5.9) and (5.10).
The following theorem describes the relationship between the answer sets for
Ω and the answer sets for [Ω]nn . In the statement of the theorem, QΩ stands for
the set of all new atoms that occur in [Ω]nn —both negation atoms qnot l and weight
atoms qw≤S , qw<S .
It is easy to see that the translation Ω 7→ [Ω]nn is modular, in the sense that
it can be computed by translating each rule of Ω separately.
Recall that the introduction of the new atoms qw≤S and qw<S is motivated by
the desire to make the translations of programs more compact. We will investigate
now to what degree this goal has been achieved.
The basic translation [C] of a weight constraint, as defined in Section 4.2.1,
can be exponentially larger than C. For this reason, the basic and nondisjunctive
translations of a program Ω are, generally, exponentially larger than Ω.
The nonnested translation of a program Ω consists of the rules (5.6)–(5.8)
corresponding to all rules of Ω, and the additional rules (5.2)–(5.5) that make the
program closed. The part consisting of rules (5.6)–(5.8) cannot be significantly larger
than Ω, because each of the nested expressions [Ci ]nn is short — it contains at most
two atoms. The second part consists of the “definitions” of all weight atoms in [Ω]nn ,
60
and it contains at most two short rules for every such atom. Under what conditions
can we guarantee that the number of weight atoms is not large in comparison with
the size of Ω?
The length of a weight constraint (2.12) is m, and its weight is w1 + · · · + wm .
We will denote the length of C by L(C), and the weight of C by W (C).
If the weights in Ω come from a fixed finite set of integers (for instance, if
every weight constraint in Ω is a cardinality constraint) then W (C) = O(L(C)), and
the proposition above shows that the number of weight atoms in [Ω]nn is not large
in comparison with the size of Ω. Consequently, in this case [Ω]nn cannot be large
in comparison with Ω either.
w ∈ {− max(w1 , . . . , wm ), . . . , w1 + · · · + wm } ∪ {L, U }.
It is clear that the number of weight atoms occurring in relevant rules can be esti-
P
mated as O L(C) · W (C) . On the other hand, it is easy to see that the set of
relevant rules contains the rules (5.6)–(5.8) corresponding to all rules of Ω, and that
it is closed. Consequently, all rules in [Ω]nn are relevant.
The fact that, in case of integer and bounded weights, [Ω]nn can be computed
from Ω in polynomial time, is not hard to check in view of Proposition 4.
61
5.2 Removing the Weights
The second translation is limited to the case when all weights in the program are
positive integers, and the bounds are integers. In addition to this, the translation
requires the logic programs to satisfy some conditions:
• the bound conditions of weight constraints are not trivially true or false. (That
is, lower bounds are positive and not greater than the sum of the weights, and
upper bounds are nonnegative and lower than the sum of the weights.)
L1 ≤ S1 , S1 ≤ U1 , . . . , Ln ≤ Sn , Sn ≤ Un .
It is actually not hard to see that this transformation is correct, in view of Propo-
sition 2 and Theorem 1.
For the second condition, we can rewrite each weight constraint L ≤ S ≤ U
in the body of a rule as two elements L ≤ S and S ≤ U .
62
function wc2cc(Ω)
1 Ω′ := ∅
2 rewrite each expression of the form S ≤ U in Ω as not (U + 1) ≤ S
3 foreach L ≤ S occurring in the body of a rule of Ω
4 while a weight in S is greater than 1
(let S be {c1 = w1 , . . . , cn = wm })
5 R := {ci : i ∈ {1, . . . , n}, wi is odd}
6 H := {ci = ⌊wi /2⌋ : i ∈ {1, . . . , n}, wi > 1}
7 foreach i : 0 < i ≤ |R|, i + L is even
8 d := new atom
9 H := H ∪ {d}
10 Ω′ := Ω′ ∪ {d ← i ≤ R}
11 end foreach
12 replace L ≤ S with ⌈L/2⌉ ≤ H
13 end while
14 end foreach
15 rewrite each expression of the form not L ≤ S in Ω as S ≤ (L − 1)
16 return Ω ∪ Ω′
For the last condition, we drop each rule that contains a weight constraint
where the upper bound is negative, or the lower bound is greater than the sum of
weights (trivially false bounds). From the remaining rules, we drop every weight
constraint in the body where the lower bound is not positive, or the upper bound
is not lower than the sum of weights (trivially true bounds).
In Figure 5.1, we have a procedure wc2cc that eliminates, in a finite program with
weight constraints in the syntax explained above, weight constraints in favor of
cardinality constraints. In it, S, R and H are considered multisets.
Line 2 replaces each weight constraint of the form S ≤ U with not ((U + 1) ≤
S), and line 15 reverses the process. This allows (U + 1) ≤ S to be considered as
an expression of the form L ≤ S in line 3. This transformation not only follows the
63
intuitive meaning of a weight constraint, but also [S ≤ U ] = not [(U + 1) ≤ S]. It
is also easy to check that if S ≤ U has no trivial bounds conditions iff (U + 1) ≤ S
doesn’t have them.
At each iteration of the while loop the bound L and the weights in S are
halved. At line 5, set H contains the result of the integer division of weights in S
by 2, and set R contains the “remainder” of the division. We need to include the
contribution of the atoms in R to H, where each atom in R should count with a
“weight” 1/2. The auxiliary atoms d added to H (and that are “defined” with rules
added to Ω′ ) have this role: intuitively, the number of these atoms that are “true”
is about half the number of “true” elements of R.
Consider, for instance, the following program:
p ← {r = 3, q = 1} ≤ 3
q (5.12)
r ← not p
p ← {r, d} ≤ 1
q
(5.13)
r ← not p
d ← 2 ≤ {r, q}
64
In the following theorem Ω is a program with weight constraints satisfying
the conditions from Section 5.2.1. By the size of a number we mean its length in
binary notation.
As an example of (a), the answer sets of (5.12) are {p, q} and {q, r}, and the
answer sets of the translation (5.13) are {p, q} and {d, q, r}. The difference between
the answer sets of the two programs is only in the presence of the atom d in one of
the answer sets.
5.3 Proofs
The idea of program completion [Clark, 1978] is that the set of rules of a program
with the same atom q in the head is the “if” part of a definition of q; the “only if”
half of that definition is left implicit. If, for instance, the rule
q←F
is the only rule in the program whose head is q then that rule is an abbreviated
form of the assertion that q is equivalent to F .
65
Since in a rule with nested expressions the head is allowed to have the same
syntactic structure as the body, the “only if” part of such an equivalence can be
expressed by a rule also:
F ← q.
The lemma below shows that adding such rules to a program does not change its
answer sets.
An occurrence of a formula F in a formula or a rule is singular if the symbol
before this occurrence of F is ¬; otherwise the occurrence is regular [Lifschitz et al.,
1999]. The expression
F ↔G
Π ∪ {q ← Def (q) : q ∈ Q}
In the special case when Q is a singleton this fact was first proved by Esra
Erdem (personal communication).
In the statement of the completion lemma, if the atoms from Q occur neither
in Π nor in the formulas Def (q) then adding the rules q ← Def (q) to Π extends the
program by “explicit definitions” of “new” atoms. According to the lemma below,
such an extension is conservative: the answer sets for Π can be obtained by dropping
the new atoms from the answer sets for the extended program.
66
Proposition 6 (Lemma on Explicit Definitions). Let Π be a program with nested
expressions, and let Q be a set of atoms that do not occur in Π. For every q ∈ Q,
let Def (q) be a formula that contains no atoms from Q. Then Z 7→ Z \ Q is a 1–1
correspondence between the answer sets for Π ∪ {q ← Def (q) : q ∈ Q} and the
answer sets for Π.
The completion lemma and the lemma on explicit definitions will be gener-
alized to arbitrary propositional theories in Section 6.3, and the proofs of the more
general statements are provided in Section 6.5.
Let Ω be a program with weight constraints. Consider the subset ∆ of its nonnested
translation [Ω]nn consisting of the rules whose heads are atoms from QΩ . The rules
included in ∆ have the forms (5.2)–(5.6); they “define” the atoms in QΩ . The rest
of [Ω]nn will be denoted by Π; the rules of Π have the forms (5.7) and (5.8). The
union of these two programs is [Ω]nn :
[Ω]nn = Π ∪ ∆. (5.14)
67
For every atom q ∈ QΩ , define the formula Def (q) as follows:
Π ∪ {q ↔ Def (q) : q ∈ QΩ }.
Proof. From the definitions of [Ω]nn and QΩ we conclude that ∆ consists of the
following rules:
• rule (5.2) for every atom of the form qw≤S in QΩ such that w ≤ 0;
• rules (5.3) for every atom of the form qw≤S ∈ QΩ such that
0 < w ≤ w1 + · · · + wm ;
• rule (5.4) for every atom of the form qw<S in QΩ such that w < 0;
• rules (5.5) for every atom of the form qw<S in QΩ such that
0 ≤ w < w1 + · · · + wm ;
68
Lemma 9. Let S be {c1 = w1 , . . . , cm = wm }. In the logic of here-and-there,
⊤, if w ≤ 0,
[w ≤ S] ↔ [w ≤ S ′ ]; (cm , [w − wm ≤ S ′ ]), if 0 < w ≤ w1 + · · · + wm ,
⊥,
otherwise.
⊤, if w < 0,
[w < S] ↔ [w < S ′ ]; (cm , [w − wm < S ′ ]), if 0 ≤ w < w1 + · · · + wm ,
⊥,
otherwise.
Proof. Recall that [w ≤ S] is an expression of the form (4.3), which stands for a
disjunction of conjunctions (4.1). If w ≤ 0 then the set after the : sign in (4.3) has
the empty set as one of its elements, so that one of the disjunctive terms of this
formula is the empty conjunction ⊤. If w > w1 + · · · + wm then the set after the :
sign in (4.3) is empty, so that the formula is the empty disjunction ⊥. Assume now
that 0 < w1 + · · · + wm ≤ w. Let I stand for {1, . . . , m} and let I ′ be {1, . . . , m − 1}.
69
P
For any subset J of I, by ΣJ we denote the sum i∈J wi . Then
[w ≤ S] = ; , ci
J⊆I : ΣJ≥w i∈J
↔ ; , c ;i ; , ci
J⊆I ′ : ΣJ≥w i∈J J⊆I : m∈J,ΣJ≥w i∈J
[w ≤ S ′ ];
= ; , ci
J⊆I ′ : ΣJ+wm ≥w i∈J∪{m}
↔ [w ≤ S ′ ]; cm , ; , c i
J⊆I ′ : ΣJ≥w−wm i∈J
is strongly equivalent to
Proof. The rules of (5.16) can be obtained from the rules of (5.15) by replacing
Def (qw≤S ) with [w ≤ S] for the atoms qw≤S in QΩ , and Def (qw<S ) with [w < S] for
the atoms qw<S in QΩ . Consequently, it is sufficient to show that, for every atom
of the form qw≤S in QΩ , the equivalences
70
are derivable in the logic of here-and-there both from (5.15) and from (5.16), and
similarly for atoms of the form qw<S . The proofs for atoms of both kinds are similar,
and we will only consider qw≤S . Let S be {c1 = w1 , . . . , cm = wm }.
The definition of Def (qw≤S ) and the statement of Lemma 9 show that the
right-hand side of (5.17) is equivalent to the result of replacing qw≤S ′ in the left-hand
side with [w ≤ S ′ ], and qw−wm≤S ′ with [w − wm ≤ S ′ ]. Since qw≤S ′ and qw−wm≤S ′
belong to QΩ , this observation implies the derivability of (5.17) from (5.16).
The derivability of (5.17) from (5.15) will be proved by strong induction
on m. If w ≤ 0 or w > w1 + · · · + wm then, by the definition of Def (qw≤S )
and by Lemma 9, (5.17) is provable in the logic of here-and-there. Assume that
0 < w ≤ w1 + · · · + wm . Then qw≤S ′ and qw−wm≤S ′ belong to QΩ , and, by the
induction hypothesis, the equivalences
Def (qw≤S ′ ) ↔ [w ≤ S ′ ]
and
Def (qw−wm ≤S ′ ) ↔ [w − wm ≤ S ′ ]
qw≤S ′ ↔ [w ≤ S ′ ]
and
qw−wm≤S ′ ↔ [w − wm ≤ S ′ ]
are derivable from (5.15) as well. By Lemma 9, this implies the derivability of (5.17).
71
Proof. From Lemmas 8 and 10 we see that [Ω]nn has the same answer sets as the
union of Π and (5.16). Furthermore, this union is strongly equivalent to the union
of [Ω]nd and (5.16). Indeed, Π consists of the rules
in Ω and every positive head element l of that rule; [Ω]nd consists of the rules
It is easy to derive each of these two programs from the other program and (5.16)
in the logic of here-and-there. Consequently, [Ω]nn has the same answer sets as the
union of [Ω]nd and (5.16). By the completion lemma, it follows that [Ω]nn has the
same answer sets as the union of [Ω]nd and the program
72
Lemma 11. At each execution of lines 5–12 in Figure 5.1, f (S) never increases.
Theorem 3(b). For any program Ω, wc2cc terminates in time polynomial in the
size of the input.
Proof. Consider Figure 5.1. The algorithm can be divided into three parts: lines 1–
2, lines 3–14, and lines 15–16. It is sufficient to show that each part terminates in a
time polynomial in the size of its input (in this case, the value of Ω and Ω′ before the
execution of that part of code). This is easy to be verified for lines 1–2 and 15–16.
It remains to show that lines 3–14 require polynomial time.
The external foreach loop is clearly executed a linear number of times.
Inside that loop, the while loop is executed a number of times linear to the the size
of the largest weight in S, since that weight is halved at each iteration. (Recall that
the size of a number is the number of bits required to memorize the number.) It
remains to consider the time needed in each iteration of lines 5–12.
Let L0 ≤ S0 be the value of L ≤ S before the first iteration of lines 5–12.
Each iteration of such lines is polynomial in the size of the current L ≤ S. The rest
of the proof consists in showing that L ≤ S doesn’t become more than polynomially
larger than L0 ≤ S0 , so that the time of an execution of lines 5–12 is polynomially
bounded by the size of L0 ≤ S0 .
Since L always decreases at each iteration, it remains to consider the size of
S only. The size of S is polynomially bounded by
73
(i) the number |S| of rules elements in it,
For part (iii), the weights always decrease, so their total size decrease. For
part (i), we know that f (S) — an upper bound for the value of |S| — never increases
by Lemma 11. It remains to notice that the value of f (S) before the first iteration
of lines 5–12 is not more than twice the initial value of |S|.
Lemma 12. For any two extended weight constraints L1 ≤ S and L2 ≤ S with
L1 ≥ L2 , [L1 ≤ S] entails [L2 ≤ S].
Lemma 13. For any extended weight constraint L ≤ S where L and all weights in
S are even, [L ≤ S] = [(L − 1) ≤ S].
74
Proof. Let F be the left-hand side of the claim. By Lemma 12,
F = ; , [L j ≤ S] ↔ ; [Lmax(X) ≤ S]
X⊆{1,...,n} : i≤|X| j∈X X⊆{1,...,n} : i≤|X|
Since |X| ≥ i, the value of max(X) ranges from i (when X = {1, . . . , i}) through
n (when n ∈ X). Consequently, by Lemma 12 again, the disjunction in the last
expression above can be simplified into [Li ≤ S].
Lemma 15. Consider any extended weight constraint L ≤ S where all weights are
positive integers and L is a nonnegative integer. Let S1 and S2 be any partitioning
of S in two (multi)sets. Then
[L ≤ S] ↔ ; ([i ≤ S1 ], [L − i ≤ S2 ]).
i=0,...,ΣS1
Proof. Let F and G be the left-hand side and the right-hand side of the above
equivalence. Let S be {F1 = w1 , . . . , F|S| = w|S| } We assume, without losing in
generality, that the elements of S1 are the first |S1 | elements of S. In the following
formulas, we omit mentioning that X ⊆ {1, . . . , |S|}, X1 ⊆ {1, . . . , |S1 |} and X2 ⊆
75
P
{|S1 | + 1, . . . , |S|}. For each X, by WX we denote i∈X wi .
F = [L ≤ S] = ; , Fj
X : L≤WX j∈X
↔ ; , Fj , , Fj
X1 ,X2 : L≤WX1 +WX2 j∈X1 j∈X2
↔ ; ; , Fj , , Fj
X1 X2 : L−WX1 ≤WX2 j∈X1 j∈X2
↔ ; , Fj , ; , Fj
X1 j∈X1 X2 : L−WX1 ≤WX2 j∈X2
↔ ; , Fj , [(L − WX1 ) ≤ S2 ] .
X1 j∈X1
↔ ; , Fj , [L − i ≤ S2 ]
X1 j∈X1
i=0,...,WX1
↔ ; , Fj , ; [L − i ≤ S2 ] .
X1 j∈X1 i=0,...,WX1
; [L − i ≤ S2 ] ↔ [L − WX1 ≤ S2 ]
i=0,...,WX1
by Lemma 12.
76
Lemma 16. For every extended weight constraint L ≤ S where all weights are
positive integers and L is a nonnegative integer, replacing two elements F = w1 and
F = w2 in S with a single element F = w1 + w2 preserves strong equivalence of
[L ≤ S].
[i ≤ S1 ] ↔ [i ≤ S2 ].
Then, for any integer L and any set expression S ′ , by Lemma 15,
[L ≤ (S1 ∪ S ′ )] ↔ ; ([i ≤ S1 ], [N − i ≤ S ′ ])
i=0,...,ΣS1
↔ ; ([i ≤ S2 ], [N − i ≤ S ′ ])
i=0,...,ΣS2
↔ [L ≤ (S2 ∪ S ′ )]
{[i ≤ R] : 0 < i ≤ |R|, i + L is even} ∪ {ci = ⌊wi /2⌋ : i ∈ {1, . . . , n}, wi > 1}, (5.18)
77
Lemma 17.
[⌈L/2⌉ ≤ H ′ ] ↔ [L ≤ S]
Proof. We consider the case in which L is even. The other case is similar. Let H1′
and H2′ be the first and second term of the union (5.18) respectively. By Lemma 15,
For i = 0 then both i ≤ H1′ and 2i ≤ R are clearly equivalent to ⊤. For i > 0, we
use Lemma 14 to rewrite i ≤ H1′ as 2i ≤ R. Consequently,
↔ ; ([i ≤ R], [L − i ≤ T ])
i=0,...,|R|, i is even
↔ [L ≤ (R ∪ T )].
78
Recall that, at any step in our algorithm, Ω may not be a program with
weight constraints, since it may contain occurrences of weight constraints L ≤ S
preceded by negation not. By Ω̂ we denote the program with weight constraints
obtained from Ω by replacing each expression of the form not (L ≤ S) by S ≤ U .
We agree to write Ω̂ simply as [Ω]: this doesn’t lead to ambiguity when Ω is a
program with weight constraints, since, in this case, Ω̂ = Ω.
Lemma 19. Consider one execution of lines 5–12 of the algorithm in Figure 5.1.
Let Ω1 and Ω′1 be the initial values of Ω and Ω′ respectively, and let Ω2 and Ω′2 be
the same sets after one execution of lines 5–12. Let D be the set of auxiliary atoms
d introduced at line 8. Then X 7→ X \D is a 1–1 correspondence between the answer
sets of Ω̂2 ∪ Ω′2 and the answer sets of Ω̂1 ∪ Ω′1 .
Proof. For each d ∈ D, let Def (d) be the formula [i ≤ R] for which rule d ← i ≤ R
has been added to Ω′1 at line 10. In view of Theorem 1, we can compare the answer
sets of [Ω2 ∪ Ω′2 ] = [Ω2 ] ∪ [Ω′2 ] and the answer sets of [Ω1 ∪ Ω′1 ] = [Ω1 ] ∪ [Ω′1 ]. The
difference between Ω1 and Ω2 is that Ω2 contains ⌈L/2⌉ ≤ H in place of L ≤ S.
79
Then, by Lemma 18, the difference between [Ω1 ] and [Ω2 ] is that [Ω2 ] contains
[⌈L/2⌉ ≤ H] in place of [L ≤ S]. Moreover, [Ω′2 ] is essentially [Ω′2 ] plus rules of the
form (after a few simplifications)
for all d ∈ D. Since each of such atoms d ∈ D occurs in the head of a rule of
[Ω2 ] ∪ [Ω′2 ] uniquely in (5.19), then, by the Completion Lemma, [Ω2 ] ∪ [Ω′2 ] has the
same answer sets as [Ω2 ] ∪ [Ω′2 ] ∪ ∆.
Let Γ be [Ω1 ] with the occurrence of [L ≤ S] replaced by [⌈L/2⌉ ≤ H ′ ], where
H ′ is defined as (5.18). Program Γ can also be seen as the result of replacing, in [Ω′1 ]
every auxiliary atom d ∈ D with Def (d). Since [Ω′2 ] ∪ ∆ contains
d ↔ [i ≤ S],
80
Proof. Consider Figure 5.1. It is easy to verify that the value of Ω̂ ∪ Ω′ after the
execution of line 2 equals the value of Ω given as a parameter to the procedure.
Moreover, the program with nested expression returned by the procedure is identical
to the value of Ω̂ ∪ Ω′ before the execution of line 15. Consequently, it is sufficient
to show that Z 7→ Z ∩ σ is a 1–1 correspondence between the answer sets of Ω̂ ∪ Ω′
after line 2 and the answer sets of Ω̂ ∪ Ω′ before line 15.
Between lines 2 and 14, programs Ω and Ω′ are modified only inside the while
loop (lines 5–12). Lemma 19 shows that the answer sets of Ω̂ ∪ Ω′ are preserved by
each iteration of lines 5–12, with the possible addition — to each answer set — of
auxiliary atoms. The claim is then immediate.
81
Chapter 6
Recall (see Section 3.6) that a rule with nested expression is seen, in equilibrium
logic, as a propositional formula — over atoms that may contain strong negation
— of a special kind: it is an implication whose antecedent and consequent don’t
contain other implications [Pearce, 1997].
In this section we present an extension of the definition of an answer set,
which allows every “rule” to be any arbitrary propositional formula.
This new definition of an answer set turns out to be equivalent to the con-
cept of an equilibrium model. This fact is important for several reasons. First of all,
theorems about equilibrium models — for instance the characterization of strong
equivalence in terms of the logic of here-and-there — hold for the new definition of
an answer set. Second, this new definition of an answer set provides a simpler char-
acterization of an equilibrium model, originally defined in terms of Kripke models.
We will also show how we can extend many useful theorems about logic
programs to arbitrary propositional theories.
In the next chapter we will show how we can use this new definition of an
82
answer set to represent aggregates.
Proofs of the theorems stated in this chapter are presented in Section 6.5.
• if X 6|= F then F X = ⊥,
• if X |= F ⊗ G then (F ⊗ G)X = F X ⊗ GX .
83
For instance, if X contains p but not q then
Theorem 4. For any theory, its models in the sense of equilibrium logic are identical
to its answer sets.
84
definition [Lifschitz et al., 1999]. Consider, for instance, the following program:
p ← not q
q ← not r
p←⊤
q ← ⊥;
(¬F )X = (F → ⊥)X = ⊥.
Otherwise, X |= F → ⊥, so that
(¬F )X = (F → ⊥)X = F X → ⊥ = ⊥ → ⊥ = ⊤.
The following proposition states a more general relationship between the new
definition of the reduct and the traditional one. We denote by F X the reduct of a
nested expression F relative to X according to the definition from [Lifschitz et al.,
1999], and similarly for the reduct of a program.
Proposition 7. For any program Π with nested expressions and any set X of atoms,
ΠX is equivalent, in the sense of classical logic,
• to ⊥, if X 6|= Π, and
85
• to the program obtained from ΠX by replacing all atoms that do not belong to
X by ⊥, otherwise.
Corollary 1. Given two sets of atoms X and Y with Y ⊆ X and any program Π,
Y |= ΠX iff X |= Π and Y |= ΠX .
This corollary suggests another way to verify that the definition of an answer
set proposed in this paper is equivalent to the usual one in the case of programs
with nested expressions. If X 6|= Π then X is not an answer set for Π under either
semantics. Otherwise, for every subset Y of X, Y |= ΠX iff Y |= ΠX by Corollary 1.
Several theorems about answer sets for logic programs can be extended to proposi-
tional theories.
Two theories Γ1 and Γ2 are strongly equivalent if, for every theory Γ, Γ1 ∪ Γ
and Γ2 ∪ Γ have the same answer sets.
Proposition 8. For any two theories Γ1 and Γ2 , the following conditions are equiv-
alent:
86
To state several theorems below, we need the following definitions. An oc-
currence of an atom in a formula is positive if it is in the antecedent of an even
number of implications. An occurrence is strictly positive if such number is 0, and
negative if it odd. For instance, in a formula (p → r) → q, the occurrences of p and
q are positive, the one of r is negative, and the one of q is strictly positive.
The following proposition is an extension of the property that in each answer
set of a program, each atom occurs in the head of a rule of that program [Lifschitz,
1996, Section 3.1]. An atom is an head head atom of a theory Γ if it has a strictly
positive occurrence in Γ. 2
Proposition 10. For every two propositional theories Γ1 and Γ2 such that Γ2 has
no head atoms, a consistent set X of atoms is an answer set for Γ1 ∪ Γ2 iff X is an
answer set for Γ1 and X |= Γ2 .
87
Proposition 12 (Completion Lemma). Let Γ be any propositional theory, and Q
a set of atoms without strong negation such that all positive occurrences of atoms
from Γ in Γ are in the scope of negation. For each q ∈ Q, let Def (q) be a formula
such that all negative occurrences of atoms from Q in Def (q) are in the scope of
negation. Then Γ ∪ {Def (q) → q : q ∈ Q} and Γ ∪ {Def (q) ↔ q : q ∈ Q} have the
same answer sets.
Proposition 13 (Splitting Set Theorem). Let Γ1 and Γ2 be two theories such that
Γ1 doesn’t contain head atoms of Γ2 . A set X of atoms is an answer set for Γ1 ∪ Γ2
iff there is an answer set Y of Γ1 such that X is an answer set for Γ2 ∪ Y .
F →a
88
Proposition 14. Rule
l1 ∧ · · · ∧ lm → a1 ∨ · · · ∨ an
We will see, in the next chapter, that the conjunctive terms in the antecedent
of (6.2) can equivalently be replaced by aggregates of a simple kind, thus showing
that adding aggregates to the language of nondisjunctive programs increases the
complexity.
6.5 Proofs
Lemma 20. For any formulas F1 , . . . , Fn (n ≥ 0), any set X of atoms, and any
connective ⊗ ∈ {∨, ∧}, (F1 ⊗ · · · ⊗ Fn )X is classically equivalent to F1X ⊗ · · · ⊗ FnX .
Lemma 21. For any X and Y such that X ⊆ Y and any theory Γ,
X |= ΓY iff (X, Y ) |= Γ.
89
• F is an atom a. X |= aY iff Y |= a and X |= a. Since X ⊆ Y , this means iff
X |= a, which is the condition for which (X, Y ) |= a.
X |= GY implies X |= H Y , and Y |= G → H.
Theorem 4. For any theory, its models in the sense of equilibrium logic are identical
to its answer sets.
90
Lemma 22. The reduct F X of a nested expression F is equivalent, in the sense
of classical logic, to the nested expression obtained from F X by replacing all atoms
that do not belong to X by ⊥.
• When F is ⊥ then F X = ⊥ = F X .
Proposition 7. For any program Π with nested expressions and any set X of atoms,
ΠX is equivalent, in the sense of classical logic,
• to ⊥, if X 6|= Π, and
• to the program obtained from ΠX by replacing all atoms that do not belong to
X by ⊥, otherwise.
Proposition 8. For any two theories Γ1 and Γ2 , the following conditions are
equivalent:
91
(i) Γ1 is strongly equivalent to Γ2 ,
Proof. We will prove the equivalence between (i) and (ii) and between (ii) and (iii).
We start with the former. Lemma 4 from [Lifschitz et al., 2001] tells that, for any
two theories, the following conditions are equivalent:
(a) for every theory Γ, theories Γ1 ∪ Γ and Γ2 ∪ Γ have the same equilibrium
models, and
(a′ ) for every theory Γ, theories Γ1 ∪ Γ and Γ2 ∪ Γ have the same answer sets,
Since ΓY1 and ΓY2 contain atoms from Y only (the other atoms are replaced by ⊥ in
the reduct), this last condition expresses equivalence between ΓY1 and ΓY2 .
92
Lemma 23. For any theory Γ, let S be a set of atoms that contains all head atoms
of Γ. For any set X of atoms, if X |= Γ then X ∩ S |= ΓX .
Proof. It is clearly sufficient to prove the claim for Γ that is a singleton {F }. The
proof is by induction on F .
Lemma 24. For any theory Γ and any set X of atoms, X |= ΓX iff X |= Γ.
Proof. Reduct ΓX is obtained from Γ by replacing some subformulas that are not
satisfied by X with ⊥.
Proof. Consider any theory Γ, the set S of head atoms of Γ, and an answer set X
of Γ. By Lemma 24, X |= Γ, so that, by Lemma 23, X ∩ S |= ΓX . Since X ∩ S ⊆ X
and no proper subset of X satisfies ΓX , it follows that X ∩ S = X, and consequently
that X ⊆ S.
93
Proposition 10. For every two propositional theories Γ1 and Γ2 such that Γ2 has
no head atoms, a consistent set X of atoms is an answer set for Γ1 ∪ Γ2 iff X is an
answer set for Γ1 and X |= Γ2 .
Proof. If X |= Γ2 then ΓX
2 is satisfied by every subset of X by Lemma 23, so that
set for Γ1 ∪ Γ2 .
We start with the proof of Proposition 13. Some lemmas are needed.
Proof. Since all atoms that occur in ΓX belong to X, it is sufficient to show that
the formulas are satisfied by the same subsets of X. By the definition of an answer
set, the only subset of X satisfying ΓX is X.
Lemma 26. Let S be a set of atoms that contains all atoms that occur in a theory Γ1
but does not contain any head atoms of a theory Γ2 . For any set X of atoms, if X
is a answer set for Γ1 ∪ Γ2 then X ∩ S is an answer set for Γ1 .
(i) Z ∩ S = Y ;
(ii) Z ⊂ X;
(iii) Z |= ΓX
2 .
94
To prove (i), note that since S ′ is disjoint from S, and Y is a subset of X ∩ S,
Z ∩ S = X ∩ (S ′ ∪ Y ) ∩ S = X ∩ Y ∩ S = (X ∩ S) ∩ Y = Y.
Y = Z ∩ S = X ∩ S;
Proposition 13. Let Γ1 and Γ2 be two theories such that Γ1 doesn’t contain head
atoms of Γ2 . A set X of atoms is an answer set for Γ1 ∪ Γ2 iff there is an answer
set Y of Γ1 such that X is an answer set for Γ2 ∪ Y .
Proof. Take theories Γ1 and Γ2 such that Γ1 does not contain any head atoms of Γ2 ,
and let S be the set of atoms that occur in Γ1 . Observe first that if a set X of atoms
is an answer set for Γ2 ∪ Y then X ∩ S = Y . Indeed, by Lemma 26 with Y as Γ1 ,
X ∩ S is an answer set for Y , and the only answer set of Y is Y . Consequently, the
assertion to be proved can be reformulated as follows: a set X of atoms is an answer
set for Γ1 ∪ Γ2 iff
95
If X ∩ S is not an answer set for Γ1 then X is not an answer set for Γ1 ∪ Γ2 by
Lemma 26. Now suppose that X ∩ S is an answer set for Γ1 . Then, by Lemma 25,
ΓX∩S
1 is equivalent to X ∩ S. Consequently,
(Γ1 ∪ Γ2 )X = ΓX X X∩S ∪ ΓX ↔ X ∩ S ∪ ΓX
1 ∪ Γ2 = Γ1 2 2
X
= (X ∩ S)X ∪ ΓX
2 = (X ∩ S) ∪ Γ2
Proposition 11. Let Γ be any propositional theory, and Q a set of atoms without
strong negation such that, for each q ∈ Q, neither q nor ∼ q occur in Γ. For each
q ∈ Q, let Def (q) be a formula that doesn’t contain any atoms from Q. Then X 7→
X \ Q is a 1–1 correspondence between the answer sets for Γ ∪ {Def (q) → q : q ∈ Q}
and the answer sets for Γ.
Proof. Let Γ2 be {Def (q) → q : q ∈ Q}. In view of the splitting set theorem
(Proposition 13), a set X is an answer set for Γ ∪ Γ2 iff
By reasoning similar to one used in the proof of Proposition 13, the only set Y
such that X is an answer set for Γ2 ∪ Y is X \ Q. Then the splitting set theorem
(Proposition 13) tells us that X is an answer set for Γ ∪ Γ2 iff
Clearly, if X is an answer set for Γ ∪ Γ2 then X \ Q is an answer set for Γ. Now take
any answer set Y for Γ. We need to show that there is exactly one answer set X of
Γ ∪ Γ2 such that X \ Q = Y . In view of the splitting set theorem, it is sufficient to
show that
Z = {q ∈ Q : X \ Q |= Def (q)} ∪ Y
96
is the only answer set X for Γ2 ∪ Y such that X \ Q = Y . If X doesn’t contain an
element q ∈ Q such that X |= Def (q) then X 6|= Γ2 , so that X is not an answer set
for Γ2 ∪ Y . In all other cases, X |= Γ2 , so that (Γ2 ∪ Y )X is equivalent to
In this reduct, each Def (q)X is classically equivalent to ⊤. Indeed, first of all, since
Y = X \ Q, all atoms that occur in Def (q)X belong to Y , and then we can replace
such occurrences with ⊤, obtaining a formula that is either equivalent to ⊤ or ⊥.
It remains to notice that since X |= Def (q) then X |= Def (q)X .
Theory (Γ2 ∪ Y )X is then equivalent to the set Z defined above. We can
conclude that the only answer set X for Γ2 ∪ Y such that X |= Def (q) is Z.
In order to prove the Completion Lemma, we will need the following lemma.
Lemma 27. Take any three sets X, Y and S of atoms such that Y ⊆ X. For any
formula F ,
• If X 6|= F then F X = ⊥, and the claim is trivial. This covers the case in which
F = ⊥.
97
• If X |= F and they are a conjunction or a disjunction, the claim is almost
immediate by Lemma 20 and induction hypothesis.
Proposition 12. Let Γ be any propositional theory, and Q a set of atoms without
strong negation such that all positive occurrences of atoms from Γ in Γ are in the
scope of negation. For each q ∈ Q, let Def (q) be a formula such that all negative
occurrences of atoms from Q in Def (q) are in the scope of negation. Then Γ ∪
{Def (q) → q : q ∈ Q} and Γ ∪ {Def (q) ↔ q : q ∈ Q} have the same answer sets.
98
Secondly, set Y is one of the sets Y ′ having the following properties:
(i) Y ′ \ Q = Y \ Q, and
Let Z be the intersection of such sets Y ′ , and let ∆ be {q → Def (q)X : q ∈ Q∩X}.
Set Z has the following properties:
(a) Z ⊆ Y ,
(b) Z |= ΓX
1 , and
(c) Z |= ∆.
Indeed, claim (a) holds since Y is one of the elements Y ′ of the intersection. To
prove (b), first of all, we observe that Z \ Q = Y \ Q, so that, by (a), there is a set
S ⊆ Q such that Z = Y \ S; as Y |= ΓX and Γ has all positive occurrences of atoms
from S ⊆ Q in the scope of negation, it follows that Z |= ΓX by Lemma 27(a).
It remains to show that, for any q, if Z |= Def (q)X then q ∈ Z. Assume that
Z |= Def (q)X . Then, since Def (q) has all negative occurrences of atoms from Q in
the scope of negation, and since all Y ′ whose intersection generate Z are superset
of Z with Y ′ \ Z ⊆ Q, all those Y ′ satisfy Def (q)X by Lemma 27. By property (ii),
we have that q ∈ Y ′ for all Y ′ , and then q ∈ Z.
It remains to prove claim (c). Take any q ∈ Z. Set Y ′ = Z \ {q} satisfies
condition (i), but it cannot satisfy (ii), because sets Y ′ that satisfy (i) and (ii) are
supersets of Z by construction of Z. Consequently, Y ′ 6|= Def (q)X . Since all positive
occurrences of atom q in Def (q) are in the scope of negation and Y ′ = Z \ {q}, we
can conclude that Z 6|= Def (q)X by Lemma 27 again.
Now consider two cases. If X 6|= Γ2 then clearly X is not an answer for Γ2 .
It is not an answer set for Γ1 as well. Indeed, since X |= Γ1 , we have that, for some
q ∈ Q ∩ X, X 6|= Def (q). Consequently, Def (q)X = ⊥ and then X 6|= ∆, but, since
99
Z |= ∆ by (c) and Z ⊆ Y ⊆ X by (a), Z is a proper subset of X. Since Z |= ΓX
1
ΓX X X X
1 ∪ ∆. We have that Z |= Γ1 by (b), and then Z |= Γ2 by (c). Since Y 6|= Γ2 ,
l1 ∧ · · · ∧ lm → a1 ∨ · · · ∨ an (6.3)
100
to X, and ap+1 , . . . , an don’t. Then F X is equivalent to H X → (a1 ∨ · · · ∨ ap ). Now
consider formula Gi . If i > p then the consequent ai is not satisfied by X, but also
the antecedent is not: it contains an implication a1 → ai ; consequently GX
i is ⊤.
(H X ∧ (a1 → ai ) ∧ · · · ∧ (ap → ai )) → ai .
It is not hard to see that this formula is classically equivalent to F X , so that the
claim easily follows.
101
Chapter 7
A New Definition of an
Aggregate
102
as a propositional formula, reducing the syntax to the one of propositional theories
proposed in Chapter 6. This provides a way to apply theorems about proposi-
tional theories (Section 6.3) to programs with aggregates. For instance, the proof
of Proposition 17 uses several of such theorems.
oph{F1 = w1 , . . . , Fn = wn }i ≺ N (7.1)
where
A (ground) aggregate is a formula with aggregates of the form (7.1). A theory with
aggregates is a set of formulas with aggregates.
103
Recall that a PDB-aggregate was introduced in Section 3.3 as an expression of
the form (7.1) also, except that F1 , . . . , Fn are literals; similarly, in FLP-aggregates
(Section 3.4), F1 , . . . , Fn are conjunctions of atoms.
We extend the recursive definition of satisfaction for propositional formulas
to formulas with aggregates, by adding a clause for aggregates: a coherent set X of
atoms satisfies an aggregate (7.1) if op(W ) ≺ N for the multiset W consisting of
the weights wi (1 ≤ i ≤ n) such that X |= Fi . As usual, we say that X satisfies a
theory Γ if X satisfies all formulas in Γ.
For example,
6 1
sumh{p = 1, q = 1}i = (7.2)
As in the case of propositional formulas, we can see the reduct process for a formula
with aggregates as the result of replacing with ⊥ each maximal subformula not
satisfied by X.
As usual, the reduct ΓX of a theory Γ with aggregates relative to a coherent
set X of atoms is the set of reducts F X for all F ∈ Γ. Set X is an answer set for Γ
if X is a minimal model of ΓX .
104
Consider, for instance, the theory Γ consisting of one formula
Set {q} is an answer set for Γ. Indeed, since both the antecedent and consequent
of (7.3) are satisfied by {q}, Γ{q} is
The antecedent of the implication above is satisfied by any set of atoms, so the
whole formula is equivalent to q. Consequently, {q} is the minimal model of Γ{q} ,
and then an answer set for Γ.
(q → p) ∧ (p → q). (7.5)
Similarly,
sumh{p = 1, q = 1}i = 1 (7.6)
is
(p ∨ q) ∧ ¬(p ∧ q). (7.7)
105
Even though (7.2) can be seen as the negation of (7.2), the negation of (7.7) is not
strongly equivalent to (7.5) (although they are classically equivalent). This shows
that it is generally incorrect to “move” a negation from a binary relation symbol
(such as 6=) in front of the aggregate as the unary connective ¬.
Next proposition shows that this understanding of aggregates as proposi-
tional formulas is equivalent to the semantics for theories with aggregates of the
previous section.
Proposition 15. Let A be an aggregate of the form (7.1), and let G be the corre-
sponding formula (7.4). For any coherent sets X and Y of atoms,
(b) Y |= GX iff Y |= AX .
106
op(W1 ) ≺ N is true. The definition of an antimonotone aggregate is similar, with
W1 ⊆ W2 replaced by W2 ⊆ W1 .
For instance,
sumh{p = 1, q = 1}i > 1. (7.8)
is monotone, and
sumh{p = 1, q = 1}i < 1. (7.9)
(p ∨ q) ∧ (p → q) ∧ (q → p),
(p ∨ q) ∧ q ∧ p
107
and then to q ∧ p. In the case of the antimonotone aggregate (7.9), the formula
((p ∧ q) → ⊥) ∧ (p → q) ∧ (q → p)
¬(p ∧ q) ∧ ¬p ∧ ¬q,
7.4 Example
We consider the following variation of the combinatorial auction problem [Baral and
Uyan, 2001], which can be naturally formalized using an aggregate that is neither
monotone nor antimonotone.
Joe wants to move to another town and has the problem of removing all his
bulky furniture from his old place. He has received some bids: each bid may be for
one piece or several pieces of furniture, and the amount offered can be negative (if
the value of the pieces is lower than the cost of removing them). A junkyard will
take any object not sold to bidders, for a price. The goal is to find a collection of
bids for which Joe doesn’t lose money, if there is any.
108
Assume that there are n bids, denoted by atoms b1 , . . . , bn . We express by
the formulas
bi ∨ ¬bi (7.12)
(1 ≤ i ≤ n) that Joe is free to accept any bid or not. Clearly, Joe cannot accept
two bids that involve the selling of the same piece of furniture. So, for every such
pair i, j of bids, we include the formula
¬(bi ∧ bj ). (7.13)
Next, we need to express which pieces of the furniture have not been given to bidders.
If there are m objects we can express that an object i is sold by bid j by adding the
rule
bj → si (7.14)
to our theory.
Finally, we need to express that Joe doesn’t lose money by selling his items.
This is done by the aggregate
Since theories with aggregates generalize disjunctive problems, the problem of the
existence of an answer set for a theory with aggregates clearly is ΣP2 -hard. We need
109
to check in which class of the computational hierarchy this problem belongs.
If we represent aggregates as formulas (7.4) then a theory with aggregates
is just a propositional theory, and we saw in Section 6.4 that this problem is in
class ΣP2 . However, we should consider that a formula (7.4) can be exponentially
larger that the original aggregate, so this is generally not a good way of representing
aggregates from a computational point of view.
We can avoid the growth in size by using the semantics of Section 7.1, and
it turns out that the computation is not harder than for propositional theories.
Proposition 18. If, for every aggregate, computing op(W ) ≺ N requires polynomial
time, then the existence of an answer set for a theory with aggregates is a ΣP2 -
complete problem.
For a logic program with nested expressions, if the heads are atoms or ⊥ then
the existence of an answer set is NP-complete. If we allow nonnested aggregates in
the body, for instance by allowing rules
A1 ∧ · · · ∧ An → a
110
op(W ) ≺ N requires polynomial time then the problem of the existence of an answer
set for theories of this kind is an NP-complete problem.
Similar results have been independently proven in [Calimeri et al., 2005] for
FLP-aggregates.
Recall that a weight constraint L ≤ S has the same intuitive meaning of sumhSi ≥
L, and S ≤ U has the same intuitive meaning of sumhSi ≤ U . Next theorem shows
that there is indeed a relationship between them.
The theorem above and Theorem 1 shows that our concept of a general ag-
gregate captures the concept of weight constraints defined in [Niemelä and Simons,
2000], when all weights are nonnegative. When we consider negative weights, how-
ever, such correspondence doesn’t hold. (As mentioned in the introduction of this
chapter, our view of negative weights is equivalent to the one proposed in [Faber et
al., 2004].) For instance, we don’t consider (3.3) to be the same as (3.4), while —
under our semantics — program
p ← 0 ≤ {p = 2, p = −1}
111
While weight constraints with positive weights only are either monotone or
antimonotone, this is not the case when negative weights are allowed as in (7.15). In
particular, it may not be possible to represent an aggregate of this kind by a nested
expression.
Under the semantics of [Niemelä and Simons, 2000], the existence of an
answer set for a program Ω with weight constraints is an NP-complete problem
even in presence of negative weights, since they reduce nonmonotone aggregates
into monotone and antimonotone ones. On the other hand, under our semantics,
the same problem is in class Σ2P .
7.6.2 PDB-aggregates
The claim above is not necessarily true when either the aggregates are not
monotone or antimonotone, or when some formula in the aggregate is a negative
literal. Programs (3.10) and (3.12) are examples of programs of PDB-aggregates of
those two kinds where the semantics of Pelov et al. and ours give different answer
112
sets. For those programs, our semantics seems to give more intuitive results: for
us, (3.10) has the same answer sets of (3.11), and (3.12) has the same answer sets
of (3.13).
7.6.3 FLP-aggregates
We will now show that our semantics of aggregates is an extension of the semantics
proposed by Faber, Leone and Pfeifer [2004]. Under the syntax of propositional
formulas extended with aggregates, an FLP-program is a set of formulas
Theorem 6. The answer sets for a positive FLP-program under our semantics are
identical to its answer sets in the sense of [Faber et al., 2004].
7.7 Proofs
113
Proof. Formula F X is classically equivalent, in view of Lemma 20, to
^ ^ _ X
Fi → Fi .
I⊆{1,...,n} : op({wi : i∈I})6≺N i∈I i∈I
Proposition 15. Let A be an aggregate of the form (7.1), and let G be the corre-
sponding formula (7.4). For any coherent sets X and Y of atoms,
(b) Y |= GX iff Y |= AX .
Proof. We start with part (a). Consider formula HI (where I ⊆ {1, . . . , n}):
^ _
Fi → Fi .
i∈I i∈I
For each coherent set X of atoms there is exactly one set I such that X 6|= Hi : the
set IX that consists of the i’s such that X |= Fi . Consequently,
For (b), if X 6|= A then X 6|= G by (a) and then both reducts are ⊥. Oth-
erwise, by (a) again, X |= G, and then GX is equivalent, in view of Lemma 28,
to (7.17). By (a) again, this formula is satisfied by the same consistent sets of atoms
that satisfy
oph{F1X = w1 , . . . , FnX = wn }i ≺ N,
114
which is AX .
Proof. Consider the case of a monotone aggregate first. Let G be (7.4), and H
be (7.18). It is easy to verify that H entails G. The opposite direction remains.
Assume H, and we want to derive every conjunctive term
_
Fi (7.19)
i∈I
115
^ ^ _
H⇒ Fi → Fi
I ′ ⊆I i∈I ′ i∈I ′
^ ^ ^ _
⇔ Fi ∧ ¬Fi → Fi
I ′ ⊆I i∈I ′ i∈I ′ \I i∈I
_ ^ ^
⇔ Fi ∧ ¬Fi → D.
I ′ ⊆I i∈I ′ i∈I ′ \I
Proof. Consider the case of a monotone aggregate first. Let G be (7.4), and H
be (7.18). In view of Proposition 8, it is sufficient to show that GX is equivalent to
H X in classical logic for all sets X. If X 6|= H then also X 6|= G by Lemma 29, so
that both reducts are ⊥. Otherwise (X |= H), by the same lemma, X |= G. Then,
116
by Lemma 28, GX is classically equivalent to (7.17). On the other hand, it is easy
to verify, by applying Lemma 20 to H X twice, that H X is classically equivalent to
^ _
FiX .
For the proof of Proposition 17, let Γ be the theory consisting of formu-
las (7.12)–(7.15).
Lemma 30. For any answer set X of Γ, X contains an atom si iff X contains an
atom bj such that bid j involves selling object i.
and
preserving the answer sets. It follows that every answer set for Γ must satisfy
formulas (7.20), and the claim immediately follows.
117
(a) the relative bids involve selling disjoint sets of items,
(b) the sum of the money earned from the bids is greater than the money spent
giving away the remaining items.
Proof. Take any answer set X of Γ. Since X satisfies rules (7.13) of Γ, condition (a)
is satisfied. Condition (b) is satisfies as well, because X contains exactly all atoms si
sold in some bids by Lemma 30, and since X satisfies aggregate (7.15) that belongs
to Γ.
Now consider a solution of Joe’s problem. This determines which atoms
of the form bi belongs to a possible corresponding answer set X. Consequently,
Lemma 30 determines also which atoms of the form sj belong to X, reducing the
candidate answer sets X to one. We need to show that this X is indeed an answer
set for Γ. The reduct ΓX consists of (after a few simplifications)
(iii) (by Lemma 30) implications (7.14) such that both bj and si belong to X, and
Notice that (i)–(iii) together are equivalent to X, so that every every proper subset
of X doesn’t satisfy ΓX . It remains to show that X |= ΓX . Clearly, X satisfies
(i)–(iii). To show that X satisfies (iv) it is sufficient, by Lemma 24 (consider (7.15)
as a propositional formula), to show that X satisfies (7.15): it does that by hypoth-
esis (b).
118
7.7.1 Proof of Propositions 18 and 19
Lemma 31. If, for every aggregate, computing op(W ) ≺ N requires polynomial
time, then
(a) checking satisfaction of a theory with aggregates requires polynomial time, and
(b) computing the reduct of a theory with aggregates requires polynomial time.
Proof. Part (a) is easy to verify by structural induction. Computing the reduct
essentially consists of checking satisfaction of subexpressions of each formula of the
theory. Each check doesn’t require too much time by (a). It remains to notice that
each formula with aggregates has a linear number of subformulas.
Proposition 18. If, for every aggregate, computing op(W ) ≺ N requires polynomial
time, then the existence of an answer set for a theory with aggregates is a ΣP2 -
complete problem.
Proof. Hardness follows from the fact that theories with aggregates are a generaliza-
tion of theories without aggregates. To prove inclusion, consider that the existence
of an answer set for a theory Γ is equivalent to:
if Y ⊆ X then Y |= ΓX iff X = Y
Lemma 32. Let F be a formula with aggregates containing monotone and anti-
monotone aggregates only, and no implications different from negations. For any
consistent sets X, Y and Z such that Y ⊆ Z, if Y |= F X then Z |= F X .
119
function verifyAS(Γ, X}
if X 6|= Γ then return false
∆ := {F X → a : F → a ∈ Γ and X |= a}
Y := ∅
while there is a formula G → a ∈ ∆ such that Y |= G and a 6∈ X
Y := Y ∪ {a}
end while
if Y = X then return true
return false
Proof. Let G be F with each monotone aggregate replaced by (7.10) and each an-
timonotone aggregate replaced by (7.11). It is easy to verify that G is a nested
expression. Nested expressions have all negative occurrences of atoms in the scope
of negation, so if Y |= GX then Z |= GX by Lemma (27). It remains to notice that
F X and GX are satisfied by the same sets of atoms by Propositions 16 and 15.
Proof. NP-hardness follows from the fact that theories with aggregates are a gener-
alization of traditional programs, for which the same problem is NP-complete. For
inclusion in NP, it is sufficient to show that the time required to check if a coherent
set X of atoms is an answer set for Γ. An algorithm that does this test is in Fig-
ure 7.1. It is easy to verify that it is a polynomial time algorithm. It remains to
120
prove that it is correct. If X 6|= Γ then it is trivial. Now assume that X |= Γ. It is
sufficient to show that
(b) the last value of Y (we call it Z) is the unique minimal model of ∆.
The first set is ∆. The second set (which includes the case in which a = ⊥) is a set
of ⊥ → ⊥. Indeed, each aX = ⊥, and since X |= Γ, X doesn’t satisfy any F and
then F X = ⊥.
For part (b) it is easy to verify that the while loop iterates as long as Y 6|= ∆,
so that Z |= ∆. Now assume, in sake of contradiction, that there is a set Z ′ that
satisfies ∆ and that is not a superset of Z. Then consider, in the algorithm, the last
value of Y that is a subset of Z ′ , and the atom a added to that Y (that is, a 6∈ Z ′ ).
This means that ∆ contains a formula G → a such that Y |= G. Recall that G
stands for a formula of the form F X , where F is a formula with aggregates with
monotone and antimonotone aggregates only and without implications that are not
negations. Consequently, by Lemma 32, Z ′ |= G. On the other hand, a 6∈ Z ′ , so
Z ′ 6|= G → a, contradicting the hypothesis that Z ′ is a model of ∆.
Lemma 33. Let F (u) and G(u) be two formulas that are AND-OR combinations
of ⊤, ⊥ and atoms from the list of atoms u. If, for any list H of formulas of the
same arity of u, F (H) is classically equivalent to G(H), then, for the same lists H
of formulas, F (H) is strongly equivalent to G(H).
121
Proof. In view of Proposition 8, it is sufficient to show that, for every coherent set
X of atoms, (F (H))X is classically equivalent to (G(H))X . By Lemma 20, (F (H))X
is classically equivalent to F (HX ), where HX is the result of applying the reduct
operation to each element of H. Similarly, (G(H))X is classically equivalent to
G(HX ). It remains to notice that F (HX ) is classically equivalent to G(HX ) by
hypothesis.
Lemma 34. For every weight constraints L ≤ S and S ≤ U and any coherent set
X of atoms,
122
For part (b), the reasoning is similar, except that we want [S ≤ U ] and (7.1)
(corresponding to aggregate sumhSi ≤ U ) to be written as AND-OR combinations
of not F1 , . . . , not Fn , ⊤ and ⊥. Formula [S ≤ U ], which has the form (written as a
propositional formula)
_ ^
¬ Fi
I⊆{1,...,n}:··· i∈I
is strongly equivalent to
^ _
¬Fi .
I⊆{1,...,n}:··· i∈I
Lemma 35. For any nested expression F without negations and any two sets X
and Y of atoms such that Y ⊆ X, Y |= F X iff Y |= F.
Lemma 36. For any FLP-aggregate A and any set X of atoms, if X |= A then
Y |= AX iff Y |= A.
Proof. Let A have the form (7.1). Since X |= A, AX has the form
oph{F1X = w1 , . . . , FnX = wn }i ≺ N.
123
In case of FLP-aggregates, each Fi is a conjunction of atoms. Then, by Lemma 35,
Y |= FiX iff Y |= Fi . The claim immediately follows from the definition of satisfac-
tion of aggregates.
Theorem 6. The answer sets for a positive FLP-program under our semantics are
identical to its answer sets in the sense of [Faber et al., 2004].
Proof. It is easy to see that if X 6|= Π then X 6|= ΠX and X 6|= ΠX , so that X is not
an answer set under either semantics. Now assume that X |= Π. We will show that
the two reducts are satisfied by the same subsets of X. It is sufficient to consider
the case in which Π contains only one rule
A1 ∧ · · · ∧ Am → a1 ∨ · · · ∨ an . (7.22)
⊥ → (a1 ∨ · · · ∨ an )X .
AX X X
1 ∧ · · · ∧ Am → (a1 ∨ · · · ∨ an ) .
These two reducts are satisfied by the same subsets of X by Lemmas 35 and 36.
This proof refers to the semantics of PDB-aggregates reviewed in Section 3.3. Given
a PDB-aggregate of the form (7.1) and a coherent set X of literals, by IX we denote
the set {i ∈ {1, . . . , n} : X |= Fi }.
Lemma 37. For each PDB-aggregate of the form (7.1), a set X of atoms satisfies
a formula of the form G(I1 ,I2) iff I1 ⊆ IX ⊆ I2 .
124
Proof.
It is easy to verify that Atr contains a disjunctive term G(I1 ,I2 ) with I1 ⊆ IX ⊆ I2
iff Atr contains disjunctive term G(IX ,IX ) . Consequently,
(a)
_
G(I,{1,...,n})
I∈{1,...,n}:op(WI )≺N
if A is monotone, and to
(b)
_
G(∅,I)
I∈{1,...,n}:op(WI )≺N
if it is antimonotone.
125
Proof. To prove (a), assume that A is monotone. Then, if Atr contains a disjunctive
term G(I1 ,I2 ) then it contains the disjunctive term G(I1 ,{1,...,n}) as well. Consider also
that formula G(I1 ,{1,...,n}) entails G(I1 ,I2 ) . Then we can drop all disjunctive terms of
the form G(I1 ,I2) with I2 6= {1, . . . , n}. Formula Atr becomes
_
G(I1 ,{1,...,n}) .
I1 ⊆{1,...,n}: for all I such that I1 ⊆ I ⊆ {1, . . . , n}, op(WI ) ≺ N
• F1 , . . . , Fn , ⊤, ⊥, if A is monotone, and
About Atr , this follows by Lemma 39. Indeed, each G(I,{1,...,n}) is a (possibly empty)
conjunction of terms of the form Fi , and each G(∅,I) is a (possibly empty) conjunction
of terms of the form Fi . About (7.4), this has already been shown in the proof of
Theorem 5.
126
Chapter 8
127
class of rules syntactic form
UR unary rules:
a ← (also written as simply a) and a ← b
PR positive rules:
a ← b1 , . . . , bn
TR traditional rules:
a ← b1 , . . . , bn , not c1 , . . . , not cm
TRC TRs + constraints:
TRs and ← b1 , . . . , bn , not c1 , . . . , not cm
DR disjunctive rules:
a1 ; . . . ; ap ← b1 , . . . , bn , not c1 , . . . , not cm
NDR negational disjunctive rules:
a1 , . . . ; ap ; not d1 ; . . . ; not dq ← b1 , . . . , bn , not c1 , . . . , not cm
RNE rules with nested expressions:
F ←G
PF propositional formulas:
H
Figure 8.1: A classification of logic programs under the answer set semantics. Here
a, b, c, d stand for propositional atoms. F , G stand for nested expressions without
classical negation (that is, expressions formed from atoms, ⊤ and ⊥, using con-
junction (,), disjunction (;) and negation as failure (not), see Section 2.2.1), and H
stands for an arbitrary propositional formula.
128
Another comparison criterion is based on the computational complexity of
the problem of the existence of an answer set. We pass, in the complexity hier-
archy, from P in case of UR- and PR-programs, to NP in case of TR- and TRC-
programs [Marek and Truszczyński, 1991], and finally to ΣP2 for more complex kinds
of programs [Eiter and Gottlob, 1993].
A third criterion consists in checking whether every rule in R is strongly
equivalent [Lifschitz et al., 2001] (see Section 3.7) to an R′ -program. From this
point of view, PR is essentially more expressive than UR: we will see at the end of
Section 8.2 that a ← b, c is not strongly equivalent to any set of unary rules. Fur-
thermore, TRC and DR are essentially different from each other, since no program
in TRC is strongly equivalent to the rule p; q in DR [Turner, 2003, Proposition 1].
A fourth comparison criterion is based on the existence of a translation from
R-programs to R′ -programs that is not only sound (that is, preserves the program’s
answer sets) but is also modular: it can be applied to a program rule-by-rule. For
instance, Janhunen (2000) showed that there is no modular translation from PR to
UR, and no modular translation from TR to PR.1 On the other hand, RNE can
be translated into NDR by a modular procedure similar to converting formulas to
conjunctive normal form [Lifschitz et al., 1999].
The main theorem of this chapter shows that under some general conditions,
the last two criteria — the one based on strong equivalence and the existence of a
sound modular translation — are equivalent to each other. This offers a method
to prove that there is no modular translation from R to R′ by finding a rule in
R that is not strongly equivalent to any R′ -program. For instance, in view of the
Proposition 1 from [Turner, 2003] mentioned above, no modular translation exists
from DR to TRC.
To apply the main theorem to other cases, we need to learn more about the
1
His results are actually stronger, see Section 8.1 below.
129
strong equivalence relations between a single rule of a language and a set of rules. We
show that for many rules r in NDR, any NDR-program that is strongly equivalent to
r contains a rule that is at least as “complex” as r. This fact will allow us to conclude
that all classes UR, PR, TR, TRC, DR and NDR are essentially different from each
other in terms of strong equivalence. In view of the main theorem, it follows that
they are essentially different from each other in the sense of the modular translation
criterion as well.
Finally, we show how to apply our main theorem to programs with weight
constraints [Simons et al., 2002] (Section 2.2.2). As a result, we find that it is not
possible to translate programs with weight constraints into programs with monotone
cardinality atoms [Marek et al., 2004] in a modular way (unless the translation
introduces auxiliary atoms).
The chapter continues with the statement of our main theorem (Section 8.1).
In Section 8.2, we study the expressiveness of subclasses of NDR in terms of strong
equivalence and modular translations. We move to the study of cardinality con-
straints in Section 8.3. The proofs of all claims of this chapter are in Section 8.4.
• for every formula r ∈ Dom(f ), f (r) is a theory such that every atom occurring
in it occurs in r also.
S
A transformation f is sound if, for every theory Π ⊆ Dom(f ), Π and r∈Π f (r) have
the same answer sets.
For example, the transformation defined in the proof of Proposition 7 from [Lif-
schitz et al., 1999], which eliminates nesting from a program with nested expressions,
130
is a sound transformation. For instance, for this transformation f ,
f (a ← b; c) = {a ← b, a ← c}.
and f (r) = {r} for the rules r in NDR that contains at least one nonnegated atom
in the head. On the other hand, the familiar method of eliminating constraints from
a program that turns ← p into q ← p, not q is not a transformation in the sense of
our definition, because it introduces an atom q that doesn’t occur in ← p.
Other definitions of a modular transformation allow the the introduction
of auxiliary atoms. This is, for instance, the case of the definitions in [Janhunen,
2000], and of the translation [Ω]nn of a program with nested expressions into a
traditional program (see Section 5.1). These two works are also different from the
work described in this chapter in that they take into account the computation time
of translation algorithms.
This is the theorem that relates strong equivalence and modular transforma-
tions:
Theorem 7. For every transformation f such that Dom(f ) contains all unary rules,
f is sound iff, for each r ∈ Dom(f ), f (r) is strongly equivalent to r.
Our definition of transformation requires that all atoms that occur in f (r)
occur in r also. The following counterexample shows that without this assumption
the assertion of Theorem 7 would be incorrect. Let p and q be two atoms, and, for
131
each rule r = F ← G in RNE, let f1 (r) be
F ← G, not p
F ← G, not q
Fp↔q ← Gp↔q , not not p, not not q.
where Fp↔q and Gp↔q stand for F and G with all the occurrences of p replaced by
q and vice versa. Note that f1 is not a transformation as defined in this chapter
since q occurs in f1 (p ← ⊤). It can also be shown that p ← ⊤ and f1 (p ← ⊤) are
not strongly equivalent. However, the “transformation” is sound:
S
Proposition 21. For any program Π, Π and r∈Π f1 (r) have the same answer sets.
with p > 0 and where a1 , . . . , ap are all distinct. We denote the set of rules of this
form by NBR. For each rule r of the form (8.1), f2 (r) is defined as
{ai ← not a1 , . . . , not ai−1 , not ai+1 , . . . , not ap , not c1 , . . . , not cm : 1 ≤ i ≤ p}.
For instance, f2 (p; q) = {p ← not q , q ← not p}. It is easy to see that this program
is not strongly equivalent to p; q. However, this transformation is sound:
S
Proposition 22. For any program Π ⊆ NBR, Π and r∈Π f2 (r) have the same
answer sets.
132
If r is
define
head + (r) = {a1 , . . . , ap } head − (r) = {d1 , . . . , dq }
body + (r) = {b1 , . . . , bn } body − (r) = {c1 , . . . , cm }.
We say that r is basic if any two of these sets, except possibly for the pair head + (r),
head − (r), are disjoint.
Any nonbasic rule can be easily simplified: it is either strongly equivalent to
the empty program or contains redundant terms in the head. A basic rule, on the
other hand, cannot be simplified if it contains at least one nonnegated atom in the
head:
Theorem 8. Let r be a basic rule in NDR such that head + (r) 6= ∅. Every program
subset of NDR that is strongly equivalent to r contains a rule r ′ such that
This theorem shows us that for most basic rules r (the ones with at least one
positive element in the head), every program strongly equivalent to r must contain
a rule that is at least as “complex” as r.
Given two subsets R and R′ of RNE, a (modular) translation from R to R′
is a transformation f such that Dom(f ) = R and f (r) is a subset of R′ for each
r ∈ Dom(f ). Using Theorems 7 and 8, we can differentiate between the classes of
rules in Figure 8.1 in terms of modular translations:
Proposition 23. For any two languages R and R′ among UR, PR, TRC, TR, DR
and NDR such that R′ ⊂ R, there is no sound translation from R to R′ .
133
Theorems 7 and 8 allow us also to differentiate between subclasses of NDR
described in terms of the sizes of various parts of the rule. Define, for instance PBRi
(“positive body of size i”) as the set of rules r of NDR such that |body + (r)| ≤ i. We
can show that, for every i ≥ 0, there is no sound translation from PBRi+1 to PBRi
(or even from PBRi+1 ∩ PR to PBRi ). Similar properties can be stated in terms of
the sizes of body − (r), head + (r) and head − (r).
Another consequence of Theorem 8 is in terms of (absolute) tightness of
a program [Erdem and Lifschitz, 2003; Lee and Lifschitz, 2003]. Tightness is an
important property of logic programs: if a program is tight then its answer sets can
be equivalently characterized by the satisfaction of a set of propositional formulas
of about the same size. Modular translations usually don’t make nontight programs
tight:
Proposition 24. Let R be any subset of NDR that contains all unary rules, and
let f be any sound translation from R to NDR. For every nontight program Π ⊆ R
S
consisting of basic rules only, r∈Π f (r) is nontight.
Let CCR denote the set of all rules with cardinality constraints (Section 2.2.2).
A straightforward generalization of the definition of a transformation allows us to
talk about sound translations between subclasses of CCR, and also between a sub-
134
class of CCR and a subclass of PT. The concept of (modular) transformations and
translations can be extended to programs with cardinality constraints: we can have
translations between subclasses of CCR, and from/to subclasses of PT. The defini-
tion of the soundness for those translations is straightforward as well. For instance,
the two translations Ω 7→ [Ω] and Ω 7→ [Ω]nd from CCR to RNE defined in Chapter 4
are modular and sound.
Another class of programs similar to programs with cardinality constraints
— programs with monotone cardinality atoms — has been defined in [Marek et al.,
2004]. The results of that paper show that rules with monotone cardinality atoms are
essentially identical to rules with cardinality constraints that don’t contain negation
as failure; we will denote the set of all such rules by PCCR (“positive cardinality
constraints”).
First of all, we show how programs with cardinality constraints are related
to the class NDR. Let SNDR (Simple NDR) be the language consisting of rules of
the form
a; not d1 ; . . . ; not dq ← b1 , . . . , bn , not c1 , . . . , not cm (8.2)
and
← b1 , . . . , bn , not c1 , . . . , not cm . (8.3)
Proposition 25. There exist sound translations from SNDR to CCR, and back.
Proposition 26. There exist sound translations from VSNDR to PCCR, and back.
135
Proposition 27. There is no sound translation from CCR to PCCR.
Since the class PCCR is essentially identical to the class of rules with mono-
tone cardinality atoms, we conclude that programs with cardinality constraints are
essentially more expressive than programs with monotone cardinality atoms.
8.4 Proofs
Lemma 40. Let A be the set of atoms occurring in theories Γ1 and Γ2 . Γ1 and Γ2
are strongly equivalent iff, for each Y ⊆ A, ΓY1 and ΓY2 .
Recall also that ΓY1 contains atoms from Y only, and similarly for ΓY2 .
We will also use the following two lemmas. The first one is immediate from
the characterization of strong equivalence based on equivalence in the logic of here-
and-there from [Lifschitz et al., 2001]. The second comes from Lemma 4 from [Lif-
schitz et al., 2001].
Lemma 42. Two theories Γ1 and Γ2 are strongly equivalent iff, for every program
Π ⊆ UR, Γ1 ∪ Π and Γ2 ∪ Π have the same answer sets.
136
8.4.2 Proof of Theorem 7
Theorem 7. For every transformation f such that Dom(f ) contains all unary
rules, f is sound iff, for each r ∈ Dom(f ), f (r) is strongly equivalent to r.
The proof from right to left is a direct consequence of Lemma 41: if f (r) is
strongly equivalent to r for every formula r ∈ R, then for any Γ ⊆ Dom(f ), Π and
S
r∈Γ f (r) are strongly equivalent, and consequently have the same answer sets.
In the proof from left to right, we first consider the case when r is a unary
rule, and then extend the conclusion to arbitrary formulas. In the rest of this section,
f is an arbitrary sound transformation such that Dom(f ) contains all unary rules.
By a and b we denote distinct atoms.
Lemma 43. For every fact a, {a} and f (a) are strongly equivalent.
Proof. In view of Lemma 40, we need to show that (i) f (a){a} is equivalent to {a},
and (ii) f (a)∅ is equivalent to ⊥. Since {a} is an answer set for {a}, it is an answer
set for f (a), so that (i) follows from Lemma 25. Since ∅ is not an answer set for
f (a), it follows we get that ∅ 6|= f (a)∅ . Since f (a)∅ doesn’t contain atoms, (ii) must
hold.
Lemma 44. For every formula r and fact a, {r, a} and f (r) ∪ {a} have the same
answer sets.
Proof. In view of Lemma 43, f (r) ∪ {a} and f (r) ∪ f (a) have the same answer sets,
and the same holds for {r, a} and f (r) ∪ f (a) by hypothesis.
137
Proof. First of all, since the empty set in the only answer set for {r} and then
for f (r), (i) is clearly true by Lemma 25. For (ii), we need to show that f (r){a}
is satisfied by both ∅ and {a}. Consider the theory consisting of rule r plus fact
a. Since {a} is an answer set for {r, a}, it is an answer set for f (r) ∪ {a} also by
Lemma 44. Consequently, by Lemma 25, f (r){ a} ∪ {a} is classically equivalent to
{a} from which we derive that {a} |= f (r){ a}. On the other hand, since {a} is not
an answer set for f (r), so also ∅ |= f (r){ a}.
Proof. The proof of the first two claims is similar to the one of Lemma 45. To
prove (iii), it is sufficient to show that {b} 6|= f (r). Since {b} is not an answer set for
{r, b}, it is not an answer set for f (r) ∪ {b} either by Lemma 44. But ∅ 6|= (f (r) ∪
{b}){b} because ∅ 6|= {b}{b} ; consequently {b} 6|= (f (r) ∪ {b}){b} . Since {b} |= {b}{b} ,
it follows that {b} 6|= f (r){b} , and then that {b} 6|= f (r) by Lemma 24.
Lemma 47. For every rule r of the form a ← b, f (r){a,b} is classically equivalent
to {r}{a,b} .
Proof. We need to show that the only subset of {a, b} not satisfying f (r){a,b} is {b},
that is
138
(iv) ∅ |= f (r){a,b} .
First of all, set {a, b} is an answer set for {r, b}, and consequently for f (r) ∪ {b} also
by Lemma 44. Consequently, by Lemma 25,
From it we derive that {b} 6|= (f (r) ∪ {b}){a,b} , and consequently (i). From (8.5) we
also derive (ii) and then that {a, b} |= (f (r) ∪ {a}){a,b} . Notice that {a, b} is not an
answer set for f (r) ∪ {a} because it is not an answer set for {r, a} and by Lemma 44.
Consequently there is a proper subset of {a, b} that satisfies (f (r) ∪ {a}){a,b} . Such
subset can only be {a} because it is the only one that satisfies {a}{a,b} . Claim (iii)
immediately follows.
The proof of (iv) remains. Let r ′ be b ← a. Claims (i) and (ii) determine
which subsets of {a, b} satisfy (f (r) ∪ f (r ′ )){a,b} : from part (i) applied to both r and
r ′ we get that {a, b} satisfies this theory, while {b} (by part (ii) applied to r) and
{a} (by part (ii) applied to r ′ ) don’t. On the other hand {a, b} is not an answer set
for {r, r ′ } and then for f (r) ∪ f (r ′ ) by the soundness hypothesis. We can conclude
that ∅ |= (f (r) ∪ f (r ′ )){a,b} from which (iv) follows.
S
Lemma 48. For every unary program Π, Π and r∈Π f (r) are strongly equivalent.
Proof. In view of Lemma 41, it is sufficient to show that for each unary rule r, {r}
and f (r) are strongly equivalent. For rules that are facts, this is proven Lemma 43.
For rules r of the form a ← a, it follows by Lemma 45 and Lemma 40. Similarly,
for rules of the form a ← b, it follows by Lemmas 46, 47 and Lemma 40.
Now we are ready to prove the second part of the main theorem: for any
formula r ∈ Dom(f ), f (r) and {r} are strongly equivalent. By Lemma 42, it is
sufficient to show that, for each unary program Π, Π ∪ {r} and Π ∪ f (r) have the
same answer sets. First we notice that Π ∪ {r} and r′ ∈Π∪{r} f (r ′ ) have the same
S
139
answer sets since Π ∪ {r} ⊆ Dom(f ) and for the soundness of the transformation.
Then we can see that r′ ∈Π∪{r} f (r ′ ) = r′ ∈Π f (r ′ )∪f (r). Finally, r′ ∈Π f (r ′ )∪f (r)
S S S
and Π ∪ f (r) have the same answer sets because, by Lemma 48, programs Π and
′
S
r ′ ∈Π f (r ) are strongly equivalent.
ΠX iff Yp↔q satisfies (ΠX )p↔q . Since Yp↔q ⊆ X and |Yp↔q | = |Y |, we can conclude
that X is a minimal set satisfying ( r∈Π f1 (r))X iff it is a minimal set satisfying
S
ΠX .
S
Proposition 22. For any program Π ⊆ NBR, Π and r∈Π f2 (r) have the same
answer sets.
satisfied by the same sets of atoms, so that if X 6|= Π then X is not an answer set
for neither programs. Assume now that X |= Π. Then, X |= Π′ . It is then not hard
to check that (P i′ )X is equivalent to a set of atoms Y , consisting of atoms a of X
such that there is a rule r in Π with head + (r) ∩ X = {a} and body − (r) ∩ X = ∅.
So X is an answer set for Π′ iff Y = X. It remains to show that X is an answer
set for Π′ iff Y = X. It is easy to verify that ΠX is Y plus a set of disjunctions of
two or more atoms of X. If Y = X then clearly ΠX is equivalent to Y . If not, let a
be an atom of X but not of X, and let Z be X \ {a}. It is not hard to verify that
140
Z |= ΠX , since all elements of Y belong to Z, and, for each disjunction of two or
more atoms of X in ΠX , at least one of them belongs to Z. From this we conclude
that X is an answer set for Π iff Y = X.
For simplicity, we consider the definition of an answer set for NDR programs as
defined in [Lifschitz and Woo, 1992], in which the reduct ΠX consists of the rule
(head + (r) here stands for the disjunction of its elements, body + (r) for their conjunc-
tion) for every rule r in Π such that head − (r) ⊆ X and body − (r) ∩ X = ∅. It is easy
to check that this definition of a reduct is equivalent to the definition of a reduct for
programs with nested expressions (they are satisfied by the same sets of atoms, see
Section 3.1). Consequently, the characterization of strong equivalence based on the
reduct of [Turner, 2003] reviewed in Section 3.7 also is correct with this definition
of a reduct:
Lemma 49. Two programs Π1 and Π2 subsets of NDR are strongly equivalent iff,
for every consistent set Y of literals,
Theorem 8. Let r be a basic rule in NDR such that head + (r) 6= ∅. Every program
subset of NDR that is strongly equivalent to r contains a rule r ′ such that
141
Proof. Let Π be a program strongly equivalent to r. Let X be head + (r)∪head − (r)∪
body + (r), and let Y be body + (r). Then r X is (8.6). By Lemma 49, since X |= r X
(recall that head + (r) is nonempty by hypothesis) then X |= ΠX , and since Y 6|= r X
it follows that Y 6|= ΠX . Consequently, there is a rule of Π — the rule r ′ of the
theorem’s statement — such that X |= (r ′ )X and Y 6|= (r ′ )X . From this second fact,
(r ′ )X is nonempty so it is
Here we provide the definition of a tight program for programs in NDR [Lee and
Lifschitz, 2003].2 This class of logic programs is important because there is a poly-
2
The definition of tightness of that paper is slightly more general.
142
nomial time reduction from tight NDR-programs into a set of propositional formulas
(called the “completion” of the program [Clark, 1978; Lee and Lifschitz, 2003]) such
that the answer sets of the program are identical to the models of the completion.
That is, the problems of the existence of an answer set for a tight program is in
class NP, even if the program contains disjunction in the head.
For any program Π ∈NDR, consider functions g from the atoms occurring in
Π into the set of natural number. Program Π is tight if there is a function g such
that, for every rule r ∈ Π, for each element a ∈ body + (r) and each b ∈ head + (r),
g(a) < g(b).
For instance,
p←q
q←r
is tight: take g(p) = 0, g(q) = 1 and g(r) = 2. Program
p←q
q←p
Proposition 23. For any two languages R and R′ among UR, PR, TR, TRC, DR
and NDR such that R′ ⊂ R, there is no sound translation from R to R′ .
143
By Theorem 7, we can conclude the claim between UR and PR, PR and TR, TRC
and DR, and finally between DR and NDR.
The proof between TR and TRC remains. Consider the TRC rule r with
an empty head and an empty body. By Theorem 7, it is sufficient to show that no
subset of TR that contains atoms from r only is strongly equivalent to r. Notice
that r doesn’t contain atoms, and that the only subset of TR that doesn’t contain
atoms is the empty set; this set is not strongly equivalent to r.
Proposition 24. Let R be any subset of NDR that contains all unary rules, and
let f be any sound translation from R to NDR. For every nontight program Π ⊆ R
S
consisting of basic rules only, r∈Π f (r) is nontight.
All those proofs rely on the sound translations Ω 7→ [Ω] and Ω 7→ [Ω]nd of Section 4.2.
Proposition 25. There exist sound translations from SNDR to CCR, and back.
144
Proof. We define a translation f from SNDR to CCR as follows: if r has the
form (8.2) then f (r) is
{not d1 } ≤ 0, . . . , {not dq } ≤ 0,
and
⊥ ← b1 , . . . , bn , not c1 , . . . , not cm , not not d1 , . . . ; not not dq .
In rules of the first kind, we can move each term not not di to the head as a disjunctive
term not di , obtaining (8.2); in rules of the second kind, we can eliminate double
negation, obtaining a formula of the form (8.3).
Proposition 26. There exist sound translations from VSNDR to NCCR, and back.
145
It is easy to check that [f (r)] is strongly equivalent to {r}.
For the opposite direction, we take a rule r in NCCR and consider [{r}]nd .
If we rewrite the first of rules (4.10) as
the body of each rule [{r}]nd is the conjunction of terms of the form [C], where C is
a cardinality constraint without negation as failure. In this case, [C] doesn’t contain
negations nested in another negation, so that the rewriting of the body in “disjunc-
tive” normal form doesn’t contain terms of the form not not a. Consequently, [{r}]nd
can be written as terms of the form
and
⊥ ← b1 , . . . , bn , not c1 , . . . , not cm .
The rules of the first kind have the form (8.4), the other rules have the form (8.3).
146
Chapter 9
Causal logic [McCain and Turner, 1997] is a formalism for knowledge representation,
especially suited for representing effects of actions. Causal theories are syntactically
simple but also very general: they consist of causal rules of the form
F ⇐G (9.1)
where F and G are propositional formulas. Intuitively, rule (9.1) says that there is
a cause for F to be true if G is true. For instance, the causal rule
pt+1 ⇐ at (9.2)
F ⇐F
147
(“if F is true then there is a cause for this”) expresses, intuitively, that F is true by
default. In particular, the causal rule
pt ⇐ pt (9.3)
says that Boolean fluent p is normally true. The frame problem [McCarthy and
Hayes, 1969] is solved in causal logic using the rules
pt+1 ⇐ pt ∧ pt+1
(9.4)
¬pt+1 ⇐ ¬pt ∧ ¬pt+1 .
These rules express inertia: if a fluent p is true (false) at time t then normally it
remains true (false) at time t + 1.
The equivalence of two fluents or actions can be expressed by equivalences
in the head. For instance, to express that two actions constants a and a′ are syn-
onymous, we can use causal rule
at ↔ a′t ⇐ ⊤.
Rules of this kind are used to semantically characterize the relationship between
modules in the Modular Action Description language MAD [Lifschitz and Ren,
2006]. For instance, [Erdoğan and Lifschitz, 2006] used an equivalence of this kind
to state that pushing the box in the Monkey and Bananas domain is a specialization
of a more general action “move”.
The language of causal theories has been extended in [Giunchiglia et al.,
2004a] to handle multi-valued constants. In the extended language, a constant may
assume values from an arbitrary finite set, not necessarily “true” and “false”. For
instance, we can express the fact that object x is in location l with loc(x) = l.
One advantage of using loc(x) = l instead of the Boolean fluent loc(x, l) is that
loc(x) = l implicitly expresses the commonsense fact that every object is exactly in
one position.
148
In many useful causal rules, such as (9.2)–(9.4), the formula before the “⇐”
is a Boolean literal, a non-Boolean atom (such as loc(x) = l) or ⊥. Rules of this
kind are called definite. Such rules are important because a causal theory consisting
of definite rules can be converted into an equivalent set of propositional formu-
las [McCain and Turner, 1997; Giunchiglia et al., 2004a] , so that its models can
be computed using a satisfiability solver. That translation is used in an imple-
mentation of the definite fragment of causal logic, called the Causal Calculator, or
CCalc.1 The Causal Calculator has been applied to several problems in the theory
of commonsense reasoning [Lifschitz et al., 2000; Lifschitz, 2000; Akman et al., 2004;
Campbell and Lifschitz, 2003; Lee and Lifschitz, 2006].
Causal theories were originally introduced in [McCain and Turner, 1997]. We review
the more general syntax and semantics of causal theories — which allow multi-valued
constants — from [Giunchiglia et al., 2004a].
A (multi-valued) signature is a set σ of symbols c, called constants, with a set
of symbols Dom(c) (the domain of c) associated to each of them. A (multi-valued)
atom is a string of the form c = v, where c ∈ σ and v ∈ Dom(c). A (multi-valued)
formula is built from atoms using the connectives ∧, ∨, ¬, ⊤ and ⊥. Formulas of
the forms F → G and F ↔ G can be seen as abbreviations in the usual way.
A (multi-valued) causal rule is an expression of the form F ⇐ G, where F
and G are formulas. These formulas are called the head and the body of the rule
respectively. A (multi-valued) causal theory is a set of causal rules.
A (multi-valued) interpretation over σ is a (total) function that maps each
constant c of σ to an element of Dom(c). An interpretation I satisfies (or is a model
of) an atom c = v if I(c) = v. The definition of satisfaction and model of formulas
1
http://www.cs.utexas.edu/~tag/ccalc/ .
149
of more general form follows the usual rules of propositional logic.
The semantics of causal theories of [Giunchiglia et al., 2004a] defines when
an interpretation I of σ is a model of a causal theory T , as follows. The reduct T I
of T relative to I is the set of the heads of the rules of T whose bodies are satisfied
by I. We say that I is a model of T if I is the only model of T I . It is clear that
replacing the head or the body of a causal rule by an equivalent formula doesn’t
change the models of a causal theory.
Take, for instance, the following causal theory with Dom(c) = {1, 2, 3}:
¬(c = 1) ∨ c = 2 ⇐ ⊤
(9.5)
¬(c = 2) ∨ c = 1 ⇐ ⊤.
150
signature, the difference between definite and semi-definite causal rules is not es-
sential, because every negative literal can be rewritten as an atom. For instance, if
the underlying signature is Boolean then ¬(c = t) is equivalent to c = f . In case
of Boolean constants c, we will often write c = t simply as c. If a causal theory
of a Boolean signature doesn’t contain atoms of the form c = f then the heads
and bodies of its rules are essentially classical, as in the original definition of causal
theories [McCain and Turner, 1997]. We call such theories MCT theories.
Take, for instance, the following MCT theory T of signature {p, q}:
p ∨ ¬q ⇐ ⊤
q ⇐ p.
We are interested in methods for computing the models of a causal theory T other
than by using the definition of a model directly.
The Causal Calculator uses a technique limited to definite causal theories.
A finite definite causal theory can be easily turned into an equivalent set of propo-
sitional formulas using the “literal completion” procedure defined in [McCain and
Turner, 1997; Giunchiglia et al., 2004a]. Then the models of the causal theory can
be found by running a SAT solver on this set of formulas.
An alternative computational procedure is to translate the given causal the-
ory into a nondisjunctive logic program (the head of each rule is a literal or ⊥) under
the answer set semantics as in Proposition 6.7 from [McCain, 1997], and then invoke
151
an answer set solver, such as smodels. This is discussed in [Doğandağ et al., 2001].
McCain’s translation is more limited than literal completion, in the sense that, in
addition to be applicable to definite theories only, those must be MCT-theories.
In this chapter we define two extensions of McCain’s translation. The first
one is applicable to the class of “almost definite” causal theories, a category of
MCT-theories that includes all definite theories and covers some other interesting
cases. One kind of interesting almost definite theories has to do with the idea of
transitive closure, or reachability in a directed graph, which plays an important
role in formal commonsense reasoning. The result of the translation is generally a
program with nested expressions, but, in the examples mentioned above, we obtain
a nondisjunctive program as with McCain’s translation.
The second translation is applicable to causal theories — even multi-valued
ones — that are in clausal form: the head of each rule is a disjunction of literals.
This class of causal theories is very general, as every causal theory can be rewritten
in clausal form. The output of this translation is a program with nested expressions
with the same “models”. We also show how we can modify the translation to
produces smaller logic programs. This translation, together with a polynomial time
“clausification” process described in Section 9.8, produces a program with nested
expressions from arbitrary causal theories in polynomial time. Nested expressions
can be eliminated in favor of disjunctive programs in the sense of [Gelfond and
Lifschitz, 1991], by a system such as nlp.2 We can then use answer set solvers that
accept disjunctive logic programs as input (such as cmodels, dlv and GnT) to
find the models of arbitrary causal theories.
2
http://www.cs.uni-potsdam.de/~torsten/nlp/ .
152
9.4 Almost Definite Causal Theories
In this chapter we will sometimes identify the logic program connectives , and ;
with the symbols used in propositional formulas ∧ and ∨, (but, in contrast to a
similar convention of Section 3.5, we don’t identify negation as failure not with ¬).
Under this convention, nested expressions that do not contain negation as failure are
identical to propositional formulas that are formed from literals using the connectives
∧, ∨, ⊤ and ⊥. Such propositional formulas are said to be in standard form, and
the literals they are formed from will be called their component literals.
By T we denote a causal theory whose rules have the form
G → H ⇐ F, (9.6)
where F , G and H are in standard form. When G is ⊤, we will identify the head
G → H of this rule with H, so that definite rules (with the body written in standard
form) can be viewed as a special case of (9.6).
Let l stand for the literal complementary to l. We say that l is default false
if T contains the rule
l ⇐ l. (9.7)
¬q → p ⇐ ⊤
(9.8)
q⇐q
153
Now we will describe a translation that turns any almost definite causal
theory T into a logic program ΠT . For any standard formula F , by Fnot we denote
the nested expression obtained from F by replacing each component literal l with
not l. For instance,
(¬p ∧ q)not = not p, not ¬q.
For any almost definite causal theory T , the logic program ΠT is defined as
the set of the program rules
H ← G, Fnot (9.9)
p ∨ ¬q ⇐ ⊤
(9.10)
q ⇐ p,
is the program
p ← ⊤, not ¬q
q ← ⊤, not ¬q
¬q ← ⊤, not q
which is strongly equivalent to
p ← not ¬q
q ← not ¬q (9.11)
¬q ← not q.
p ← ¬q
(9.12)
q ← not ¬q.
154
Theorem 9. An interpretation is a model of an almost definite causal theory T iff
it is an answer set for ΠT .
Note that this theorem does not say anything about the answer sets for the
translation ΠT that are not complete. For instance, the first of the answer sets
for program (9.11) is complete, and the second is not; in accordance with Theo-
rem 9, the first answer set is identical to the only model of the corresponding causal
theory (9.10). The only answer set for the translation (9.12) of causal theory (9.8) is
{q}; it is incomplete, and accordingly (9.8) has no models. The incomplete answer
sets of a logic program can be eliminated by adding the constraints
9.5 Examples
155
includes the causal rule
p(x, y) ⇐ ⊤. (9.14)
Theorem 10. Causal theory (9.14)–(9.18) has a unique model. In this model M ,
an atom is true iff it has the form p(x, y) where xP y, or the form tc(x, y) where
xP ∗ y.
then the assertion of Theorem 10 will become incorrect [Giunchiglia et al., 2004a,
Section 7.2].
The logic program corresponding to causal theory (9.14)–(9.18) is shown in
Figure 9.1.
156
p(x, y) ← ⊤ if xP y
¬p(x, y) ← not p(x, y)
tc(x, y) ← not ¬p(x, y)
tc(x, z) ← tc(y, z), not ¬p(x, y)
¬tc(x, y) ← not tc(x, y)
p(x, y) → tc(x, y) ⇐ ⊤
and
p(x, y) ∧ tc(y, z) → tc(x, z) ⇐ ⊤.
The assertion of Theorem 10 holds for the modified theory also. Since the atoms
p(x, y) are default false, the modified theory is almost definite, so that Theorem 9
can be used to turn it into a logic program. Its translation differs from the one
shown in Figure 9.1 in that it does not have the combination not ¬ in the third and
forth lines.
The fact that the atoms p(x, y) are assumed to be defined by rules of the
forms (9.14) and (9.15) is not essential for the validity of Theorem 10, or for the
claim that the theory is almost definite; the relation P can be characterized by any
definite causal theory with a unique model. But the modification described above
would not be almost definite in the absence of rules (9.15).
Transitive closure often arises in work on formalizing commonsense reasoning.
For instance, Erik Sandewall’s description of the Zoo World3 says about the neighbor
relation among positions that it “is symmetric, of course, and the transitive closure of
the neighbor relation reaches all positions.” Because of the difficulty with expressing
transitive closure in the definite fragment of causal logic, this part of the specification
3
http://www.ida.liu.se/ext/etai/lmw/ .
157
Figure 9.2: Robby’s apartment is a 3 × 3 grid, with a door between every pair of
adjacent rooms. Initially Robby is in the middle, and all doors are locked. The goal
of making every room accessible from every other can be achieved by unlocking 8
doors, and the robot will have to move to other rooms in the process.
of the Zoo World is disregarded in the paper by Akman et al. [2004] where the Zoo
World is formalized in the input of language of CCalc.
Here is another example of this kind. The apartment where Robby the Robot
lives consists of several rooms connected by doors, and Robby is capable of moving
around and of locking and unlocking the doors. This is a typical action domain of
the kind that are easily described by definite causal theories. But the assignment
given to Robby today is to unlock enough doors to make any room accessible from
any other (Figure 9.2). To express this goal in the language of causal logic we need,
for any time instant t, the transitive closure of the relation “there is currently an
unlocked door connecting Room i with Room j.” In the spirit of the representation
discussed above, the transitive closure can be defined by the causal rules
158
¬M otorOn(G(i))t+1 ⇐ T oggle(S(i))t ∧ M otorOn(G(i))t
M otorOn(G(i))t+1 ⇐ T oggle(S(i))t ∧ ¬M otorOn(G(i))t
¬Connectedt+1 ⇐ P usht ∧ Connectedt
Connectedt+1 ⇐ P usht ∧ ¬Connectedt
M otorOn(G(i))t+1 ⇐ M otorOn(G(i))t+1 ∧ M otorOn(G(i))t
¬M otorOn(G(i))t+1 ⇐ ¬M otorOn(G(i))t+1 ∧ ¬M otorOn(G(i))t
Connectedt+1 ⇐ Connectedt+1 ∧ Connectedt
¬Connectedt+1 ⇐ ¬Connectedt+1 ∧ ¬Connectedt
M otorOn(G(i))0 ⇐ M otorOn(G(i))0
¬M otorOn(G(i))0 ⇐ ¬M otorOn(G(i))0
Connected0 ⇐ Connected0
¬Connected0 ⇐ ¬Connected0
T oggle(S(i))t ⇐ T oggle(S(i))t
¬T oggle(S(i))t ⇐ ¬T oggle(S(i))t
P usht ⇐ P usht
¬P usht ⇐ ¬P usht
(i = 1, 2; t = 0, . . . , n − 1);
T urning(G(i))t ⇐ M otorOn(G(i))t
T urning(G(1))t ↔ T urning(G(2))t ⇐ Connectedt
¬T urning(G(i))t ⇐ ¬T urning(G(i))t
(i = 1, 2; t = 0, . . . , n).
Imagine that there are two gears, each powered by a separate motor.
There are switches that toggle the motors on and off, and a button that
moves the gears so as to connect or disconnect them from one another.
The motors turn the gears in opposite (i.e., compatible) directions. A
gear is caused to turn if either its motor is on or it is connected to a gear
that is turning.
159
¬M otorOn(G(i))t+1 ← not ¬T oggle(S(i))t , not ¬M otorOn(G(i))t
M otorOn(G(i))t+1 ← not ¬T oggle(S(i))t , not M otorOn(G(i))t
Connectedt+1 ← not ¬P usht , not Connectedt
¬Connectedt+1 ← not ¬P usht , not ¬Connectedt
M otorOn(G(i))t+1 ← not ¬M otorOn(G(i))t+1 , not ¬M otorOn(G(i))t
¬M otorOn(G(i))t+1 ← not M otorOn(G(i))t+1 , not M otorOn(G(i))t
Connectedt+1 ← not ¬Connectedt+1 , not ¬Connectedt
¬Connectedt+1 ← not Connectedt+1 , not Connectedt
M otorOn(G(i))0 ← not ¬M otorOn(G(i))0
¬M otorOn(G(i))0 ← not M otorOn(G(i))0
Connected0 ← not ¬Connected0
¬Connected0 ← not Connected0
T oggle(S(i))t ← not ¬T oggle(S(i))t
¬T oggle(S(i))t ← not T oggle(S(i))t
P usht ← not ¬P usht
¬P usht ← not P usht
(i = 1, 2; t = 0, . . . , n − 1),
(i = 1, 2; t = 0, . . . , n).
160
Because of the second line from the end, this theory is not definite. But we
can make it almost definite by replacing that line with
By Proposition 4(i) from [Giunchiglia et al., 2004a], this transformation does not
change the set of models.
The corresponding logic program is shown in Figure 9.4. Many occurrences
of the combination not ¬ in this program can be dropped without changing the
answer sets.
l1 ∨ · · · ∨ ln ⇐ G, (9.20)
161
¬(c = v); ¬(c = v ′ ) ← not (c = v), not (c = v ′ ) (9.23)
where the expression of the form F ↔ G stands for two rules F ← G and
G ← F.
According to this definition, each rule (9.21) of ΛT can be obtained from the
corresponding rule of T in three steps: by
• replacing each component literal l in the body of each rule with not l, and
This last step “compensates” the replacement of ∨ in the head of a rule with the
corresponding “stronger” logic program connective. It is clear that this translation
is linear if there is an upper bound on the size of the domain for each constant in T
(for instance, when T is binary).
Rules (9.22) and (9.23) relate literals containing the same constant. They
are needed to establish, for each interpretation I, a 1–1 relationship between the
models of T I and the subsets of I (where I is seen as the set of literals satisfied by
it) that satisfy (ΛT )I .
For instance, if T is
¬(c = 1) ∨ c = 2 ⇐ ⊤
(9.24)
¬(c = 2) ∨ c = 1 ⇐ ⊤.
162
then ΛT is
If T is (9.10) then ΛT is
p ↔ ¬(p = f )
p = f ↔ ¬p
(9.26)
q ↔ ¬(q = f )
q = f ↔ ¬q
Theorem 11. For any causal theory T in clausal form, the models of T are identical
to the answer sets for ΛT .
163
For instance, the only answer set for (9.25) is {¬(c = 1), ¬(c = 2), c = 3},
and indeed it is the only model of (9.24). The only answer set for (9.26) is
Proposition 28. For any literal l and any nested expression F , the one-rule logic
program
l ← F, l; not l
is strongly equivalent to
l ← F.
q ← not ¬p
p ∨ ¬p ⇐ ⊤,
p ↔ ¬(p = f )
(9.27)
p = f ↔ ¬p
164
9.7 Reducing the Size of the Translation of Causal The-
ories in Clausal Form
For each constant c, let Nc denote the number of atoms containing c that do
not occur in S. We define the logic program ∆T (S, C) as obtained from ΛT by:
• replacing, for each constant c such that Nc > 0, rules (9.22) with the set of
rules
, ¬(c = w) ← c = v (9.28)
w : c=w∈S,w6=v
• adding
⊥← , not (c = w) (9.29)
w : c=w∈S
We will denote ∆T (S, ∅) by ∆T (S). We can easily notice that ∆T (S, ∅) contains
atoms from S only. Clearly, when S contains all atoms of the underlying signature,
∆T (S) = ΛT . Taking S smaller and C larger makes ∆T (S, C) contain smaller and
simpler rules.
Rules (9.28) impose a condition similar to the left-to-right half of (9.22),
but they are limited to atoms of S. Rule (9.29) expresses, in the translation, the
following fact about causal theories: if neither of two distinct atoms c = v1 and
165
c = v2 occurs in a causal theory T then no model of T maps c to v1 or v2 . For
instance, if Dom(c) = {1, 2, 3} and only c = 1 occurs in T then every model of T
maps c to 1. However, if c = 2 occurs in T as well then c can be mapped to 3, as
shown by example (9.24).
For instance, if T is (9.24) then ∆T ({c = 1, c = 2}) is
¬(c = 2) ← c = 1 (9.30)
¬(c = 1) ← c = 2
Theorem 12. Let T be a causal theory over σ. Let S be a set of atoms of σ such
that every atom occurring in T belongs to S, and let C be a set of constants of σ
such that every rule of T containing a constant from C in the head is semi-definite.
Then I 7→ I ∩ {a, ¬a : a ∈ S} is a 1–1 correspondence between the models of T
and the answer sets of ∆T (S, C) that are complete over S.
We get the models of the original causal theory by looking at the unique
interpretation that satisfies each complete answer set for ∆T (S, C). (The uniqueness
of the interpretation is guaranteed by the theorem.) For instance, {¬(c = 1), ¬(c =
2)} is the only complete answer set for (9.30); it corresponds to the interpretation
that maps c to 3, and this is indeed the only model of (9.24). Also this translation
∆T (S, C) may have incomplete answer sets.
Similarly to ΠT , program ∆T (S, C) may have incomplete answer sets, which
don’t correspond to any model of T . Also in this case, they can be eliminated from
the collection of answer sets ∆T (S, C) by adding
166
We can notice that no constant c ∈ C occurs in the head of “intrinsically
disjunctive” rules of ∆T (S, C), in the following sense. If c ∈ C then each rule (9.21)
with c in the head is nondisjunctive because it comes from a semi-definite causal
rule, and ∆T (S, C) doesn’t contain rules (9.23) whose head contains c. Moreover,
rules (9.22) and (9.29) can be strongly equivalently rewritten as nondisjunctive rules.
In particular, it is possible to translate semi-definite causal theories into nondisjunc-
tive programs of about the same size. As a consequence, the problem of the existence
of a model of a semi-definite causal theory is in class NP.
When, for a binary constant c, only one of the two atoms belongs to S, all
rules (9.22) and (9.23) in ΛT for such constant c are replaced in ∆T (S, C) by a single
rule (9.28) whose head is ⊤, which can be dropped. In particular, an MCT theory
T over σ can be translated into logic program ∆T (σ), essentially consisting just of
rules (9.21) for all rules (9.20) in T .
For instance, if T is (9.10) then ∆T ({p, q}) is
C1 ∧ · · · ∧ Cn ⇐ G, (9.31)
Ci ⇐ G (9.32)
167
(i = 1, . . . , n) [Giunchiglia et al., 2004a, Proposition 4]. However, this reduction
may lead to an exponential increase in size unless we assume an upper bound on
the number of atoms that occur in the head of each single rule.
We propose a reduction from an arbitrary causal theory to a causal theory
where the head of each rule has at most three atoms. This translation can be
computed in polynomial time and requires the introduction of auxiliary Boolean
atoms. The translation is similar to the one for logic programs from [Pearce et al.,
2002] mentioned in the introduction.
We denote each auxiliary atom by dF , where F is a formula. For any causal
theory T , the causal theory T ′ is obtained by T by
– dF ↔ F ⇐ ⊤, if F is an atom, ⊤ and ⊥,
Intuitively, the equivalences in the heads of the rules above recursively define
each atom dF occurring in T ′ to be equivalent to F . This translation is clearly
modular.
If T is an MCT theory then T ′ is an MCT theory also. For instance, MCT
rule
p ∨ (q ∧ ¬r) ⇐ r
168
is transformed into the following 7 MCT rules:
dp∨(q∧¬r) ⇐ r
dp∨(q∧¬r) ↔ dp ∨ dq∧¬r ⇐ ⊤
dq∧¬r ↔ dq ∧ d¬r ⇐ ⊤
d¬r ↔ ¬dr ⇐ ⊤
da ↔ a ⇐ ⊤ (a ∈ {p, q, r})
Theorem 13. For any causal theory T over a signature σ, I 7→ I|σ is a 1–1 corre-
spondence between the models of T ′ and the models of T .
We can see that every rule in causal theories of the form T ′ is either already
in clausal form, or has the body ⊤ and at most three atoms in the head. It is not
hard to see that the clausification process described at the beginning of the section
is linear when applied to T ′ .
l ⇐ l1 ∧ · · · ∧ ln
l ← not l1 , . . . , not ln .
169
• every atom in the language of T is default false, that is to say, T contains the
causal rule ¬a ⇐ ¬a for every atom a, and
This special case is covered essentially by the lemma from [Giunchiglia et al., 2004a,
Section 7.3]. What is interesting about this case is that by forming the translation
ΠT of a causal theory T satisfying the conditions above we can get an arbitrary set
of rules of the form
for all atoms a. Since the problem of existence of an answer set for a finite set
of rules of the form (9.33) is ΣP2 -hard [Eiter and Gottlob, 1993, Corollary 3.8], it
follows that the problem of existence of a model for an almost definite causal theory
is ΣP2 -hard also. This fact shows that from the complexity point of view almost
definite causal theories are as general as arbitrary causal theories.
On the other hand, if the formula H in every rule (9.6) of an almost defi-
nite causal theory T is a literal or ⊥ then the corresponding logic program ΠT is
nondisjunctive. Consequently, the problem of existence of a model for the almost
definite causal theories satisfying this condition is in class NP, just as for definite
causal theories. This condition is satisfied, for instance, for both examples discussed
in Section 9.5.
If a causal theory T is definite then the corresponding logic program ΠT is
tight in the sense of [Erdem and Lifschitz, 2003]. The answer sets for a finite tight
170
program can be computed by eliminating classical negation from it in favor of addi-
tional atoms and then generating the models of the program’s completion [Babovich
et al., 2000]. This process is essentially identical to the use of literal completion men-
tioned in the introduction. If T is almost definite but not definite then the program
ΠT , generally, is not tight.
Even in the case MCT-theories, the classes of almost definite causal theories
and of causal theories in clausal form partially overlap, neither is a subset of the
other. For a causal theory T that is both almost definite and in clausal form, the
two programs ΠT and ΛT are strongly equivalent to each other.
9.10 Proofs
We begin with a comment about notation. The semantics of propositional logic de-
fines when an interpretation satisfies a propositional formula; on the other hand, we
also defined when a set of literals satisfies a nested expression. Since we have agreed
to identify any interpretation with a set of literals, and to identify any standard
formula with a nested expression, these two definitions of satisfaction overlap when
applied to an interpretation (a complete set of literals) and a standard formula (a
nested expression without negation as failure). It is easy to see, however, that the
two definitions are equivalent to each other in this special case, so that we can safely
use the same symbol |= for both relations.
For any nested expression F we denote by lit(F ) the set of literals that have regular
occurrences in F . (An occurrence is regular if it is not an occurrence of an atom
within a negative literal [Lifschitz et al., 1999],) In particular, if F is a standard
formula then lit(F ) is the set of all component literals of F . The following fact is
easy to check by structural induction:
171
Fact 3. For any nested expression F and any consistent set X of literals,
X |= F iff X ∩ lit(F ) |= F.
H←G (9.34)
J |= Θ(I) iff J |= T I . (9.35)
lit(G) ⊆ D (9.36)
and
lit(H) ⊆ D or H is a conjunction of literals. (9.37)
In the proof we use the following fact, which is easy to prove by structural
induction.
172
belongs to T I , so that Θ(I) contains the program rule l ← ⊤. Consequently any set
of literals that satisfies Θ(I) contains l. But l ∈ J, so that l 6∈ J, which implies that
neither J nor I ∩ J satisfies Θ(I).
Case 2: J ∩ D ⊆ I.
Left to right. Assume that I and J satisfy Θ(I), and take any rule (9.34) in Θ(I)
such that I ∩J |= G. We need to check that I ∩J |= H. By Fact 4, I |= G and J |= G.
Since I and J satisfy Θ(I), it follows that I |= H and J |= H. According to (9.37),
there are two possibilities. One is that lit(H) ⊆ D. Then, by the assumption of
Case 2,
J ∩ lit(H) ⊆ J ∩ D ⊆ I ∩ J. (9.38)
Right to left. Assume that I ∩ J |= Θ(I), and take any rule (9.34) in Θ(I) such that
J |= G. We need to check that J |= H. By Fact 3, from J |= G can conclude that
J ∩ lit(G) |= G. On the other hand, by (9.36) and the assumption of Case 2,
J ∩ lit(G) ⊆ J ∩ D ⊆ I ∩ J.
Lemma 51. For any consistent set X of literals and any interpretation I,
In the proof we use the following fact, which is easy to prove by structural
induction.
173
Fact 5. For any standard formula F , any interpretation I and any consistent set
X of literals,
X |= (Fnot )I iff I |= F.
Proof of Lemma 51. The condition X |= (ΠT )I means that X satisfies the reduct
with respect to I of the translation (9.9) of every rule (9.6) of T . That reduct can
be written as
H ← G, (Fnot )I (9.39)
I is a model of T
means that
174
This is further equivalent to the assertion
Let P be a binary relation on a set A, P ∗ its transitive closure, and T the causal
theory (9.14)–(9.18). Define the interpretation M by
TI = {p(x, y) : xP y}
∪ {¬p(x, y) : I 6|= p(x, y)}
(9.40)
∪ {tc(x, y) : I |= p(x, y)} ∪ {tc(y, z) → tc(x, z) : I |= p(x, y)}
∪ {¬tc(x, y) : I 6|= tc(x, y)}.
Since T I is consistent, from lines 1 and 2 of (9.40) we see that I |= p(x, y) whenever
xP y. Consequently, T I contains
It remains to notice that these formulas entail tc(x, y) for all x, y such that xP ∗ y.
175
Lemma 53. For any interpretation I, if T I is consistent and complete then M |= T I .
Proof. According to (9.40), the set of formulas in T I that contain the atoms p(x, y)
is
{p(x, y) : xP y} ∪ {¬p(x, y) : I 6|= p(x, y)}.
xP y iff I |= p(x, y).
TI = {p(x, y) : xP y}
∪ {¬p(x, y) : not xP y}
(9.41)
∪ {tc(x, y) : xP y} ∪ {tc(y, z) → tc(x, z) : xP y}
∪ {¬tc(x, y) : I 6|= tc(x, y)}.
M clearly satisfies the formulas in the first three lines of (9.41). To prove that M
satisfies the formulas in line 4, take any x, y such that I 6|= tc(x, y); we need to
check that M 6|= tc(x, y), or, in other words, that xP ∗ y doesn’t hold. Assume xP ∗ y.
Then, by Lemma 52, T I |= tc(x, y); since T I contains the formula ¬tc(x, y), this
contradicts the consistency of T I .
Proof of Theorem 10. First we need to check that M is the only interpretation sat-
isfying T M . By formula (9.40) applied to I = M ,
TM = {p(x, y) : xP y}
∪ {¬p(x, y) : not xP y}
(9.42)
∪ {tc(x, y) : xP y} ∪ {tc(y, z) → tc(x, z) : xP y}
∪ {¬tc(x, y) : not xP ∗ y)}.
It is clear that M satisfies all these formulas. Take any interpretation I satisfying T M
and any x, y ∈ A. From the first two lines of (9.42) we see that
176
If xP ∗ y then, by Lemma 52 applied to I = M , T M |= tc(x, y), and consequently
I |= tc(x, y). Otherwise, from line 4 of (9.42) we see that I |= ¬tc(x, y). Thus
I = M.
To show that an interpretation I different from M cannot be a model of T ,
notice that for such I, by Lemma 53, T I either is inconsistent, or is incomplete, or
is satisfied by an interpretation different from I. In each of these cases, I cannot be
the only interpretation satisfying T I .
We use the following property about logic programs, easily provable by induction.
Fact 6. For any logic program Π, and any consistent set X of literals,
X |= ΠX iff X |= Π.
(a) Y |= Π1 iff Y |= Π2 , and
We also use the following property about logic programs, easily provable by
induction.
Proposition 28. For any literal l and any nested expression F , the one-rule logic
program
l ← F, l; not l (9.43)
is strongly equivalent to
l ← F. (9.44)
177
Proof. Let Π2 be (9.43), and Π1 be (9.44). It is clear that condition (a) above holds.
We still need to prove (b). Take any consistent set Y of literals, and assume that Y
satisfies the reduct ΠY1 :
l ← FY .
Y
Case 1: l 6∈ Y . Then l; not l = l; ⊤ , which is equivalent to ⊤. Consequently
(Π2 )Y is essentially identical to (Π1 )Y , so that (b) holds. Case 2: l ∈ Y . Then
l 6∈ Y (Y is consistent), and then, since Y |= ΠY1 , Y 6|= F Y . Consequently, since F Y
is a nested expression without negation as failure not, F Y is not satisfied by any
subset of Y . Consequently, all subset of Y satisfies both (Π1 )Y and (Π2 )Y , because
they both contain F Y as a conjunctive term in the body.
Fact 7. Let Π be any logic program, and let Z be a set of literals not occurring in
Π. Then, for any two consistent sets X and Y of literals that
Y |= ΠX iff Y ∩ Z |= ΠX∩Z .
Fact 8. For any nested expression F and any two sets of literals X and Y such that
Y ⊆ X,
Y |= {⊥ ← F }X iff Y |= {⊥ ← F }.
Let T be a causal theory over σ, and let S be a set of atoms over σ that
do not occur in T , and C a set of constants which do not occur in the head of
nonsemi-definite rules. Let S ′ be S ∪ {¬a : a ∈ S}. By any set X of literals (for
178
instance, interpretations and S ′ ) and any constant c, by Xc we denote the set of
literals of X that are over c.
Let Γ1 be the set of rules (9.21) of ∆(S, C), and Γ2 the other rules of
∆T (S, C). We say that an interpretation is a candidate model over S if, for each
constant c, atom c = I(c) ∈ S whenever two or more atoms of the form c = v
(v ∈ Dom(c) \ {I(c)}) don’t belong to S (or, alternatively, whenever Nc ≥ 2).
Proof. Take any interpretation I that is not a candidate model. This means that,
for some constant c and two values v1 , v2 ∈ Dom(c), I(c) = v1 , and c = v1 , c = v2
don’t belong to S. This means that those two atoms don’t occur neither in T , not
in T I . Let I ′ be identical to I except that I ′ (c) = v2 . Consequently, if I is a model
of T I then I ′ is a model of T I , so that I cannot be the unique model of T I . We
conclude that I is not a model of T .
Proof. We start by proving the right direction. It is easy to check that every inter-
pretation satisfies rules (9.22), (9.23) and (9.28) of Γ2 . Now consider any rule (9.29)
which occurs in Γ2 . This means that Nc > 1, so that at least two atoms of the form
c = v don’t occur in T . If an interpretation I is a candidate model then c = I(c)
belongs to S, which is the condition imposed by (9.29).
Now take any consistent and complete set X of literals over S that satisfies
Γ2 . Consequently,
• X doesn’t contain more than one atom c = v (rules (9.28) and right direction
of (9.22)), and
179
(Rules (9.23) are always satisfied by complete sets of literals.) It is easy to see that
there is just one interpretation I such that I ∩ S ′ = X: it is the one that maps each
constant c to
(b) the only value of v ∈ Dom(c) such that c = v 6∈ S, otherwise. (The value of v
is unique, because, in this case, Nc = 1.)
This interpretation I is also a candidate model over S. Indeed, when Nc > 1 we are
in case (a), and in this case c = I(c) ∈ X ⊆ S.
Lemma 56. For any two interpretations I and J, and any causal theory T in clausal
form, I ∩ J |= ΓI1 iff J is a model of T I .
Proof. It is sufficient to prove the claim for the case when T is a single rule (9.20),
and Γ1 rule (9.21).
Case 1: I is not a model for G. Then T I = ∅, and, in view of Fact 5, (Gnot )I
is not satisfied by any subset of I. Consequently, since (Gnot )I is a conjunctive term
in the body of ΓI1 , every subset of I satisfies ΓI1 . The claim immediately follows.
Case 2: I is a model for G. Then T I is
l1 ∨ · · · ∨ ln .
Consider the reduct of (9.21) relative to I. We notice that the body of that rule
contains a conjunctive term (Gnot )I , but, in view of Fact 5, it is satisfied by all
sets of literals and then it can be dropped. Also, the terms of the form (l i ; not li )X
in the body of the reduct can be written as li if li ∈ X, and dropped otherwise.
Consequently, we can write ΓI1 as
l1 ; . . . ; ln ← , l
l∈{l1 ,...,ln }:l∈I
180
V
where the “big comma” is similar to (in particular, it is ⊤ if there are no con-
junctive terms). Consequently, since interpretations are complete sets of literals, (l
ranges over l1 , . . . , ln )
iff l ∈ J for some l
iff J is a model of T I .
Lemma 57. For any two interpretations I and J such that I is a candidate model
′
over S, I ∩ J ∩ S ′ |= ∆T (S, C)I∩S iff J is a model of T I .
′
I ∩ J satisfies the reduct of rules (9.29). The other rules of Γ2I∩S are (9.22), (9.28),
and rules of the form
¬(c = v); ¬(c = v ′ ) ← ⊤ (9.45)
such that both ¬(c = v) and ¬(c = v ′ ) belong to S ′ and I. (Some trivial rules
are dropped). We notice that, for each constant c and each pair of literals ¬(c =
v), ¬(c = v ′ ) that belong to I, at least one of them belongs to J also, so that (9.45)
is satisfied by I ∩ J ∩ S ′ . Consider any rule (9.22) of Γ2I∩S . This means that Nc = 0,
′
181
For any interpretation I and any subset X of I, we define interpretation
J = f (I, X) as follows: for each constant c, J(c) is
(i) I(c), if either c = I(c) ∈ X, or ¬(c = v) ∈ X for all v ∈ Dom(c) \ {I(c)}, and
(ii) an arbitrary value v ∈ Dom(c) \ {I(c)} such that ¬(c = v) 6∈ X and possibly
such that c = v ∈ S (if such value exists), otherwise.
Lemma 58. For any interpretation I and any subset X of I, J = f (I, J) has the
following properties:
(b) X ⊆ J
(d) I ∩ J ∩ S ′ |= Γ1I∩S .
′
Assume that J(c) = I(c), then one of the two conditions of (i) holds. Case 1:
c = I(c) ∈ X. Claim (x) clearly holds. It is not too hard to see that (y) holds if
X satisfies rule (9.28) with v = I(c), or the left-to-right direction of (9.22) with the
same substitution. It remains to notice that ∆T (S, C) contains one of those two
rules, that the reduct operation doesn’t modify them (they don’t contain negation
′
as failure) and that X |= (∆T (S, C))I∩S by hypothesis. Case 2: ¬(c = v) ∈ X
for all v ∈ Dom(c) \ {I(c)}. Then (y) clearly holds. To prove (x), assume that
182
c = I(c) ∈ S ′ . Notice that Xc ⊆ S ′ , so ¬(c = v) ∈ S for all v ∈ Dom(c) \ {I(c)}.
′
Consequently, Nc = 0. By the definition of ∆, ∆T (S, C) (and then (∆T (S, C))I∩S )
′
contains rules (9.22) for that constant c. Since X |= (∆T (S, C))I∩S and by the
hypothesis of this case, it follows that c = I(c) ∈ X.
To prove (b), first we notice that, for each c such that J(c) = I(c), Xc ⊆ Jc
because X ⊂ I. Now consider constants c such that J(c) 6= I(c), i.e., (ii) was
applied. Since X ⊆ I, and the only atom of the form c = v ∈ I is c = I(c), X
doesn’t contain any atom of the form c = v. Consider now any literal of the form
¬(c = v) ∈ X. By the choice of J, J(c) 6= v, so that J contains ¬(c = v).
To prove (c), consider any constant c 6∈ C. The fact that Xc ⊆ (I ∩ J ∩ S ′ )c
follows from the hypothesis that X ⊂ I ∩ S ′ and from (b). It remains to show that
(I ∩ J ∩ S ′ )c ⊆ Xc . Case 1: J(v) = I(v). Then Jc = Ic and, by (a), Xc = (I ∩ S ′ )c .
Consequently,
(I ∩ J ∩ S ′ )c = Ic ∩ Jc ∩ Sc′ = Ic ∩ Sc′ = (I ∩ S ′ )c = Xc .
Case 2: J(c) 6= I(c). Then Ic and Jc share only negative literals. Let ¬(c = w) be
one element of Ic , Jc and S ′ . The goal is to prove that ¬(c = w) ∈ X. Consider also
that J(c) has been selected using (ii). Case 2a: c = J(c) 6∈ S. Since we wanted
c = J(c) to be in S if possible, that means that
and then as
It remains to notice that v = w satisfies the “if” part, so ¬(c = w) ∈ Xc . Case 2b:
c = J(c) ∈ S. Since both c = w and c = J(c) belong to S, and c 6∈ C, ∆T (S, C)
183
contains rule (9.23) with v = J(c). Note also that I doesn’t contain either c = J(c)
′
(since J(c) 6= I(c)) nor c = w (since ¬(c = w) ∈ Ic ), consequently (∆T (S, C))I∩S
contains rule
¬(c = J(c)); ¬(c = w) ← ⊤.
′
Since X |= (∆T (S, C))I∩S by hypothesis but X 6|= ¬(c = J(c)) by (ii). We can then
conclude that ¬(c = w) ∈ X.
Now the proof of (d). Since the transformation T 7→ Γ1 is modular, it
is sufficient to consider a single causal rule r of T , and the corresponding logic
program rule r ′ of Γ1 , and prove that I ∩ J ∩ S ′ |= (r ′ )I∩S . Since (r ′ )I∩S ∈ Γ1I∩S
′ ′ ′
l ← Fnot .
′
l ← (Fnot )I∩S .
The only literal occurring in Γ1I∩S is l in the head, so, since X |= (r ′ )I∩S , and
′ ′
Theorem 12. Let T be a causal theory over σ, let S be a set of atoms over σ
and C a set of constants subset of σ. If S contains all atoms occurring in T and
184
elements of C do not occur in the head of rules of T that are not semi-definite then
I 7→ I ∩ (S ∪ {¬a : a ∈ S}) is a 1–1 correspondence between the models of T and
the complete (over S) answer sets of ∆T (S, C).
Proof. By Lemma 54, only interpretations that are candidate models over S can
be models of T . Similarly, among the complete sets X of literals over S, only
the ones that satisfy Γ2 can be answer sets of ∆T (S, C). Indeed, if X 6|= Γ2 then
X 6|= ∆T (S, C), and then by Fact 6, X 6|= (∆T (S, C))X ; we can conclude that X
is not an answer set for ∆T (S, C). Consequently, by Lemma 55, it is sufficient to
show that a candidate model I over S is a model of T iff I ∩ S ′ is an answer set for
∆T (S, C).
For the right-to-left direction, assume that I∩S ′ is an answer set for ∆T (S, C).
Consequently, I ∩ S ′ |= ∆T (S, C)I∩S and then I |= T I by Lemma 57 (take J to
′
′
subset X of I ∩ S ′ , and assume, in sake of contradiction, that X |= (∆T (S, C))I∩S .
By Lemma 58, there is a interpretation J such that I ∩ J ∩ S ′ |= Γ1I∩S (claim (d)),
′
and then that satisfies T I by Lemma 56. Moreover, J 6= I by claim (a) and the
hypothesis that X ⊂ J. We get the contradictory conclusion that I is not a model
of T .
185
9.10.5 Proof of Theorem 13
Lemma 60. I 7→ I|σ is a 1–1 correspondence between the models of (T ′ )I and the
models of T I|σ .
{dF : F ⇐ G ∈ T, I |= G} ∪ ∆.
In view of Lemma 59 and the fact that the body of each rule of T is over σ, (T ′ )I
is equivalent to
{dF : F ⇐ G ∈ T, I|σ |= G} ∪ ∆′
and then to
T I|σ ∪ ∆′ .
We can notice that ∆′ is a set of equivalences that define auxiliary atoms in terms
of atoms from σ, and that T I|σ doesn’t contain auxiliary atoms. Consequently, the
1–1 correspondence between models follows from the fact that the truth value of
auxiliary atoms is determined in terms of atoms from σ in a unique way.
Theorem 13. For any causal theory T over σ, I 7→ I|σ is a 1–1 correspondence
between the models of T ′ and the models of T .
186
(i) each T I|σ is identical to T J , and
From (i) we get that J is the only model of every T I|σ . Consequently, by Lemma 60,
(T ′ )I has a unique model M , with the following property: M |σ = J. Moreover, this
M is the same for all I ′ s by (ii). Note that since M |σ = J, M is one of the
interpretations I that we are considering, so that M is the only model of (T ′ )M and
consequently a model of T ′ . No I 6= M is a model of T ′ because M is a model of
(T ′ )I .
187
Chapter 10
Conclusions
188
programs with variables.
In this direction, we have recently proposed, in [Ferraris et al., 2007], an
extension of the concept of an answer set from propositional theories to first-order
formulas. Its definition, however, is not based on the concept of a reduct: the answer
sets of a first order formula F are the models of a second-order formula built from
it. In the same paper we also proposed a characterization of strong equivalence for
the new definition of an answer set. We still need to extend other theorems defined
for propositional formulas, and to represent aggregates under this extended syntax.
Possible applications of this new definition of an answer set for first-order
formulas are related the fact that the answer set semantics for first-order formulas
is more expressive than classical first-order logic: for instance, we can define recur-
sive definitions such as reachability, and express defaults. There are commonsense
knowledge representation languages, such as the situation calculus [McCarthy and
Hayes, 1969], whose meaning is defined in terms of classical first-order logic. How-
ever, in classical first-order logic, it is difficult to express the commonsense law of
inertia. This problem could be avoided by redefining such languages as first-order
formulas under the answer set semantics.
189
Bibliography
[Akman et al., 2004] Varol Akman, Selim Erdoğan, Joohyung Lee, Vladimir Lifs-
chitz, and Hudson Turner. Representing the Zoo World and the Traffic World in
the language of the Causal Calculator. Artificial Intelligence, 153(1–2):105–140,
2004.
[Anger et al., 2002] Christian Anger, Kathrin Konczak, and Thomas Linke.
NoMoRe: Non-monotonic reasoning with logic programs. In Lecture Notes in
Computer Science, volume 2424, pages 521–524. Springer-Verlag, 2002.
[Aura et al., 2000] Tuomas Aura, Matt Bishop, and Dean Sniegowski. Analizing
single-server network inhibition. In Proceedings of the 13th EEEI Computer Se-
curity Foundation Workshop, pages 108–117, 2000.
[Babovich et al., 2000] Yuliya Babovich, Esra Erdem, and Vladimir Lifschitz. Fages’
theorem and answer set programming.1 In Proceedings of International Workshop
on Nonmonotonic Reasoning (NMR), 2000.
190
[Balduccini et al., 2001] Marcello Balduccini, Michael Gelfond, Monica Nogueira,
Richard Watson, and Matthew Barry. An A-Prolog decision support system for
the Space Shuttle. In Working Notes of the AAAI Spring Symposium on Answer
Set Programming, 2001.
[Baral and Uyan, 2001] Chitta Baral and Cenk Uyan. Declarative specification and
solution of combinatorial auctions using logic programming. Lecture Notes in
Computer Science, 2173:186–199, 2001.
[Baral et al., 2004] Chitta Baral, Michael Gelfond, and Richard Scherl. Using an-
swer set programming to answer complex queries. In Workshop on Pragmatics of
Question Answering at HLT-NAAC2004, 2004.
[Bibel and Eder, 1993] Wolfgang Bibel and Elmar Eder. A survey of logical calculi.
In D.M. Gabbay, C.J. Hogger, and J.A. Robinson, editors, The Handbook of Logic
in AI and Logic Programming, volume 1, pages 67–182. Oxford University Press,
1993.
[Cabalar and Ferraris, 2007] Pedro Cabalar and Paolo Ferraris. Propositional the-
ories are strongly equivalent to logic programs.2 Theory and Practice of Logic
Programming, 2007. To appear.
[Cabalar and Santos, 2006] Pedro Cabalar and Paulo Santos. Strings and holes: An
exercise on spatial reasoning. In IBERAMIA-SBIA, pages 419–429, 2006.
[Calimeri et al., 2005] Francesco Calimeri, Wolfgang Faber, Nicola Leone, and Si-
mona Perri. Declarative and computational properties of logic programs with
aggregates. In Proceedings of International Joint Conference on Artificial Intel-
ligence (IJCAI), 2005.
2
http://www.cs.utexas.edu/users/otto/papers.html .
191
[Campbell and Lifschitz, 2003] Jonathan Campbell and Vladimir Lifschitz. Rein-
forcing a claim in commonsense reasoning. In Working Notes of the AAAI Spring
Symposium on Logical Formalizations of Commonsense Reasoning, 2003.
[Clark, 1978] Keith Clark. Negation as failure. In Herve Gallaire and Jack Minker,
editors, Logic and Data Bases, pages 293–322. Plenum Press, New York, 1978.
[De Jongh and Hendriks, 2003] Dick De Jongh and Lex Hendriks. Characterization
of strongly equivalent logic programs in intermediate logics. Theory and Practice
of Logic Programming, 3:250–270, 2003.
[Denecker et al., 2001] Marc Denecker, Nikolay Pelov, and Maurice Bruynooghe.
Ultimate well-founded and stable semantics for logic programs with aggregates.
In Proc. ICLP, pages 212–226, 2001.
[Denecker et al., 2002] Marc Denecker, V. Wiktor Marek, and Miroslaw Truszczyn-
ski. Ultimate approximations in nonmonotonic knowledge representation systems.
In Proc. KR, pages 177–190, 2002.
[Dimopoulos et al., 1997] Yannis Dimopoulos, Bernhard Nebel, and Jana Koehler.
Encoding planning problems in non-monotonic logic programs. In Sam Steel and
Rachid Alami, editors, Proceedings of European Conference on Planning, pages
169–181. Springer-Verlag, 1997.
[Doğandağ et al., 2001] Semra Doğandağ, Ferda N. Alpaslan, and Varol Akman.
Using stable model semantics (SMODELS) in the Causal Calculator (CCALC).
In Proc. 10th Turkish Symposium on Artificial Intelligence and Neural Networks,
pages 312–321, 2001.
[Eiter and Gottlob, 1993] Thomas Eiter and Georg Gottlob. Complexity results
for disjunctive logic programming and application to nonmonotonic logics. In
192
Dale Miller, editor, Proceedings of International Logic Programming Symposium
(ILPS), pages 266–278, 1993.
[Eiter et al., 1998] Thomas Eiter, Nicola Leone, Cristinel Mateis, Gerald Pfeifer,
and Francesco Scarcello. The KR system dlv: Progress report, comparisons and
benchmarks. In Anthony Cohn, Lenhart Schubert, and Stuart Shapiro, editors,
Proceedings of International Conference on Principles of Knowledge Representa-
tion and Reasoning (KR), pages 406–417, 1998.
[Eiter et al., 1999] Thomas Eiter, Wolfgang Faber, Nicola Leone, and Gerald
Pfeifer. Diagnosis frontend of the dlv system. The European Journal of Ar-
tificial Intelligence, 12(1–2):99–111, 1999.
[Erdem and Lifschitz, 2003] Esra Erdem and Vladimir Lifschitz. Tight logic pro-
grams. Theory and Practice of Logic Programming, 3:499–518, 2003.
[Erdem et al., 2000] Esra Erdem, Vladimir Lifschitz, and Martin Wong. Wire rout-
ing and satisfiability planning. In Proceedings of International Conference on
Computational Logic, pages 822–836, 2000.
[Erdem et al., 2003] Esra Erdem, Vladimir Lifschitz, Luay Nakhleh, and Donald
Ringe. Reconstructing the evolutionary history of Indo-European languages using
answer set programming. In Proceedings of International Symposium on Practical
Aspects of Declarative Languages (PADL), pages 160–176, 2003.
[Erdoğan and Lifschitz, 2004] Selim T. Erdoğan and Vladimir Lifschitz. Definitions
in answer set programming. In Vladimir Lifschitz and Ilkka Niemelä, editors, Pro-
ceedings of International Conference on Logic Programming and Nonmonotonic
Reasoning (LPNMR), pages 114–126, 2004.
[Erdoğan and Lifschitz, 2006] Selim T. Erdoğan and Vladimir Lifschitz. Actions
193
as special cases. In Proceedings of International Conference on Principles of
Knowledge Representation and Reasoning (KR), pages 377–387, 2006.
[Faber et al., 2004] Wolfgang Faber, Nicola Leone, and Gerard Pfeifer. Recursive
aggregates in disjunctive logic programs: Semantics and complexity. In Proceed-
ings of European Conference on Logics in Artificial Intelligence (JELIA), 2004.
Revised version: http://www.wfaber.com/research/papers/jelia2004.pdf.
[Ferraris et al., 2007] Paolo Ferraris, Joohyung Lee, and Vladimir Lifschitz. A new
perspective on stable models. In Proceedings of International Joint Conference
on Artificial Intelligence (IJCAI), pages 372–379, 2007.
[Gelfond and Galloway, 2001] Michael Gelfond and Joel Galloway. Diagnosing dy-
namic systems in aprolog. In Working Notes of the AAAI Spring Symposium on
Answer Set Programming, 2001.
[Gelfond and Lifschitz, 1988] Michael Gelfond and Vladimir Lifschitz. The stable
model semantics for logic programming. In Robert Kowalski and Kenneth Bowen,
editors, Proceedings of International Logic Programming Conference and Sympo-
sium, pages 1070–1080, 1988.
[Gelfond and Lifschitz, 1991] Michael Gelfond and Vladimir Lifschitz. Classical
negation in logic programs and disjunctive databases. New Generation Com-
puting, 9:365–385, 1991.
[Giunchiglia et al., 2004b] Enrico Giunchiglia, Yuliya Lierler, and Marco Maratea.
SAT-based answer set programming. In Proceedings of National Conference on
Artificial Intelligence (AAAI), pages 61–66, 2004.
194
[Heidt, 2001] Mary Lynn Heidt. Developing an inference engine for ASET-prolog.3
Master’s thesis, University of Texas at El Paso, 2001.
[Heljanko and Niemelä, 2001] Keijo Heljanko and Ilkka Niemelä. Answer set pro-
gramming and bounded model checking. In Working Notes of the AAAI Spring
Symposium on Answer Set Programming, 2001.
[Heljanko, 1999] Keijo Heljanko. Using logic programs with stable model semantics
to solve deadlock and reachability problems for 1-safe Petri nets. In Proc. Fifth
Int’l Conference on Tools and Algorithms for the Construction and Analysis of
Systems, pages 218–223, 1999.
[Heyting, 1930] Arend Heyting. Die formalen Regeln der intuitionistischen Logik.
Sitzunsberichte der Preussischen Akademie von Wissenschaften. Physikalisch-
mathematische Klasse, pages 42–56, 1930.
[Hietalahti et al., 2000] Maarit Hietalahti, Fabio Massacci, and Nielelä Ilkka. a chal-
lenge problem for nonmonotonic reasoning systems. In Proceedings of the 8th
International Workshop on Non-Monotonic Reasoning, 2000.
[Janhunen et al., 2003] Tomi Janhunen, Ilkka Niemelä, Dietmar Seipel, Patrik Si-
mons, and Jia-Huai You. Unfolding partiality and disjunctions in stable model
semantics. CoRR, cs.AI/0303009, 2003.
[Janhunen, 2000] Tomi Janhunen. Comparing the expressive powers of some syntac-
tically restricted classes of logic programs. In Proc. 1st International Conference
on Computational Logic, volume 1861, pages 852–866, 2000.
[Kautz and Selman, 1992] Henry Kautz and Bart Selman. Planning as satisfiability.
In Proceedings of European Conference on Artificial Intelligence (ECAI), pages
359–363, 1992.
3
http://www.krlab.cs.ttu.edu/papers/download/hei01.pdf .
195
[Koksal et al., 2001] Pinar Koksal, Kesim Cicekli, and I. Hakki Toroslu. Specifica-
tion of wrokflow processes using the action description language ⌋. In Working
Notes of the AAAI Spring Symposium on Answer Set Programming, 2001.
[Lee and Lifschitz, 2003] Joohyung Lee and Vladimir Lifschitz. Loop formulas for
disjunctive logic programs. In Proceedings of International Conference on Logic
Programming (ICLP), pages 451–465, 2003.
[Lee and Lifschitz, 2006] Joohyung Lee and Vladimir Lifschitz. A knowledge mod-
ule: buying and selling. In Working Notes of the AAAI Symposium on Formalizing
Background Knowledge, 2006.
[Lierler and Maratea, 2004] Yuliya Lierler and Marco Maratea. Cmodels-2: SAT-
based answer set solver enhanced to non-tight programs. In Procedings of Inter-
national Conference on Logic Programming and Nonmonotonic Reasoning (LP-
NMR), pages 346–350, 2004.
[Lifschitz and Ren, 2006] Vladimir Lifschitz and Wanwan Ren. A modular action
description language. In Proceedings of National Conference on Artificial Intelli-
gence (AAAI), pages 853–859, 2006.
[Lifschitz and Turner, 1994] Vladimir Lifschitz and Hudson Turner. Splitting a logic
program. In Pascal Van Hentenryck, editor, Proceedings of International Confer-
ence on Logic Programming (ICLP), pages 23–37, 1994.
[Lifschitz and Woo, 1992] Vladimir Lifschitz and Thomas Woo. Answer sets in gen-
eral nonmonotonic reasoning (preliminary report). In Bernhard Nebel, Charles
Rich, and William Swartout, editors, Proceedings of International Conference
on Principles of Knowledge Representation and Reasoning (KR), pages 603–614,
1992.
196
[Lifschitz et al., 1999] Vladimir Lifschitz, Lappoon R. Tang, and Hudson Turner.
Nested expressions in logic programs. Annals of Mathematics and Artificial In-
telligence, 25:369–389, 1999.
[Lifschitz et al., 2000] Vladimir Lifschitz, Norman McCain, Emilio Remolina, and
Armando Tacchella. Getting to the airport: The oldest planning problem in AI.
In Jack Minker, editor, Logic-Based Artificial Intelligence, pages 147–165. Kluwer,
2000.
[Lifschitz et al., 2001] Vladimir Lifschitz, David Pearce, and Agustin Valverde.
Strongly equivalent logic programs. ACM Transactions on Computational Logic,
2:526–541, 2001.
[Lifschitz, 1999] Vladimir Lifschitz. Answer set planning. In Proc. ICLP-99, pages
23–37, 1999.
[Lifschitz, 2000] Vladimir Lifschitz. Missionaries and cannibals in the Causal Cal-
culator. In Proceedings of International Conference on Principles of Knowledge
Representation and Reasoning (KR), pages 85–96, 2000.
[Lin and Chen, 2005] Fangzhen Lin and Yin Chen. Discovering classes of strongly
equivalent logic programs. In Proceedings of International Joint Conference on
Artificial Intelligence (IJCAI), 2005. To appear.
[Lin and Zhao, 2002] Fangzhen Lin and Yuting Zhao. ASSAT: Computing answer
sets of a logic program by SAT solvers. In Proceedings of National Conference on
Artificial Intelligence (AAAI), pages 112–117, 2002.
197
[Liu et al., 1998] Xinxin. Liu, C. R. Ramakrishnan, and Scott A. Smolka. Fully
local and efficient evaluation of alternating fixed points. In Proc. Fourth Int’l
Conference on Tools and Algorithms for the Construction and Analysis of Sys-
tems, pages 5–19, 1998.
[Lloyd and Topor, 1984] John Lloyd and Rodney Topor. Making Prolog more ex-
pressive. Journal of Logic Programming, 3:225–240, 1984.
[Lukasiewicz, 1941] J. Lukasiewicz. Die logik und das grundlagenproblem. Les En-
tries de Zürich sur les Fondaments et la Méthode des Sciences Mathématiques,
12(6-9 (1938)):82–100, 1941.
[Marek and Remmel, 2002] Victor Marek and Jeffrey Remmel. On logic programs
with cardinality constraints. In Proc. NMR-02, pages 219–228, 2002.
[Marek and Truszczyński, 1991] Victor Marek and Miroslaw Truszczyński. Au-
toepistemic logic. Journal of ACM, 38:588–619, 1991.
[Marek and Truszczyński, 1999] Victor Marek and Miroslaw Truszczyński. Stable
models and an alternative logic programming paradigm. In The Logic Program-
ming Paradigm: a 25-Year Perspective, pages 375–398. Springer Verlag, 1999.
[Marek et al., 2004] V. Wiktor Marek, Ilkka Niemelä, and Miroslaw Truszczynski.
Logic programs with monotone cardinality atoms. In LPNMR, pages 154–166,
2004.
[McCain and Turner, 1997] Norman McCain and Hudson Turner. Causal theories of
action and change. In Proceedings of National Conference on Artificial Intelligence
(AAAI), pages 460–465, 1997.
198
[McCarthy and Hayes, 1969] John McCarthy and Patrick Hayes. Some philosoph-
ical problems from the standpoint of artificial intelligence. In B. Meltzer and
D. Michie, editors, Machine Intelligence, volume 4, pages 463–502. Edinburgh
University Press, Edinburgh, 1969.
[Niemelä and Simons, 2000] Ilkka Niemelä and Patrik Simons. Extending the Smod-
els system with cardinality and weight constraints. In Jack Minker, editor, Logic-
Based Artificial Intelligence, pages 491–521. Kluwer, 2000.
[Niemelä et al., 1999] Ilkka Niemelä, Patrik Simons, and Timo Soininen. Stable
model semantics for weight constraint rules. In Logic Programming and Non-
monotonic Reasoning: Proc. Fifth Int’l Conf. (Lecture Notes in Artificial Intelli-
gence 1730), pages 317–331, 1999.
[Niemelä, 1999] Ilkka Niemelä. Logic programs with stable model semantics as a
constraint programming paradigm. Annals of Mathematics and Artificial Intelli-
gence, 25:241–273, 1999.
[Osorio et al., 2004] Mauricio Osorio, Juan Antonio Navarro, and José Arrazola.
Safe beliefs for propositional theories. Accepted to appear at Annals of Pure and
Applied Logic, 2004.
[Pearce et al., 2001] David Pearce, Hans Tompits, and Stefan Woltran. Encodings
for equilibrium logic and logic programs with nested expressions. In Proceedings
of Portuguese Conference on Artificial Intelligence (EPIA), pages 306–320, 2001.
[Pearce et al., 2002] David Pearce, Torsten Schaub, Vladimir Sarsakov, Hans Tom-
pits, and Stefan Woltran. A polynomial translation of logic programs with nested
expressions into disjunctive logic programs. In Proc. NMR-02, 2002.
[Pearce, 1997] David Pearce. A new logical characterization of stable models and
answer sets. In Jürgen Dix, Luis Pereira, and Teodor Przymusinski, editors,
199
Non-Monotonic Extensions of Logic Programming (Lecture Notes in Artificial
Intelligence 1216), pages 57–70. Springer-Verlag, 1997.
[Pelov et al., 2003] Nikolay Pelov, Marc Denecker, and Maurice Bruynooghe. Trans-
lation of aggregate programs to normal logic programs. In Proc. Answer Set
Programming, 2003.
[Ruffolo et al., 2006] Massimo Ruffolo, Marco Manna, Lorenzo Gallucci, Nicola
Leone, and Domenico Saccà. A logic-based tool for semantic information ex-
traction. In JELIA, pages 506–510, 2006.
[Sabuncu et al., 2004] Orkunt Sabuncu, Ferda Nur Alpaslan, and Varol Akman.
Using criticalities as a heuristic for answer set programming. In Proceedings of
International Conference on Logic Programming and Nonmonotonic Reasoning
(LPNMR), pages 234–246, 2004.
[Sakama, 2001] Chiaki Sakama. Learning by answer sets. In Working Notes of the
AAAI Spring Symposium on Answer Set Programming, 2001.
[Simons et al., 2002] Patrik Simons, Ilkka Niemelä, and Timo Soininen. Extending
and implementing the stable model semantics. Artificial Intelligence, 138:181–234,
2002.
[Soininen and Niemelä, 1998] Timo Soininen and Ilkka Niemelä. Developing a
declarative rule language for applications in product configuration. In Gopal
Gupta, editor, Proceedings of International Symposium on Practical Aspects of
Declarative Languages (PADL), pages 305–319. Springer-Verlag, 1998.
[Soininen et al., 1999] Timo Soininen, Esthera Gelle, and Ilkka Niemelä. A fix-
point definition of dynamic constraint satisfaction. In Ronald Brachman, Hector
Levesque, and Raymond Reiter, editors, Proc. Fifth Int’l Conf. on Principles and
Practice of Constraint Programming, pages 419–433, 1999.
200
[Son and Lobo, 2001] Tran Cao Son and Jorge Lobo. Reasoning about policies using
logic programs. In Working Notes of the AAAI Spring Symposium on Answer Set
Programming, 2001.
[Subrahmanian and Zaniolo, 1995] V.S. Subrahmanian and Carlo Zaniolo. Relating
stable models and AI planning domains. In Proceedings of International Confer-
ence on Logic Programming (ICLP), 1995.
[Trajcevski et al., 2000] Goce Trajcevski, Chitta Baral, and Jorge Lobo. Formal-
izing (and reasoning about) the specifications of workflows. In Proceedings of
the Fifth IFCIS International conference on Cooperative Information Systems
(CoopIS’2000), 2000.
[Turner, 2003] Hudson Turner. Strong equivalence made easy: nested expressions
and weight constraints. Theory and Practice of Logic Programming, 3(4,5):609–
622, 2003.
[Turner, 2004] Hudson Turner. Strong equivalence for causal theories. In Pro-
ceedings of International Conference on Logic Programming and Nonmonotonic
Reasoning (LPNMR), pages 289–301, 2004.
[van Emden and Kowalski, 1976] Maarten van Emden and Robert Kowalski. The
semantics of predicate logic as a programming language. Journal of ACM,
23(4):733–742, 1976.
201
Vita
Paolo Ferraris was born in Genova, Italy in 1972, son of Italo Ferraris and Franca
Nicola. He has a brother — Enrico Ferraris — who is two years older than him.
He got an high school diploma at Liceo Scientifico Cristoforo Colombo (Genova)
in 1991 and a Laurea degree (between B.S. and M.S.) in Computer Engineering
in 1999 at the Università degli Studi di Genova. After a three month visit to the
United States in 2000, he worked as a software engineer at Marconi Communications,
a hardware developer for telecommunication companies. In 2001 he enrolled into
the PhD program in Computer Science at the University of Texas at Austin. To be
mentioned are his participations at the ACM Collegiate Programming Contest world
finals in 2002 and 2003 in teams representing the University of Texas at Austin.
202