<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>A new OWLAPI interface for HEX-Programs applied to Explaining Contingencies in Production Planning</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Peter Sch u¨ller</string-name>
          <email>peter.schueller@tuwien.ac.at</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Technische Universita ̈t Wien, Institute of Logic and Computation, Knowledge-Based Systems Group</institution>
          ,
          <country country="AT">Austria</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Description Logics (DLs) and Logic Programs are formalisms for describing knowledge about the world. In industrial settings, DLs are often used to describe factories and inventories, and logic programs could be useful for planning production - if they can be integrated with DLs. We here introduce a variation of the DL Program formalism for integrating description logics with Answer Set Programming (ASP). We a new implementation based on OWLAPI and a use case in Explainable AI for production planning. Our integration is based on the HEX formalism and the Hexlite solver. Different from previous work, we extend the integration interface to permit an arbitrary number of parallel modifications of the OWL ontology to be considered for the computation of a single answer set. This is useful to model changes of the planning domain over time, where each time step is a separate modification of the ontology. We present a case study towards the EU recommendations on 'Human-centered, trustworthy AI systems', concretely we present a production planning framework that can be challenged by users with alternative scenarios. With our case study we argue that Explainability in the context of planning is not about the rationale behind decisions (those are defined by formal semantics and by the program) but we argue that Explainability should mainly focus on the possibility of human operators to challenge the system and request alternative solutions under alternative assumptions. We provide the following examples to show that Logic Programming requires only very small modifications to provide insights by means of the following whatif questions: (i) which machines could be deactivated without preventing to reach the production goal and (ii) which product could be skipped to reach a reduced production goal in a shorter time limit.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>Description Logics (DLs) are useful tools for describing knowledge
about objects in the world, and they are in practical usage in
industrial settings, where they are the basis for describing factory
inventories and production processes. These descriptions are static and
usually considered timeless.</p>
      <p>
        In production planning, processes in a factory change products
and materials. For planning it is useful to consider changes in the
assertional knowledge of an ontology. One method for planning is
the usage of Answer Set Programming (ASP) [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], which is a
nonmonotonic knowledge representation formalism based on rules and
solver tools based on SAT solving techniques. In ASP planning, time
Copyright c 2020 for this paper by its authors. Use permitted under
Creative Commons License Attribution 4.0 International (CC BY 4.0).
ClosedBox v Box
OpenBox v Box
ClosedBox u OpenBox v ?
MRobot v Robot
PRobot v Robot
A ordsClosing v A ordance
A ordsOpening v A ordance
A ordsPainting v A ordance
OpenBox v A ordsClosing
ClosedBox v A ordsOpening
ClosedBox v A ordsPainting
closed boxes are boxes
open boxes are boxes
no box is both open and closed
there are manipulation robots . . .
. . . and painting robots
open boxes can be closed
closed boxes can be opened
closed boxes can be painted
      </p>
      <p>r1 : MRobot
b1 : OpenBox
r2 : MRobot
b2 : OpenBox
r2 : PRobot
b3 : ClosedBox
is represented as a sequence of steps and in each step different truth
values can hold in the world.</p>
      <p>
        In practice, representing planning in DLs or representing
ontological knowledge in ASP is usually impractical.2 Therefore, it is natural
to integrate DLs and ASP in a way that both formalisms are used in
parallel within one integrated reasoning method. HEX is an ASP
formalism for integrating ASP with external computations of all kinds,
and one existing method for integrating ASP with DLs, DL-programs
[
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] actually use HEX as an underlying implementation formalism.
      </p>
      <p>As a running example, consider an ontology about robots that can
manipulate and paint boxes: the TBox is shown in Figure 1, the ABox
of a concrete factory is shown in Figure 2. The goal of our production
planning is to find a sequence of actions that paint all boxes where
only robots in the class PRobot can paint and only closed boxes
afford3 painting. Finally, robots in the class MRobot can open and
close boxes. Consider now the following information we would like
to gain by quering this planning domain: (I) is there a plan that
finishes the production within n1 steps, using as few actions as possible,
and what is that plan; (II) if we would have n2 &gt; n1 steps available,
which robots could we omit from the domain and still finish the job
in time; (III) if we have only n3 &lt; n1 steps available, which product
2 It is sometimes possible due to complexity results.
3 Affordances are a popular concept in robotics regarding prototypical
actions: if an object affords a certain action, it provides the possibility to be
affected by that action. An affordance is a property of an object, not an
agent, and some agents might not be capable of performing the action due
to geometric constraints or missing actuators.
could we omit from production to finish the other products in time.</p>
      <p>
        DL-programs [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] are well-suited to express planning domains,
including the above explanatory queries to the planning domain.
DLprograms permit queries to ontologies based on a modification of
an ontology that depends on the answer set of the solver.
Therefore, DL-programs provide a bidirectional integration between ASP
and DLs. Unfortunately, the concrete syntactic realization of
DLprograms makes it cumbersome to encode production planning
problems, because it is necessary to represent each time step using distinct
logical predicates. Moreover, there is no current working
implementation of DL-programs available as the licensing and the API of the
underlying DL reasoner has changed.
      </p>
      <p>In the following, we use the idea of DL-programs but we develop
and present the problem directly within the HEX-formalism. This
removes one layer of abstraction and simplifies presentation.</p>
      <p>
        ASP is often praised for its Elaboration Tolerance [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ] which is the
property to create modular programs with a separation of concerns
among program parts, and the possibility to modify each concern
separately and easily without a need to modify other parts of the
program. ASP also provides multiple answers and alternative solutions.
This makes AI systems based on ASP suitable for addressing several
concerns of the EU recommendation on ‘human-centered,
trustworthy AI systems’, in particular
      </p>
      <p>Human Agency, concretely to ‘self-assess and challenge the
system‘; and
Technical Robustness, concretely to provide ‘Fallback Plans‘.</p>
      <p>We next address above challenges and make the following
contributions.</p>
      <p>We introduce a new way of interfacing with DLs from HEX where
it is easily possible to describe multiple ontology modifications
in the extension of one predicate, which facilitates the encoding
of domains where multiple alternative worlds must be considered
and we do not know beforehand how many of such alternative
worlds exist. Planning is such a domain.</p>
      <p>
        We implement this integration using the OWLAPI interface and the
HEXLITE solver [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ], which provides a free and universal API for
OWL DLs to be used together with answer set programs. HEXLITE
is based on CLINGO [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] and therefore uses the state of the art in
ASP solving. OWLAPI interfaces with many existing DL
reasoners.
      </p>
      <p>We present a use case of production planning where action
preconditions are defined by the ontology, action effects are realized
as ontology modifications in the HEX program, and the initial state
of the world is taken from the ontology, including in particular all
individual names which are not known to the HEX program prior
to solving.</p>
      <p>We formulate our thoughts about how Explainability can be
realized in Logic programs and argue that the classical notion of
Explainability does not apply to Logic Programming, and that
instead the possibility to challenge the system with alternative
scenarios is an appropriate way to make a Logic Program more
human-centric.</p>
      <p>We discuss a possible usage of the production planning encoding
for obtaining explanations about feasible and necessary changes in
the production process to reach given production goals. Such
reasoning can be useful for optimizing the factory and for hardening
it against equipment malfunctions.
framework for integrating OWLAPI in HEX and comment on the
implementation, in Section 4 we use the framework for demonstrating
how to explain contingencies in production planning, we discuss
Explainability in Section 5 and we conclude in Section 6 with a brief
discussion.
2
2.1</p>
    </sec>
    <sec id="sec-2">
      <title>Preliminaries</title>
    </sec>
    <sec id="sec-3">
      <title>HEX - Answer Set Programming with External</title>
    </sec>
    <sec id="sec-4">
      <title>Computations</title>
      <p>
        We give syntax and semantics of the HEX formalism [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] which
generalizes logic programs under answer set semantics [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] with external
computations. A comprehensive introduction to HEX is given in [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
HEXLITE4;5 [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ] is a solver for the HEX formalism which is based
on Clingo [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] and enables implementation of external computations
using PYTHON.
      </p>
      <sec id="sec-4-1">
        <title>HEX Syntax</title>
        <p>Let C, X , and G be mutually disjoint sets whose elements are called
constant names, variable names, and external predicate names,
respectively. Usually, elements from X and C are denoted with first
letter in upper case and lower case, respectively; while elements from
G are prefixed with ‘ &amp; ’. Elements from C [ X are called terms. An
(ordinary) atom is a tuple p(Y1; : : : ; Yn) where p 2 C is a predicate
name and Y1; : : : ; Yn are terms and n 0 is the arity of the atom.
An atom is ground if all its terms are constants. An external atom is
of the form &amp;g[Y1; : : : ; Yn](X1; : : : ; Xm), where Y1; : : : ; Yn and
X1; : : : ; Xm are two lists of terms, called input and output lists,
respectively, and &amp;g 2 G is an external predicate name. We
assume that input and output lists have fixed lengths in(&amp;g) = n and
out (&amp;g) = m. With each term Yi in the input list, 1 i n, we
associate a type ti 2 fconsg [ N. We call the term constant input
iff ti = cons, otherwise we call it predicate input of arity ti.</p>
        <p>A rule r is of the form 1 _ _ k
1; : : : ; n; not n+1; : : : ; not m with m; k 0 where all
i are atoms and all j are either atoms or external atoms. We
let H(r) = f 1; : : : ; kg and B(r) = B+(r) [ B (r), where
B+(r) = f 1; : : : ; ng and B (r) = f n+1; : : : ; mg. A
HEX-program is a finite set P of rules.</p>
      </sec>
      <sec id="sec-4-2">
        <title>HEX Semantics</title>
        <p>Given a rule r, the grounding grnd (r) of r is obtained by
systematically replacing all variables with constants from C. Given a
HEXprogram P , the Herbrand base HB P of P is the set of all
possible ground versions of atoms and external atoms occurring in P
obtained by replacing variables with constants from C. The grounding
grnd (P ) of P is given by grnd (P ) = Sr2P grnd (r). Importantly,
the set of constants C that is used for grounding a program is only
partially given by the program itself: external computations may
introduce new constants, for example external computations can import
individual names from an ontology.</p>
        <p>
          Extensional Semantics [
          <xref ref-type="bibr" rid="ref5 ref9">9, 5</xref>
          ] of external atoms are defined
as follows: we associate a (n+1)-ary extensional evaluation
function F&amp;g with every external predicate name &amp;g 2 G.
Given an interpretation I HB P and a ground input tuple
In the following, in Section 2 we provide preliminaries of
HEXprograms and Description Logics, in Section 3 we describe the new
4 github.com/hexhex/hexlite
5 www.ai4eu.eu/resource/hexlite
(x1; : : : ; xm), F&amp;g(I; y1; : : : ; yn) returns a set of ground output
tuples (x1; : : : ; xm). The external computation is restricted to depend
(a) for contant inputs, i.e., ti = cons, only on the constant value of
yi; and (b) for predicate inputs, i.e., ti 2 N, only on the extension of
predicate yi of arity ti in I.6
        </p>
        <p>
          An interpretation I HB P is a model of an atom a, denoted
I j= a if a is an ordinary atom and a 2 I. I is a model of a ground
external atom a = &amp;g [y1; : : : ; yn](x1; : : : ; xm) if (x1; : : : ; xm) 2
F&amp;g(I; y1; : : : ; yn). Given a ground rule r, I j= H(r) if I j= a for
some a 2 H(r); I j= B(r) if I j= a for all a 2 B+(r) and I 6j= a
for all a 2 B (r); and I j= r if I j= H(r) whenever I j= B(r).
Given a HEX-program P , I j= P if I j= r for all r 2 grnd (P ); the
FLP-reduct [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ] of P with respect to I HB P , denoted f P I , is the
set of all r 2 grnd (P ) such that I j= B(r); I HB P is an answer
set of P if I is a minimal model of f P I , and we denote by AS(P )
the set of all answer sets of P .
        </p>
        <p>An important shortcut notation that we use in this work
is the guess in the head of a rule: f 1; ; kg
1; : : : ; n; not n+1; : : : ; not m with m; k 0 is rewritten into
a set of rules such that, given the rule body is satisfied, candidate
answer sets are generated which contain all subsets of f 1; : : : ; kg.
2.2</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Description Logics and OWLAPI</title>
      <p>
        Description Logics (DLs) [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] are logics of limited expressivity with
decidable reasoning. In particular a DL usually permits only unary
and binary predicates, called concepts and roles, respectively. DL
reasoning is usually organized in a TBox (terminological axioms)
and in an ABox (assertional axioms).
      </p>
      <p>For the purposes of this paper it is sufficient to introduce concept
inclusion axioms, concept intersection, the empty concept, and
concept assertions. Concept inclusion axioms of form C v D denote
that 8x : C(x) ! D(x), i.e., every instance in concept C is also
in concept D. Concept intersection C u D is a concept expression
that contains the intersection of two concepts, i.e., all instances that
are both in C and in D. The empty concept, ?, denotes an
impossible class that is always empty. A concept membership axiom of form
i : C denotes that the individual/constant i is in concept C.
Example 1. In our running example TBox in Figure 1, the meaning
of each axiom is written next to the axiom, except for the affordances
which can be read as ‘A ordsClosing is an A ordance’, etc. The
ABox in Figure 2 introduces individual constants into the theory and
assigns concept memberships to them.</p>
      <p>
        Answer Set Programs and DLs have been combined in Description
Logic Programs (DL-Programs) [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. This formalism paved the way
for the development of HEX-programs. In brief, DL-programs are
Answer Set Programs with special DL-atoms of form
      </p>
      <p>DL[C1 op1 p1; : : : ; Cm opm pm; Q](~t)
which evaluates the DL-Query Q on an ontology modified by
operations of form C op p and evaluates to true for all tuples ~t in the
result of query Q. The modifications can add (op = ]) or subtract
(op = [-) the extension of predicate p from the assertions of concept
C. Note that one DL-atom always takes the whole extension of all
predicates p1; : : : ; pm to modify the ontology.
6 Formally, this is the set fyi(v1; : : : ; vti ) 2 Ig.</p>
    </sec>
    <sec id="sec-6">
      <title>Parameterized Multi-Modification-Integration of</title>
    </sec>
    <sec id="sec-7">
      <title>OWLAPI in HEX</title>
      <p>Our novel integration interface has two major components: a
representation for ontology modifications in ASP atoms (Section 3.1) and
external atoms that query the ontology based on these modifications
(Section 3.2).
3.1</p>
    </sec>
    <sec id="sec-8">
      <title>Ontology Modifications</title>
      <p>Ontology modifications are represented as atoms in ASP as follows.
Definition 1. A modification atom is of the form
( ; )
2 N and
with some predicate name,
one of the following terms:
addc(C; I)
delc(C; I)
addop(OP ; I1; I2)
delop(OP ; I1; I2)
adddp(DP ; I; D)
deldp(DP ; I; D)
where C, OP , and DP are OWL Class, Object Property, and Data
Property IRIs, respectively, I, I1, and I2 are OWL Individual IRIs,
and D is either an integer or a string parseable as OWL Data value.</p>
      <p>Intuitively the modifications in (2) add ABox assertions and those
in (3) remove ABox assertions.
(1)
(2)
(3)
3.2</p>
    </sec>
    <sec id="sec-9">
      <title>External Atoms</title>
      <p>External atoms for querying the ontology are of the following form,
where ! is a specifier for the ontology and / are as above.
&amp;dlConsistent [!; ; ]()</p>
      <p>for consistency of the ontology (4)
&amp;dlC [!; ; ; C ](I )</p>
      <p>for querying class instances
&amp;dlDP [!; ; ; DP ](I1 ; I2 )</p>
      <p>for querying data properties
&amp;dlOP [!; ; ; OP ](I1 ; D )
for querying object properties
(5)
(6)
(7)</p>
      <p>Intuitively, these external atoms query the ontology ! after it has
been modified using all modifications in the extension of in the
current answer set candidate I, selected by . Formally, the above
external atoms perform reasoning on the ontology modified by
f j ( ; ) 2 Ig:
Example 2. In our running example, the external atom
&amp;dlC[onto,delta,T,"ex:AffordsOpening"](B)
with T=0 and an empty extension of delta is false for B=b1
and true for B=b2, because the ontology contains assertions b1 :
ClosedBox and b2 : OpenBox from which the reasoner infers that
b1 affords opening (via Axiom ClosedBox v A ordsOpening ) but
b2 does not.</p>
      <p>The HEX-program defines in each time step T that the modification
of the ontology corresponds with the planning state which is
represented in predicate s(Box,State,T). Therefore, if at T=2 some
action has caused a change in the state such that s(b1,open,2)
and s(b2,open,2) are true, then the above external atom, with
T=2, is false for both B=b1 and B=b2.</p>
      <p>The format of the ontology specifier ! is a string pointing to a
JSON file that holds the location of the OWL ontology file and
provides namespaces for usage in ASP.</p>
      <p>Example 3. In our running example, the file meta.json has the
# c o n s t o n t o =” meta . j s o n ” .
following content.</p>
      <p>{
}
}
"load-uri": "sample.owl",
"namespaces": {
"owl": "http://www.w3.org/2002/07/owl#",
"ex": "http://www.kr.tuwien.ac.at/hexlite/example#"</p>
    </sec>
    <sec id="sec-10">
      <title>3.3 Implementation</title>
      <p>
        The external atoms (4)–(7) have been implemented in the OWLAPI
Plugin7;8 for the HEXLITE [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ] solver. The plugin uses JPYPE9 to
access OWLAPI10 [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] and as reasoner currently uses HERMIT11 [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ].
      </p>
      <p>To facilitate value invention from the ontology, i.e., to allow for
importing all individual names from the ontology instead of
specifying them in the HEX program, the OWLAPI plugin contains
‘readonly’ external atoms of the form
&amp;dlCro[!; C ](I )
&amp;dlDPro[!; DP ](I1 ; I2 )
&amp;dlOPro[!; OP ](I1 ; D)
which correspond to (5)–(7) but operate on the unmodified ontology.</p>
    </sec>
    <sec id="sec-11">
      <title>4 Use Case: Explaining Contingencies in</title>
    </sec>
    <sec id="sec-12">
      <title>Production Planning</title>
      <p>Here we concretely develop the use case described in the
Introduction as a HEX-program.
the same time;
in the ontology;12
the initial state of the planning domain is obtained from the
ontolall fluents are inertial, i.e., the fluent state it is maintained unless
otherwise specified, moreover a box cannot be open and closed at
the fluents are represented in delta predicates so that the OWLAPI
integration can represent the fluent values not only in ASP but also
we require consistency of the ontology for all time steps, using the
&amp;dlConsistent external atom;
we guess which action is applied, where actions are licensed by
certain affordances on boxes and can be performed by certain
robot types;
we constrain actions so that each robot can only perform one
action at each step, and each box can be affected by only one action
at each step; finally
we define the effect of actions on the fluents.
12 Note, that we remove the OWL assertions that correspond with non-true
fluent values, and we add assertions for true fluent values. This ensures that
the initial state (which is represented in the ontology in form of OpenBox
and ClosedBox assertions does not interfere with reasoning in time steps
T &gt; 0. We could get rid of all ‘del’ operations by using a separate
ontology for specifying the initial state. This is possible using the plugin but it
would complicate the example.
(c) %% manadke a c t i o n s as e a r l y as p o s s i b l e</p>
      <p>as few as p o s s i b l e
: do (A, T ) . [ T+1@1, A]
(i) % aim t o f i n i s h i n t i m e s t e p 3
# c o n s t f i n a l t i m e s t e p = 3 .</p>
      <p>% aim t o f i n i s h i n t i m e s t e p 5
(ii) # c o n s t f i n a l t i m e s t e p = 5 .</p>
      <p>% r e q u i r e b o x e s t o be p a i n t e d i n t h e f i n a l s t e p
: box (B ) , not s t a t e ( B , p a i n t e d , f i n a l t i m e s t e p ) .
% d e a c t i v a t e as many r o b o t s as p o s s i b l e
f e x p l a n a t i o n ( d e a c t i v a t e (R ) ) g : r o b o t (R ) .
: not e x p l a n a t i o n ( d e a c t i v a t e (R ) ) , r o b o t (R ) . [ 1@2, R]
% d e a c t i v a t e d r o b o t s c a n n o t do a c t i o n s
: e x p l a n a t i o n ( d e a c t i v a t e (R ) ) ,</p>
      <p>a c t S t e p ( S ) , do ( a c t i o n ( , R , ) , T ) .
% r e q u i r e b o x e s t o be p a i n t e d i n t h e f i n a l s t e p
: box (B ) , not s t a t e ( B , p a i n t e d , f i n a l t i m e s t e p ) .
% aim t o f i n i s h i n t i m e s t e p 2
(iii) # c o n s t f i n a l t i m e s t e p = 2 .</p>
      <p>% g u e s s which b o x e s t o s k i p f o r p a i n t i n g
f e x p l a n a t i o n ( s k i p (B ) ) g : box (B ) .
% s k i p as few as p o s s i b l e
: e x p l a n a t i o n ( s k i p (B ) ) , box (B ) . [ 1@2, B]
% r e q u i r e non s k i p p e d b o x e s t o be p a i n t e d
: box (B ) , not e x p l a n a t i o n ( s k i p (B ) ) ,</p>
      <p>not s t a t e ( B , p a i n t e d , f i n a l t i m e s t e p ) .
Given a value for finaltimestep this encoding does not contain a
planning goal, that means it will produce all possible plans and all
resulting states without a restriction on the final state. For example,
resulting plans include the plan without actions, and the plan that
repeatedly opens and closes a single box.
4.2</p>
    </sec>
    <sec id="sec-13">
      <title>Queries and Results</title>
      <p>When we compute answer sets using the above program fragments
integrated with the above ontology, we obtain the following results.
(C)+(I) Painting all boxes until time step 3: Table 1 shows two
optimal answer sets for this query. We observe that the integration
successfully permitted only those actions that are licensed by
affordances in the ontology. Multiple plans of the same quality exist, they
differ in the order of closed and painted boxes. Table 2 provides the
ontology modifications that are used in each time step of the planning
to obtain the first plan in Table 1.
(C)+(II) Explaining how to reduce the number of robots by
achieving the goal only at time step 5: Table 3 shows one of the
optimal answer sets: an explanation together with a witnessing plan.
We observe that the robot r2, which can both paint and manipulate
boxes, was chosen to do the whole work, and r1, which can only
manipulate boxes, was deactivated. As in the previous example,
multiple plans of same quality exist. However, all plans deactivate r1
because without r2 the goal can not be reached.
(C)+(III) Explaining how to finish the work until time step 2 by
skipping a product: Table 4 displays one of the optimal
explanations together with its witnessing plan. Note that b2 is not touched
by the robots, although r1 is idle in Step 1 and could close it. This
can be explained by constraint (C) which requires robots to perform
only the minimally required actions for reaching the goal.
In this section, we argue that Explainability as it is usually
understood is not applicable to Answer Set Programming and propose an
alternative.</p>
      <p>The classical notion of Explanation in AI aims to provide to the
user of a system at least some parts of the rationale, assumptions,
data, and reasoning process that leads to a decision. In the case of
Logic Programming, decisions are made on (i) the basis of a
mathematical framework, i.e., based on the mathematical definition of
Logic Programming, (ii) based on the program given by the
programmer, and (iii) based on the query we pose to the program, again in the
shape of program rules that have clearly defined syntax and
semantics. Therefore, explanations of the classical form would amount to
teaching formal semantics and presenting the program that is
reasoned upon by the solver software, which is neither feasible for an
end-user nor does it serve the intention of Explainability. Classical
explanations apply mostly to Machine Learning systems where the
system makes a decision based on input data and a model learned
from training data, and where usually a big amount of input data
(such as audio or video data) is fed to an algorithm that makes a
decision that is based on a small part of that input data.</p>
      <p>Classical Logic Programming makes no decisions in the presence
of uncertainty, it produces multiple solutions that are equally viable.
In case of optimization criteria, it is also clearly determined which
solution(s) are preferred.</p>
      <p>Teaching end-users the formal semantics of ASP so that they can
understand the reasoning process and programs requires to make
0
1
2
3
4
5
0
1
2
end-users experts in order to use explanations. This approach would
be too fine-grained to have any practical value. Therefore, a more
macroscopic approach for Explainability is necessary.</p>
      <p>We therefore argue that the best way to gain Explainability in
Logic Programming is an interaction possibility where users can
(i) challenge the system with alternative scenarios, (ii) explore
differences between alternative solutions to a single scenario, and
(iii) change optimization criteria to explore their effect on solutions.
The short query snippets we presented in the previous section
(Figure 4) provide such a way of challenging the system using concise
program additions or modifications.</p>
      <p>
        The ASP literature contains several studies about such types of
Explainability under the names Diagnosis [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], Debugging [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ], and
Explaining Inconsistency [
        <xref ref-type="bibr" rid="ref22">22</xref>
        ].
6
      </p>
    </sec>
    <sec id="sec-14">
      <title>Discussion, Related and Future Work</title>
      <p>We have described a new interface for integrating Description
Logics, in particular every DL reasoner that is compatible with OWLAPI,
with logic programming under Answer Set Semantics, concretely
using the HEX formalism. The benefit of such an integration is, that the
ontology is used in its original form, and that the ASP planning
domain permits all freedoms that ASP provides for planning, as
demonstrated by our example use cases with explanatory queries. An
alternative solution for integrating ontologies with logic programs would
be to convert the ontology into a logic program, but this creates the
need for a conversion process and for maintenance of not only the
ontology but also the conversion process.</p>
      <p>Using logic programming for planning is only one possibility
among many others. The benefit of using Answer Set
Programming is the power and freedom that comes with a guess-and-check
paradigm where guesses and constraints and optimizations can be
combined freely. In particular, Answer Set Programming permits
expressive representations such as indirect effects/ramifications and
domain-global constraints and optimization criteria that are difficult
or impossible to model in STRIPS and PDDL.</p>
    </sec>
    <sec id="sec-15">
      <title>Related Work</title>
      <p>
        DL-Programs [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] permit the integration of DL reasoning into an ASP
planning domain similar to our domain above, however for each time
step a separate DL atom with a separate delta predicate would be
required (i.e., for n time steps we would need to define delta1, . . . ,
deltan and create n instances of all rules in Figure 3 where is used).
Therefore, our new integration interface does not increase
expressivity but it greatly improves conciseness, readability, and
maintainability of the encoding, because ASP variables can be used to express
selection of a certain sub-extension of delta to be used as ontology
modification.
      </p>
      <p>
        Action Languages, e.g., PDDL [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ] or AR [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] are custom
languages for representing planning domains. While basic PDDL
does not provide support for non-deterministic effects, its extension
PPDDL supports representation of probabilistic effects and AR (and
several other planning languages) support representation of
possibilistic effects (i.e., effects that can happen without providing a
probability). These action languages usually come with specific reasoning
methods and do not support what-if scenarios out of the box, unless
they can be represented directly in the respective planning input
language. ASP planning has the advantage that everything is represented
as an ASP rule and the programmer is free to modify rules in order
to represent additional what-if scenarios just by replacing a
deterministic rule by a rule with a guessing construction in the head, or
by weakening or strengthening the rule in other ways. However, the
advantages of dedicated action languages and the freedom of
representation in ASP can be combined by rewriting a planning domain
to ASP rules for evaluating it in a generic ASP solver. This has been
done, e.g., for the K [
        <xref ref-type="bibr" rid="ref6 ref7">6, 7</xref>
        ] and C+ [
        <xref ref-type="bibr" rid="ref15 ref2">2, 15</xref>
        ] planning languages.
      </p>
    </sec>
    <sec id="sec-16">
      <title>Future Work</title>
      <p>As future work on the API side of the integration, we see an
extension of the interface to permit arbitrary DL queries using the OWLAPI
DL Query Parser, and additional ontology modifications that permit
adding and removing axioms. As future work on the
implementation side, it will be necessary to generate on-demand constraints that
speed up the reasoning. Due to time constraints it was not possible
to implement this technique so far, therefore we here do not report
timing results.</p>
    </sec>
    <sec id="sec-17">
      <title>ACKNOWLEDGEMENTS</title>
      <p>We would like to acknowledge fruitful discussions about Description
Logics and Production Planning with Magdalena Ortiz, Ivan Gocev,
Raoul Blankertz, Sonja Zillner, and Stephan Grimm. We would also
like to thank the referees and chairs for their feedback. This work has
received funding from the European Union’s Horizon 2020 research
and innovation programme under grant agreement 825619 (AI4EU).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>Franz</given-names>
            <surname>Baader</surname>
          </string-name>
          , Diego Calvanese,
          <string-name>
            <surname>Deborah</surname>
            <given-names>McGuinness</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Daniele</given-names>
            <surname>Nardi</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Peter</given-names>
            <surname>Patel-Schneider</surname>
          </string-name>
          , volume
          <volume>32</volume>
          , Cambridge University Press,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>Joseph</given-names>
            <surname>Babb</surname>
          </string-name>
          and
          <string-name>
            <given-names>Joohyung</given-names>
            <surname>Lee</surname>
          </string-name>
          , 'cplus2asp:
          <article-title>Computing action language C+ in answer set programming'</article-title>
          ,
          <source>in International Conference on Logic Programming and Nonmonotonic Reasoning</source>
          , pp.
          <fpage>122</fpage>
          -
          <lpage>134</lpage>
          . Springer, (
          <year>2013</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Marcello</given-names>
            <surname>Balduccini</surname>
          </string-name>
          and
          <string-name>
            <given-names>Michael</given-names>
            <surname>Gelfond</surname>
          </string-name>
          , '
          <article-title>Diagnostic reasoning with a-prolog'</article-title>
          ,
          <source>Theory and Practice of Logic Programming</source>
          ,
          <volume>3</volume>
          (
          <issue>4-5</issue>
          ),
          <fpage>425</fpage>
          -
          <lpage>461</lpage>
          , (
          <year>2003</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Gerd</given-names>
            <surname>Brewka</surname>
          </string-name>
          , Thomas Eiter, and Miroslaw Truszczynski, AI Magazine:
          <article-title>Special Issue on Answer Set Programming</article-title>
          , vol.
          <volume>37</volume>
          (
          <issue>3</issue>
          ), AAAI Press,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>T.</given-names>
            <surname>Eiter</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Fink</surname>
          </string-name>
          , G. Ianni,
          <string-name>
            <given-names>T.</given-names>
            <surname>Krennwallner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Redl</surname>
          </string-name>
          , and
          <string-name>
            <given-names>P.</given-names>
            <surname>Schu</surname>
          </string-name>
          <article-title>¨ller, 'A model building framework for Answer Set Programming with external computations'</article-title>
          ,
          <source>Theory and Practice of Logic Programming</source>
          ,
          <volume>16</volume>
          (
          <issue>4</issue>
          ), (
          <year>2016</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Thomas</given-names>
            <surname>Eiter</surname>
          </string-name>
          , Wolfgang Faber, Nicola Leone, Gerald Pfeifer, and Axel Polleres, '
          <article-title>Planning under incomplete knowledge'</article-title>
          ,
          <source>in International Conference on Computational Logic</source>
          , pp.
          <fpage>807</fpage>
          -
          <lpage>821</lpage>
          . Springer, (
          <year>2000</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>Thomas</given-names>
            <surname>Eiter</surname>
          </string-name>
          , Wolfgang Faber, Nicola Leone, Gerald Pfeifer, and Axel Polleres, '
          <article-title>The dlv k planning system: Progress report'</article-title>
          ,
          <source>in European Workshop on Logics in Artificial Intelligence</source>
          , pp.
          <fpage>541</fpage>
          -
          <lpage>544</lpage>
          . Springer, (
          <year>2002</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>Thomas</given-names>
            <surname>Eiter</surname>
          </string-name>
          , Giovambattista Ianni, Thomas Lukasiewicz, Roman Schindlauer, and Hans Tompits, '
          <article-title>Combining Answer Set Programming with Description Logics for the Semantic Web'</article-title>
          ,
          <source>Artificial Intelligence</source>
          ,
          <volume>172</volume>
          (
          <fpage>12</fpage>
          -
          <lpage>13</lpage>
          ),
          <fpage>1495</fpage>
          -
          <lpage>1539</lpage>
          , (
          <year>2008</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>Thomas</given-names>
            <surname>Eiter</surname>
          </string-name>
          , Giovambattista Ianni, Roman Schindlauer, and Hans Tompits, '
          <article-title>Effective integration of declarative rules with external evaluations for Semantic-Web reasoning'</article-title>
          ,
          <source>in European Semantic Web Conference (ESWC)</source>
          , pp.
          <fpage>273</fpage>
          -
          <lpage>287</lpage>
          , (
          <year>2006</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <surname>Thomas</surname>
            <given-names>Eiter</given-names>
          </string-name>
          , Tobias Kaminski, Christoph Redl, Peter Schu¨ller, and Antonius Weinzierl, '
          <article-title>Answer Set Programming with external source access'</article-title>
          ,
          <source>in Reasoning Web International Summer School</source>
          , pp.
          <fpage>204</fpage>
          -
          <lpage>275</lpage>
          , (
          <year>2017</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>Wolfgang</surname>
            <given-names>Faber</given-names>
          </string-name>
          , Gerald Pfeifer, and Nicola Leone, '
          <article-title>Semantics and complexity of recursive aggregates in Answer Set Programming'</article-title>
          ,
          <source>Artificial Intelligence</source>
          ,
          <volume>175</volume>
          (
          <issue>1</issue>
          ),
          <fpage>278</fpage>
          -
          <lpage>298</lpage>
          , (
          <year>2011</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <surname>Martin</surname>
            <given-names>Gebser</given-names>
          </string-name>
          , Roland Kaminski, Benjamin Kaufmann, and Torsten Schaub,
          <article-title>'Multi-shot ASP solving with clingo'</article-title>
          ,
          <source>Theory and Practice of Logic Programming</source>
          ,
          <fpage>1</fpage>
          -
          <lpage>56</lpage>
          , (
          <year>2018</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>Michael</given-names>
            <surname>Gelfond</surname>
          </string-name>
          and Vladimir Lifschitz, '
          <article-title>Classical negation in logic programs</article-title>
          and deductive databases',
          <source>New Generation Computing</source>
          ,
          <volume>9</volume>
          ,
          <fpage>365</fpage>
          -
          <lpage>385</lpage>
          , (
          <year>1991</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>Enrico</given-names>
            <surname>Giunchiglia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G Neelakantan</given-names>
            <surname>Kartha</surname>
          </string-name>
          , and Vladimir Lifschitz, '
          <article-title>Representing action: Indeterminacy and ramifications'</article-title>
          ,
          <source>Artificial Intelligence</source>
          ,
          <volume>95</volume>
          (
          <issue>2</issue>
          ),
          <fpage>409</fpage>
          -
          <lpage>438</lpage>
          , (
          <year>1997</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <surname>Enrico</surname>
            <given-names>Giunchiglia</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Joohyung</given-names>
            <surname>Lee</surname>
          </string-name>
          , Vladimir Lifschitz,
          <string-name>
            <surname>Norman McCain</surname>
          </string-name>
          , and Hudson Turner, '
          <article-title>Nonmonotonic causal theories'</article-title>
          ,
          <source>Artificial Intelligence</source>
          ,
          <volume>153</volume>
          (
          <issue>1-2</issue>
          ),
          <fpage>49</fpage>
          -
          <lpage>104</lpage>
          , (
          <year>2004</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <surname>Birte</surname>
            <given-names>Glimm</given-names>
          </string-name>
          , Ian Horrocks, Boris Motik, Giorgos Stoilos, and Zhe Wang, '
          <article-title>HermiT: an OWL 2 reasoner'</article-title>
          ,
          <source>Journal of Automated Reasoning</source>
          ,
          <volume>53</volume>
          (
          <issue>3</issue>
          ),
          <fpage>245</fpage>
          -
          <lpage>269</lpage>
          , (
          <year>2014</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>Matthew</given-names>
            <surname>Horridge</surname>
          </string-name>
          and Sean Bechhofer, '
          <article-title>The OWL API: a Java API for OWL ontologies'</article-title>
          ,
          <source>Semantic web</source>
          ,
          <volume>2</volume>
          (
          <issue>1</issue>
          ),
          <fpage>11</fpage>
          -
          <lpage>21</lpage>
          , (
          <year>2011</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <surname>John</surname>
            <given-names>McCarthy</given-names>
          </string-name>
          , '
          <article-title>Elaboration tolerance'</article-title>
          ,
          <source>in Common Sense</source>
          , volume
          <volume>98</volume>
          , (
          <year>1998</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <surname>Drew</surname>
            <given-names>McDermott</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Malik</given-names>
            <surname>Ghallab</surname>
          </string-name>
          , Adele Howe, Craig Knoblock, Ashwin Ram, Manuela Veloso,
          <string-name>
            <given-names>Daniel</given-names>
            <surname>Weld</surname>
          </string-name>
          ,
          <article-title>and David Wilkins. PDDL - The planning domain definition language</article-title>
          ,
          <year>1998</year>
          .
          <source>Technical Report</source>
          CVC TR-
          <volume>98</volume>
          -003/DCS TR-
          <volume>1165</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <surname>Johannes</surname>
            <given-names>Oetsch</given-names>
          </string-name>
          ,
          <article-title>Jo¨rg Pu¨hrer, and Hans Tompits, 'Catching the ouroboros: On debugging non-ground answer-set programs'</article-title>
          ,
          <source>Theory Pract. Log. Program.</source>
          ,
          <volume>10</volume>
          (
          <issue>4-6</issue>
          ),
          <fpage>513</fpage>
          -
          <lpage>529</lpage>
          , (
          <year>2010</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>Peter</given-names>
            <surname>Schu</surname>
          </string-name>
          <article-title>¨ller, 'The Hexlite solver'</article-title>
          ,
          <source>in European Conference on Logics in Artificial Intelligence (JELIA)</source>
          , pp.
          <fpage>593</fpage>
          -
          <lpage>607</lpage>
          . Springer, (
          <year>2019</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [22]
          <string-name>
            <surname>Claudia</surname>
            <given-names>Schulz</given-names>
          </string-name>
          , Ken Satoh, and Francesca Toni, '
          <article-title>Characterising and explaining inconsistency in logic programs'</article-title>
          ,
          <source>in International Conference on Logic Programming and Nonmonotonic Reasoning</source>
          , pp.
          <fpage>467</fpage>
          -
          <lpage>479</lpage>
          . Springer, (
          <year>2015</year>
          ).
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>