Content uploaded by Mehul Bhatt

Author content

All content in this area was uploaded by Mehul Bhatt on Jun 16, 2015

Content may be subject to copyright.

ASPMT(QS): Non-Monotonic Spatial Reasoning With

Answer Set Programming Modulo Theories

Przemysław Andrzej Wał˛ega1, Mehul Bhatt2, and Carl Schultz2

1University of Warsaw, Institute of Philosophy, Poland,

2University of Bremen, Department of Computer Science, Germany.

Abstract. The systematic modelling of dynamic spatial systems [9] is a key re-

quirement in a wide range of application areas such as comonsense cognitive

robotics, computer-aided architecture design, dynamic geographic information

systems. We present ASPMT(QS), a novel approach and fully-implemented pro-

totype for non-monotonic spatial reasoning —a crucial requirement within dy-

namic spatial systems– based on Answer Set Programming Modulo Theories

(ASPMT). ASPMT(QS) consists of a (qualitative) spatial representation module

(QS) and a method for turning tight ASPMT instances into Sat Modulo Theories

(SMT) instances in order to compute stable models by means of SMT solvers. We

formalise and implement concepts of default spatial reasoning and spatial frame

axioms using choice formulas. Spatial reasoning is performed by encoding spa-

tial relations as systems of polynomial constraints, and solving via SMT with the

theory of real nonlinear arithmetic. We empirically evaluate ASPMT(QS) in com-

parison with other prominent contemporary spatial reasoning systems. Our results

show that ASPMT(QS) is the only existing system that is capable of reasoning

about indirect spatial effects (i.e. addressing the ramiﬁcation problem), and in-

tegrating geometric and qualitative spatial information within a non-monotonic

spatial reasoning context.

Keywords: Non-monotonic Spatial Reasoning, Answer Set Programming Mod-

ulo Theories, Declarative Spatial Reasoning

1 Introduction

Non-monotonicity is characteristic of commonsense reasoning patterns concerned with,

for instance, making default assumptions (e.g., about spatial inertia), counterfactual rea-

soning with hypotheticals (e.g., what-if scenarios), knowledge interpolation, explana-

tion & diagnosis (e.g., ﬁlling the gaps, causal links), belief revision. Such reasoning

patterns, and therefore non-monotonicity, acquires a special signiﬁcance in the context

of spatio-temporal dynamics, or computational commonsense reasoning about space,

actions, and change as applicable within areas as disparate as geospatial dynamics,

computer-aided design, cognitive vision, commonsense cognitive robotics [6]. Dynamic

spatial systems are characterised by scenarios where spatial conﬁgurations of objects

undergo a change as the result of interactions within a physical environment [9]; this

requires explicitly identifying and formalising relevant actions and events at both an on-

tological and (qualitative and geometric) spatial level, e.g. formalising desertiﬁcation

2 P. Wał˛ega, M. Bhatt, C. Schultz

and population displacement based on spatial theories about appearance, disappear-

ance, splitting, motion, and growth of regions [10]. This calls for a deep integration of

spatial reasoning within KR-based non-monotonic reasoning frameworks [7].

We select aspects of a theory of dynamic spatial systems —pertaining to (spatial) iner-

tia, ramiﬁcations, causal explanation— that are inherent to a broad category of dynamic

spatio-temporal phenomena, and require non-monotonic reasoning [9,5]. For these as-

pects, we provide an operational semantics and a computational framework for real-

ising fundamental non-monotonic spatial reasoning capabilities based on Answer Set

Programming Modulo Theories [3]; ASPMT is extended to the qualitative spatial (QS)

domain resulting in the non-monotonic spatial reasoning system ASPMT(QS). Spatial

reasoning is performed in an analytic manner (e.g. as with reasoners such as CLP(QS)

[8]), where spatial relations are encoded as systems of polynomial constraints; the task

of determining whether a spatial graph Gis consistent is now equivalent to determining

whether the system of polynomial constraints is satisﬁable, i.e. Satisﬁability Modulo

Theories (SMT) with real nonlinear arithmetic, and can be accomplished in a sound

and complete manner. Thus, ASPMT(QS) consists of a (qualitative) spatial representa-

tion module and a method for turning tight ASPMT instances into Sat Modulo Theories

(SMT) instances in order to compute stable models by means of SMT solvers.

In the following sections we present the relevant foundations of stable model semantics

and ASPMT, and then extend this to ASPMT(QS) by deﬁning a (qualitative) spatial rep-

resentations module, and formalising spatial default reasoning and spatial frame axioms

using choice formulas. We empirically evaluate ASPMT(QS) in comparison with other

existing spatial reasoning systems. We conclude that ASMPT(QS) is the only system,

to the best of our knowledge, that operationalises dynamic spatial reasoning within a

KR-based framework.

2 Preliminaries

2.1 Bartholomew – Lee Stable Models Semantics

We adopt a deﬁnition of stable models based on syntactic transformations [2] which

is a generalization of the previous deﬁnitions from [14] [19] and [13]. For predicate

symbols (constants or variables) uand c, expression u≤cis deﬁned as shorthand

for ∀x(u(x)→c(x)). Expression u=cis deﬁned as ∀x(u(x)≡c(x)) if uand c

are predicate symbols, and ∀x(u(x) = c(x)) if they are function symbols. For lists

of symbols u= (u1, . . . , un)and c= (c1, . . . , cn), expression u≤cis deﬁned

as (u1≤c1)∧ · · · ∧ (un≤cn), and similarly, expression u=cis deﬁned as

(u1=c1)∧ · · · ∧ (un=cn). Let cbe a list of distinct predicate and function con-

stants, and let b

cbe a list of distinct predicate and function variables corresponding to

c. By cpred (cf unc , respectively) we mean the list of all predicate constants (function

constants, respectively) in c, and by b

cpred (b

cfunc , respectively) the list of the corre-

sponding predicate variables (function variables, respectively) in b

c. In what follows, we

refer to function constants and predicate constants of arity 0as object constants and

propositional constants, respectively.

ASPMT(QS): Non-Monotonic Spatial Reasoning 3

Deﬁnition 1 (Stable model operator SM). For any formula Fand any list of predicate

and function constants c(called intensional constants), SM[F;c]is deﬁned as

F∧ ¬∃b

c(b

c<c∧F∗(b

c)),(1)

where b

c<cis a shorthand for (b

cpred ≤cpred )∧ ¬(b

c=c)and F∗(b

c)is deﬁned

recursively as follows:

–for atomic formula F,F∗≡F0∧F, where F0is obtained from Fby replacing all

intensional constants cwith corresponding variables from b

c,

–(G∧H)∗=G∗∧H∗,(G∨H)∗=G∗∨H∗,

–(G→H)∗= (G∗→H∗)∧(G→H),

–(∀xG)∗=∀xG∗,(∃xG)∗=∃xG∗.

¬Fis a shorthand for F→ ⊥,>for ¬⊥ and F≡Gfor (F→G)∧(G→F).

Deﬁnition 2 (Stable model). For any sentence F, a stable model of Fon cis an inter-

pretation Iof underlying signature such that I|=SM[F;c].

2.2 Turning ASPMT into SMT

It is shown in [3] that a tight part of ASPMT instances can be turned into SMT instances

and, as a result, off-the-shelf SMT solvers (e.g. Z3 for arithmetic over reals) may be

used to compute stable models of ASP, based on the notions of Clark normal form,

Clark completion.

Deﬁnition 3 (Clark normal form). Formula Fis in Clark normal form (relative to the

list cof intensional constants) if it is a conjunction of sentences of the form (2) and (3).

∀x(G→p(x)) (2) ∀xy(G→f(x) = y)(3)

one for each intensional predicate pand each intensional function f, where xis a list

of distinct object variables, yis an object variable, and Gis an arbitrary formula that

has no free variables other than those in xand y.

Deﬁnition 4 (Clark completion). The completion of a formula Fin Clark normal

form (relative to c), denoted by Compc[F]is obtained from Fby replacing each con-

junctive term of the form (2) and (3) with (4) and (5) respectively

∀x(G≡p(x)) (4) ∀xy(G≡f(x) = y).(5)

Deﬁnition 5 (Dependency graph). The dependency graph of a formula F(relative to

c) is a directed graph DGc[F]=(V, E)such that:

1. Vconsists of members of c,

2. for each c, d ∈V,(c, d)∈Ewhenever there exists a strictly positive occurrence

of G→Hin F, such that chas a strictly positive occurrence in Hand dhas a

strictly positive occurrence in G,

4 P. Wał˛ega, M. Bhatt, C. Schultz

where an occurrence of a symbol or a subformula in Fis called strictly positive in Fif

that occurrence is not in the antecedent of any implication in F.

Deﬁnition 6 (tight formula). Formula Fis tight (on c) if DGc[F]is acyclic.

Theorem 1 (Bartholomew, Lee). For any sentence Fin Clark normal form that is

tight on c, an interpretation Ithat satisﬁes ∃xy(x=y)is a model of SM[F;c]iff Iis

a model of Compc[F]relative to c.

3 ASPMT with Qualitative Space – ASPMT(QS)

In this section we present our spatial extension of ASPMT, and formalise spatial default

rules and spatial frame axioms.

3.1 The Qualitative Spatial Domain QS

Qualitative spatial calculi can be classiﬁed into two groups: topological and positional

calculi. With topological calculi such as the Region Connection Calculus (RCC) [25],

the primitive entities are spatially extended regions of space, and could possibly even

be 4D spatio-temporal histories, e.g., for motion-pattern analyses. Alternatively, within

a dynamic domain involving translational motion, point-based abstractions with orien-

tation calculi could sufﬁce. Examples of orientation calculi include: the Oriented-Point

Relation Algebra (OP RAm) [22], the Double-Cross Calculus [16]. The qualitative spa-

tial domain (QS) that we consider in the formal framework of this paper encompasses

the following ontology:

QS1. Domain Entities in QS Domain entities in QS include circles, triangles,

points and segments. While our method is applicable to a wide range of 2D and 3D

spatial objects and qualitative relations, for brevity and clarity we primarily focus on a

2D spatial domain. Our method is readily applicable to other 2D and 3D spatial domains

and qualitative relations, for example, as deﬁned in [23,11,24,12,8,26,27].

–apoint is a pair of reals x, y

–aline segment is a pair of end points p1, p2(p16=p2)

–acircle is a centre point pand a real radius r(0< r)

–atriangle is a triple of vertices (points) p1, p2, p3such that p3is left of segment

p1, p2.

QS2. Spatial Relations in QS We deﬁne a range of spatial relations with the cor-

responding polynomial encodings. Examples of spatial relations in QS include:

Relative Orientation. Left, right, collinear orientation relations between points and

segments, and parallel, perpendicular relations between segments [21].

Mereotopology. Part-whole and contact relations between regions [28,25].

ASPMT(QS): Non-Monotonic Spatial Reasoning 5

3.2 Spatial representations in ASPMT(QS)

Spatial representations in ASPMT(QS) are based on parametric functions and qualita-

tive relations, deﬁned as follows.

Deﬁnition 7 (Parametric function). Aparametric function is an n–ary function fn:

D1×D2× · · ·× Dn→Rsuch that for any i∈ {1. . . n},Diis a type of spatial object,

e.g., P oints,Circles,P olyg ons, etc.

Example 1. Consider following parametric functions x:Circles →R,y:C ircles →

R,r:Circles →Rwhich return the position values x, y of a circle’s centre and

its radius r, respectively. Then, circle c∈Cirlces may be described by means of

parametric functions as follows: x(c)=1.23 ∧y(c) = −0.13 ∧r(c)=2.

Deﬁnition 8 (Qualitative spatial relation). Aqualitative spatial relation is an n-ary

predicate Qn⊆D1×D2× · · · × Dnsuch that for any i∈ {1. . . n},Diis a type of

spatial object. For each Qnthere is a corresponding formula of the form

∀d1∈D1. . . ∀dn∈DnQn(d1,...,dn)←p1(d1,...,dn)∧ · · ·∧pm(d1,...,dn)(6)

where m∈Nand for any i∈ {1. . . n},piis a polynomial equation or inequality.

Proposition 1. Each qualitative spatial relation according to Deﬁnition 8 may be rep-

resented as a tight formula in Clark normal form.

Proof. Follows directly from Deﬁnitions 3 and 8.

Thus, qualitative spatial relations belong to a part of ASPMT that may be turned into

SMT instances by transforming the implications in the corresponding formulas into

equivalences (Clark completion). The obtained equivalence between polynomial ex-

pressions and predicates enables us to compute relations whenever parametric informa-

tion is given, and vice versa, i.e. computing possible parametric values when only the

qualitative spatial relations are known.

Many relations from existing qualitative calculi may be represented in ASPMT(QS)

according to Deﬁnition 8; our system can express the polynomial encodings presented

in e.g. [23,11,24,12,8]. Here we give some illustrative examples.

Proposition 2. Each relation of Interval Algebra (IA) [1] and Rectangle Algebra (RA)

[20] may be deﬁned in ASPMT(QS).

Proof. Each IA relation may be described as a set of equalities and inequalities between

interval endpoints (see Figure 1 in [1]), which is a conjunction of polynomial expres-

sions. RA makes use of IA relations in 2 and 3 dimensions. Hence, each relation is a

conjunction of polynomial expressions [27].

Proposition 3. Each relation of RCC–5 in the domain of convex polygons with a ﬁnite

maximum number of vertices may be deﬁned in ASPMT(QS).

6 P. Wał˛ega, M. Bhatt, C. Schultz

Proof. Each RCC–5 relation may be described by means of relations P(a, b)and O(a, b).

In the domain of convex polygons, P(a, b)is true whenever all vertices of aare in the

interior (inside) or on the boundary of b, and O(a, b)is true if there exists a point p

that is inside both aand b. Relations of a point being inside, outside or on the boundary

of a polygon can be described by polynomial expressions e.g. [8]. Hence, all RCC–5

relations may be described with polynomials, given a ﬁnite upper limit on the number

of vertices a convex polygon can have.

Proposition 4. Each relation of Cardinal Direction Calculus (CDC) [15] may be de-

ﬁned in ASPMT(QS).

Proof. CDC relations are obtained by dividing space with 4 lines into 9 regions. Since

halfplanes and their intersections may be described with polynomial expressions, then

each of the 9 regions may be encoded with polynomials. A polygon object is in one or

more of the 9 cardinal regions by the topological overlaps relation between polygons,

which can be encoded with polynomials (i.e. by the existence of a shared point) [8].

3.3 Choice Formulas in ASPMT(QS)

A choice formula [14] is deﬁned for a predicate constant pas Choice(p)≡ ∀x(p(x)∨

¬p(x)) and for function constant fas Choice(f)≡ ∀x(f(x) = y∨¬f(x) = y), where

xis a list of distinct object variables and yis an object variable distinct from x. We use

the following notation: {F}for F∨ ¬F,∀xy{f(x) = y}for Choice(f)and ∀x{p(x)}

for Choice(p). Then, {t=t’}, where tcontains an intentional function constant and

t’ does not, represents the default rule stating that thas a value of t’ if there is no other

rule requiring tto take some other value.

Deﬁnition 9 (Spatial choice formula). The spatial choice formula is a rule of the

form (8) or (7):

{fn(d1, . . . , dn) = x} ← α1∧α2∧ · · · ∧ αk,(7)

{Qn(d1, . . . , dn)} ← α1∧α2∧ · · · ∧ αk.(8)

where fnis a parametric function, x∈R,Qnis a qualitative spatial relation, and

for each i∈ {1, . . . , k},αiis a qualitative spatial relation or expression of a form

{fr(dk, . . . , dm) = y}or a polynomial equation or inequality, whereas di∈Diis an

object of spatial type Di.

Deﬁnition 10 (Spatial frame axiom). The spatial frame axiom is a special case of a

spatial choice formula which states that, by default, a spatial property remains the same

in the next step of a simulation. It takes the form (9) or (10):

{fn(d1, . . . , dn−1, s + 1) = x} ← fn(d1, . . . , dn−1, s) = x, (9)

{Qn(d1, . . . , dn−1, s + 1)} ← Qn(d1, . . . , dn−1, s).(10)

where fnis a parametric function, x∈R,Qnis a qualitative spatial relation, and

s∈Nrepresents a step in the simulation.

ASPMT(QS): Non-Monotonic Spatial Reasoning 7

Corollary 1. One spatial frame axiom for each parametric function and qualitative

spatial relation is enough to formalise the intuition that spatial properties, by default,

do not change over time.

The combination of spatial reasoning with stable model semantics and arithmetic over

the reals enables the operationalisation of a range of novel features within the context of

dynamic spatial reasoning. We present concrete examples of such features in Section 5.

4 System implementation

We present our implementation of ASPMT(QS) that builds on ASPMT2SM T [4] – a

compiler translating a tight fragment of ASPMT into SMT instances. Our system con-

sists of an additional module for spatial reasoning and Z3 as the SMT solver. As our

system operates on a tight fragment of ASPMT, input programs need to fulﬁl certain

requirements, described in the following section. As output, our system either produces

the stable models of the input programs, or states that no such model exists.

4.1 Syntax of Input Programs

The input program to our system needs to be f-plain to use Theorem 1 from [2].

Deﬁnition 11 (f-plain formula). Let fbe a function constant. A ﬁrst–order formula is

called f-plain if each atomic formula:

–does not contain f, or

–is of the form f(t) = u, where tis a tuple of terms not containing f, and uis a term

not containing f.

Additionally, the input program needs to be av-separated, i.e. no variable occurring

in an argument of an uninterpreted function is related to the value variable of another

uninterpreted function via equality [4]. The input program is divided into declarations

of:

–sorts (data types);

–objects (particular elements of given types);

–constants (functions);

–variables (variables associated with declared types).

The second part of the program consists of clauses. ASPMT(QS) supports:

–connectives: &,|,not,->,<-, and

–arithmetic operators: <,<=,>=,>,=,!=,+,=,*, with their usual meaning.

Additionally, ASPMT(QS) supports the following as native / ﬁrst-class entities:

8 P. Wał˛ega, M. Bhatt, C. Schultz

–sorts for geometric objects types, e.g., point,segment,circle,triangle;

–parametric functions describing objects parameters e.g., x(point),r(circle);

–qualitative relations, e.g., rccEC(circle,circle),coincident(point,circle).

Example 1: combining topology and size Consider a program describing three

circles a,b,csuch that ais discrete from b,bis discrete from c, and ais a proper part

of c, declared as follows:

:- sorts

circle.

:- objects

a,b,c :: circle.

:- constants

.

:- variables

C,C1,C2 :: circle.

{x(C)=X}. {y(C)=X}. {r(C)=X}.

rccDR(a,b)=true.rccDR(b,c)=true.rccPP(a,c)=true.

ASPMT(QS) checks if the spatial relations are satisﬁable. In the case of a positive

answer, a parametric model and computation time are presented. The output of the

above mentioned program is:

r(a)= 0.5r(b)= 1.0r(c)= 0.25

x(a)= 1.0x(b)= 1.0x(c)= 1.0

y(a)= 3.0y(b)= 1.0y(c)= 3.0

This example demonstrates that ASPMT(QS) is capable of computing composition ta-

bles, in this case the RCC–5 table for circles [25]. Now, consider the addition of a

further constraint to the program stating that circles a,b,chave the same radius:

<- r(a)=R1 &r(b)=R2 &r(c)=R3 &(R1!=R2 |R2!=R3 |R1!=R3).

This new program is an example of combining different types of qualitative informa-

tion, namely topology and size, which is a non-trivial research topic within the rela-

tion algebraic spatial reasoning community; relation algebraic-based solvers such as

GQR [17,29] will not correctly determine inconsistencies in general for arbitrary com-

binations of different types of relations (orientation, shape, distance, etc.). In this case,

ASPMT(QS) correctly determines that the spatial constraints are inconsistent:

UNSATISFIABLE;Z3 time in milliseconds:10;Total time in milliseconds:946

Example 2: combining topology and relative orientation Given three circles a,b,

clet abe proper part of b,bdiscrete from c, and ain contact with c, declared as follows:

:- sorts

circle.

:- objects

a,b,c :: circle.

:- constants

.

:- variables

C,C1,C2 :: circle.

{x(C)=X}. {y(C)=X}. {r(C)=X}.

rccPP(a,b)=true.rccDR(b,c)=true.rccC(a,c)=true.

ASPMT(QS): Non-Monotonic Spatial Reasoning 9

a

bc

a

bc

a

bca

bc

(a)

a

bc

a

bc

a

bca

bc

(b)

Fig. 1: Reasoning about consistent and reﬁnement by combining topology and relative

orientation.

Given this basic qualitative information, ASPMT(QS) is able to reﬁne the topological

relations to infer that (Figure 1a): i) amust be a tangential proper part of bii) both a

and bmust be externally connected to c.

r(a)= 1.0r(b)= 2.0r(c)= 1.0

x(a)= 1.0x(b)= 0.0x(c)= 3.0

y(a)= 0.0y(b)= 0.0y(c)= 0.0

rccTPP(a,b)=true rccEC(a,c)=true rccEC(b,c)=true

We then add an additional constraint that the centre of ais left of the segment between

the centres bto c.

...

left_of(center(a),center(b),center(c)).

ASPMT(QS) determines that this is inconsistent, i.e., the centres must be collinear

(Figure 1b).

UNSATISFIABLE;

5 Empirical Evaluation and Examples

In this section we present an empirical evaluation of ASPMT(QS) in comparison with

other existing spatial reasoning systems. The range of problems demonstrate the unique,

non-monotonic spatial reasoning features that ASPMT(QS) provides beyond what is

possible using other currently available systems. Table 2 presents run times obtained

by Clingo – an ASP grounder and solver [18], GQR – a binary constraint calculi rea-

soner [17], CLP(QS) – a declarative spatial reasoning system [8] and our ASPMT(QS)

implementation. Tests were performed on an Intel Core 2 Duo 2.00 GHZ CPU with 4

GB RAM running Ubuntu 14.04. The polynomial encodings of the topological relations

have not been included here for space considerations.

Table 2: Cumulative results of performed tests. “—” indicates that the problem can not be for-

malised, “I” indicates that indirect effects can not be formalised, “D” indicates that default rules

can not be formalised.

Problem Clingo GQR CLP(QS) ASPMT(QS)

Growth 0.004sI0.014sI,D 1.623sD0.396s

Motion 0.004sI0.013sI,D 0.449sD15.386s

Attach I 0.008sI—3.139sD0.395s

Attach II — — 2.789sD0.642s

10 P. Wał˛ega, M. Bhatt, C. Schultz

5.1 Ramiﬁcation Problem

S0:

S1:

ac

b

a=bcac

b

a c

b

OR

growth(a, 0) motion(a, 0)

Fig. 3: Indirect effects of growth(a, 0) and

motion(a, 0) events.

The following two problems, Growth

and Motion, were introduced in [5].

Consider the initial situation S0pre-

sented in Figure 3, consisting of

three cells: a,b,c, such that ais

a non-tangential proper part of b:

rccNTPP(a, b, 0), and bis externally

connected to c:rccEC(b, c, 0).

Growth. Let agrow in step S0; the event growth(a, 0) occurs and leads to a successor

situation S1. The direct effect of growth(a, 0) is a change of a relation between aand b

from rccNTPP(a, b, 0) to rccEQ(a, b, 1) (i.e. ais equal to b). No change of the relation

between aand cis directly stated, and thus we must derive the relation rccEC(a, c, 1)

as an indirect effect.

Motion. Let amove in step S0; the event motion(a, 0) leads to a successor situation

S1. The direct effect is a change of the relation rccNTPP(a, b, 0) to rccTPP(a, b, 1) (a

is a tangential proper part of b). In the successor situation S1we must determine that

the relation between aand ccan only be either rccDC(a, c, 1) or rccEC(a, c, 1).

GQR provides no support for domain-speciﬁc reasoning, and thus we encoded the prob-

lem as two distinct qualitative constraint networks (one for each simulation step) and

solved them independently i.e. with no deﬁnition of growth and motion. Thus, GQR is

not able to produce any additional information about indirect effects. As Clingo lacks

any mechanism for analytic geometry, we implemented the RCC8 composition table

and thus it inherits the incompleteness of relation algebraic reasoning. While CLP(QS)

facilitates the modelling of domain rules such as growth, there is no native support for

default reasoning and thus we forced band cto remain unchanged between simulation

steps, otherwise all combinations of spatially consistent actions on band care produced

without any preference (i.e. leading to the frame problem).

In contrast, ASPMT(QS) can express spatial inertia, and derives indirect effects directly

from spatial reasoning: in the Growth problem ASPMT(QS) abduces that ahas to be

concentric with bin S0(otherwise a move event would also need to occur). Checking

global consistency of scenarios that contain interdependent spatial relations is a crucial

feature that is enabled by a support polynomial encodings and is provided only by

CLP(QS) and ASPMT(QS).

5.2 Geometric Reasoning and the Frame Problem

In problems Attachment I and Attachment II the initial situation S0consists of three

objects (circles), namely car,trailer and garage as presented in Figure 4. Initially, the

trailer is attached to the car:rccEC(car,trailer,0),attached(car,trailer,0). The

successor situation S1is described by rccTPP(car,garage,1). The task is to infer the

possible relations between the trailer and the garage, and the necessary actions that

would need to occur in each scenario.

ASPMT(QS): Non-Monotonic Spatial Reasoning 11

There are two domain-speciﬁc actions: the car can move, move(car, X), and the trailer

can be detached, detach(car,trailer, X)in simulation step X. Whenever the trailer

is attached to the car, they remain rccEC. The car and the trailer may be either com-

pletely outside or completely inside the garage.

S0:garage

car

trailer

S1:car

trailer garag e

car

trailer

garage

OR

motion(car, 0)

Case (a) Case (b)

Fig. 4: Non-monotonic reasoning

with additional geometric informa-

tion.

Attachment I. Given the available topological in-

formation, we must infer that there are two possi-

ble solutions (Figure. 4); (a) the car was detached

from the trailer and then moved into the garage:

(b) the car, together with the trailer attached to

it, moved into the garage:

Attachment II. We are given additional geomet-

ric information about the objects’ size: r(car) =

2,r(trailer) = 2 and r(garage) = 3. Case (b) is

now inconsistent, and we must determine that the

only possible solution is (a).

These domain-speciﬁc rules require default rea-

soning: “typically the trailer remains in the same

position” and “typically the trailer remains at-

tached to the car”. The later default rule is formalised in ASPMT(QS) by means of

the spatial defaul.: The formalisation of such rules addresses the frame problem. GQR

is not capable of expressing the domain-speciﬁc rules for detachment and attachment in

Attachment I and Attachment II. Neither GQR nor Clingo are capable of reasoning with

a combination of topological and numerical information, as required in Attachment II.

As CLP(QS) cannot express default rules, we can not capture the notion that, for ex-

ample, the trailer should typically remain in the same position unless we have some

explicit reason for determining that it moved; once again this leads to an exhaustive

enumeration of all possible scenarios without being able to specify preferences, i.e. the

frame problem, and thus CLP(QS) will not scale in larger scenarios.

The results of the empirical evaluation show that ASPMT(QS) is the only system that

is capable of (a) non-monotonic spatial reasoning, (b) expressing domain-speciﬁc rules

that also have spatial aspects, and (c) integrating both qualitative and numerical infor-

mation. Regarding the greater execution times in comparison to CLP(QS), we have not

yet implemented any optimisations with respect to spatial reasoning; this is one of the

directions of future work.

6 Conclusions

We have presented ASPMT(QS), a novel approach for reasoning about spatial change

within a KR paradigm. By integrating dynamic spatial reasoning within a KR frame-

work, namely answer set programming (modulo theories), our system can be used to

model behaviour patterns that characterise high-level processes, events, and activities

as identiﬁable with respect to a general characterisation of commonsense reasoning

about space, actions, and change [6,9]. ASPMT(QS) is capable of sound and complete

spatial reasoning, and combining qualitative and quantitative spatial information when

12 P. Wał˛ega, M. Bhatt, C. Schultz

reasoning non-monotonically; this is due to the approach of encoding spatial relations

as polynomial constraints, and solving using SMT solvers with the theory of real non-

linear arithmetic. We have demonstrated that no other existing spatial reasoning system

is capable of supporting the key non-monotonic spatial reasoning features (e.g., spatial

inertia, ramiﬁcation) provided by ASPMT(QS) in the context of a mainstream knowl-

edge representation and reasoning method, namely, answer set programming.

Acknowledgments. This research is partially supported by: (a) the Polish National

Science Centre grant 2011/02/A/HS1/0039; and (b). the DesignSpace Research Group

www.design-space.org.

References

1. Allen, J.F.: Maintaining knowledge about temporal intervals. Communications of the ACM

26(11), 832–843 (1983)

2. Bartholomew, M., Lee, J.: Stable models of formulas with intensional functions. In: KR

(2012)

3. Bartholomew, M., Lee, J.: Functional stable model semantics and answer set programming

modulo theories. In: Proceedings of the Twenty-Third international joint conference on Ar-

tiﬁcial Intelligence. pp. 718–724. AAAI Press (2013)

4. Bartholomew, M., Lee, J.: System aspmt2smt: Computing ASPMT Theories by SMT

Solvers. In: Logics in Artiﬁcial Intelligence, pp. 529–542. Springer (2014)

5. Bhatt, M.: (Some) Default and Non-Monotonic Aspects of Qualitative Spatial Reasoning. In:

AAAI-08 Technical Reports, Workshop on Spatial and Temporal Reasoning. pp. 1–6 (2008)

6. Bhatt, M.: Reasoning about space, actions and change: A paradigm for applications of spatial

reasoning. In: Qualitative Spatial Representation and Reasoning: Trends and Future Direc-

tions. IGI Global, USA (2012)

7. Bhatt, M., Guesgen, H., Wölﬂ, S., Hazarika, S.: Qualitative spatial and temporal reasoning:

Emerging applications, trends, and directions. Spatial Cognition & Computation 11(1), 1–14

(2011)

8. Bhatt, M., Lee, J.H., Schultz, C.: CLP(QS): A Declarative Spatial Reasoning Framework. In:

Proceedings of the 10th international conference on Spatial information theory. pp. 210–230.

COSIT’11, Springer-Verlag, Berlin, Heidelberg (2011)

9. Bhatt, M., Loke, S.: Modelling dynamic spatial systems in the situation calculus. Spatial

Cognition and Computation 8(1), 86–130 (2008)

10. Bhatt, M., Wallgrün, J.O.: Geospatial narratives and their spatio-temporal dynamics: Com-

monsense reasoning for high-level analyses in geographic information systems. ISPRS In-

ternational Journal of Geo-Information 3(1), 166–205 (2014)

11. Bouhineau, D.: Solving geometrical constraint systems using CLP based on linear constraint

solver. In: Artiﬁcial Intelligence and Symbolic Mathematical Computation, pp. 274–288.

Springer (1996)

12. Bouhineau, D., Trilling, L., Cohen, J.: An application of CLP: Checking the correctness of

theorems in geometry. Constraints 4(4), 383–405 (1999)

13. Ferraris, P.: Answer sets for propositional theories. In: Logic Programming and Nonmono-

tonic Reasoning, pp. 119–131. Springer (2005)

14. Ferraris, P., Lee, J., Lifschitz, V.: Stable models and circumscription. Artiﬁcial Intelligence

175(1), 236–263 (2011)

ASPMT(QS): Non-Monotonic Spatial Reasoning 13

15. Frank, A.U.: Qualitative spatial reasoning with cardinal directions. In: 7. Österreichische

Artiﬁcial-Intelligence-Tagung/Seventh Austrian Conference on Artiﬁcial Intelligence. pp.

157–167. Springer (1991)

16. Freksa, C.: Using orientation information for qualitative spatial reasoning. In: Proceedings

of the Intl. Conf. GIS, From Space to Territory: Theories and Methods of Spatio-Temporal

Reasoning in Geographic Space. pp. 162–178. Springer-Verlag, London, UK (1992)

17. Gantner, Z., Westphal, M., Wölﬂ, S.: GQR-A fast reasoner for binary qualitative constraint

calculi. In: Proc. of AAAI. vol. 8 (2008)

18. Gebser, M., Kaminski, R., Kaufmann, B., Schaub, T.: Clingo= ASP+ control: Preliminary

report. arXiv preprint arXiv:1405.3694 (2014)

19. Gelfond, M., Lifschitz, V.: The stable model semantics for logic programming. In: ICLP/SLP.

vol. 88, pp. 1070–1080 (1988)

20. Guesgen, H.W.: Spatial reasoning based on Allen’s temporal logic. Technical Report TR-89-

049, International Computer Science Institute Berkeley (1989)

21. Lee, J.H.: The complexity of reasoning with relative directions. In: 21st European Confer-

ence on Artiﬁcial Intelligence (ECAI 2014) (2014)

22. Moratz, R.: Representing relative direction as a binary relation of oriented points. In: Brewka,

G., Coradeschi, S., Perini, A., Traverso, P. (eds.) ECAI. Frontiers in Artiﬁcial Intelligence

and Applications, vol. 141, pp. 407–411. IOS Press (2006)

23. Pesant, G., Boyer, M.: QUAD-CLP (R): Adding the power of quadratic constraints. In: Prin-

ciples and Practice of Constraint Programming. pp. 95–108. Springer (1994)

24. Pesant, G., Boyer, M.: Reasoning about solids using constraint logic programming. Journal

of Automated Reasoning 22(3), 241–262 (1999)

25. Randell, D.A., Cui, Z., Cohn, A.G.: A spatial logic based on regions and connection. KR 92,

165–176 (1992)

26. Schultz, C., Bhatt, M.: Towards a Declarative Spatial Reasoning System. In: 20th European

Conference on Artiﬁcial Intelligence (ECAI 2012) (2012)

27. Schultz, C., Bhatt, M.: Declarative spatial reasoning with boolean combinations of axis-

aligned rectangular polytopes. In: ECAI 2014 - 21st European Conference on Artiﬁcial In-

telligence. pp. 795–800 (2014)

28. Varzi, A.C.: Parts, wholes, and part-whole relations: The prospects of mereotopology. Data

& Knowledge Engineering 20(3), 259–286 (1996)

29. Wölﬂ, S., Westphal, M.: On combinations of binary qualitative constraint calculi. In: IJ-

CAI 2009, Proceedings of the 21st International Joint Conference on Artiﬁcial Intelligence,

Pasadena, California, USA, July 11-17, 2009. pp. 967–973 (2009)