Implementing Default and Autoepistemic Logics via the Logic of GK

Implementing Default and Autoepistemic Logics via the Logic of GK

Jianmin Ji
School of Computer Science and Technology
University of Science and Technology of China
Hefei, China &Hannes Strass
Computer Science Institute
Leipzig University
Leipzig, Germany
Abstract

The logic of knowledge and justified assumptions, also known as the logic of grounded knowledge (GK), was proposed by Lin and Shoham as a general logic for nonmonotonic reasoning. To date, it has been used to embed in it default logic (propositional case), autoepistemic logic, Turner’s logic of universal causation, and general logic programming under stable model semantics. Besides showing the generality of GK as a logic for nonmonotonic reasoning, these embeddings shed light on the relationships among these other logics. In this paper, for the first time, we show how the logic of GK can be embedded into disjunctive logic programming in a polynomial but non-modular translation with new variables. The result can then be used to compute the extension/expansion semantics of default logic, autoepistemic logic and Turner’s logic of universal causation by disjunctive ASP solvers such as GNT, cmodels, DLV, and claspD(-2).

Implementing Default and Autoepistemic Logics via the Logic of GK


Jianmin Ji School of Computer Science and Technology University of Science and Technology of China Hefei, China                        Hannes Strass Computer Science Institute Leipzig University Leipzig, Germany

Introduction

Lin and Shoham [1992] proposed a logic with two modal operators and , standing for knowledge and assumption, respectively. The idea is that one starts with a set of assumptions (those true under the modal operator ), computes the minimal knowledge under this set of assumptions, and then checks to see if the assumptions were justified in that they agree with the resulting minimal knowledge. For instance, consider the GK formula . If we assume , then we can conclude that we know , thus the assumption that holds is justified, and we get a GK model where both and are true. (There is another GK model where we do not assume and hence do not know .) However, there is no GK model of : if we do not assume , we are forced to conclude , but then knowledge and assumptions do not coincide; if we do assume , we cannot conclude that we know and thus assuming was not justified.

To date, there have been embeddings from default logic [Reiter, 1980] and autoepistemic logic [Moore, 1985] to the logic of GK [Lin and Shoham, 1992], from Turner’s logic of universal causation [Turner, 1999] to the logic of GK [Ji and Lin, 2012], as well as from general logic programs [Ferraris, 2005] to the logic of GK [Lin and Zhou, 2011]. Among other things, these embeddings shed new light on nonmonotonic reasoning, and have led to an interesting characterization of strong equivalence in logic programming [Lin, 2002; Lin and Zhou, 2011], and helped relate logic programming to circumscription [Lin and Shoham, 1992] as the semantics of GK is just a minimization (of knowledge) together with an identity check (of assumptions and knowledge) after the minimization.

In this paper, for the first time, we consider computing models of GK theories by disjunctive logic programs. We shall propose a polynomial translation from a (pure) GK theory to a disjunctive logic program such that there is a one-to-one correspondence between GK models of the GK theory and answer sets of the resulting disjunctive logic program. The result can then be used to compute the extension/expansion semantics of default logic, autoepistemic logic and Turner’s logic of universal causation by disjunctive ASP solvers such as GNT [Janhunen and Niemelä, 2004], cmodels [Giunchiglia, Lierler, and Maratea, 2006], DLV [Leone et al., 2006], claspD [Drescher et al., 2008] and claspD-2 [Gebser, Kaufmann, and Schaub, 2013]. In particular, the recent advances in disjunctive answer set solving [Gebser, Kaufmann, and Schaub, 2013] open up promising research avenues towards applications of expressive nonmonotonic knowledge representation languages.

To substantiate this claim, we have implemented the translation and report on some preliminary experiments that we conducted on the special case of computing extensions for Reiter’s default logic [Reiter, 1980]. The implementation, called gk2dlp, is available for download from the second author’s home page.111http://informatik.uni-leipzig.de/~strass/gk2dlp/

Providing implementations for theoretical formalisms has a long tradition in nonmonotonic reasoning, for an overview see [Dix, Furbach, and Niemelä, 2001]. In fact, nonmonotonic reasoning itself originated from a desire to more accurately model the way humans reason, and was since its conception driven by applications in commonsense reasoning [McCarthy, 1980, 1986]. Today, thanks to extensive research efforts, we know how closely interrelated the different formalisms for nonmonotonic reasoning are, and can use this knowledge to improve the scope of implementations.

This paper is organized as follows. Section 2 reviews logic programs, the logic of GK and default and autoepistemic logics. Section 3 presents our main result, the mapping from GK to disjunctive logic programming. Section 4 presents our prototypical implementation, several experiments we conducted to analyze the translation, possible applications for it, and a comparison with previous and related work. Section 5 concludes with ideas for future work.

Preliminaries

We assume a propositional language with two zero-place logical connectives for tautology and for contradiction. We denote by the set of atoms, the signature of our language, and the set of literals: . A set of literals is called complete if for each atom , exactly one of is in .

In this paper, we identify an interpretation with a complete set of literals. If is a complete set of literals, we use it as an interpretation when we say that it is a model of a formula, and we use it as a set of literals when we say that it entails a formula. In particular, we denote by the logical closure of (considered to be a set of literals).

Logic Programming

A nested expression is built from literals using the 0-place connectives and , the unary connective “” and the binary connectives “,” and “;” for conjunction and disjunction. A logic program with nested expressions is a finite set of rules of the form , where and are nested expressions. The answer set of a logic program with nested expressions is defined as in [Lifschitz, Tang, and Turner, 1999]. Given a nested expression and a set of literals, we define when satisfies , written below, recursively as follows ( is a literal):

  • if ,

  • and ,

  • if ,

  • if and , and

  • if or .

satisfies a rule if whenever . satisfies a logic program , written , if satisfies all rules in .

The reduct of related to is the result of replacing every maximal subexpression of  that has the form with if , and with otherwise. For a logic program without , the answer set of is any minimal consistent subset of that satisfies . We use to denote the set of answer sets of . Now a consistent set  of literals is an answer set of  iff . Every logic program with nested expressions can be equivalently translated to disjunctive logic programs with disjunctive rules of the form

where and are propositional literals.

Default Logic

Default logic [Reiter, 1980] is for making and withdrawing assumptions in the light of incomplete knowledge. This is done by defaults, that allow to express rules of thumb such as “birds usually fly” and “tools usually work.” For a given logical language, a default is any expression of the form where are formulas of the underlying language. A default theory is a pair , where is a set of formulas and is a set of defaults. The meaning of default theories is given through the notion of extensions. An extension of a default theory is “interpreted as an acceptable set of beliefs that one may hold about the incompletely specified world ” [Reiter, 1980]. For a default theory and any set of formulas let be the smallest set satisfying (1) , (2) , (3) If , and , then . A set of formulas is called an extension for iff .

Autoepistemic Logic

Moore [1985] strives to formalize an ideally rational agent reasoning about its own beliefs. He uses a belief modality to explicitly refer to the agent’s belief within the language. Given a set of formulas (the initial beliefs), a set is an expansion of if it coincides with the deductive closure of the set . In words, is an expansion if it equals what can be derived using the initial beliefs and positive and negative introspection with respect to itself. It was later discovered that this definition of expansions allows unfounded, self-justifying beliefs. Such beliefs are however not always desirable when representing the knowledge of agents.

The Logic of GK

The language of GK proposed by Lin and Shoham [1992] is a modal propositional language with two modal operators, , for knowledge, and , for assumption. GK formulas are propositional formulas with and , that is,

where is an atom. A GK theory is a set of GK formulas.

GK is a nonmonotonic logic, and its semantics is defined using the standard Kripke possible world interpretations. Informally speaking, a GK model is a Kripke interpretation where what is true under is minimal and exactly the same as what is true under . The intuition here is that given a GK formula, one first makes some assumptions (those true under ), then one minimizes the knowledge thus entailed, and finally checks to make sure that the initial assumption is justified in the sense that the minimal knowledge is the same as the initial assumption.

Formally, a Kripke interpretation  is a tuple , where is a nonempty set of possible worlds, a function that maps a possible world to an interpretation, and binary relations over representing the accessibility relations for and , respectively, and , called the actual world of . The satisfaction relation between a Kripke interpretation and a GK formula is defined in a standard way:

  • ,

  • iff , where is an atom,

  • iff ,

  • iff and ,

  • iff or ,

  • iff for any such that ,

  • iff for any such that .

Note that for any , is an interpretation. We say that a Kripke interpretation  is a model of a GK formula  if satisfies , is a model of a GK theory if satisfies every GK formula in . In the following, given a Kripke interpretation , we let

Notice that and are always closed under classical logical entailment – they are propositional theories.

Given a GK formula , a Kripke interpretation is a minimal model of  if is a model of  and there does not exist another model of such that and . We say that is a GK model of if is a minimal model of  and .

In this paper, we consider only GK formulas that do not contain nested occurrences of modal operators. Specifically, an -atom is a formula of the form and a -atom is a formula of the form , where is a propositional formula. A GK formula is called a pure GK formula if it is formed from -atoms, -atoms and propositional connectives. Similarly, a pure GK theory is a set of pure GK formulas. Given a pure GK formula , we denote

For a pure GK theory , we use and to denote their modal atoms.

So far, the applications of the logic of GK only ever use pure GK formulas. We now present some embeddings of well-known nonmonotonic knowledge representation languages into the logic of GK.

Default logic

A (propositional) default theory (under extension semantics) is translated into pure GK formulas in the following way: (1) Translate each to ; (2) translate each to . For the weak extension semantics, a default is translated to .

Autoepistemic logic

An -sentence of autoepistemic logic that is in normal form [Konolige, 1988], that is, a disjunction of the form , is (under expansion semantics) expressed as . For strong expansion semantics, it becomes .

Notice that the translation of default and autoepistemic theories into the logic of GK is compatible with Konolige’s translation from default logic into autoepistemic logic [Konolige, 1988]. Indeed, Konolige’s translation perfectly aligns the weak extension semantics of default logic with expansion semantics for autoepistemic logic, and likewise for extension and strong expansion semantics [Denecker, Marek, and Truszczyński, 2003].

Logic of universal causation

The logic of universal causation is a nonmonotonic propositional modal logic with one modality  [Turner, 1999]. A formula of this logic is translated to the pure logic of GK by replacing every occurrence of by , adding before each atom which is not in the range of in it, and adding for each atom . For example, if a UCL formula is and , then the corresponding pure GK formula is .

Disjunctive logic programs

A disjunctive LP rule

where ’s are atoms, corresponds to the pure GK formula:

Main Result: From Pure GK to Disjunctive ASP

Before presenting the translation, we introduce some notations. Let be a pure GK formula, we use to denote the propositional formula obtained from by replacing each occurrence of a -atom by and each occurrence of an -atom by , where and are new atoms with respect to and respectively. For a pure GK theory , we define . To illustrate these and the definitions that follow, we use a running example.

Example 1 (Normal Reiter default)

Consider the pure GK theory with corresponding to the default , and another pure GK theory with corresponding to the default . Then and , where , , and are new atoms.

Here we introduce a set of new atoms and for each formula and . Intuitively, the new atom (resp. ) will be used to encode containment of the formula in (resp. ) of a GK model for .

Given a propositional formula and an atom , we use to denote the propositional formula obtained from by replacing each occurrence of an atom with a new atom with respect to . These formulas and new atoms will later be used in our main translation to perform the minimality check of the logic of GK’s semantics.

We now stepwise work our way towards the main result. We start out with a result that relates a pure GK theory to a propositional formula that will later reappear in our main translation.

Proposition 1

Let be a pure GK theory. A Kripke interpretation is a model of if and only if there exists a model of the propositional formula where

such that

  • ;

  • .

The proposition examines the relationship between models of a pure GK theory and particular models of the propositional formula . The first conjunct of the formula indicates that the -atoms and -atoms in it can be interpreted in accordance with and such that iff is a model of . The soundness formula achieves that the sets and are consistent. The witness formulas indicate that, if for some (resp. ) then there exists a model of (resp. ) such that , where is explicitly indicated by newly introduced (resp. ) atoms. So intuitively, if a formula is not known (or not assumed), then there must be a witness for that. This condition is necessary: for instance, the set satisfies the formula , however, since is a theory there does not exist a Kripke interpretation such that , and .

Example 1 (Continued)

Formula is given by:

Formula is given by:

where , , , , and are new atoms. Note that formula prevents a model that satisfies both and .

While Proposition 1 aligns Krikpe models and propositional models of the translation, there is yet no mention of GK’s typical minimization step. This is the task of the next result, which extends the above relationship to GK models.

Proposition 2

Let be a pure GK theory. A Kripke interpretation is a GK model of if and only if there exists a model of the propositional formula such that

  • ;

  • for each ,

  • there does not exist another model such that

Example 1 (Continued)

Clearly the intended reading of our running example is that there is no reason to assume that is false, and the default lets us conclude that we know . This is testified by the partial interpretation (the remaining atoms are not relevant). It is easy to see that is a model for and there is no model with the properties above. Now shows that is known in the corresponding GK model.

Similarly, provides a reason to assume that is false and concludes that we know . Consider the partial interpretation , it specifies a model for and there is no model with the properties above. In particular, shows that is known in the corresponding GK model.

In Proposition 2, we only need to consider a Kripke interpretation such that is consistent. This means that formula can be modified to where

So the soundness formula actually becomes easier, since soundness of knowledge and assumptions is enforced for one and the same vocabulary (the one from the original theory). The witness formulas become somewhat more complicated, as the witnesses have to respect both the knowledge as well as the assumptions of the theory. This is best explained by consulting our running example again.

Example 1 (Continued)

While ’s propositionalization stays the same, the soundness and witness formulas change in the step from formula to formula . We only show the first conjunct of the witness formula , which is given by

Intuitively, the formula expresses that whenever is not known, then there must be a witness, that is, an interpretation where is false. Since the witnessing interpretations could in principle be distinct for each -atom, they have to be indexed by the respective -atom they refer to, as in . Of course, the witnesses have to obey all that is known and assumed, which is guaranteed in the last two conjuncts.

Using this new formula, the result of Proposition 2 can be restated.

Proposition 3

Let be a pure GK theory. A Kripke interpretation is a GK model of if and only if there exists a model of the propositional formula  such that

  • ;

  • for each , we have that implies

  • there does not exist another model of  such that

We are now ready for our main result, translating a pure GK theory to a disjunctive logic program. First, we introduce some notations. Let be a pure GK theory, we use to denote the nested expression obtained from  by first converting it to negation normal form222A propositional formula is in Negation Normal Form (NNF) if negation occurs only immediately above atoms, and are the only allowed connectives., then replacing “” by “” and “” by “”. A propositional formula can be equivalently translated to conjunctive normal form (involving at most linear blowup)

where ’s and ’s are atoms; we use to denote the set of rules

We use to denote the propositional formula obtained from by replacing each occurrence of an atom by a new atom .

We use to denote the propositional formula obtained from the formula  by replacing each occurrence of an atom (except atoms in ) by a new atom . Intuitively, each atom that is not an -atom is replaced by a new atom.

Notice that is obtained from  while is obtained from . Intuitively, by Proposition 3, is used to restrict interpretations for introduced -atoms and -atoms so that these interpretations serve as candidates for GK models, and by Proposition 1, constructs possible models of the GK theory which are later used to test whether these models prevent the candidate to be a GK model.

(for each atom occurring in )
(for each rule in )
()
(for each )
(for each )
(for each )
(for each )
(for each new atom occurring in )
(for each )
(for each rule in
(for each atom except -atoms and -atoms occurring in
Figure 1: Translation from pure GK theory to disjunctive logic program used in Theorem 1, where , , and (for each ) are new atoms.

Inspired by the linear translation from parallel circumscription into disjunctive logic programs by Janhunen and Oikarinen [2004], we have the following theorem.

Theorem 1

Let be a pure GK theory. A Kripke interpretation is a GK model of if and only if there exists an answer set of the logic program in Figure 1 with .

The intuition behind the construction is as follows:

  • (1) and (2) in : is a model of the formula .

  • (3–8): if there exists a model of the formula  with

    then there exists a set constructed from new atoms in (which is a copy of the formula  with same for each ) and for some such that satisfies rules (3) to (8) and .

  • (9) and (10): if there is such a set then it is the least set containing , all ’s and -atoms.

  • (11): such a set should not exist. (See item 3 in Proposition 3.)

  • (12) and (13): if there exists a model of the formula , then should not occur in the minimal model of the program.

  • (14): should not be consistent. (This is necessary by item 2 in Proposition 3.)

Given a model of the logic program , the new atom is used to indicate that the model of w.r.t. (specified by (1) and (2)) satisfies item 3 in Proposition 3. Specifically, if does not satisfy item 3, then there exists a subset of ’s and -atoms that satisfies (3) to (8). If in addition , then there exists a subset of that satisfies all rules in except (11), thus cannot be an answer set of . Similarly, is used to indicate that satisfies item 2 in Proposition 3. Specifically, if does not satisfy item 2, then the propositional formula is satisfiable, thus there exists a subset of ’s that satisfies (12). If in addition , then there exists a subset of that satisfies all rules in except (14), thus cannot be an answer set of .

Example 1 (Continued)

For our running example theory with , we find that the logic program translation has a single answer set with Thus by Theorem 1 we can conclude that the GK theory has a single GK model in which . Likewise, the logic program has a single answer set with , whence has a single GK model in which .

Computational complexity

We have seen in the preliminaries section that disjunctive logic programs can be modularly and equivalently translated into pure formulas of the logic of GK. Conversely, Theorem 1 shows that pure GK formulas can be equivalently translated into disjunctive logic programs. Eiter and Gottlob showed that the problem of deciding whether a disjunctive logic program has an answer set is -complete [Eiter and Gottlob, 1995]. In combination, these results yield the following straightforward complexity result for the satisfiability of pure GK.

Proposition 4

Let be a pure GK theory. The problem of deciding whether has a GK model is -complete.

We remark that the hardness of disjunctive logic programs stems from so-called head cycles (at least two atoms that mutually depend on each other and occur jointly in some rule head). It is straightforwardly checked that our encoding creates such head cycles, for example the head of rule (8) contains the cycle induced by rules (7) and (10).

Implementation

We have implemented the translation of Theorem 1 into a working prototype gk2dlp. The program is written in Prolog and uses the disjunctive ASP solver claspD-2 [Gebser, Kaufmann, and Schaub, 2013], which was ranked first place in the 2013 ASP competition.333http://www.mat.unical.it/ianni/storage/aspcomp-2013-lpnmrtalk.pdf

Our prototype is the first implementation of the (pure) logic of GK to date. The restriction to pure formulas seems harmless since all known applications of the logic of GK use only pure formulas. We remark that gk2dlp implements default and autoepistemic logics such that input and target language are of the same complexity.

Evaluation

To have a scalable problem domain and inspired by dl2asp [Chen et al., 2010], we chose the fair division problem [Bouveret and Lang, 2008] for experimental evaluation. An instance of the fair division problem consists of a set of agents, a set of goods, and for each agent a set of constraints that intuitively express which sets of goods the agent is willing to accept. A solution is then an assignment of goods to agents that is a partition of all goods and satisfies all agents’ constraints. Bouveret and Lang [2008] showed that the problem is -complete, and can be naturally encoded in default logic.

We created random instances of the fair division problem with increasing numbers of agents and goods. We then applied the translation of [Bouveret and Lang, 2008], furthermore the translation from default logic into the logic of GK, then invoked gk2dlp to produce logic programs and finally used gringo 3.0.3 and claspD version 2 (revision 6814) to compute all answer sets of these programs, thus all extensions of the original default theory corresponding to all solutions of the problem instance. The experiments were conducted on a Lenovo laptop with an Intel Core i3 processor with 4 cores and 4GB of RAM running Ubuntu 12.04. We recorded the size of the default theory, the size of the translated logic program, the translation time and the solving time, as well as the number of solutions obtained. We started out with 2 agents and 2 goods, and stepwise increased these numbers towards 6. For each combination in , we tested 20 randomly generated instances. Random generation here means that we create agents’ preferences by iteratively drawing random subsets of goods to add to an agent’s acceptable subsets with probability , where is initialized with and discounted by the factor for each subset that has been drawn.

In accordance with our theoretical predictions, we observed that the increase in size from GK formula to logic program is indeed polynomial (albeit with a low exponent). The plot on the right (Figure 2) shows the solving time in relation to the size of the default theory, where the time axis is logarithmic. We can see that the runtime behavior of gk2dlp is satisfactory. We acknowledge however that the runtimes we measured are not competitive with those reported by Chen et al. [2010] for dl2asp. However, a direct comparison of the two systems is problematic for a number of reasons. First of all, the system dl2asp is not publicly available to the best of our knowledge. Furthermore, Chen et al. [2010] do not describe how they create random instances of the fair division problem, so we cannot compare the runtimes they report and the ones we measured. Finally, dl2asp is especially engineered for default logic, and it is not clear how their approach can be generalized to other languages, for example Turner’s logic of universal causation. In general, the approaches to translation that are followed by dl2asp and gk2dlp are completely different: dl2asp translates a -complete problem to an -complete problem using a translation in . Our system gk2dlp translates a -complete problem into another -complete problem using a translation that can be computed in polynomial time.

0.1

1

10

100

1000

0

500

1000

1500

2000

2500

solving time (seconds)

default theory size