[
Abstract
(To appear in Theory and Practice of Logic Programming (TPLP))
is designed and implemented as an experiment platform to investigate the semantics, language, related reasoning algorithms, and possible applications of epistemic specifications. We first give the epistemic specification language of and its semantics. The language employs only one modal operator K but we prove that it is able to represent luxuriant modal operators by presenting transformation rules. Then, we describe basic algorithms and optimization approaches used in . After that, we discuss possible applications of in conformant planning and constraint satisfaction. Finally, we conclude with perspectives.
ESmodels: An Epistemic Specification Solver]
ESmodels: An Epistemic Specification Solver
ZZ. Zhang, KK. Zhao]
ZHIZHENG ZHANG and KAIKAI ZHAO
School of Computer Science and Engineering
Southeast University, NanJing 211189, China
\jdateMarch 2003
2003
\pagerange[–References
\doiS1471068401001193
ogic programming, epistemic specification, knowledge representation
1 Introduction
The language of epistemic specification initially proposed in [Gelfond and Przymusinska (1991)], [Gelfond and Przymusinska (1993)], [Gelfond (1994)], and [Gelfond (1991)] is an extension of the language of answer set programs by modal operators K and M to represent beliefs of the agent capable of introspection in the presence of multiple belief sets. Intuitively, it use to denote an proposition is believed to be true in each of the agent’s belief sets, and to denote an proposition is believed to be true in some of the agent’s belief sets. This extension is believed to be useful by discussing its application to formalization of commonsense reasoning. Along its syntax and semantics in [Gelfond and Przymusinska (1991)], a few efforts were made to establish reasoning algorithms in [Zhang (2006)] and [Watson (1994)], and theoretical foundation in [Zhang (2003)], [Watson (2000)], and [Wang and Zhang (2005)]. Recently, research on epistemic specifications increases again because introspective reasoning is becoming reality and forseeable as showed in [Faber and Woltran (2011)], [Faber and Woltran (2009)], and [Truszczyński (2011)]. To eliminate some unintended interpretations which exist under the original definition, a new semantics is defined in [Gelfond (2011)] to arguably close to the intuitive meaning of modalities. Currently, efforts are still desired to made to establish and validate properties of epistemic specifications and the corresponding reasoning algorithms, and to investigate the use of the language. The design and implementation of an epistemic specification solver is hoped to facilitate those efforts.
This article introduces an epistemic specification solver that is recently being designed and implemented as a flexible platform for experiment with epistemic specifications. The language of has two types of subjective literals K and K. To express other types of subjective literals, we propose a group of transformation rules rewriting epistemic specifications with arbitrary types of subjective literals in ’s language. In , a generatetest algorithm for computing world views of the epistemic specification is employed. It is worth noting that efficient ASP solver is coupled into to help to generate candidate world views efficiently. Optimization approaches are preliminarily used to promoting the efficiency of the basic algorithm. Presently, we are applying in solving security conditions in conformant planning, and encoding constraint satisfaction problems.
2 Language
2.1 Syntax and Semantics
An ’s epistemic specification is a collection of finite rules in the following form
where each for is an objective literal, ie. either an atom or the negation of , and S is either K or , is negation as failure. The set of all objective literals appears in an epistemic specification is denoted by . Given a rule in the above form, let denote its head , and the body . Furthermore, let be the positive objective body and negative objective body of , and the subjective body . In addition, we use to denote the set of objective literals in the body of which appears in term K, and to denote the set of objective literals in the body of which appears in term K.
Epistemic specifications with variables are considered as shorthands for their ground instantiations. In the rest of this section, except special noted, we always consider the epistemic specification is grounded.
Let be a nonempty collection of sets of objective literals, and an objective literal.

K is satisfied with regard to , denoted by K , iff : .

K is satisfied with regard to , denoted by K , iff : .
Definition 1
Let be an epistemic specification and be a nonempty collection of sets of objective literals in . is a world view of iff is the collection of all answer sets of denoted by , where is an ASP program obtained from by the following reduct laws:

RL1: removing all rules containing subjective literals not satisfied by ;

RL2: removing any remaining subjective literals of the form K;

RL3: replacing any remaining subjective literals of the form K by .
Example 1
Let an epistemic specification consist of the following three rules:
With regard to , is satisfied while is not satisfied. Hence, and then . So is a world view of . Similarly, is also a world view of .
2.2 Representation of Other Subjective Literals
To handle other subjective literals using , namely K , K , M, M, M , and M , we can convert an epistemic specification with arbitrary subjective literals in rules bodies into an epistemic specification such that has only subjective literals in the form K or K by the following transformation procedure.

For each objective literal , add a rule to if there exist a subjective occurrence of K or M or M or K in , where is a new created objective literal corresponding to .

Add each rule of to after performing the following operations on it.

Replace K by K;

Replace M by K;

Replace M by K;

Replace K by K;

Replace M by K;

Replace M by K.

Then, we define its world view based semantics as follows.
Definition 2
For an epistemic specification with arbitrary subjective literals, let be a set of objective literals appearing in , and its corresponding epistemic specification, a collection of sets of objective literals is a world view of iff there exists a world view of such that .
Example 2
Given an epistemic specification then we have and . has two world views and , hence, has two world views and .
Example 3
Given an epistemic specification , then we have . has two world views and , hence, has two world views and .
2.3 Connection to Gelfond’s New Epistemic Specification
In the syntactic aspect of the epistemic specification defined in [Gelfond (2011)], it allows two more subjective literals of forms, K not and K not , in the rule’s body. The modality M is defined to be expressed in terms of K by . Semantically, let be a nonempty collection of sets of objective literals, and an objective literal.

K is satisfied with regard to , denoted by K , iff : .

K is satisfied with regard to , denoted by K , iff : .

K not is satisfied with regard to , denoted by iff for every , , otherwise
The set is called a world view of if is the collection of all answer sets of , where is obtained by

removing all rules containing subjective literals not satisfied by ;

removing any remaining subjective literals of the form K or K;

replacing any remaining subjective literals of the form K by and any K by .
Theorem1 shows that can compute the world view of any Gelfond’s new epistemic specification.
Theorem 1
For any Gelfond’s new epistemic specification , let be a set of objective literals appearing in , a collection of sets of objective literals is a world view of under Gelfond’s new definition iff there exists a world view of such that .
The main idea of this proof is as follows. Let be objective literals appearing in ,
direction: if there is a world view of , then for any , is an answer set of . Let , then is an answer set of under Gelfond’s new definition (because the GelfondLifschitz reduction of wrt. just possibly has less facts than the GelfondLifschitz reduction of wrt. ).
direction: if is a world view of , then we create as follows: for each , we have in . Then, is an answer set of (because the GelfondLifschitz reduction of wrt. just possibly has more facts than the GelfondLifschitz reduction of wrt. ).
Example 4
Given an epistemic specification , under Gelfond’s definition has two world views and . By the transformation defined in last subsection, we have , and can find ’s two world views: and , that is, also has two world views and by .
3 Computing World Views in
A generatetest algorithm forms a basis of computing world views in . Now, we are taking two preliminary steps to optimize the algorithm.
3.1 Basic Algorithm
Let be an epistemic specification, be a set of objective literals such that iff K or K occurring in . Then, we call a pair an assignment of iff
Then, we define an answer set program obtained by:

removing from all rules containing subjective literals K such that , or subjective literal K such that ,

removing from the rest rules in all other occurrences of subjective literals of the form K,

replacing remaining occurrences of literals of the form K by .
Theorem 2
Given an epistemic specification and a collection of sets of objective literals. is a world view of if an assignment of exists such that

is the collection of all answer sets of ,

satisfies the assignment, that is, and .
If both and are satisfied, we have . Hence, if is the collection of all answer sets of then is the collection of all answer sets of , that is, is a world view of .
By Theorem 2, an immediate method of computing the world views of an epistemic specification includes three main stages: generating a possible assignment, reducing the epistemic specification into an answer set program, and testing if the collection of the answer sets of the answer set program satisfies the assignment. At a high level of abstraction, the method can be implemented as showed in the following algorithm.
ESMODELS firstly gets all subjective literals and generates all possible assignments of . For each assignment, the algorithm reduces to an answer set program , i.e., . Next, it calls exiting ASP solver like Smodels, Clasp to compute all answer sets of . Finally, it verifies the . is a world view of , if satisfies and . ESMODELS stops, when all possible assignments are tested.
3.2 Optimization Approaches
3.2.1 Reducing Subjective Literals
However, ESMODELS has a high computational cost, especially with a large number of subjective literals. Therefore, we introduce a new preprocessing function to reduce reduce before generating all possible assignments of . We first give several propositions.
Let be an epistemic specification and a pair of objective literals of , be an lower bound operator on defined as follows:
where , . Intuitively, computes the objective literals that must be true and that not true with regard to and which are sets of literals known true and known not true respectively. Clearly, we can use this operation to reduce the searching space of subjective literals. This idea is guaranteed by the following definitions and propositions.
Definition 3
A pair of sets of objective literals is a partial model of an epistemic specification if, for any world view of , and .
Theorem 3
is a partial model if is a partial model of an epistemic specification , .
Let to denote of a pair , and to denote . The main idea of this proof is as follows. For any world view of , and , by the definition of , the GelfondLifschitz reduction of wrt. any must have and must not have any rule with head in , hence, we have and .
Corollary 1
Let, , then is a partial model of .
Because is a partial model, is a partial model, and so on, … are partial models of An epistemic specification rule is defeated by if or . Let be a partial model of an epistemic specification , is obtained by

removing from all rules defeated by ,

removing from the rest rules in all other occurrences of literals of the form not or K such that ,

removing remaining occurrences of literals of the form or K such that .

adding if

adding if
Theorem 4
If is a partial model of an epistemic specification , and have the same world views.
The main idea in this proof is as follows. For any world view of , if and , then and have the same answer sets. And, for any world view of , we have that is a world view of .
By theorem 3 and 4, we can design PreProcess showed in algorithm 2. Firstly, it sets the pair () as . Then it expands the partial model of and reducts the according to (). Next, we updates the partial model by the new program. Finally, it compares the new partial model with the previous one. If the partial model is stable, it stops and returns ; Otherwise, it repeats this procedure.
Obviously, PreProcess and partial model are very helpful for reducing search space. We thus provide an EFFICIENT ESMODELS as follows:
3.2.2 Using Multicore Technology
In , another way of improving efficiency is the use of multicore technology. Based on Algorithm 3, by parallel generation of possible assignments and parallel calling of ASP solver, the efficiency of can be improved greatly.
4 Applications
4.1 Conformant Planning
Consider the planning problem with multiple possible initial states, what makes it become much harder is to find a so called secure plan that enforces the goal from any initial state. [Eiter et al. (2003)] gives three security conditions to check whether a plan is secure:

the actions of the plan are executable in the respective stages of the execution;

at any stage, executing the respective actions of the plan always leads to some legal successor state; and

the goal is true in every possible state reached if all steps of the plan are successfully executed.
Here, we consider a track of effects of executing an action sequence as a belief set, thus can intuitively encode those security conditions in epistemic specification constraints. We use to denote the actions are not executable, to denote that a state is illegal, to sign a state satisfies the goal, and to denote the state reached after a given steps number satisfies the goal, and to denote an action happens in the step :

for security condition 1:

for security condition 2:

for security condition 3: and
Moreover, to guarantee the above security testing is put on tracks caused by the same action sequence, we write a new constraint.
(1) 
Intuitively, rule (1) says that if one action happened in stage of one track, it happened in stage of all tracks. Thus, we can easily get a Conformant Planning Module consisting of the above five constraints and the following action generation rules:

Set a planning horizon :

Generating one action for each step:
Combine the conformant planning module with a planning domain (including action axioms e.g., inertial law) encoded in an answer set program, the result epistemic specification represents a conformant planning problem, and its world view(s) corresponds to the secure plan(s) of the problem. Here, we use a case provided in [Palacios and Geffner (2006)] to demonstrate the conformant planning approach using epistemic specification. Given a conformant planning problem with an initial state (i.e., nothing else is known; there is no CWA), and action and with effects causes if , causes if , and causes if , the planning goal is . Then, we describe the planning domain as follows.

Signatures:

Causal Laws:

Inertial Laws:

Initial:

Goal:
When we set , can find the unique world view including twelve literal sets, and each of them includes and that means the program has a conformant plan .
4.2 Constraints Satisfaction
In some situations, constraints on the variable are with epistemic features, that is, a variable’s value is not only affected by the values of other variables, but also determined by all possible values of other variables. Here, we demonstrate the use of in solving such constraint satisfaction problems using a dinner problem:Jim, Bones, Checkov, Mike, Jack, Uhura, and Scotty, and Tommy received a dinner invitation, and the constraints on their decisions and the constraints description in epistemic specification rules are as follows:

if Checkov may not participate, then Jim will participate:

if Jim may not participate, then bones will participate:

if only one of Jack and Mike will participate:

if Jack must participate, then Uhura will participate:

if Uhura may not participate, then Scotty will participate:

if Scotty must participate, then Tommy will participate:

Checkov will participate.
can find the unique world view that means Jim, Checkov, Scotty, and tommy must participate, Bones and Uhura must not participate, Jack and Mike may or may not participate.
5 Conclusion
is an epistemic specification solver designed and implemented as an experiment platform to investigate the semantics, language, related reasoning algorithms, and possible applications of epistemic specifications. A significant feature of this solver is that its language is more compact than that defined in literatures, but capable of representing many subjective literals via a group of transformation rules. Besides, this solver can compute world views under Gelfond’s new definition, while that presented by Zhang in [Zhang (2007)] and Watson in [Watson (1994)] are based on the early definition of epistemic specifications. In addition, we find the compact encoding of conformant planning problems and constraint satisfaction problems in the epistemic specification language, which primarily shows ’s potential in applications^{1}^{1}1In the early related work, Gelfond investigated the value of epistemic specifications in formalizing commonsense reasoning.
The work presented here is primary. Now, we are designing and exploring more efficient algorithm for and evaluate it using those benchmarks in the conformant planning field.
Acknowledgment
We acknowledge the support from Project 60803061 and 61272378 by National Natural Science Foundation of China, and Project BK2008293 by Natural Science Foundation of Jiangsu.
References
 Eiter et al. (2003) Eiter, T., Faber, W., Leone, N., Pfeifer, G., and Polleres, A. 2003. A logic programming approach to knowledgestate planning, ii: The dlvk system. Artificial Intelligence 144, 1, 157–211.
 Faber and Woltran (2009) Faber, W. and Woltran, S. 2009. Manifold answerset programs for metareasoning. In Logic Programming and Nonmonotonic Reasoning. Springer, 115–128.
 Faber and Woltran (2011) Faber, W. and Woltran, S. 2011. Manifold answerset programs and their applications. In Logic programming, knowledge representation, and nonmonotonic reasoning. Springer, 44–63.
 Gelfond (1991) Gelfond, M. 1991. Strong Introspection. In National Conference on Artificial Intelligence. 386–391.
 Gelfond (1994) Gelfond, M. 1994. Logic programming and reasoning with incomplete information. Annals of mathematics and artificial intelligence 12, 12, 89–116.
 Gelfond (2011) Gelfond, M. 2011. New semantics for epistemic specifications. In Logic Programming and Nonmonotonic Reasoning. Springer, 260–265.
 Gelfond and Przymusinska (1991) Gelfond, M. and Przymusinska, H. 1991. Definitions in epistemic specifications. In LPNMR (20020103). 245–259.
 Gelfond and Przymusinska (1993) Gelfond, M. and Przymusinska, H. 1993. Reasoning on open domains. In LPNMR. Vol. 1993. 397–413.
 Palacios and Geffner (2006) Palacios, H. and Geffner, H. 2006. Compiling uncertainty away: Solving conformant planning problems using a classical planner (sometimes). In AAAI. AAAI Press, 900–905.
 Truszczyński (2011) Truszczyński, M. 2011. Revisiting epistemic specifications. In Logic programming, knowledge representation, and nonmonotonic reasoning. Springer, 315–333.
 Wang and Zhang (2005) Wang, K. and Zhang, Y. 2005. Nested epistemic logic programs. In Logic Programming and Nonmonotonic Reasoning. Springer, 279–290.
 Watson (1994) Watson, R. 1994. An inference engine for epistemic specifications. 1994.M.S. Thesis, Department of Computer Science, University of Texas at El Paso..
 Watson (2000) Watson, R. 2000. A splitting set theorem for epistemic specifications. In Proceedings of the 8th International Workshop on NonMonotonicReasoning (NMR2000).
 Zhang (2003) Zhang, Y. 2003. Minimal change and maximal coherence for epistemic logic program updates. In IJCAI. 112–120.
 Zhang (2006) Zhang, Y. 2006. Computational properties of epistemic logic programs. In KR. 308–317.
 Zhang (2007) Zhang, Y. 2007. Epistemic reasoning in logic programs. In IJCAI. 647–653.