QUALITATIVE SPATIAL REASONING VIA 3-VALUED

HETEROGENEOUS LOGIC

Konstantine Arkoudas, Selmer Bringsjord

Departments of Cognitive and Computer Science, RPI, Troy, NY, U.S.A.

Sangeet Khemlani

Department of Cognitive Science, Princeton University, NJ, U.S.A.

Keywords:

Qualitative spatial reasoning, 3-Valued logic, Heterogeneous reasoning, Diagrams, Sat-solving, Constraints,

Relative position, Orientation, Flip-ﬂop calculus, Combined direction calculus.

Abstract:

Systems for qualitative spatial reasoning (QSR) are usually formulated as relation algebras, and reasoning in

such systems is performed by constraint-satisfaction techniques. While this is often adequate, it is a rather

inexpressive framework that cannot model and solve many spatial reasoning problems; it can also complicate

the combination of different spatial formalisms, e.g., the combination of topological with metric primitives,

or absolute orientation with relative orientation. Here we suggest an alternative approach, whereby spatial

information is expressed in a rich quantiﬁed 3-valued logic, equipped with a novel semantics for dealing with

incomplete information. Decidability is ensured by a systematic compilation into propositional logic and the

use of SAT solvers. To illustrate, we deﬁne and implement a new system for two-dimensional positional

reasoning that combines Frank’s cardinal-direction calculus, the ip- op calculus for reasoning about relative

orientation, and various new positional primitives. Unlike previous work, the system uses diagrams as well as

symbolic formulas. In particular, the logic we introduce is heterogeneous, meaning that it combines symbolic

and diagrammatic representation and inference.

1 A HYBRID SYSTEM FOR

REASONING ABOUT

ORIENTATION

Representing and reasoning about position and ori-

entation is an active area of QSR, with applications

ranging from robot navigation and geographic infor-

mation systems to computational linguistics. Most of

the existing systems are based either on absolute ref-

erence systems or on relative reference systems. For

the latter, a reference axis is introduced by ﬁxing a

given origin and a relatum, and then the position of a

given referent is described with respect to that axis. It

is increasingly recognized that realistic scenarios de-

mand the ability to handle both absolute and relative

orientation.

The system we are about to introduce, CDC (for

Combined Direction Calculus), integrates:

1. an absolute-reference orientation system im-

plementing Frank’s cardinal-directions calculus

(Frank, 1991); and

2. a relative-reference orientation system in which

the reference axis is speciﬁed by an arbitrary ori-

gin and relatum, implementing Ligozat’s ﬂip-ﬂop

calculus (Ligozat, 1993).

We introduce several additional primitives that are not

part of either of these two systems.

In what follows we demonstrate the system on a

number of examples, starting with a problem from

(Isli et al., 2001) that illustrates the need for combin-

ing absolute- and relative-orientation reasoning:

1. Viewed from Hamburg, Berlin is to the left of

Paris, Paris is to the left of London, and Berlin

is to the left of London.

2. Viewed from London, Berlin is to the left of Paris.

3. Hamburg is to the north of Paris, and north-west

of Berlin.

4. Paris is to the south of London.

80

Arkoudas K., Bringsjord S. and Khemlani S. (2009).

QUALITATIVE SPATIAL REASONING VIA 3-VALUED HETEROGENEOUS LOGIC.

In Proceedings of the International Conference on Knowledge Engineering and Ontology Development, pages 80-87

DOI: 10.5220/0002306200800087

Copyright

c

SciTePress

The ﬁrst two premises are consistent. Indeed, if we

assert

the ﬁrst two premises (i.e., insert them into

the knowledge base) and then issue the command

(find-model)

, CDC will automatically ﬁnd and dis-

play the following spatial model:

Hamburg Berlin

London Paris

Likewise, the last two premises are mutually con-

sistent. CDC automatically produces the following

model for them:

Hamburg

London Berlin

Paris

Nevertheless, the conjunction of all four premises

is inconsistent,

1

and CDC readily discovers this.

There are two ways to demonstrate the inconsistency.

One is to ask the system to ﬁnd a model for the current

knowledge base (which contains all four premises). If

the knowledge base is inconsistent, as in this example,

the system will report that no such model exists. The

other is to ask whether the sentence

false

follows

from the knowledge base. In this case CDC conﬁrms

that

false

indeed follows.

Consider next the Indian-tent problem, a rather

simple problem that nevertheless presents challenges

to several QSR systems (R¨ohrig, 1997, p. 229) and

used as a benchmark by the SparQ-Toolbox (Wallgr¨un

et al., 2006): There are four objects (points, regions,

or whatever), A, B, C, and D, whose spatial arrange-

ment is as follows:

1. Viewed from A,C is to the right of B (equivalently,

C is to the right of the line from A to B).

2. Viewed from C, D is to the right of B.

3. Viewed from A, D is to the left of B.

The goal is to deduce that viewed from C, D is to the

right of A. Geometrically, the conﬁguration must be

isomorphic to the following:

1

The only reason the four premises are jointly incon-

sistent is because, in calculi of this sort, directions such

as north and northwest are required to be mutually exclu-

sive. That clearly represents a departure from ordinary us-

age, where the two are not only compatible (e.g., we say

that Chicago is both northwest and north of Baltimore), but

in fact one implies the other. The requirement is neverthe-

less customarily imposed because in the constraint-based

paradigm that has dominated the ﬁeld, the base relations of

a QSR calculus must be mutually exclusive.

J

J

J

J

J

J

r

r

D

B

r r

CA

When we

assert

these three premises and ask CDC

to ﬁnd a model, the system responds with the follow-

ing diagram:

A

B D

C

Further, when we

query

whether it follows logically

that D must be to the right of A from C’s perspective,

CDC quickly responds afﬁrmatively.

For our third and ﬁnal example, suppose that we

must arrange ﬁve objects (e.g., furniture pieces) A, B,

C, D, and E, according to the following constraints:

1. A must not be adjacent to C.

2. Nothing is to the right of E.

3. If D and A are not adjacent, then B should be in

the middle.

4. D is above all others.

5. E and D are adjacent.

When we ask CDC to ﬁnd a model for these require-

ments, it promptly

2

returns the following diagram:

D

A B E

C

The remainder of the paper is structured as fol-

lows. The next section contains a discussion of our

overallapproach to QSR in general terms. In section 3

we apply this methodology to deﬁne CDC rigorously.

In section 4 we show how to carry out the SAT re-

duction for CDC and in general. Finally, section 5

concludes.

2 GENERAL METHODOLOGY

A spatial problem deals with a ﬁnite system of objects

s

1

,. ..,s

N

. Each object has a number of attributes,

which typically represent spatial properties. While

2

The current implementation of CDC solves all of the

sample problems that appear in the paper in a fraction of a

second (on an 2GHz IBM T2500 with 1GB of RAM). The

complete source code along with a machine-readable test

suite of numerous problems, including these examples, can

be obtained by contacting the authors.

QUALITATIVE SPATIAL REASONING VIA 3-VALUED HETEROGENEOUS LOGIC

81

there may be several attributes in general, in prac-

tice there is often only one attribute of interest. In

this case, as in many others, this attribute is location,

which here consists of a pair of numeric coordinates

that locate each object on a two-dimensional grid.

A system state is a function σ that maps each ob-

ject s

i

to a ﬁnite and non-empty set of attribute values.

As a simple example, suppose we have three objects

s

1

, s

2

, and s

3

, to be located on a 2 × 2 grid. Then a

system state σ might map s

1

to (1,1), s

2

to (2,1), and

s

3

to (1,2):

σ(s

1

) = {(1,1)};

σ(s

2

) = {(2,1)};

σ(s

3

) = {(1,2)}.

(1)

We can depict σ diagrammatically as follows:

s

1

s

3

s

2

Such a state is called a world, because it maps each

object to a unique attribute value, in this case to a

unique location.

3

Thus a world provides a maximal

amount of information: it gives the precise attribute

values (e.g., the precise locations) of all objects. Of-

tentimes, however, we do not know exact attribute

values. For instance, we might know the precise loca-

tion of s

1

(say, (2,2)), but for s

2

and s

3

we might only

know that they are both on the top row, but without

knowing their exact positions. That would be cap-

tured by the following state:

σ(s

1

) = {(2,2)};

σ(s

2

) = σ(s

3

) = {(1,1),(1,2)}.

(2)

In the extreme case, we might have no information

whatsoever about the locations of any of the objects:

σ(s

1

) = σ(s

2

) = σ(s

3

) = {(1,1),(1,2),(2, 1), (2,2)}.

So that is why states map objects to ﬁnite sets of

attribute values, rather than single attribute values.

Since set membership is disjunctive, this provides us

with a technically convenient device for dealing with

incomplete information. Moreover, the ﬁniteness re-

quirement ensures that we can encode the content of

a state with a ﬁnite disjunction. For instance, state (2)

can be represented by the CNF formula

loc(s

1

,(2, 2)) ∧ [loc(s

2

,(1, 1)) ∨ loc(s

2

,(1, 2))]

∧ [loc(s

3

,(1, 1)) ∨ loc(s

3

,(1, 2))],

where the literal loc(s

i

,l) has the obvious meaning.

Any state σ can be straightforwardly encoded by a

CNF formula F

σ

.

3

Technically, each object is mapped to a singleton, but it

is convenient to treat worlds as if they map objects directly

to values.

Let σ

1

, σ

2

be system states. We say that σ

2

is an

extension of σ

1

, written σ

2

⊑ σ

1

, iff σ

2

(s

i

) ⊆ σ

1

(s

i

)

for every i = 1,.. .,N. If σ

2

⊑ σ

1

and σ

1

6⊑ σ

2

, then

σ

2

is a proper extension of σ

1

, written σ

2

⊏ σ

1

. Thus,

if σ

2

⊑ σ

1

then F

σ

2

subsumes F

σ

1

.

Note that oftentimes system states can (and

should) be depicted diagrammatically. This is possi-

ble even in the presence of partial information (i.e.,

when the state is not a world), if we only intro-

duce appropriate abstraction tricks and correspond-

ing diagram-parsing conventions. For instance, if we

place a question mark in a location to indicate that we

do not know which object appears there, while an un-

occupied location is simply left blank, then state (2)

can be depicted as follows:

? ?

s

1

The pervasive use of such diagrams is a distinguishing

aspect of our approach. Indeed, in our work “system

state” and “diagram” are used synonymously.

Let us now describe the syntax of the underly-

ing logic. First, every object s

i

is given a name

c

i

, and indeed for many purposes the objects can be

identiﬁed with their names. A term is either an ob-

ject name c

i

or else a variable v. (To keep these

apart, variables and constants start with lower- and

upper-case letters, respectively.) Atomic sentences

are of the form

(

R t

1

·· ·t

k

)

, where R is a relation

symbol of arity k and t

1

·· ·t

k

are terms. There are

also negations

(not

p

)

, conjunctions and disjunc-

tions

(and/or

p

1

·· · p

k

)

, conditionals and bicondi-

tionals

(if/iff

p

1

p

2

)

, and universal and existen-

tial quantiﬁcations

(forall/some

v

1

·· · v

k

p

)

.

A speciﬁc system is largely determined by the

stock of available relation symbols and their mean-

ing. More precisely, to deﬁne a QSR system by this

methodology, one must choose

1. a set of object attributes (as we remarked, a single

attribute location sufﬁces in many cases); and

2. a ﬁnite set of relation symbols R , and their inter-

pretations.

The interpretation of a symbol R ∈ R is a computable

relation R on some attributes (typically on location).

Thus, for instance, supposing that

left

is a binary

relation symbol,

left

would be a binary relation on

locations, deﬁned, e.g., as follows:

left

((r

1

,c

1

),(r

2

,c

2

)) ≡ c

1

< c

2

.

Then an atom such as

(left B C)

will be true in a

given state σ iff the left relation deﬁnitely holds be-

tween all possible locations that σ assigns to the ob-

jects named

B

and

C

. (Recall that a state might map

KEOD 2009 - International Conference on Knowledge Engineering and Ontology Development

82

an object to multiple locations.) Thus, e.g., assuming

that

A

,

B

, and

C

are the names of the objects s

1

, s

2

,

and s

3

, respectively, the atom

(left B C)

is true in

world (1), as s

2

is deﬁnitely to the left of s

3

in that

state. Likewise,

(

R t

1

·· ·t

k

)

will be false in a state σ

iff R fails for all possible attribute values that σ as-

signs to the objects named by t

1

,. ..,t

k

. Thus, e.g.,

(left A B)

is false in state (1). But if R holds for

some of these values and fails for others, then the truth

value of

(

R t

1

·· ·t

k

)

is unknown—the third value of

the 3-valued semantics. Thus, e.g., the truth value of

(left B C)

is unknown in state (2), because it is true

if s

2

assumes the location (1,1) and s

3

assumes the

location (1, 2), but false if s

2

is assigned to (1,2) and

s

3

to (1,1). Given such interpretations for the rela-

tion symbols, any sentence p can be compiled into an

equivalent formula F

p

in propositional logic (in the

context of the inference problems described below).

Let us be more precise. Recall that a term t is

either a constant name c or a variable v. Thus, to eval-

uate a term t, i.e., to ﬁnd out which system object it

denotes, we need two pieces of information: a map-

ping from variables to objects, and a mapping from

constants to objects. The mapping from constants to

objects is usually ﬁxed once and for all in the begin-

ning of the session with the system. For any constant

name c, we write c for the system object denoted by

it through this initial mapping, e.g.,

A

= s

1

,

B

= s

2

,

C

= s

3

. A variable mapping is a total function χ from

the set of variables to the set of objects. Given such a

mapping χ, the denotation of a term t is written as t

χ

,

and is deﬁned as follows: If t is one of the constants,

c, then t

χ

= c; and if t is a variable v, then t

χ

= χ(v).

We write χ[v 7→ s

i

] for the mapping that assigns s

i

to

v and agrees with χ everywhere else.

We ﬁrst deﬁne the truth value of any given sen-

tence w.r.t. a given world w and a given variable map-

ping χ, denoted V

w/χ

[p], as follows. Suppose ﬁrst

that p is an atomic sentence. If p is an identity

(=

t

1

t

2

)

, then p is true iff t

χ

1

= t

χ

2

. For non-identities,

V

w/χ

[

(

R t

1

·· ·t

k

)

] is deﬁned as follows:

true if R(w(t

χ

1

),... ,w(t

χ

k

));

false otherwise.

For non-atomic p, V

w/χ

[p] is deﬁned in accor-

dance with the strong 3-valued Kleene scheme, e.g.,

V

w/χ

[

(and

p

1

p

2

)

] is true iff both V

w/χ

[p

1

] and

V

w/χ

[p

2

] are true; false if one of them is false; and

unknown otherwise. Universal and existential quan-

tiﬁcations are desugared into conjunctions and dis-

junctions, respectively.

A knowledge base is a ﬁnite set of sentences β.

A context is a pair γ = (β,σ) consisting of a knowl-

edge base β and a system state (diagram) σ. The fol-

lowing speciﬁes the key notion of logical entailment

in this framework: A world w satisﬁes a sentence p

w.r.t. a variable mapping χ iff V

w/χ

[p] = true. This

is denoted by writing w|=

χ

p. Likewise, w satisﬁes a

system state σ, written w |= σ, iff w ⊑ σ. We say that

w satisﬁes a context γ = (β,σ) w.r.t. a given χ, writ-

ten w|=

χ

(β,σ), iff w|=

χ

p for all p ∈ β and w |= σ.

A context γ entails a sentence p, written γ |= p, iff

w|=

χ

γ implies w|=

χ

p for every world w and vari-

able mapping χ. Finally, γ entails a system state σ,

written γ |= σ, iff w|=

χ

γ implies w |= σ for all w and

χ.

With this background, we can describe the two

types of inference supported in our framework as fol-

lows:

1. Theorem proving: Given a context γ, determine

whether or not

• a sentence p follows from γ; or

• a state σ

′

follows from γ.

2. Model ﬁnding: Given a context γ, ﬁnd a model

for it, if one exists, or else report inconsistency.

The system should be able to ﬁnd as many distinct

models for γ as possible.

For theorem proving, we encode the given context

γ as a CNF formula F

γ

, and check the satisﬁability

of F

γ

∧ A ∧ ¬F

p

or that of F

γ

∧ A ∧ ¬F

σ

′

, where A is

a canonicity axiom that will be discussed later. For

model-ﬁnding, we simply look for satisfying interpre-

tations for F

γ

∧ A .

We stress that grid-based numeric locations are

not a necessary feature of this methodology. Loca-

tions could be data values of an arbitrary type, e.g., the

thirteen relative regions of the Double-Cross Calculus

(Freksa, 1992) determined by an arbitrary origin and

relatum. Then a system state might map an object s

i

to a set of “locations” such as {left-front,right-back}.

3 DEFINITION OF CDC

To deﬁne CDC in accordance with the preceding

schema, we need to (a) specify the object attribute(s),

and (b) specify the relation symbols and their inter-

pretations. There is only one attribute, location, so for

(a) we only need to specify the type of locations used

in CDC. These will be cells on a two-dimensional

grid. In particular, letting R and C denote the num-

ber of rows and columns of the grid, respectively,

4

we identify a location with an ordered pair (i, j) with

4

Both dimensions of the grid (R and C) are adjustable

parameters in our implementation; they can take any posi-

tive values.

QUALITATIVE SPATIAL REASONING VIA 3-VALUED HETEROGENEOUS LOGIC

83

1 ≤ i ≤ R and 1 ≤ j ≤ C. We write L for the set of all

locations, namely, {(1,1),. .. ,(R,C)}. The top row

and leftmost column are row 1 and column 1, while

the bottom row and rightmost column are row R and

column C, respectively. Thus, a system state here is a

function

σ : {s

1

,. ..,s

N

}→ [P (L ) \ {

/

0}]

that assigns a non-empty set of locations to every sys-

tem object.

For part (b): CDC has 24 relation symbols, 15

of which are binary, 8 are ternary, and one is unary.

The unary relation is

middle

;

(middle

t

)

holds

iff the object denoted by t is located at the cen-

ter of the absolute reference system. The follow-

ing are the binary relations:

north

,

south

,

east

,

west

,

north-west

,

north-east

,

south-west

,

south-east

,

above

,

below

,

left

,

right

,

diag

,

adjacent

, and

same-location

. In addition, there

is the equality symbol:

(=

s t

)

iff s and t denote the

same object. The ternary relations are those of the

ﬂip-ﬂop calculus (

ff-right

,

ff-left

,

ff-front

,

ff-back

,

ff-inside

,

ff-start

,

ff-end

), and an

extra ternary relation

between

.

We now come to the interpretations of these sym-

bols. For each symbol R, R is a relation of the same

arity on L . Thus, for instance,

above

is a binary re-

lation on L . Speciﬁcally,

above

((r

1

,c

1

),(r

2

,c

2

)) iff

r

1

< r

2

. We illustrate with the interpretations of a few

more of the binary primitives:

west

((r

1

,c

1

),(r

2

,c

2

)): r

1

= r

2

and c

1

< c

2

adjacent

((r

1

,c

1

),(r

2

,c

2

)): [r

1

= r

2

and

|c

1

− c

2

| = 1] or [c

1

= c

2

and |r

1

− r

2

| = 1]

The interpretations of the rest should be obvious. The

only somewhat tricky case is

diag

, which holds for

positions that are located diagonally.

For the base relations of the ﬂip-ﬂop calculus, we

transform locations (r,c) into Cartesian coordinates

(x,y), where x = c and y = R − r + 1. Then, given

an origin (r

1

,c

1

), a relatum (r

2

,c

2

), and a referent

(r

3

,c

3

), with Cartesian coordinates (x

1

,y

1

), (x

2

,y

2

),

and (x

3

,y

3

), respectively, we compute the slope and

constant of the line from the origin to the relatum, and

then determine the relative location of the referent by

analytic geometry. For instance, writing b?→ e

1

;e

2

for the conditional expression that denotes the value

of e

2

(e

3

) is b is true (false), the following interprets

ff-right:

ff-right((r

1

,c

1

),(r

2

,c

2

),(r

3

,c

3

)) ≡ (c

1

= c

2

)?→

[r

2

≤ r

1

?→ (c

3

> c

1

);(c

3

< c

1

)];

[(c

2

> c

1

)?→ y

3

< y

′

;y

3

> y

′

]

where y

′

= (slope· x) + constant,

slope = y

2

− y

1

/x

2

− x

1

,

and constant = y

1

− (slope· x

1

).

Finally, note that the semantics do not preclude

worlds in which multiple objects are in the same lo-

cation. In practice, our implementation rules out such

worlds by adding the following sentence to the global

knowledge base:

(forall x y

(if (same-location x y) (= x y)))

4 TRANSLATION TO SAT

Recall that N, R, and C are the numbers of objects,

rows, and columns, respectively. Our translation uses

two basic types of Boolean variables, location–i–r–c,

asserting that object i is in location (r, c), and eq–i–i

′

,

asserting that objects i and i

′

are identical. We de-

ﬁne two additional variables in terms of location,

row–i–r and col–i–c, asserting that object i is in row

r and column c, respectively. There are, therefore,

N· R·C+ N

2

+N ·(R+C) variables. For greater read-

ability, we write variables of the form location–i–r–c

and eq–i–i

′

as location(i,(r,c)) and eq(i,i

′

), respec-

tively, and likewise for row and col. The following

axiom deﬁnes row:

N

^

i=1

"

R

^

r=1

row(i,r) ⇔

C

_

c=1

location(i,(r, c))

#

The deﬁnition of col is similar.

To weed out unintended models, we must ensure

that for every i ∈ 1,.. . ,N there is some l ∈ L such

that location(i,l); i.e., every object occupies some lo-

cation:

N

^

i=1

_

l∈L

location(i,l)

Furthermore, location must be univalent, i.e., no ob-

ject can occupy more than one location:

N

^

i=1

^

l∈L

location(i,l) ⇒

^

l

′

∈L \{l}

¬location(i,l

′

)

We also postulate the following two axioms formal-

izing the semantics of the identity relation:

"

N

^

i=1

eq(i,i)

#

and

N

^

i=1

^

j∈{1,...,N} \{i}

¬eq(i, j)

We write A for the conjunction of all of the above

KEOD 2009 - International Conference on Knowledge Engineering and Ontology Development

84

below

T

(s

i

,s

j

) =

R

^

x=1

"

row(i,x) ⇒

R

_

y=x+1

row( j,y)

#

ff-right

T

(s

i

,s

j

,s

k

) =

^

(l

1

,l

2

)∈ L

2

location(i,l

1

) ∧ location( j,l

2

) ⇒

_

l

3

∈R(l

1

,l

2

)

location(k,l

3

)

where R(l

1

,l

2

) = {l

3

∈ L | ff-right(l

1

,l

2

,l

3

)}

north-west

T

(s

i

,s

j

) =

above

T

(s

i

,s

j

) ∧

left

T

(s

i

,s

j

)

Figure 1: SAT translation of sample base relations.

axioms, including the deﬁnitions of row and col. By

an interpretation I we mean a function that assigns a

truth value to every atom of the form location–i–r–c

and eq–i–i

′

, i, i

′

∈ {1,.. .,N}, r ∈ {1,. .., R}, c ∈

{1,.. .,C}. We write I |= F, where F is a proposi-

tional formula over this set of variables, to mean that

I satisﬁes F, in the usual sense of propositional-logic

semantics. We say that an interpretation I is canon-

ical iff I |= A . We are only interested in canonical

interpretations.

A system state (diagram) σ can be encoded as a

propositional formula F

σ

as follows:

F

σ

=

N

^

i=1

_

l∈σ(s

i

)

location(i,l)

Alternatively—and more efﬁciently—we can encode

σ as the conjunction of all unit clauses that state where

an object cannot be. We can now deﬁne the main

translation function T that takes a sentence p and a

variable mapping χ and produces a formula in propo-

sitional logic (over the aforementioned set of vari-

ables) that captures the 3-valued-logic semantics of

p in a sense made rigorous by the theorem below. For

atoms, T (

(

R t

1

·· ·t

k

)

,χ) = R

T

(t

χ

1

,. ..,t

χ

k

), where R

T

is deﬁned for some sample R in ﬁgure 1. Boolean

combinations are straightforward, e.g.,

T (

(and

p

1

p

2

)

,χ) = T (p

1

,χ) ∧ T (p

2

,χ),

and universal (existential) quantiﬁcations are reduced

to conjunctions (disjunctions), e.g.,

T (

(forall

v p

)

,χ)

is deﬁned as the conjunction of all T (p,χ[v 7→ s

i

]) for

i = 1,... ,N.

For a knowledge base β and mapping χ, T (β,χ) =

{T (p, χ) | p ∈ β}. Note that the size of the clause set

for base relations is O(G

3

), where G is the size of the

grid (i.e., R·C).

Writing Sat[S] and UnSat[S] to mean that S is sat-

isﬁable and unsatisﬁable, respectively, we have:

Theorem 1.

Pick an arbitrary

χ

. Then:

(β,σ) |= p

iff

UnSat[{A ,F

σ

,¬T (p,χ)} ∪ T (β, χ)]

;

(β,σ) |= σ

′

iff

UnSat[{A ,F

σ

,¬F

σ

′

} ∪ T (β,χ)]

;

(β,σ)

has a model iff

Sat[{A ,F

σ

} ∪ T (β, χ)]

.

(We assume without loss of generality that sentences

in the abovetheorem are closed, i.e., haveno free vari-

ables. If one does, we can consider its universal clo-

sure instead, since the semantics ensure that the two

are equivalent.) This result completes the reduction

of CDC to SAT, and enables us to determine whether

an arbitrary sentence or diagram follows from the cur-

rent context. For a given inference problem, our im-

plementation carries out this propositional encoding

and then proceeds in three stages. First it translates

the produced formulas into CNF; it then translates the

CNF into DIMACS format; and it ﬁnally invokes a

SAT solver on the DIMACS input (currently RSat).

It should be noted that the reduction to SAT can be

carried out automatically not just for CDC but for any

QSR system adhering to the approach we have out-

lined in this paper, given the interpretations of its re-

lation symbols. We sketch out the relevant technique

below. Suppose for simplicity that there is only one

attribute (this is not an essential restriction), which, in

the context of a speciﬁc inference problem, can only

take values from a ﬁnite set A. Then we introduce

variables of the form att-i-v for i = 1,.. .,N, v ∈ A.

Now let R be an interpreted relation of arity k + 1,

k ≥ 0. Given values v

1

,. ..,v

k

∈ A, deﬁne the projec-

tion R↓(v

1

,. ..,v

k

) as follows:

R↓(v

1

,. ..,v

k

) = {v ∈ A | R(v

1

,. ..,v

k

,v)}.

Then we deﬁne R

T

(s

i

1

,. ..,s

i

k

) as follows:

^

(v

1

,...,v

k

)∈A

k

{att-i

1

-v

1

,. ..,att-i

k

-v

k

} ⇒

_

v∈R↓(v

1

,...,v

k

)

att-i

k+1

-v

QUALITATIVE SPATIAL REASONING VIA 3-VALUED HETEROGENEOUS LOGIC

85

This is essentially the same general scheme that was

used in the translation of CDC. (Derived attributes

such as row and col are convenient but inessential ab-

breviations.)

5 COMPARISON WITH

PREVIOUS APPROACHES AND

CONCLUSIONS

Historically, most of the work in QSR has stemmed

from and was heavily inﬂuenced by Allen’s calculus

(Allen, 1983). Although some important early work

was couched in ﬁrst-order logic (Randell et al., 1992),

by and large, following Allen it has been widely

thought that an expressive reasoning framework for

QSR powered by a general-purpose inference proce-

dure would be infeasible. Accordingly, expressivity

and reasoning completeness have been sacriﬁced in

the interest of efﬁciency. With few exceptions, QSR

systems are couched as relation algebras, and reason-

ing in such systems is performed by CSP techniques

on networks of objects constrained by binary (or oc-

casionally ternary) base relations.

In the wake of the remarkable progress that has

been achieved in SAT-solving technology over the last

decade, this approach has become questionable. The

general-purpose reasoning provided by off-the-shelf

SAT-solvers is now powering systems that solve ex-

tremely demanding problems, not only in hardware

and software veriﬁcation, but in AI as well (e.g., for

planning and scheduling). That QSR could also stand

to beneﬁt from this progress is suggested by the fol-

lowing observation: The reasoning required in many

practical QSR applications is model-based, dealing

with a ﬁnite set of objects (regions, points, lines, time

intervals, or arbitrary objects in a scene), each hav-

ing a ﬁnite number of possible spatial-attributevalues.

Therefore, one can retain ﬁrst-order logic and still

achieve decidability through propositionalization, by

restricting the universe of discourse to the set of ob-

jects in question and then deciding entailment through

off-the-shelf SAT solvers.

By comparison to the CSP tradition, the approach

we have suggested in this paper can offer the follow-

ing advantages:

1. Increased expressivity: The full expressive power

of ﬁrst-order logic is available, allowing for much

more natural modeling of spatial information.

Anything that could be modeled with relational

constraints can be expressed in ﬁrst-order logic,

but the converse is not true. Many problems

that could not be solved—or even expressed—in

pure constraint-based calculi can be directly for-

mulated and solved in the present setting. The

furniture-arrangementproblem from section 1, for

instance, is beyond the reach of current QSR sys-

tems, but it is readily formulated and solved in

CDC.

2. Higher level of abstraction: In the present ap-

proach there is no need to compute transitivity ta-

bles or to devise or modify path-consistency al-

gorithms. These are laborious processes—often

left unﬁnished for many systems–that are neces-

sitated largely by the idiosyncrasies of the un-

derlying reasoning mechanism. When deﬁning a

QSR system in our approach, one can focus on the

purely logical aspects of the primitive relations

and relegate the reasoning to the SAT solver. It

is also not necessary to require the primitive rela-

tions of the system to be JEPD (jointly exhaustive

and pairwise disjoint), a requirement that can have

somewhat awkward modeling consequences (see

footnote 1).

3. Built-in mechanisms for dealing with incomplete

spatial knowledge: The semantics of the present

framework are based on an intuitive new 3-valued

logic that is particularly apt for modeling incom-

plete spatial information. We have shown how to

compile these semantics into propositional logic.

4. Extensibility: New dimensions of spatial repre-

sentation and reasoning can be incorporated with

relatively little effort. The relative-orientation

primitives of the ﬂip-ﬂop calculus, for instance,

were added to the cardinal-direction primitives of

Frank’s calculus in less than two hours. By con-

trast, combining these two systems in a constraint-

based algebraic setting was a major research chal-

lenge that by itself merited publication (Isli et al.,

2001). Similar systems could be implemented for,

e.g., topological inference.

5. Orthogonal efﬁciency improvements: Progress

in SAT-solving technology is rapid, and should

translate into corresponding efﬁciency gains for

SAT-based QSR systems.

6. Prominent role for diagrams: Diagrams play a

crucial role in spatial cognition, but so far they

have been largely absent from QSR systems,

which are usually entirely algebraic, even though

QSR is recognized as “especially suited for appli-

cations that involve interaction with humans, as

they provide an interface based on human spatial

concepts” (Wallgr¨un et al., 2006, p. 39). The

system we have presented can accept diagram-

matic input, including incompletely speciﬁed di-

agrams, and can also present output diagrammat-

KEOD 2009 - International Conference on Knowledge Engineering and Ontology Development

86

ically. Moreover, the underlying framework pro-

vides a general formal notion of diagrams.

7. Heterogeneous proofs: In addition to automat-

ing reasoning tasks such as model-ﬁnding and

theorem-proving, the present framework allows

for proofs that express spatial reasoning.

5

These

are given in a heterogeneous framework that is

speciﬁcally designed to combine visual and sym-

bolic reasoning. None of the present systems al-

low for proofs, let alone heterogeneous proofs.

Nevertheless, proofs are not only interesting in

their own right, but they could also play an impor-

tant role in human-machineinteraction, since they

can serve as explanations of spatial reasoning.

In the near future we plan to integrate additional

spatial primitives (particularly topological ones); im-

prove the efﬁciency of the SAT encoding; pursue

additional optimizations (e.g., cache the canonicity

clauses after the ﬁrst translation, instead of reencod-

ing them on every query); and evaluate the system’s

performance on a wider range of problems.

REFERENCES

Allen, J. F. (1983). Maintaining knowledge about temporal

intervals. Communications of the ACM, 26(11):832–

843.

Arkoudas, K. and Bringsjord, S. (2009). Vivid: An

AI Framework for Heterogeneous Problem Solv-

ing. Artiﬁcial Intelligence. In press, doi:10.1016/

j.artint.2009.06.002.

Frank, A. U. (1991). Qualitative Spatial Reasoning with

Cardinal Directions. In Kaindl, H., editor, Proc. 7th

Austrian Conference on Artiﬁcial Intelligence, pages

157–167. Springer.

Freksa, C. (1992). Using Orientation Information for Quali-

tative Spatial Reasoning. In Frank, A. U., Campari, I.,

and Formentini, U., editors, Theories and methods of

spatio-temporal reasoning in geographic space, pages

162–178. Springer.

Isli, A., Haarslev, V., and M¨oller, R. (2001). Combining

cardinal direction relations and relative orientation re-

lations in Qualitative Spatial Reasoning. Technical

Report FBI-HH-M-304/01, Fachbereich Informatik,

Universit¨ot Hamburg.

Ligozat, G. F. (1993). Qualitative triangulation for spatial

reasoning. In Frank, A. U. and Campari, I., editors,

Spatial Information Theory. A Theoretical Basis for

GIS. European Conference, COSIT’93, volume 716 of

LNCS, pages 54–68. Springer.

5

We have not had space to cover that aspect of the sys-

tem here, but we discuss it in detail elsewhere (Arkoudas

and Bringsjord, 2009).

Randell, D. A., Cui, Z., and Cohn, A. G. (1992). A spatial

logic based on regions and connection. In Proceedings

of the Third International Conference on Knowledge

Representation and Reasoning, pages 165–176.

R¨ohrig, R. (1997). Representation and Processing of Qual-

itative Orientation Knowledge. In Proceedings of the

21st Annual German Conference on Artiﬁcial Intelli-

gence, volume 1303 of LNCS, pages 219–230.

Wallgr¨un, J. O., Frommberger, L., Wolter, D., Dylla, F., and

Freksa, C. (2006). Qualitative Spatial Representation

and Reasoning in the SparQ-Toolbox. In Barkowsky,

T., Knauff, M., Ligozat, G., and Montello, D. R., edi-

tors, Spatial Cognition, volume 4387 of Lecture Notes

in Computer Science, pages 39–58. Springer.

QUALITATIVE SPATIAL REASONING VIA 3-VALUED HETEROGENEOUS LOGIC

87