185
FIRST-ORDER ANSWER SET PROGRAMMING AND CLASSICAL FIRST-ORDER LOGIC A THESIS SUBMITTED TO THE UNIVERISTY OF WESTERN SYDNEY FOR THE DEGREE OF DOCTOR OF PHILOSOPHY Vernon Asuncion February 2013

researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

FIRST-ORDER ANSWER SET PROGRAMMING ANDCLASSICAL FIRST-ORDER LOGIC

A THESIS

SUBMITTED TO THE UNIVERISTY OF WESTERN SYDNEY

FOR THE DEGREE OF

DOCTOR OF PHILOSOPHY

Vernon Asuncion

February 2013

Page 2: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

Copyright c© V. Asuncion 2013

Typeset in Times with TEX and LATEX2e

iv

Page 3: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

Except where otherwise indicated, this thesis is my own original work. I certify that this

thesis contains no material that has been submitted previously, in whole or in part, for the

award of any other academic degree.

Vernon Asuncion

May 2012

Page 4: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

Acknowledgements

First and foremost, none of this would be possible without the help, guidance, encourage-

ment, and support of my supervisor Yan Zhang. It is for this reason that I would like to

thank Yan for all that he had provided to me from my days as a 3rdyear undergraduate

student, to my Honours year, and my most recent years as a Ph.D. candidate. I would spe-

cially like to thank Yan for keeping me on the correct path throughout my research work,

which included him having to listen to my immature ideas.

I would also like to thank Yi Zhou for all the help and advice that he had given and

in particular, for showing me the skills of paper writing. I also benefited from discussions

with Yin Chen, Joohyung Lee, and Torsten Schaub. I would also like to mention the other

useful discussion I had with the other ISL members.

Last (but not least), I would also like to thank my family for helping me throughout my

studies, and for motivating me by setting me the challenge ofachieving this.

Page 5: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

Abstract

Answer Set Programming (ASP) is a form of declarative programming oriented towards

difficult and primarily NP-hard search problems. Generallyspeaking, an ASP search prob-

lem is formulated as a theory of some language of formal logic. The formalization is

designed in such a way that the problem description is usually separate from the prob-

lem instance. Thus, once a particular encoding of a problem instance is combined with

the problem description, it results in some theory of formallogic whosemodels(under a

particular semantics) corresponds to a solution of the problem instance.

This thesis is about the translation of ASP programs into classical first-order logic the-

ories. Viewed in the context of expressing logic programs with variables into (classical)

first-order logic, work of this direction goes all the way back to Clark who gave us what

is now called the Clark’s completion semantics, on which thiswork is based. This work

modifies the Clark’s completion in such a way that the models ofthe modified comple-

tion corresponds exactly to the answer sets. We then report on such an implementation of

grounding completely on first-order theories rather than onprograms (i.e., as is the case

with traditional ASP solvers), and show that the new approach is quite competitive with

current effective solvers on very large instances of the Hamiltonian circuit program. In

addition, we further consider the translation of logic programs with aggregates (a very im-

portant building block of ASP) under the stable model semantics, into classical first-order

theories.

Preferences play an important role in knowledge representation and reasoning. In the

past decade, a number of approaches for handling preferences have been developed in var-

ious nonmonotonic reasoning formalisms, while adding preferences into ASP has been

known to have promising advantages from both implementation and application view-

points. This thesis also extends the notion of preferred ASP(i.e., answer set program-

ming with preferrence relations among the rules), that is currently only formalized for

Page 6: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

propositional programs, into the notion of first-order ASP.To this aim, we develop both a

(first-order) fixpoint type characterization that is similarto Zhang and Zhou’s progression

semantics, and a classical logic formulation so that the preferred answer sets are exactly

those models of the logic formula. We further show that the fixpoint type characterization

and classical logic formulation coincide.

Page 7: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

Contents

Acknowledgements

Abstract

1 Introduction to Answer Set Programming 1

1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Research Work in ASP . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2.1 First-Order Answer Set Programming . . . . . . . . . . . . . . .. 6

1.2.2 Stable Models of Arbitrary Formulas . . . . . . . . . . . . . . .. 10

1.2.3 Loop Formulas Approach . . . . . . . . . . . . . . . . . . . . . . 15

1.2.4 ASP with Aggregates . . . . . . . . . . . . . . . . . . . . . . . . . 17

1.2.5 Preferred ASP . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

1.2.6 Important Preferred Program Frameworks . . . . . . . . . . .. . . 21

1.3 Structure of the Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . .26

2 First-Order ASP and Classical First-Order Logic 28

2.1 Past Efforts in Linking Logic Programs and Classical Logics . . . . . . . . 28

2.2 The Clark’s Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

2.3 The Ordered Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

2.3.1 Positive Predicate Dependency Graphs and Tight Programs . . . . . 34

2.3.2 Intuition of the Ordered Completion . . . . . . . . . . . . . . . .. 35

2.3.3 Definition of the Ordered Completion . . . . . . . . . . . . . . . .36

2.3.4 The Main Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . 41

2.3.5 Normal Programs with Constraints . . . . . . . . . . . . . . . . . .44

2.3.6 Adding Choice Rules . . . . . . . . . . . . . . . . . . . . . . . . . 46

Page 8: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

2.3.7 Arbitrary Structures and Disjunctive Programs . . . . .. . . . . . 48

2.3.8 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

2.4 Ordered Completion with Aggregates . . . . . . . . . . . . . . . . . .. . 55

2.4.1 The Stable Model Semantics for Aggregates . . . . . . . . . .. . . 59

2.4.2 Extension of Ordered Completion for Aggregates . . . . . .. . . . 61

2.4.3 Externally Supported Sets with Aggregates . . . . . . . . .. . . . 66

2.4.4 Theorem of Ordered Completion with Aggregates . . . . . . .. . 67

2.4.5 Aggregate Constructs as Classical FO Logic . . . . . . . . . . .. . 69

2.4.6 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

3 Implementation and Experimental Results 77

3.1 Grounding ASP Programs . . . . . . . . . . . . . . . . . . . . . . . . . . 77

3.2 Domain Predicates and Guarded Variables . . . . . . . . . . . . .. . . . . 78

3.3 Ordered Completion vs Clark’s Completion . . . . . . . . . . . . . . .. . 79

3.4 Grounding Ordered Completion . . . . . . . . . . . . . . . . . . . . . . .81

3.4.1 Constructing Domains Using Partial Structures . . . . . .. . . . . 82

3.4.2 Dynamic Domain Relations . . . . . . . . . . . . . . . . . . . . . 86

3.4.3 Grounding on a Domain Predicate Sequence . . . . . . . . . . .. 88

3.4.4 Incorporating Classical Reasoning . . . . . . . . . . . . . . . . .. 90

3.4.5 Iteration and Conversion to SMT . . . . . . . . . . . . . . . . . . . 91

3.5 Experimental Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

3.6 Further Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

4 Preferred FO Answer Set Programs 97

4.1 Lifting Preferred Answer Set Programming to First-Order. . . . . . . . . . 97

4.2 A Progression Based Semantics . . . . . . . . . . . . . . . . . . . . . . .98

4.3 Properties of Preferred Answer Sets . . . . . . . . . . . . . . . . .. . . . 103

4.3.1 Grounding Preferred programs . . . . . . . . . . . . . . . . . . . .104

4.3.2 Semantic Properties . . . . . . . . . . . . . . . . . . . . . . . . . 108

4.4 Logical Characterizations . . . . . . . . . . . . . . . . . . . . . . . . .. . 111

4.4.1 Formulas Representing Generating Rules and Program Completion 112

4.4.2 Well-Orderings on Generating Rules in Terms of Structures . . . . 113

4.4.3 Formalizing Progression . . . . . . . . . . . . . . . . . . . . . . . 114

Page 9: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

4.4.4 Incorporating Preference . . . . . . . . . . . . . . . . . . . . . . .119

4.5 Related Work and Further Remarks . . . . . . . . . . . . . . . . . . . . . .123

5 Summary of Contributions and Future Work 125

5.1 Ordered Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

5.1.1 Incorporating Aggregates . . . . . . . . . . . . . . . . . . . . . . .127

5.2 Solver Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . .129

5.3 Preferred ASP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

5.4 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131

A Proofs 134

A.1 Proofs for Chapter 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

A.1.1 Proof of Lemma 1 . . . . . . . . . . . . . . . . . . . . . . . . . . 134

A.1.2 Proof of Theorem 2 . . . . . . . . . . . . . . . . . . . . . . . . . . 136

A.1.3 Proof of Lemma 2 . . . . . . . . . . . . . . . . . . . . . . . . . . 138

A.1.4 Proof of Theorem 3 . . . . . . . . . . . . . . . . . . . . . . . . . . 141

A.2 Proofs for Chapter 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

A.2.1 Proof of Proposition 14 . . . . . . . . . . . . . . . . . . . . . . . . 145

A.2.2 Proof of Theorem 6 . . . . . . . . . . . . . . . . . . . . . . . . . . 150

A.2.3 Proof of Lemma 3 . . . . . . . . . . . . . . . . . . . . . . . . . . 151

A.2.4 Proof of Lemma 4 . . . . . . . . . . . . . . . . . . . . . . . . . . 152

A.2.5 Proof of Theorem 10 . . . . . . . . . . . . . . . . . . . . . . . . . 153

A.2.6 Proof of Theorem 11 . . . . . . . . . . . . . . . . . . . . . . . . . 161

References 170

Page 10: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

Chapter 1

Introduction to Answer Set

Programming

1.1 Introduction

Answer Set Programming (ASP) is a form of declarative programming oriented towards

difficult and primarily NP-hard search problems. Generallyspeaking, an ASP search prob-

lem is formulated as a theory of some language of formal logic. The formalization is

designed in such a way that the problem description is usually separate from the prob-

lem instance. Thus, once a particular encoding of a problem instance is combined with

the problem description, it results in some theory of formallogic whosemodels(under a

particular semantics) corresponds to a solution of the problem instance. ASP turned out

to be particularly useful in knowledge-intensive applications such as automated product

configuration [TSNS03], decision support for the space shuttle [NBG+01], and inferring

phylogenetic trees [BEE+07].

ASP programs arelogic programsthat are usually interpreted under thestable model

(also calledanswer set) semantics as introduced by Gelfond and Lifschitz in [GL88]. Un-

like its Prolog logic programming counterpart, ASP programs are fully declarative in the

sense that neither the ordering of the rules in the programs or the ordering of literals in the

rules have any effect on the answer sets. In fact, it even goesfurther that it has, if any, only

a negligible effect on the computation of answer sets. This is due to the clear separation of

the problem description from that of the problem instance, since the fully declarative nature

1

Page 11: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 2

of the problem description allows one to apply the necessarypreprocessing even before the

problem instance had arrived. The effectiveness of this approach is due to the reason that

the problem instance is usually many magnitudes bigger in size than the problem descrip-

tion. Thus, as already mentioned above, any preprocessing on the problem description will

only have a very neglible effect in the whole computation process.

In the traditional manner, the answer set semantics of logicprograms with variables

is defined in two steps. First, since the answer set semanticswas originally defined by

Gelfond and Lifschitz in [GL88] based on the syntax of propositional logic programs, it

was necessary to first ground the program by replacing all thevariables mentioned in it by

domain constants of the corresponding problem instance. The answer set of the program

is then defined as theminimalmodel of the program’s so-called “Gelfond-Lifschitz reduc-

tion” (named after its inventors). TheGelfond-Lifschitz reduction(or just reductionwhen

clear from the context) is a “simplification” of the program where only positive atoms are

mentioned in the “reduced” program. This two step process isalso reflected in the way

current ASP solver systems (softwares for finding solutionsto ASP encodings) work by

also having the two step process of first grounding the underlying program, and then on

the actual solving of the resulting propositional program.Currently, the softwares used in

each steps, calledgroundersandsolvers, respectively, have already reached such a high

level of performance that it is now possible to use these on ASP encodings corresponding

to problems of practical importance.

The notion of the Gelfond-Lifschitz reduction and answer sets was extended to arbi-

trary formulas by Pearce in [Pea96] via the so-calledequillibrium logic and the logic of

here-and-there(HT) that is based on Kripke models. Generally speaking, thelogic of HT

generalizes the notion of the Gelfond-Lifschitz reductionfrom the restricted syntax of rules

of logic programs into arbitrary propositional formulas. The so-called equillibrium models

then correspond to the minimal models of the propositional formula’s reducts. This notion

of reduct was then solely defined in terms of classical propositional theories by Ferraris

in [Fer05]. Ferraris in [Fer05] defined the reductFX of an (arbitrary) propositional for-

mulaF in terms of a setX of atoms by a recursive definition that is obtained via a similar

method in [Pea96], but where the formula was already simplified by replacing its appro-

priate subformulas by⊥ (falsity), depending on whether or notX satisfies the particular

subformula.

Page 12: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 3

The works of Pearce [Pea96] and Ferraris [Fer05] opened up the avenue for defining the

answer set semantics offirst-order(FO) formuals. In fact, Pearce et. al. in [PV05] extended

the answer set semantics to first-order formulas via the so-called first-order equilibrium

logic. Then, by viewing answer set programs with variables as first-order formulas, it is

now possible to define atruly first-orderanswer set semantics for “first-order” answer set

programs. Then a surprising result of Ferraris et. al. in [FLL07] is the direct encoding of

the first-order equilibrium models as a classical second-order (SO) sentence via theSM

operator. TheSM operator takes any arbitrary first-order formulaϕ, and then translates

it into a (universal) second-order sentenceSM(ϕ) such that the models ofSM(ϕ) are

exactly the answer sets ofϕ. Then, by again viewing answer set programs with variables

as first-order formulas, it is now possible to define the first-order answer set semantics of

programs in terms of classical logic.

1.2 Research Work in ASP

In this section, we describe a brief history of the current research that had occured in the

paradigm of ASP. To this aim, we first introduce the formal syntax of answer set programs,

along with the formal definition of stable models (or answer sets).

A normal answer set program (or justprogramwhen clear from the context)1 Π of

some propositional signatureL is a finite set of rulesr of the form

a← b1, · · · , bl, not c1, · · · , not cm, (1.1)

wherea, bi (1 ≤ i ≤ l), andci (1 ≤ i ≤ m) are propositional atoms fromL. The atoma is

called theheadof r and is denoted byHead(r), the set{b1, · · · , bl, not c1, · · · , not cm} is

called thebodyof r and is denoted byBody(r). The setBody(r) can be further subdivided

into two setsPos(r) andNeg(r), called thepositiveandnegativebodies ofr respectively,

such thatPos(r) = {b1, · · · , bl} andNeg(r) = {c1, · · · , cm}. WhenHead(r) is non-

existent (i.e.,r has no head), thenr is called aconstraint.

The semantics of answer set programming was originally defined in terms of itsGelfond-

Lifschitzreduction, named after its inventors [GL88], and is referredto as thestable models

semantics, or what we willmostlyrefer to as theanswer setssemantics. Given a program

1We assume all answer set programs to be “normal” unless stated otherwise.

Page 13: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 4

Π and an interpretationI ⊆ L, by ΠI , we denote the (Gelfond-Lifschitz) reduction ofΠ

such thatΠI is obtained fromΠ by:

1. Deleting all rulesr ∈ Π from Π whereNeg(r) ∩ I 6= ∅;

2. Transforming all remaing rulesr of the form (1.1) intoa ← b1, · · · , bl, i.e., simply

deleted the “negative” part of its body.

Then clearly,ΠI is now apositive(or negationfree) program. Now byΠI , we denote the

propositional formula

r∈ΠI ,r= a←b1,··· ,bl

(b1 ∧ · · · ∧ bl → a). (1.2)

Then ΠI is usually referred to as thelogical closureΠI (note thatΠI is a propositional

formula whileΠI is not). ThenI is said to be astable model(or answer set) of Π iff:

1. I |= ΠI ;

2. For all other interpretationsI ′ ⊂ I (i.e.,I ′ is a strict-subsetI), I ′ 6|= ΠI .

In other words, an interpretationI ⊆ L is a stable model ofΠ iff it is a minimal modelof

the closure of its reduct, i.e.,ΠI .

Example 1 Assume we haveL = {a, b, c, d} andΠ as the program

a← not c

b← a, not d

c← not a

d← not b.

Then withI = {a, b}, we show thatI is an answer set ofΠ. Indeed, since for the rules

“c ← not a” and “d ← not b,” we have thata ∈ I andb ∈ I, then these two rules will

be deleted fromΠ so they will not be in the reductΠI . Then through the deletion of the

negative bodies of the remaining two rules “b ← a, not d” and “a ← not c” (i.e., to end

Page 14: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 5

up with the two rules “b ← a” and “a ←” respectively), we have the reductΠI to be the

(negation free) program:

a←

b← a.

ThenΠI is simply the propositional formulaa ∧ (a→ b). It is then not too difficult to see

that{a, b} is also a minimal model ofa ∧ (a → b) so thatI is an answer set ofΠ. Note

that when the body is empty, as in the rule “a ←” of ΠI , thena is what is so-called afact,

and where facts are always assumed to be present in any answerset.

Incidentally, the (Gelfond-Lifschitz) reduction of a program is a way of viewing the

“not ” operator asnegation by failure. The “not ” operator differs in meaning from the

classical ‘¬’ connective (i.e., “not ” is simply not denoted by ‘¬’ in programs) in that an

atoma under “not a” is assumed to be non-provable from thereductof the program. To

see the difference, letΠ be the program

b← a

← not a.

Then, if we view “not ” as the classical connective ‘¬’ and the rules “b← a” and “← not a”

as the classical implications “a → b” and “¬a → ⊥,” respectively, we have thatΠ is the

propositional formula

(a→ b) ∧ (¬a→ ⊥)

≡(a→ b) ∧ a.

Then under this context,{a, b} is a minimal model ofΠ. Now let us consider the case

where “not ” is viewed as negation by failure. Then we have thatΠ{a,b} is the reduced

program

b← a,

Page 15: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 6

i.e., the constraint “← not a” was deleted sincea ∈ {a, b}. ThenΠ{a,b} in this case is

simply the propositional formula

a→ b,

and such that{} (i.e., the empty set) is its minimal model. So in this case, since{} 6= {a, b},

then we have that{a, b} is not an answer set ofΠ.

1.2.1 First-Order Answer Set Programming

A recent enhancement to answer set programming is the so-called first-order (FO) answer

set programming. In traditional answer set programming approaches, a program with vari-

ables is simply viewed as a shorthand of itsHerbrand instantiation. For example, assume

Π to be the following program with variablesx, y andz, and constantsa, b, andc:

E(a, b)←

E(b, c)←

T (x, y)← E(x, y)

T (x, z)← E(x, y), T (y, z).

ThenΠ is simply viewed as a shorthand for the propositional program

E(a, b)←

E(b, a)←

T (a, a)← E(a, a)

T (a, b)← E(a, b)

T (b, a)← E(b, a)

T (b, b)← E(b, b)

T (a, a)← E(a, a), T (a, a)

T (a, a)← E(a, b), T (b, a)

(1.3)

Page 16: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 7

T (a, b)← E(a, a), T (a, b)

T (a, b)← E(a, b), T (b, b)

T (b, a)← E(b, a), T (a, a)

T (b, a)← E(b, b), T (b, a)

T (b, b)← E(b, a), T (a, b)

T (b, b)← E(b, b), T (b, b),

which was obtained fromΠ by subtituting the constantsa, b, andc for the variablesx, y, and

z in all possible ways. Thus, in this context, each of the constantsa, b, andc are interpreted

as theirHerbrand interpretation, i.e., we think ofa, b, andc as literally constantsa, b, and

c respectively. This is in contrast with that of FO logic sincethe constantsa, b, andc can

stand for different domain objects. Hence, under this notion, the traditional approach of

answer set programming with variables isnot trulyFO.

To get over this representational limit, a truly FO characterization of answer set pro-

grams is achieved by using a kind ofminimality expression about the extents of some its

predicates. This is achieved by a SO sentence thatuniversallyquantifies over these “in-

tended” predicates. Hence, through a universal SO sentence, one will now be able to define

the answer sets of a FO program without any reference to the grounding (or “proposition-

alization”) of the program. Before proceeding, we first formally define the syntax of FO

answer set programs.

A first-order normal answer set program (or simply call FO program)Π is a finite set

of rulesr of the form

α← β1, · · · , βl, not γ1, · · · , not γm, (1.4)

such thatα, βi (1 ≤ i ≤ l), andγi (1 ≤ i ≤ m) are atomic formulas of the formP (x)

wherex is a tuple of terms (i.e., can be variables or constants) whose length matches the

arity ofP . As in the case of propositional programs, the atomα is called theheadof r and

is denoted byHead(r), the set of literals2 {β1, · · · , βl, not γ1, · · · , not γm} is called the

bodyof r and is denoted byBody(r). The setBody(r) can be further subdivided intor’s

“positive” and “negative” bodies. Hence byPos(r), we denote the set{β1, · · · , βl}, which

2Note that under our context here, “not γi” (1 ≤ i ≤ m) is a literal.

Page 17: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 8

is called thepositive bodyof r, and byNeg(r), we denote the set{γ1, · · · , γm}, which

is called thenegative bodyof r. For convenience, for a given programΠ, we denote by

τ(Π) as the signature of the programΠ. As in the case of propositional programs, when the

Head(r) is non-existent (i.e., the rule has no head), thenr is what is so-called aconstraint.

In our notion here of FO answer set programs, we distinguish between the so-called

extensionalandintensionalpredicates. The intensional predicates are simply those predi-

cates that are mentioned in the heads of some rules of the program and the other predicates

are referred to as extensional. Conceptually, the “extensional” predicates are viewed as the

input and the “intensional” predicates as the output of the program. For instance, assume

we haveΠ to be the well-known program that computes the transitive closure of a graph

G = (V,E):

T (x, y)← E(x, y)

T (x, z)← E(x, y), T (y, z),

such that our signatureτ(Π) in this case is{T,E}. Then under this context, given a graph

structureG = (Dom(G), EG) such thatDom(G) are the graph’s vertices andEG its edge

relations, the programΠ will output the transitive closure of those edge relations of G.

For convenience, in addition to denoting the signature ofΠ to beτ(Π), we also denote by

Pext(Π) andPint(Π) as the sets ofextensionaland intensionalpredicate symbols respec-

tively.

From here on, we reserve a special type of extensional predicate called theequality

predicate, denoted by the symbol ‘=’ and of arity 2, and such that we assume that ‘=’ is in

τ(Π) for any programΠ (i.e., whether or not ‘=’ is actually mentioned inΠ). Moreover,

for any givenτ(Π)-structureM, we assume that=M is the interpretation

{(a, a) | a ∈ Dom(M)}

(i.e., theequality relations) and such that we take= (x, y), or x = y using the usualinfix

notation, to mean thatx is equal toy.

Now we introduce thestable modelssemantics of FO programs. So for this purpose,

Page 18: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 9

for a given FO programΠ, setΠ as the FO sentence

r∈Π,r:= α←β1,··· ,βl,not γ1,··· ,not γm

∀xr(β1 ∧ · · · ∧ βl ∧ ¬γ1 ∧ · · · ∧ ¬γm → α) (1.5)

where for a ruler ∈ Π, xr denotes all the variables occurring inr. ThenΠ is usually

referred to as theuniversal closureof Π. Now assume that the set of intensional predicates

Pint(Π) is the set{P1, · · · , Pn} and letP = P1 · · ·Pn such thatP is a tuple of distinguish-

able intensional predicates. Then, setU = U1 · · ·Un to be another tuple of fresh (i.e., they

are not inτ ) distinguishable predicates such that eachUi for 1 ≤ i ≤ n matches the arity

of Pi. Now define the SO formulaΠ∗(U) as

r∈Π,r:= α←β1,··· ,βl,not γ1,··· ,not γm

∀xr(β∗1 ∧ · · · ∧ β

∗l ∧ ¬γ1 ∧ · · · ∧ ¬γm → α∗), (1.6)

where for an atomic formulaP (x): if P = Pi for some1 ≤ i ≤ n (i.e.,P is intensional)

thenP (x)∗ = Ui(x), andP (x)∗ = P (x) otherwise (i.e., ifP is extensional). So finally, by

SM(Π) (i.e., “SM ” for “ stable model”), denote theuniversalSO sentence

Π ∧ ∀U(U < P→ ¬Π∗(U)), (1.7)

whereU < P denotes the FO sentence

1≤i≤n

∀xi(Ui(xi)→ P (xi)) ∧ ¬∧

1≤i≤n

∀xi(Pi(xi)→ Ui(xi)), (1.8)

which basically states thatUi ⊆ Pi for all 1 ≤ i ≤ n and thatUj ⊂ Pj (strict subset) for

some1 ≤ j ≤ n. Then aτ(Π)-structureM is said to be astable modelor answer setof Π

iff M |= SM(Π).

Informally speaking, the SO sentenceSM(Π) is a “first-order” way of expressing a

minimal model ofΠ’s reduct. Indeed, the formulaΠ∗(U) corresponds in a way to the

reduct and such that we look for a “minimal” model of it. This is expressed by the fact

that we look for aτ(Π)-structureM that satisfies the universal closureΠ and where there

cannot exist anotherτ(Π)-structureM′ that is smaller in the extents of the intensional

predicates that satisfiesΠ∗(U), i.e., as expressed by∀U(U < P→ ¬Π∗(U)). It is not too

Page 19: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 10

difficult to show that our notion ofSM(Π) here corresponds to that as proposed in [FLL11]

when restricted to the syntax of (the universal closures of)normal answer set programs.

Novel as this truly FO characterization seems, it has one major drawback, which is the

fact that we resorted to auniversalSO sentence, i.e., weuniversallyquantified over the

extents of the intensional predicates. From even just themodel checkingviewpoint, it is

immediately apparent that in verifying if a candidate structureM is a modelSM(Π), one

will have to consider all possible structuresM′ for which we havePM′

i ⊂ PMi for some

1 ≤ i ≤ n. Even under the context offinite structures, this will result in exponential time

in the worst case, i.e., since there are anasymptoticallyexponential number of possible

strict subsets of a given set. So a natural question to ask is:can the stable models semantics

of first-order answer set programs be defined without resorting to a universal second-order

sentence?Fortunately, in this work, we provide a positive answer to this question. In fact,

until now and to the best of our knowledge, our work is the firstsuch one. As will be seen

in Chapter 2, we will show a polynomial translation of FO programs into FO sentence with

fresh predicates [ALZZ12].

1.2.2 Stable Models of Arbitrary Formulas

Propositional equilibrium logic

Pearce extended the notion of the stable models semantics toarbitrary propositional for-

mulas via his so-calledequilibrium logic[Pea96]. Equilibrium logic is based on the logic

of here-and-there(HT).3 To define the semantics of propositional HT, first let us assume

a propositional signatureL and interpretationsH ⊆ L (i.e., ‘H ’ for “here”) andT ⊆ L

(i.e., ‘T ’ for “there”) and whereH ⊆ T . Then the tuple〈H, T 〉 is called ahere-and-there

interpretation, or simply a HT interpretation. The satisfaction relation〈H, T 〉 |=HT ϕ, for

some propositional formulaϕ of L, is now recursively defined as follows:

• If ϕ = ⊥, then〈H, T 〉 6|=HT ϕ;

• If ϕ = ⊤, then〈H, T 〉 |=HT ϕ;

• If ϕ = a for somea ∈ L, then〈H, T 〉 |=HT ϕ iff a ∈ H;

• If ϕ = ψ ∧ ξ, then〈H, T 〉 |=HT ϕ iff 〈H, T 〉 |=HT ψ and〈H, T 〉 |=HT ξ;

3For simplicity here, we do not refer to the more rigorous notion ofKripke structures.

Page 20: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 11

• If ϕ = ψ ∨ ξ, then〈H, T 〉 |=HT ϕ iff 〈H, T 〉 |=HT ψ or 〈H, T 〉 |=HT ξ;

• If ϕ = ψ → ξ, then〈H, T 〉 |=HT ϕ iff both conditions are satisfied:

– 〈H, T 〉 6|=HT ψ or 〈H, T 〉 |=HT ξ;

– T |= ψ → ξ (i.e., where|= in here is simply the classical satisfaction relation),

and where we view¬ϕ as the shorthand forϕ → ⊥, i.e., the connective ‘¬’ is not in our

language since we view¬ϕ asϕ → ⊥. Then a HT interepretation〈H, T 〉 is said to be an

equilibrium modelof ϕ iff:

1. 〈H, T 〉 |=HT ϕ and whereH = T , i.e., we require the “here” world to be equal to

the “there” world;

2. For all other interpretationsH ′ whereH ′ ⊂ H, we have that〈H ′, T 〉 6|=HT ϕ, i.e.,

the HT interpretation is “here” minimal.

From [Pea96], it also follows that the stable models of an arbitrary propositional formulaϕ

are precisely its equilibrium models. Note that this generalizes the stable models semantics

from the “syntactical” restriction of propositional programs to propositional formulas of

arbitrary (syntactical) structures.

For intuition, let us refer back to the concept of the Gelfond-Lifschitz reduction, or sim-

ply thereduction, of a propositional programΠ. In the HT interpretation〈H, T 〉, the world

“here” plays the role of the reduct via the interpretationT and such that the minimality

requirement of this “here” world corresponds to the minimalmodels of this reduct. To see

this, assumer to be the rule

b← not a.

Then viewingr as the “classical” implication and “not ” as the “classical” ‘¬’ connective,

gives us the propositional formula

¬a→ b.

Then since we view¬a asa→ ⊥ in the logic of HT, this further gives us

(a→ ⊥)→ b.

Page 21: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 12

Now let us assume a HT interpretation〈H, T 〉 such thatH = T = {a}. Then, by the

definition of the HT satisfaction relation|=HT , we have that〈H, T 〉 |=HT (a → ⊥) → b

iff:

• 〈H, T 〉 6|=HT a→ ⊥ or 〈H, T 〉 |=HT b;

• T |= a ∧ (a→ ⊥)→ b.

Then since〈H, T 〉 6|=HT b, we must have〈H, T 〉 6|=HT a → ⊥. Then, since we have

〈H, T 〉 6|=HT a→ ⊥ iff

• 〈H, T 〉 |=HT a and〈H, T 〉 6|=HT ⊥, or

• T 6|= a→ ⊥,

and wherea → ⊥ ≡ ¬a (i.e., classically), thenT 6|= a → ⊥ ≡ ¬a always holds.

Thus, because of this condition (i.e., where this conditioncorresponds to the activation

of the reduct), we will have that〈H ′, T 〉 |=HT (a → ⊥) → b for all interpretationsH ′

whereH ′ ⊂ H. Therefore, it follows from the definition of an equilibriummodel thata

is not a stable model (or answer set) ofΠ. Hence, even though{a} is a minimal model

of the “classical view” of the rule “b ← not a” (i.e., which is the propositional formula

“¬a→ b”), it is not necessarily a “here” minimal HT interpretation.

First-order equilibrium logic

This notion of equilibrium models was extended to the first-order case of arbitrary FO for-

mulas in [PV05] by extending to a FO notion of the logic ofhere-and-there(HT). Assuming

a signatureτ , a FO HT interpretation is a pair ofτ -structures〈H, T 〉 such that:

1. Dom(H) = Dom(T );

2. cH = cT for each constant symbolc ∈ τ ;

3. RH ⊆ RT for each relation symbolR ∈ τ .

As in the propositional case, the structuresH andT corresponds to the worlds “here” and

“there” respectively. Then the FO HT satisfaction relation〈H, T 〉 |=HT ϕ(x)[x/a] for

some FO formulaϕ is defined recursively as follows:

Page 22: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 13

• If ϕ(x) = ⊥, then〈H, T 〉 6|=HT ϕ(x)[x/a];

• If ϕ(x) = ⊤, then〈H, T 〉 |=HT ϕ(x)[x/a];

• If ϕ(x) = R(t1, · · · , tk) for some relational symbolR ∈ τ and tuple of terms

(t1, · · · , tk), then〈H, T 〉 |=HT ϕ(x)[x/a] iff (b1, · · · , bk) ∈ RH (i.e., the “here”

structure) such that for1 ≤ i ≤ k:

bi =

aj if ti = xj for some1 ≤ j ≤ s

cT if ti = c for some constantc ∈ τ ;

• If ϕ = (ψ ∧ ξ), then 〈H, T 〉 |=HT ϕ(x)[x/a] iff 〈H, T 〉 |=HT ψ(x)[x/a] and

〈H, T 〉 |=HT ξ(x)[x/a];

• If ϕ = (ψ ∨ ξ), then〈H, T 〉 |=HT ϕ(x)[x/a] iff 〈H, T 〉 |=HT ψ(x)[x/a] or

〈H, T 〉 |=HT ξ(x)[x/a];

• If ϕ = ∃xψ, then〈H, T 〉 |=HT ϕ(x)[x/a] iff there exist somea ∈ Dom(T ) such

that 〈H, T 〉 |=HT ψ(xx)[xx/aa] (i.e., wherexx = x1 · · · xsx andaa = a1 · · · asa

are extensions ofx anda respectively);

• If ϕ = ∀xψ, then〈H, T 〉 |=HT ϕ(x)[x/a] iff for all a ∈ Dom(T ), we have

〈H, T 〉 |=HT ψ(xx)[xx/aa];

• If ϕ = (ψ → ξ), then〈H, T 〉 |=HT ϕ(x)[x/a] iff:

– 〈H, T 〉 6|=HT ψ(x)[x/a] or 〈H, T 〉 |=HT ξ(x)[x/a]

– T |= (ψ → ξ)[x/a] (i.e., where|= is simply the “classical” FO satisfaction

relation),

and where we view¬ϕ as a shorthand forϕ→ ⊥ as usual. Note that whenϕ is a sentence

(i.e., has no free variables), then the HT satisfaction relation is simply 〈H, T 〉 |=HT ϕ.

It follows from [PV05] that a HT interpretation〈H, T 〉 is anequilibrium modelof a FO

sentenceϕ iff:

1. 〈H, T 〉 |=HT ϕ and where for each relation symbolR ∈ τ , we have thatRH = RT ,

i.e., loosely speaking, “here” and “there” are the same;

Page 23: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 14

2. For all otherτ -structuresH′ such that:

(a) Dom(H′) = Dom(H);

(b) cH′

= cH for each constant symbolc ∈ τ ;

(c) RH′

⊆ RH for eachrelation symbolR ∈ τ ;

(d) RH′

⊂ RH for somerelation symbolR ∈ τ ,

we have that〈H′, T 〉 6|=HT ϕ, i.e., this is the minimal “here” condition part.

As in the propositional case, it also follows from [PV05] that the equilibrium models of a

FO sentenceϕ are precisely itsstable models.

As a classical second-order formula

In [FLL11], this notion of FO “equilibrium models” was directly encoded into a classical

formula via their so-calledSM operator. This was achieved by encoding the minimal

“here” world condition of the “reduct” via auniversalsecond-order (SO) sentence. For a

given FO formulaϕ of signatureτ , SM(ϕ) is the following (classical) SO sentence:

ϕ ∧ ∀U(U < P→ ¬ϕ∗(U)), (1.9)

where:

• P = P1 · · ·Pn is a tuple of distinguishable predicates such thatP1, · · · , Pn ∈ τ ;

• U = U1 · · ·Un is a fresh (i.e., they are not inτ ) tuple of distinguishable predicates

such that the arity ofUi matches the arity ofPi for 1 ≤ i ≤ n;

• ϕ∗(U) is defined recursively based onϕ as follows:

– If ϕ = P (x) for some tuple of termsx (i.e., can contain both variables and

constants), thenϕ∗(U) = Ui(x) if P = Pi for some1 ≤ i ≤ n, andϕ∗(U) =

P (x) otherwise;

– If ϕ = ⊙ψ for ⊙ ∈ {∀, ∃}, thenϕ∗(U) = ⊙ψ∗(U);

– If ϕ = ψ ⊙ ξ for ⊙ ∈ {∧,∨}, thenϕ∗(U) = ψ∗(U)⊙ ξ∗(U);

– If ϕ = ψ → ξ, thenϕ∗(U) = (ψ∗(U)→ ξ∗(U)) ∧ (ψ → ξ),

Page 24: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 15

and such that we view¬ϕ asϕ→ ⊥ as usual.

Then from [FLL11], it was shown that aτ -structureM satisfiesSM(ϕ) iff the HT inter-

pretation〈M,M〉 is an equilibrium model ofϕ. Thus, it follows from the notion of FO

equilibrium models thatM |= SM(ϕ) iff M is astable modelof ϕ.

It follows that ifϕ is an implication free formula (i.e., free of the ‘→’ connective), then

ϕ∗(U) is simply the formula obtained fromϕ by replacing every occurrences of atoms

Pi(x) in it (where1 ≤ i ≤ n andx is a tuple of terms whose length matches the arity ofPi)

byUi(x). Therefore, ifϕ is implication free, then we simply have thatSM(ϕ) corresponds

to the expression of theminimal modelsof ϕ with respect to the predicates in the tupleP.

The scenario now becomes different when implications are introduced intoϕ since from

above, we have that

(ψ → ξ)∗(U) = (ψ∗(U)→ ξ∗(U)) ∧ (ψ → ξ),

i.e., we also make a copy of(ψ → ξ) along with(ψ∗(U) → ξ∗(U)). Note now how this

corresponds to the logic of HT. Indeed, loosely speaking, wehave that the “(ψ∗(U) →

ξ∗(U))” part corresponds to the “here” world and the “(ψ → ξ)” part as the “there” world.

In fact, in reference to a FO HT interpretation〈H, T 〉, we can loosely view the relations

of those predicates from the tupleU as those of the structureH, while those relations

of the predicates fromP as those ofT . Thus, as in the case of equilibrium logic, this

notion corresponds to the “activation” of the reduct ofϕ under the interpretations of those

predicates fromP, i.e., intuitively speaking, we fixP and minimizeU.

Incidentally, it is also important to note the work in [LZ11]where they captured the

stable models of arbitrary formulas in terms ofcircumscription[Lif85, McC86]. In terms

of the ‘∗’ operator, the formula in [LZ11] follows the formCIRC(ϕ∗(U)) ∧ U = P

whereCIRC(ϕ∗(U)) = ϕ∗(U) ∧ ∀U(U < P → ¬ϕ∗(U)) andU = P stand for(U <

P) ∧ (P < U).

1.2.3 Loop Formulas Approach

In Lin and Zhao’s work [LZ04], the answer sets of propositional normal programs was

defined in terms of the so-calledloopsand loop formulas. Generally speaking, the loop

formulasLF (Π) of a (propositional) programΠ is a way of strengthening the Clark’s

Page 25: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 16

completion of (propositional) programs so that it corresponds exactly to the answer.

More formally, letΠ be a propositional program andτ(Π) be the set of all the propo-

sitional atoms in it, i.e., its signature. Now letL ⊆ τ(Π). Then byLF (L), define the

following propositional formula

a∈L

a→∨

r∈Π,Head(r)∈L,Pos(r)∩L=∅

Body(r), (1.10)

where for a (propositional) ruler of the form (1.1),Body(r) denotes the conjunctions

b1∧· · ·∧bl∧¬c1∧· · ·∧¬cm of literals inBody(r). Intuitively speaking,LF (L) is viewed

as theexternal supportof L in the sense that if all the atoms inL are true, then it must be

supported by some ruler ∈ Π for whichPos(r)∩L = ∅, i.e., the “external” support. This

notion was then extended to all the possible subsetsL ⊆ τ(Π) such thatLF (Π) denotes

the formula

L⊆τ(Π)

LF (L),

i.e., all the loop formulas ofΠ. It was then shown in [LZ04] that the formulaΠ ∧ LF (Π)

(i.e., whereΠ is the logical closure ofΠ) exactly captures the answer sets ofΠ.

This notion of loop formulas for normal (propositional) programs was then extended to

disjunctive programs [FLL06] (and to the more general programs with nested expressions).

This was achieved by modifying the definition of a loop in sucha way that a program

is turned into the corresponding propositional formula by simply adding loop formulas

directly to the conjunctions of the rules, which eliminatedthe intermediate step of forming

the program’s Clark’s completion.

Up to this point, most of the work about loop formulas have beenrestricted to the

propositional case. That is, variables in programs are firsteliminated by grounding, through

which the loop formulas are then formed from the resulting ground program. For this

reason, loop formulas are only defined as formulas in propositional logic. A relatively

closer to first-order form of loop formulas was given in Chen et. al.’s definition of loop

formuals [CLWZ06]. This notion of loop formulas in [CLWZ06] is different since the loop

formulas are obtained from the original programs without first converting into a ground

Page 26: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 17

program so that the variables remain. So in this sense, this notion of loop formulas are

closer to “first-order.” However though, since the the underlying semantics of the logic

programs still referred to grounding, then such loop formulas is still understood as schema

for the set of propositional loop formulas. In the same way Ferraris et. al. in [FLL06]

extended the notion of loop formulas to the more general caseof disjunctive programs and

programs with nested expressions, this notion of “first-order” loop formulas in [CLWZ06]

is also extended in Lee at. al. [LM11] to first-order disjunctive programs, and then to

arbitrary first-order formulas.

1.2.4 ASP with Aggregates

One of the reasons that ASP has emerged as a predominant declarative programming

paradigm in the area of knowledge representation and logic programming [Bar03] is due to

its rich modeling language [GKKS09]. One important ASP building block is the so-called

aggregateconstructs. Some particular well known constructs of theseaggregates are the

cardinality andweight constraints[SNS02], which plays an important role in many appli-

cations. Aggregates are currently a hot topic in ASP not onlybecause of their significance,

but also since there is no uniform understanding of the concept of an aggregate [Fer11]. The

reason why aggregates are crucial in answer set solving is twofold. First, it can simplify the

representation task. For many applications, one can write asimpler and more elegant logic

program by using aggregates, for instance, the job scheduling program [PSE04]. More im-

portantly, it can improve the efficiency of ASP solving [GKKS09]. Normally, the program

using aggregates can be solved much faster [FPL+08].

At the propositional level, a weight constraint atom is a construct of the form

M ≤ {p1 = n1, . . . , pk = nk} ≤ N, (1.11)

wherep1, · · · , pn are propositional atoms, andM,N, n1, . . . , nk are numbers fromZ (the

set of integers). Theni of each correspondingpi (for 1 ≤ i ≤ k) is known as the “weight”

associated withpi. Intuitively, (1.11) means that the sum of all theni for which a corre-

spondingpi is true must be more than or equal toM , but less than or equal toN . More

Page 27: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 18

formally, for a given set of propositional atomsI, we say that

I |=M ≤ {p1 = n1, . . . , pk = nk} ≤ N

if and only if

M ≤∑

pi∈I∩{p1,··· ,pk}

ni ≤ N.

The case for the cardinality constraint is the same as the weight constraint but whereni = 1

for 1 ≤ i ≤ k. An example of an ASP program with a weight constraint atom isthe

following:

p← 2 ≤ {q = 1, r = 2} ≤ 3 (1.12)

q ← p (1.13)

q ← r (1.14)

r ←, (1.15)

where rule (1.12) states that if the corresponding weights of the true atoms in{q, r} is

between2 and3 inclusively (i.e., by the weight constraint atom2 ≤ {q = 1, r = 2} ≤ 3),

then we also havep.

As it is well known in the literatures, aggregate constructscan contain variables al-

though, since the definition of their semantics still referred to grounding, it is still essen-

tially propositional. An example of an ASP program with aggregates containing variables

is the following well known company control program [FPL11]:

ControlsStk(x, x, y, n)← OwnsStk(x, y, n)

ControlsStk(x, y, z, n)← Company(x), Controls(x, y), OwnsStk(y, z, n)

Controls(x, z)← Company(x), Company(z)

SUM〈n : ∃y ControlsStk(x, y, z, n) 〉 > 50,

which is clearly a program with variables in the aggregate atom

SUM〈n : ∃y ControlsStk(x, y, z, n) 〉 > 50.

Page 28: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 19

Traditionally, the answer sets of programs with aggregateswas computed by first grounding

the program, and then on computing the answer sets of the resulting propositional program

(as in the case of the aggregate free programs). It is for thisreason that the traditional

approach is not truly first-order. In the recent years, the first-order stable semantics was

extended to include aggregates by Lee et. al. in [LM09]. As this notion neither referred

to grounding or fixpoint, it is viewed as truly first-order. Even more recently, the FLP ag-

gregate semantics of Faber, Leone, and Pfeifer [FPL11], as initially defined via grounding,

was also uplifted to the first-order case by Bartholomew et. al. in [BLM11].

It should be noted that although the recent characterizations of first-order logic pro-

grams with aggregates are viewed as truly first-order, they are defined via a SO sentence.

Another of the main contributions of this thesis is that we provide a translation of ASP pro-

grams with a significant subclass of aggregates, calledmonotoneandanti-monotone, into

classical FO logic [AZZar]. We emphasize that although we only consider these subclass

of aggregates, they are indeed powerful because, as far as wehad check, almost all the

aggregates mentioned in benchmark programs [CIR+11] belong to this class.

1.2.5 Preferred ASP

Getting back again to the case of propositional program, theexpressive power of answer

set programming was even enhanced by incorporating preferences among the rules.4 This

brings us to the realm of the so-calledpreferredanswer set programming. A preferred

propositionalprogramP is a structure(Π, <P) whereΠ is propositional program and<P

is anasymmetricand transitivepartial relation among the rules ofΠ. So in other words,

a preferred propositional programP = (Π, <P) is a propositional programΠ together

with a strict-partial ordering5 among its rules. For example, assume we haveP to be the

preferred program(Π, <P) such thatΠ is the propositional program

(1) b← not c, a

(2) c← not b

(3) a← not d,

4Theoretically, some formalisms enhance expressive power since they step outside the complexity classof the underlying ASP programming framework, e.g., the approaches proposed in [Rin95] and [ZF97].

5Note that the strict-partial order need not be total.

Page 29: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 20

and where(1) <P (2) <P (3), i.e.,<P= {〈(1), (2)〉, 〈(2), (3)〉, 〈(1), (3)〉} where (1), (2),

and (3) stands for the rules “b ← not c, a”, “ c ← not b”, and “a ← not d”, respectively.

Then the strict-partial order<P onΠ states that: rule (1) is more preferred than rule (2); (2)

is more preferred than (3); and (1) is more preferred than (3)(i.e., by thetransitive closure

of 〈(1), (2)〉 and〈(2), (3)〉).

As in the traditional way of viewing a program with variables,the usual case of viewing

a program with variables and preferences as simply a shorthand of its Herbrand instanti-

ation poses a bottleneck. For instance, assume we haveP = (Π, <P) such thatΠ is the

program with variables

(1) P (x, y)← Q(x, y)

(2) P (x, z)← Q(x, y), Q(y, z)

and where(1) <P (2). Then the grounding (or “propositionalizing”) ofΠ to a singleton

constant{a} renders (1) and (2) to collapse to the same propositional rule “P (a, a) ←

Q(a, a)” violating the intuition of the preference(1) <P (2). In fact, due to this condition

and in some preferred answer frameworks, they require certain auxiliary conditionssuch

as “well behaved” or “consistent,” which are simply assumptions that such a rule collapse

will not happen in the grounding of the program, e.g., as found in [BE99].

In this work, we provide a truly first-order characterization of preferred FO programs.

We achieve this in two ways: (1) by a FOfixpoint definition; (2) by aclassicalSO logic

sentence. In addition, we also show that the fixpoint and classical logic characterizations

are equivalent. Moreover, when only restricted to the confines of finite structures, the SO

sentence reduces down to anexistentialSO sentence. In fact, this SO sentence is polyno-

mial in the length of the underlying FO preferred program. This now allows us, for the first

time (to the best of our knowledge), to reason about FO preferred programs at a truly first-

order level. Furthermore, we achieved this FO preferred answer set characterizations by

generalizing important preferred propositional program frameworks to the FO level, e.g.,

as those mentioned in [SW03].

Page 30: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 21

1.2.6 Important Preferred Program Frameworks

In this section, we briefly review some important preferred program frameworks of the

past years. We emphasize though the fact that all these frameworks are only defined for

propositionalpreferred programs.

Brewka and Eiter’s framework and Principles I and II

Brewka and Eiter studied essential issues inpreferred default reasoningand argued that all

preferred answer set reasoning approaches should satisfy the following two basic principles

[BE99]:

Principle I . Let A1 andA2 be two answer sets of a preferred propositional

programP = (Π, <P) generated by the rulesR∪{r1} ⊆ Π andR∪{r2} ⊆ Π

respectively, wherer1, r2 6∈ R. If r1 is preferred overr2, thenA2 is not a

preferred answer set ofΠ.

Principle II . LetA be a preferred answer set of a preferred propositional pro-

gramP = (Π, <P) andr a rule inΠ such that there exist ana ∈ Pos(r) for

which a /∈ A. ThenA is a preferred answer set ofP ′ = (Π, <P′

) whenever

<P′

agrees with<P on the preferences among the rules inΠ.

Brewka and Eiter observed that some preferred answer set reasoning frameworks do not

satisfy these principles and proposed their own preferred semantics that satisfies these

principles. Their preferred answer set semantics is based on a reduction of the underly-

ing program to one where only negative bodies are left in the program’s rules. That is,

while the Gelfond-Liftschitz reduction leaves us with a “reduced” program whose rules

only contain a positive body (i.e., the negative part was deleted), theBrewka-Eiterreduc-

tion, or justBE-reduction, leaves us with a “reduced” program whose rules only containa

negative body (i.e., this time it is the positive part that isdeleted). It should be noted that

the preferred program framework as developed by Brewka and Eiter had been viewed as an

important proposal in preferred program reasoning since itsatisfies the two basic principles

addressed above [BE99].

In order to define the notion of the Brewka and Eiter preferred (or just BE-preferred)

program semantics, for now, it will be necessary to assume a preferred propositional pro-

gramP = (Π, <P) where<P is a strict-total order onΠ. In such a case, we refer toP

Page 31: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 22

as afully preferredpropositional program. For convenience, from here on, we assume all

propositional programs to be of signatureL.

Definition 1 (BE-reduction) [BE99] LetP = (Π, <P) be a fully preferred propositional

program andI ⊆ L an interpretationI of L. ThenP ′ = ( IΠ, <P′

) denotes the fully

preferred program such thatIΠ is the set of rules obtained fromΠ by:

1. deleting every rules having an atoma in its positive body wherea /∈ I, and

2. removing from each remaining rules their positive body,

and where<P′

is obtained from<P by the mapf : IΠ −→ Π such thatr′1 <P ′

r′2 iff

f(r′1) <P f(r′2), and wheref(r′) = r is the first rule inΠ with respect to<P such thatr′

results fromr by step 2.

It should be noted that<P′

is still a strict-total order onIΠ above. Thus, having defined

the BE-reduction, we are now ready to define the BE-preferred semantics for propositional

programs. Generally speaking, the BE-preferred semantics is defined through an immediate

consequence operator6

CP : 2L −→ 2L

such that an answer setA ⊆ L of Π satisfies the preferences iffCP(A) = A. Before

proceeding to define the consequence operatorCP , it will first be helpful to introduce

the following notion. For a given fully preferred programP = (Π, <P), the rules in

Π corresponds to a uniqueordinal numberas given by|Π|, and thus, to an enumeration

r1, · · · , rα, · · · , r|Π| of the elements ofΠ. Therefore, we also use the notation{rα}<P to

represent(Π, <P).

Definition 2 [BE99] LetP = (Π, <P) be a fully preferred propositional program andI

an interpretationI ⊆ L. Moreover, letP ′ = (IΠ, <P′

) = {rα}<P′ whereIΠ and<P′

is as

6Note that2L denotes the set ofall the subsets ofL, i.e.,2L = {S | S ⊆ L}.

Page 32: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 23

defined in Definition 1. Then the sequenceSα is defined inductively as follows:

S0 = ∅;

Sα+1 =

Sα, if rα+1 is defeated bySα, or

Head(rα+1) ∈ S andrα+1 is defeated byS,

Sα ∪ {Head(rα+1)}, otherwise,

ThenCP(S) = S|SΠ|. where for ruler and a setS ⊆ L, we take “r is defeated byS” to

mean thatNeg(r) ∩ S 6= ∅.

Then it follows from [BE99] that for a fully preferred programP = (Π, <P), an answer

setA of Π is apreferred answer setof P iff CP(A) = A.

In cases whereP is not a fully preferred program (i.e.,<P is not a strict-total order

but rather astrict-partial order), then the BE-preferred framework is defined by extending

P to a fully preferred one ofP ′ = (Π, <P′

) such that<P⊆<P′

. Thus, an answer set

A of Π is then said to be a preferred answer set of apartially-orderedpreferred program

P = (Π, <P) iff there exists a fully preferred programP ′ = (Π, <P′

) where<P⊆<P′

such

thatA is a preferred answer set ofP ′.

Proposition 1 [BE99] The BE-preferred answer set framework satisfies PrinciplesI and

II above.

Proposition 2 [AZ09] On finite propositional programs, the BE-preferred answer sets can

be captured by propositional formulas without extending thelanguage’s original vocabu-

lary, i.e., no auxilliary atoms.

Torsten and Wang’s unifying frameworks

In [SW03], Torsten and Wang provided a unifying framework that linked three important

preferred frameworks. We refer to these as follows:

BE-preferred : with “BE” standing for Brewka and Eiter and refers to the framework as

already mentioned above;

DST-preferred : with “DST” standing for Delgrande, Schaub and Tompits, which refers

to the preferred program framework as introduced in [DST00];

Page 33: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 24

WZL-preferred : with “WZL” standing for Wang, Zhou and Lin, which refers to the

preferred framework as proposed in [WZL00].

Torsten and Wang unified these three important frameworks byrelating theexplicit pref-

erence relations among the rules with the so-called notion of “ groundedness” 7. In this

notion of “groundedness,” a programΠ is said to be “grounded” if there exist a strict-

total orderT = (ΓIΠ, <

T ) of the generating rulesof Π underI (i.e., the setΓIΠ where

ΓIΠ = {r | Pos(r) ⊆ I andNeg(r) ∩ I = ∅}) such thatPos(r) ⊆ {Head(r′) | r′ <T r}

for each ruler ∈ ΓIΠ. It was found in [SW01]8 that the DST-preferred framework cap-

tures the notion of “groundedness” by simply having the strict-total order corresponding to

the program’s “groundedness” to respect the preferrence relations among the rules of the

program. This is made precise in the following definition:

Definition 3 (DST-preferred answer sets)[SW03] An interpretationI ⊆ L is said to be

a DST-preferred answer set of a preferred propositional programP = (Π, <P) iff:

1. I is an answer set ofΠ;

2. there exist a strict-total orderT = (ΓIΠ, <

T ) ofP such that:

(a) Pos(r) ⊆ {Head(r′) | r′ <T r} for each ruler ∈ ΓIΠ (i.e., the groundedness

condition);

(b) r1 <P r2 impliesr1 <T r2 for each ruler1, r2 ∈ ΓIΠ (i.e., the total-orderT

respects the preference relations ofP);

(c) for eachr1 ∈ Π \ ΓIΠ andr2 ∈ ΓI

Π wherer1 <P r2, either:

i. Pos(r1) 6⊆ I or

ii. Neg(r1) ∩ {Head(r) | r <T r2} 6= ∅.

As already briefly mentioned above, Conditions (2) (a) and (b)simply corresponds to

the “groundedness” ofΠ under the strict-total orderT . On the other hand, Condition(2)

(c) simply insures that for eachnon-generating ruler1 (i.e., those rules not inΓIΠ) and

generating ruler2 (i.e.,r2 ∈ ΓIΠ), and such thatr1 is more preferred thanr2 (i.e.,r1 <P r2),

we have that either: (i)r1 is not derivable sincePos(r1) 6⊆ I or (ii) r2 is already “defeated”

7We refer to this notion of groundedness by “groundedness.”8It should be noted that [SW03] is the TPLP-2003 journal counterpart of the IJCAI-2001 paper [SW01].

Page 34: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 25

by a ruler (i.e., “defeated” as inHead(r) ∈ Neg(r)) wherer <T r2. Intuitively speaking,

Condition (2) (c) above simply insures that the non-application of more preferred rules are

already settled before considering the application of the lesser preferred ones.

It was found in [SW03] that the WZL-preferred framework is captured by this notion

of “groundedness” through a slight modification of Definition 3. In fact, it was found that

the WZL-preferred framework is nothing more than the DZL-preferred framework but with

the property that it exploits aweakerform of “groundedness.” This notion is made precise

in the following definition:

Definition 4 (WZL-preferred answer sets) [SW03] An interpretationI ⊆ L is said to be

a WZL-preferred answer set of a preferred propositional programP = (Π, <P) iff:

1. I is an answer set ofΠ;

2. there exist a strict-total orderT = (ΓIΠ, <

T ) ofP such that:

(a) Pos(r) ⊆ {Head(r′) | r′ <T r} or Head(r) ∈ {Head(r′) | r′ <T r} for each

rule r ∈ ΓIΠ (i.e., the weaker groundedness condition);

(b) r1 <P r2 impliesr1 <T r2 for each ruler1, r2 ∈ ΓIΠ (i.e., the total-orderT

respects the preference relations ofP);

(c) for eachr1 ∈ Π \ ΓIΠ andr2 ∈ ΓI

Π wherer1 <P r2, either:

i. Pos(r1) 6⊆ I or

ii. Neg(r1) ∩ {Head(r) | r <T r2} 6= ∅ or

iii. Head(r1) ∈ {Head(r) | r <T r2} 6= ∅.

It is not too difficult to see that Definition 4 of the WZL-preferred framework only

differs from Definition 3 of the DST-preferred through Conditions (2) (a) and (c). In-

deed, Condition (2) (a) of Definition 4 has the more liberal condition that it is enough for

Head(r) ∈ {Head(r′) | r′ <T r} for eachr ∈ ΓIΠ, which is in contrast with that of (2) (a)

of Definition 3 where we explicitly required thatPos(r) ⊆ {Head(r′) | r′ <T r}. Simi-

larly, Condition (2) (c) of Definition 4 also has the more liberal condition that it is enough

for Head(r1) ∈ {Head(r) | r <T r2} 6= ∅ in order to settle the non-applicability ofr1.

Relating now to the BE-preferred framework, it was also found in [SW03] that the BE-

preferred framework can also be characterized in terms of this “groundedness” property.

Page 35: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 26

In fact, of the three BE, DST, and WZL-preferred frameworks, itwas found that the BE-

preferred possesses the weakest of all the “groundedness” requirement. To see this, let us

consider the precise definition of the BE-preferred answer sets as found in [SW03]:

Definition 5 (BE-preferred answer sets version of Schaub and Wang) [SW03] An inter-

pretationI ⊆ L is said to be a BE-preferred answer set of a preferred propositional pro-

gramP = (Π, <P) iff:

1. I is an answer set ofΠ;

2. there exist a strict-total orderT = (ΓIΠ, <

T ) ofP such that:

(a) r1 <P r2 impliesr1 <T r2 for each rulesr1, r2 ∈ ΓIΠ (i.e., the total-orderT

respects the preference relations ofP);

(b) for eachr1 ∈ Π \ ΓIΠ andr2 ∈ ΓI

Π wherer1 <P r2, either:

i. Pos(r1) 6⊆ I or

ii. Neg(r1) ∩ {Head(r) | r <T r2} 6= ∅ or

iii. Head(r1) ∈ I.

Clearly, it can be seen that the “groundedness” property is outright omitted in Definition

5 of the BE-preferred framework. In fact, for any preferred programP = (Π, <P), with

ASDST (P),ASWZL(P) andASBE(P) standing for the set of all the DST, WZL and BE-

preferred answer sets ofP, respectively, we have the following relationships from [SW03]:

ASDST (P) ⊆ ASWZL(P) ⊆ ASBE(P).

Thus, the relative “weak” or “strong” characterizations ofthe DST, WZL, and BE-preferred

answer sets rest entirely upon this notion of “groundedness.”

It should be noted that [SW03] also providedfixpoint type characterizations of those

three aforementioned preferred answer set frameworks. We delve deeper into these fixpoint

type characterizations in Chapter 4.

1.3 Structure of the Thesis

The rest of this thesis is organized as follows. Chapter 2 addresses the main theme of

the thesis that is about the translation of logic programs under the stable model semantics

Page 36: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 1. INTRODUCTION TO ANSWER SET PROGRAMMING 27

(answer set programs) to classical first-order logic. Section 2.4 then further extends our

first-order logic translation to consider logic programs with aggregate constructs. Chapter

3 describes our first implementation of the answer set solverGroc [ALZZ12], that works

in a different manner to the traditional approach by first translating a logic program into a

first-order sentence, and then grounding the sentence whileincorporating “classical” rea-

soning. Experimental results are also reported in this chapter. Chapter 4 studies the problem

of preferred first-order answer set programming, which is first-order logic programming

where the rules in the programs can have a preferrence relation. As already mentioned

above, adding preferences to rules with variables (i.e., a “first-order rule”) can introduce

the additional problem where the preference relation amongtwo rules can collapse to a

single propositional rule, if the semantics of preferred first-order programs is defined via

grounding. We address this problem in Chapter 4 by lifting some well known preferred

propositionalanswer set programming frameworks to first-order. We achieve this by intro-

ducing a first-order progression (or fixpoint) type definition, and also through a classical

second-order sentence such that on finite structures, the second-order sentence can be re-

duced down to first-order. Chapter 5 finally summarizes the contributions provided by this

thesis. Long proofs of lemmas and theorems are left to Appendix A for a more fluent

reading.

Page 37: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

Chapter 2

First-Order ASP and Classical

First-Order Logic

2.1 Past Efforts in Linking Logic Programs and Classical

Logics

This chapter is about tranlsating first-order (FO) programsunder the stable models seman-

tics [FLL11] to classical FO logic. Viewed in the context of expressing FO programs into

classical FO logic, work on this direction goes all the way back to Clark [Cla77] who gave

us what is now called the Clark’s completion semantics, on which our work is based.

As mentioned in Section 1.2.1, the “stable models” semantics of FO (normal) programs

is defined by a (universal) SO sentence via theSM(Π) formula. Recall that theSM(Π)

formula is a universal SO sentence of the form

Π ∧ ∀U(U < P→ ¬Π∗(U))

that captures the notion of the minimal models of the “reduct” (i.e., Π∗(U)) to the first-

order level. As also mentioned in Section 1.2.1, in this work, we provide a translation of

FO programs under the stable models semantics to classical FO logic sentences, which we

do by introducing extra predicates that are polynomial in the size of the original number

of intensional predicates of the underlying program. In fact, to the best of our knowledge,

it provides for the first time a translation from FO (normal) programs (under the stable

28

Page 38: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 29

models semantics) to classical FO logic sentences.

In terms of the stable models semantics, Clark’s completion semantics is, in general,

too weak in the sense that not all classical models of the “Clark’s completion” are also

stable models, unless the programs are “tight” [Fag94]1. Various ways to remedy this have

been proposed, particularly in the propositional case of programs without variables. This is

due to the recent interest in answer set programming and the prospect of using SAT solvers

to compute the answer sets, e.g., [LZ04]. Our work though considers FO programs and the

prospect of capturing the answer sets of these programs in (classical) FO logic. Thus, under

this new direction, we can now use the mature developments ofthe area of automated FO

theorem provingto reason about FO programs for the first time. This will be beneficial in

the simplification of FO programs for the purpose of optimization. For instance, there had

already been substantial work done on the direct use of FO reasoning for the optimization

of the grounding process of (classical) FO sentences, e.g.,[WMD10].

In the past years, for the case of propositional programs, a way of expressing programs

into classical propositional logic is by introducing extrapropositional symbols, i.e., “ex-

panding” the signature of the underlying language and translating the program into a clas-

sical propositional logic formula. An example of this is theBen-Eliyahu and Dechter’s

translation [BED94] of propositional programs to (classical) propositional logic that is

polynomial in space but usesO(n2) extra propositional symbols. Another direction of

mapping propositional programs to propositional logic is via the well-known notion of

loop formulasof Lin and Zhao [LZ04]. The “loop formulas” approach does notintroduce

extra propositional symbols into the corresponding (classical) logic formula but isexpo-

nential in the number of the propositional symbols of the underlyingprogram in the worst

case. In the realm of FO programs, Chen et al. [CLWZ06] extended the notions of “loops”

and “loop formuals” to the FO case and showed that on finite domains, the answer sets

of a FO program can be captured by its Clark’s completion and all its FO loop formulas.

However, in general, a program may have an infinite number of loops and loop formulas.

Furthermore, the approach in [CLWZ06] still only treated the semantics of FO programs as

the usual notion of “programs with variables” (i.e., still only as a shorthand of itsHerbrand

instantiation as mentioned in Section 1.2.1) since the variables of the underlying programs

are viewed as just place holders and such that rules with variables are schemas. Hence, in

1More discussions on “tight” programs in Section 2.3.1.

Page 39: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 30

this sense, the FO programs considered in [CLWZ06] are not truly FO. But this is the best

that one can possibly hope for if no extra predicates are used. For instance, it is well-known

that the program

T (x, y)← E(x, y)

T (x, z)← E(x, y), T (y, z)

that computes the transitive closure of the relations underE (and thus, can be easily written

as a FO program) cannot be captured by any finite first-order theory on finite structures

[EF99].

The situation now becomes different if we introduce extra predicates for the corre-

sponding classical FO logic formulas. One of the main technical results of this thesis is

that, by using some additional predicates that keep track ofthe derivation order from the

bodies to the heads of the underlying program, we can modify Clark’s completion into what

we call theordered completion, which exactly captures the answer set semantics on finite

structures.

2.2 The Clark’s Completion

Firstly, recall that as mentioned in Section 1.2.1, we view the predicate symbols of a signa-

tureτ(Π) of a given programΠ as being either of anextensionalor intensionalpredicate,

which we denote byPext(Π) andPint(Π), respectively. To recall, the intensional pred-

icatesPint(Π) of Π are those predicates that appear in the head of some rule inΠ and

where those other predicates inPext(Π) are the extensionals, i.e., the extensional predi-

cates do not occur in the head of any rule ofΠ. Note that under this notion, we have that

Pext(Π)∩Pint(Π) = ∅, i.e., the setsPext(Π) andPint(Π) partitions the predicates symbols

of τ(Π).

For convenience and without loss of generality, we assume inthis Chapter (i.e., Chapter

2) that every program mentioned is in anormalized formin the sense that for each inten-

sional predicateP , there is a tuplex of distinct variables that matches the arity ofP and

such that for each rule, if its head mentionsP , then the head must beP (x).

We now introduce the notion of theClark’s completionof a program. Our definition

of the Clark’s completion is standard except that we do not make the completions for the

Page 40: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 31

extensional predicates.

Given a programΠ, the Clark’s Completionof Π (or simply completionwhen clear

from the context), denotedComp(Π), is the following FO sentence:

P∈Pint(Π)

∀x(P (x)↔∨

r∈Π,Head(r)=P (x)

∃yrBody(r)), (2.1)

where for a ruler ∈ Π of the form (1.4) (i.e., see Section 1.2.1):

• yr is the tuple oflocal variablesin the ruler, i.e., those variables that is only men-

tioned inBody(r) and not inHead(r);

• Body(r) is the formula

β1 ∧ · · · ∧ βl ∧ ¬γ1 ∧ · · · ∧ ¬γm.

Example 2 Let ΠTC be the following program that computes the transitive closure of a

given graph structure of predicate symbolE:

T (x, y)← E(x, y)

T (x, y)← E(x, z), T (z, y),

such thatE is the only extensional predicate ofΠTC which represents the edge relations

of the graph, andT is the only intensional predicate ofΠTC. Ideally, the intensional pred-

icate computes the transitive closure (i.e., all the paths)of the given graph. The Clark’s

completionComp(ΠTC) of ΠTC is the following FO sentence:

∀xy(T (x, y)↔ (E(x, y) ∨ ∃z(E(x, z) ∧ T (z, y)))).

Page 41: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 32

Example 3 Now assumeΠPA as the program that computes theparent-ancestorrelation-

ships

ΠPA :

Ancestor(x, y)← Parent(x, y)

Ancestor(x, y)← Ancestor(x, z), Ancestor(z, y),

such that for the predicatesParent andAncestor, we takeParent(x, y) to mean thatx is

a parent ofy, andAncestor(x, y) to meanx is an ancestor ofy. Then we have the Clark’s

completionComp(ΠPA) of ΠPA to be the FO sentence

∀xy(Ancestor(x, y)↔ (Parent(x, y) ∨ ∃z(Ancestor(x, z) ∧ Ancestor(z, y)))).

Informally speaking,

∀xy((Parent(x, y) ∨ ∃z(Ancestor(x, z) ∧ Ancestor(z, y)))→ Ancestor(x, y)) (2.2)

means that if either: (1)x is a parent ofy; or (2)∃z (i.e., “there exist” some other person)

such thatx is an ancestor ofz and wherez is an ancestor ofy, then we have thatx is an

ancestor ofy. On the other hand,

∀xy(Ancestor(x, y)→ (Parent(x, y) ∨ ∃z(Ancestor(x, z) ∧ Ancestor(z, y)))).

means that ifx is an ancestory, then either: (1)x is a parent ofy; or (2) ∃z (i.e., “there

exist” some other person) such thatx is an ancestor ofz and wherez is an ancestor ofy.

Note that (2.2) corresponds to theuniversal closureof ΠPA as menioned in Section 1.2.1,

i.e., it corresponds to the sentenceΠPA.

Now, let us consider the following “parent” structure

P = (Dom(P), ParentP)

(i.e., our extensional or input database) where:

• Dom(P) = {Ann, Bob, Chris}, i.e., our domain is the set comprising of the persons

Ann, Bob and Chris;

Page 42: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 33

• ParentP = {(Ann, Bob), ( Bob, Chris)}, i.e., which implies that: (1) Ann is the

mother of Bob; and (2) Bob is the father of Chris2.

Now, let us consider twoτ(ΠPA)-structures3

A1 = (Dom(A1), ParentA1 , AncestorA1)

and

A2 = (Dom(A2), ParentA2 , AncestorA2)

such that:

• Dom(A1) = Dom(A2) = Dom(P) = {Ann, Bob, Chris};

• ParentA1 = ParentA2 = ParentP = {(Ann, Bob), ( Bob, Chris)};

• AncestorA1 = {(Ann, Bob), ( Bob, Chris), (Ann, Chris)};

• AncestorA2 = {(Ann, Bob), ( Bob, Chris), (Ann, Chris), (Chris, Bob), (Chris, Ann),

(Bob,Ann)}.

Then it is not too difficult to show thatA1 |= Comp(ΠPA) andA2 |= Comp(ΠPA). More-

over, it is also not too difficult to see thatA1 corresponds to thetransitive closureof the

“parent” structureP and thatA2 does not. For instance, the structureA2 states that Chris

is an ancestor of Ann, which we know is not the case since we getfrom the “parent” struc-

tureP that Ann must be the grandmother of Chris, i.e., since(Ann, Bob) ∈ ParentP and

( Bob, Chris) ∈ ParentP . In fact, we have thatA1 is an answer set ofΠPA and thatA2

is not. Thus, even thoughA1 andA2 both satisfy the Clark’s completionComp(ΠTC) of

ΠPA, onlyA1 is an answer set ofΠPA whileA2 is not.

As it turns out, the reason for this is becauseA1 is a “minimal” model ofΠPA andA2

is not.

2This is under the assumptions that Ann is a female, and both Bob and Chris are males.3Structures of the signature ofΠPA (i.e., {Parent,Ancestor}) which could be thought of as our inten-

sional “expansion.”

Page 43: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 34

Hence, through Example 3, it can be easily seen why the Clark’scompletion is, in

general, too weak in capturing the answer set semantics in the sense that there are some

models of the Clark’s completion that are not answer sets of the underlying program.

2.3 The Ordered Completion

In this section, we show how we can strengthen the Clark’s completion so that its models

correspond exactly to the answer sets. To do this, we first define the notion of thepositive

predicate dependencygraph of a given FO program.

2.3.1 Positive Predicate Dependency Graphs and Tight Programs

Thus, letΠ be a FO program. Then we define the graph structureG+Π = (Dom(G+Π ), EG+Π )

such that:

• Dom(G+Π ) = Pint(Π), i.e., the intensional predicates ofΠ;

• EG+Π = {(P,Q) | there is a ruler ∈ Π mentioningP in Head(r) andQ in Pos(r)}.

This is usually referred in the literature as thepositive dependencygraph ofΠ, (and hence

the superscript ‘+’ in G+Π ).

Example 4 For example, withΠ the following FO program:

P (y, x)← T (x, z), notS(x, z)

T (x, y)← Q(x, y)

Q(x, y)← P (x, z), notS(x, z)

R(x, y)← S(x, y)

P (x, y)← R(x, y),

we have thatG+Π = (Dom(G+Π ), EG+Π ) such that:

• Dom(G+Π ) = Pint(Π) = {P,Q,R, T}, i.e., and whereS is the only extensional

predicate ofΠ;

• EG+Π = {(P,R), (Q,P ), (T,Q), (P, T )}.

Page 44: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 35

P R

Q T

Figure 2.1: Positive predicate dependency graph ofΠ from Example 4.

Its positive predicate dependency graph is illustrated in Figure 2.1.

We say that a programΠ is tight if the transitive closureof the edge relations ofG+Π is

cycleor loop free. That is, there do not exist a relation(x, x) ∈ TC(EG+Π ) where TC(EG

+Π )

denotes thetransitive closureextension of the edge relations inEG+Π , i.e., the minimal

transitive relations extension of TC(EG+Π ). For instance, withΠ the program from Example

4, we have thatΠ is non-tightsince(P, P ) is in

TC(EG+Π ) = {(P,R), (Q,P ), (T,Q), (P, T ), (P,Q), (Q, T ), (T, P ),

(P, P ), (Q,Q), (T, T )}.

It should be noted that this notion automatically holds (i.e., non-tight) whenx = y for some

edge relation(x, y) ∈ EG+Π , i.e., this is usually referred to as aself loopor cycle.

Theorem 1 [Fag94] If a FO programΠ is tight, then aτ(Π)-structureM is an answer

set ofΠ iffM |= Comp(Π).

Hence, from [Fag94], we have that the classical models of theClark’s completion cor-

responds exactly to the answer sets on tight programs, although for non-tight programs

(i.e., as in the programΠ of Example 4), this is not always the case.

2.3.2 Intuition of the Ordered Completion

In a nutshell, theordered completionis a translation of FO programs into classical FO

logic sentences that is achieved by modifying the Clark’s completion and introducing ex-

tra predicates. The main technical property of our new translation is that for each finite

Page 45: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 36

FO program, our translation yields a FO sentence that exactly captures the finite answer

sets of the program. The ideas behind our translation can be best illustrated by simple

propositional programs. Consider the propositional program

p← q

q ← p.

Then the program has the one answer set∅, although its Clark’s completionp ↔ q has

two models: {p, q} and ∅. To remedy this problem, we introduce four extra symbols

Tpq, Tpp, Tqq andTqp (read, for e.g.,Tpq as fromp to q), and translate this propositional

program into the following propositional formula:

(p→ q) ∧ (q → p) (2.3)

∧(p→ (q ∧ Tqp ∧ ¬Tpq)) (2.4)

∧(q → (p ∧ Tpq ∧ ¬Tqp)) (2.5)

∧(Tpq ∧ Tqp → Tpp) (2.6)

∧(Tqp ∧ Tpq → Tqq). (2.7)

Formula (2.3) is the “classical” logic encoding of the two rules “p← q” and “q ← p”; (2.4)

is similar to the other side of the Clark’s completion forp except that we addTqp and¬Tpq,

which intuitively means that: forp to be true, thenq must be true and it must be the case

thatq is used to derivep and not the other way around; (2.5) is similar in that it is theother

side of the Clark’s completion forq but with the extra assertions ofTpq andTpq (i.e., same

meaning as above); and finally, (2.6) and (2.7) are simply about the condition that those

“T ” atoms satisfies the notion of transitivity.

2.3.3 Definition of the Ordered Completion

Now we introduce the notion ofordered completion. So letΠ be a FO program with a

set of intensional predicatesPint(Π). Then for each pair of intensional predicates(P,Q)

(i.e., note thatP andQ can be the same), we introduce a new predicate≤PR, called the

comparison predicate, whose arity is the sum of the arities ofP andQ. The intuitive

meaning of≤PR (x,y), read as fromP (x) toQ(y), is thatP (x) was used to deriveQ(y).

Page 46: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 37

Definition 6 (Ordered completion) LetΠ be a FO program. Then the ordered completion

of Π, denoted byOC(Π), is the following FO sentence:

P∈Pint(Π)

∀x(∨

r∈Π,Head(r)=P (x)

∃yrBody(r)→ P (x) ) (2.8)

∧∧

P∈Pint(Π)

∀x(P (x)→∨

r∈Π,Head(r)=P (x)

∃yr( Body(r) ∧ P os(r) < P (x)) ) (2.9)

∧ Trans(Π), (2.10)

where we have borrowed notations as used in the definition of the Clark’s completion (see

Section 2.2), and where:

• P os(r) < P (x) denotes the formula:

Q(y)∈Pos(r),Q∈Pint(Π)

≤QP (y,x) ∧ ¬ ≤PQ (x,y), (2.11)

which intuitively means that the atoms inPos(r) were used to deriveP (x) and not

the other way around;

• Trans(Π) denotes the formula:

P,Q,R∈Pint(Π)

∀xyz (≤PQ (x,y)∧ ≤QR (y, z)→≤PR (x, z)), (2.12)

which intuitively means that the comparison atoms satisfies anotion of “transitivity.”

Clearly, for a finite programΠ,OC(Π) is a finite FO sentence. Moreover, the predicates

occurring inOC(Π) are all the predicates occurring inΠ (i.e., Pext(Π) ∪ Pint(Π)) and

together with the set of all the comparison predicates{≤PQ| P,Q ∈ Pint(Π)}.

Page 47: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 38

Note that the Clark’s completion of a predicate can be rewritten as two parts:

P∈Pint(Π)

∀x(∨

r∈Π,Head(r)=P (x)

∃yrBody(r)→ P (x) ) (2.13)

∧∧

P∈Pint(Π)

∀x(P (x)→∨

r∈Π,Head(r)=P (x)

∃yrBody(r) ). (2.14)

Thus, appart from the “transitivity axioms”Trans(Π), we have thatOC(Π) andComp(Π)

really only differ through Formulas (2.9) and (2.14), i.e.,since (2.8) and (2.13) are basically

the same formulas. It can be seen that (2.9) introduces some assertions on the comparison

predicates (i.e., via “P os(r) < P (x)”), which intuitively means that there exist derivation

paths from the intensional atoms of thepositive body to the head and not the other way

around. In addition (2.10) (i.e.,Trans(Π)) simply means that the comparison predicates

satisfy a notion of “transitivity.”

Proposition 3 LetΠ be a FO program. ThenOC(Π) introducesm2 new predicates whose

arities are no more than2s, and the size ofOC(Π) isO(s×m3 + s× n), where:m is the

number of intensional predicates ofΠ; s is the maximal arity of the intensional predicates

of Π; andn is the length ofΠ.

Example 5 Recall the parent-ancestor programΠPA presented in Example 3. In this case,

since the only intensional predicate isAncestor, then we only need to introduce one ad-

ditional predicate≤AncestorAncestor, whose arity is 4, i.e., since the arity ofAncestor is 2.

Page 48: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 39

The ordered completionOC(ΠPA) of ΠPA is then the following FO sentence:

∀xy((Parent(x, y) ∨ ∃z(Ancestor(x, z) ∧ Ancestor(z, y)))

→ Ancestor(x, y)) (2.15)

∧ ∀xy(Ancestor(x, y)

→ (Parent(x, y)∨

∃z(Ancestor(x, z)∧ ≤AncestorAncestor (x, z, x, y)

∧ ¬ ≤AncestorAncestor (x, y, x, z)

∧ Ancestor(z, y)∧ ≤AncestorAncestor (z, y, x, y)

∧ ¬ ≤AncestorAncestor (x, y, z, y) ))) (2.16)

∧ ∀uvwxyz(≤AncestorAncestor (u, v, w, x)∧ ≤AncestorAncestor (w, x, y, z)

→≤AncestorAncestor (u, v, y, z)). (2.17)

Intuitively, one can understand≤AncestorAncestor (u, v, w, x) to mean thatAncestor(u, v)

is used to establishAncestor(w, x). So Formula (2.16) means that forAncestor(x, y)

to be true, then eitherParent(x, y) (the base case), or inductively, for somez, both

Ancestor(x, z) andAncestor(z, y) are true and where they are both used to establish

Ancestor(x, y) but not the other way around, i.e., as expressed by the comparison predicate

assertions

≤AncestorAncestor (x, z, x, y) ∧ ¬ ≤AncestorAncestor (x, y, x, z)

and

≤AncestorAncestor (z, y, x, y) ∧ ¬ ≤AncestorAncestor (x, y, z, y),

corresponding toAncestor(x, z) andAncestor(z, y) respectively.

To see how this axiom works, consider again the “parent” structureP (i.e., the exten-

sional (or input) database) and the “intensional expansion” τ(ΠPA)-structureA2 of Exam-

ple 3. As already discussed in Example 3, we have thatA2 is not an answer set ofΠPA.

Now we show how this corresponds to the ordered completionOC(ΠPA) of ΠPA. Indeed,

let us consider the ancestor relation(Chris, Ann) ∈ AncestorA2 . Then from (2.16), since

Page 49: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 40

(Chris, Ann) /∈ ParentA2 (i.e., and whereParentA2 is our extensional database), there

must be somez (i.e., another person) such that

Ancestor(Chris, z) ∧ Ancestor(z,Ann),

i.e., Chris is an ancestor of ‘z’ and ‘z’ is an ancestor of Ann. Then since we haveAncestorA2

= {(Ann, Bob), ( Bob, Chris), (Ann, Chris), (Chris, Bob), (Chris, Ann) (Bob, Ann)},

we have thatz can only be Bob since(Chris,Bob), (Bob,Ann) ∈ AncestorA2 . But then,

since this implies that we have

Ancestor(Chris,Bob) ∧ Ancestor(Bob,Ann),

by the additional assertions as enforced by the comparison predicate atoms, we must also

have that

≤AncestorAncestor (Chris,Bob,Chris,Ann)

∧¬ ≤AncestorAncestor (Chris,Ann,Chris,Bob)

∧ ≤AncestorAncestor (Bob,Ann,Chris,Ann)

∧¬ ≤AncestorAncestor (Chris,Ann,Bob,Ann) (2.18)

is true. Now, to see why this is a contradiction, let us consider the fact that(Bob, Ann) is

also inAncestorA2. Then again by (2.16), since(Bob, Ann) /∈ ParentA2 , there must be

somez such that

Ancestor(Bob, z) ∧ Ancestor(z,Ann).

Then it follows by the interpretationAncestorA2 thatz can only be Chris since(Bob, Chris),

(Chris, Ann) ∈ AncestorA2 , so that we have

Ancestor(Bob,Chris) ∧ Ancestor(Chris,Ann).

Then similarly, by the additional assertions as enforced bythe comparison predicate atoms,

Page 50: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 41

we must further have the following to also be true:

≤AncestorAncestor (Bob,Chris,Bob,Ann)

∧¬ ≤AncestorAncestor (Bob,Ann,Bob,Chris)

∧ ≤AncestorAncestor (Chris,Ann,Bob,Ann)

∧¬ ≤AncestorAncestor (Bob,Ann,Chris,Ann).

Then this is a contradiction since we already had that

≤AncestorAncestor (Bob,Ann,Chris,Ann)

must be true from (2.18). So therefore, we had just showed that A2 6|= OC(ΠPA), which

corresponds to the fact thatA2 is not an answer set ofΠPA. This in turn implies that

the interpretationAncestorA2 of Ancestor underA2 is not an ancestral relations of the

“parent” extensional structureP.

2.3.4 The Main Theorem

In this section, we now introduce some of the main technical results of this thesis. To

achieve this, it will be helpful to first introduce the notionof an “expansion” of a structure.

Thus, letτ1 andτ2 be arbitrary signatures such thatτ1 ⊆ τ2. Then we say that aτ2-structure

M2 is anexpansionof a τ1-structureM1 iff:

• Dom(M2) = Dom(M1);

• cM2 = cM1 for each constant symbolc ∈ τ1;

• PM2 = PM1 for each predicate (or relational) symbolP ∈ τ1.

Loosely speaking, we can think of the expansionM2 ofM1 as simply the addition of the

constant and predicate symbols fromτ2 \ τ1, and their associated interpretations, to the

structureM1. As an example, consider again the “parent” structureP and the “intensional

expansion” structuresA1 andA2 of Example 3. Then it follows that bothA1 andA2

are expansions ofP on the signature{Ancestor}, i.e., whereAncestor is the intensional

Page 51: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 42

predicate. Symmetrically, by the restriction ofM2 on the signatureτ1, denotedM2↾τ1 , we

denote theτ1-structure that is obtained fromM2 by only consideringthose symbols (both

constants and predicates) that are inτ1. Again as an example, with the “parent” structure

P and its associated “intensional expansions”A1 andA2 of Example 3, whileA1 andA2

are expansions ofP, we have thatA1↾{Parent} = A2↾{Parent} = P, i.e., we only consider

the predicateParent in the structuresA1 andA2 to obtainP.

Borrowing ideas from the notions of loops and loop formulas [CLWZ06], we now in-

troduce the notion of anexternally supported setof ground atoms.4 To achieve this, we

first introduce the following notion about a set of ground atoms. LetΠ be program andA

a structure of some signatureσ such thatτ(Π) ⊆ σ. Then by[Pint(Π)]A, we denote the

following set of ground atoms:{P (a) | a ∈ PA, P ∈ Pint(Π)}. We are now ready to

introduce the notion of an externally supported set.

Definition 7 (Externally supported set) Let Π be a program andA a structure of some

signatureσ such thatτ(Π) ⊆ σ. Then we say a setS ⊆ [Pint(Π)]A is externally supported

underΠ andA (or just externally supported) if there exist some ground atomP (a) ∈ S

such that for some ruleP (x) ← Body(r) ∈ Π with local variablesyr, and assignment of

the formxyr −→ abr (underA), we have that:

1. A |= Body(r)[xyr/abr];

2. Pos(r)[xyr/abr] ∩ S = ∅,

where with a slight abuse of notation,Pos(r)[xyr/abr] denotes the set of ground atoms

{Q(b) | Q(b) corresponds toβ[xyr/abr], β ∈ Pos(r)}, i.e., the ground atoms corre-

sponding toPos(r) under the assignmentxyr −→ abr.

Informally speaking, an externally supported setS, under some programΠ and cor-

responding structureA, is a set of ground atoms that can be justified without any de-

pendence on itself, i.e., hence the “external” support. Note that by Definition 7, a set

S ⊆ [Pint(Π)]A is not externally supported if for all (ground atom)P (a) ∈ S, rule

P (x) ← Body(r) ∈ Π with local variablesyr, and assignment of the formxyr −→ abr

such thatA |= Body(r)[xyr/abr], thatPos(r)[xyr/abr] ∩ S 6= ∅.

4By a ground atom, we refer to the construct of the formP (a) whereP is a predicate symbol anda is atuple of domain elements (of some associated structure) that matches the arity ofP .

Page 52: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 43

The following lemma now relates the notion of an externally supported set to the answer

sets.

Lemma 1 LetΠ be a program. Then aτ(Π)-structureA is an answer set ofΠ iff A |= Π

and all setsS ⊆ [Pint(Π)]A is externally supported.

Proof: See Appendix A.1.1.�

We now introduce another of the key result of this thesis. Generally speaking, the

following result links the notion of externally supported sets of ground atoms to the answer

sets of a program.

Theorem 2 LetΠ be a FO program andσ≤ = {≤PQ| P,Q ∈ Pint(Π)} (i.e., the set of all

the comparison predicate symbols). Then afinite τ(Π)-structureA is an answer set ofΠ

iff there exist an expansionA′ ofA on the signatureσ≤ such thatA′ |= OC(Π).

Proof: See Appendix A.1.2.�

From the proof of the main theorem, we see that the basic idea of the ordered comple-

tion is that each atom in an answer set must be justified step-by-step. In this sense, a finite

structureA is an answer set of a FO programΠ iff it is a model ofΠ and that also satisfies

the following conditions:

Downgrading: every ground atomP (a) in A has some supports from earlier stages. The

“support” part is ensured by the Clark’s completion, and where the “earlier stages”

part is ensured by adding some assertions on the comparison predicates (see Formula

(2.9));

Loop-free: the above downgrading procedure does not contain a loop. This is ensured by

Trans(Π), which states that the comparison predicates satisfy transitivity;

Well-foundedness: the downgrading procedure will end at some step. This is ensured by

the finiteness, i.e., only finite structures are taken into account.

Thus, together with the above three conditions, each groundatomP (a) in a finite answer

setA can be justified step-by-step, in which the track of justifying this atom is captured by

the comparison predicates.

Page 53: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 44

2.3.5 Normal Programs with Constraints

Note that from the definitions of both the Clark’s and ordered completion, we require the

heads of all the rules of the underlying program to be existent. Now recall from Section

1.2.1 that when the head of a rule is empty, then the rule is what is so-called a constraint,

i.e., rules of the form

← β1, · · · , βl, not γ1, · · · , not γm, (2.19)

such thatβi (for 1 ≤ i ≤ l) andγj (for 1 ≤ j ≤ m) are atoms. A model is said to satisfy

the above constraint if it satisfies the corresponding sentence:

∀y¬(β1 ∧ · · · ∧ βl ∧ ¬γ1 ∧ · · · ∧ ¬γm),

wherey is the distinctive tuple of all the variables occurring in (2.19).

A normal program with constraints is then a finite set of rulesand constraints of the form

(2.19). The answer set (or stable models) semantics can be extended to normal program

with constraints: a model is an answer set of a program with constraints if it is an answer

set of the program and that it also satisfies all the constraints.

Both the Clark’s completion and our ordered completion can be extended to programs

with constraints by simply adding5 the corresponding constraints to the respective com-

pletions.

Example 6 The following programΠREACH checks whether all the nodes of a given graph

can be reached from a given inital node:

Reach(x)← x = a

Reach(x)← Reach(y), Edge(y, x)

← notReach(x),

where:

• Edge is the only extensional predicate representing the edges ofthe graph;

5By “adding,” we meanconjuncting.

Page 54: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 45

• a is a constant representing the initial node;

• Reach is the only intensional predicate representing whether a node can be reached

from a.

ThenΠREACH has an answer set iff all the nodes in the graph can be reached froma. Then the

ordered completionOC(ΠREACH) of ΠREACH and the sentence corresponding to the constraint

“← notReach(x)” is the following FO sentence:

∀xy(x = a ∨ (Edge(y, x) ∧Reach(y))→ Reach(x))

∧∀x(Reach(x)→ x = a ∨ ∃y(Reach(y) ∧ Edge(y, x)∧ ≤ReachReach (y, x)

∧ ¬ ≤ReachReach (x, y) ))

∧∀xyz(≤ReachReach (x, y)∧ ≤ReachReach (y, z)→≤ReachReach (x, z))

∧∀xReach(x).

Proposition 4 Let Π be a FO program with its set of constraints denoted byC. Then a

τ(Π)-structureA is an answer set ofΠ iff there exist an expansionA′ ofA on the signature

σ≤ = {≤PQ| P,Q ∈ Pint(Π)} such thatA′ |= OC(Π) ∧ C, whereC is the sentence

r∈Π,r:= ←β1,··· ,βl,not γ1,··· ,not γm∈Π

∀yr¬(β1 ∧ · · · ∧ βl ∧ ¬γ1 ∧ · · · ∧ ¬γm)

such thatyr is the distinctive tuple of all the variables occurring inr.

Proof: PartitionΠ into the setsΠ′ andC such thatΠ′ = Π \ C, i.e., the non-constraint

rules. ThenA is an answer set ofΠ iff A is an answer set ofΠ′ ∪ C iff A is an answer

set ofΠ′ and is a model ofC iff there exist an expansionA′ of A on the signatureσ≤

such thatA′ |= OC(Π′) (i.e., by Theorem 2) andA′ |= C (i.e., sinceC do not mention

any comparison predicates) iffA′ |= OC(Π) ∧ C (i.e.,OC(Π) ∧ C = OC(Π′) ∧ C since

OC(Π) = OC(Π′) by the definition ofOC(Π)). �

Page 55: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 46

2.3.6 Adding Choice Rules

Another widely used extension of normal program is to allowchoice rulesof the following

form:

{P (x)},

whereP is a predicate andx is the tuple of variables associated withP . Intuitively, this

choice rule ofP means that the intensional predicateP can be interpreted arbitrarily in the

stable models.

Example 7 Consider the following programΠHC with constraints and choice rules for com-

puting all Hamiltonian circuit of a graph:

{hc(x, y)}

← hc(x, y), notE(x, y)

← hc(x, y), hc(x, z), y 6= z

← hc(y, x), hc(z, x), y 6= z

R(x)← hc(a, x)

R(x)← R(y), hc(y, x)

← notR(x),

where:

• E is the only extensional predicate representing the edges ofthe graph;

• a is a constant representing a particular node in the Hamiltonian circuit;

• hc(x, y) is an intensional predicate representing the Hamiltonian circuit;

• R(x) is an intensional predicate to check that all vertices are inthe Hamiltonian

circuit.

In particular, the first rule of the program, “{hc(x, y)},” is a choice rule to guess a possible

Hamiltonian circuit. Then using the notion of ordered completion, we can encodeΠHC as a

Page 56: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 47

FO sentence as follows:

∀x(hc(a, x)→ R(x)) ∧ ∀xy(hc(y, x) ∧R(y)→ R(x))

∧∀x(R(x)→ hc(a, x) ∨ ∃y(R(y) ∧ hc(y, x)∧ ≤RR (y, x) ∧ ¬ ≤RR (x, y)))

∧∀xyz(≤RR (x, y)∧ ≤RR (y, z)←≤RR (x, z))

∧∀xy¬(hc(x, y) ∧ E(x, y))

∧∀xyz(hc(x, y) ∧ hc(x, z) ∧ y 6= z)

∧∀xyz(hc(y, x) ∧ hc(z, x) ∧ y 6= z)

∧∀xR(x),

which is simply the ordered completion ofΠHC obtained by only making the ordered com-

pletion of the intensional predicateR and not of the intensional predicatehc. This is be-

cause we are free to choose arbitrarily whether or not to include an extent ofhc in the

model.�

The following proposition shows that programs with choice rules can also be captured

by their ordered completion.

Proposition 5 LetΠ be a FO program with its set of constraints denoted byC andChoice(σ)

the set of choice rules of every predicate inσ whereσ ⊆ Pint(Π). Then aτ(Π)-structure

A is an answer set ofΠ ∪ Choice(σ) iff there exist an expansionA′ of A such that

A′ |= OC(Π) ∧ C with C as defined in Proposition (4) and where this time,OC(Π) is

the following FO sentence:

P∈Pint(Π)

∀x(∨

r∈Π,Head(r)=P (x)

∃yrBody(r)→ P (x) ) (2.20)

∧∧

P∈Pint(Π),P /∈σ

∀x(P (x)→∨

r∈Π,Head(r)=P (x)

∃yr( Body(r) ∧ P os(r) < P (x) )) (2.21)

∧ Trans(Π), (2.22)

Page 57: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 48

and whereTrans(Π) is defined as

P,Q,R∈Pint(Π),P,Q,R /∈σ

∀xyz (≤PQ (x,y)∧ ≤QR (y, z)→≤PR (x, z)). (2.23)

Loosely speaking, we can think of incorporating choice rulesinto the ordered comple-

tion by not considering those “choice” intensional predicates ofσ in Formulas (2.21) and

(2.22), i.e., and where(2.22) is fulfilled by (2.23).

Proof: This assertion follows directly from Proposition 4 and the following fact: the answer

sets ofΠ∪Choice(σ) are exactly the same as the answer sets ofΠ∗ whereΠ∗ is the program

obtained fromΠ by rewriting each rule of the form:

α← β1, · · · , βl, not γ1, · · · , not γm, (2.24)

whose head mentions predicates fromσ, into the following constraint:

← β1, · · · , βl, not γ1, · · · , not γm, notα.

2.3.7 Arbitrary Structures and Disjunctive Programs

It is worth mentioning that the correspondence between classical FO models of ordered

completions and answer sets of programs only holds on finite structures. In general, the

result doesnot hold if infinite structures are allowed. For instance, the ordered completion

OC(ΠTC) of the programΠTC of Example 2, that computes the Transitive Closure (TC),

does not capture TC on some infinite structures [ALZZ12].

Proposition 6 [ALZZ12] There does not exist a FO formula whose signature contains the

signature of TC, and where the reducts of all its models exactlycorresponds to the answer

sets of TC on arbitrary structures.

Disjunctive answer set programs are a very important extension of normal answer set

programs for dealing with incomplete information [EGM97, GL91]. A disjunctive answer

Page 58: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 49

set programis a finite set ofdisjunctive rulesof the following form

α1; . . . ;αn ← β1, . . . , βl, not γ1, . . . , not γm. (2.25)

Similarly to normal programs, we can distinguish intensional and extensional predicates

here. The answer set semantics for a disjunctive programΠ is defined by applying theSM

operator to the universal closureΠ of Π, whereΠ is the following formula:

r∈Π,r=α1;...;αn←β1,...,βl,not γ1,...,not γm

∀xr(β1 ∧ · · · ∧ βl ∧ ¬γ1 ∧ · · · ∧ ¬γm → α1 ∨ · · · ∨ αn), (2.26)

i.e., the answer sets ofΠ are exactly those models ofSM(Π), whereSM(Π) is defined as

in Section 1.2.2.

A natural question then arises on whether or not the ordered completion can be ex-

tended to FO disjunctive programs under the stable models (or answer set) semantics. As it

turns out, the answer isnegativeprovided some well-recognized assumptions in the com-

putational complexity theory are true. Actually, the following proposition shows a stronger

result that there exist disjunctive programs that cannot becaptured (under thestable model

semantics) by any FO sentence, even with a larger signature.

Proposition 7 [ALZZ12] There exists a disjunctive programΠ such that it cannot be cap-

tured by any FO sentence with the same or larger signature unless NP=coNP. That is, there

is no FO sentenceϕwhose signature contains that ofΠ, and where the reduct of all its finite

models are exactly the finite answer sets ofΠ.

2.3.8 Related Work

In this section, we discuss some related work, mostly other existing or possible transla-

tions from answer set programs under the stable model (answerset) semantics to classical

logic. In fact, the intuitions behind most of the current translations are similar. The main

differences are in the ways how these intuitions are formalized.

Page 59: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 50

Other FO translations

As the focus of this work is to consider the FO case, we first review the existing work about

translating FO answer set programs under the stable model (i.e., answer set) semantics to

standard FO logic. To the best of our knowledge, the only suchtranslation is the loop

formula approach [CLWZ06, LM08]. From a syntactical viewpoint, the main difference

between this approach and ours is that the ordered completion results in a finite FO theory

(which can be represented as a single FO sentence) but uses auxiliary predicates, while the

loop formula approach does not use any auxiliary predicatesbut in general results in an

infinite FO theory.

From a semantical viewpoint, both approaches share some similar ideas. First of all,

both of them are extended from Clark’s completion, and where the extended parts play a

similar role to the elimination of those structures which are models of the Clark’s com-

pletion, but are not stable models of the answer set program.The main difference is that

the loop formula approach uses loop formulas for this purpose, while the ordered comple-

tion uses additional comparison predicates to keep track ofthe derivation order. Secondly,

they both require that every ground atom in a stable model mustbe justified by a certain

derivation path. However, for this purpose, the loop formula approach further claims that

every loop (so is every ground atom) must have some external supports, while the ordered

completion approach explicitly enumerates such a derivation order (thus a derivation path)

by the new comparison predicates.

Similar FO translations in Datalog

Another related work [Kol90] is in the area of finite model theory and fixed-point logic.

Although fixed-point logic and normal answer set programming are not comparable, they

have a common fragment, namely Datalog. Kolaitis [Kol90] showed that every fixed-point

query is conjunctive definable on finite structures. That is,given any fixed-point query

Q, there exists another fixed-point queryQ′ such that the conjunctive query(Q,Q′) is

implicitly definable on finite structures. As a consequence,every datalog query is also

conjunctively definable on finite structures. From this result, although tedious, one can

actually derive a translation from Datalog to FO sentences using some new predicates not

in the signatures of the original datalog programs.

We will not go into details comparing our translation and theone derived from Kolaitis’

Page 60: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 51

result since our focus here is on normal answer set programs.Suffice to say here that the

two are different in many ways, not the least is that ours is based on Clark’s completion

in the sense that some additional conditions are added to thenecessary parts of intensional

predicates, while the one derived from Kolaitis’ result is not. We mention this work because

Kolaitis’ result indeed inspired our initial study on this topic. We speculated that if it is

possible to translate datalog programs to FO sentences using some new predicates, then it

must also be possible for normal answer set programs, and thatif this is true, then it must

be doable by modifying Clark’s completion. As it happened, this turned out to be the case.

Translations in the propositional case

The ordered completion can be viewed as a propositional translation from normal logic

programs to propositional theories by treating each propositional atom as a0-ary predicate.

Several proposals in this direction have been proposed in the literature [BED94, Jan04,

LM08, LZ04, Nie08]. An early attempt is due to Ben-Eliyahu andDechter [BED94], who

assigned an index (or level numbering)#p to each propositional atomp, and added the

assertions#p < #q to the Clark’s completion for each pair(p, q) similar to the ordered

completion, whereq is the head of a rule andp ranges over all atoms in the positive body of

a rule. A closely related work is recently proposed by Niemela [Nie08], in which the level

mappings and their comparisons are captured in dierence logic, an extension of classical

propositional logic. More precisely, each atomp is assigned to a numberxp, meaning its

level or stage. Then, the assertionsxq− 1 < xp are added to the Clark’s completion similar

to Ben-Eliyahu and Dechter and the ordered completion. In addition, in both approaches,

the optimization technique of exploiting strongly connected components is discussed.

Another translation, also sharing the basic idea of comparing stages (or indices), is due

to Janhunen [Jan04], who proposed a simplified translation by level numbering as well.

Different from the above approaches, Lin and Zhao [LZ03] translated an arbitrary normal

answer set program equivalently to a tight program by first adding some new atoms, and

then to use the Clark’s completion of the new program to capture the answer sets of the

original one. Finally, the loop formula approach in the propositional case [LZ04] yields

another translation from propositional normal answer programming to propositional logic.

Again, the loop formula approach requires no new atoms. However, it is not polynomial in

the sense that a program may have exponential loop formulas in worst case.

Page 61: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 52

Comparisons with Ben-Eliyahu and Dechter’s and Niemela’s work

Here, we discuss more about the relationships among the ordered completion, Ben-Eliyahu

and Dechter’s translation, and Niemela’s work since these three translations are very closely

related, while the others are slightly different. In fact, the above three translations basically

share the same intuitions in the propositional case. This isbecause all of them are modified

from Clark’s completion by adding to it the comparisons of indices/levels/stages. Specifi-

cally, the comparisons are represented by≤pq ∧¬ ≤qp in the ordered completion,#p < #q

in Ben-Eliyahu and Dechter’s translation andxq − 1 ≥ xp in Niemela’s work, where in all

the above approaches,q is the head of a rule andp ranges over all atoms in the positive

body of a rule. Indeed, these assertions play the same role tostate that the stage (or level)

of p should be less than the one ofq. In this sense, the modified completion part of all these

three approaches can be transformed from each other.

In Ben-Eliyahu and Dechter’s translation, one has to explicitly enumerate the “indices”

#p and “comparisons”#p < #q in propositional logic [BED94], which turns out to be

rather complicated. This is not an issue for Niemela’s work [Nie08] because the level

numberingxp associated with the atoms and the comparisonsxq − 1 ≥ xp can be directly

represented by the built-in predicates within the languageof difference logic. Finally, in

the ordered completion, we do not introduce the indices directly but use additional atoms

≤pq in classical propositional logic to explicitly represent the comparisons≤pq ∧¬ ≤pq,

which are further specified by the transitivity formulas. The similarities and differences

among the three approaches can be better illustrated by the following example.

Example 8 LetΠ be the following propositional program:

p1 ← p2

p2 ← p1

p1 ← not p3. (2.27)

According to the definitions, the modified completion part ofΠ for the ordered completion

Page 62: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 53

is

(p2 ∨ ¬p3 → p1) ∧ (p1 → p2)

∧ (p1 → p2 ∧ [≤p2p1 ∧¬ ≤p1p2 ] ∨ ¬p3)

∧ (p2 → p1 ∧ [≤p1p2 ∧¬ ≤p2p1 ]),

while for Ben-Eliyahu and Dechter’s translation, this is

(p2 ∨ ¬p3 → p1) ∧ (p1 → p2)

∧ (p1 → p2 ∧ [#p2 ∧#p1] ∨ ¬p3)

∧ (p2 → p1 ∧ [#p1 ∧#p2]),

and finally, for Niemela’s work, this is6

(p2 ∨ ¬p3 → p1) ∧ (p1 → p2)

∧ (p1 → p2 ∧ [xp1 − 1 ≥ xp2 ] ∨ ¬p3)

∧ (p2 → p1 ∧ [xp2 − 1 ≥ xp1 ]).

It can be observed that, the modified completion part of the three approaches can be eas-

ily obtained from each other. For instance, from Niemela’s work to the ordered completion,

one only needs to replace each subformula of the formxp − 1 ≥ xq (e.g.,xp1 − 1 ≥ xp2)

with its corresponding counterpart≤qp ∧¬ ≤pq in the ordered completion (≤p2p1 ∧¬ ≤p1p2

resp.).

The main difference among the three approaches is another part of the translation,

namely how to encode those new indices and comparisons. The host formalism for both

Ben-Eliyahu and Dechter’s translation and our ordered completion is propositional logic,

but for Niemela’s work, it is difference logic, which is an extension of classical proposi-

tional logic with linear constraints but not propositionallogic itself. As a result, the encod-

ing problem of comparisons for Niemela’s work is not an issue because the comparisons,

e.g.,xp1 − 1 ≥ xp2, can be naturally represented in the language of differencelogic with

6It can be observed that the new atomsbdia in Niemela’s work are not necessary.

Page 63: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 54

the built-in predicate≥.

In the ordered completion, we use additionally transitivity formulas among new atoms

≤pq for this purpose. For instance, for the programΠ of Example 8, the transitivity formula

is: 7

≤p1p2 ∧ ≤p2p1→≤p1p1

∧ ≤p2p1 ∧ ≤p1p2→≤p2p2 .

In Ben-Eliyahu and Dechter’s translation, one needs to explicitly encode the indices#p

and the comparisons#p < #q in classical propositional logic. This is rather complicated

because one has to enumerate all the possibilities. For instance, for the programΠ of

Example 8, the encoding of each index, e.g.,#p1, is:

(p1 = 1 ∨ p1 = 2) ∧ (p1 = 1→ ¬(p1 = 2)),

and the encoding of each comparison, for instance#p1 < #p2, is:

p1 = 1 ∧ p2 = 2.

FO definability and weak definability

Since the ordered completion is about translating answer set programs to FO logic, it is

closely related to the concepts of (first-order) definability for answer set programming

[LM08, ZZ10].

A program is (first-order) definable (on finite structures) if there exists a first-order

sentence of the signature of the program such that its (finite) models are exactly the (finite)

stable models of the program. It is well-known that many programs are not first-order

definable, e.g., the program TC in Example 2, both on arbitrary structures and on finite

structures [EF99].

A weaker notion of FO definability is to allow new predicates.A program is (first-

order) weakly definable(on finite structures) if there exists a FO sentence of a signature

containing the signature of the program such that the reducts of its (finite) models on the

signature of the program are exactly the (finite) stable models of the program. It is easy to

7All the other transitive formulas are trivially true.

Page 64: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 55

see that a program is weakly definable (on finite structures) iff it is defined by an existential

second-order sentence (on finite structures).

The following result immediately follows from Theorem 2.

Corollary 1 Every normal answer set program is weakly definable on finite structures.

More precisely, every program is weakly defined by its orderedcompletion on finite struc-

tures.

However, as shown in Proposition 6, this result does not holdon arbitrary structures. For

instance, the TC program is not weakly definable on arbitrarystructures. In fact, following

a similar proof, Proposition 6 can be extended to the following result.

Proposition 8 On arbitrary structures, if a normal answer set program is notdefinable,

then it is not weakly definable.

2.4 Ordered Completion with Aggregates

Aggregates are a very important buidling block of answer setprogramming that is widely

used in many (practical) applications. The reason why aggregates are crucial in answer set

solving is twofold. First, it can simplify the representation task. For many applications,

one can write a simpler and more elegant logic program by using aggregates, for instance,

the job scheduling program [PSE04]. More importantly, it can improve the efficiency of

program solving [GKKS09]. Normally, the program using aggregates can be solved much

faster [FPL+08].

Before we formally define the notion of a program with aggregates, it will first be nec-

essary to enhance our definition of a structure. We do this by having a more general view of

a structure to include somefixedinterpretations on relations associated with the integer set

Z. For this purpose, we resort tomany-sortedstructures andtypedfirst-order logic. In par-

ticular, we now assume our language to have thesuper-sortS = Z∪D such that:Z∩D = ∅

(i.e.,D contains no elements from theZ); Z is the set{. . . ,−3,−2,−1, 0, 1, 2, 3, . . . } of

integers; andD is the set ofall possiblenon-integer domain elements.

Page 65: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 56

We now view a structureA as amany-sortedstructure of the form

({S,Dom(A)},

. . . ,−3A,−2A,−1A, 0A, 1A, 2A, 3A, . . . ,+A,×A, <A,≤A,=A,≥A, >A,

cA1 , . . . , cAm, R

A1 , . . . , R

An ), (2.28)

with sorts{S,Dom(A)} such that

(Dom(A), cA1 , . . . , cAm, R

A1 , . . . , R

An ) (2.29)

is a standard structure in first-order logic whereDom(A) is a finitesub-sortof thesuper-

sortS = Z ∪D.8

Note that in (2.28),

. . . ,−3,−2,−1, 0, 1, 2, 3, . . .

are constant symbols such that

. . . ,−3A,−2A,−1A, 0A, 1A, 2A, 3A, . . .

corresponds to their natural interpretations onZ, i.e., 0A = 0, 1A = 1, 2A = 2, etc. In

addition to these constants, we also have the function symbols + and×, and relational

symbols<, ≤, =, ≥, and> such that+A, ×A, <A, ≤A, =A, ≥A, and>A stands for the

“standard”9 interpretations onZ. Note that since we view (2.29) as asub-structureof A,

then all the constantsc1, . . . , cm and relationsR1, . . . , Rn only involve sorts ofDom(A).

Therefore, we view the other sub-structure

(S, . . . ,−3A,−2A,−1A, 0A, 1A, 2A, 3A, . . . ,+,×, <A,≤A,=A,≥A, >A) (2.30)

of the super-sortS as thefixed“standard” interpretation associated with number theory.For

this reason and simplicity, when we refer to a structure, we only assume (2.29) and regard

(2.30) as the fixed background structure on integers. In addition, as already mentioned

8Dom(A) is a finite set that can contain both integer (i.e., those fromZ) and non-integer (i.e., those from

D) elements.9For instance, if one ofx or y is a non-integer element, then we assumex ≤ y to evaluate to false, and

x+ y (or x× y) to evaluate to some non-integer element.

Page 66: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 57

above, we only restrict ourselves to finite structures by assuming thatDom(A) is finite.

Also for convenience, we denote byσZ as the signature corresponding to the set of symbols

{. . . ,−3,−2,−1, 0, 1, 2, 3, . . . ,+,×, <,≤,=,≥, >}

associated with the standard interpretation onZ.

We now introduce the notion of aggregate atoms. For this purpose, it will again be

necessary to further enhance our notion of a structure by also incorporating a new sort

MS, which represents the set of all the finitemultiset10 subsets ofS, i.e., whereS is the

super-sort ofZ andDom(A). We also introduce the following additional functions into

the signatureσZ: CARD, SUM, PROD, MIN , andMAX ,11 which operates fromMS to S. In

particular,CARD is a function fromMS to Z, andSUM, PROD, MIN , andMAX arepartial

functions fromMS to S such that:

1. If M ∈ MS is a multiset ofZ (i.e., only mentions element of integers), then with

OP∈ {SUM, PROD,MIN ,MAX }, we haveOP(M) ∈ Z;

2. Otherwise, ifM ∈ MS is not a multiset ofZ (i.e., it mentions some non-integer ele-

ments), then withOP∈ {SUM, PROD, MIN , MAX }, we have thatOP(M) is undefined.

In this work, we consider aggregate atomsδ of the form

OP〈v : ∃wBody(δ)〉 � N, (2.31)

where:

• OP∈ {CARD, SUM, PROD,MIN ,MAX };

• Body(δ) (the body ofδ) is of the form

Q1(y1), . . . , Qs(ys), notR1(z1), . . . , notRt(zt), (2.32)

where eachQi(yi) (1 ≤ i ≤ s) andRj(zj) (1 ≤ j ≤ t) are atoms that can be

10A multisetgeneralizes the notion of asetby allowing repeated elements. Hence conceptually, the usualnotion of a set is the special case of a multiset where every element occurs at most once.

11CARD, SUM, PROD, MIN , andMAX stands forcardinality, sum, product, minimum, andmaximum, re-spectively.

Page 67: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 58

of predicates fromσZ, but where all the variables are mentioned in some atom of a

predicate from{R1, . . . , Rn};12

• v andw are distinctive tuples of variables mentioned in (2.32),

• �∈ {<,≤,=,≥, >} is a comparison operator onZ (i.e.,�∈ σZ);

• and finally,N is a constant standing for a number inZ (i.e.,N ∈ σZ as well).

For convenience, we usePos(δ) andNeg(δ) to denote the sets{Q1(y1), . . . , Qs(ys)} and

{R1(z1), . . . , Rt(zt)} respectively. By thefree variables ofδ, we denote those variables

mentioned in (2.32) but not inv ∪w. For instance, withδ the aggregate atom

SUM〈x : ∃yP (x, y), notQ(y, z)〉 < 10, (2.33)

then we havez as its only free variable, i.e., we can also denoteδ by δ(z). Informally speak-

ing, (2.33) states that the sum of allx such that there exist ay where “P (x, y), notQ(y, z)”

holds for some givenz, is less than 10.

A FO programΠ with aggregates is then still a collection of rulesr of the form:

α← β1, · · · , βl, not γ1, · · · , not γm, (2.34)

(1.4) but where some of theβi (1 ≤ i ≤ l) or γj (1 ≤ j ≤ m) can be aggregate atoms of the

form (2.31). In addition, we can also assume that these atomscan involve symbols from

σZ but where each variable mentioned must occur in some atom from {R1, . . . , Rn},13 and

all function terms fromσZ (i.e., ‘+’ and ‘×’) only occurs in the comparison operators<,

≤, =,≥, and> of σZ.14 By τ(Π), we denote the signature of the symbols mentioned inΠ

that are not inσZ (this includes the aggregate functions).

12This insures that all the variables only ranges overDom(A) since all atoms of{R1, . . . , Rn} are of sortDom(A).

13This insures that all variables are of sortDom(A) hence, only ranging overDom(A).14This insures the values ofx+ y andx× y are only considered for the comparison operators ofσZ.

Page 68: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 59

Example 9 Consider the following FO programΠ with a simple aggregate atom

Q(y)← CARD〈x : P (x)〉 = 2 (2.35)

P (x)← Q(x) (2.36)

P (x)← R(x). (2.37)

Here,τ(Π) = {P,Q} and whereP andQ are intensional whileR is extensional. Rule

(2.35) states that ifP (x) holds exactly for two elements, then we haveQ(y).

Now assumeδ to be an aggregate atom with free variablesx. Then we say that a

structureA (of appropriate signature) satisfiesδ(x)[x/a] for somea ∈ Dom(A)|x| iff:

1. The multiset15

M = {{c[1] |A |= Body(δ)[xwv/abc],b ∈ Dom(A)|w|, c ∈ Dom(A)|v|}}

is in the domain of the aggregate functionOP (whereBody(δ) denotes the conjunc-

tions of all the literals inBody(δ) with ‘not ’ turned into ‘¬’);

2. OP(M) � N holds.

Then the satisfaction of formulas with aggregates can be defined recursively as usual by

viewing the aggregate atoms as a base case.

An aggregate functionOP with respect to a comparison operator� and numberN is

said to be: monotoneif M1,M2 ∈ Dom(OP) (i.e., in the domain ofOP), M1 ⊆ M2,

andOP(M1) � N imply that OP(M2) � N ; andanti-monotoneif M1,M2 ∈ Dom(OP),

M2 ⊆M1, andOP(M1) � N imply thatOP(M2) � N .

2.4.1 The Stable Model Semantics for Aggregates

By Π, we now define theuniversal closureof Π as the FO sentence

r∈Π,r:= α←β1,··· ,βl,not γ1,··· ,not γm

∀xr(β1 ∧ · · · ∧ βl ∧ ¬γ1 ∧ · · · ∧ ¬γm → α), (2.38)

15In the following,c[1] denotes the first component (or position) in the tuplec.

Page 69: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 60

wherexr denotes the tuple of distinctive free variables occurring in r, and such that ifβi

(1 ≤ i ≤ l) or γj (1 ≤ j ≤ m) is an aggregate atomδ of the form (2.31), thenβi (or γj) is

the aggregate atom of the form

OP〈v : ∃yBody(δ)〉 � N, (2.39)

such thatBody(δ) denotes the conjunctions

P1(y1) ∧ · · · ∧ Ps(ys) ∧ ¬Q1(z1) ∧ · · · ∧ ¬Qt(zt)

of literals inBody(δ).

Example 10 Let us consider again the FO programΠ of Example 9. Then the universal

closureΠ of Π is the following FO sentence:

∀y(CARD〈x : P (x)〉 = 2→ Q(y)) (2.40)

∧∀x(Q(x)→ P (x)) (2.41)

∧∀x(R(x)→ P (x)). (2.42)

In the spirit of Section 1.2.1, also assumingP = P1 · · ·Pn to be the tuple of distinctive

intensional predicates andU = U1 · · ·Un as the tuple of fresh distinctive predicates of the

same length asP (i.e., and such that the arity ofUi matches the arity ofPi for 1 ≤ i ≤ n),

we now defineΠ∗(U) as the following formula:

r∈Π,r:= α←β1,··· ,βl,not γ1,··· ,not γm

∀xr(β∗1 ∧ · · · ∧ β

∗l ∧ ¬γ1 ∧ · · · ∧ ¬γm → α∗), (2.43)

such that for an atomρ ∈ {α, β1, · · · , βl}, if:

1. ρ = Q(x) whereQ ∈ Pext(Π), thenρ∗ = ρ;

2. ρ = Pi(x) wherePi ∈ Pint(Π) (i.e.,1 ≤ i ≤ n), thenρ∗ = Ui(x) ;

Page 70: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 61

3. ρ is an aggregate atomδ of the form (2.31), thenρ∗ is the formula

(OP〈v : ∃w Body(δ)∗〉 � N) ∧ (OP〈v : ∃wBody(δ)〉 � N),

where Body(δ)∗ is the formula

P1(y1)∗ ∧ · · · ∧ Ps(ys)

∗ ∧ ¬Q1(z1) ∧ · · · ∧ ¬Qt(zt),

such thatPj(yj)∗ (1 ≤ j ≤ s) is defined as in the aforementioned Items 1 and 2

above.

Then similarly to Section (1.2.1), bySM(Π) we denote the universal SO sentence

Π ∧ ∀U(U < P→ ¬Π∗(U)).

Then we say aτ(Π)-structureA is ananswer set(or stable model) of the FO program

Π with aggregates iffA |= SM(Π). It should be noted here that our notion ofSM(Π)

is essentially equivalent to the one in [BLM11] when restricted to the syntax of normal

programs with aggregate atoms of the form (2.31).

2.4.2 Extension of Ordered Completion for Aggregates

From a theoretical point of view, ordered completion [ALZZ10] makes important pro-

gresses on understanding first-order answer set programming. Firstly, it shows that the

stable model semantics is simply Clark’s completion plus derivation order. Secondly, it

clarifies the relationship between first-order normal program and classical first-order logic.

More precisely, every normal answer set program can be captured by a first-order sentence

with some new predicates on finite structures. Surprisingly, this fails to be true on infinite

structures or if no new predicates are allowed [ALZZ12] (seeSection 2.3.7).

Ordered completion is not only theoretically interesting but also practically important.

It initiates a new direction of program solvers by first translating a normal logic program

to its ordered completion and then to work on finding a model ofthis first-order sentence

[ALZZ12]. A first implementation shows that this new direction is promising as it performs

surprisingly good on the Hamiltonian Circuit program [Nie99], especially on big instances.

Page 71: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 62

However, ordered completion can hardly be used beyond the Hamiltonian Circuit pro-

gram because it cannot handle aggregates - a very important building block in program that

is widely used in many applications. As far as we are concerned, most benchmark pro-

grams contain aggregate constructs [CIR+11]. Aggregates are crucial in answer set solving

because on one hand, it can simplify the representation task, and on the other hand, it can

improve the efficiency of program solving [GKKS09].

In this section, we consider to incorporate aggregates in ordered completion. How-

ever, this is a challenging task. As shown in [ALZZ12], ordered completion cannot be

extended for disjunctive programs because they are not in the same complexity level. Sim-

ilarly, normal answer set programs with arbitrary aggregates has the same complexity level

as disjunctive programs, which is beyond the complexity of naive normal programs. This

suggests that, most likely, normal logic programs with arbitrary aggregates cannot be cap-

tured in first-order logic, thus not by ordered completion.

Hence, we are mainly focused on some special classes of aggregates, for instance,

(anti)monotone aggregates. Even for this case, the task is still very complicated. One ob-

servation is that aggregate atoms can express some featuresof existential quantifiers, which

is even more complicated than disjunctions in first-order program. For instance, recall the

program specified in Example 9. The first rule, i.e., rule (2.35), is actually equivalent to the

following rule∃=2P (x)→ Q(y), where∃=2P (x) is a shorthand of

∃xz(x 6= z ∧ P (x) ∧ P (z) ∧ ∀u(P (u)→ u = x ∨ u = z)),

meaning thatP (x) holds exactly for2 elements.

Another observation is that monotone aggregate atoms contribute to the first-order loops

[CLWZ06, LM09] of the program. Again, consider the program in Example 9. If we ignore

the aggregate atoms, then this program has no loops. But the stable models of the program

cannot be captured by its Clark’s completion. This means thatthe aggregate atom in rule

(2.35) indeed plays a role to form a loop of the program.

Hence, the difficult part is to identify the gap between the aggregates that can be incor-

porated into ordered completion and those cannot. In this section, we show that a large vari-

ety of (anti)monotone aggregates can indeed be incorporatedin ordered completion, which

covers the types of aggregates in most benchmark programs, as far as we have checked.

We extend the notion of ordered completion for normal logic programs with such kind of

Page 72: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 63

aggregates so that every stable model of a program is corresponding to a classical model of

its enhanced ordered completion, and vice versa.

Formally, the aggregate functions we consider in this work are restricted as follows.

Definition 8 For an aggregate atom of the form (2.31) whereOP∈ {CARD, SUM, PROD,

MIN , MAX },

• CARD is a function from multisets ofdomain tuplesto Z+ = {0, 1, 2, 3, . . . } (non-

negative integers), and it is defined as0 on the empty multiset∅;

• SUM is a function from multisets ofZ+ to Z+, and it is also defined as0 on∅;

• MIN andMAX are functions from multisets ofZ toZ, and are undefined for∅;

• PROD is a function frommultisetsof N to N (i.e., N = {1, 2, 3, . . . }, the natural

number), and is defined as1 on∅.

Now, we define the ordered completion for normal FO programs with aggregate atoms

of the form (2.31) under the restrictions in Definition 8. Forconvenience, we usePosAgg(r)

to denote the aggregate atoms fromPos(r); PosCardSumProd(r) to denote the cardi-

nality, sum, and product aggregates fromPos(r); andPosMinMax(r) to denote the min-

imum and maximum aggregate atoms fromPos(r) respectively.

Definition 9 (Ordered completion with aggregates)LetΠ be a FO program with aggre-

gate atoms of form (2.31) under the restrictions in Definition 8. Themodified completion

of Π, denoted byMComp(Π), is the following formula:

P∈Pint(Π)

∀x(∨

r∈Π,Head(r)=P (x)

∃yrBody(r)→ P (x) )∧ (2.44)

P∈Pint(Π)

∀x(P (x)→∨

r∈Π,Head(r)=P (x)

∃yr[Body(r) ∧ P os(r) < P (x) ∧ PosAgg (r) < P (x)] )

(2.45)

where:

Page 73: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 64

• Po s(r) < P (x) is

Q(y)∈Pos(r)\PosAgg(r),Q∈Pint(Π)

(≤QP (y,x) ∧ ¬ ≤PQ (x,y) );

• andPosAgg (r) < P (x) is

δ∈PosCardSumProd(r),�∈{=,≥,>}

( OP〈v : ∃wBody(δ) ∧ Po s(δ) < P (x) 〉 � N )∧

δ∈PosMinMax(r),�∈{<,≤,=,≥,>}

( OP〈v : ∃wBody(δ) ∧ Po s(δ) < P (x) 〉 � N ),

where for an aggregate atomδ of the form (2.31) with body of the form (2.32),

Po s(δ) < P (x) stands for

1≤i≤s,Qi∈Pint(Π)

(≤QiP (yi,x) ∧ ¬ ≤PQi(x,yi) ). (2.46)

Finally, theordered completionofΠ, denoted byOC(Π), is againMComp(Π)∧Trans(Π).

Let us take a closer look at Definition 9. First of all, for non-aggregate atoms, we

treat them the same way as in the original definition of ordered completion. For aggregate

atoms, we distinguish two cases. For those atomsOP〈v : ∃wBody(δ) 〉 � N whereOP ∈

{CARD, SUM, PROD} and�∈ {<,≤}, and those atoms negatively occurring in the rule, we

do not need to pay extra attention. However, for the rest of the positive aggregate atomsδ,

we need to enforce the comparison assertions, i.e., formula(2.46). This is because, for the

latter kind of aggregate atoms, we need to keep track of the derivation order. However, for

the former kind, this is not necessary because they do not enforce a nonempty multiset.

Page 74: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 65

Example 11 Consider again the programΠ in Example 9. ThenOC(Π) is

∀y(CARD〈x : P (x)〉 = 2→ Q(y)) (2.47)

∧∀x(Q(x)→ P (x)) ∧ ∀x(R(x)→ P (x)) (2.48)

∧∀x(P (x)→ R(x) ∨ (Q(x) ∧ Q(x) < P (x)) ) (2.49)

∧∀y(Q(y)→ [CARD〈x : P (x)〉 = 2] ∧ [CARD〈x : P (x) ∧ P (x) < Q(y)〉 = 2] ) (2.50)

∧Trans(Π), (2.51)

where Q(x) < P (x) and P (x) < Q(y) are the shorthands for≤QP (x, x) ∧ ¬ ≤PQ (x, x)

and≤PQ (x, y) ∧ ¬ ≤QP (y, x) respectively. Notice thatOC(Π) can be represented in

first-order logic since formula (2.47) is equivalent to∀y(∃=2xP (x)→ Q(y)) and Formula

(2.50) is equivalent to∀y(Q(y)→ ∃=2x(P (x) ∧ P (x) < Q(y))).

Consider a structureA whereRA = ∅. Then,A is a stable model ofΠ iff PA =

QA = ∅. This in fact corresponds to a model ofOC(Π). Otherwise, supposePA 6= ∅,

sayPA = {a, b}. Then since we haveP (a), by (2.49),Q(a) ∧ Q(a) < P (a) holds. Then

by (2.50),∃=2x(P (x) ∧ P (x) < Q(a)) must also hold. Then sincePA = {a, b} exactly

contains 2 elements, thenP (a) < Q(a) must hold as well. This contradicts toTrans(Π)

and Q(a) < P (a).

Consider a structureA with RA = {a, b}. ThenA is a stable model ofΠ iff Dom(A)

only contains two elements andPA = QA = {a, b}. Now we show that this in fact

corresponds to the model ofOC(Π) as well. On one hand, ifDom(A) only contains two

elements andPA = QA = {a, b}, it can be easily extended to a model ofOC(Π) by

forcing ∀xy P (x) < Q(y) to be true. On the other hand, supposeDom(A) contains more

than2 elements. ThenOC(Π) has no model since there are only two possible cases:

Case 1: PA = {a, b}.

Then by (2.47),Q holds for all domain elements. By (2.48),P holds for all domain

elements as well, a contradiction.

Case 2: PA 6= {a, b}.

Then by (2.48),{a, b} ⊂ PA. By (2.49),QA is not empty. Then by (2.50),∃=2xP (x)

holds, a contradiction.

In fact, it can be verified that a finite structureA is a stable model ofΠ iff it can be

Page 75: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 66

expanded to a model ofOC(Π).

2.4.3 Externally Supported Sets with Aggregates

In Definition 7 of Section 2.3.4, we introduced the notion of theexternally supportedset

of ground atoms, i.e., the setsS ⊆ [Pint(Π)]A where[Pint(Π)]

A = {P (a) | a ∈ PA, P ∈

Pint(Π)} for some programΠ and associated structureA. We will now extend this notion

to account for the occurrence of aggregate atoms. The following definition is towards this

purpose.

Definition 10 LetΠ be a FO program with aggregate atoms of form (2.31) andA a struc-

ture of some signatureσ such thatτ(Π) ⊆ σ. Then we say that a setS ⊆ [Pint(Π)]A

is externally supported(underA andΠ) if there exist someP (a) ∈ S and ruleP (x) ←

Body(r) ∈ Π with local variablesyr, such that for some assignment of the formxyr −→

abr, we have:

1. A |= Body(r)[xyr/abr];

2. (Pos(r) \ PosAgg(r))[xyr/abr] ∩ S = ∅; 16

3. For all aggregate atomδ ∈ PosAgg(r) of the form (2.31),17

OP〈cv[1] : A |= Body(δ)[xyrwv/abrcwcv], Pos(δ)[xyrwv/abrcwcv] ∩ S = ∅,

cw ∈ Dom(A)|w| andcv ∈ Dom(A)|v|〉 � N,

holds.

Note that by Definition 10, a setS ⊆ [Pint(Π)]A is not externally supported if for all

P (a) ∈ S, ruleP (x) ← Body(r) ∈ Π with local variablesyr, and assignmentsxyr −→

abr such thatA |= Body(r)[xyr/abr] (i.e., a “support” forP (a)), there exists some atom

β ∈ Pos(r) such that either

16Pos(r) \ PosAgg(r) denotes the atoms inPos(r) minus the ones fromPosAgg(r) (i.e., the aggregateones), such that with a slight abuse of notation,(Pos(r)\PosAgg(r))[xyr/abr] denotes the set of predicateinstances{Q(b) | β ∈ Pos(r) \ PosAgg(r), Q(b) corresponds toβ[xyr/abr]}.

17In the following,cv[1] denotes the first component (or position) in the tuplecv.

Page 76: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 67

1. β = Q(y), whereQ ∈ Pint(Π) andQ(b) ∈ S corresponds toβ[xyr/abr], or

2. β is a aggregate atomδ of the form (2.31) and

OP〈cv[1] : A |= Body(δ)[α], Pos(δ)[α] ∩ S = ∅〉 � N (2.52)

does not hold, whereα is the assignment of the formxyrwv −→ abrcwcv such that

cw ∈ Dom(A)|w| andcv ∈ Dom(A)|v|.

Intuitively, if OP〈 cv :A |= Body(δ) [α] 〉 � N holds (i.e., givenA |= Body(r)[xyr/abr]),

then (2.52) does not hold because there are not enoughBody(δ)[α] with Pos(δ)[α] inde-

pendent of those grounded atoms fromS. Then removing those intensional grounded atoms

corresponding to the grounded atoms inS fromA will make OP〈cv : A |= Body(δ)∗ [α] 〉

� N false. Now consider the particular cases whereOP∈ {CARD, SUM, PROD}. If OP〈cv :

A |= Body(δ) [α] 〉 � N holds and (2.52) does not, then� must be in{=,≥, >} since

CARD, SUM (onZ+), andPROD (onN) are (anti)monotonic. Now assume thatOP is MIN

and� is≥ (or OP is MAX and� is≤). If OP〈cv :A |= Body(δ) [α] 〉 � N holds and (2.52)

does not, then it must be the case that{{cv : A |= Body(δ)[α], Pos(δ)[α] ∩ S = ∅}} = ∅

sinceMIN andMAX are undefined for∅, i.e., since it is the only way forδ to be false in this

case.

The following lemma now relates the notion of externally supported to the answer sets

of programs with aggregates.

Lemma 2 Let Π be FO program with aggregate atoms of the form (2.31) under there-

strictions in Definition 8, andA a finiteτ(Π)-structure. ThenA is an answer set ofΠ iff

A |= Π and everyS ⊆ [Pint(Π)]A is externally supported.

Proof: See Appendix A.1.3.�

2.4.4 Theorem of Ordered Completion with Aggregates

With the notion of externally supported set extended to aggregates, then through Lemma

2, we can now prove the following theorem about the enhanced ordered completion of

programs with aggregates.

Page 77: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 68

Theorem 3 LetΠ be FO program with aggregate atoms of the form (2.31) under there-

strictions in Definition 8, andA a finiteτ(Π)-structure. ThenA is an answer set ofΠ iff

there exists an expansionA′ ofA such thatA′ |= OC(Π).

Proof: See Appendix A.1.4.�

Example 12 Let us consider the familiarcompany controlprogram [FPL11]. We are given

an input database corresponding to the predicateCompany(x), denoting the companies

involved. Along with all the companies involved, we are alsogiven an input database

corresponding to the predicateOwnsStk(x, y, n), denoting the percentage of shares from

companyy that is owned by companyx. We say a companyx controls a companyy if the

sum of the shares fromy that is either directly owned byx, or by companies also owned by

x, is more than 50%. This problem yields the following programΠctrl:

ControlsStk(x, x, y, n)← OwnsStk(x, y, n) (2.53)

ControlsStk(x, y, z, n)← Company(x), Controls(x, y), OwnsStk(y, z, n) (2.54)

Controls(x, z)← Company(x), Company(z)

SUM〈n : ∃y ControlsStk(x, y, z, n) 〉 > 50, (2.55)

where:

• ControlStk(x, y, z, n) denotes that companyx controlsn% of z shares via company

y (sincex controlsy and wherey ownsn% of z shares);

• Controls(x, y) encodes that companyx controls companyy. Note that by rule

(2.55), Controls(x, z) can be derived if the sum of the elements in the multiset

{{n | ∃y ControlsStk(x, y, z, n) }} is greater than 50%.

Page 78: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 69

Then the ordered completionOC(Πctrl) of Πctrl is given by the following FO sentence:

∀xyzn( [(OwnsStk(x, z, n) ∧ x = y)∨

(Company(x) ∧ Controls(x, y) ∧OwnsStk(y, z, n))]→

ControlsStk(x, y, z, n))

∧∀xz(Company(x) ∧ Company(z) ∧ (SUM〈n : ∃y ControlsStk(x, y, z, n) 〉 > 50)→

Controls(x, y))

∧∀xyzn(ControlsStk(x, y, z, n)→ [OwnsStk(x, z, n) ∧ x = y]∨

[Company(x) ∧ Controls(x, y) ∧OwnsStk(y, z, n)∧

Controls(x, y) < ControlsStk(x, y, z, n)] )

∧∀xz(Controls(x, z)→ Company(x) ∧ Company(z)∧

(SUM〈n : ∃y ControlsStk(x, y, z, n) 〉 > 50)

(SUM〈n : ∃y ControlsStk(x, y, z, n)∧

Control Stk(x, y, z, n) < Controls(x, z) 〉 > 50)),

where Controls(x, y) < ControlsStk(x, y, z, n) andControl Stk(x, y, z, n) < Controls(x, z)

denotes the formulas≤ControlsControlsStk (x, y, x, y, z, n)∧¬ ≤ControlsStkControls (x, y, z, n, x, y)

and≤ControlsStkControls (x, y, z, n, x, z) ∧ ¬ ≤ControlsControlsStk (x, z, x, y, z, n) respec-

tively. Then by Theorem 3, we have that the answer sets ofΠctrl are exactly thoseτ(Πctrl)-

structuresA that can be expanded to a model ofOC(Πctrl).

2.4.5 Aggregate Constructs as Classical FO Logic

Theorem 3 shows that normal answer set programs with a large variety of aggregates can

be captured by their ordered completions. However, the ordered completion defined in

Definition 9 is not exactly in first-order logic as it containsaggregate atoms. A natural

question arises whether this can be further translated intoclassical first-order logic. We an-

swer it positively in this section. That is, we show that programs with aggregates functions,

restricted in Definition 8, can be further expressed in classical FO logic.

We first express the cardinality aggregate atoms of the formCARD〈v : ∃xLt(δ)〉 � N

Page 79: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 70

into classical FO logic. In here,Lt(δ) is a conjunction of literals that can be comparison

literals. For convenience throughout this section, let us set δ∀vw,N , for some numberN , to

stand for the following formula:

∀vw(Lt(δ)→∨

1≤i≤N

(vw = viwi) ), (2.56)

where each pair of tuplesvi andwi are fresh tuples of distinctive variables matching the

lengths ofv andw, respectively. Intuitively speaking, (2.56) simply encodes that all the

vw satisfyingLt(δ) must have a match with at least one of the tuplesv1w1 . . .vNwN.

Definition 11 (CARD into classical FO logic) Let δ be the aggregate atom of the form

CARD〈v : ∃wLt(δ)〉 � N . Then byδFO, we denote the following formula:

Φ�,N ∧ (2.57)

( ∃vwLt(δ)→ ∃v1w1n1 . . .vN+1wN+1nN+1{ (2.58)∧

1≤i≤N+1

Lt(δ)[vw/viwi] ∧∧

1≤i≤N+1

(ni = 1 ∨ ni = 0) (2.59)

∧∧

1≤i<j≤N+1

(viwi = vjwj → (ni = 0 ∨ nj = 0) ) (2.60)

∧ (n1 + · · ·+ nN+1 � N) ∧ Ψ�,N+1} ). (2.61)

In Definition 11, the formula�,N+1 in (2.57) is defined based on whether or not the

aggregate atom

δ(x) = CARD〈v : ∃wLt(δ)〉 � N

can be satisfied by any structureA, and corresponding assignmentx −→ a on x, even if

the multiset

{{b | A |= Lt(δ)[xvw/abc],b ∈ Dom(A)|v| andc ∈ Dom(B)|w|}} (2.62)

is empty. For instance, if� is > andN ≥ 1, then we defineΦ�,N to be∃vwLt(δ). This

encodes the fact thatδ(x)[x/a] cannot be satisfied byA, under the assignmentx −→ a,

if (2.62) is empty since� being≥ andN ≥ 1 implies that there must at least be onev

for which ∃vwLt(δ)[x/a] holds. On the other hand, if�∈ {<,≤}, then we simply omit

Page 80: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 71

∃vwLt(δ) in (2.57) (or equivalently, set∃vwLt(δ) as⊤), since in this case, the multiset

(2.62) can be empty.

About the formula�,N+1 in (2.61), it is also defined based on the cases about�. If

�∈ {<,≤,=}, thenΨ�,N+1 = δ∀vw,N+1 (see Formula (2.56)). For the other cases (i.e.,

�∈ {≥, >}), we simply omitΨ�,N+1 from the formula (or equivalently, setΨ�,N+1 = ⊤).

Informally speaking, settingΨ�,N+1 = δ∀vw,N+1 for�∈ {<,≤,=} simply insures that we

had considered all possible instances ofvw satisfyingLt(δ) in v1w1 . . .vN+1wN+1.

In general, although Definition 11 seems a little complicated, the underlying idea is

quite simple. We useni to countviwi but only counting non-duplicated occurrences of

viwi. In relation to the formulaΦ�,N mentioned above,∃vwLt(δ) in (2.58) is to cover the

case whereCARD is defined on∅. In particular, note that ifΦ�,N = ∃vwLt(δ) in (2.57),

then∃vwLt(δ) must be true in (2.58), which enforces the consequent in (2.58). As already

hinted above, the∃v1w1n1 . . .vN+1wN+1nN+1 part in (2.58) is for the counting of the

satisfiable instances ofvw. The�,N+1 in (2.61) insures that every satisfiable instances of

vw is considered in our counting (for the cases where�∈ {<,≤,=}). The formula

1≤i≤N+1

(ni = 1 ∨ ni = 0)

in (2.59) forcesni to be only either1 (count the corresponding instanceviwi) or 0 (not

count it). The ∧

1≤i<j≤N+1

(viwi = vjwj → (ni = 0 ∨ nj = 0) )

formula in (2.60) means that for duplicated satisfiable instancevw, we only count at most

once, to prevent multiple countings of duplicated instances. Finally, the

(n1 + · · ·+ nN+1 � N)

formula in (2.61) insures that the counting result is consistent with� andN .

Through a minor modification ofδFO as described Definition 11, we can adopt it to

also express the aggregate constructs involvingSUM andPROD into classical FO logic.

Definition 12 (SUM and PROD into classical FO logic) Letδ be the aggregate atom of the

form OP〈v : ∃wLt(δ)〉 � N whereOP ∈ {SUM, PROD}. Then byδFO, we denote the

Page 81: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 72

following formula:

Φ�,N ∧ (2.63)

( ∃vwLt(δ)→ ∃v1w1n1 . . .vN+1wN+1nN+1{ (2.64)∧

1≤i≤N+1

Lt(δ)[vw/viwi] ∧∧

1≤i≤N+1

(ni = vi[1] ∨ ni = C) (2.65)

∧∧

1≤i<j≤N+1

(viwi = vjwj → (ni = C ∨ nj = C) ) (2.66)

∧ (n1 ⊙ · · · ⊙ nN+1 � N) ∧ Ψ�,N+1 ∧ ΘDom } ), (2.67)

where:

• theΦ�,N in (2.63) is defined as in Definition 11 of theCARD aggregate constructs;

• the C in (2.65) and (2.66) is such thatC = 0 for OP = SUM, andC = 1 for

OP= PROD;

• the⊙ in (2.67) is such that⊙ = + for SUM and⊙ = × for PROD.

• theΨ�,N+1 in (2.67) is also as defined Definition 11 for theCARD aggregate con-

structs;

• and finally, theΘDom in (2.67) denotes the formula

∀vw(Lt(δ)→ v[1] ≥ C), (2.68)

wherev[1] (as also found in (2.65)) stands for the first position (or component) of the

tuplev. This formula simply insures that all thev[1] are numbers that are greater

than or equal toC (withC = 0 for SUM andC = 1 for PROD).

To explain the intuition of Definition 12, let us consider theparticular case whereOP=

SUM (OP = PROD follows similarly). ThenC = 0 in (2.65) and (2.66). In the same way

as in the definition ofδFO of theCARD aggregate constructs, we use theni to simulate the

sum of the (first position) of theviwi but only considering the non-duplicated occurrences.

Hence similarly, the ∧

1≤i≤N+1

(ni = vi[1] ∨ ni = 0)

Page 82: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 73

formula in (2.65) (i.e., withC = 0 sinceOP= SUM) insures thatni can only be eithervi[1]

(includevi[1] in the sum) or0 (not include it). In addition, the

1≤i<j≤N+1

(viwi = vjwj → (ni = 0 ∨ nj = 0) )

formula in (2.66) (i.e., withC = 0 sinceOP = SUM) insures that duplicated instance of

viwi is not considered in the sum. On the other hand, theΘDom in (2.67) (see Formula

(2.68) for its definition) insures that all the (first position) of the satisfiable instances of

vw are numbers that are greater than or equal to0. Finally, as in the case of theCARD

aggregate constructs (as described in Defintion 11), the formula(n1 + · · ·+ nN+1 � N) in

(2.67) insures the summation result is consistent with� andN .

Note that with respect to theCARD aggregate constructs, we can also explicitely ex-

press these into classical FO logic without resorting to anysymbols fromσZ (i.e., the sig-

nature associate with number theory). We achieve this by incorporating some ideas from

[LLP08]. More precisely, we can alternatively defineδFO, whereδ is a CARD aggregate

atom, through the following formula

Φ�,N ∧ (2.69)

{∃vwLt(δ)→ (2.70)∨

1≤k≤N+1

∃v1w1 . . .vkwk(∧

1≤i≤k

Lt(δ)[vw/viwi] ∧∧

1≤i<j≤k

(viwi 6= vjwj) ∧Ψ�,N+1 )},

(2.71)

where�,N and�,N+1 is as defined in Definitions 11 and 12. Informally speaking, (2.71)

simply considers all the possible non-duplicated instancesv1w1 . . .vkwk for lengthsk of

1 toN + 1, for which Lt(δ)[vw/viwi] holds for1 ≤ i ≤ k.

In contrast with the aggregate constructs forCARD, SUM, andPROD, the aggregates

involving MIN and MAX yields a much more simpler translation into classical FO logic.

The following definition now provides the translation of theMIN andMAX aggregates into

classical FO logic.

Definition 13 (MIN and MAX into classical FO logic) Let δ be an aggregate atom of the

Page 83: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 74

form (2.31) whereOP∈ {MIN ,MAX }. Then byδFO, we denote the following formula

∃vwLt(δ) ∧ΘDom ∧ (2.72)

∀v1{ ∀v2(∃wLt(δ)[v1/v1] ∧ ∃wLt(δ)[v

1/v2]→ v1 ⊙ v2 )→ v1 � N }, (2.73)

where:

• ΘDom is now18 defined for thisMIN andMAX cases as

∀vw(Lt(δ)→ (v[1] ≤ 0 ∨ v[1] ≥ 0)), (2.74)

which simply ensures thatv[1] (i.e., the first position ofv) is a number;

• with a slight abuse of notation,v1 denotes the first position (or component) of the

tuplev (i.e.,v1 = v[1]), so thatLt(δ)[v1/v1] (or Lt(δ)[v1/v2]) denotes the formula

obtained fromLt(δ) by substitutingv1 (or v2) for the first componentv[1] of v;

• ⊙ is≤ if OP= MIN and≥ if OP= MAX .

Informally speaking, (2.72) encodes that the multiset associated with the aggregate

atomδ is non-empty (i.e., via∃vwLt(δ)), and that it is a multiset only containing numbers

(i.e., viaΘDom, as defined in (2.74)). On the other hand, (2.73) simply encodes that the

minimum (maximum) elementv1 of the multiset satisfiesv1 � N (with minimum corre-

sponding toMIN and maximum withMAX ).

Theorem 4 For a programΠwith aggregate atoms of the form (2.31) under the restrictions

in Definition 8. LetOC(Π)FO be the formula obtained fromOC(Π) by replacing every

aggregate atomδ in it by δFO. Then a finite structureA is an answer set ofΠ iff A can be

expanded into a model ofOC(Π)FO.

Proof: This follows from the descriptions ofδFO for the various cases ofCARD, SUM,

PROD, MIN , andMAX , as given in Definitions 11, 12, and 13.�

18As opposed to (2.68) in Definition 12.

Page 84: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 75

2.4.6 Related Work

Aggregates are extensively studied in the literature [AZZar, DTEFK09, BLM11, FPL11,

EIST05, Fer11, PSE04]. Although the syntactic form of aggregates is usually presented

in a first-order language, its semantics is normally defined propositionally via ground-

ing. There are several major approaches: Ferraris’ semantics [Fer11], the FLP seman-

tics [FPL11] (later extended for arbitrary formulas by Truszczynski [Tru10]), and the SP

semantics [PSE04].

The Ferraris’ semantics and the FLP semantics (and its extension to arbitrary formulas

by Truszczynski) are extended into the first-order case [FLL11, BLM11]. Our work cap-

tures the first one, also called the stable model semantics, in first-order logic. Certainly, it

is interesting to consider whether the FLP semantics can be captured in first-order logic as

well. We leave this to our future work. Nevertheless, it is worth mentioning that if the ag-

gregate atoms only occurs in the positive bodies of rules andthe bodies of these aggregates

contain no negative atoms (this is actually the case in most benchmark programs), these

semantics coincide.

Bartholomew et al. [BLM11] studied the aggregate semantics infirst-order case via

translating into second-order logic. This work is slightlydifferent from ours. Syntactically,

the former considers aggregate atoms as arbitrary formula while we only consider a special

form, i.e., form (2.31). Semantically, the former combinesthe theory of first-order atoms

and aggregate atoms into a unified one, while the latter definesthem separately in the sense

that the theory of aggregates is regarded as a background theory. The main reason is for

simplicity. It can be shown that they essentially coincide when restricted into the specific

aggregate forms.

In this work, we only focused on aggregate frameworks that are based on “translation

like” semantics, i.e., either translated the corresponding logic program with aggregates into

classical formulas (as in [BLM11] and [AZZar]) or to an aggregate free program (as in

[DTEFK09] via the unfolding semantics). Another line of aggregate research worth men-

tioning are those ones based on fixpoint type characterizations. These line of work stems

from the extension of thewell-foundedsemantics of [GRS91] to logic programs with ag-

gregates. The core of these type of approaches [DPB01, PDB07, SP07] is to extend the

well-founded semantics to logic programs with aggregates by various extensions of the van

Emden-Kowalski provability operator. In fact, we would mention that these approaches are

Page 85: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 2. FIRST-ORDER ASP AND CLASSICAL FIRST-ORDER LOGIC 76

also applicable to arbitrary (i.e., includes non-monotone) aggregates. It will be very inter-

esting to also explore for future work about how such approaches also relates to classical

FO logic.

Page 86: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

Chapter 3

Implementation and Experimental

Results

3.1 Grounding ASP Programs

To the best of our knowledge, ordered completion provides for the first time a translation

from FO normal answer set programs under the stable model semantics to classical FO

logic. Significantly, this translation enables us to develop a new direction of ASP solvers

by grounding on a program’s ordered completion instead of the program itself.

In this section, we report on a first implementation of such a solver. In order to be

consistent with existing ASP solvers, we consider Herbrandstructures and not arbitrary

structures at this stage. This is because this first implementation does not yet consider

constant symbols (or0-ary functions) in the language, i.e. we currently only assume pred-

icate symbols in the vocabulary. We also point out that we do not yet consider any kind of

aggregate constructs in our language.

A grounding transforms an answer set program into an equivalent ground program

where the equivalence is defined as having the same set of answer sets. In Lparse [SN01],

the answer set programs are assumed to bedomain restricted. That is, all the variables

in its rules must occur in some positive domain predicate atom in the rule’s body. This

syntactical restriction guarantees that the interpretations of all predicates are confined by

the interpretations of the domain predicates (i.e., more specifically, confined by thenatural

joinsof the interpretations of domain predicates). Hence in thisway, the domain predicates

77

Page 87: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 78

are viewed as theguardsof the variables.

The input answer set programs of DLV [LPF+06] is a larger class of programs called

thesafeprograms, which generalizes the notion of domain restricted programs by only re-

stricting the variables of its rules to occur in a positive body atom of the rule (not necessarry

to be a domain predicate atoms). In addition, DLV has the ability to handle disjunctive pro-

grams. As a front end, DLV employs a routine called theintelligent grounder(or IG), which

uses techniques ofrule rewritingandjoins-projectionsreordering. In recent years, GrinGo

[GST07] has emerged as a very effective ASP grounding system. GrinGo’s grounding pro-

cedure is based on DLV’sback-jumpingalgorithm [LPS04], and to avoid redundant rules,

employsenhanced binder-splitting[GST07].

In this chapter, we provide a different manner of approach. Since we are grounding

under the framework of classical FO sentences, we can incorporateclassical reasoning

directly in our grounding technique. Hence, compared to current ASP grounders such as

DLV (as the front end), GrinGo, and Lparse that “reasons” about grounding only under

the semantics of the ASP framework, we can do more. For instance, in our technique, the

“domain” as constructed using the notion of domain predicates in Lparse can behave in

a dynamicway. Hence, the “domain” as constructed during our grounding procedure can

actually “shrink” as we progress through the grounding, which is in contrast with current

existing ASP grounders where the domain remainsstatic.

3.2 Domain Predicates and Guarded Variables

Recall the notion of thepositive predicate dependency graphG+Π = (Dom(G+Π ), EG+Π ) of a

programΠ as introduced in Section 2.3.1 where:

• Dom(G+Π ) = Pint(Π), i.e., the intensional predicates ofΠ;

• EG+Π = {(P,Q) | there is a ruler ∈ Π mentioningP in Head(r) andQ in Pos(r)}.

Then we say that a predicateP is adomain predicateunderΠ if eitherP is an extensional

predicate, orP is not involved in apredicate loopin the graphG+Π . By “predicate loop,”

we mean there exists a predicateQ ∈ Pint(Π) (can also beP ) such that(P,Q), (Q,P ) ∈

TC(EG+Π ), where TC(EG

+Π ) denotes the transitive closure of the edge relationsEG

+Π of the

Page 88: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 79

graphG+Π . Hence by default, allextensionalpredicates are domain predicates. ByPdom(Π),

we denote all the domain predicates ofΠ.

Given a ruler with x the unique tuple of free variables, we call a variablex of x guarded

if x appears in a positive body atom that is also of a domain predicate. A rule isguarded

if all variables in it are guarded. So naturally, a program isguarded if all the rules in it are

guarded.

Example 13 Consider the well known programΠ1 that computes the transitive closure of

a graph with extensional predicateE and intensionalT :

r1 : T (x, y)← E(x, y)

r2 : T (x, y)← E(x, z), T (z, y). (3.1)

Then all the variables inr1 are guarded whiler2 contains the single non-guarded variable

y. Therefore,Π1 is not guarded.

All rules can be converted into a guarded rule without changing its meaning by adding

the equality atomx = x for every non-guarded variablex to the rule’s positive body.

Example 14 ProgramΠ1 can be converted into an equivalent guarded programΠ2 by

addingy = y into r′2s positive body:

r1 : T (x, y)← E(x, y)

r2 : T (x, y)← E(x, z), T (z, y), y = y. (3.2)

3.3 Ordered Completion vs Clark’s Completion

Let us consider again the Clark’s completion of a predicateP under some programΠ as

given by

∀x(P (x)↔∨

r∈Π,Head(r)=P (x)

∃yrΦBODYr (x,yr)),

Page 89: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 80

where for our purpose in this chapter,ΦBODYr (x,yr) will now denote the formula originally

represented byBody(r) (see Section 2.2).

Note that as mentioned in Section 2.3.3,P ’s completion can be equivalently written as

r∈Π,Head(r)=P (x)

∀yrx(ΦBODYr (x,yr)→ P (x)) (3.3)

∧ ∀x(P (x)→∨

r∈Π,Head(r)=P (x)

∃yrΦBODYr (x,yr)). (3.4)

In the ordered completion (see Definition 6), we simply replaced (3.4) by

∀x(P (x)→∨

r∈Π,Head(r)=P (x)

∃yr(ΦBODYr (x,yr) ∧ ΦOC

r (x,yr))), (3.5)

where for our purpose now in this chapter,ΦOCr (x,yr) will denote the formula originally

represented byPo s(r) < P (x) (see Definition 6).

Clearly, it can be seen that the “necessary” condition for a ground instance ofP in (3.5)

is stronger than that in (3.4) due to the extra assertions enforced by the comparison atoms

(i.e., viaΦOCr (x,yr)). Now for a predicateP , denote the sentence

r∈Π,Head(r)=P (x)

∀xyr(ΦBODYr (x,xr)→ P (x)) (3.6)

∧ ∀x(P (x)→∨

r∈Π,Head(r)=P (x)

∃yr(ΦBODYr (x,yr) ∧ ΦOC

r (x,yr))) (3.7)

by ΦOCP . Then we callΦOC

P as thepredicate ordered completionof P . Additionally for

convenience, for a ruler and predicateP , we also denote the formulas

(ΦBODYr (x,yr)→ P (x)) (3.8)

Page 90: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 81

and

(P (x)→∨

r∈Π,Head(r)=P (x)

∃yr(ΦBODYr (x,yr) ∧ ΦOC

r (x,yr))) (3.9)

by ΦCLOr (x,yr) (where “CLO” for closure) andΦSUP

P (x) (where “SUP” for support) respec-

tively, so that the predicate ordered completion ofP can now be represented by the follow-

ing formula:

ΦOCP = (

r∈Π,Head(r)=P (x)

∀xyrΦCLOr (x,yr)) ∧ ∀xΦ

SUPP (x). (3.10)

Also for convenience, we sometimes denote the formulaΦBODYr (x,yr)∧Φ

OCr (x,yr) simply

byΦBODYOCr (x,yr).

3.4 Grounding Ordered Completion

Structure in the traditional sense defines an interpretation as those extents of a predicate

which we regard astrue. Hence, those ones regarded asfalseare definedimplicitely as

those not in the interpretation. In this section, we introduce the notion of apartial structure,

which also contains the notion of a “not-known.” Thus, with this notion in mind, we now

define both true and falseexplicitely.

Definition 14 A partial-structureP of vocabularyτ is a tupleP = (Dom(P), cP1 , · · · , cPm,

PP1 , · · · , PPn ) with constantscPi ∈ Dom(P) (1 ≤ i ≤ m) as usual, but where for eachPj

(1 ≤ j ≤ n), we havePPj = {(Pj · T )P , (Pj · F )

P , (Pj ·D)P} such that:

1. (Pj · T )P , (Pj · F )

P , and(Pj ·D)P are subsets ofDom(P)k with k the arity ofPj;

2. (Pj · T )P ∩ (Pj · F )

P = (Pj ·D)P ∩ (Pj · F )P = ∅.

Intuitively speaking, for a predicateP , (P · T )P captures the extents of those regarded

as true while(P · F )P the ones as false. Additionally,(P · D)P (here, ‘D’ stands for

domain) captures the notion of those extents that are eithertrue or not knownbut notfalse

(so hence, it can be that that(P ·T )P ∩ (P ·D)P 6= ∅). Thus,(P ·D)P can be thought of as

Page 91: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 82

a “weaker” form of(P · T )P . This will play a prominent role in our grounding procedure.

For convenience, we refer to(P · T )P , (P · F )P , and(P ·D)P simply asPP · T , PP · F ,

andPP ·D respectively.1

In the spirit of Lparse on constructing “domains” using domain predicates, for an inten-

sional domain predicateP and input structureI, our use of the “weaker” form ofP I ·D of

P I · T is to hold the current domain relations as constructed usingthe domain predicates.

On the other hand, the relations as contained inP I · T andP I · F represents the instances

of P that are already known to betrueandfalse, respectively, in order to keep OC(Π) from

beinginconsistent(or unsatisfiable).

3.4.1 Constructing Domains Using Partial Structures

We now propose a procedure for grounding the formulaΦCLOr (x,yr). First, unless otherwise

stated, we setI andE to be structures defined as the follows:

• I = (Dom(I), cI1 , · · · , cIr , I

I1 , · · · , I

Is ) is the input orknownstructure such thatcIi ∈

Dom(I) (1 ≤ i ≤ r) andIIj ⊆ Dom(I)|Ij | (1 ≤ j ≤ s) (i.e., this corresponds to the

extensionalstructure);

• E = (Dom(E), cE1 , · · · , cEr , E

E1 , · · · , E

Et ) is the expansional oroutput partial-structure

that covers both theintensionalandcomparisonpredicates, and such that:

1. cEi = cIi (1 ≤ i ≤ r) (i.e., interpretations of the constants are the same);

2. EEj · F , EEj ·D, andEEj · T (1 ≤ j ≤ t) are subsets ofDom(E)|Ej | (i.e.,EEj · F ,

EEj ·D, andEEj · T are tuples ofDom(E) and of length|Ej|).

Thus, generally speaking, we have thatI corresponds to the extensional structure of sig-

natureτext(Π) (hence we refer to this as the “input” structure), whileE corresponds to

the intensional structure plus the comparison predicates (hence we refer to these as the

“expansional” structure).

In the well known classical problem ofmodel expansion[PLTG07], a given structure

(in our case, the extensional or input structure) is expanded with new relations (this cor-

responds in our case to the expansional or output structure)such that the new relations

satisfies a given formula (the ordered completion in our case). It is important to note that

1This notation is borrowed from the way structure members arereferred to in C++.

Page 92: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 83

although our approach will be similar in principle to that ofgrounding for model expansion,

our approach can also incoporate several techniques that had proved effective in traditional

ASP systems.

For convenience, we say that a predicateP ∈ τ(Π) is of an input (or extensional)

predicate ifP ∈ τext(Π), otherwise we say that it is of anexpansionalpredicate (note that

this covers the cases whereP is either an intensional or comparison predicate).

Definition 15 Given a first-order formulaΦ(x) of signatureτ with free variablesx, and

input structureI of signatureτ ′ ⊆ τ , a domain forΦ(x) is a pair (x, T ) whereT ⊆

DOM(I)|x| (i.e., a set of tuples of arity|x|). In most context, we refer to the pair(x, T )

as a tableT with rows corresponding to the tuples inT , and whose fields (or attributes)

correspond to the vectorx. Sometimes, when it is clear from the context, we simply useT

to refer to theT in (x, T ).

For convenience, for a table T= (x, T ), we denote by|T| as the size ofT , i.e., |T| =

|T |.

Example 15 Let x be the tuple of variablesxyz andT be the corresponding (i.e.,3-ary)

set of relations{(a, b, c), (a, b, b), (b, b, a), (a, c, c), (a, a, b)}. Then T= (x, T ) represents

the following table:

x y z

a b c

a b b

b b a

a c c

a a b

and where|T| = |T | = 5. �

For the ruler of the formulaΦCLOr (x,yr), for each unguarded variablex of xyr, add

the corresponding atomx = x in its positive body to transformr into a guarded rule.

Now, assumingHead(r) = P (x), Algorithm 1 describes ourget domain procedure for

obtaining a domain forΦBODYr (x,yr). For this purpose, we assume thatΦBODY

r (x,yr) is of

the form

P1(x1) ∧ · · · ∧ Pm(xm) ∧ ¬Q1(y1) ∧ · · · ∧ ¬Qn(yn).

Page 93: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 84

Moreover, we can further assume without loss of generality thatP1(x1) is a domain predi-

cate (i.e., note that in caser is not guarded to start with via some variable, sayx, adding the

equality atomx = x in its positive body gives it (at least) a domain predicate inits positive

body). Note thatget domain also considers the formulaΦBODYOCr (x,yr) (i.e., similar to

ΦBODYr (x,yr) in that it can contain the comparison atoms).

Algorithm 1: GETDOMAIN

Data: The formulaΦBODYr (x,yr) orΦBODYOC

r (x,yr), the input structureI, and theexpansional partial-structureE .

Result: A table T with fieldsxyr

1 begin2 if P1 is of an input (extensional) predicatethen3 T ← [P I1 ]x1

4 else5 T ← [P E1 ·D]x1

6 for 2 ≤ i ≤ m do7 if Pi is a domain predicatethen8 if Pi is of an input predicatethen9 T ← T ⋊⋉ [P Ii ]xi

10 else11 T ← T ⋊⋉ [P Ei ·D]xi

12 else13 T ← T ⋊⋉c [P Ei · F ]xi

14 for 1 ≤ j ≤ n do15 if Qj is an input predicatethen16 T ← T ⋊⋉c [QIj ]yj

17 else18 T ← T ⋊⋉c [QEj · T ]yj

19 return T

First, in Lines 2 to 5, we set the table T such that ifP1 is an input (or expansional)

predicate, thenT is the table[P E1 ]x1(or [P I1 · D]x1

), where[P E1 ]x1(or [P I1 · D]x1

) is the

table corresponding to the interpretationP E1 (or P I1 · D) of P1 with fields (i.e., attributes)

x1. Then for each atomsPi(xi) for 2 ≤ i ≤ m (i.e., corresponds toPos(r)), we take the

natural joinof T with:

• [P Ei ]xiif Pi is of the input (or extensional) predicate, or

Page 94: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 85

• [P Ii ·D]xiif Pi is a both a domain and expansional predicate.

Additionally, if Pi is a non-domain and expansional predicate, then we take instead the

complementary join of T with[P Ii ·F ]xi. The table T is then set to the new resulting table.

On the other hand, for each atomsQj for 1 ≤ j ≤ n (i.e., corresponds toNeg(r)) we

take thecomplementary joinof T with: (1) [QEj ]xjif Qj is input; (2) [QIj · T ]xj

if Qj is

expansional. Finally, Line 19 returns the resulting table Twith fieldsxyr.

Example 16 Assume we haver as the rule

P (w, z)← I(w, x), E1(y, z), E2(y, z), notE3(w, z),

such thatxyr = wzxy,Head(r) = P (w, z), andΦBODYr (x,yr) the formula

I(w, x) ∧ E1(y, z) ∧ E2(y, z) ∧ ¬E3(w, z).

In Addition, we have that: (1)I is of the input structure; (2)E1 is a domain predicate

of the expansional partial-structure; (3) bothE2 andE3 are non-domain predicates of the

expansional partial-structure. Then we perform the following join operations:

[II ]wx ⋊⋉ [EE1 ·D]yz ⋊⋉c [EE2 · F ]yz ⋊⋉

c [EE3 · T ]wz,

such that the resulting table with fields(w, z, x, y) is the domain forΦBODYr (x,yr). Addi-

tionally, to obtain a domain forP (i.e.,P E ·D), we project under the fields(w, z)

πw,z( [II ]wx ⋊⋉ [EE1 ·D]yz ⋊⋉

c [EE2 · F ]yz ⋊⋉c [EE3 · T ]wz ),

and add the tuples corresponding to the resulting table toP E ·D.

Informally speaking, compared to current approaches to grounding ASP programs, we

also take into account the already “known” expansional relations (i.e., those ofP E · F and

P E · T , while most current grounders only considersP E ·D).

Page 95: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 86

3.4.2 Dynamic Domain Relations

Consider again the ruler in Example 16 and such that this time, assume thatEE1 ·D = EE2 ·F

(i.e., the “domain” forE1 is the same as thefalseofE2). Then[EE1 ·D]yz ⋊⋉c [EE2 ·F ]yz = ∅,

and thus,[II ]wx ⋊⋉ [EE1 ·D]yz ⋊⋉c [EE2 · F ]yz ⋊⋉

c [EE3 · T ]wz = ∅. Hence, this time, we have

P E ·D = ∅. This is our motivation for this section.

Proposition 9 Let T1, T2, and T3 be tables with fieldsx, y, and z respectively, where

y ⊆ x. Then|T1 ⋊⋉c T2 ⋊⋉ T3| ≤ |T1 ⋊⋉ T3|.

Proposition 10 LetT1, T2, andT3 be the tables again from Proposition 9. Then computing

T1 ⋊⋉c T2 ⋊⋉ T3 is done in timeO(|T1| · |T2|+ |T1 ⋊⋉

c T2| · |T3|), while computingT1 ⋊⋉ T3

is done inO(|T1| · |T3|).

Proposition 11 Let T1, T2, andT3 be the tables again from Proposition 9. Then|T1 ⋊⋉c

T2| ≤ |T1| · (1−|T2||T3|

) implies|T1| · |T2|+ |T1 ⋊⋉c T2| · |T3| ≤ |T1| · |T3|.

That is, if it is the case that the inequality

|T1 ⋊⋉c T2| ≤ |T1| · (1−

|T2|

|T3|)

holds, then computing T1 ⋊⋉c T2 ⋊⋉ T3 is more efficient than computing T1 ⋊⋉ T3. Hence,

if the ratio |T2||T3|

is small and|T1 ⋊⋉c T2| < |T1| (i.e., T1 is reduced from the complementary

join with T2), then it is highly probable that computing T1 ⋊⋉c T2 ⋊⋉ T3 is faster than

computing T1 ⋊⋉ T3. Note that in usual practice, the known expansional relations (i.e., that

takes the role of the table T2) is generally a lot smaller in size than the “domain” relations

(as played by T3).

Example 17 Assume we haveΦBODYOCr (x,yr) to be

I(w, x, y) ∧ E1(y)∧ ≤E1E2 (y, w, x) ∧ ¬ ≤E2E1 (w, x, y) ∧ E3(w, x, z),

such that: (1)I is of the input predicate; (2)E1 is a non-domain and expansional predi-

cate; (3)E3 is a domain and expansional predicate; (4)≤E1E2 and≤E2E1 are comparison

predicates. Then by the GETDOMAIN procedure, we perform the join operations

[II ]wxy ⋊⋉c [EE1 · F ]y ⋊⋉

c [≤EE1E2·F ]ywx ⋊⋉c [≤EE2E1

·T ]wxy ⋊⋉ [EE ·D]wxz.

Page 96: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 87

Recall that for a predicateP , we denoted byΦSUPP (x) as the following formula:

P (x)→∨

r∈Π,Head(r)=P (x)

∃yr(ΦBODYOCr (x,yr))

(i.e., the support for the instances ofP ). Then an instanceP (a) of P will be known to be

false (i.e.,a ∈ P E · F ), if

r∈Π,Head(r)=P (x)

∃yr(ΦBODYOCr (x,yr))[x/a]

is false. As already mentioned above (i.e., Section 3.3),ΦSUPP (x) is a much strongernec-

essarycondition than its Clark’s completion counter part, due to the extra assertions en-

forced by the comparison atoms (i.e., via the formulaΦOCr (x,yr)). Thus, to fully exploit

this “stronger” property, we assume that each comparison predicates≤PQ and≤QR of the

expansional partial-structure has the following properties:

1. ab ∈≤EPQ ·T andbc ∈≤EQR ·T impliesac ∈≤EPR ·T (i.e., thetransitive closure);

2. if eitherP 6= Q ora 6= b thenab ∈≤EPQ ·T impliesba ∈≤EQP ·F , otherwise,P = Q

anda = b impliesab /∈≤EPQ ·T andab ∈≤EPQ ·F (theasymmetric property).

For intuition, we can think of the comparison predicate relations as a dynamic set of re-

lations that updates itself, as required, when new known relations are added, in order to

satisfy the transitive and asymmetric properties (i.e., analogous to anoracle).

Proposition 12 Checking whether the comparison predicates of the expansional partial-

structure are transitively closed can be done in time

O(∑

P,Q,R∈Pint(Π)

|T EPQ · T | · |TEQR · T |).

Proof: For each tripleP,Q,R ∈ Pint(Π), we perform the join operation[T EPQ · T ]xy ⋊⋉

[T EQR·T ]yz wherex, y, andz are pairwise disjoint tuples of distinguished variables oflength

|P |, |Q|, and|R| respectively. We then define a new table TPR with fieldsx andz, obtained

Page 97: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 88

from the projectionπx,y( [T EPQ · T ]xy ⋊⋉ [T EQR · T ]yz ). Then ifT EPQ · T = T EPQ · T ∪ TPQ

for each pairsP,Q ∈ Pint(Π), the comparison relations are transitively closed.�

3.4.3 Grounding on a Domain Predicate Sequence

Definition 16 (Domain grounding sequence) LetΠ be a (first-order) answer set program

with intensional predicatesPint(Π). Then a stricttotal-orderS = (Pint(Π), <) onPint(Π)

is called adomain grounding sequence(or just grounding sequence) if for every pair of

predicatesP1, P2 ∈ Pint(Π) not in a predicate loop inG+Π , P1 < P2 implies thatP2 is not

reachable fromP1 in the graphG+Π .

Intuitively speaking, a domain grounding sequenceS = (Pint(Π), <S) is a strict-total

order onPint(Π) such that for each pair of predicatesP,Q ∈ Pint(Π) not involved in a

predicate loop inG+Π , if P <S Q thenQ is not reachable fromP in G+Π . Informally, this

makes sure thatQ is on a higher stratum thanP . Hence, ifP andQ are domain predicates

such thatQ depends onP , then fromP , we construct the domain forQ. That is, we use

the relations from the interpretationP E · D of P to obtain the “domain” forQ, which is

QE ·D (i.e., via the table join and projection operations).

Definition 17 Given a FO programΠ, assume thatPint(Π) = {P1, . . . , Pn}. Without loss

of generality, also assume thatS = (Pint(Π), <S) is a predicate grounding sequence of

Pint(Π) such thatP1 <S · · · <S Pn. We recursively define the groundingGr(OC(Π)) of

OC(Π) as follows:

1. Gr(OC(Π)) =∧

1≤i≤n Gr(ΦOCPi);

2. Gr(ΦOCPi) = (

∧r∈Π,

Head(r)=Pi(xi)Gr(ΦCLO

r (xi,yr))) ∧ Gr(ΦSUPPi

(xi));

3. Gr(ΦCLOr (x,yr)) =

∧aar∈T Φ

CLOr (xyr/aar)

(whereT is the table as obtained by theGETDOMAIN procedure onΦBODYr (x,yr));

Page 98: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 89

4. Gr(ΦSUPP (x)) =

∧a∈PI ·D(P (a)→

∨r∈Π,

Head(r)=P (x)Gr(ΦBODYOC

r (xyr/ayr)) );

5. Gr(ΦBODYOCr (xyr/ayr)) =

∨ar∈T Φ

BODYOCr (xyr/aar)

(whereT is the table obtained via a similar method to theGETDOMAIN procedure

onΦBODYOCr (xr)[x/a]),

and such that for eachΦCLOr (xiyr/aiar) = ΦBODY

r → Pi(ai), we addai to P Ei ·D, provided

it is not the case thatai /∈ PEi · F .

Let us now take a closer look at Definition 17. Basically, givena predicate ground-

ing sequenceS = (Pint(Π), <S) on Pint(Π) = {P1, . . . , Pn} such thatP1 <

S · · · <S

Pn, Gr(OC(Π)) (i.e., the grounding of the whole ordered completion) is defined as the

grounding ofΦOCP1, . . . ,ΦOC

Pnin the sequence1, . . . , n. As with the usual technique of the

use of domain predicates in traditional ASP grounders, thisgrounding sequence produces

the “domain tuples” associated with the intensional predicatesP1, . . . , Pn. For everyPi

(1 ≤ i ≤ n), this is fulfilled by the grounding of eachΦCLOr (x,yr) for rulesr ∈ Π such

thatHead(r) = Pi(xi). Indeed, as indicated in the last sentence of Definition 17, each

relationai corresponding to a grounded ruleΦCLOr (xiyr/aiar) = ΦBODY

r → Pi(ai), is added

to P Ei ·D (provided it is not known to be false), and where we useP Ei ·D in the the future

join operations, i.e., to get the “domain” relations for other predicates.

As mentioned in Section 3.4.2, the setP Ei · D of domain relations can also reduce in

size after the grounding of the correspondingΦSUPPi

(xi), i.e., see Item 2 of Definition 17.

This is because each domain relationai ∈ PEi ·D is verified in

Pi(ai)→∨

r∈Π,Head(r)=Pi(xi)

Gr(ΦBODYOCr (xiyr/aiyr))

if it can be justified by ∨

r∈Π,Head(r)=Pi(xi)

Gr(ΦBODYOCr (xiyr/aiyr)),

whereΦBODYOCr (xiyr/aiyr) is a stronger condition thanΦBODY

r (xiyr/aiyr). Thus, in this

sense, the “domain relations” can behave in a dynamic way, which can optimize future join

operations due to some tables possibly shrinking in size.

Page 99: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 90

3.4.4 Incorporating Classical Reasoning

For each application ofGr on a formulaΦ(x), we also do an application ofS onGr(Φ(x))

(i.e.,S(Gr(Φ(x)))) such that for a propositional formulaϕ, S(ϕ) is recursively defined as

follows:

1. if ϕ = P (a), then:

(a) if P = Ii (for 1 ≤ i ≤ s) is of an input (or extensional) predicate, then ifa ∈ IIi

(or a /∈ IIi ), S(ϕ) = ⊤ (or S(ϕ) = ⊥);2

(b) else, ifP = Ei (for 1 ≤ i ≤ t) is of an expansional predicate, then:3

i. if a ∈ EEi · T (or a ∈ EEi · F ), thenS(ϕ) = ⊤ (or S(ϕ) = ⊥),

ii. otherwise,S(ϕ) = P (a);

2. else, ifϕ = ¬(ψ), thenS(ϕ) = ¬S(ψ);

3. else, ifϕ = ψ∧ξ (orϕ = ψ∨ξ), thenS(ϕ) = S(ψ)∧S(ξ) (orS(ϕ) = S(ψ)∨S(ξ)),

and where⊤ ∧ ϕ ≡ ⊥ ∨ ϕ ≡ ϕ,⊥ ∧ ϕ ≡ ⊥, and⊤ ∨ ϕ ≡ ⊤ as usual.

In addition, ifS(ϕ) results in the conjunctive clausel1∧· · ·∧lk for ϕ = Gr(ΦCLOr (x,yr))

or ϕ = Gr(ΦSUPP (x)), thenS(ϕ) = ⊤ and such that for eachli (1 ≤ i ≤ k): if li = P (a),

thena is added toP E · T ; and if li = ¬P (a), thena is added toP E · F and deleted from

P E ·D. This will then dynamically effect future join operations involvingP E ·T ,P E ·F , and

P E ·D. For convenience, we denote this immediate application ofS with each application

of Gr asS ◦ Gr, where ‘◦’ denotes function composition.

It should be noted from the definition ofS thatS(ϕ) is a formula with literals only

corresponding to the instances of the expansional predicates (i.e., the input ones had been

turned into⊤ or ⊥). In a nutshell, the operatorS simply does the simplification of the

resulting propositional formula on the fly. Based on these simplifications, appart from

reducing the size of the resulting proposition theory, we are also able to know more true

and false “domain relations,” which can be useful in optimizing the future grounding of the

other formulas.2Recall thatI = (Dom(I), cI1 , · · · , c

Ir , I

I1 , · · · , I

Is ) denotes the input (also called the extensional) struc-

ture (see beginning of Section 3.4.1).3Recall thatE = (Dom(E), cE1 , · · · , c

Er , E

E1 , · · · , E

Et ) reprsents the expansional partial structure (see be-

ginning of Section 3.4.1).

Page 100: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 91

3.4.5 Iteration and Conversion to SMT

With Γ = (S◦Gr)(OC(Π)),4 S can be applied again toΓ to simplify it further, and possibly

collect more known expansional relations using classical reasoning. It can even be thatS

is iteratively applied toΓ until Γ cannot be simplified any further.

After (S ◦ Gr)(OC(Π)), we are now at liberty to treat instancesP (a) for which a /∈

P E · D as false. That is, instanceP (a) for which eithera ∈ P E · F or a /∈ P E · D is

now treated as⊥. This is becauseP E · D corresponds to the relations that appear in the

heads of instances of rules mentioningP . In fact, it will be necessary to make at least

one application ofS to consider if all the instances (i.e., propositional atoms) occurring in

the resulting propositional formula are mentioned inP E ·D. This corresponds to the well

known notion that an atomP (a) is in some answer set only if it is mentioned in some head

of a grounded rule of the program. It is important to note thatthis is only necessary for the

occurrences of the non-domain predicate instances since those of the domain predicates are

already assured to be in the “domain relations” as it was already enforced by the predicate

grounding sequence (see Section 3.4.3).

An obvious drawback of the grounded form of the ordered completion is the transi-

tive axioms of the comparison predicates (see Formula 2.12), since this introducesO(n3)

propositional clauses into the formula (withn the number of intensional ground atoms).

To get over this problem, we borrow some ideas from [Nie08]. Thus, instead of using a

SAT solver to find a model of the theory, we instead use an SMT (Satisfiability Modulo

Theories) [NOT99] solver. Through this way, instead of incorporating theO(n3) proposi-

tional clauses (of the transitive axioms) into the resulting propositional theory, we instead

use the “built in” predicate ‘≥’ of the SMT framework. We achieve this by converting each

comparison predicate instance≤PQ (a,b) into theinequality atom

xQ(b) − 1 ≥ xP (a),

wherexQ(b) andxP (a) are new variables ranging over the integers. Intuitively, the atom

xQ(b) − 1 ≥ xP (a) encodes the notion that there exist mappings from the variablesxP (a)

andxQ(b) to the integers for whichxP (a) is strictly less thanxQ(b).

Thus, assumingΓ = S((S ◦ Gr)(OC(Π))) (i.e., we apply at least one iteration ofS

4Recall that ‘◦’ denotes function composition.

Page 101: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 92

to (S ◦ Gr)(OC(Π))), then as already stated above, we can mapΓ into adifference logic

formula DIF(Γ) of the SMT framework.

Theorem 5 Given a FO programΠ, input structureI of signatureτext(Π), and(Pint(Π),

<S) a domain grounding sequence on its intensional predicates,letΓ = S((S◦Gr)(OC(Π)))

such thatGr(Π) is the grounding on the domain predicate sequence(Pint(Π), <S). Now,

let DIF(Γ) (i.e., its mapping to difference logic). Then there exists an expansionI ′ of I on

the signatureτext(Π) ∪ Pint(Π) = τ(Π) such thatI ′ is an answer set ofΠ iff DIF(Γ) is

satisfiable.

3.5 Experimental Results

TRANSLATOR GROUNDER SAT/SMTFO Program Ordered

Completion

Propositional

Theory

Answer Sets

FactsGround

Figure 3.1: The Groc ASP solver main architecture.

In the following, we report our first experiment with a prototype implementation. The

goal of our experiments is to compare our new type of ASP solver based on ordered com-

pletion, as depicted in Figure 3.1, with a number of existingASP solvers based on the

traditional approach.

The input is divided into two parts: a FO program as well as a set of ground facts (i.e.,

an extensional database). The output is to return an answer set of the program based on the

extensional database if there exists such one, and to return“no” otherwise.

In order to solve this problem, existing ASP solvers normally use a 2-step approach.

First, a grounder is used to transform the FO program togetherwith the extensional database

to a propositional program. Here, we considered Gringo (version 3.03) [GST07] as the

grounder. Second, a propositional ASP solver is called to compute an answer set. In this

section, we consider three different propositional ASP solvers, including Clasp (version

Page 102: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 93

2.0.1)5 [GKNS07], Cmodels (version 3.81)6 [Lie05], and Lp2diff (version 1.27)7 [JNS09]

with Z3 (version 3.2.18)8.

Differently, our solver needs 3 steps. First, we translate aFO program to its ordered

completion. As this step is normally very efficient and can beconsidered as off line, we do

not count the time used in this step. Second, we have implemented a grounder, called Groc

(version 1.0)9 [ALZZ12], to transform the ordered completion together with the extensional

database to a propositional SMT theory. Finally, we call an SMT solver to compute a model

of the SMT theory, which should be an answer set of the programbased on the extensional

database by Theorem 5. We use Z3 (version 3.2.18) as the SMT solver in this step.

We consider the Hamiltonian Circuit benchmark program, originally inspired by Niemela

[Nie99], given by the following:

hc(x, y)← arc(x, y), not otherroute(x, y)

otherroute(x, y)← arc(x, y), arc(x, z), hc(x, z), y 6= z

otherroute(x, y)← arc(x, y), arc(z, y), hc(z, y), x 6= z

reached(y)← arc(x, y), hc(x, y), reached(x), not init(x)

reached(y)← arc(x, y), hc(x, y), not init(x)

← vertex(x), not reached(x),

such thatarc, vertex, andinit are the extensional, andhc, otherroute, andreached are

the intensional predicates. The current benchmark graph instances for the HC program

normally contain no more than 150 nodes. Here, we instead consider much bigger graph

instances. That is, we consider random graphs with nodes ranging from 200 to 1000, in

which the numbers of edges are ten times the numbers of nodes.The graph instances

are named asrand nodesedgesnumber, whererand means this is a random graph,nodes

represents the number of nodes in this graph,edgesrepresents the number of edges in this

graph, andnumberis the code of this graph in this category. For instance,rand 200 20006

is a random graph with 200 nodes and 2000 edges, and is the 6-thgraph instance in this

5http://www.cs.uni-potsdam.de/clasp/6http://www.cs.utexas.edu/ tag/cmodels/7http://www.tcs.hut.fi/Software/lp2diff/8http://research.microsoft.com/en-us/um/redmond/projects/z3/9The system is found at http://staff.scm.uws.edu.au/∼yzhou/?pageid=174

Page 103: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 94

category.

Table 3.1 reports some runtime data of our experiments on theHC program with those

relatively big graph instances. The experiments were performed on a CENTOS version

2.16.0 LINUX platform with 2GB of memory and AMD Phenom 9950 Quad-Core pro-

cessor running at 2.6GHz. For space reasons, we only report the overall time used by the

following different approaches:

• Gringo as the Grounder and Clasp as the propositional ASP solver (gringo+clasp);

• Gringo as the grounder and Cmodels as the propositional ASP solver (gringo+cmodels);

• Gringo as the grounder, Lp2diff as the translator from propositional programs to

SMT and Z3 as the SMT solver (Gringo+Lp2diff+Z3);

• finally, our solver by using Groc to ground the ordered completion together with the

extensional databases, and then calling the SMT solver Z3 (groc+Z3).

We set the timeout threshold as 900 seconds, which is denotedby “—–” in our experimental

results.

In Table 3.1, the first column specifies the graph instances. In the second column, “y”

(“n”) means that the corresponding graph has a (no) Hamiltonian Circuit, while “?” means

that this problem instance is not solved by any approaches within limited time. The rest of

the four columns records the overall time in seconds used by the four different approaches.

It is worth mentioning that, normally, the grounding time (i.e., for Gringo and Groc) is

much less than the solving time.

Table 3.1 shows that our solver compares favorably to the others on the Hamiltonian

Circuit benchmark program, especially for those big graph instances. For 200 node ran-

dom graphs, our solver seems not as good as Gringo+Classp in general, but still looks

slightly better than the other two. However, when the graph becomes bigger, our advan-

tages emerge. For those 400 node and 600 node graphs, our solver clearly outperforms

the other approaches. Moreover, for 1000 node random graphs,our solver is the only one

capable of solving the problems within the time threshold. Also, it is interesting to take

a closer look at the only instance with no answer sets, i.e.,rand 200 20003. With our

grounder Groc, the inconsistency can be identified immediately.

Page 104: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 95

Table 3.1: Experimental Results

instances Gringo Gringo Gringo Groc+ Clasp + Cmodels + Lp2diff + Z3

+ Z3

rand200 20001 y 0.325 3.130 6.954 1.79rand200 20002 y 0.604 3.310 10.185 1.95rand200 20003 n 0.175 0.150 2.507 0.00rand200 20004 y 1.453 7.960 18.412 1.66rand200 20005 y 0.329 7.600 8.899 15.24rand400 40001 y —— —— 49.506 5.08rand400 40002 y 24.110 —— —— 59.31rand400 40003 ? —— —— —— ——rand400 40004 y —— —— 46.938 8.10rand400 40005 y —— —— 162.277 8.00rand600 60001 y 140.830 —— 114.973 12.16rand600 60002 y —— —— 203.500 38.41rand600 60003 y —— —— 340.219 45.84rand600 60004 y —— —— 83.650 52.13rand600 60005 y —— —— 403.075 9.20

rand1000100001 y —— —— —— 324.22rand1000100002 y —— —— —— 133.66rand1000100003 y —— —— —— 99.32rand1000100004 y —— —— —— 256.91rand1000100005 y —— —— —— 295.89

Page 105: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 3. IMPLEMENTATION AND EXPERIMENTAL RESULTS 96

More importantly, it is reasonable to believe that the performance of our solver can be

further improved by employing more optimization techniques because this is our first im-

plementation based on an entirely new method. Among them, one specific technique, both

theoretically challenging and practically promising, is the simplification of the FO formula

of ordered completion. As mentioned earlier, this step can be regarded as offline since it

only needs to be done once for each program. Evident from somesimple observations, the

simplifications can sometimes significantly reduce the sizeof ordered completion, thus the

grounded propositional SAT/SMT theory. To us, this is one ofthe most important work left

in the future.

3.6 Further Remarks

In this chapter, we have showed that through ordered completion, we have been able to inte-

grate ASP grounding techniques with those of first-order theories. Moreover, since ordered

completion is a first-order theory, we are able to reason about grounding in the classical

manner. Thus, we are now able to blur the distinction betweenthe actual grounding and

solving processes of ASP programming implementations. Among our key contributions is

the exploitation of thecomparison atomsto the full effect. This was achieved byexplicitly

considering the comparison atoms in the table join operations. Additionally, for maximum

affect, we assumed that the “known” relations of the comparison predicates always satisfy

the notions of transitivity and asymmetry. So in fact, our grounding procedure incorporates

a sort of “background theory” that allows us to simulate a kind of built in “<” predicate

as found in SMT solver systems. Furthermore, as already mentioned above, although the-

oretically challenging but practically promising, this work opens up the possibility for the

direct simplification of the FO formula of ordered completion, which may be a viewed as

a kind of offline reasoning.

Page 106: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

Chapter 4

Preferred FO Answer Set Programs

4.1 Lifting Preferred Answer Set Programming to First-

Order

Preferences play an important role in knowledge representation and reasoning. In the past

decade, a number of approaches for handling preferences have been developed in various

nonmonotonic reasoning formalisms, e.g., see a survey in [DSTW04], while adding pref-

erences into answer set programming has promising advantages from both implementation

and application viewpoints [DST03].

In recent years, as an important enhancement of traditionalanswer set programming

approaches, FO programs have been intensively studied by researchers, e.g., [ALZZ12,

FLL11, ZZ10]. FO answer set programming generalizes the traditional propositional an-

swer set programming paradigm in the following aspects: syntactically it allows arbitrary

FO formulas to be used to formalize the underlying problem scenario, while its seman-

tics is characterized by a SO sentence which has certain similarity to circumscription

[FLL11, LZ11].

An important research agenda in this direction is to redevelop important functionalities

and properties, that have been successful in propositionalanswer set programming, to the

new framework of FO answer set programming, e.g., [LM09]. Inthis work, we propose

a semantic framework for preferred FO programs in the case ofnormal logic programs,

and show how preference reasoning is properly captured under this new framework. In

particular, we make the following contributions towards the development of the preferred

97

Page 107: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 98

FO answer set programming:

- We propose a progression based preference semantics for FOprograms. This seman-

tics is a generalization of Zhang and Zhou’s progression semantics for FO normal

answer set programs [ZZ10], and which also extends Schaub and Wang’s preference

semantics for propositional answer set programming [SW03];

- We investigate essential semantic properties of preference reasoning under the pro-

posed preferred FO answer set programming. In order to provethese important prop-

erties, we specifically consider the grounding of preferredanswer set programs and

establish its connections to the first-order case.

- Finally, we address the expressiveness of preferred FO answer set programming in

relation to classical SO logic. In particular, we show that the proposed preferred

semantics can be precisely represented by a SO sentence on arbitrary structures. Fur-

thermore, by restricting on finite structures, the preferred semantics can be charac-

terized by an existential SO sentence. As a consequence of this result, we know that

on finite structures, a preferred FO normal program can always be represented by a

FO sentence under an extended vocabulary.

4.2 A Progression Based Semantics

As in the case of preferredpropositionalprograms, a preferred FO programP is a structure

(Π, <P) where<P is an asymmetric and transitive relation and such that this time,Π is a

FO program rather than a propositional one. Intuitively speaking, if (r1, r2) ∈<P (i.e., note

that we sometimes write this asr1 <P r2), we mean thatr1 is more preferred thanr2.

That is, when we evaluateΠ, we consider thatr1 has a higher priority thanr2 during the

evaluation. However, this intuition is quite vague, and we need to make this precise.

To develop a semantics for preferred FO programs, we first introduce some useful no-

tions. LetΠ be a FO program andr a rule inΠ. We denote byVar(r) andConst(r) to

be the set of all variables and constants occurring inr respectively. We also denote by

Term(r) as the setVar(r) ∪ Const(r). Consider aτ(Π)-structureM andr ∈ Π. We define

Page 108: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 99

an assignmentη inM with respect tor as a function:

η : Var(r) −→ Dom(M).

We may extendη from arbitrary terms occurring inr toDom(M) by mapping each constant

occurring inr to an elementcM in Dom(M). We also define the setΣ(Π)M as follows:

Σ(Π)M = {(r, η) | r ∈ Π andη : Term(r) −→ Dom(M)}.

Basically,Σ(Π)M contains all the rules ofΠ but together with the references to all the

possible associated assignments under the structureM. Such assignment references will

be essential to the development of the semantics for preferred programs.

Given a programΠ, letM be aτ(Π)-structure. We specifyM0(Π) to be a newτ(Π)-

structure obtained fromM as follows:

M0(Π) = (Dom(M), cM0

1 , · · · , cM0

r , PM0

1 , · · · , PM0

s , QM0

1 , · · · , QM0

n ),

wherecM0

i = cMi for each constantci of τ(Π) (1 ≤ i ≤ r), PM0

j = PMj for each exten-

sional predicatePj in τext(Π) (1 ≤ j ≤ s), andQM0

k = ∅ for each intensional predicateQk

in τint(Π) (1 ≤ k ≤ n). Furthermore, for someX ⊆ Σ(Π)M, we also defineλM0(X) to

be aτ(Π)-structure generated fromM0 andX in the following way:

λM0(X) =M0(Π) ∪ {Head(r)η | (r, η) ∈ X}.

We are now ready to present a progression based semantics forpreferred FO programs.

Definition 18 (Preferred evaluation stage)LetP = (Π, <P) be a preferred FO program

andM a τ(Π)-structure. Thet-th preferred evaluation stage ofP based onM, denoted as

Page 109: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 100

Γt(P)M, is a set of pairs(r, η) (i.e.,Γt(P)M ⊆ Σ(Π)M), defined inductively as follows:

Γ0(P)M ={(r, η) | (1) Pos(r)η ⊆M0(Π) andNeg(r)η ∩M = ∅;

(2) there do not exist a ruler′ ∈ Π and an assignmentη′ such that

r′ <P r, Pos(r′)η′ ⊆M andNeg(r′)η′ ∩M0(Π) = ∅};

Γt+1(P)M =Γt(P)M ∪ {(r, η) | (1) Pos(r)η ⊆ λM0(Γt(P)M) andNeg(r)η ∩M = ∅;

(2) there do not exist a ruler′ ∈ Π and an assignmentη′

such thatr′ <P r, (r′, η′) 6∈ Γt(P)M, and

Pos(r′)η′ ⊆M andNeg(r′)η′ ∩ λM0(Γt(P)M) = ∅}.

Let us now take a closer look at Definition 18. First,M0(Π) contains all extensional

relations as input, and any ruler with the highest priority, where its positive body is sat-

isfied inM0(Π) (i.e.,Pos(r)η ⊆ M0(Π)) and negative body is not satisfied inM (i.e.,

Neg(r)η ∩M0(Π) = ∅), will be generated along with the underlying assignmentη (i.e.,

as a tuple(r, η)). This forms the initial stageΓ0(P)M.

Next, we now consider the structureλM0(Γt(P)M) that is obtained from the structure

M0(Π) by expanding all the relations derived from the rules inΓt(P)M (with the asso-

ciated assignments). Then the structureλM0(Γt(P)M) will be used as a basis to evaluate

the preferred programP at the (t+1)-th stage. Condition (1) inΓt+1(P)M is quite straight-

forward: the positive body of the rule to be generated shouldbe satisfied by the structure

obtained from the previous evaluation stages, and the negative should not be satisfied in

M. Condition (2) inΓt+1(P)M, on the other hand, takes the preference into account. In

particular, based on Condition (1), we require that a rule to be generated should meet two

criteria: (a) no other rules with higher priorities havenot been generated earlier; and (b)

these rules’ positive bodies are already satisfied inM and their negative bodies are not

satisfied (not defeated) by the structureλM0(Γt(P)M) generated from the previous stages.

Generally speaking, this strategy insures that when we consider a rule for application, other

more preferredrules had already been settled in the sense that the more preferred rules had

already been derived or that they cannot possibly ever be derived since either their posi-

tive bodies are not satisfied byM or that they are already defeated by the structure of the

previous stage.

Page 110: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 101

Basically, Definition 18 may be viewed as the generalization of Zhang and Zhou’s pro-

gression semantics [ZZ10] for FO normal logic program by taking preference into account.

We should also emphasize its inside connection to Schaub andWang’s order preservation

semantics for propositional preferred logic programs [SW03]. In particular, the Condition

(2) in the specification ofΓt+1(P)M is a first-order generalization of Schaub and Wang’s

immediate consequence operator (i.e., operatorT(Π,<),YX in Definition 1 of [SW03]). Nev-

ertheless, Schaub and Wang’s order preservation semanticsmay not simply be extended

into our first-order case since during each evaluation stage, we must keep track of the as-

signments that were applied to all the rules in the progression evaluation. Without such as-

signment references, the rules generated from the evaluation stage will lose their preference

features because rules with different priorities may be instantiated to the same grounded

rule 1.

Definition 19 (progression based preferred semantics)LetP = (Π, <P) be a preferred

FO program andM a τ(Π)-structure. ThenM is called apreferred answer setof P iff

λM0(Γ∞(P)M) =M.

Example 18 Let us consider the following simple preferred programP1 = (Π1, <P1)

whereΠ1 is the following program:

r1 : Flies(x)← Bird(x), not Cannot fly(x)

r2 : Cannot fly(x)← Penguin(x), not Flies(x),

and where<P1= {(r2, r1)} (i.e.,r2 <P1 r1). Let us now consider a finite structureM were

Dom(M) = {cody, tweety};

BirdM = {cody, tweety};

PenguinM = {tweety};

FliesM = {cody};

Cannot flyM = {tweety}.

ThenBird andPenguin are the extensional andFlies andCannot fly are the intensional

1This bottleneck notion was mentioned in Section 1.2.5.

Page 111: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 102

predicates ofΠ1. According to Definition 18, we have:

Γ0(P1)M = {(r2, η) | η : x −→ tweety};

Γ2(P1)M = Γ1(P1)M = Γ0(P1)M ∪ {(r1, η′) | η′ : x −→ cody}.

Then from Definition 19, we have:

λM0(Γ2(P1)M) =M0 ∪ {Cannot fly(tweety), F lies(cody)} =M.

Thus, we have thatM is a preferred answer set ofP1.

Proposition 13 LetP = (Π, <P) be a preferred program. If<P= ∅, then a structureM

of τ(Π) is a preferred answer set ofP iffM is an answer set ofΠ.

Proof: By restricting the preference relation<P to be empty, the definition ofΓt(P)M is

simplified to the following form:

Γ0(P)M ={(r, η) | Pos(r)η ⊆M0(Π) andNeg(r)η ∩M = ∅};

Γt+1(P)M =Γt(Π)M ∪ {(r, η) | Pos(r) ⊆ λM0(Γt(Π)M) andNeg(r)η ∩M = ∅}.

It is easy to observe the correspondence betweenΓt(P)M andMt(Π) in Definition 1 from

[ZZ10]. Indeed, we can show that for eacht ≥ 0, λM0(Γt(P)M) =Mt+1(Π). Therefore,

λM0(Γ∞(P)M) = M∞(Π). Then from Theorem 1 of [ZZ10], we conclude thatM is a

preferred answer set ofP = (Π, ∅) iff M is an answer set ofΠ. �

Proposition 14 LetP = (Π, <P) be a preferred program. If a structureM of τ(Π) is a

preferred answer set ofP, thenM is also an answer set ofΠ.

Proof: See Appendix A.2.1.�

Page 112: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 103

4.3 Properties of Preferred Answer Sets

In this section, we study some essential properties of the preferred answer set semantics

proposed in last section. Firstly, from Proposition 14, we know that for any preferred

programP = (Π, <P), its preferred answer sets must also be answer sets ofΠ. Now we

take a closer look at the relationship between the existenceof an answer set ofΠ and of a

preferred one ofP.

Example 19 LetP2 = (Π2, <P2) be a preferred program such thatΠ2 is the program:

r1 : P (x)← Q(x)

r2 : Q(x)←,

and where<P2= {(r1, r2)}, i.e., r1 <P2 r2. Note thatΠ2 has no extensional predicate,

and any structureM on τ(Π2) wherePM = QM = Dom(M) is an answer set ofΠ2.

But P2 has no preferred answer set. To see this, we consider Definition 18. For any

M which is an answer set ofΠ2, we haveΓ0(P2)M = Γ1(P2)M = ∅. This follows that

λM0(Γ∞(P2)M) =M′ werePM′

= QM′

= ∅. By Definition 19,M cannot be a preferred

answer set ofP2.

Now we consider another preferred programP3 = (Π3, <P3) such thatΠ3 is the pro-

gram:

r1 : P (y)← P (x), Q(x)

r2 : P (x)← Q(x),

and wherer1 <P3 r2. Here,Q is the only extensional predicate ofΠ3. It is not difficult

to show that for any answer setM of Π3 werePM = QM 6= ∅,M cannot be a preferred

answer set ofP3. However,P3 has one preferred answer setM′ in whichPM′

= QM′

= ∅.

The preferred programP2 from Example 19 suggests that the existence of an answer

set for a programΠ does not necessarily imply the existence of a preferred answer set for a

corresponding preferred programP = (Π, <P). On the other hand, the preferred program

P3 seems to suggest that if the positive body for each rule of theprogram is not empty, then

a preferred answer set always exists. The following proposition shows that this is the case.

Page 113: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 104

Proposition 15 LetΠ be a program where for each ruler ∈ Π, Pos(r) 6= ∅. Then for any

preferred programP = (Π, <P) built uponΠ, P has a preferred answer set.

4.3.1 Grounding Preferred programs

It has been observed that the answer sets of FO programs can always be obtained via its

grounded correspondence [ALZZ12]. We would like to explorewhether this approach is

also suitable for preferred FO programs since a grounding based approach will not only

have advantages in computing preferred answer sets in practice, but also provide an effec-

tive means of studying the semantic properties of the corresponding preferred FO programs.

Nevertheless, unlike the case of FO answer set programs, a naive grounding method

does not work for preferred programs. Let us consider the following preferred program

P4 = (Π4, <P4) such thatΠ4 is the program:

r1 : P (x)← Q(x), Q(y)

r2 : P (z)← Q(z),

and wherer1 <P4 r2. If we simply groundΠ4 under a domain consisting of a singleton

{a}, the grounded program would only contain one instance{P (a) ← Q(a)}, while the

original preference relationr1 <P4 r2 collapses with this instance2. This problem may

be avoided by relating each rule ofΠ with a corresponding tag predicate, as shown in the

following.

LetP = (Π, <P) be a preferred FO program of vocabularyτ(Π). A preferred program

P ′ = (Π′, <P′

) is called thetagged preferred programof P, if:

1. for each ruleri ∈ Π of the form:

ri : α← β1, · · · , βl, not γ1, · · · , not γm,

Π′ contains itstagged ruleof the form:

ri : α← β1, · · · , βl, not γ1, · · · , not γm, Tagi(x)

2Note that this was also addressed in Section 1.2.5.

Page 114: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 105

wherex is the tuple of all variables occurring inri andTagi is a new extensional

predicate not inτ(Π);

2. Π′ does not contain any other rules;

3. for any two rulesr′i andr′j in Π′, r′i <P ′

r′j iff ri <P rj, and where<P is as specified

in P.

Now letP = (Π, <P) be a preferred program of the vocabularyτ(Π) andP ′ = (Π′, <P′

) be the tagged preferred program ofP of the vocabularyτ(Π′) = τ(Π)∪{Tag1, · · · , Tagk}3.

Given a structureM of τ , we construct an expansionM′ ofM to τ(Π′) as follows:

1. Dom(M′) = Dom(M);

2. For each predicateP and constantc in τ , PM′

= PM andcM′

= cM;

3. For eachn-aryTagi in τ(Π′) (1 ≤ i ≤ k), TagM′

i = Dom(M′)n.

Let r′ ∈ Π′ andη an assignment on structureM′ of τ(Π′). We denote byr′η the ground

instance ofr′ based onη. We are now ready to define the grounding of a preferred answer

set program.

Definition 20 Let P = (Π, <P) be a preferred program,M a structure ofτ(Π), P ′ =

(Π′, <P′

) the tagged preferred program ofP, andM′ the expansion ofM to τ(Π′) as

described above. We say that a structureP∗ = (Ground(Π)M, <P∗

) is the grounded

preferred programofP based onM, if:

1. Ground(Π)M = {r∗ | r∗ : Head(r)η ← Body(r)η, Tag(x)η, wherer ∈ Π and

η is an assignment onM′} ∪

{P (a)← | P ∈ Pext(Π) andP (a) ∈ PM} ∪

{Tagi(a)← | Tagi(a) ∈ TagM′

i (1 ≤ i ≤ k)} ∪

{a = a←| a is an element ofDom(M′)}4;

2. <P∗

= {(r∗i , r∗j ) | r

∗i , r∗j ∈ Ground(Π)M for somer′k, r

′l ∈ Π′ such that there exist

an assignmentη onM′ satisfyingr∗i = r′kη, r∗j = r′lη

andr′k <P ′

r′l}.

3We assume thatΠ contains rulesr1, · · · , rk.4Here we viewa = a as a propositional atom.

Page 115: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 106

Example 20 We consider the preferred programP1 = (Π1, <P1) from Example 18 again.

Under the structureM given in Example 18, the grounded preferred programP∗1 (Ground(Π1)M,

<P∗1 ) of P1 is as follows:

r∗1 : Flies(cody)← Bird(cody), not Cannot fly(cody), Tag1(cody)

r∗2 : Flies(tweety)← Bird(tweety), notCannot fly(tweety), Tag1(tweety)

r∗3 : Cannot fly(cody)← Penguin(cody), not Flies(cody), Tag2(cody)

r∗4 : Cannot fly(tweety)← Penguin(tweety), notFlies(tweety), Tag2(tweety)

r∗5 : Bird(cody)←

r∗6 : Bird(tweety)←

r∗7 : Penguin(tweety)←

r∗8 : Tag1(cody)←

r∗9 : Tag1(tweety)←

r∗10 : Tag2(cody)←

r∗11 : Tag2(tweety)←

r∗12 : cody = cody ←

r∗13 : tweety = tweety ←

r∗3 <P∗1 r∗1

r∗3 <P∗1 r∗2

r∗4 <P∗1 r∗1

r∗4 <P∗1 r∗2.

Now let us consider the preferred programP3 = (Π3, <P3) in Example 19 under

the finite structureM = ({a}, {P (a)}, {Q(a)}). It is clear thatM is an answer set

of Π3. By Definition 20, it is easy to see that the grounded preferredprogramP∗3 =

(Ground(Π3)M, <P∗3 ) of P3 consists of the following rules and preferences:

r∗1 : P (a)← Q(a), Tag1(a)

r∗2 : P (a)← Q(a), Tag2(a)

r∗3 : Q(a)←

r∗4 : Tag1(a)←

r∗5 : Tag2(a)←

r∗6 : a = a←

r∗1 <P∗3 r∗2.

Page 116: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 107

It is noted that with the tag predicate introduced, the preferences from the original preferred

programP3 is preserved in its grounded preferred programP∗3 .

Basically, a grounded preferred program is a program in propositional form and may

contain infinite number of rules and preference relations ifan infinite domain is consid-

ered. We will define the semantics for such grounded preferred programs and show that it

coincides with the progression based semantics of preferred FO programs.

Definition 21 (preferred answer sets of grounded programs)LetP = (Π, <P) be a grounded

preferred program as obtained from Definition 20 andS a set of propositional atoms. The

t-th preferred evaluation stageof P based onS, denoted as∆t(P)S, is a set of rules from

Π, i.e.,∆t(P)S ⊆ Π, defined inductively as follows:

∆0(P)S ={r | (1) Pos(r) = ∅ andNeg(r) ∩ S = ∅;

(2) there does not exist a ruler′ ∈ Π such thatr′ <P r,

Pos(r′) ⊆ S andNeg(r′) ∩Head(r) = ∅};

∆t+1(P)S =∆t(P)S ∪ {r | (1) Pos(r) ⊆ Head(∆t(P)S) andNeg(r) ∩ S = ∅;

(2) there does not exist a ruler′ ∈ Π such that

r′ <P r, r′ 6∈ ∆t(P)S, andPos(r′) ⊆ S

andNeg(r′) ∩Head(∆t(P)S) = ∅}.

ThenS is called apreferred answer setofP iff Head(∆∞(P)S) = S.

Example 21 Example 20 continued. It is easy to see that under Definition 21, the grounded

preferred programP∗1 of P1 = (Π1, <P1) has the unique preferred answer set:

{Bird(cody), Bird(tweety), P enguin(tweety), F lies(cody), Cannot fly(tweety),

Tag1(cody), Tag2(cody), Tag1(tweety), Tag2(tweety),

cody = cody, tweety = tweety}.

On the other hand, the grounded preferred programP∗3 of P3 = (Π1, <P3) has the

unique preferred answer set{P (a), Q(a), Tag1(a), Tag2(a), a = a}.

Page 117: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 108

The following result shows that the preferred answer sets ofeach FO preferred answer

set program can be precisely computed through its grounded counterpart.

Theorem 6 Let P = (Π, <P) be a preferred FO program,M a structure ofτ(Π), and

P∗ = (Ground (Π)M, <P∗

) the grounded preferred answer set program of(Π, <) based

onM as defined in Definition 20. ThenM is a preferred answer set ofP iff there is a

preferred answer setS ofP∗ such thatS ∩M =M.

Proof: See Appendix A.2.2�

4.3.2 Semantic Properties

In this subsection, we study several specific properties of the preferred answer set seman-

tics. As we will see, the grounded preferred answer set semantics provides a basis for

our investigation. We first define the notion of generating rules. LetP = (Π, <P) be

a grounded preferred program andS a set of propositional atoms. We say that a rule

r ∈ Π is a generating ruleof S if Pos(r) ⊆ S andNeg(r) ∩ S = ∅. Now consider

P = (Π, <P) to be a preferred FO program (i.e.,Π is a FO program) andM a structure of

τ(Π). Then we say that a ruler ∈ Π is agenerating ruleofM under the assignmentη if

M |= P os(r)η∧¬Neg(r)η, whereP os(r) and¬Neg(r) denote the formulasβ1∧· · ·∧βl

and¬γ1 ∧ · · · ∧ ¬γm respectively.

Lemma 3 LetP = (Π, <P) be a grounded preferred program andS an answer set ofΠ.

Then the following two statements are equivalent:

1. S is a preferred answer set ofP;

2. For each ruler ∈ Π, r ∈ ∆∞(P)S iff r is a generating rule ofS.

Proof: See Appendix A.2.3�

Now we have the following semantic characterization theorem for preferred FO pro-

grams.

Page 118: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 109

Theorem 7 LetP = (Π, <P) be a preferred FO program and aτ(Π)-structureM be an

answer set ofΠ. Then the following two statements are equivalent:

1. M is a preferred answer set ofP;

2. For each ruler ∈ Π, (r, η) ∈ Γ∞(P)M iff r is a generating rule ofM underη .

Proof: For the givenP = (Π, <P) and its preferred answer setM,P ’s grounded preferred

program is denoted asP∗ = (Ground(Π)M, <P∗

) as defined in Definition 20. From the

proof of Theorem 6, we can then construct a set of propositional atomsS fromM such

thatS is an answer set ofP∗ andS = S ∩M. Then based on Lemma 3, in order to prove

this theorem, it is sufficient to prove the following two results:

Result 1:(r, η) ∈ Γ∞(P)M iff r∗ ∈ ∆∞(P∗)S, were

r∗ : Head(r)η ← Body(r)η, Tag(x)η,

Result 2:r is a generating rule ofM underη iff r∗ is a generating rule ofS.

From the definitions ofΓ∞(P)M, ∆∞(P∗)S and such thatP∗ = (Ground(Π)M, <P∗

),

and together with Theorem 6, Results 1 and 2 are easily proved.�

Proposition 16 For preferred FO programsP1 = (Π, <P1) andP2 = (Π, <P2) where

<P1⊆<P2, and a structureM of τ(Π), if M is a preferred answer set ofP2, thenM is

also a preferred answer set ofP1.

Now we consider the existence of preferred answer sets of a preferred program. From

Theorem 7, in order to see whether a structureM is a preferred answer set of a given

preferred programP, we need to computeΓ∞(P)M and then to check all generating rules

againstM. It is always desirable to discovery some stronger sufficient conditions for the

existence of preferred answer sets for which there is no needto undertake the computation

of Γ∞(P)M. The following lemma and theorem are towards this purpose.

Lemma 4 A grounded preferred programP = (Π, <P) has a preferred answer set if there

exist an answer setS of Π such that for each(r1, r2) ∈<P wereHead(r2) ∩ (Pos(r1) ∪

Neg(r1)) 6= ∅, r2 is not a generating rule ofS.

Page 119: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 110

Proof: See Appendix A.2.4.�

Theorem 8 A preferred FO programP = (Π, <P) has a preferred answer set if there exist

an answer setM of Π such that for each(r1, r2) ∈<P and for all assignmentsη, η′ ofM

satisfyingHead(r2)η′∩(Pos(r1)∪Neg(r1))η 6= ∅, r2 is not a generating rule ofM under

η′.

Proof: We prove the result by showing that the givenM is a preferred answer set ofP.

For the given preferred FO programP = (Π, <P) and an answer setM of Π, we con-

sider the grounded preferred programP∗ = (Ground(Π)M, <P∗

). From Theorem 6, we

know that there is a preferred answer setS of P∗ whereS ∩M =M. We can also show

that for each pair of rulesr1, r2 ∈ Π wherer1 <P r2 and assignmentsη, η′ of M such

thatHead(r2)η′ ∩ (Pos(r1) ∪ Neg(r1))η 6= ∅, there exist a corresponding pair of rules

r∗1, r∗2 ∈ Ground(Π) such thatr∗1 <

P∗

r∗2 andHead(r∗2) ∩ (Pos(r∗1) ∪Neg(r∗1)) 6= ∅, and

vice versa. We can further prove that a ruler ∈ Π is not a generating rule ofM underη iff

there is a corresponding ruler∗ in Ground(Π) which is not a generating rule ofS. Then

from Lemma 4, it follows thatS is a preferred answer set ofP∗ = (Ground(Π), <P∗

).

Finally, from Theorem 6,M is also a preferred answer set ofP = (Π, <P). �

It is clear that the sufficient condition represented in Theorem 8 is semantics based in the

sense that an answer set (answer sets) ofΠ has (have) to be computed and verified to decide

the existence of a preferred answer set. Nevertheless, fromTheorem 8, we can actually

derive a purely syntactic sufficient condition which can be quite effective in deciding the

existence of preferred answer sets. To make our claim precise, we first introduce a useful

notion.

A substitutionθ is a tuple of term replacements(t1/t′1, · · · , tk/t′k). By applying a sub-

stitutionθ on a set of first-order formulasX, we obtain another set of formulas, denoted as

Xθ, by replacing each termt occurring in formulas ofX with t′ whenevert/t′ ∈ θ.

Definition 22 Let P (t) be an atom,X a finite set of atoms,T1 andT2 two finite sets of

formulas of the formst1 = t2 and t1 6= t2 wheret is a tuple of terms,t1 and t2 are terms.

We callT1 andT2 the sets ofterm binding constraintsimposing onP (t) andX respectively.

The pair(P (t), X) is calledunifiableunderT1 andT2 if there exist a substitutionθ such

thatP (t) ∈ Xθ and(X ∪ T2)θ ∪ T1 is consistent.

Page 120: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 111

Example 22 Let us consider an atomP (x, y). SetX = {P (x′, y′), Q(y′, z′)}, and their

term constraint setsT1 = {x = y} andT2 = {x′ 6= z′, y′ = c} respectively. It is easy

to see thatP (x, y) andX are unifiable underT1 andT2 because we can find a substitu-

tion θ = (x′/x, y′/y), such that(X ∪ T2)θ = {P (x, y), Q(y, z′), x 6= z′, y = c}, and

{P (x, y), Q(y, z′), x 6= z′, y = c} ∪ {x = y} is consistent.

For a given FO programΠ and a ruler ∈ Π, we specifyr’s set of term binding con-

straints as follows:

T (r) = {t1 = t2 | t1 = t2 ∈ Pos(r)} ∪ {t1 6= t2 | t1 = t2 ∈ Neg(r)}.

We also usePos(r)−e andNeg(r)−e to denote the sets of all atoms ofPos(r) andNeg(r)

except the equality atoms respectively.

Theorem 9 LetP = (Π, <P) be a preferred FO program. ThenP has a preferred answer

set ifΠ has an answer set and where for eachr1 <P r2, neither(Head(r2), Pos(r1)−e)

nor (Head(r2), Neg(r1)−e) are unifiable underT (r2) andT (r1).

Proof: From Definition 22, we see that for any two rulesr, r′ ∈ Π, if neither(Head(r2),

Pos(r1)−e) nor (Head(r2), Neg(r1)−e) are unifiable underT (r2) andT (r1), then for any

answer setM ofΠ and any two assignmentsη andη′,Head(r2)η′∩(Pos(r1)∪Neg(r1))η =

∅. This implies that the condition of Theorem 8 holds. So undersuch situation, each answer

setM of Π is actually a preferred answer set ofP = (Π, <P). �

4.4 Logical Characterizations

Since the answer set semantics for FO programs is defined via aSO sentence, it is a natural

question to ask whether it is also possible to characterize the progression based semantics

for preferred FO programs through a SO sentence. In this section, we will study this issue

in detail. Our basic idea is that: we first propose an alternative SO sentence that precisely

captures the answer set semantics of FO programs. Our formalization will be different

from that of the original one as presented in [FLL11] for the case when restricted to normal

logic programs. Instead, our SO formalism will be developedbased on the intuition of the

Page 121: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 112

progression based semantics [ZZ10]. Then we extend such SO formalism by taking the

preference into account.

To begin with, we first introduce some useful notions. We suppose that from here on,

each programΠ is presented in aconstant normalized form. That is, we assume that each

proper atom occurring in a rule only contains a tuple of distinguishable variables. Note that

every program can be rewritten into such a normalized form. For instance, if

P (x1, · · · , xi−1, c, xi+1, · · · , xn) (4.1)

occurs in some ruler werec is a constant, then we simply replace (4.1) by

P (x1, · · · , xi−1, xi, xi+1, · · · , xn)

and then addxi = c into r’s positive body. In this way, we can simply writexP andxr as

the tuples of all distinguishable variables occurring in predicateP and ruler respectively.

Now consider a program consisting of the single rule

r : S(x, y)← E(a, y), x = a.

Then this program can be equivalently rewritten to a normalized form

r : S(x, y)← E(z, y), x = a, z = a,

wherexr = xyz. Now letx = x1 · · · xn andy = y1 · · · yn, then we also writex = y to

denote the formula∧

1≤i≤n xi = yi.

For easier presentation and readability of formulas, we further assume that for any two

rulesr1 andr2 wherer1 6= r2 (that is, distinct rules),xr1 andxr2 are disjoint from each

other. That is, the names of the variables inr1 do not occur inr2 (and vice versa). Note

that in cases where we have to refer to the tuplesxr1 andxr2 in a formula for which they

have to be disjoint, we can always relabel the variables inxr2 without explicitly stating it,

if clear from the context.

4.4.1 Formulas Representing Generating Rules and Program Com-

pletion

Similar to what we introduced in section 4.2, here we presenta FO formula to represent

the notion ofgenerating rulesin terms of a structure. In particular, given a programΠ and

Page 122: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 113

a ruler ∈ Π of the form (1.4):α ← β1, · · · , βl, not γ1, · · · , not γm, we specify a FO

formula

ϕGENr (xr) = P os(r) ∧ ¬Neg(r). (4.2)

Clearly, for a givenτ(Π)-structureM,M |= ϕGENr (xη) iff Pos(r)η ⊆M andNeg(r)η∩

M = ∅.

Example 23 Consider the programΠ5 consisting of the following rules:

r1 : S(x1, y1)← E(z1, y1), x1 = a, z1 = a

r2 : S(x2, z2)← S(x2, y2), E(y2, z′2), z2 = a, z′2 = b.

Then we have:

ϕGENr1

(x1, y1, z1) = E(z1, y1) ∧ x1 = a ∧ z1 = a

ϕGENr2

(x2, y2, z2, z′2) = S(x2, y2) ∧ E(y2, z

′2) ∧ z2 = a ∧ z′2 = b.

Now letΠ be a FO program. Then we define the FO sentenceϕCOMPΠ to be the completion

of Π,

ϕCOMPΠ =

P∈Pint(Π)

∀xP(P (xP) ↔∨

r∈Π,Head(r)=P (yP)

∃xr(ϕGENr (xr) ∧ xP = yP)), (4.3)

where we assume thatxP is a tuple of distinguishable variables disjoint fromyP.

4.4.2 Well-Orderings on Generating Rules in Terms of Structures

Given a FO programΠ and aτ(Π)-structureM, letΓ(Π)M5 denote the set:

{(r, η) | r ∈ Π, Pos(r)η ⊆M andNeg(r)η ∩M = ∅},

5Note thatΓ(Π)M differs from Γt(P)M in that Γ(Π)M does not represent a progression stage of apreferred programP.

Page 123: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 114

i.e., those generating rules under the structureM. Then awell-orderonΓ(Π)M is a struc-

tureW = (Γ(Π)M, <W) with domainΓ(Π)M and binary relations<W on Γ(Π)M that

satisfies the following properties:

1. x, y ∈ Γ(Π)M andx 6= y impliesx <W y or y <W x (totality);

2. x <W y andy <W z impliesx <W z (transitivity);

3. x <W y impliesy 6<W x (asymmetry);

4. and lastly, the SO axiom:

(∀S ⊆ Γ(Π)M)(S 6= ∅ → (∃x ∈ S)((∀y ∈ S)(x 6= y → x <W y))),

which expresses that every non-empty subsetS of Γ(Π)M has a least element.

Note that whenΓ(Π)M is finite, anystrict-total orderof Γ(Π)M is trivially a well-order,

while this is not the case whenΓ(Π)M is infinite. In fact, sincetotality, transitivity and

asymmetrymakes up a strict-total order, then when only considering finite structures, we

can drop the SO axiom corresponding to the least element property of each non-empty

subset.

4.4.3 Formalizing Progression

We now propose a SO sentence that will simulate the progression semantics we defined

earlier but without first taking the preferences on rules into account.

Definition 23 Given a FO programΠ, we define a SO formulaϕPROΠ (−→<,S) as follows (here

Page 124: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 115

“ PRO” stands forprogression)6:

r1,r2,r3∈Π

∀xr1xr2xr3(<r1r2(xr1 ,xr2) ∧ <r2r3(xr2 ,xr3)→ <r1r3(xr1 ,xr3)) (4.4)

∧∧

r1,r2∈Π

∀xr1xr2(<r1r2(xr1 ,xr2)→ ¬<r2r1(xr2 ,xr1)) (4.5)

∧∧

r1,r2∈Π

∀xr1xr2(<r1r2(xr1 ,xr2)→ ϕGENr1

(xr1) ∧ ϕGENr2

(xr2)) (4.6)

∧∧

r∈Π

∀xr(ϕGENr (xr)→ ϕSUP

r (−→<,xr)) (4.7)

∧ ϕWELLORΠ (

−→<,S), (4.8)

where:

• for eachr1, r2 ∈ Π, the symbol<r1r2 is a predicate variable of arity|xr1 |+ |xr2 |;7

•−→< denotes the tuple of distinguishable predicate variables of the set{<r1r2 | r1, r2 ∈

Π};

• ϕSUPr (−→<,xr) denotes the following formula (here “SUP” stands forsupport):

P (xP)∈Pos(r),P∈Pint(Π)

r′∈Π,Head(r′)=P (yP)

∃xr′(<r′r(xr′ ,xr) ∧ xP = yP) (4.9)

(where in the case thatr′ = r, we simply assume a relabeling ofxr′ such thatxr′ will

be disjoint fromxr);

6In the following Formulas (4.4), (4.5) and (4.6), in the casethatr1 = r2, r1 = r3, or r2 = r3, we assumea relabling ofxr1

, xr2, orxr3

(however appropriate) such that they will now be disjoint from each other.7For clarity, we denote a predicate variableP with an accentP to remind of the fact that we will be

quantifying over these predicates.

Page 125: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 116

• ϕWELLORΠ (

−→<,S) denotes the following formula (here “WELLOR” stands for well-

ordered):

r∈Π

∀xr(Sr(xr)→ ϕGENr (xr)) ∧ (

r∈Π

∃xrSr(xr))→

r′∈Π

∃xr′(Sr′(xr′) ∧ ∀yr′(Sr′(yr′) ∧ yr′ 6= xr′ → <r′r′(xr′ ,yr′))

∧∧

r′′∈Π,r′′ 6=r′

∀xr′′(Sr′′(xr′′)→ <r′r′′(xr′ ,xr′′))), (4.10)

whereS denotes the tuple of distinguishable predicate variables of the set{Sr | r ∈

Π} such that for eachr ∈ Π, the arity ofSr is |xr|, andyr′ (in the consequent above)

is a relabeling of the distinct variables ofxr′ such thatyr′ is now disjoint fromxr′ .

Let us take a closer look at Definition 23. Basically, formulaϕPROΠ (−→<,S) imposes a

progression-like order on the set of generating rules with respect to a structureM:

Γ(Π)M = {(r, η) | r ∈ Π, Pos(r)η ⊆M andNeg(r)η) ∩M = ∅ for an

assignmentη ofM},

which eventually establishes a correspondence to the sequence of progression setsΓ0(Π)M,

Γ1(Π)M Γ2(Π)M, · · · as we defined in Definition 18. We should emphasize that at this

stage, no preferences among rules are considered.

In particular, Formulas (4.4) and (4.5) expresses the transitive and asymmetric prop-

erties respectively, while Formula (4.6) expresses the condition that the well-order only

involves those of generating rules. Moreover, Formula (4.7) expresses that if some rule is

a generating rule (with respect to certain structure and associated assignment), then it must

be supported by rules generated in some earlier stages (i.e., ϕSUPr (−→<,xr)). Finally, Formula

(4.8) enforces a well-order (i.e.,ϕWELLORΠ (

−→<,S)).

Specifically, (4.8) is fulfilled by Formula (4.10), which encodes that each non-empty

subset of a generating rule has a least element. Indeed, the formula

r∈Π

∀xr(Sr(xr)→ ϕGENr (xr))

Page 126: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 117

encodes that each extent of eachSr for r ∈ Π are only those of generating rules, and

r∈Π

∃xrSr(xr)

encodes that at least one of these subsets are non-empty, andwhile the consequence

r′∈Π

∃xr′(Sr′(xr′) ∧ ∀yr′(Sr′(yr′) ∧ yr′ 6= xr′ → <r′r′(xr′ ,yr′))

∧∧

r′′∈Π,r′′ 6=r′

∀xr′′(Sr′′(xr′′)→ <r′r′′(xr′ ,xr′′)))

encodes the existence of the least element.

Proposition 17 The SO formulaϕPROΠ (−→<,S) is of lengthO(n3+mn2)wherem = |ATOMS(Π)|

(i.e., all the atoms occurring inΠ) andn = |Π|.

Proof: Formula (4.4) is of lengthO(n3), (4.6) is of lengthO(n2), (4.7) is of lengthO(mn2)

and (4.8) is of lengthO(n2). �

Example 24 Consider the well-known programΠ6 that computes the transitive closure of

a binary relationE:

r1 : T (x1, y1)← E(x1, y1)

r2 : T (x2, z2)← T (x2, y2), E(y2, z2).

Then:

ϕCOMPΠ6

= ∀xy(T (x, y)↔∃x1y1(ϕGENr1

(x1, y1) ∧ x = x1 ∧ y = y1)

∨ ∃x2y2z2(ϕGENr2

(x2, y2, z2) ∧ x = x2 ∧ y = z2)),

where:

ϕGENr1

(x1, y1) = E(x1, y1),

ϕGENr2

(x2, y2, z2) = T (x2, y2) ∧ E(y2, z2).

Page 127: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 118

In particular, we also have that:

ϕSUPr1

(−→<, x1, y1) =E(x1, y1),

ϕSUPr2

(−→<, x2, y2, z2) =∃x3y3z3(<r2r2(x3, y3, z3, x2, y2, z2) ∧ x2 = x3 ∧ y2 = z3)

∨ ∃x1y1(<r1r2(x1, y1, x2, y2, z2) ∧ x2 = x1 ∧ y2 = y1),

where the tuplex3y3z3 is a disjoint relabeling ofx2y2z2 and−→< is the tuple<r1r1 <r1r2

<r2r1 <r2r2 of predicate variables.

About the formulaϕWELLORΠ6

(−→<,S), we further have:

∀x1y1(Sr1(x1, y1)→ ϕGENr1

(x1, y1)) ∧ ∀x2y2z2(Sr2(x2, y2, z2)→ ϕGENr1

(x2, y2, z2))

∧ (∃x1y1Sr1(x1, y1) ∨ ∃x2y2z2Sr2(x2, y2, z2))→

(∃x1y1(Sr1(x1, y1) ∧ ∀xy(Sr1(x, y) ∧ (x1 6= x ∨ y1 6= y)→ <r1r1(x1, y1, x, y))

∧ ∀x2y2z2(Sr2(x2, y2, z2)→ <r1r2(x1, y1, x2, y2, z2)))

∨ ∃x2y2z2(Sr2(x2, y2, z2) ∧ ∀xyz(Sr2(x, y, z) ∧ (x2 6= x ∨ y2 6= y ∨ z2 6= z)→

<r2r2(x2, y2, z2, x, y, z))

∧ ∀x1y1(Sr1(x1, y1)→ <r2r1(x2, y2, z2, x1, y1)))),

whereS is the tupleSr1Sr2 of predicate variables. Then∀SϕWELLORΠ6

(−→<,S) expresses that

each non-empty subset ofΓ(Π)M possesses a least element as induced by the relations of

the predicates<r1r1 , <r1r2 , <r2r1 and<r2r2 . Note that the non-empty subsets ofΓ(Π)M are

implicitly encoded via the universally quantification of the predicate variablesSr1 andSr2.

Theorem 10 Given a FO programΠ and aτ(Π)-structureM,M is an answer set ofΠ

iffM |= ∃−→<∀SϕΠ(−→<,S), where

ϕΠ(−→<,S) = ϕPRO

Π (−→<,S) ∧ ϕCOMP

Π .

Proof: See Appendix A.2.5.�

Page 128: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 119

4.4.4 Incorporating Preference

We have shown that the SO sentence∃−→<∀SϕΠ(−→<,S) proposed in Theorem 10 has pre-

cisely captured the answer set semantics for FO programs. Inthis subsection, we further

extend this formula by embedding preferences among the rulesof a preferred FO program.

We first define the following formula.

Definition 24 Given a preferred FO programP = (Π, <P), we define the formulaϕPREFP (−→< )

as follows (here “PREF” stands for preference):

r∈Π

∀xr(ϕGENr (xr)→

r′<Pr

∀xr′((ϕGENr′ (xr′)→ <r′r(xr′ ,xr))

∧ (¬ϕGENr′ (xr′)→ (ϕ¬POS

r′ (xr′) ∨ ϕDEFrr′ (−→<,xr,xr′) )))),

(4.11)

where:

• ϕ¬POSr′ (xr′) denotes the formula (“¬POS” stands forpositive body not satisfied):

P (xP)∈Pos(r′)

¬P (xP); (4.12)

• ϕDEFrr′ (−→<,xr,xr′) (here “DEF” stands fordefeated) denotes the formula

(∨

P (xP)∈Neg(r′),P /∈Pint(Π)

P (xP)) ∨ (∨

P (xP)∈Neg(r′),P∈Pint(Π)

r′′∈Π,Head(r′′)=P (yP)

∃xr′′(<r′′r(xr′′ ,xr) ∧ xP = yP)).

(4.13)

Intuitively speaking, Formula (4.11) encodes that ifr is a generating rule (under some

structure and associated assignment), then for all rulesr′ that is more preferred thanr, and

such thatr′ is also a generating rule (under the structure and associated assignment), then

we require thatr′ should had already been derived earlier thanr in the progression stages.

On the other hand, in the case thatr′ is not a generating rule, then either the positive body

of r′ is not satisfied (i.e., by (4.12)), or that it is defeated by some other ruler′′ such thatr′′

is already derived earlier thanr in the progression stages (i.e., by (4.13)), which indicates

that the head ofr′′ occurs in the negative body ofr′.

Page 129: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 120

The following theorem now reveals the main result of this chapter.

Theorem 11 LetP = (Π, <P) be preferred FO program andM a τ(Π)-structure. Then

M is a preferred answer set ofP iffM |= ∃−→<∀SϕP(−→<,S), where

ϕP(−→<,S) = ϕPREF

P (−→< ) ∧ ϕPRO

Π (−→<,S) ∧ ϕCOMP

Π .

Proof: See Appendix A.2.6.�

Thus, by Theorem 11, we have that the fixpoints of the progression operatorλM0(Γ∞(P)M)

(i.e., λM0(Γ∞(P)M) = M, corresponding toM a preferred answer set) are exactly the

models of the SO sentence∃−→<∀SϕP(−→<,S). In fact, when only considering finite struc-

ture, we even have that the universal SO sentence∃−→<∀SϕP(

−→<,S) reduces down to an

existential SO sentence, as revealed in the following proposition.

Proposition 18 On finite structures, every preferred FO program is precisely captured by

an existential SO (ESO) formula.

Proof: We obtain an ESO formula∃−→<ψP(−→< ) from ∃−→<∀SϕP(

−→<,S) by substituting the

SO formulaϕTOTALORΠ (

−→< )8 for ϕWELLOR

Π (−→<,S) in ϕP(

−→<,S) such thatϕTOTALOR

Π (−→< ) is given

by:

r∈Π

∀xryr(ϕGENr (xr) ∧ ϕ

GENr (yr) ∧ xr 6= yr → (<rr(xr,yr) ∨ <rr(yr,xr)))

∧∧

r1,r2∈Π,r1 6=r2

∀xryr(ϕGENr1

(xr1) ∧ ϕGENr2

(xr2)→ (<r1r2(xr1 ,xr2) ∨ <r2r1(xr2 ,xr1))),

which, in conjunction with Formulas (4.4), (4.5) and (4.6),expresses astrict-total order

onΓ(Π)M. Then since well-orders are strict total-orders on finite structures, the result fol-

lows.�

Example 25 On finite structures, let us consider once again the preferred programP2 =

8Where “TOTALOR” stands fortotal-order.

Page 130: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 121

(Π2, <P2) of Example 19:9

r1 : P (x1)← Q(x1)

r2 : Q(x2)←

r1 <P2 r2.

We will now use Theorem 11 and Proposition 18 to show thatΠ2 does not have a preferred

answer set. Thus, givenΠ2, we haveϕPREFΠ2

(−→< ) to be:

∀x1(ϕGENr1

(x1)→ ⊤)

∧ ∀x2(ϕGENr2

(x2)→ ∀x1((ϕGENr1

(x1)→ <r1r2(x1, x2))

∧ (¬ϕGENr1

(x1)→ (ϕ¬POSr1

(x1) ∨ ϕDEFr2r1

(−→<, x2, x1))))). (4.14)

Then fromϕPROΠ2

(−→< ), we further have:

∀x1(ϕGENr1

(x1)→ ∃x2(<r2r1(x2, x1) ∧ x1 = x2)), (4.15)

i.e., the support forr1. Then since we also have

∀x1x2(<r1r2(x1, x2)→ ϕGENr1

(x1) ∧ ϕGENr2

(x2)) (4.16)

by ϕPROΠ2

(−→< ) (i.e., via (4.6)), then (4.15) is equivalent to:

∀x1(ϕGENr1

(x1)→ ∃x2(<r2r1(x2, x1) ∧ ϕGENr2

(x2) ∧ x1 = x2)). (4.17)

Then from (4.14), we further get that (4.17) is equivalent to:

∀x1(ϕGENr1

(x1)→ ∃x2(<r2r1(x2, x1) ∧ ϕGENr2

(x2) ∧ <r1r2(x1, x2) ∧ x1 = x2)), (4.18)

9Note that for our purpose here, we relabelled the variables in rulesr1 andr2 to make them disjoint.

Page 131: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 122

i.e., simply added the atom,<r1r2(x1, x2), to the consequent. Then by (4.4), i.e., the tran-

sitive property, we further have that (4.18) is equivalent to

∀x1(ϕGENr1

(x1)→ ∃x2(<r2r1(x2, x1) ∧ ϕGENr2

(x2) ∧ <r1r2(x1, x2)∧

<r2r2(x2, x2) ∧ x1 = x2)), (4.19)

i.e., added the atom,<r2r2(x2, x2), to the consequent. Then by the asymmetry as expressed

by Formula (4.5) (i.e., which implies we cannot have<r2r2(x2, x2)), we further have that

∀x1(ϕGENr1

(x1)→ ⊥) ≡ ∀x1¬ϕGENr1

(x1). (4.20)

Hence, sinceϕGENr1

(x1) = Q(x1), then this implies that:

∀x1¬Q(x1).

Therefore, since we also have∀x1Q(x1) by ϕCOMPΠ2

, then the sentence∃−→<ψP2(−→< ) is in-

consistent(or unsatisfiable), which corresponds to the preferred programP2 not having a

preferred answer set as mentioned in Example 19.

The following proposition now reveals that when the preference relations among the

rules in the preferred program is empty, then the models of the sentence∃−→<∀SϕP(−→<,S)

corresponds exactly to the answer sets of the program.

Proposition 19 For a preferred FO programP = (Π, <P) where<P= ∅ and aτ(Π)-

structureM,M |= ∃−→<∀SϕP(−→<,S) iffM is an answer set ofΠ.

Proof: When<P= ∅, the sentence∃−→<∀SϕP(−→<,S) reduces to∃−→<∀SϕΠ(

−→<,S), since

ϕPREFP (−→< ) as given by:

r∈Π

∀xr(ϕGENr (xr)→

r′<Pr

∀xr′((ϕGENr′ (xr′)→ <r′r(xr′ ,xr))

∧ (¬ϕGENr′ (xr′)→ (ϕ¬POS

r′ (xr′) ∨ ϕDEFrr′ (−→<,xr,xr′) )))),

becomes ∧

r∈Π

∀xr(ϕGENr (xr)→ ⊤) ≡ ⊤.

Page 132: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 123

Therefore, along with Theorem 11, we have by Proposition 19 that all FO preferred

programs can be precisely captured by SO sentences on arbitrary structures. In addition,

by Proposition 18, when only finite structures are considered, we have that all FO preferred

programs can be precisely captured by ESO sentences.

4.5 Related Work and Further Remarks

Handling preferences through propositional answer set programming has been studied by

many researchers. Among the different proposals, the approach developed by Schaub and

Wang [SW03] provided a unified preference framework that captures several important

approaches including Brewka and Eiter’s and Delgrande’s et al’s [BE99, DST03].

Our framework generalizes Zhang and Zhou’s progression semantics for FO programs

[ZZ10] to incorporate preference, while it also extends Schaub and Wang’s order preserva-

tion semantics for preferred propositional programs to theFO case. As mentioned in Sec-

tions 1.2.5 and 4.3.1, a naive grounding method extending previous preferred propositional

program approaches seems not to work for defining a preferredFO program framework

since simply grounding a preferred programP = (Π, <P) with r1 <P r2 for some rules

r1, r2 ∈ Π could renderr1 andr2 to collapse to the same rule and hence lose the original

preference intuition presented in the program.

Another important difference between preferred FO programand propositional pro-

gram is the issue of dealing with infinite domains. In our proposed framework, we allow

both finite and infinite domains, while only finite domains arepossibly represented in pre-

ferred propositional program formulations. Although infinite domains are not often consid-

ered in practice, it is critical to gain a clear picture of thetheoretic foundations of preferred

FO program.

Other related work regarding preferred nonmonotonic reasoning on the FO level is that

of prioritized circumscription. Prioritized circumscription [Lif85, McC86] is an alternative

way of introducing circumscription by means of an ordering on tuples of predicates satisfy-

ing an axiom (can be any arbitrary first-order sentence). Hence, prioritized circumscription

differs from ours in that we do not relate to any ordering of the tuples of predicates, but

Page 133: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 4. PREFERRED FO ANSWER SET PROGRAMS 124

rather, we relate directly to “ordering on formulas,” i.e.,as represented by the universal

closures of rules. Thus, our approach is more of a prescriptive analog on a FO level.

Another work with respect to FO nonmonotonic reasoning is theordered completionof

FO programs as discussed in Chapter 2. Though the logical formulation in here of preferred

FO programs corresponds to a SO characterization that reduces down to an ESO formula on

finite structures, the way that the underlying ESO formula isencoded here is quite different

from that of the ordered completion. In fact, while ordered completion expresses the order

of the derivation paths of predicates, the ESO formula encodes the derivation order on the

rules itself, thus giving us the ability to express the notion of preference among the rules.

Page 134: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

Chapter 5

Summary of Contributions and Future

Work

5.1 Ordered Completion

One of the main contribution of this thesis is the introduction of the notion of ordered

completion that exactly captures the answer set semantics of first-order normal answer set

programs (see Chapter 2). As is well known in the literatures,the Clark’s completion of a

FO (normal) ASPΠ is a classical FO sentence of the following form:

P∈Pint(Π)

∀x(P (x)↔∨

r∈Π,Head(r)=P (x)

∃yrBody(r)),

and where it is also well known that the Clark’s completion is too weak in the sense that

not all models of it are answer sets of the underlying program. The ordered completion

strengthens the Clark’s completion by introducing the so-called comparison predicates,

that keep track of the derivation order of the intensional relations.

Semantically, the Clark’s completion of a predicateP can be equivalently written into

125

Page 135: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 5. SUMMARY OF CONTRIBUTIONS AND FUTURE WORK 126

two parts:

∀x(∨

r∈Π,Head(r)=P (x)

∃yrBody(r)→ P (x) ) (5.1)

∧∀x(P (x)→∨

r∈Π,Head(r)=P (x)

∃yrBody(r) ), (5.2)

where (5.1) corresponds to the universal closure of the predicateP , and (5.2) to the nec-

essary condition of an extent ofP . The so-calledmodified completionfor the predicateP

is obtained from the above form of the traditional predicatecompletion by replacing (5.2)

with the following formula:

∀x(P (x)→∨

r∈Π,Head(r)=P (x)

∃yr( Body(r) ∧ P os(r) < P (x))),

which simply enforcesBody(r) with P os(r) < P (x), whereP os(r) < P (x) denotes the

comparison assertions

Q(y)∈Pos(r)

(≤QP (y,x) ∧ ¬ ≤PQ (x,y)),

which intuitively mean thatQ(y) is used to establishP (x) (i.e., the head of the rule) and

not the other way around. From this, withMComp(Π) denoting all the conjunctions of

all the modified completions of the intensional predicates of Π, the ordered completion

OC(Π) is then simply the conjunction of the two sentencesMComp(Π) ∧ Trans(Π),

whereTrans(Π) stands for the formula

P,Q,R∈Pint(Π)

∀xyz(≤PQ (x,y)∧ ≤QR (y, z)→≤PR (x, z)),

which further encodes that the comparison relations satisfy a notion of “transitivity.” Then,

by Theorem 2, we have that the models ofOC(Π) corresponds exactly to the answer sets

of Π on finite structures. We then extended this result to also include other important ASP

constructs such as constraints and choice rules (see Propositions 4 and 5).

This result can now be summarized as follows:

Page 136: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 5. SUMMARY OF CONTRIBUTIONS AND FUTURE WORK 127

Table 5.1: From normal ASP to FO logic

Structures New Predicates Resulting Theory Translation

Arbitrary Allowed No restriction Does not existFinite Not Allowed Finite Does not existFinite Not Allowed No restriction Loop FormulaFinite Allowed Finite Ordered Completion

For first-order normal answer set programs on finite structures,

Answer Set= Clark’s Completion + Derivation Order

= Ordered Completion.

This seems to be a very tight result. First of all, as we have seen, this result cannot be

extended to disjunctive answer set programs unless NP = coNP(see Proposition 7). For

normal answer set programs, with this result, we now have a rather complete picture of

mappings from logic programs to FO logic which is summarizedby Table 5.1.

The significance of our ordered completion can be seen from both a theoretical and

a practical point of view. To the best of our knowledge, it provides for the first time a

translation from first-order normal answer programs under the stable model semantics to

first-order sentences.

5.1.1 Incorporating Aggregates

Aggregates form one of the most important building blocks ofASP. Aggregates are cur-

rently a hot topic in ASP due to their wide range of practical applications. Another of the

main contribution of this thesis is the extension of the ordered completion to include FO

ASP programs with aggregate constructs.

In this work, we considered first-order aggregate atomsδ of the following form:

OP〈v : ∃wBody(δ)〉 � N, (5.3)

Page 137: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 5. SUMMARY OF CONTRIBUTIONS AND FUTURE WORK 128

such thatBody(δ) is of the form

Q1(y1), . . . , Qs(ys), notR1(z1), . . . , notRt(zt),

and whereOP can either be one of the aggregate functionsCARD, SUM, PROD, MIN , and

MAX defined for the integers. However, some of these aggregates are non-monotone in

general, and where we know that on the propositional level, programs with non-monotone

aggregates are at least as complex as disjunctive programs [Fer11]. It is for these reason that

it is unlikely that ordered completion can be extended to include arbitrary aggregates in the

first-order case since, as was shown in [ALZZ12], ordered completion cannot be extended

to disjunctive programs as they are not in the same complexity level. We addressed this

problem by only considering the so-calledmonotoneandanti-monotoneaggregates. More

precisely, we achieved this by restricting some of the domains of the aggregate functions.

In particular, sinceCARD, MIN , andMAX are already (anti)monotone on the integers, we

only had to restrict the domains ofSUM to the non-negative integers, andPROD to the

natural numbers. We emphasize that although we only consideraggregates of this form, it

is indeed powerful since it covers almost all the aggregatesused in benchmark programs

[CIR+11].

For this case of ASP programs with aggregates, we enhanced the so-called modified

completion of a predicateP into the following sentence:

∀x(∨

r∈Π,Head(r)=P (x)

∃yrBody(r)→ P (x) )∧ (5.4)

∧∀x(P (x)→∨

r∈Π,Head(r)=P (x)

∃yr[Body(r) ∧ P os(r) < P (x) ∧ PosAgg (r) < P (x)] ), (5.5)

whereP os(r) < P (x) is defined as in the original definition of the ordered completion and

only on the standard (i.e., non-aggregate) atoms of the positive body, andPosAgg (r) < P (x)

Page 138: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 5. SUMMARY OF CONTRIBUTIONS AND FUTURE WORK 129

stands for the sentence1

δ∈PosCardSumProd(r),�∈{=,≥,>}

( OP〈v : ∃wBody(δ) ∧ Po s(δ) < P (x) 〉 � N )∧

δ∈PosMinMax(r),�∈{<,≤,=,≥,>}

( OP〈v : ∃wBody(δ) ∧ Po s(δ) < P (x) 〉 � N ),

such thatPo s(δ) < P (x) is simply the enforcement of the comparison relations into the

positive body ofδ. Generally speaking,PosAgg (r) < P (x) is the enhancement part from

that of the original definition by considering the occurrences of aggregate atoms in the rule’s

body. Then withMComp(Π) again being the conjunctions of all the enhanced modified

completion of the intensional predicates ofΠ, and withTrans(Π) as in the original defi-

nition, we have that the enhance ordered completion of a FO program with (anti)monotone

aggregates is againOC(Π) =MComp(Π)∧Trans(Π). Then by Theorem 3, we have that

the models ofOC(Π) are exactly corresponding to the answer sets (i.e., the stable models)

of Π on finite structures.

5.2 Solver Implementation

The notion of ordered completion also initiated a new direction of ASP solvers by ground-

ing on a program’s ordered completion instead of the programitself. We reported our first

implementation of such a solver (see Chapter 3), which compared favorably to other major

existing ASP solvers, especially on big problem instances (See Table 3.1).

In the traditional ASP solvers, a 2-step approach is used. First, a grounder is used to

transform the FO program into a propositional one. Second, apropositional ASP solver is

then called to compute an answer. Differently from the traditional approach, our solver uses

a 3-step approach. First, we translate a FO program into its ordered completion. Second,

we had implemented a grounder called Groc, to transform the ordered completion together

with the extensional database, into a propositional SMT theory. Then finally, we call an

SMT solver to compute a model of the SMT theory, which would bean answer set of the

1For the following, we use PosAgg(r) to denote the aggregate atoms fromPos(r);PosCardSumProd(r) to denote the cardinality, sum, and product aggregates fromPos(r); andPosMinMax(r) to denote the minimum and maximum aggregate atoms fromPos(r) respectively.

Page 139: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 5. SUMMARY OF CONTRIBUTIONS AND FUTURE WORK 130

program based on Theorem 5. It should be noted that since we were grounding directly on

a classical FO sentence, we were able to incorporate classical reasoning directly into the

grounding technique (see Section 3.4.4). In addition, we also made use of the advantages

provided by the interpretations of the comparison atoms by incorporating the notion of

“derivation order” as well into our grounding technique. Surprisingly, this method proved

to be highly efficient on very big problem instances of the Hamiltonian circuit program (see

Section 3.5).

5.3 Preferred ASP

The other main contribution of the thesis is the lifting of propositional preferred ASP to the

first-order case (see Chapter 4). In particular, we proposed aprogression based preference

semantics for FO ASP so that for a preferred programP = (Π, <P), we have that aτ(Π)-

structureM is preferred answer set ofP iff λM0(Γ∞(P)M) =M, i.e., the fixpoint of the

operatorλM0(Γ∞(P)M) isM (see Definitions 18 and 19).

We then investigated the essential semantical and syntactical properties (see Sections

4.3 and 4.3.2). In particular, the preferred answer sets have the property that all preferred

answer sets of a preferred programP = (Π, <P) are also answer sets ofΠ (see Proposition

14). In addition, we also showed the syntactical property that preferred programs where

all rules have non-empty positive bodies always have an answer set (see Proposition 15),

i.e., this mainly being the empty answer set∅. Furthermore, we also showed the interesting

property thatM is a preferred answer set ofP = (Π, <P) iff each (r, η) ∈ Γ∞(P)M

is a generating rule ofM underη (see Theorem 3). We further derived certain stronger

syntactical conditions for which the existence of a preferred answer set can be determined

(see Theorem 9). We emphasize that in order to prove these important properties, we also

specifically considered the grounding of preferred answer set programs and established its

connections to the first-order case (see Section 4.3.1).

We then addressed the expressiveness of preferred FO answerset programming in rela-

tion to classical SO logic. More precisely, we proposed a translation of a preferred program

P = (Π, <P) into a SO sentence∃−→<∀SϕP(−→<,S), where

ϕP(−→<,S) = ϕPREF

P (−→< ) ∧ ϕPRO

Π (−→<,S) ∧ ϕCOMP

Π , (5.6)

Page 140: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 5. SUMMARY OF CONTRIBUTIONS AND FUTURE WORK 131

such that aτ(Π) structureM is a preferred answer set ofP iff M |= ∃−→<∀SϕP(−→<,S) (see

Theorem 11). Intuitively speaking, (5.6) precisely captures the preferred answer sets by

“simulating” the progression semantics through encoding awell-ordered relation among

the pairs of generating rule and assignment(r, η) via theϕPROΠ (−→<,S) formula (see Defi-

nition 23). This well-ordered encoding was further refined to comply with the preference

relations by strengthening the theory with the formulaϕPREFP (−→< ) (see Definition 24). We

then showed that when only finite structures are concerned, the SO formula can be reduced

down to an existential SO sentence (see Proposition 18), by using the fact that total-orders

are always well-orders on finite sets.

5.4 Future Work

By introducing the notion of the ordered completion, this work enabled us to implement a

new direction of ASP solver by first translating a program into its ordered completion, and

then to work on finding a model of this FO sentence using, e.g.,SAT or SMT solvers. In

Section 2.4, we also showed how the notion of the ordered completion can be extended to

ASP programs with aggregate constructs. Since our current (in fact first) implementation of

the ordered completion (i.e., see Chapter 3) only involves programs without aggregates, we

leave the implementation of programs with aggregates as a promising task for our future

work. Furthermore, as also mentioned in Chapter 3, since the ordered completion is a

classical first-order sentence, a theoretically challenging but practically significant direction

is the implementation of directly performing FO reasoning on the ordered completion.

Another interesting direction for the theoretical side of ordered completion is to con-

sider how it relates to more general first-order formulas, i.e., not restricted to the syntax of

normal logic programs. A particular promising direction isto consider programs where the

heads of the rules are of a single atom (similar to the case of normal programs), but where

the bodies are made up of nested expressions [LTT99]. Nestedexpressions are formulas

built up as in classical first-order logic, but where the onlyconnectives used are∧, ∨, ¬,

∃, and∀, i.e., anything but the implication ‘→.’ A reason why this is a promising direction

is because at the propositional level, programs where all the rules have traditional heads

(i.e., head is just an atom), but where the bodies are of nestedexpressions, are still in NP

[Fer11]. An even more general direction is to extend the ordered completion to arbitrary

Page 141: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 5. SUMMARY OF CONTRIBUTIONS AND FUTURE WORK 132

first-order sentences as a whole, and study how the models of such formulas relates to both

its classical and stable models. To gain a general idea of this translation, let us consider

the simple case of propositional disjunctive logic programs. A propositional disjunctive

program is a set of rules of the form

a1; . . . ; ak ← b1, . . . , bl, not c1, . . . , not cm. (5.7)

Now let Π be a propositional logic program with signatureτ(Π). Then we define the

modified completion ofMComp(Π) of Π as follows

r∈Π

(Body(r)→∨

Head(r)) (5.8)

∧∧

a∈τ(Π)

(a→∨

r∈Π,a∈Head(r)

(Body(r) ∧ Pos(r) < a)), (5.9)

where for a ruler ∈ Π of the form (5.7):

• Head(r) = {a1, . . . , ak} such that∨Head(r) stands for the formulaa1 ∨ · · · ∨ ak;

• Body(r) = b1 ∧ · · · ∧ bl ∧ ¬c1 ∧ · · · ∧ ¬cm;

• Pos(r) = {b1, . . . , bl};

• and lastly,Pos(r) < a stands for the following formula:

b∈Pos(r)

(≤ba ∧¬ ≤ab),

which still encodes thatb is used to establisha and not the other way around.

Then withTrans(Π) similarly standing for the formula

a,b,c∈τ(Π)

(≤ab ∧ ≤bc→≤ac), (5.10)

we defineOC(Π) as againMComp(Π) ∧ Trans(Π), it can be shown that on finite struc-

tures, if an interpretationI ⊆ τ(Π) is an answer set ofΠ, then we have thatI |= OC(Π).

Then we clearly have thatOC(Π) is weaker thanSM(Π), i.e.,SM(Π) |= OC(Π). Now

Page 142: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

CHAPTER 5. SUMMARY OF CONTRIBUTIONS AND FUTURE WORK 133

setMComp′(Π) to be a minor modification ofMComp(Π) such that it is defined as the

following formula:

r∈Π

(Body(r)→∨

Head(r)) (5.11)

∧∧

a∈τ(Π)

(a→∨

r∈Π,a∈Head(r)

(Body(r) ∧ Pos(r) < a ∧ ¬Head (r) \ {a})), (5.12)

where

Head (r) \ {a} =∧

b∈Head(r)\{a}

¬b,

i.e., the conjunctions of the negations of all the atoms inHead(r) \ {a}. Then with

OC ′(Π) = MComp′(Π) ∧ Trans(Π), it can be shown thatOC ′(Π) |= SM(Π), such

that we now have the following relationship:

OC ′(Π) |= SM(Π) |= OC(Π).

It would then be interesting if this relationship could be used towards some implementation

advantage, as an approximation to the stable models, or alternatively, study if a “tighter”

bound exist.

In regards to preferred FO ASP, several issues are also left for our future work. Firstly, it

would be an interesting topic to study the application of preferred FO programs. Currently,

we are considering to use the proposed formalisms to specifyfinite structure update, where

the entire update process may be represented by a preferred FO program. Another interest-

ing work is to extend the proposed framework to preferred FO disjunctive programs. The

recent work of Zhou and Zhang [ZZ11] extends the progressionbased semantics of FO nor-

mal programs to FO disjunctive programs. This new semanticsprovides for a possibility to

develop a similar progression based preference semantics for FO programs.

Page 143: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

Appendix A

Proofs

A.1 Proofs for Chapter 2

A.1.1 Proof of Lemma 1

(=⇒) If A is an answer ofΠ, thenA |= SM(Π). Then sinceA |= Π (i.e., sinceA |=

SM(Π)), it will be sufficient to show that allS ⊆ [Pint(Π)]A is externally supported. For

the sake of contradiction, assume otherwise that there exist such a non-externally supported

setS. Then withσU = {Ui | 1 ≤ i ≤ n},1 define theτ(Π) ∪ σU-structureU as a structure

expanded fromA as follows:

• cU = cA for each constantc ∈ τ(Π);

• P U = PA for each predicateP ∈ τ(Π);

• UUi = PAi \ {a | Pi(a) ∈ S} for 1 ≤ i ≤ n.

Then clearly,U |= U < P sinceS 6= ∅. Moreover, it is also true thatU |= Π∗(U).

Indeed, consider the formula∀xyr( Body(r)∗ → P (x)∗) for some ruler ∈ Π with lo-

cal variablesyr. Then with a corresponding assignmentxyr −→ abr on xyr, either

U 6|= Body(r)∗[xyr/abr] or U |= Body(r)∗[xyr/abr]. We now consider each of these

possibilities:

1Recall from Section 1.2.1 thatU = U1 . . . Un such that withPint(Π) = {P1, . . . , Pn}, eachUi (1 ≤i ≤ n) is a new predicate symbol that match the arity ofPi.

134

Page 144: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 135

Case: 1 U 6|= Body(r)∗[xyr/abr].

Then we clearly haveU |= ( Body(r)∗ → P (x)∗)[xyr/abr] as well.

Case: 2 U |= Body(r)∗[xyr/abr].

Then eitherU |= P (x)∗[x/a] or U 6|= P (x)∗[x/a]. We now consider each further

subcases:

Subcase 1:U |= P (x)∗[x/a].

Then we clearly haveU |= ( Body(r)∗ → P (x)∗)[xyr/abr] as well.

Subcase 2:U 6|= P (x)∗[x/a].

SinceU < P |= Body(r)∗ → Body(r) and whereU |= U < P, we have

U ↾τ(Π)= A |= Body(r) as well. Then sinceA |= Π, we must haveA |=

P (x)[x/a] as well. Then sinceU 6|= P (x)∗[x/a], we thatP (a) ∈ S since

P (a) ∈ A andP (a)∗ /∈ U . Then sinceS is not externally supported, we

must havePos(r)[xyr/abr] ∩ S 6= ∅. Then sinceU was expanded fromA

by interpreting theUi predicates as those ofPi but omitting those grounded

atoms inS, we must have thatU 6|= P os(r)∗[xyr/abr],2 which then implies

U 6|= Body(r)∗[xyr/abr]. This is in contradiction with the assumptionU |=Body(r)∗[xyr/abr], therefore we cannot haveU 6|= P (x)∗[x/a].

Therefore, sinceU |= U < P ∧ Π∗(U), then this is a contradiction since this implies

A 6|= SM(Π).

(⇐=) SinceA |= Π, it will be sufficient to show thatA |= ∀U(U < P → ¬Π∗(U))

to showA |= SM(Π). For the sake of contradiction, assumeU |= U < P ∧ Π∗(U)

for someτ(Π) ∪ σU-structureU expansion ofA. Now letS be the set of ground atoms

{Pi(a) | a ∈ PUi \ U

Ui , 1 ≤ i ≤ n}. ThenS 6= ∅ andS is not externally supported. For

otherwise, assume thatS is externally supported. Then there exist someP (a) ∈ S, rule

P (x)→ Body(r) ∈ Π with local variablesyr, and assignmentxyr −→ abr such that:

1. A |= Body(r)[xyr/abr] (i.e., the “support” forP (a));

2. Pos(r)[xyr/abr] ∩ S = ∅.

2 Pos(r)∗ denotes the conjunctions∧

Q(y)∈Pos(r) Q(y)∗.

Page 145: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 136

Then by the construction ofS, this impliesU |= Body(r)∗[xyr/abr]. Then sinceU |=

Π∗(U), this impliesU |= P (x)∗[x/a] as well. This is a contradiction asP (a) ∈ S and

sinceP (a) ∈ S impliesP (a)∗ is not in theU structure. Therefore, this show thatS is

not externally supported. Then this is again a contradiction since we had that every set

S ⊆ [Pint(Π)]A is externally supported. This completes the proof of Lemma 1. �

A.1.2 Proof of Theorem 2

(=⇒) To prove this result, we borrow some of the ideas from [ZZ10]. In a similar manner

to the “progression stages” in [ZZ10], we define the theτ(Π) ∪ σU-structureU t(Π∗(U))

(or justU t when clear from context) inductively as follows:

1. U0 is theτ(Π) ∪ σU-structure expanded fromA as follows:

• cU0= cA for each constantc ∈ τ(Π);

• P U0= PA for each predicateP ∈ τ(Π);

• UU0= ∅ for each predicateU ∈ σU;

2. U t+1 is the followingτ(Π) ∪ σU-structure:

U t ∪ {P (a)∗ | there exists a ruleP (x)← Body(r) ∈ Π with local variablesyr

and assignmentxyr −→ abr such thatU t |= Body(r)∗[xyr/abr]}.

Then it is not too difficult to show by induction thatUUt

i ⊆ PAi (1 ≤ i ≤ n)3 for all t ≥ 0

sinceA |= Π (i.e., becauseA |= SM(Π)). In fact, it is true that the otherway holds as

well, as we have by the following claim.

Claim 1: PAi ⊆ UU∞

i (1 ≤ i ≤ n).

Proof of Claim 1: On the contrary, assumeUU∞

i ⊂ PAi for somei (1 ≤ i ≤ n). Then let

S be the following set of ground atoms:

{Pi(a) | a ∈ PAi \ U

U∞

i , 1 ≤ i ≤ n}.

3Recall from Section 1.2.1 thatU = U1 . . . Un corresponds toPint(Π) = {P1, . . . , Pn}.

Page 146: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 137

Then we haveS 6= ∅. Moreover, we even have thatS is not externally supported.

For otherwise, assume thatS is externally supported. Then there is aP (a) ∈ S, rule

P (x) ← Body(r) ∈ Π with local variablesyr, and assignmentxyr −→ abr such

that:

1. A |= Body(r)[xyr/abr];

2. Pos(r)[xyr/abr] ∩ S = ∅.

Then with a slight abuse of notation, this implies thatPos(r)∗[xyr/abr] ⊆ U∞.4

Then from the definition of Body(r)∗, this implies thatU t |= Body(r)∗[xyr/abr]

for somet ≥ 1. Then this is a contradiction since this impliesP (a)∗ ∈ U t+1 ⊆ U∞.

Therefore,S cannot be externally supported. But this is again a contradiction since

by Lemma 1, we must have thatS is externally supported sinceA is an answer set of

Π. This completes the proof of Claim 1.

Therefore, sinceUU∞

i = PAi (1 ≤ i ≤ n) as implied Claim 1, we can now construct an

expansionA′ of A on the signatureσ≤. First, define∆t inductively as follows:

∆0 ={P (a)∗ | P (a)∗ ∈ U1, P ∈ Pint(Π)};

∆t ={P (a)∗ | P (a)∗ ∈ U t+1 \ U t, P ∈ Pint(Π)}.

Then clearly, we have∆i ∩∆j = ∅ if both ∆i and∆j are non-empty andi 6= j (i.e., these

sets partitionsU∞ on the “U ” interpretations). Moreover, it is also not too difficult tosee

that⋃

i≥0 ∆i = U ↾σU

, i.e.,⋃

i≥0 ∆i is exactly the “U ” interpretations ofU∞. Then we

define the expansionA′ of A on the signatureσ≤ by setting

≤A′

PQ= {(a,b) | P (a)∗ ∈ ∆i, Q(b)∗ ∈ ∆j, i < j}

for each pair of predicatesP,Q ∈ Pint(Π). Now we show thatA′ |= OC(Π). Indeed,

sinceA′↾τ(Π)= A |= Π, then it is sufficient to show thatA′ satisfies

P∈Pint(Π)

∀x(P (x)→∨

r∈Π,Head(r)=P (x)

∃yr( Body(r) ∧ P os(r) < P (x)) ). (A.1)

4With a slight abuse of notation,Pos(r)∗[xyr/abr] denotes the following set of ground atoms:{P (a)∗ |β ∈ Pos(r), P (a) corresponds toβ[xyr/abr]}.

Page 147: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 138

Hence, assumeA′ |= P (x)[x/a] for some assignmentx −→ a. Then by Claim 1,

P (a)∗ ∈ U t for somet ≥ 1. Without loss of generality, assume thatt is the least such

stage. Then by the definition ofU t, there exist a ruleP (x) ← Body(r) ∈ Π with local

variablesyr and assignmentxyr −→ abr such thatU t−1 |= Body(r)∗[xyr/abr]. Then

this implies thatPos(r)∗[xyr/abr] ⊆ Ut−1. Then sinceP (a)∗ ∈ U t andP (a)∗ /∈ U t−1

(i.e., sincet is the least such stage), we have from the construction ofA′ that(b, a) ∈≤A′

QP

for eachQ(b)∗ ∈ Pos(r)∗[xyr/abr] whereQ ∈ Pint(Π). Then this implies thatA′ |=

P os(r) < P (x)[xyr/abr]. Therefore, sinceU t−1 |= Body(r)∗[xyr/abr], and whereU t−1 ⊆

U∞ andUU∞

i = PAi (1 ≤ i ≤ n) as implied by Claim 1, then it follows thatA′ |=

(Body(r) ∧ P os(r) < P (x))[xyr/abr].

(⇐=) SinceA′ |= OC(Π), thenA′ ↾τ(Π)= A |= Π. Then by Lemma 1, it will be

sufficient to show that allS ⊆ [Pint(Π)]A′

are also externally supported. Indeed, for the

sake of contradiction, assume for someS ⊆ [Pint(Π)]A′

thatS is not externally supported.

Then we have for allP (a) ∈ S, ruleP (x) ← Body(r) ∈ Π with local variablesyr, and

assignmentxyr −→ abr such thatA′ |= Body(r)[xyr/abr], thatPos(r)[xyr/abr] ∩

S 6= ∅. Now, sinceA′ |= OC(Π), then there exist aP (a) ∈ S such that for some rule

P (x) ← Body(r) ∈ Π with local variablesyr and assignmentxyr −→ abr, we have

A′ |= (Body(r) ∧ P os(r) < P (x))[xyr/abr]. Moreover, due to the finiteness ofA′ (and

thus, also the finiteness ofS), we can safely assume without loss of generality that for all

≤QP (b, a) ∈ P os(r) < P (x)[xyr/abr], we haveQ(b) /∈ S.5 Then this is a constradiction

since this implies thatS is externally supported. This ends the proof of Theorem 2.�

A.1.3 Proof of Lemma 2

(=⇒) If A is an answer set ofΠ, thenA |= SM(Π). Therefore, since this implies that

A |= Π, then it will be sufficient to show that every setS ⊆ [Pint(Π)]A is also externally

supported. So for the sake of contradiction, let us assume that there exist such a setS ⊆

[Pint(Π)]A that is not externally supported. Then withσU = {U1, . . . , Un}, setU to be the

5To validate this assumption, one only has to note that for a chosenP (a), if Pos(r)[xyr/abr] ∩ S 6= ∅,then we can choose anotherQ(b) ∈ Pos(r)[xyr/abr] ∩ S. Then sinceA′ |= OC(Π), there must alsoexists a ruleQ(y) ← Body(r′) ∈ Π with local variableszr′ and assignmentyzr′ −→ bcr′ such thatA′ |=

( Body(r′) ∧ P os(r′) < Q(y))[yzr′/bcr′ ] and whereP (a) /∈ Pos(r′)[yzr′/acr′ ], due to the enforcement

of the comparison atoms, i.e.,P os(r′) < Q(y). Then due to the finiteness ofS, this can be repeated a finitenumber of times until we reach the desired condition of the assumption.

Page 148: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 139

τ(Π) ∪ σU-structure as follows:

• cU = cA for each constantc ∈ τ(Π);

• P U = PA for each predicateP ∈ τ(Π);

• UUi = PAi \ {a | Pi(a) ∈ S} for 1 ≤ i ≤ n.

Then clearly,U |= U < P sinceS 6= ∅. Moreover, it is also true thatU |= Π∗(U). Indeed,

sinceS is non-externally supported, then we have for all rulesP (x)← Body(r) ∈ Π with

local variablesyr and assignmentxyr −→ abr such thatA |= Body(r)[xyr/abr] (i.e., a

“support” forP (a)), that there exist some atomβ ∈ Pos(r) such that either:

• β = Q(y), whereQ ∈ Pint(Π) andQ(b) ∈ S corresponds toβ[xyr/abr], or

• β is a aggregate atomδ of the form (2.31) and

OP〈cv : A |= Body(δ)[α], Pos(δ)[α] ∩ S = ∅〉 � N

does not hold for all assignmentsα of the formxyrwv −→ abrcwcv wherecw ∈

Dom(A)|w| andcv ∈ Dom(A)|v|.

Now, to showU |= Π∗(U), consider the formula∀xyr( Body(r)∗ → P (x)∗) for some rule

r ∈ Π with local variablesyr. Then with a corresponding assignmentxyr −→ abr on

xyr, eitherU 6|= Body(r)∗[xyr/abr] or U |= Body(r)∗[xyr/abr]. We now consider each

of these possibilities:

Case: 1 U 6|= Body(r)∗[xyr/abr].

Then we clearly haveU |= ( Body(r)∗ → P (x)∗)[xyr/abr] as well.

Case: 2 U |= Body(r)∗[xyr/abr].

Then eitherU |= P (x)∗[x/a] or U 6|= P (x)∗[x/a]. We now consider each further

subcases:

Subcase 1:U |= P (x)∗[x/a].

Then we clearly haveU |= ( Body(r)∗ → P (x)∗)[xyr/abr] as well.

Page 149: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 140

Subcase 2:U 6|= P (x)∗[x/a].

SinceU < P |= Body(r)∗ → Body(r) and whereU |= U < P, we have

U ↾τ(Π)= A |= Body(r) as well. Then sinceA |= Π, we must haveA |=

P (x)[x/a] as well. Then sinceU 6|= P (x)∗[x/a], we thatP (a) ∈ S since

P (a) ∈ A andP (a)∗ /∈ U . Then sinceS is not externally supported, we must

have that either:

• (Pos(r) \ PosAgg(r))[xyr/abr] ∩ S 6= ∅, or

• for some aggregate atomδ of the form (2.31), we have that

OP〈cv : A |= Body(δ)[α], Pos(δ)[α] ∩ S = ∅〉 � N

does not hold for all assignmentsα of the formxyrwv −→ abrcwcv

wherecw ∈ Dom(A)|w| andcv ∈ Dom(A)|v|. Note from the construction

of theτ(Π) ∪ σU-structureU that

OP〈cv : U |= Body(δ)∗[α] 〉 � N

does not hold as well.

Then sinceU was expanded fromA by interpreting theUi predicates as those

of Pi but omitting those grounded atoms inS, we must have thatU 6|= P os(r)∗

[xyr/abr],6 which then impliesU 6|= Body(r)∗[xyr/abr]. This is in contradic-

tion with the assumptionU |= Body(r)∗[xyr/abr], therefore we cannot have

U 6|= P (x)∗[x/a].

Hence, since we had shown thatU |= Π∗(U), then this is a contradiction sinceA |=

SM(Π) and whereU |= U < P∧Π∗(U). Therefore, we must have that allS ⊆ [Pint(Π)]A

that is externally supported.

(⇐=) SinceA |= Π, it will be sufficient to showA |= ∀U(U < P → ¬Π∗(U)) to

show thatA |= SM(Π). For the sake of contradiction, assumeU |= U < P ∧ Π∗(U) for

someτ(Π)∪σU-structureU expansion ofA. Then letS be the set of ground atoms{Pi(a) |

a ∈ P Ui \ UUi , 1 ≤ i ≤ n}. ThenS 6= ∅ andS is not externally supported. For otherwise,

assume thatS is externally supported. Then there exist some ground atomP (a) ∈ S, rule

6 Pos(r)∗ denotes the conjunctions∧

Q(y)∈Pos(r) Q(y)∗.

Page 150: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 141

P (x← Body(r)∗ ∈ Π with local variablesyr, and assignmentxyr −→ abr such that:

1. A |= Body(r)[xyr/abr];

2. (Pos(r) \ PosAgg(r))[xyr/abr] ∩ S = ∅;

3. For all aggregate atomδ ∈ PosAgg(r) of the form (2.31),

OP〈cv : A |= Body(δ)[xyrwv/abrcwcv], Pos(δ)[xyrwv/abrcwcv] ∩ S = ∅,

cw ∈ Dom(A)|w| andcv ∈ Dom(A)|v|〉 � N,

holds.

Then by the construction ofS, this impliesU |= Body(r)∗[xyr/abr] as well. Then since

U |= Π∗(U), this impliesU |= P (x)∗[x/a]. Then this is a contradiction becauseP (a) ∈ S,

and sinceP (a) ∈ S impliesP (a)∗ is not in theU structure. Therefore, this show thatS

is not externally supported. But this is again a contradiction since we had that every set

S ⊆ [Pint(Π)]A is externally supported. This completes the proof of Lemma 2. �

A.1.4 Proof of Theorem 3

(=⇒) To prove this result, we borrow some of the ideas from [ZZ10]. In a similar manner

to the “progression stages” in [ZZ10], we define the theτ(Π) ∪ σU-structureU t(Π∗(U))

(or justU t when clear from context) inductively as follows:

1. U0 is theτ(Π) ∪ σU-structure expanded fromA as follows:

• cU0= cA for each constantc ∈ τ(Π);

• P U0= PA for each predicateP ∈ τ(Π);

• UU0= ∅ for each predicateU ∈ σU;

2. U t+1 is the followingτ(Π) ∪ σU-structure:

U t ∪ {P (a)∗ | there exists a ruleP (x)← Body(r) ∈ Π with local variablesyr

and assignmentxyr −→ abr such thatU t |= Body(r)∗[xyr/abr]}.

Page 151: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 142

Then it is not too difficult to show by induction thatUUt

i ⊆ PAi (1 ≤ i ≤ n)7 for all t ≥ 0

sinceA |= Π (i.e., becauseA |= SM(Π)). In fact, it is true that the otherway holds as

well, as we have by the following claim.

Claim 1: PAi ⊆ UU∞

i (1 ≤ i ≤ n).

Proof of Claim 1: On the contrary, assumeUU∞

i ⊂ PAi for somei (1 ≤ i ≤ n). Then let

S be the following set of ground atoms:

{Pi(a) | a ∈ PAi \ U

U∞

i , 1 ≤ i ≤ n}.

Then we haveS 6= ∅. Moreover, we even have thatS is not externally supported.

For otherwise, assume thatS is externally supported. Then there is aP (a) ∈ S, rule

P (x) ← Body(r) ∈ Π with local variablesyr, and assignmentxyr −→ abr such

that:

1. A |= Body(r)[xyr/abr];

2. (Pos(r) \ PosAgg(r))[xyr/abr] ∩ S = ∅;

3. for each aggregate atomδ ∈ PosAgg(r) of the form (2.31), we have that

OP〈cv : A |= Body(δ)[α], Pos(δ)[α] ∩ S = ∅ 〉 � N, (A.2)

holds, whereα is the assignment of the formxyrwv −→ abrcwcv with cw ∈

DomA|w| andcv ∈ DomA|v|.

Then with a slight abuse of notation, this implies that(Pos(r)\PosAgg(r))[xyr/abr]

⊆ U∞ 8 andU∞ |= δ∗[x,yr/abr] for all aggregate atomsδ ∈ PosAgg(r). Then

from the definition of Body(r)∗, this implies thatU t |= Body(r)∗[xyr/abr] for

somet ≥ 1. Then this is a contradiction since this impliesP (a)∗ ∈ U t+1 ⊆ U∞.

Therefore,S cannot be externally supported. But this is again a contradiction since

by Lemma 2, we must have thatS is externally supported sinceA is an answer set of

Π. This completes the proof of Claim 1.

7Recall from Section 1.2.1 thatU = U1 . . . Un corresponds toPint(Π) = {P1, . . . , Pn}.8With a slight abuse of notation,Pos(r)∗[xyr/abr] denotes the following set of ground atoms:{P (a)∗ |

β ∈ Pos(r) \ PosAgg(r), P (a) corresponds toβ[xyr/abr]}.

Page 152: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 143

Therefore, sinceUU∞

i = PAi (1 ≤ i ≤ n) as implied Claim 1, we can now construct an

expansionA′ of A on the signatureσ≤. First, define∆t inductively as follows:

∆0 ={P (a)∗ | P (a)∗ ∈ U1, P ∈ Pint(Π)};

∆t ={P (a)∗ | P (a)∗ ∈ U t+1 \ U t, P ∈ Pint(Π)}.

Then clearly, we have∆i ∩∆j = ∅ if both ∆i and∆j are non-empty andi 6= j (i.e., these

sets partitionsU∞ on the “U ” interpretations). Moreover, it is also not too difficult tosee

that⋃

i≥0 ∆i = U ↾σU

, i.e.,⋃

i≥0 ∆i is exactly the “U ” interpretations ofU∞. Then we

define the expansionA′ of A on the signatureσ≤ by setting

≤A′

PQ= {(a,b) | P (a)∗ ∈ ∆i, Q(b)∗ ∈ ∆j, i < j}

for each pair of predicatesP,Q ∈ Pint(Π). Now we show thatA′ |= OC(Π). Indeed,

sinceA′↾τ(Π)= A |= Π, then it is sufficient to show thatA′ satisfies

P∈Pint(Π)

∀x(P (x)→∨

r∈Π,Head(r)=P (x)

∃yr[ Body(r) ∧ P os(r) < P (x) ∧ PosAgg (r) < P (x)] ).

(A.3)

Hence, assumeA′ |= P (x)[x/a] for some assignmentx −→ a. Then by Claim 1,P (a)∗ ∈

U t for somet ≥ 1. Without loss of generality, assume thatt is the least such stage. Then

by the definition ofU t, there exist a ruleP (x)← Body(r) ∈ Π with local variablesyr and

assignmentxyr −→ abr such thatU t−1 |= Body(r)∗[xyr/abr]. Then this implies that:

1. (Pos(r) \ PosAgg(r))∗[xyr/abr] ⊆ Ut−1;

2. U t−1 |= δ∗[xyr/abr] for each aggregate atomδ ∈ PosAgg(r) of the form (2.31).

Then sinceP (a)∗ ∈ U t andP (a)∗ /∈ U t−1 (i.e., sincet is the least such stage), we have from

the construction ofA′ that(b, a) ∈≤A′

QP for eachQ(b)∗ ∈ (Pos(r)\PosAgg(r))∗[xyr/abr]

whereQ ∈ Pint(Π), which then implies thatA′ |= P os(r) < P (x)[xyr/abr]. In addition,

since for each aggregate atomδ ∈ PosAgg(r) we have that

OP〈cv : U t−1 |= Body(δ)∗[α], Pos(δ)∗[α] ⊆ U t−1 〉 � N

Page 153: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 144

holds (whereα : xyrwv −→ abrcwcv9), then we have that

OP〈cv : A′ |= (Body(δ) ∧ P os(δ) < P (x))[α] 〉 � N

holds as well. Therefore, sinceU t−1 |= Body(r)∗[xyr/abr], and whereU t−1 ⊆ U∞ and

UU∞

i = PAi (1 ≤ i ≤ n) as implied by Claim 1, then it follows thatA′ |= (Body(r) ∧

P os(r) < P (x) ∧ PosAgg (r) < P (x))[xyr/abr].

(⇐=) SinceA′ |= OC(Π), thenA′ ↾τ(Π)= A |= Π. Then by Lemma 1, it will be

sufficient to show that allS ⊆ [Pint(Π)]A′

are also externally supported. Indeed, for the

sake of contradiction, assume for someS ⊆ [Pint(Π)]A′

thatS is not externally supported.

Then we have for allP (a) ∈ S, ruleP (x) ← Body(r) ∈ Π with local variablesyr, and

assignmentxyr −→ abr such thatA′ |= Body(r)[xyr/abr], that there exist some atom

β ∈ Pos(r) such that either:

1. β = Q(y), whereQ ∈ Pint(Π) andQ(b) ∈ S corresponds toβ[xyr/abr], or

2. β is a aggregate atomδ of the form (2.31) and

OP〈cv : A |= Body(δ)[α], Pos(δ)[α] ∩ S = ∅〉 � N

does not hold, whereα is the assigment of the formxyrwv −→ abrcwcv, with

cw ∈ Dom(A)|w| andcv ∈ Dom(A)|v|.

Now, sinceA′ |= OC(Π), then there exist aP (a) ∈ S such that for some ruleP (x) ←

Body(r) ∈ Π with local variablesyr and assignmentxyr −→ abr, we haveA′ |=

(Body(r)∧P os(r) < P (x)∧PosAgg (r) < P (x))[xyr/abr]. Moreover, due to the finite-

ness ofA′ (and thus, also the finiteness ofS), we can safely assume without loss of gener-

ality that:

1. for all≤QP (b, a) ∈ P os(r) < P (x)[xyr/abr], we haveQ(b) /∈ S;

2. for all aggregate atomsδ ∈ PosAgg(r) of the form (2.31), we have

OP〈cv : A′ |= Body(δ)[α], ≤QP (b, a) ∈ P os(δ) < P (x)[α] impliesQ(b) /∈ S〉 � N

holds, whereα : xyrwv −→ abrcwcv.9cw ∈ Dom(A)w andcv ∈ Dom(A)v.

Page 154: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 145

To validate this assumptions, one only has to note that for a chosenP (a) ∈ S, if it is the

case that either:

• (Pos(r) \ PosAgg(r))[xyr/abr] ∩ S 6= ∅, or

• there exist some aggregate atomδ ∈ PosAgg(r) such that

OP〈cv : A′ |= Body(δ)[α], Pos(δ)[α] ∩ S = ∅〉 � N

does not hold, whereα is the assigment of the formxyrwv −→ abrcwcv,

then we can choose anotherQ(b) ∈ (Pos(r) \ PosAgg(r))[xyr/abr] ∩ S or Q(b) ∈

Pos(δ)[α]∩S (for someδ ∈ PosAgg(r)). Then sinceA′ |= OC(Π), there must also exists

a ruleQ(y) ← Body(r′) ∈ Π with local variableszr′ and assignmentyzr′ −→ bcr′ such

thatA′ |= ( Body(r′) ∧ P os(r′) < Q(y) ∧ PosAgg (r′) < Q(y))[yzr′/bcr′ ], and where:

1. P (a) /∈ (Pos(r′) \ PosAgg(r′))[yzr′/bcr′ ];

2. and for each aggregate atomδ ∈ PosAgg(r) of the form (2.31),

OP〈cv : A′ |= Body(δ)[α], P (a) /∈ Pos(δ)[α]〉 � N

holds, whereα is the assigment of the formxyrwv −→ abrcwcv,

due to the enforcement of the comparison atoms. Then due to the finiteness ofS and the

aggregates being either monotone or anti-monotone, this canbe repeated a finite number of

times until we reach the desired condition of the assumption. Then this is a constradiction

since this implies thatS is externally supported. This ends the proof of Theorem 3.�

A.2 Proofs for Chapter 4

A.2.1 Proof of Proposition 14

We prove this proposition by again using the result from [ZZ10] that provided a progression

based answer set semantics for FO programs. Such progression semantics is a special case

of our progression based preferred semantics specified in Definition 18.

Page 155: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 146

We again give Zhang and Zhou’s progression semantics as follows. LetΠ be a FO pro-

gram andPint(Π) = {Q1, . . . , Qn} the set of all the intensional predicates ofΠ. Consider

a structureM of τ(Π). Thet-th simultaneous evolution stageof Π based onM, denoted

asMt(Π), is a structure ofτ(Π) defined inductively as follows:

M0(Π) = (Dom(M), cM0

1 , · · · , cM0

r , PM0

1 , · · · , PM0

s , QM0

1 , · · · , QM0

n ),

wherecM0

i = cMi for each constant symbolci (1 ≤ i ≤ r), PM0

j = PMj for each exten-

sional predicatePj in Pext(Π) (1 ≤ j ≤ s), andQM0

k = ∅ for each intensional predicate

Qk in Pint(Π) (1 ≤ k ≤ n);

Mt+1(Π) =Mt(Π) ∪ {Qi(x)η | there exist a rule

Qi(x)← β1, . . . , βl, not γ1, . . . , not γm ∈ Π

and an assignmentη such that for allj (1 ≤ j ≤ l),

βjη ∈Mt(Π), and for allk (1 ≤ k ≤ m), γkη 6∈ M}.

Then by Theorem 1 of [ZZ10], we know thatM is an answer set ofΠ iff M∞(Π) =M.

Now to prove this proposition, we will show that under the conditionλM0(Γ∞(P)M) =

M, λM0(Γ∞(P)M) ⊆M∞(Π) andM∞(Π) ⊆ λM0(Γ∞(P)M). Indeed, it is easy to show

the former holds by the definition ofλM0(Γ∞(P)M). Therefore, it is only left to show

M∞(Π) ⊆ λM0(Γ∞(P)M). We show by induction ont thatMt(Π) ⊆ λM0(Γ∞(P)M).

Basis Clearly, sinceλM0(Γ∞(P)M) =M0(Π) ∪ {Head(r)η | (r, η) ∈ Γ∞(P)M}, then

it immediately follows thatM0(Π) ⊆ λM0(Γ∞(P)M).

Step Assume for0 ≤ t′ ≤ t we haveMt′(Π) ⊆ λM0(Γ∞(P)M).

We showMt+1(Π) ⊆ λM0(Γ∞(P)M). On the contrary, supposeMt+1(Π) 6⊆

λM0(Γ∞(P)M). Then there exist a ruler ∈ Π and assignmentη such thatPos(r)η ⊆

Mt(Π) andNeg(r)η ∩M = ∅, and wereHead(r)η ∈ Mt+1(Π) andHead(r)η /∈

λM0(Γ∞(P)M). Now, sinceMt(Π) ⊆ λM0(Γ∞(P)M) (i.e., by the inductive as-

sumption), then for somen ≥ 0, we haveMt(Π) ⊆ λM0(Γn(P)M). Furthermore,

sinceHead(r)η /∈ λM0(Γ∞(P)M), then we also haveHead(r)η /∈ λM0(Γn+1(P)M),

and hence, that(r, η) /∈ Γn+1(P)M. Then by the definition ofΓn+1(P)M, there must

Page 156: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 147

exists a ruler′ <P r and an assignmentη′ such that:

(a)Pos(r′)η′ ⊆M andNeg(r′)η′ ∩ λM0(Γn(P)M)) = ∅;

(b) (r′, η′) /∈ Γn(P)M,

i.e., a rule blockingr from being applied at stagen + 1. Now, for ak ≥ 0 and

(arbitrary) ruler∗ ∈ Π and corresponding assignmentη∗, setBk(r∗, η∗) to be such

that

B0(r∗, η∗) = {(r′, η′) |r′ <P r∗, Pos(r′)η′ ⊆M andNeg(r′)η′ ∩M0(Π) = ∅} and

Bk(r∗, η∗) = {(r′, η′) |(a) r′ <P r∗;

(b) Pos(r′)η′ ⊆M andNeg(r′)η′ ∩ λM0(Γk(P)M) = ∅;

(c) (r′, η′) /∈ Γk(P)M}

for k ≥ 1. Intuitively,Bk(r∗, η∗) comprises the pairs(r′, η′) that blocks(r∗, η∗) from

being applied at stagek + 1. Now, the following Claims 1, 2 and 3 reveal important

properties of the setBk(r∗, η∗).

Claim 1 For all k′ ≥ k ≥ 1, we haveBk(r∗, η∗) ⊇ Bk′(r∗, η∗). In other words, we

do not gain anymore pairs(r′, η′) blocking (r∗, η∗) from being applied as we

progress along the stages ofΓk′(P)M.

Proof of Claim 1 For simplicity we assume thatk ≥ 1 (the case where we allow

k = 0 immediately follows). Setk′ to be such thatk′ ≥ k and let(r′′, η′′) ∈

Bk′(r∗, η∗). Then by the definition ofBk′(r∗, η∗), we have:

(a) r′′ <P r∗;

(b) Pos(r′′)η′′ ⊆M andNeg(r′′)η′′ ∩ λM0(Γk′(P)M) = ∅;

(c) (r′′, η′′) /∈ Γk′(P)M.

Then by the monotonicity ofΓk′(P)M for k′ ≥ k (i.e.,Γk(P)M ⊆ Γk′(P)M),

Page 157: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 148

we also have:

(a) r′′ <P r∗;

(b) Pos(r′′)η′′ ⊆M andNeg(r′′)η′′ ∩ λM0(Γk(P)M) = ∅;

(c) (r′′, η′′) /∈ Γk(P)M,

and hence, that(r′′, η′′) ∈ Bk(r∗, η∗). This ends the proof of Claim 1.

Claim 2 For each(r′, η′) ∈ Bk(r∗, η∗), Bk(r′, η′) ⊆ Bk(r∗, η∗). That is, for each

pairs (r′, η′) ∈ Bk(r∗, η∗) blocking (r∗, η∗) from being applied at stagek +

1, the pairs(r′′, η′′) blocking (r′, η′) in turn at stagek + 1, are themselves in

Bk(r∗, η∗). Intuitively, this impliesBk(r∗, η∗) satisfies some form of closure.

Proof of Claim 2 Set(r′, η′) ∈ Bk(r∗, η∗) and let(r′′, η′′) ∈ Bk(r′, η′). Then we

haver′ <P r∗ and r′′ <P r′ by the definitions ofBk(r∗, η∗) andBk(r′, η′)

respectively. Then by transitivity, we also haver′′ <P r∗. Hence, by the defini-

tion of Bk(r∗, η∗), we also have(r′′, η′′) ∈ Bk(r∗, η∗). This ends the proof of

Claim 2.

Claim 3 Bk(r∗, η∗) = ∅ for some ordinalk ≥ 1. That is, eventually, there will be

some stagek ≥ 1 such that there will be no more pairs(r′, η′) blocking(r∗, η∗)

from being applied. First, we provide the intuition of the proof of Claim 3.

Basically, under the assumptionΓ∞(P)M =M, we prove by showing that for

all the pairs(r′, η′) ∈ Bk(r∗, η∗), there will be somel > 0 such that either

Γk+l(P)M will “defeat” (r′, η′) (i.e., as inNeg(r′)η′ ∩ Γk+l(P)M 6= ∅) or gets

“eaten up” by it (i.e., as in(r′, η′) ∈ Γk+l(P)M).

Proof of Claim 3 First, we show for allk ≥ 1, Bk(r∗, η∗) 6= ∅ implies there exist

somel > 0 such thatBk(r∗, η∗) ⊃ Bk+l(r∗, η∗). Thus, for ak ≥ 1, let (r′, η′) ∈

Bk(r∗, η∗). Moreover, without loss of generality, assume that for all(r′′, η′′) ∈

Bk(r∗, η∗), we haver′′ 6<P r′ (i.e., note that due to the finiteness ofΠ, we will

always have these pairs(r′, η′) ∈ Bk(r∗, η∗)). Then we haveBk(r′, η′) = ∅.

This is because ifBk(r′, η′) 6= ∅ and let(r′′, η′′) ∈ Bk(r′, η′), we will have

r′′ <P r′ by the definition ofBk(r′, η′), which contradicts the initial assumption

about the pair(r′, η′). Now, as(r′, η′) ∈ Bk(r∗, η∗), then by the definition of

Page 158: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 149

Bk(r∗, η∗), we havePos(r′)η′ ⊆ M andNeg(r′)η′ ∩ λM0(Γk(P)M) = ∅.

Also, sinceλM0(Γ∞(P)M) =M by assumption, then for somel ≥ 0, we have

Pos(r′)η′ ⊆ λM0(Γk+l(P)M). Now there can only be two possibilities:

Case 1Neg(r′)η′ ∩M = ∅.

Then since we also haveBk+l(r′, η′) = ∅ by Claim 1 (i.e., sinceBk(r′, η′) =

∅), then we have(r′, η′) ∈M0(Γk+l+1(P)M by the definition ofΓk+l+1(P)M

since(r′, η′) will now be applicable at this stage (i.e., since there are no

pairs (r′′, η′′) blocking (r′, η′) from application at stagek + l + 1 since

Bk+l(r′, η′) = ∅). Then by the definition ofBk+l+1(r∗, η∗), we have

(r′, η′) /∈ Bk+l+1(r∗, η∗), which impliesBk(r∗, η∗) 6= Bk+l+1(r∗, η∗).

Then since by Claim 1, we haveBk(r∗, η∗) ⊇ Bk+l+1(r∗, η∗), then we

must haveBk(r∗, η∗) ⊃ Bk+l+1(r∗, η∗).

Case 2Neg(r′)η′ ∩M 6= ∅.

Then there could be two further possibilities:

Subcase 1Neg(r′)η′ ∩ λM0(Γk+l(P)M) 6= ∅.

Then we have(r′, η′) /∈ Bk+l(r∗, η∗) by the definition ofBk+l(r∗, η∗).

Moreover, since(r′, η′) ∈ Bk(r∗, η∗), then it must be thatk + l > k,

which impliesl > 0. Hence, similarly to above, we have also that

Bk(r∗, η∗) ⊃ Bk+l(r∗, η∗) with l > 0.

Subcase 2Neg(r′)η′ ∩ λM0(Γk+l(P)M) = ∅.

Then sinceλM0(Γ∞(P)M) = M by assumption, there exist some

m > 0 such thatNeg(r′)η′ ∩ λM0(Γk+l+m(P)M) 6= ∅, which implies

(r′, η′) /∈ Bk+l+m(r∗, η∗) by the definition ofBk+l+m(r∗, η∗). Hence,

in a similar manner to above, we haveBk(r∗, η∗) ⊃ Bk+l+m(r∗, η∗)

with m > 0.

Therefore, we have that for allk ≥ 1, Bk(r∗, η∗) 6= ∅ implies there exist some

l > 0 such thatBk(r∗, η∗) ⊃ Bk+l(r∗, η∗). Now we show for allk ≥ 1 andl >

0, Bk(r∗, η∗) ⊃ Bk+l(r∗, η∗) impliesΓk(P)M ⊂ Γk+l(P)M. Hence, assume

thatBk(r∗, η∗) ⊃ Bk+l(r∗, η∗) and let(r′, η′) ∈ Bk(r∗, η∗) where(r′, η′) /∈

Bk+l(r∗, η∗). Then by the definition ofBk(r∗, η∗) we have:

1. r′ <P r∗;

2. Pos(r′)η′ ⊆M andNeg(r′)η′ ∩ λM0(Γk(P)M) = ∅;

Page 159: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 150

3. (r′, η′) /∈ Γk(P)M.

Also, since(r′, η′) /∈ Bk+l(r∗, η∗), then by the definition ofBk+l(r∗, η∗), we

have either:

1. Neg(r′)η′ ∩ λM0(Γk+l(P)M) 6= ∅ or

2. (r′, η′) ∈ Γk+l(P)M.

In either of these two aforementioned possibilities, it canbe seen thatΓk(P)M 6=

Γk+l(P)M. Therefore, sinceΓk(P)M ⊆ Γk+l(P)M, then we must haveΓk(P)M ⊂

Γk+l(P)M. Hence, from this, we obtain the equivalent true statement (i.e., its

contrapositive): if for allk ≥ 1 and l > 0 we haveΓk(P)M = Γk+l(P)M,

thenBk(r∗, η∗) = Bk+l(r∗, η∗). Now, by the monotonicity ofΓk(P)M for

all k ≥ 1 and its guaranteed convergence, it follows that there existsome

K ≥ 1 such that for alll > 0, ΓK(P)M = ΓK+l(P)M (i.e., reached its con-

vergent point). Then from above, we also haveBK(r∗, η∗) = BK+l(r∗, η∗).

Then since this holds for alll > 0, we must haveBK(r∗, η∗) = ∅ for if

BK(r∗, η∗) 6= ∅, then this will contradict the above result that there exist

somel > 0 for which BK(r∗, η∗) ⊃ BK+l(r∗, η∗) (i.e., which also means

BK(r∗, η∗) 6= BK+l(r∗, η∗)). This ends the proof of Claim 3.

Therefore, by Claim 3, there exist some ordinaln′ > n for whichBn′

(r, η) = ∅. Then

at this stage (i.e.,n′), there would be no other pairs(r′, η′) blocking(r, η) from being

applied. Now, by the monotonicity ofΓn(P)M for all n ≥ 0, we havePos(r)η ⊆

λM0(Γn′

(P)M) andNeg(r)η ∩ M = ∅. Then this implies(r, η) ∈ Γn′+1(P)M,

which further impliesHead(r)η ∈ λM0(Γ∞(P)M). This then contradicts the initial

assumptionHead(r)η /∈ λM0(Γ∞(P)M). Therefore, we must haveMt+1(Π) ⊆

λM0(Γ∞(P)M).

This completes our proof ofM∞(Π) ⊆ λM0(Γ∞(P)M). �

A.2.2 Proof of Theorem 6

(=⇒) SupposeM is a preferred answer set ofP. According to Definitions 20 and 21,

we construct a setS of propositional atoms from the expansionM′ of M as described

earlier, and show thatS is a preferred answer set for the grounded preferred programP∗

Page 160: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 151

andS ∩M =M. LetP ′ = (Π′, <P′

) be the tagged preferred program obtained fromP,

then the construction ofS is as follows:

1. For each predicateP ∈ τ(Π′) other than=, if P (a) ∈ PM′

, thenP (a) ∈ S (here

P (a) is treated as a propositional atom);

2. For each elementa ∈ Dom(M′), propositional atoma = a is in S (note that

Dom(M) = Dom(M′));

3. S does not contain any other atoms.

Clearly, if we view all elements occurringM’s relations as propositional atoms, we have

S ∩M =M′ ∩M =M.

Now we show thatS is a preferred answer set ofP∗. For each ruler ∈ Π, we denote

rT ∈ Π′ to be the tagged rule obtained fromr by adding the corresponding atomTag(x)

to r’s positive body (see earlier definition). Also note that sinceDom(M) = Dom(M′),

each assignmentη ofM is also an assignment ofM′. Then from the definition ofP∗ and

whereP∗ = (Ground (Π)M, <P∗

), we can see that for eachr ∈ Π, assignmentη ofM

andt (t = 0, 1, · · · ), (r, η) ∈ Γt(P)M iff rTη ∈ ∆t(P∗)S. On the other hand, since the

only extra rules in∆∞(P∗)S are those of the formsTagi(a)← anda = a←, and whileS

contains all atoms of the formsTagi(a) anda = a, thenS is exactly the set{Head(rTη) |

rTη ∈ ∆∞(P∗)S} ∪ {Tagi(a), a = a | for all correspondingi’s, a’s anda’s}. This means

thatS is a preferred answer set ofP∗ = (Ground(Π)M,<P∗

).

The other direction can be proved with similar arguments.�

A.2.3 Proof of Lemma 3

(=⇒) SupposeS is a preferred answer set ofP. If r ∈ ∆∞(P)S, then according to

Definition 21, we know thatPos(r) ⊆ Head(∆∞(P)S) andNeg(r) ∩ S = ∅. Since

Head(∆∞(P)S) = S, this implies thatr is a generating rule ofS. Now we assume

that r is a generating rule ofS. We will show thatr ∈ ∆∞(P)S. We prove this re-

sult by induction on the sequence of rules under ordering<P . Firstly, consider any rule

r ∈ S where there does not exist any other rulesr′ in Π such thatr′ <P r. Accord-

ing to Definition 21,r ∈ ∆0(P)S if Pos(r) = ∅, otherwiser ∈ ∆1(P)S. Now we

assume that for all generating rulesr′ of S such thatr′ <P r, r′ ∈ ∆∞(P)S. Suppose

Page 161: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 152

that r 6∈ ∆∞(P)S. Then for allt, we have thatr 6∈ ∆t(P)S. That is, for allt, either

(1) Pos(r) 6⊆ Head(∆t−1(P)S) or Neg(r) ∩ S 6= ∅; or (2) there exist somer′ ∈ Π

such thatr′ <P r, r′ 6∈ ∆t−1(P)S, Pos(r′) ⊆ S andNeg(r′) ∩ Head(∆t−1(P)S). Since

r is a generating rule ofS andS = Head(∆∞(P)S), it is obvious that case (1) cannot

occur. So it has to be case (2). In this case, we can select a sufficient big t such that

for any othert′ wheret′ > (t − 1), no more rules fromΠ can be added into∆t′(P)S,

i.e., ∆t−1(P)S = ∆t′(P)S for all t′ > (t − 1)10. Therefore, for this particulart, we

can find somer′ ∈ Π such thatr′ <P r andr′ /∈ ∆t−1(P)S. SincePos(r′) ⊆ S and

Neg(r′)∩Head(∆t−1(P)S) = Neg(r′)∩Head(∆∞(P)S) = Neg(r′)∩S = ∅, it follows

thatr′ is a generating rule ofS. Since according to our inductive assumption, we had that

r′ ∈ ∆∞(P)S, then this is a contradiction.

(⇐=) For eachr ∈ ∆∞(P)S, r is a generating rule ofS, soPos(r) ⊆ S andNeg(r)∩

S = ∅. Also, sinceS is an answer set ofΠ, this followsHead(r) ∈ S. SoHead(∆∞(P)S) ⊆

S. Now we showS ⊆ Head(∆∞(P)S). Suppose this is not the case. Then there must

exist someHead(r) ∈ S such thatr 6∈ ∆∞(P)S. From the condition, we know thatr is

a generating rule ofS. So there is a ruler ∈ Π wherePos(r) ⊆ S, Neg(r) ∩ S = ∅ but

Head(r) 6∈ S. This is in contradiction with the fact thatS is an answer set ofΠ. Therefore,

we haveS = Head(∆∞(P)S). SoS is an answer set ofP = (Π, <P). �

A.2.4 Proof of Lemma 4

We show thatS is a preferred answer set ofP = (Π, <P). We first prove that ifr ∈

∆∞(P)S, thenr is a generating rule ofS. We prove this by induction ont. Consider

∆0(P)S. Since for allr ∈ ∆0(P)S, Pos(r) = ∅ andNeg(r) ∩ S = ∅. This means that

r is a generating rule ofS. SinceS is an answer set ofΠ, this impliesHead(r) ∈ S.

Suppose for allt that r ∈ ∆t(P)S implies r is a generating rule ofS, which implies

Head(∆t(P)S) ⊆ S. Now we consider∆t+1(P)S. According to the definition, ifr 6∈

∆t(P)S butr ∈ ∆t+1(P)S, thenPos(r) ⊆ Head(∆t(P)S) andNeg(r)∩S = ∅. From the

induction assumption, we havePos(r) ⊆ Head(∆t(P)S) ⊆ S. Sor is also a generating

rule ofS, and henceHead(r) ∈ S.

Now we show that under the given conditions of this lemma, ifr is a generating rule

10Note that from the grounded preferred logic program definition (i.e., Definition 20), this is always possi-ble.

Page 162: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 153

of S, thenr ∈ ∆∞(P)S. We prove this by induction on<P . Firstly, suppose there does

not exist a ruler∗ ∈ Π such thatr∗ <P r andr∗ is a generating rule ofS. Sincer is

a generating rule andS is an answer set ofΠ, it must be the case thatPos(r) = ∅ and

hence, thatr ∈ ∆0(P)S. Now we assume that for all generating rulesr∗ such thatr∗ <P r

and thoser∗ satisfy the condition of this lemma, thatr∗ ∈ ∆∞(P)S. Now we considerr.

Since for anyr′ wherer <P r′ andHead(r′) ∩ (Pos(r′) ∪ Neg(r′)) 6= ∅ we have thatr′

is not a generating rule ofS, then there must exist generating rulesr1, · · · , rk of S such

thatri <P r (i = 1, · · · , k), Pos(r) ⊆⋃k

i=1Head(ri) andNeg(r) ∩⋃k

i=1Head(ri) = ∅.

Now, according to the induction assumption, theser1, · · · , rk are in∆∞(P)S. So there

exist some certaint for which we havePos(r) ⊆ Head(∆t(P)S) andNeg(r) ∩ S = ∅

(this is due to the fact thatr is a generating rule ofS). Therefore, from the definition of

∆∞(P)S (see Definition 21), we know that ifr 6∈ ∆∞(P)S, then for allt, there must exist a

ruler′ such thatr′ <P r, r′ 6∈ ∆t−1(P)S andPos(r′) ⊆ S andNeg(r′)∩Head(∆t−1(P)S).

By selecting a sufficient bigt, we would have∆t(P)S = ∆∞(P)S. This implies that there

exist somer′ such thatr′ <P r, r′ 6∈ ∆∞(P)S andr′ is a generating rule ofS. This is in

contradiction with our inductive assumption. Sor must be in∆t(P)S for somet. That is,

r ∈ ∆∞(Π)S.

Finally, from Lemma 3, we know thatS is also a preferred answer set ofP = (Π, <P).

This completes our proof.�

A.2.5 Proof of Theorem 10

To prove this theorem, we will use a result from [ZZ10] thatM∞(Π) = M iff M is

an answer set ofΠ. Thus, we prove the equivalent statement:M∞(Π) = M iff M |=

∃−→<∀SϕΠ(

−→<,S).

(=⇒) AssumeM∞(Π) =M. For t ≥ 0, define the operator

(M∗)t(Π) : 2Σ(Π)M −→ 2Σ(Π)M

as

(M∗)t(Π) = {(r, η) | Pos(r)η ⊆Mt+1(Π) andNeg(r)η ∩M = ∅}

Page 163: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 154

11. Then sinceM∞(Π) = M by assumption, we also have that(M∗)∞(Π) = Γ(Π)M.

Now, for t ≥ 0, setΛt(Π)M : 2Σ(Π)M −→ 2Σ(Π)M to be an operator defined inductively as

follows:

Λ0(Π)M = (M∗)0(Π);

Λt+1(Π)M = (M∗)t+1(Π) \ (M∗)t(Π).

Then clearly, we also have⋃

t≥0 Λt(Π)M = (M∗)∞(Π). Moreover, by the definition of

ΛtM(Π), it is not difficult to see that the setsΛ0(Π)M,Λ

1(Π)M, · · · ,Λ∞(Π)M

12 partitions

(M∗)∞(Π). Now we construct awell-orderedrelationW = (Γ(Π)M, <W) on the set

Γ(Π)M as follows:

1. For eachΛtM(Π), by thewell-ordering theorem(every set can be well-ordered), there

exist a well-ordering on the elements ofΛtM(Π). Set such a well-ordering asWt =

(ΛtM(Π), <Wt).

2. Then we define the well-orderW = (Γ(Π)M, <W) onΓ(Π)M by setting

<W= (⋃

t≥0

<Wt) ∪ {〈(r1, η1), (r2, η2)〉 |(r1, η1) ∈ Λt1M(Π), (r2, η2) ∈ Λt2

M(Π),

with t1 < t2}.

Incidentally, this simply follows from the fact that thesumand productsof well-

ordered types are themselves well-ordered [End77].

Now we denote by∀SϕΠ(S) as the sentence obtained from∀SϕΠ(−→<,S) by treating the

existentially quantified predicate variables in−→< as predicate constants. Then to show

M |= ∃−→<∀SϕΠ(

−→<,S), we show that there exist an expansionM′ ofM such thatM′ |=

∀SϕΠ(S). In the following, we denote the treatment of each predicatevariables,<r1r2, as

a predicate constant by simply denoting it as<r1r2 (just removing the ‘ ’ accent). Now

setM′ to be an expansion ofM such thatM′ is of the extended signatureτ(Π) ∪ {<r1r2|

11Note that(M∗)t(Π) ⊆ Σ(Π)M and is not an actualτ -structure likeMt(Π).12Here∞ denotes an arbitraryorder-type.

Page 164: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 155

r1, r2 ∈ Π} ofM and where each predicate symbol<r1r2 (for r1, r2 ∈ Π) is interpreted as:

<M′

r1r2= {〈η1(u1), . . . , η1(uk), η2(v1), . . . , η2(vl)〉 |〈u1, . . . , uk〉 = xr1 , 〈v1, . . . , vl〉 = xr2 ,

and(r1, η1) <W (r2, η2)}

withW the well-order onΓ(Π)M as defined above. Now, through the following Claims 1

and 2, we showM′ |= ∀SϕPROΠ (S) andM′ |= ϕCOMP

Π respectively, so thatM′ |= ∀SϕΠ(S).

Claim 1: M′ |= ∀SϕPROΠ (S).

Proof of Claim 1: To prove this claim, it is sufficient to show the following:

1.M′ |=∧

r1,r2,r3∈Π

∀xr1xr2xr3(<r1r2 (xr1 ,xr2)∧ <r2r3 (xr2 ,xr3)→<r1r3 (xr1 ,xr3));

2.M′ |=∧

r1,r2∈Π

∀xr1xr2(<r1r2 (xr1 ,xr2)→ ¬ <r2r1 (xr2 ,xr1));

3.M′ |=∧

r1,r2∈Π

∀xr1xr2(<r1r2 (xr1 ,xr2)→ ϕGENr1

(xr1) ∧ ϕGENr2

(xr2));

4.M′ |=∧

r∈Π

∀xr(ϕGENr (xr)→ ϕSUP

r (xr))

5.M′ |= ∀SϕWELLORΠ (S),

Now we show each of the above statements.

1. M′ |=∧

r1,r2,r3∈Π∀xr1xr2xr3(<r1r2 (xr1 ,xr2)∧ <r2r3 (xr2 ,xr3)→<r1r3 (xr1 ,xr3)):

Suppose for some assignmentυ, we haveM′ |=<r1r2 (ar1 , ar2)∧ <r1r2 (ar2 , ar3)

such thatar1 , ar2 andar3 denotes the tuples obtained fromxr1 , xr2 andxr3 re-

spectively by replacing each of the variablex in xr with υ(x). We now show

M′ |=<r1r3 (ar1 , ar3). From the definition of<M′

r1r2, we have that there exist

(r1, η1) ∈ Γ(Π)M and(r2, η2) ∈ Γ(Π)M with (r1, η1) <W (r2, η2) such that

if 〈u1, . . . , uk〉 = xr1 and〈v1, . . . , vl〉 = xr2 , then〈η1(u1), . . . , η1(uk)〉 = ar1

and〈η2(v1), . . . , η2(vl)〉 = ar2 . Similarly, by the definition of<M′

r2r3, there exist

(r2, η′2) ∈ Γ(Π)M and(r3, η3) ∈ Γ(Π)M with (r2, η

′2) <

W (r3, η3) such that if

〈w1, . . . , wm〉 = xr3 then〈η′2(v1), . . . , η′2(vl)〉 = ar2 and〈η3(w1), . . . , η3(wm)〉

= ar3 . Then, since〈η′2(v1), . . . , η′2(vl)〉 = 〈η2(v1), . . . , η2(vl)〉, we must have

Page 165: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 156

η′2 = η2. Then we have(r1, η1) <W (r3, η3) by transitivity since(r2, η2) =

(r2, η′2). Then from the definition of<M

r1r3, it follows that 〈ar1 , ar3〉 ∈<

M′

r1r3,

and hence, thatM′ |=<r1r3 (ar1 , ar3).

2. M′ |=∧

r1,r2∈Π∀xr1xr2(<r1r2 (xr1 ,xr2)→ ¬ <r2r1 (xr2 ,xr1)):

On the contrary, assume for some assignmentυ, we haveM′ |=<r1r2 (ar1 , ar2)

∧ <r2r1 (ar2 , ar1). Then we also have<r1r1 (ar1 , ar1) by the transitivity axiom

(which was already shown above to be satisfied byM′). Then by the defini-

tion of <M′

r1r1, there exist(r1, η1) ∈ Λt1(Π)M and (r1, η2) ∈ Λt2(Π)M with

t1 < t2 such that if〈u1, . . . , uk〉 = xr1 , we have〈η1(u1), . . . , η1(uk)〉 = ar1

and〈η2(u1), . . . , η2(uk)〉 = ar1 . Then this impliesη1 = η2, and since there is a

uniquet for which (r1, η) ∈ Λt(Π)M for each(r1, η), then it must also be that

t1 = t2. Then this is a contradiction sincet1 < t2.

3. M′ |=∧

r1,r2∈Π∀xr1xr2(<r1r2 (xr1 ,xr2)→ ϕGEN

r1(xr1) ∧ ϕ

GENr2

(xr2)):

This follows from the interpretations<M′

r1r2of the predicates<r1r2 (for r1, r2 ∈

Π) and where it is a “representation” of the well-orderW = (Γ(Π)M, <W) on

Γ(Π)M).

4. M′ |=∧

r∈Π ∀xr(ϕGENr (xr)→ ϕSUP

r (xr)):

Suppose for some assignmentυ, we haveM′ |= ϕGENr (ar) such thatar is the

tuple obtained fromxr via υ as above. Then we show

M′ |=∧

P (aP)∈Pos(r),P∈Pint(Π)

r′∈Π,Head(r′)=P (yP)

∃xr′(<r′r (xr′ , ar) ∧ aP = yP)

Now, sinceM′ |= ϕGENr (ar), then by the definition ofM′, it also follows

thatM′ ↾τ(Π)= M |= ϕGENr (ar) (sinceϕGEN

r (xr) only involves those sym-

bols occurring inτ(Π)). Then there exist an assignmentη such that with

Page 166: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 157

〈u1, . . . , uk〉 = xr, we have〈η(u1), . . . , η(uk)〉 = ar and wherePos(r)η ⊆M

andNeg(r) ∩ M = ∅. Moreover, there must be the least staget for which

Pos(r)η ⊆ Mt(Π). Now let P (aP) ∈ Pos(r)η whereP ∈ Pint(Π). Then

there must also be some least staget′ such that for some ruler′ and corre-

sponding assignmentη′, we haveHead(r′)η′ = P (aP), Pos(r′)η′ ⊆ Mt′(Π)

andNeg(r′)η′ ∩M = ∅ (i.e., the least stage that derivesP (aP)). Moreover,

sinceP (aP) ∈ Mt(Π) (i.e., sinceP (aP) ∈ Pos(r)η ⊆ M

t(Π)), thent′ < t

for if t = t′, this will contradict the assumption thatP (aP) ∈ Mt(Π) since

this impliesP (aP) /∈ Mt(Π) (i.e., ast′ is the least stage that derivesP (aP)).

Then by the definitions ofΛt′+1M (Π) andΛt+1

M (Π), we have(r′, η′) ∈ Λt′+1M (Π)

and(r, η) ∈ Λt+1M (Π). Then ast′ + 1 < t + 1, by the definition of<W , we

also have(r′, η′) <W (r, η). Then by the interpretation of<M′

r′r , if we let

ar′ = 〈η′(v1), . . . , η′(vl)〉 such that〈v1, . . . , vl〉 = xr′, then〈ar′ , ar〉 ∈<

M′

r′r .

Then this implies thatM′ |=<r′r (ar′ , ar) ∧ aP = aP (whereaP is the projec-

tion underyP from the tuplear′).

5. M′ |= ∀SϕWELLORΠ (S). That is, we show thatM′ satisfies the SO sentence

∀S((∧

r∈Π

∀xr(Sr(xr)→ ϕGENr (xr))) ∧ (

r∈Π

∃xrSr(xr))→

r′∈Π

∃xr′(Sr′(xr′) ∧ ∀yr′(Sr′(yr′) ∧ yr′ 6= xr′ →<r′r′ (xr′ ,yr′))

∧∧

r′′∈Π,r′′ 6=r′

∀xr′′(Sr′′(xr′′)→<r′r′′ (xr′ ,xr′′)))) :

This simply follows from the assumption thatW is a well-ordering onΓ(Π)M

since a well-order implies that each non-empty subset contains a least ele-

ment. Indeed,∧

r∈Π ∀xr(Sr(xr) → ϕGENr (xr)) encodes the condition that we

only consider tuples corresponding to the generating rulesin the well-order,∨

r∈Π ∃xrSr(xr) encodes the condition that the subset ofΓ(Π)M that we are

Page 167: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 158

considering is non-empty, and lastly,

r′∈Π

∃xr′(Sr′(xr′) ∧ ∀yr′(Sr′(yr′) ∧ yr′ 6= xr′ →<r′r′ (xr′ ,yr′))

∧∧

r′′∈Π,r′′ 6=r′

∀xr′′(Sr′′(xr′′)→<r′r′′ (xr′ ,xr′′)))

encodes the condition that for such a (non-empty) subset, a least element exists.

This ends the proof of Claim 1.

Claim 2: M′ |= ϕCOMPΠ .

Proof of Claim 2: From [ZZ10],M∞(Π) =M iff M |= SM(Π), whereSM(Π) is the

SO sentence (1.5). Moreover, ifM |= SM(Π), thenM |= ϕCOMPΠ . This ends the

proof of Claim 2.

So we have shown thatM |= ∃−→<∀SϕΠ(−→<,S).

(⇐=) Now let us assumeM |= ∃−→<∀SϕΠ(

−→<,S). Then for some expansionM′ of

M of the extended signatureτ(Π) ∪ {<r1r2| r1, r2 ∈ Π}, we haveM′ |= ∀SϕΠ(S)

where∀SϕΠ(S) is the sentence obtained from∀SϕΠ(−→<,S) by simply treating the predicate

variables in−→< as predicate constants. To showM∞(Π) = M, we showM∞(Π) ⊆ M

andM⊆M∞(Π). First we showM∞(Π) ⊆M by induction.

Basis Clearly,M0(Π) ⊆ M by the definition ofM0(Π) (i.e., only considering the inter-

pretations of the external predicates ofΠ).

Step Assume that fort′ ≤ t, we haveMt′(Π) ⊆M.

Then letP (aP) ∈Mt+1(Π) such thatP (aP) /∈M

t(Π) (i.e., for if P (aP) ∈Mt(Π)

then the result is clear by the inductive hypothesis). We will now showP (aP) ∈M.

Indeed, sinceP (aP) ∈ Mt+1(Π) with P (aP) /∈ Mt(Π), then there exist a rule

r ∈ Π and an assignmentη such thatHead(r)η = P (aP), Pos(r)η ⊆ Mt(Π) and

Neg(r)η ∩M = ∅. Then sinceMt(Π) ⊆ M by assumption,M′ ↾τ(Π)= M and

M |= ϕCOMPΠ (i.e., sinceϕCOMP

Π only involves those symbols inτ(Π)), it follows that

P (aP) ∈M.

Page 168: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 159

Thus we have shownM∞(Π) ⊆ M. Next we showM ⊆ M∞(Π). Indeed, since

M′ |= ∀SϕPROΠ (S), set the well-orderW = (Dom(W), <W) such that:

Dom(W) =Γ(Π)M;

<W={〈(r1, η1), (r2, η2)〉 | r1, r2 ∈ Π, η1 andη2 are assignments such that if

xr1 = 〈u1, . . . , uk〉 andxr2 = 〈v1, . . . , vl〉 then

〈η1(u1), . . . , η1(uk), η2(v1), . . . , η2(vl)〉 ∈<M′

r1r2}.

Now, for an elemente ∈ Dom(W), we define the operatorWe(Π) inductively as follows:

WBOT(W)(Π) ={Head(r)η | (r, η) = BOT(W)};

WSUCC(e)(Π) =We(Π) ∪ {Head(r)η | (r, η) = SUCC(e)},

where: (1)BOT(W) denotes the least element ofDom(W) under the well-orderW; (2)

SUCC(e) the successor element ofe underW; (3) andORD(W), the order type ofW (i.e.,

that is, ORD(W) is equal to thesizeof Dom(W)). AsW is a well-order onDom(W),

we usetransfinite induction[End77] on the setDom(W) to show thatWORD(W)(Π) ⊆

M∞(Π).

Basis Without loss of generality, assumeBOT(W) = (r, η). Then sinceM′ |= ∀SϕPROΠ (S),

there can only be two possibilities:

Case 1Pred(Pos(r)) ∩ Pint(Π) = ∅ (i.e., nointensionalpredicates).

In this case, since(r, η) ∈ Dom(W) = Γ(Π)M (a generating rule) andM |=

ϕCOMPΠ (which implies thatM′ ↾τ(Π)= M is logically closed underΠ), then it

follows from the definition ofM1(Π) thatHead(r)η ∈ M1(Π) ⊆ M∞(Π).

Hence, by the definition ofWBOT(W)(Π), we haveWBOT(W)(Π) = {Head(r)η} ⊆

M∞(Π).

Case 2Pred(Pos(r)) ∩ Pint(Π) 6= ∅.

Then since(r, η) ∈ Γ(Π)M and

M′ |=∧

r∈Π

∀xr(ϕGENr (xr)→ ϕSUP

r (xr))

Page 169: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 160

(i.e., which obeys the notion of a support for each intensional predicate in-

stance in the positive body from a preceding element), then this contradicts the

assumption(r, η) is the bottom element ofDom(W) under<W . Therefore, we

cannot havePred(Pos(r)) ∩ Pint(Π) 6= ∅.

Step Assume forBOT(W) ≤W e′ ≤W e, we haveWe′(Π) ⊆M∞(Π).

We showWSUCC(e)(Π) ⊆ M∞(Π). Hence, assume thatSUCC(e) = (r, η). In a

similar manner to the base case, there can only be two possibilities:

Case 1Pred(Pos(r)) ∩ Pint(Π) = ∅.

Then in a similar manner to Case 1 of the Basis above, it follows thatHead(r)η ∈

M1(Π) ⊆ M∞(Π), which impliesWSUCC(e)(Π) = We(Π) ∪ {Head(r)η} ⊆

M∞(Π).

Case 2Pred(Pos(r)) ∩ Pint(Π) 6= ∅.

Then as

M′ |=∧

r∈Π

∀xr(ϕGENr (xr)→ ϕSUP

r (xr))

(each intensional predicate instances in the positive bodyis supported by a

preceding element), we havePos(r)η ⊆ We(Π) by the definition ofWe(Π).

Hence, asWe(Π) ⊆M∞(Π) by assumption, thenPos(r)η ⊆M∞(Π). Thus,

there must be the least staget for whichPos(r)η ⊆Mt(Π). Then by the defini-

tion ofMt+1(Π) and as(r, η) ∈ Γ(Π)M (i.e., which impliesNeg(r)η∩M = ∅

as(r, η) is a generating rule underM), it follows thatHead(r)η ∈Mt+1(Π) ⊆

M∞(Π) and hence, thatWSUCC(e)(Π) =We(Π) ∪ {Head(r)η} ⊆ M∞(Π).

Thus, to showM⊆M∞(Π), it will now be sufficient to only show thatM⊆WORD(W)(Π)

∪M1(Π) holds sinceWORD(W)(Π)∪M1(Π) ⊆M∞(Π) (i.e., since we had already verified

thatWORD(W)(Π) ⊆M∞(Π) and whereM1(Π) ⊆M∞(Π)). Thus, letP (aP) ∈ M such

that P ∈ Pint(Π) (i.e., for if P /∈ Pint(Π), then it immediately follows thatP (aP) ∈

M0(Π) ⊆ M1(Π)). AsM′ |= ϕCOMPΠ impliesM |= ϕCOMP

Π (i.e., sinceϕCOMPΠ only involves

the symbols occurring inτ(Π)), then for some ruler ∈ Π and assignmentη, we have

Head(r)η = P (aP), Pos(r)η ⊆ M andNeg(r)η ∩M = ∅. Now, about the ruler, there

can only be two possibilities:

Page 170: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 161

Case 1Pred(Pos(r)) ∩ Pint(Π) = ∅.

Then by the definition ofM1(Π), we haveHead(r)η = P (aP) ∈ M1(Π) ⊆

WORD(W)(Π) ∪M1(Π).

Case 2Pred(Pos(r)) ∩ Pint(Π) 6= ∅.

Then as(r, η) ∈ Γ(Π)M and sinceDom(W) = Γ(Π)M, it is clear that(r, η) ∈

Dom(W). Hence, by the definition ofWORD(W)(Π), we haveP (aP) ∈ WORD(W)(Π) ⊆

WORD(W)(Π) ∪M1(Π).

Therefore, we haveM⊆M∞(Π). This finally completes the proof of this theorem.�

A.2.6 Proof of Theorem 11

(=⇒) AssumeλM0(Γ∞(P)M) =M (i.e.,M is a preferred answer set ofP = (Π, <P)).

We showM |= ∃−→<∀SϕP(−→<,S) in two steps:

1. GivenλM0(Γ∞(P)M) =M, we show there exist a well-orderW = (Γ(Π)M, <W)

on the setΓ(Π)M called thepreference preserving well-order, satisfying the follow-

ing conditions. For each(r, η) ∈ Γ(Π)M:

(a) Pos(r)η ⊆M0(Π) ∪ {Head(r′)η′ | (r′, η′) <W (r, η)};

(b) for each ruler′ <P r and assignmentη′:

i. (r′, η′) ∈ Γ(Π)M implies(r′, η′) <W (r, η);

ii. (r′, η′) /∈ Γ(Π)M implies that either:

A. Pos(r′)η′ 6⊆ M or

B. Neg(r′)η′ ∩ (M0(Π) ∪ {Head(r′′)η′′ | (r′′, η′′) <W (r, η)}) 6= ∅;

2. Based on the well-orderW on Γ(Π)M, we construct an expansionM′ of M and

show thatM′ |= ∀SϕP(S) where∀SϕP(S) is the sentence obtained fromM |=

∀SϕP(−→<,S) by treating the predicate variables in−→< as constants.

Now for the first part, we start with the following claim.

Claim 1: Γ∞(P)M = Γ(Π)M. That is,Γ∞(P)M contains exactly the generating rules.

Page 171: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 162

Proof of Claim 1: SinceM is a preferred answer set ofP, then by Theorem 7,(r, η) ∈

Γ∞(P)M iff r is a generating rule ofM underη. This completes the proof of Claim

1.

Now, based onΓ∞(P)M, we show by induction ont for t ≥ 0 that there exist a well-

orderW = (Γt(P)M, <W) on Γt(P)M with the following properties. For each(r, η) ∈

Γt(P)M:

1. Pos(r)η ⊆M0(Π) ∪ {Head(r′)η′ | (r′, η′) <W (r, η)};

2. for each ruler′ <P r and assignmentη′:

(a) (r′, η′) ∈ Γt(P)M implies(r′, η′) <W (r, η);

(b) (r′, η′) /∈ Γ(P)M implies that either:

i. Pos(r′)η′ 6⊆ M or

ii. Neg(r′)η′ ∩ (M0(Π) ∪ {Head(r′′)η′′ | (r′′, η′′) <W (r, η)}) 6= ∅.

Thus ultimately, sinceΓ∞(P)M = Γ(Π)M by Claim 1, then we would have showed

the first part.

Basis By the well-ordering theorem[End77] (which states that every set can be well-

ordered), there exist a well-orderW = (Γ0(P)M, <W) onΓ0(P)M. Moreover, due

to the finiteness ofΠ, it should not be too difficult to see that we can make the well-

orderW in such a way that for each(r, η), (r′, η′) ∈ Γ0(P)M, r <P r′ implies

(r, η) <W (r′, η′). To see this, note that we can partitionΓ0(Π)M into a sequence

of setsSr1 , . . . , Srn whereri <P rj implies i < j and such that(r, η) ∈ Sri implies

r = ri. Then by the well-ordering theorem, there exist a well-orderWi = (Sri , <Wi)

of each of the setSri. Thus, we can just define the well-orderW = (Γ0(P)M, <W)

by setting<W= (⋃

1≤i≤n <Wi) ∪ {〈(ri, ηi), (rj, ηj)〉 | (ri, ηi) ∈ Sri , (rj , ηj) ∈

Srj , i < j}. This simply follows from the fact that thesumandproductsof well-

ordered types are also well-ordered [End77]. Hence, assumeW to be such a well-

order. We now make the following claims:

Claim 2 (r, η) ∈ Γ0(P)M impliesPos(r)η ⊆ M0(Π) ∪ {Head(r′)η′ | (r′, η′) <W

(r, η)}.

Page 172: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 163

Proof of Claim 2 Clearly by the definition ofΓ0(P)M, (r, η) ∈ Γ0(P)M implies

Pos(r)η ⊆M0(Π). This completes the proof of Claim 2.

Claim 3 If (r, η) ∈ Γ0(P)M, then (r′, η′) ∈ Γ0(P)M, wherer′ <P r implies

(r′, η′) <W (r, η).

Proof of Claim 3 Follows from the description ofW. This ends the proof of Claim

3.

Claim 4 If (r, η) ∈ Γ0(P)M, then(r′, η′) /∈ Γ(Π)M, wherer′ <P r implies that

either:

1. Pos(r′)η′ 6⊆ M or

2. Neg(r′)η′ ∩ (M0(Π) ∪ {Head(r′′)η′′ | (r′′, η′′) <W (r, η)}) 6= ∅.

Proof of Claim 4 On the contrary, assume thatPos(r′)η′ ⊆ M andNeg(r′)η′ ∩

(M0(Π)∪{Head(r′′)η′′ | (r′′, η′′) <W (r, η)}) = ∅. Then by the latter, we also

haveNeg(r′)η′ ∩M0(Π) = ∅. Then this contradicts the assumption(r, η) ∈

Γ0(P)M since by the definition ofΓ0(P)M, we have(r′, η′) will be blocking

(r, η) from being applied. This completes the proof of Claim 4.

Step Assume for1 ≤ t′ ≤ t the hypothesis holds.

We will now show it also holds fort + 1. Indeed, by the inductive hypothesis, there

exist a well-orderW = (Γt(P)M, <W) onΓt(P)M satisfying the conditions of the

preference preserving well-order. Moreover, by the well-ordering theorem, there also

exists a well-orderW ′ = (Λt+1(P)M, <W ′

) on Λt+1(P)M such thatΛt+1(P)M =

Γt+1(P)M \Γt(P)M. Furthermore, due to the finiteness ofΠ, it is not difficult to see

that we can further defineW ′ in such a way that for each(r, η), (r′, η′) ∈ Λt+1(P)M,

r <P r′ implies (r, η) <W′

(r′, η′) (i.e., same argument as above). Now we specify

W ′′ = (Γt+1(P)M, <W ′′

) to be a well-order onΓt+1(P)M by setting<W′′

=<W

∪ <W′

∪(Γt(P)M × Λt+1(P)M).

Claim 5 (r, η) ∈ Γt+1(P)M impliesPos(r)η ⊆M0(Π)∪{Head(r′)η′ | (r′, η′) <W′′

(r, η)}.

Proof of Claim 5 We consider the possibilities:

Case 1 (r, η) ∈ Γt(P)M.

Then by the inductive hypothesis, we havePos(r)η ⊆M0(Π)∪{Head(r′)η′ |

Page 173: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 164

(r′, η′) <W (r, η)}. Then since<W⊆<W′′

, it also follows thatPos(r)η ⊆

M0(Π) ∪ {Head(r′)η′ | (r′, η′) <W′′

(r, η)}.

Case 2 (r, η) ∈ Λt+1(P)M.

Then by the definition ofΛt+1(P)M, we have(r, η) ∈ Γt+1(P)M and

(r, η) /∈ Γt(P)M, which implies(r, η) is derived at staget+1. Then by the

definition ofΓt+1(P)M, it follows thatPos(r)η ⊆M0(Π)∪{Head(r′)η′ |

(r′, η′) ∈ Γt(P)M}. Then as<W⊆<W′′

(i.e., which implies(r′, η′) <W′′

(r, η) for all (r′, η′) ∈ Γt(P)M), it also follows thatPos(r)η ⊆ M0(Π) ∪

{Head(r′)η′ | (r′, η′) <W′′

(r, η)}.

This completes the proof of Claim 5.

Claim 6 If (r, η) ∈ Γt+1(P)M, then(r′, η′) ∈ Γt+1(P)M wherer′ <P r implies

(r′, η′) <W′′

(r, η).

Proof of Claim 6 On the contrary, assume(r, η), (r′η′) ∈ Γt+1(P)M, r′ <P r,

where(r, η) <W′′

(r′, η′). We also consider all possibilities:

Case 1 (r, η), (r′, η′) ∈ Γt(P)M.

Then this is a contradiction, since by the ind. hyp., we must have that

(r′, η′) <W′′

(r, η).

Case 2 (r, η) ∈ Γt(P)M and(r′, η′) ∈ Λt+1(P)M.

Then as(r′, η′) ∈ Λt+1(P)M, we have:

1. Pos(r′)η′ ⊆ λM0(Γt(P)M);

2. Neg(r′)η′ ∩M = ∅.

Then sinceλM0(Γt(P)M) ⊆ M (i.e., sinceλM0(Γ∞(P)M) = M by

assumption), it follows that(r′, η′) is also a pair such that:

1. r′ <P r (i.e., by the assumption);

2. Pos(r′)η′ ⊆M;

3. Neg(r′)η′ ∩ λM0(Γt′(P)M) = ∅;

4. (r′, η′) /∈ Γt′(P)M (i.e., by the definition ofΛt+1(P)M and as(r′, η′) ∈

Λt+1(P)M) for all 1 ≤ t′ ≤ t.

Then by the definition ofΓt(P)M, this contradicts the assumption(r, η) ∈

Γt(P)M because the pair(r′, η′) will always be blocking(r, η) from being

applied at all stages0 ≤ t′ ≤ t.

Page 174: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 165

Case 3 (r′, η′) ∈ Γt(P)M and(r, η) ∈ Λt+1(P)M.

Then by the construction ofW ′′, we have that(r′, η′) <W′′

(r, η), which

contradicts the assumption(r, η) <W′′

(r′, η′). Therefore, we cannot have

this possibility.

Case 4 (r, η), (r′, η′) ∈ Λt+1(P)M.

Then since<W′

⊆<W′′

and by the construction of the well-orderW ′ on

Λt+1(P)M, then we must have(r′, η′) <W′′

(r, η) sincer′ <P r by as-

sumption. This is contrary to the initial assumption(r, η) <W′′

(r′, η′).

This ends the proof of Claim 6.

Claim 7 If (r, η) ∈ Γt+1(P)M, then(r′, η′) /∈ Γ(Π)M wherer′ <P r implies that

either:

1. Pos(r′)η′ 6⊆ M or

2. Neg(r′)η′ ∩ (M0(Π) ∪ {Head(r′′)η′′ | (r′′, η′′) <W′′

(r, η)}) 6= ∅.

Proof of Claim 7 We again consider the possibilities:

Case 1: (r, η) ∈ Γt(P)M.

Then it immediately follows by the inductive hypothesis that Claim 7 holds.

Case 2 (r, η) ∈ Λt+1(P)M.

For the sake of contradiction, assumePos(r′)η′ ⊆ M andNeg(r′)η′ ∩

(M0(Π) ∪ {Head(r′′)η′′ | (r′′, η′′) <W′′

(r, η)}) = ∅. Then by the con-

struction ofW ′′, it also follows thatNeg(r′)η′∩λM0(Γt(P)M) = ∅. Then

this implies(r′, η′) is a pair such that:

1. r′ <P r (i.e., by assumption);

2. Pos(r′)η′ ⊆M andNeg(r′)η′ ∩ λM0(Γt(P)M) = ∅;

3. (r′, η′) /∈ Γt(P)M (i.e., since(r′, η′) /∈ Γ(Π)M by assumption and

whereΓ∞(P)M = Γ(Π)M by Claim 1).

Then this contradicts the assumption(r, η) ∈ Λt+1(P)M = Γt+1(P)M \

Γt(P)M (i.e., (r, η) is applied inΓt+1(P)M)) since by the definition of

Γt+1(P)M, we have(r′, η′) is blocking(r, η) from being applied at stage

t+ 1.

This ends the proof of Claim 7.

Page 175: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 166

Thus, by Claims 5, 6 and 7, we have the hypothesis also holds fort+ 1.

Now we prove the second part by showingM |= ∃−→<∀SϕP(−→<,S). As mentioned in the

beginning, based on the result of the first part (i.e., that there exist a preference preserving

well-orderW = (Γ(Π)M, <W) on the setΓ(Π)M), we now construct an expansionM′ of

M based on the well-orderW. Thus, set the structureM′ to be an expansion ofM on the

signatureτ(Π)∪ {<r1r2 | r1, r2 ∈ Π} (i.e., whereM is of the signatureτ(Π)) such that for

each (new) predicate symbol<r1r2 (i.e., wherer1, r2 ∈ Π andr1 andr2 could be the same),

we have

<M′

r1r2= {〈η1(u1), . . . , η1(uk), η2(v1), . . . , η2(vl)〉 |〈u1, . . . , uk〉 = xr1 , 〈v1, . . . , vl〉 = xr2 ,

(r1, η1) <W (r2, η2)}.

Then in a similar manner to the proof of Theorem 10, it can be shown (although tedious)

thatM′ |= ∀SϕP(S).

(⇐=) AssumeM |= ∃−→<∀SϕP(

−→<,S). We showλM0(Γ∞(P)M) = M by showing

λM0(Γ∞(P)M) ⊆ M andM ⊆ λM0(Γ∞(P)M). Indeed, sinceM |= ∃−→< ∀S ϕP(

−→<,S)

impliesM |= ∃−→<∀S(ϕPRO

Π (−→<,S) ∧ ϕCOMP

Π ), thenM is an answer set ofΠ by Theorem

10. Thus, from [ZZ10], we haveM∞(Π) =M. Then sinceλM0(Γ∞(P)M) ⊆ M∞(Π),

it follows thatλM0(Γ∞(P)M) ⊆ M. Therefore, it is only left for us to show thatM ⊆

λM0(Γ∞(P)M). Now, sinceM |= ∃−→<∀SϕP(

−→<,S), then there exist an expansionM′

of M, on the signatureτ(Π) ∪ {<r1r2 | r1, r2 ∈ Π}, such thatM′ |= ∀SϕP(S) with

∀SϕP(S) the sentence obtained from∀SϕP(−→<,S) by treating the predicate variables in−→<

as constants. Then sinceM′ |= ∀SϕP(S) (i.e., which implies a well-order onΓ(Π)M), we

construct a well-orderW = (Γ(Π)M, <W) of Γ(Π)M by setting

<W= {〈(r1, η1), (r2, η2)〉 |r1, r2 ∈ Π, xr1 = 〈u1, . . . , uk〉, xr2 = 〈v1, . . . , vl〉,

〈η1(u1), . . . , η1(uk), η2(v1), . . . , η2(vl)〉 ∈<M′

r1r2}.

Hence, for ane ∈ Γ(Π)M, defineWe(Π) inductively as follows:

WBOT(W)(Π) ={BOT(W)};

WSUCC(e)(Π) =We(Π) ∪ {SUCC(e)},

Page 176: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 167

whereBOT(W), SUCC(e) andORD(W) denotes the bottom element, the successor element

of e and the order type ofΓ(Π)M underW respectively. Intuitively,We(Π) represents

the “gradual” collection of the pairs(r, η) of Γ(Π)M under the well-orderW up to and

including the elemente.

Claim 1: WORD(W)(Π) ⊆ Γ∞(Π)M.

Proof of Claim 1: We prove by induction one for e ≥ BOT(W).

Basis: SinceW is a preference preserving well-order onΓ(Π)M, then we have that

BOT(W) = (r, η) is such that:

1. Pred(Pos(r))∩Pint(Π) = ∅ (i.e., since(r, η) is the least element underW

of Γ(Π)M and that the well-orderW satisfies the notion ofsupportsince

M′ |=∧

r∈Π ∀xr (ϕGENr (xr)→ ϕSUP

r (xr)));

2. Any ruler′ <P r and assignmentη′ implies(r′, η′) /∈ Γ(Π)M. For assume

(r′, η′) ∈ Γ(Π)M. Then we must have(r′, η′) <W (r, η) sincer′ <P r and

where(r, η) and(r′, η′) are both inΓ(Π)M, and were

M′ |= ∀xr(ϕGENr (xr)→

r′<Pr

∀xr′(ϕGENr′ (xr′)→<r′r (xr′ ,xr)))

(i.e., sinceM′ |= ϕPREFP ). This is absurd since(r, η) is the least most under

W;

3. For each ruler′ <P r and assignmentη′ with (r′, η′) /∈ Γ(Π)M, we have

either:

(a) Pos(r′)η′ 6⊆ M or

(b) Neg(r′)η′ ∩ (M0(Π) ∪ {Head(r′′)η′ | (r′′, η′′) <W (r, η)}) 6= ∅

since

M′ |= ∀xr(ϕGENr (xr)→

r′<Pr

∀xr′(¬ϕGENr′ (xr′)→

(Φ¬POSr′ (xr′) ∨ ΦDEF

rr′ (xr,xr′)))).

Then since(r, η) = BOT(W) (i.e., the least element underW, which means

that{Head(r′′)η′′ | (r′′, η′′) <W (r, η)} = ∅), it must be thatPos(r′)η′ 6⊆

Page 177: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 168

M orNeg(r′)η′ ∩M0(Π) 6= ∅.

Then by 2 and 3 above, we know that there does not exists a ruler′ <P r

and assignmentη′ with Pos(r′)η′ ⊆ M andNeg(r′)η′ ∩ M0(Π) = ∅ since

we will always havePos(r′)η′ 6⊆ M or Neg(r′)η′ ∩M0(Π) 6= ∅. Hence, as

(r, η) ∈ Γ(Π)M and wherePos(r)η ⊆ M0(Π) by 1 above, then this implies

(r, η) ∈ Γ0(P)M by the definition ofΓ0(P)M. Thus, we haveWBOT(W)(Π) ⊆

Γ0(P)M ⊆ Γ∞(P)M.

Step: Assume forBOT(W) ≤W e′ ≤W e, we haveWe′(Π) ⊆ Γ∞(P)M. We will

show thatWSUCC(e)(Π) ⊆ Γ∞(P)M. Thus, assumeSUCC(e) = (r, η). Then

by the ind. hyp., there exist some certaint for whichWe(Π) ⊆ Γt(P)M (i.e.,

sinceWe(Π) ⊆ Γ∞(P)M). Moreover, sinceM′ |=∧

r∈Π ∀xr(ϕGENr (xr) →

ϕSUPr (xr)) (i.e., obeys the notion of “support”), then we also havePos(r)η ⊆

λM0(We(Π)), and hence, thatPos(r)η ⊆ λM0(Γt(P)M), sinceWe(Π) ⊆

Γt(P)M.

Subclaim 1: There does not exists a ruler′ <P r and assignmentη′ such that

1. Pos(r′)η′ ⊆M andNeg(r′)η′ ∩ λM0(Γt(P)M) = ∅;

2. (r′, η′) /∈ Γt(P)M.

Proof of Subclaim 1: On the contrary, assume that there exist such a ruler′

and assignmentη′. Then there can only be two possibilities:

Case 1: (r′, η′) ∈ Γ(Π)M.

Then as

M′ |= ∀xr(ϕGENr (xr)→

r′<Pr

∀xr′(ϕGENr′ (xr′)→<r′r (xr′ ,xr)))

and sincer′ <P r, then we must have(r′, η′) <W (r, η) = SUCC(e), or

in other words, that(r′, η′) ∈ We(Π) (i.e., by the definition ofWe(Π)).

Then sinceWe(Π) ⊆ Γt(P)M by assumption (i.e., ind. hyp.), this

contradicts the assumption(r′, η′) /∈ Γt(P)M.

Case 2: (r′, η′) /∈ Γ(Π)M.

Page 178: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

APPENDIX A. PROOFS 169

Then since

M′ |= ∀xr(ϕGENr (xr)→

r′<Pr

∀xr′(¬ϕGENr′ (xr′)→

(Φ¬POSr′ (xr′) ∨ ΦDEF

rr′ (xr,xr′)))),

there can only be two possibilities:

Subcase 1:Pos(r′)η′ 6⊆ M.

Then this contradicts the assumptionPos(r′)η′ ⊆M.

Subcase 2:Neg(r′)η′ ∩ λM0(We(Π)) 6= ∅.

Then this contradicts the assumptionNeg(r′)η′ ∩ λM0(Γt(P)M) =

∅ sinceWe(Π) ⊆ Γt(P)M, by the ind. hyp.

This completes the proof of Subclaim 1.

Hence, by Subclaim 1, we must have(r, η) ∈ Γt+1(P)M (i.e., since there is

no pair(r′, η′) blocking (r, η) from being applied at staget + 1), which then

impliesWSUCC(e)(Π) ⊆ Γ∞(P)M.

This completes the proof of Claim 1.

Therefore, using the fact thatWORD(W)(Π) ⊆ Γ∞(P)M by Claim 1, it is now sufficient

to only show thatM ⊆ λM0(WORD(W)(Π)) to showM ⊆ λM0(Γ∞(P)M). Hence, let

P (aP) ∈ M such thatP (aP) /∈ M0(Π) (i.e., for if P (aP) ∈ M

0(Π) then the result is

clear). We will show thatP (aP) ∈ {Head(r)η | (r, η) ∈ WORD(W)(Π)}. Indeed, since

M∞(Π) = M (i.e., sinceM |= ∃−→<∀S(ϕPRO

Π (−→<,S) ∧ ϕCOMP

Π ) and by Theorem 10 and

[ZZ10]), we have for somet > 1, ruler, and corresponding assignmentη:

1. Head(r)η = P (aP);

2. Pos(r)η ⊆Mt(Π) ⊆M∞(Π) =M andNeg(r)η ∩M = ∅.

Then we have that(r, η) ∈ Γ(Π)M, which further implies(r, η) ∈ WORD(W)(Π)

(i.e., sinceDom(W) = Γ(Π)M). Therefore, we haveP (aP) ∈ {Head(r)η | (r, η) ∈

WORD(W)(Π)} ⊆ λM0(WORD(W)(Π)). Hence, we had shown thatM⊆ λM0(Γ∞(P)M).

This completes the proof of the theorem.�

Page 179: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

References

[ALZZ10] Vernon Asuncion, Fangzhen Lin, Yan Zhang, and Yi Zhou. Ordered com-

pletion for first-order logic programs on finite structures.In Proceedings of

AAAI-2010, pages 249–254, 2010.

[ALZZ12] Vernon Asuncion, Fangzhen Lin, Yan Zhang, and Yi Zhou. Ordered com-

pletion for first-order logic programs on finite structures.Artif. Intell., 177-

179:1–24, 2012.

[AZ09] Vernon Asuncion and Yan Zhang. Translating preferred answer set programs

to propositional logic. InProceedings of LPNMR-2009, pages 396–401,

2009.

[AZZar] Vernon Asuncion, Yan Zhang, and Yi Zhou. Ordered completion for logic

programs with aggregates. InProceedings of AAAI-2012, 2012 (to appear).

[Bar03] Chitta Baral.Knowledge representation, reasoning and declarative problem

solving. Cambridge University Press, 2003.

[BE99] Gerhard Brewka and Thomas Eiter. Preferred answer setsfor extended logic

programs.Artif. Intell., 109(1-2):297–356, 1999.

[BED94] Rachel Ben-Eliyahu and Rina Dechter. Propositional semantics for disjunc-

tive logic programs.Ann. Math. Artif. Intell., 12(1-2):53–87, 1994.

[BEE+07] Daniel R. Brooks, Esra Erdem, Selim T. Erdogan, James W. Minett, and Don-

ald Ringe. Inferring phylogenetic trees using answer set programming. J.

Autom. Reasoning, 39(4):471–511, 2007.

170

Page 180: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

REFERENCES 171

[BLM11] Michael Bartholomew, Joohyung Lee, and Yunsong Meng.First-order ex-

tension of the FLP stable model semantics via modified circumscription. In

Proceedings of IJCAI-2011, pages 724–730, 2011.

[CIR+11] Francesco Calimeri, Giovambattista Ianni, Francesco Ricca, Mario Alviano,

Annamaria Bria, Gelsomina Catalano, Susanna Cozza, Wolfgang Faber,

Onofrio Febbraro, Nicola Leone, Marco Manna, Alessandra Martello, Clau-

dio Panetta, Simona Perri, Kristian Reale, Maria Carmela Santoro, Marco

Sirianni, Giorgio Terracina, and Pierfrancesco Veltri. The third answer set

programming competition: Preliminary report of the systemcompetition

track. InProceedings of LPNMR-2011, pages 388–403, 2011.

[Cla77] Keith L. Clark. Negation as failure. InProceedings of Logic and Data Bases

1977, pages 293–322, 1977.

[CLWZ06] Yin Chen, Fangzhen Lin, Yisong Wang, and Mingyi Zhang.First-order loop

formulas for normal logic programs. InProceedings of KR-2006, pages 298–

307, 2006.

[DPB01] Marc Denecker, Nikolay Pelov, and Maurice Bruynooghe. Ultimate well-

founded and stable semantics for logic programs with aggregates. InICLP,

pages 212–226, 2001.

[DST00] James P. Delgrande, Torsten Schaub, and Hans Tompits. Logic programs with

compiled preferences. InProceedings of ECAI-2000, pages 464–468, 2000.

[DST03] James P. Delgrande, Torsten Schaub, and Hans Tompits. A framework for

compiling preferences in logic programs.TPLP, 3(2):129–187, 2003.

[DSTW04] James P. Delgrande, Torsten Schaub, Hans Tompits, and Kewen Wang. A

classification and survey of preference handling approaches in nonmonotonic

reasoning.Computational Intelligence, 20(2):308–334, 2004.

[DTEFK09] Minh Dao-Tran, Thomas Eiter, Michael Fink, and Thomas Krennwallner.

Modular nonmonotonic logic programming revisited. InProceedings of

ICLP-2009, pages 145–159, 2009.

Page 181: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

REFERENCES 172

[EF99] Heinz-Dieter Ebbinghaus and Jorg Flum. Finite Model Theory. Springer,

1999.

[EGM97] Thomas Eiter, Georg Gottlob, and Heikki Mannila. Disjunctive datalog.ACM

Trans. Database Syst., 22(3):364–418, 1997.

[EIST05] Thomas Eiter, Giovambattista Ianni, Roman Schindlauer, and Hans Tompits.

A uniform integration of higher-order reasoning and external evaluations in

answer-set programming. InProceedings of IJCAI-2005, pages 90–96, 2005.

[End77] Herbert B. Enderton.Elements of Set Theory. Elsevier Science, 1977.

[Fag94] Francois Fages. Consistency of clark’s completionand existence of stable

models.Meth. of Logic in CS, 1(1):51–60, 1994.

[Fer05] Paolo Ferraris. Answer sets for propositional theories. In Proceedings of

LPNMR-2005, pages 119–131, 2005.

[Fer11] Paolo Ferraris. Logic programs with propositionalconnectives and aggre-

gates.ACM Trans. Comput. Log., 12(4):25, 2011.

[FLL06] Paolo Ferraris, Joohyung Lee, and Vladimir Lifschitz. A generalization of

the Lin-Zhao theorem.Ann. Math. Artif. Intell., 47(1-2):79–101, 2006.

[FLL07] Paolo Ferraris, Joohyung Lee, and Vladimir Lifschitz. A new perspective on

stable models. InProceedings of IJCAI-2007, pages 372–379, 2007.

[FLL11] Paolo Ferraris, Joohyung Lee, and Vladimir Lifschitz. Stable models and

circumscription.Artif. Intell., 175(1):236–263, 2011.

[FPL+08] Wolfgang Faber, Gerald Pfeifer, Nicola Leone, Tina Dell’Armi, and Giuseppe

Ielpa. Design and implementation of aggregate functions inthe DLV system.

CoRR, abs/0802.3137, 2008.

[FPL11] Wolfgang Faber, Gerald Pfeifer, and Nicola Leone. Semantics and complexity

of recursive aggregates in answer set programming.Artif. Intell., 175(1):278–

298, 2011.

Page 182: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

REFERENCES 173

[GKKS09] Martin Gebser, Roland Kaminski, Benjamin Kaufmann,and Torsten Schaub.

On the implementation of weight constraint rules in conflict-driven asp

solvers. InProceedings of ICLP-2009, pages 250–264, 2009.

[GKNS07] Martin Gebser, Benjamin Kaufmann, Andre Neumann, and Torsten Schaub.

clasp: A conflict-driven answer set solver. InProceedings of LPNMR-2007,

pages 260–265, 2007.

[GL88] Michael Gelfond and Vladimir Lifschitz. The stable model semantics for

logic programming. InProceedings of ICLP/SLP 1988, pages 1070–1080,

1988.

[GL91] Michael Gelfond and Vladimir Lifschitz. Classical negation in logic programs

and disjunctive databases.New Generation Comput., 9(3/4):365–386, 1991.

[GRS91] Allen Van Gelder, Kenneth A. Ross, and John S. Schlipf.The well-founded

semantics for general logic programs.J. ACM, 38(3):620–650, 1991.

[GST07] Martin Gebser, Torsten Schaub, and Sven Thiele. Gringo : A new grounder

for answer set programming. InProceedings of LPNMR-2007, pages 266–

271, 2007.

[Jan04] Tomi Janhunen. Representing normal programs with clauses. InProceedings

of ECAI-2004, pages 358–362, 2004.

[JNS09] Tomi Janhunen, Ilkka Niemela, and Mark Sevalnev. Computing stable models

via reductions to difference logic. InProceedings of LPNMR-2009, pages

142–154, 2009.

[Kol90] Phokion G. Kolaitis. Implicit definability on finitestructures and unambigu-

ous computations (preliminary report). InProceedings of LICS-1990, pages

168–180, 1990.

[Lie05] Yuliya Lierler. Cmodels - SAT-based disjunctive answer set solver. InPro-

ceedings of LPNMR-2005, pages 447–451, 2005.

[Lif85] Vladimir Lifschitz. Closed-world databases and circumscription.Artif. Intell.,

27(2):229–235, 1985.

Page 183: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

REFERENCES 174

[LLP08] Joohyung Lee, Vladimir Lifschitz, and Ravi Palla. A reductive semantics for

counting and choice in answer set programming. InProceedings of AAAI-

2008, pages 472–479, 2008.

[LM08] Joohyung Lee and Yunsong Meng. On loop formulas with variables. In

Proceedings of KR-2008, pages 444–453, 2008.

[LM09] Joohyung Lee and Yunsong Meng. On reductive semantics of aggregates in

answer set programming. InProceedings of LPNMR-2009, pages 182–195,

2009.

[LM11] Joohyung Lee and Yunsong Meng. First-order stable model semantics and

first-order loop formulas.J. Artif. Intell. Res. (JAIR), 42:125–180, 2011.

[LPF+06] Nicola Leone, Gerald Pfeifer, Wolfgang Faber, Thomas Eiter, Georg Gottlob,

Simona Perri, and Francesco Scarcello. The DLV system for knowledge rep-

resentation and reasoning.ACM Trans. Comput. Log., 7(3):499–562, 2006.

[LPS04] Nicola Leone, Simona Perri, and Francesco Scarcello. Backjumping tech-

niques for rules instantiation in the DLV system. InProceedings of NMR-

2004, pages 258–266, 2004.

[LTT99] Vladimir Lifschitz, Lappoon R. Tang, and Hudson Turner. Nested expressions

in logic programs.Ann. Math. Artif. Intell., 25(3-4):369–389, 1999.

[LZ03] Fangzhen Lin and Jicheng Zhao. On tight logic programs and yet another

translation from normal logic programs to propositional logic. InProceedings

of IJCAI-2003, pages 853–858, 2003.

[LZ04] Fangzhen Lin and Yuting Zhao. Assat: computing answer sets of a logic

program by sat solvers.Artif. Intell., 157(1-2):115–137, 2004.

[LZ11] Fangzhen Lin and Yi Zhou. From answer set logic programming to circum-

scription via logic of GK.Artif. Intell., 175(1):264–277, 2011.

[McC86] John McCarthy. Applications of circumscription to formalizing common-

sense knowledge.Artif. Intell., 28(1):89–116, 1986.

Page 184: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

REFERENCES 175

[NBG+01] Monica Nogueira, Marcello Balduccini, Michael Gelfond,Richard Watson,

and Matthew Barry. An a prolog decision support system for thespace shuttle.

In Proceedings of Answer Set Programming 2001, 2001.

[Nie99] Ilkka Niemela. Logic programs with stable model semantics as a constraint

programming paradigm.Ann. Math. Artif. Intell., 25(3-4):241–273, 1999.

[Nie08] Ilkka Niemela. Stable models and difference logic. InProceedings of ISAIM-

2008, 2008.

[NOT99] Robert Nieuwenhuis, Albert Oliveras, and Cesare Tinelli. Solving SAT and

SAT modulo theories: from an abstract Davis–Putnam–Logemann–Loveland

procedure to DPLL(t). Journal of the ACM (JACM), 53(6):937–977, 1999.

[PDB07] Nikolay Pelov, Marc Denecker, and Maurice Bruynooghe.Well-founded and

stable semantics of logic programs with aggregates.TPLP, 7(3):301–353,

2007.

[Pea96] David Pearce. A new logical characterisation of stable models and answer

sets. InProceedings of NMELP-1996, pages 57–70, 1996.

[PLTG07] Murray Patterson, Yongmei Liu, Eugenia Ternovska,and Arvind Gupta.

Grounding for model expansion ink-guarded formulas with inductive defi-

nitions. InProceedings of IJCAI-2007, pages 161–166, 2007.

[PSE04] Enrico Pontelli, Tran Cao Son, and Islam Elkabani. Smodels with CLP? A

treatment of aggregates in ASP. InProceedings of LPNMR-2004, pages 356–

360, 2004.

[PV05] David Pearce and Agustın Valverde. A first order nonmonotonic extension of

constructive logic.Studia Logica, 80(2-3):321–346, 2005.

[Rin95] Jussi Rintanen. On specificity in default logic. InIJCAI, pages 1474–1479,

1995.

[SN01] Tommi Syrjanen and Ilkka Niemela. The smodels system. InProceedings of

LPNMR-2001, pages 434–438, 2001.

Page 185: researchdirect.westernsydney.edu.au14… · Acknowledgements First and foremost, none of this would be possible without the help, guidance, encourage-ment, and support of my supervisor

REFERENCES 176

[SNS02] Patrik Simons, Ilkka Niemela, and Timo Soininen. Extending and implement-

ing the stable model semantics.Artif. Intell., 138(1-2):181–234, 2002.

[SP07] Tran Cao Son and Enrico Pontelli. A constructive semantic characterization

of aggregates in answer set programming.TPLP, 7(3):355–375, 2007.

[SW01] Torsten Schaub and Kewen Wang. A comparative study of logic programs

with preference: Preliminary report. InProceedings of Answer Set Program-

ming 2001, 2001.

[SW03] Torsten Schaub and Kewen Wang. A semantic framework for preference

handling in answer set programming.CoRR, cs.AI/0301023, 2003.

[Tru10] Miroslaw Truszczynski. Reducts of propositional theories, satisfiability re-

lations, and generalizations of semantics of logic programs. Artif. Intell.,

174(16-17):1285–1306, 2010.

[TSNS03] Juha Tiihonen, Timo Soininen, Ilkka Niemala, and Reijo Sulonen. A practical

tool for mass-customising configurable products. InProceedings of the 14th

International Conference on Engineering Design 2003, pages 1290–1299,

2003.

[WMD10] Johan Wittocx, Maarten Marien, and Marc Denecker. Grounding FO and

FO(ID) with bounds.J. Artif. Intell. Res. (JAIR), 38:223–269, 2010.

[WZL00] Kewen Wang, Lizhu Zhou, and Fangzhen Lin. Alternating fixpoint theory for

logic programs with priority. InProceedings of Computational Logic 2000,

pages 164–178, 2000.

[ZF97] Yan Zhang and Norman Y. Foo. Answer sets for prioritized logic programs.

In ILPS, pages 69–83, 1997.

[ZZ10] Yan Zhang and Yi Zhou. On the progression semantics and boundedness of

answer set programs. InProceedings of KR-2010, pages 286–291, 2010.

[ZZ11] Yi Zhou and Yan Zhang. Progression semantics for disjunctive logic pro-

grams. InProceedings of AAAI-2011, pages 518–527, 2011.