Translating LPOD and CR-Prolog2 into Standard Answer Set Programs

05/02/2018 ∙ by Joohyung Lee, et al. ∙ Arizona State University 0

Logic Programs with Ordered Disjunction (LPOD) is an extension of standard answer set programs to handle preference using the construct of ordered disjunction, and CR-Prolog2 is an extension of standard answer set programs with consistency restoring rules and LPOD-like ordered disjunction. We present reductions of each of these languages into the standard ASP language, which gives us an alternative way to understand the extensions in terms of the standard ASP language.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

In answer set programming, each answer set encodes a solution to the problem that is being modeled. There is often a need to express that one solution is preferable to another, so several extensions of answer set programs were made to express a qualitative preference over answer sets. In Logic Programs with Ordered Disjunction (LPOD) [Brewka (2002)], this is done by introducing the construct of ordered disjunction in the head of a rule: intuitively means, when Body is true, if possible then , but if is not possible, then at least . Proposition 2 from [Brewka (2002)] states that there is no reduction of LPOD to disjunctive logic programs [Gelfond and Lifschitz (1991)] based on the fact that the answer sets of disjunctive logic programs are subset-minimal whereas LPOD answer sets are not necessarily so. However, this justification is limited to translations that preserve the underlying signature, and it remained an open question if it is possible to turn LPOD into the language of standard ASP such as ASP-Core 2 [Calimeri et al. (2012)] by using auxiliary atoms. In this paper, we provide a positive answer to this question.

We present a reduction of LPOD to standard answer set programs by compiling away ordered disjunctions. The translation gives us an alternative way to understand the semantics of LPOD in terms of the standard ASP language, and more generally, a method to express preference relations among answer sets. Instead of iterating the generator and the tester programs as in [Brewka et al. (2002)], our reduction is one-pass: the preferred answer sets can be computed by calling an answer set solver one time.

It turns out that the translation idea is not restricted to LPOD but also applies to [Balduccini and Mellarkod (2004)], which not only has a construct similar to ordered disjunction in LPOD but also inherits the construct of consistency-restoring rules—rules that can be added to make inconsistent programs to be consistent—from CR-Prolog [Balduccini and Gelfond (2003)]. With some modifications to the LPOD translation, we show that programs can also be turned into standard answer set programs by compiling away both ordered disjunctions and consistency-restoring rules.

The paper is organized as follows. Section 2 reviews LPOD and presents a translation that turns LPOD into standard answer set programs. Section 3 reviews and presents a translation that turns into standard answer set programs. The complete proofs are in the appendix.

2 LPOD to ASP with Weak Constraints

2.1 Review: LPOD

We review the definition of LPOD by brewka02logic. As in that paper, for simplicity, we assume the underlying signature is propositional.

Syntax:   A (propositional) LPOD is , where its regular part consists of usual ASP rules , and its ordered disjunction part consists of LPOD rules of the form

(1)

in which are atoms, is at least , and Body is a conjunction of atoms possibly preceded by not.111In [Brewka (2002)], a usual ASP rule is viewed as a special case of a rule with ordered disjunction when but in this paper, we distinguish them. This simplifies the presentation of the translation and also allows us to consider LPOD that are more general than the original definition by allowing modern ASP constructs such as aggregates. Rule (1) intuitively says “when Body is true, if possible then ; if is not possible then ; …; if all of are not possible then .”

Semantics:   For an LPOD rule (1), its -th option () is defined as

A split program of an LPOD is obtained from by replacing each rule in by one of its options. A set of atoms is a candidate answer set of if it is an answer set of a split program of .

Example 1

(From [Brewka (2002)]) The following LPOD ,

has four split programs:

(2)

Each of them has the following answer sets respectively, which are the candidate answer sets of .

A candidate answer set of is said to satisfy rule (1)

  • to degree if does not satisfy Body, and

  • to degree () if satisfies Body and .

When contains LPOD rules, the satisfaction degree list of a candidate answer set of is where is the degree to which satisfies rule in . For a candidate answer set , let denote the set of rules in satisfied by to degree . For candidate answer sets and of , brewka05preferences introduces the following four preference criteria.

  1. Cardinality-Preferred: is cardinality-preferred to () if there is a positive integer such that , and for all .

  2. Inclusion-Preferred: is inclusion-preferred to () if there is a positive integer such that , and for all .

  3. Pareto-Preferred: is Pareto-preferred to () if there is a rule that is satisfied to a lower degree in than in , and there is no rule that is satisfied to a lower degree in than in .

  4. Penalty-Sum-Preferred: is penalty-sum-preferred to () if the sum of the satisfaction degrees of all rules is smaller in than in .

A candidate answer set of is a k-preferred () answer set if there is no candidate answer set of such that .

Example 1 (Continued)
Recall that has three candidate answer sets: , , and . Their satisfaction degree lists are (1,1), (2,1), and (1,2), respectively. One can check that is the only preferred answer set according to any of the four preference criteria.

Example 2

To illustrate the difference among the four preference criteria, consider the following LPOD about picking a hotel near the Grand Canyon. is a 2 star hotel but is close to the Grand Canyon, is a 3 star hotel and the distance is medium, and is a 4 star hotel but is too far.

has split programs but only the following three programs are consistent (The regular part of is not listed).

The candidate answer sets of and their satisfaction degree lists are

By definition, the cardinality-preferred answer set is , the inclusion-preferred answer sets are and , the Pareto-preferred answer sets are , and , while the penalty-sum-preferred answer sets are and .

2.2 An Alternative Way to Generate Candidate Answer Sets: Assumption Programs

Before we describe the translation of LPOD into standard answer set programs, we consider an alternative way to generate candidate answer sets together with their “assumption degrees,” which serves as a basis of our translation.

Let be an LPOD with LPOD rules. For an LPOD rule ()

(3)

its -th assumption (), denoted by , is defined as the set of ASP rules

(4)
(5)
(6)
(for ) (7)
(for ) (8)

where is a new, distinct atom for each LPOD rule . Rules (4)—(6) ensure that the body of (3) is false iff . Rule (7) represents that is true under the -th assumption, and rule (8) ensures that all atoms are false. The last two rules together tells us that the first atom in that is true is . The reason we call rules (4)—(8) the -th assumption is because they encode a certain assumption imposed on rule (3) in deriving each candidate answer set: assumes is false, whereas assumes is true and the -th atom in the head is to be derived.

An assumption program of an LPOD is obtained from by replacing each rule in by one of its assumptions. If each LPOD rule is replaced by its -th assumption, we call the assumption degree list of the assumption program.

The following proposition asserts that the candidate answer sets can be obtained from assumption programs instead of split programs.

Proposition 1

For any LPOD of and any set of atoms of , is a candidate answer set of iff satisfies the body of rule in is an answer set of some assumption program of .

Example 1 (Continued)   The assumptions for rule denoted by , and the assumptions for rule denoted by are as follows, where and range over .

has 9 assumption programs,

among which the three assumption programs in the boxes are consistent. Their answer sets are shown together.

An advantage of considering assumption programs over split programs is that the satisfaction degrees—a basis of comparing the candidate answer sets—can be obtained from the assumption degrees with a minor modification (Section 2.3.1). This is in part because each candidate answer set is obtained from only one assumption program whereas the same candidate answer set can be obtained from multiple split programs (e.g., in Example 1).

2.3 Turning LPOD into Standard Answer Set Programs

We define a translation that turns an LPOD into a standard answer set program.

Let be an LPOD of signature where contains propositional rules with ordered disjunction:

(9)

where are rule indices, and for .

The first-order signature of contains -ary predicate constant for each propositional constant of . Besides, contains the following predicate constants not in : (“assumption program”), , (), (“preferred”), and (“preferred answer set”). Furthermore, contains the following predicate constants according to each preference criterion:

  • for cardinality-preferred: , ,

  • for inclusion-preferred: , ,

  • for Pareto-preferred:

  • for penalty-sum-preferred: .

2.3.1 Generate Candidate Answer Sets

The first part of the translation is to generate all candidate answer sets of based on the notion of assumption programs. We use the assumption degree list as a “name space” for each candidate answer set, so that we can compare them in a single answer set program.

1.  We use atom to denote the assumption program whose assumption degree list is . We consider all consistent assumption programs by generating a maximal set of atoms: is included in an optimal answer set 222For programs containing weak constraints, an optimal answer set is defined by the penalty that comes from the weak constraints that are violated. [Calimeri et al. (2012)] iff the assumption program denoted by is consistent.

(10)
(11)

Rule (10) generates an arbitrary subset of atoms, each of which records an assumption degree list. Rule (11) is a weak constraint that maximizes the number of atoms by adding the penalty for each true instance of . Together with the rules below, these rules ensure that we consider all assumption programs that are consistent and that no candidate answer sets are missed in computing preference relationship in the second part of the translation.

2.  We extend each atom to include the assumption degrees , and append atom in the bodies of rules.

  • For each rule in , contains

    (12)

    where and are obtained from Head and Body by replacing each atom in them with . Each schematic variable ranges over .

  • For each rule

    in , where , contains

    (13)
    (14)
    (15)

    And for , contains

    (16)
    (17)

3.  The satisfaction degree list can be obtained from the assumption degree list encoded in by changing to if it was . For this, contains

(18)

and for , contains

(19)
(20)

Since all answer sets of the same assumption program are associated with the same satisfaction degree list, we say an assumption program satisfies LPOD rule to degree if its answer sets satisfy the rule to degree . Rule (18) reads “for any assumption program , it has exactly one assignment of satisfaction degrees .” Rules (19) and (20) say that the assumption program satisfies LPOD rule to degree 1 if (in which case is false) and to degree if (in which case is true).

Let us denote the set of rules (10)—(20) by . Observe that the atoms in the original signature are in the form of in the answer sets of . We define a way to retrieve the candidate answer set of by removing as follows. Let be an optimal answer set of , and let

If , we define the set as a candidate answer set on of .333We also apply this notation to the full translation and below.

The following proposition asserts the soundness of the translation .

Proposition 2

The candidate answer sets of an LPOD of signature are exactly the candidate answer sets on of .

Example 1 Continued: The following is the encoding of in the input language of clingo.

%%%% 1 %%%%
{ap(X1,X2): X1=0..2, X2=0..2}.             :~ ap(X1,X2). [-1, X1, X2]
%%%% 2 %%%%
% a*b <- not c.
body_1(X1,X2) :- ap(X1,X2), not c(X1,X2).
:- ap(X1,X2), X1=0, body_1(X1,X2).         :- ap(X1,X2), X1>0, not body_1(X1,X2).
a(X1,X2) :- body_1(X1,X2), X1=1.           b(X1,X2) :- body_1(X1,X2), X1=2.
:- body_1(X1,X2), X1!=1, a(X1,X2).
:- body_1(X1,X2), X1!=2, not a(X1,X2), b(X1,X2).
% b*c <- not d.
body_2(X1,X2) :- ap(X1,X2), not d(X1,X2).
:- ap(X1,X2), X2=0, body_2(X1,X2).         :- ap(X1,X2), X2>0, not body_2(X1,X2).
b(X1,X2) :- body_2(X1,X2), X2=1.           c(X1,X2) :- body_2(X1,X2), X2=2.
:- body_2(X1,X2), X2!=1, b(X1,X2).
:- body_2(X1,X2), X2!=2, not b(X1,X2), c(X1,X2).
%%%% 3 %%%%
1{degree(ap(X1,X2), D1, D2): D1=1..2, D2=1..2}1 :- ap(X1,X2).
:- degree(ap(X1,X2), D1, D2), X1=0, D1!=1.
:- degree(ap(X1,X2), D1, D2), X1>0, D1!=X1.
:- degree(ap(X1,X2), D1, D2), X2=0, D2!=1.
:- degree(ap(X1,X2), D1, D2), X2>0, D2!=X2.

The optimal answer set of is

(21)

( and atoms are not listed). Since satisfies , , and , the candidate answer sets on of are

which are exactly the candidate answer sets of .

2.3.2 Find Preferred Answer Sets

The second part of the translation is to compare the candidate answer sets to find the preferred answer sets. For each preference criterion, contains the following rules respectively. Below is .

  1. Cardinality-Preferred: For this criterion, contains the following rules.

    (22)
    (23)
    (24)
    (25)
    (26)

    , , and denote assumption programs in the form of . is true if satisfies rules in to degree . is true if and have the same number of rules that are satisfied to degree . is true if satisfies more rules to degree than does. is true if is cardinality-preferred to : satisfies more rules to degree than does whereas they satisfy the same number of rules up to degree . Rule (26) reads as: given an assumption program represented by , if we cannot find an assumption program that is more preferable, then the answer sets of are all preferred answer sets of . Note that in rule (26) is a local variable that ranges over all atoms.

  2. Inclusion-Preferred: For this criterion, contains the following rules.

    (27)
    (28)
    (29)
    (30)
    (31)

    where counts the number of true atoms in this set, so it equals to 0 (or 2) when none (or both) of and are true; means that the number of true atoms in this set must be smaller or equal to 1, which means that and cannot be true at the same time – in other words, implies .

  3. Pareto-Preferred: For this criterion, contains the following rules.

    (32)
    (33)
    (34)

    where means that is equivalent to at all degrees.

  4. Penalty-Sum-Preferred: For this criterion, contains the following rules.

    (35)
    (36)
    (37)

    where means that the sum of ’s satisfaction degrees of all rules is .

If , we define the set to be a preferred answer set on of