The Oriented Straight Line Segment Algebra - informatik.uni-bremen.de

5 downloads 8036 Views 1MB Size Report
Jul 21, 2011 - National Center for Geographic Information and Analysis, .... condensed semantics, as we call it, provides spatial domain knowledge to the.
A Condensed Semantics for Qualitative Spatial Reasoning About Oriented Straight Line Segments Reinhard Moratz1 and Dominik Lücke2 and Till Mossakowski2,3 1 University of Maine, National Center for Geographic Information and Analysis, Department of Spatial Information Science and Engineering, 348 Boardman Hall, Orono, 04469 Maine, USA. [email protected] 2 University of Bremen, Collaborative Research Center on Spatial Cognition (SFB/TR 8), Department of Mathematics and Computer Science, Bibliothekstr. 1, 28359 Bremen, Germany. {luecke, till}@informatik.uni-bremen.de 3 DFKI GmbH Bremen, Safe and Secure Cognitive Systems, Enrique-Schmidt-Str. 5, 28359 Bremen, Germany. [email protected]

Abstract More than 15 years ago, a set of qualitative spatial relations between oriented straight line segments (dipoles) was suggested by Schlieder. However, it turned out to be difficult to establish a sound constraint calculus based on these relations. In this paper, we present the results of a new investigation into dipole constraint calculi which uses algebraic methods to derive sound results on the composition of relations of dipole calculi. This new method, which we call condensed semantics, is based on an abstract symbolic model of a specific fragment of our domain. It is based on the fact that qualitative dipole relations are invariant under orientation preserving affine transformations. The dipole calculi allow for a straightforward representation of prototypical reasoning tasks for spatial agents. As an example, we show how to generate survey knowledge from local observations in a street network. The example illustrates the fast constraint-based reasoning capabilities of dipole calculi. We integrate our results into two reasoning tools which are publicly available. Keywords: Qualitative Spatial Reasoning, Relation Algebra, Affine Geometry

Preprint submitted to Elsevier

July 21, 2011

1. Introduction Qualitative reasoning about space abstracts from the physical world and enables computers to make predictions about spatial relations, even when precise quantitative information is not available [4]. A qualitative representation provides mechanisms which characterize the essential properties of objects or configurations. In contrast, a quantitative representation establishes a measure in relation to a unit of measurement which must be generally available [12]. The constant and general availability of common measures is now self-evident. In history, however, there used to be a lot of measurement systems that were only standardized locally. If you said that a pole was six feet long, that pole would have been 150 cm long in the grand duchy of Hesse, but 300 cm in the duchy of Nassau. Even today several quantitative systems of measurements are used in the world, with the SI-system, the Imperial system and the United States Customary Units being the predominant ones. One need only recall the history of length measurement technologies to see that the more local relative measures, which are represented qualitatively1 , can be managed by biological/epigenetic cognitive systems much more easily than absolute quantitative representations. Qualitative spatial calculi usually deal with elementary objects (e.g., regions, points) and qualitative relations between them (e.g., “included in,” “adjacent,” “to the left of”). This is the reason why qualitative descriptions are quite natural for people. The two main trends in qualitative spatial reasoning (QSR) are topological reasoning about regions [9, 44, 45, 49, 64] and positional (e.g., direction and distance) reasoning about point configurations2 . Positional relations can refer to absolute (e.g., cardinal) directions [10, 28, 48] or to relative directions [25]. Relative position calculi based on points as basic entities are [3, 13, 23, 35, 54, 65]. Most relative position calculi use ternary relations. In contrast cardinal directions are expressed as binary relations. Positional calculi can be related to the results of psycholinguistic research in the field of reference systems [25, 37]. Human natural language spatial propositions often express relative spatial positions based on reference directions derived from the shape (and function) of one of the objects involved [25] (e.g., “The hill is to the left of the train”). This leads to binary relations between objects in which at least one of the objects has the feature of orientedness. For that reason, in our conception, orientedness is an important feature of natural objects. In a corresponding qualitative calculus it is necessary to use more complex basic entities than points. One option for building more complex basic entities is to use oriented line segments (see Figure 1) as basic entities. In this abstraction we lose the specific shape of the object, but preserve the feature of orientedness. With this approach we can design relative position calculi in which directions are expressed as binary relations. The corresponding calculus, Schlieder’s line 1 Compare for example the qualitative expression “one piece of material is longer than another” with the quantitative expression “this thing is two meters long.” 2 There is also some work about directions between regions [18, 55]

2

segment calculus [53]3 , is the main topic of this paper. Oriented straight line segments (which were called dipoles by Moratz et al. [36]) may be specified by their start and end points.

Figure 1: Orientation between two dipoles

Using dipoles as basic building blocks, more complex objects can be constructed (e.g., polylines, polygons) in a straightforward manner (see Figure 11). Therefore, dipoles can be used as the basic units in numerous applications. To give an example, line segments are central to edge-based image segmentation and grouping in computer vision. In addition, GIS systems often have line segments as basic entities [21]. Polylines are particularly interesting for representing paths in cognitive robotics [40] and can serve as the geometric basis of a mobile robot when autonomously mapping its working environment [61]. To sum up, dipole calculi are qualitative calculi that abstract from metric information. They focus on directional relations, but can also be used to express certain topological relations (see Section 2.7). In the previous paragraphs, we discussed the representation of spatial knowledge. The central topic of this paper is the collection of reasoning mechanisms which are employed to make use of the represented initial knowledge to infer indirect knowledge. In qualitative spatial reasoning two main reasoning modes are used: conceptual neighborhood-based reasoning, and constraint-based reasoning about (static) spatial configurations. Conceptual neighborhood-based reasoning describes whether two spatial configurations of objects can be transformed into each other by small changes [11], [15]. The conceptual neighborhood of a qualitative spatial relation is the set of relations into which a relation can be changed with minimal transformations, e.g., by continuous deformation. Such a transformation can be a movement of one object in the configuration in a short period of time. The movement of an agent can then be modeled qualitatively as a sequence of neighboring spatial relations which hold for adjacent time in3 However, Schlieder’s first presentation of dipole relations [53] does not mention composition of dipole relations. Moreover, he focuses on DRAlr (with no more than two start or end points on the same straight line), which cannot be used for polylines, while his presentation of the finer calculi is sketchy and imprecise, leading to the wrong number, 63, of DRAf relations. See Section 2.1 for the definition of these calculi.

3

tervals4 . Based on this qualitative representation of trajectories, neighborhoodbased spatial reasoning can for example be used as a simple, abstract model of the navigation of a spatial agent5 . In constraint-based reasoning about spatial configurations, typically a partial initial knowledge of a scene is represented in terms of qualitative constraints between spatial objects. Implicit knowledge about spatial relations is then derived by constraint propagation6 . Previous research has found that the mathematical notion of a relation algebra and related notions are well-suited for this kind of reasoning. In particular, in an arbitrary relation algebra, the well-known path consistency algorithm computes an algebraic closure of a given constraint network, and this approximates, and in some cases also decides, the consistency of the network in polynomial time. Intelligent backtracking techniques and the study of maximal tractable subclasses also allow of efficiently deciding networks involving disjunctions. Starting with Allen’s interval algebra, this approach has been successfully applied to several qualitative constraint calculi, and is now supported by freely available toolboxes [16, 59]. Moreover, people have started to develop benchmark problem libraries [42] and have shown that this method performs quite well also when compared to other constraint reasoning techniques [60]. Since this approach is inherently based on composition tables, an essential prerequisite is the computation of such tables. For the dipole calculi, composition tables are quite large, and existing composition tables contain errors7 . The main objective of this paper is the first computation of correct composition tables for all dipole calculi. The next sections of this paper present a detailed and technical description of dipole calculi and prove new results about algebraic features of these constraint calculi. In Section 2 we introduce base relation sets of the dipole calculi. Then we revisit the theory of constraint reasoning with algebraic closure. To use contraint reasoning in applications, our newly computed correct composition table can directly be fed into the SparQ [58, 59] and GQR [16] tools and used for reasoning in dipole calculi. Using this, a concrete sample application of dipole calculi using a spatial reasoning toolbox is presented. 4 This

was the reasoning used in the first investigation of dipole relations by Schlieder [53] an application of neighborhood based reasoning of spatial agents, we refer the reader to the simulation model SAILAWAY [7] 6 For an application of constraint-based reasoning for spatial agents, we refer the reader to the example in Section 2.5. 7 There has been an explosion of new qualitative spatial calculi in the last decade. A recent diploma thesis supervised by us has found errors in the composition tables of several such calculi. But the composition table is the core of the standard reasoning mechanism (i.e. algebraic closure) for a calculus. A wrong composition table can easily lead to wrong conclusions in reasoning. While algebraic closure has its limits and is incomplete, we know that it is still sound, i.e. always gives a safe approximation of the space of possible geometric configurations. However, this soundness depends on a correct composition table. Developing techniques for correctly computing composition tables is therefore an important contribution. This means that the methods for computing composition tables should be subject of research. Moreover, the method we use also gives insight into the nature of spatial configurations, by identifying them with orbits in the affine group GA(R2 ). 5 For

4

Finally, an inconsistent but algebraically closed scenario is presented, showing the limits of the algebraic closure method. Section 3 tackles the problem of obtaining a correct composition table for dipole calculi. It provides a condensed semantics for the dipole calculus. A condensed semantics, as we call it, provides spatial domain knowledge to the calculus in the form of an abstract symbolic model of a specific fragment of the spatial domain. In this model, possible configurations of very few of the basic spatial entities of a calculus are enumerated. In our case, we use orbits in the affine group GA(R2 ). This provides a useful abstraction for reasoning about qualitatively different configurations in the Euclidean plane, so that the mathematical reasoning can be rather directly transformed to a computer program checking the configurations. This avoids the sources of errors of previous approaches to composition table computation. We use affine geometry at a rather elementary level and appeal to pictures instead of complete analytic arguments, whenever it is easy to fill in the details—however, at key points in the argument, careful analytic treatments are provided. Further, we calculate the composition tables for the dipole calculi using the condensed semantics and we investigate properties of the composition. It should be noted that condensed semantics techniques can be applied to other calculi as well, for example, the OPRA calculus [34]. In general, condensed semantics can be summarized as the study of geometric transformations that leave the relations of the calculus at hand invariant, and then work with qualitative configurations, which essentially can be identified as orbits in the automorphism group of these transformations. Our paper ends with a summary and conclusion and discussion of future work. 2. Representation of Dipole Relations and Relation Algebras In this section, we first present a set of spatial relations between dipoles, then variants of this set of spatial relations. The next subsection gives a formal representation of dipole relations. Then a subsection presents the standard reasoning method with dipole relations. The last three subsections discuss application contexts for dipole reasoning and exhibit some of the limits of dipole reasoning. 2.1. Basic Representation of Dipole Relations The basic entities we use are dipoles, i.e., oriented line segments formed by a pair of two points, a start point and an end point. Dipoles are denoted by A, B, C, . . ., start points by sA and end points by eA , respectively (see Figure 1). These dipoles are used for representing spatial objects with an intrinsic orientation. When examining different relations, the goal is to obtain a set B of jointly exhaustive and pairwise disjoint atomic or base-relations, such that exactly one relation holds between any two dipoles. The set of general relations P(B) is the powerset of the set of base relations. That is, a general relation is a set R ⊆ B of base relations. It is interpreted as the union of these base

5

relations, and bySabuse of notation, we will identify a general relation R ⊆ B with the union R. General relations are used to express uncertainty about the relative position of dipoles. If these relations form an algebra which fulfills certain requirements, it is possible to apply standard constraint-based reasoning mechanisms that were originally developed for temporal reasoning [1] and that have also proved valuable for spatial reasoning (see Section 2.4). So as to enable efficient reasoning, an attempt should be made to keep the number of different base relations relatively small. For this reason, we will restrict ourselves to using two-dimensional continuous space for now, in particular R2 , and distinguish the location and orientation of different dipoles only according to a small set of seven different dipole–point relations. We distinguish between whether a point lies to the left, to the right, or at one of five qualitatively different locations on the straight line that passes through the corresponding dipole8 . The corresponding regions are shown on Figure 2. A corresponding set of relations between three points was proposed by Ligozat [27] under the name flip-flop calculus and later extended to the LR calculus [54]9 .

Figure 2: Dipole-point relations (= LR relations)

Then these dipole–point relations describe cases where the point is: to the left of the dipole (l); to the right of the dipole (r); straight behind the dipole (b); at the start point of the dipole (s); inside the dipole (i); at the end of the dipole (e); or straight in front of the dipole (f). For example, in Figure 1, sB lies to the left of A, expressed as A l sB . Using these seven possible relations between a dipole and a point, the relations between two dipoles may be specified according to the following four relationships: A R1 sB ∧ A R2 eB ∧ B R3 sA ∧ B R4 eA , where Ri ∈ {l, r, b, s, i, e, f} with 1 ≤ i ≤ 4. Theoretically, this gives us 2401 relations, out of which 72 relations are geometrically possible. They constitute the dipole calculus DRAf (f stands for fine grained) and they are listed in Figure 3. In the next subsection we present several versions of sets of dipole 8 In his introduction of a set of qualitative spatial relations between oriented line segments, Schlieder [53] mainly focused on configurations in which no more than two end or start points were on the same straight line (e.g., all points were in general position). However, in many domains, we may wish to represent spatial arrangements in which more than two start or end points of dipoles are on a straight line. 9 The LR calculus also features the relations dou and tri for both reference points or all points being equal, respectively. These cases are not possible for dipoles, since the start and end points cannot coincide by definition.

6

Figure 3: The 72 atomic relations of the DRAf calculus. In the dipole calculus, orthogonality is not defined, although the graphical representation may suggest this.

base relations also in an informal way. Then in Section 2.3 we define the dipole base relations in an algebraic way. Proposition 1. Allen’s interval algebra can be embedded into DRAf by the

7

following mapping of base relations:10 = b m o d s f

7→ 7 → 7→ 7→ 7 → 7→ 7 →

sese ffbb efbs ifbi bfii sfsi beie

bi mi oi di si fi

7→ 7 → 7 → 7 → 7 → 7 →

bbff bsef biif iibf sisf iebe

In cases stemming from the embedding of Allen’s interval algebra, the dipoles lie on the same straight lines and have the same direction. DRAf and DRAfp also contain 13 additional relations which correspond to the case with dipoles lying on a line but facing opposite directions. 2.2. Several Versions of Sets of Dipole Base Relations In their paper on customizing spatial and temporal calculi, Renz and Schmid [51] investigated different methods for deriving variants of a given calculus that have a granularity better-suited for certain tasks. One of these methods uses only a subset of the base relations as a new set of base relations. For example, Schlieder [53] introduced a set of base relations in which no more than two start or end points were on the same straight line. As a result, only a subset of the DRAf base relations is used. We call DRAlr a calculus based on these base relations (where lr stands for left/right). The following base relations are part of DRAlr : rrrr, rrll, llrr, llll, rrrl, rrlr, rlrr, rllr, rlll, lrrr, lrrl, lrll, llrl, lllr. Moratz et al. [36] introduced an extension of DRAlr which adds relations for representing polygons and polylines. In this extension, two start or end points can share an identical location. In this calculus three points at different locations still cannot belong to the same straight line. This subset of DRAf was named DRAc (c refers to coarse, f refers to fine). The set of 24 base relations of DRAc extends the base relations of DRAlr with the following relations: ells, errs, lere, rele, slsr, srsl, lsel, rser, sese, eses. The method of using only a subset of base relations reduces the number of base relations. Conversely, other methods extend the number of base relations. For example, Dylla and Moratz [8] have observed that DRAf may not be sufficient for robot navigation tasks, because the dipole configurations that are pooled in certain base relations are too diverse. Thus, the representation has been extended with additional orientation knowledge and a more fine-grained DRAfp calculus with additional orientation distinctions has been derived. It has slightly more base relations. The large configuration space for the rrrr relation is visualized in Figure 4. The other analogous relations which are extremely coarse are llrr, rrll and llll. In 10 Indeed,

this yields a homomorphism of non-associative algebras.

8

Figure 4: Pairs of dipoles subsumed by the same relation

many applications, this unwanted coarseness of four relations can lead to problems11 . Therefore, we introduce an additional qualitative feature by considering the angle spanned by the two dipoles. This gives us an important additional distinguishing feature with four distinctive values. These qualitative distinctions are parallelism (P) or anti-parallelism (A) and mathematically positive and negative angles between A and B, leading to three refining relations for each of the four above-mentioned relations (Figure 5). We call this algebra DRAfp , as it is an extension of the fine-grained relation algebra DRAf with additional distinguishing features due to “parallelism.” For the relations different from rrrr, llrr rrll and llll, a ’+’ or ’−’, ’P’ or ’A’ respectively, is already determined by the original base relation and does not have to be mentioned explicitly. These base relations then have the same relation symbol as in DRAf . The introduction of parallelism into dipole calculi not only has benefits in certain applications, the algebraic features also benefit from this extension (see Section 3.6). 2.3. Formal Representation of Dipole Relations The dipole relations have been introduced in an informal way in Section 2.1, but they can also be defined in an algebraic way. The following derivation of the semantics of the dipole calculi may seem a bit complicated to some readers, but we want to remain as compatible to the work begun by Moratz et al. in [36] as possible. Every dipole D on the plane R2 is an ordered pair of two points sD and eD in the Euclidean plane, each of them being represented by its Cartesian coordinates x and y, with x, y ∈ R and sD 6= eD . D = (sD , eD ) ,

sD = ((sD )x , (sD )y ) ,

eD = ((eD )x , (eD )y )

11 An investigation by Dylla and Moratz into the first cognitive robotics applications of dipole relations integrated in situation calculus [8] showed that the coarseness of DRAf compared to DRAfp would indeed lead to rather meandering paths for a spatial agent.

9

Figure 5: Refined base relations in DRAfp

The basic relations are then described by equations with the coordinates as variables. The set of solutions for a system of equations describes all the possible coordinates for these points. A first specification based on coordinates was presented in Moratz et al. [36]. Let us focus here on the LR relations first. Given a dipole A and a point p, we want to determine whether p lies to the right or to the left of A, or is collinear with A. We begin the derivation by

~ Figure 6: Constructing P~ × A ~ and P~ having base point sA and pointing to eA and p constructing vectors A 10

respectively as ~= A



(eA )x − (sA )x (eA )y − (sA )y



P~ =



px − (sA )x py − (sA )y



~ and P~ as vectors in three-dimensional Euclidean space, located If we construe A in the plane determined by z = 0, the vector product ~ P~ × A points upwards (z > 0) iff p is to the right of A, and downwards (z < 0) iff p is ~ is given by to the left of A. The z coordinate of P~ × A z = −px · (sa )y + (ea )x · (sa )y + py · (sa )x − (ea )y · (sa )x − py · (ea )x + px · (ea )y ~ and P~ are collinear (z = 0), we can use If the vectors A ~ · P~ = η =t A (sa )2y + (sa )2x − py · (sa )y − (ea )y · (sa )y − px · (sa )x − (ea )x · (sa )x + py · (ea )y + px · (ea )x ~ and P~ point into the same direction, and negative if they — this is positive if A point into opposite directions. Altogether, we can define the LR relations as:    l if z < 0   r if z > 0     b if z = 0 ∧ η < 0      s if p = sa z =0∧η >0 R = i if   ||ea − sa || > ||p − sa ||     e if p =    ea   z =0∧η >0    f if ||ea − sa || < ||p − sa || This description of the relations is particularly useful for reasoning tasks, e.g., Gröbner reasoning. Gröbner reasoning can be used to check the solvability of linear equalities over the complex numbers. For the SparQ toolbox [58] an extension of Gröbner reasoning has been defined and implemented that can check the solvability of nonlinear inequalities over the real numbers. Unfortunately Gröbner reasoning has doubly exponential running time. This particular extension is still work in progress, but preliminary results have been published in [63]. A follow-up article is to appear. The semantics of the relations can also be expressed in a more convenient and more regular way using atan2 and the function angle based on it: ~ B) ~ := atan2(A ~x · B ~y − A ~y · B ~ x, A ~x · B ~x + A ~y · B ~ y) angle(A, To determine an LR-relation (a b R c) with a 6= b, we compute the angle from ~ to the vector ac the vector ab ~ as depicted in Figure 7a. Now we just need to 11

(a)

(b)

Figure 7: Computing LR-relation (a) and qualitative angle (b) via vectors

substitute the LR-relations for their definitions by the case distinction:

R

=

 l     r      b s   i      e   f

if if if if if if if

0 < angle(ab, ac) < π − π < angle(ab, ac) < 0 angle(ab, ac) = π ∨ angle(ab, ac) = −π angle(ab, ac) = 0 ∧ ||ac|| ~ =0 ~ angle(ab, ac) = 0 ∧ ||ac|| ~ < ||ab|| ~ angle(ab, ac) = 0 ∧ ||ac|| ~ = ||ab|| ~ angle(ab, ac) = 0 ∧ ||ac|| ~ > ||ab||

The conditions for s and e can be rewritten as a = c and b = c respectively. Please note that the LR relations Dou and T ri (which express that the first two points coincide) cannot occur, since dipoles always have a non-zero length. To obtain a DRAf relation, we determine all four LR-relations by this operation and concatenate them in the manner described above. For determining a DRAfp -relation, we additionally need to determine the angle of intersection of two dipoles dpA and dpB . Again we consider them as ~A and dp~B as shown in Figure 7b and we can get the quantitative vectors dp angle via ~A , dp~B ) angle(dp by using the simple case-distinction:  ~A , dp~B ) < π  if 0 < angle(dp  +   ~A , dp~B ) < 0 − if − π < angle(dp R5 = ~ ~ ~A , dp~B ) = −π  A if angle(dpA , dpB ) = π ∨ angle(dp    ~ ~ P if angle(dpA , dpB ) = 0

12

2.4. Constraint Reasoning With Algebraic Closure The domain of the dipole calculi, the Euclidean plane, is infinite. Standard methods developed for finite domains generally do not apply to constraint reasoning over infinite domains. The theory of relation algebras and non-associative algebras [24, 32] allows of a purely symbolic treatment of constraint satisfaction problems involving relations over infinite domains. The corresponding constraint reasoning techniques were originally introduced for temporal reasoning [1] and later proved to be valuable for spatial reasoning [22, 49]. The central data for a qualitative calculus are given by: • a set B of (symbolic names for) base relations, which are interpreted as relations over some domain, having the crucial properties of pairwise disjointness and joint exhaustiveness (a general relation is then simply a set of base relations); • a table for the computation of the converses of relations; • a table for the computation of the compositions of relations. As described in Section 2.1, the set of general relations P(B) is the powerset of the set of base relations, and each such general relation is identified with its union. The converse and composition operations are easily extended from B to P(B). These data together generate a so-called non-associative algebra [29, 32]. Then, the path consistency algorithm [33] and backtracking techniques [57] are the tools used to tackle the problem of consistency of constraint networks (and related problems). These algorithms have been implemented in two generic reasoning tools, GQR [16] and SparQ [59]. To integrate a new calculus into these tools, only a list of base relations and tables for compositions and converses need to be provided. Thereby, the qualitative reasoning facilities of these tools become available for this calculus. Since the compositions and converses of general relations can be reduced to compositions and converses of base relations, these tables only need to be given for base relations. Based on these tables, the tools provide a means to approximate the consistency of constraint networks, list all their atomic refinements, and more (see Section 2.5 for an application).12 If b is a base relation, the converse {(x, y)|(y, x) ∈ b} is often itself a base relation and is denoted by b`13 . In the dipole calculus, it is obvious that the converse of a relation can easily be computed by exchanging the first two and second two letters of the name of a relation, see Table 1. Since (R^ )^ = R in the DRAf calculus, the entries in the table can be read from top to bottom as well as from bottom to top yielding correct converses. For the dipole calculus DRAfp with additional orientation distinctions, converses can be obtained by 12 With more information about a calculus, both of the tools can provide functionality that goes beyond simple qualitative reasoning for constraint calculi. 13 In Freksa’s double-cross calculus [12] the converses are not necessarily base relations, but for the calculi that we investigate this property holds.

13

R R^

rrrr rrrr

rrrl rlrr

rrlr lrrr

rrll llrr

rllr lrrl

rlll llrl

llll llll

lrll lllr

R R^

eses eses

sese sese

ells lsel

errs rser

lere rele

slsr srsl

lrri rilr

rlli lirl

R R^

irrl rlir

lril illr

llrf rfll

lfrr rrlf

frrr rrfr

rrrb rbrr

lllb lbll

flll llfl

R R^

brll llbr

rrbl blrr

bbff ffbb

efbs bsef

ifbi biif

sfsi sisf

bfii iibf

beie iebe

R R^

bbbb fefe bbbb fefe

fifi fifi

ebis iseb

fbii iifb

fsei eifs

ibib ibib

sbsb sbsb

R R^

ffff ffff

Table 1: The converse (^) operation of DRAf can be reduced to a simple permutation. adding the simple rule that ’+’ and ’−’ are exchanged, while ’P’ and ’A’ remain invariant. Since base relations generally are not closed under composition, this operation is approximated by a weak composition: [ b1  b2 = {b ∈ B | (b1 ◦ b2 ) ∩ b 6= ∅} where b1 ◦ b2 is given by the usual set theoretic composition R ◦ S = {(x, z)|∃y . (x, y) ∈ R, (y, z) ∈ S} Computing composition tables is non-trivial and will be the subject of Section 3. Generally, b1  b2 over-approximates the set-theoretic composition (i.e., b1  b2 ) b1 ◦ b2 ), while composition is said to be strong if approximation is exact, i.e., b1  b2 = b1 ◦ b2 . Strong composition has attracted some interest under the name extensional composition [2, 26]. Note that neither DRAlr nor DRAc provide a jointly exhaustive set of base relations over the Euclidean plane. This leads to the lack of an identity relation in the case of DRAlr , and more severely, for both DRAlr and DRAc , weak composition does not lead to an over-approximation (nor to an underapproximation)14 of set-theoretic composition, because, e.g., ffbb is missing from 14 Recall that generally, weak composition over-approximates composition, and exactly captures it in the case of strong composition.

14

the composition of llll with itself. This also means that we do not obtain a nonassociative algebra for these calculi. By contrast, DRAf and DRAfp provide jointly exhaustive and pairwise disjoint sets of base relations, and lead to nonassociative algebras. Let us now apply the relation-algebraic method to constraint reasoning. Given a qualitative calculus with set of base relations B, a constraint network is a map ν : N × N → P(B), where N is a set of nodes (or variables) [29]. Individual constraints ν(X, Y ) = R are written X R Y , where X, and Y are variables in N and R is a relation in P(B). A constraint network ν : N × N → P(B) is atomic or a scenario if each ν(X, Y ) is a base relation. Given a constraint network ν, an important reasoning problem is to decide whether ν is consistent, i.e., whether there is an assignment of all variables of ν with dipoles such that all constraints are satisfied (a solution). We call this problem DSAT. DSAT is a constraint satisfaction problem (CSP) [31]. We rely on relation-algebraic methods to check consistency, namely the above mentioned path consistency algorithm. For non-associative algebras, the abstract composition of relations need not coincide with the (associative) set-theoretic composition. Hence, in this case, the standard path-consistency algorithm does not necessarily lead to path consistent networks, but only to algebraic closure, which is defined as follows [47]: Definition 2 (Algebraic Closure). A constraint network over binary relations is called algebraically closed if for all variables X1 , X2 , X3 and all relations R1 , R2 , R3 the constraint relations X1 R1 X2 ,

X2 R2 X3 ,

X1 R3 X3

imply R3 ≤ R1  R2 . Algebraic closure can be enforced by iterating R3 := R3 ∩ (R1  R2 ) for X1 R1 X2 , X2 R2 X3 , X1 R3 X3 until a fixed point is reached. Note that this procedure leaves the set of solutions of the constraint network invariant. This means that if the algebraic closure contains the empty relation, the original network is inconsistent. However, in general, algebraic closure is only a one-sided approximation of consistency: if algebraic closure detects an inconsistency, then we are sure that the constraint network is inconsistent; however, algebraic closure may fail to detect some inconsistencies: an algebraically closed network is not necessarily consistent. For some calculi, like Allen’s interval algebra, algebraic closure is known to exactly decide the consistency of scenarios, but for others it does not, see [47], where it is also shown that this question is completely orthogonal to the question of whether the composition is strong. We will examine these questions for the dipole calculi in Section 2.7 and Section 3.4 ff. below.

15

Figure 8: A street network and two local observations

2.5. A Sample Application of Algebraic Closure Reasoning With the Dipole Calculus In this subsection, we want to demonstrate with an example why the dipole calculus is a useful qualitative model for directional information. Moreover, the example shows that composition-based reasoning is useful although it is incomplete. Our example uses the spatial knowledge expressed in DRAfp for deductive reasoning based on constraint propagation (algebraic closure), resulting in the generation of useful indirect knowledge from partial observations in a spatial scenario. This is a direct application of the composition table which we generated based on our new condensed semantics for the dipole calculi (see Section 3). In our sample application, a spatial agent (a simulated robot, cognitive simulation of a biological system, etc.) explores a spatial scenario. The agent collects local observations and wants to generate survey knowledge. Figure 8 shows our spatial environment. It consists of a street network in which some streets continue straight after a crossing and some streets run parallel. These features are typical of real-world street networks. Spatial reasoning in our example uses constraint propagation (e.g., algebraic closure computation) to derive indirect constraints between the relative location of streets which are further apart than are the local observations between neighboring streets. The resulting survey knowledge can be used for several tasks including navigation tasks. The environment is represented by streets si and crossings Cj . The streets and crossings have unique names (e.g., s1 , ... , s12 , and C1 , ..., C9 in the concrete example). The local observations are modeled in the following way, based on specific visibility rules (we want to simulate the prototypical features of visual perception): Both at each crossing and at each straight street segment we have an observation. At each crossing the agent observes the neighboring crossings.

16

At the middle of each straight street segment the agent can observe the direction of the outgoing streets at the adjacent crossings (but not at their other ends). Two specific examples of observations are marked in Figure 8. The observation “s1 errs s7” is marked green at crossing C1. The observation “s8 rrllP s9” is marked red at street s4. These observations relate spatially neighboring streets to each other in a pairwise manner, using DRAfp base relations. The agent has no additional knowledge about the specific environment. The spatial world knowledge of the agent is expressed in the converse and composition tables of DRAfp . The following sequence of partial observations could be the result of a tour made by the spatial agent exploring the street network of our example (see Figure 8):

Figure 9: All observation and resulting uncertainty marked with different colors

Observations at crossings C1: (s7 errs s1) C2: (s1 efbs s2) (s8 errs s2) (s1 rele s8) C3: (s2 rele s9) C4: (s10 efbs s7) (s10 errs s3) (s7 srsl s3) C5: (s3 efbs s4) (s11 efbs s8) (s11 errs s4) (s3 ells s8) (s3 rele s11) (s8 srsl s4) C6: (s12 efbs s9) (s4 ells s9) (s4 rele s12) C7: (s10 srsl s5) C8: (s5 efbs s6) (s5 ells s11) (s11 srsl s6) C9: (s6 ells s12)

17

Observations at streets s1: (s7 rrllP s8) s2: (s8 rrllP s9) s3: (s10 rrllP s11) s4: (s11 rrllP s12) s8: (s3 llrr- s1) s9: (s4 llrr- s2) s10:(s3 rrll- s5) s11:(s4 rrll- s6)

The result of the algebraic closure computation/constraint propagation is a refined network with the same solution set (the results are computed with the publicly available SparQ reasoning tool supplied with our newly computed DRAfp composition table [58]). We have listed the results in the next Section 2.6. Three different models are the only remaining consistent interpretations (see the Section 2.6 for a list of all the resulting data). The three different models agree on all but four relations. The solution set can be explained with the help of the diagram in Figure 9. The input crossing observations are marked with green arrows, the input street observations are marked with red arrows. The result shows that for all street pairs which could not be observed directly, the algebraic closure algorithm deduces a strong constraint, i.e., precise information: typically, the resulting spatial relation between street pairs comprises just one DRAfp base relation. The exception consists of four relations between streets in which the three models differ (marked with dashed blue arrows in Figure 9). For these four relations, each model from the solution set agrees on the same DRAf base relation for a given pair of dipoles, but the three consistent models differ on the finer granularity level of DRAfp base relations. Since the refinement of one of these four underspecified relations into a single interpretation (DRAfp base relation) as a logical consequence also assigns a single base relation to the other three relations, only three interpretations are valid models. The uncertainty/indeterminacy is the result of the specific street configuration in our example. The streets in a North–South direction are parallel, but the streets in an East–West direction are not parallel, resulting in fewer constraint composition results. However, the small solution set of consistent models agrees on most of the relative position relations between street pairs and the differences between the models are small. In our judgement, this means that the system has generated the relevant survey knowledge about the whole street network from local observations alone. 2.6. Computation for the street network application with the SparQ tool In this section, we demonstrate how to use the publicly available SparQ QSR toolbox [58] to compute the algebraic closure by constraint propagation for the street network example from the previous Section 2.5. For successful relative position reasoning, the SparQ tool has to be supplied with our newly computed DRAfp composition table which we generated based on our new condensed semantics for the dipole calculi (see Section 3). 18

The local street configuration observations by the spatial agent are listed in Section 2.5. The direct translation of these logical propositions into a SparQ spatial reasoning command looks as follows15 : sparq constraint-reasoning dra-fp path-consistency "( (s7 errs s1) (s1 efbs s2) (s8 errs s2) (s1 rele s8) (s2 rele s9) (s10 efbs s7) (s10 errs s3) (s7 srsl s3) (s3 efbs s4) (s11 efbs s8) (s11 errs s4) (s3 ells s8) (s3 rele s11) (s8 srsl s4) (s12 efbs s9) (s4 ells s9) (s4 rele s12) (s10 srsl s5) (s5 efbs s6) (s5 ells s11) (s11 srsl s6) (s6 ells s12) (s7 rrllP s8) (s8 rrllP s9) (s10 rrllP s11) (s11 rrllP s12) (s3 llrr- s1) (s4 llrr- s2) (s3 rrlls5) (s4 rrll- s6) )" 16

The result of this reasoning command is a refined network with the same solution set derived by the application of the algebraic closure/constraint propagation algorithm (see Section 2.4). SparQ omits the converses for a more compact presentation. Modified network. ((S5 (EFBS) S6)(S12 (LSEL) S6)(S12 (LLFL) S5)(S11 (SRSL) S6)(S11 (LSEL) S5)(S11 (RRLLP) S12) (S4 (RRLL-) S6)(S4 (RRLL-) S5)(S4 (RELE) S12)(S4 (RSER) S11)(S3 (RRLL-) S6)(S3 (RRLL-) S5) (S3 (RFLL) S12)(S3 (RELE) S11)(S3 (EFBS) S4)(S10 (RRBL) S6)(S10 (SRSL) S5)(S10 (RRLLP) S12) (S10 (RRLLP) S11)(S10 (RRRB) S4)(S10 (ERRS) S3)(S9 (LBLL) S6)(S9 (LLLL-) S5)(S9 (BSEF) S12) (S9 (LLRRP) S11)(S9 (LSEL) S4)(S9 (LLFL) S3)(S9 (LLRRP) S10)(S8 (BRLL) S6)(S8 (LBLL) S5) (S8 (RRLLP) S12)(S8 (BSEF) S11)(S8 (SRSL) S4)(S8 (LSEL) S3)(S8 (LLRRP) S10)(S8 (RRLLP) S9) (S2 (RRLL+ RRLL- RRLLP) S6)(S2 (RRLL+ RRLL- RRLLP) S5)(S2 (RRLF) S12)(S2 (RRFR) S11)(S2 (RRLL+) S4) (S2 (RRLL+) S3)(S2 (RRRR+) S10)(S2 (RELE) S9)(S2 (RSER) S8)(S1 (RRLL+ RRLL- RRLLP) S6) (S1 (RRLL+ RRLL- RRLLP) S5)(S1 (RRLL+) S12)(S1 (RRLF) S11)(S1 (RRLL+) S4)(S1 (RRLL+) S3) (S1 (RRFR) S10)(S1 (RFLL) S9)(S1 (RELE) S8)(S1 (EFBS) S2)(S7 (RRLL-) S6)(S7 (BRLL) S5) (S7 (RRLLP) S12)(S7 (RRLLP) S11)(S7 (RRBL) S4)(S7 (SRSL) S3)(S7 (BSEF) S10)(S7 (RRLLP) S9) (S7 (RRLLP) S8)(S7 (RRRB) S2)(S7 (ERRS) S1)) SparQ can output all path-consistent scenarios (i.e., constraint networks in base relations). For this constraint network, only three slightly different path consistent scenarios exist. They differ only in the following three relation 15 For

technical details of SparQ we refer the reader to the SparQ manual [58]. does not accept line breaks which we have inserted here for better readability. All the data for this sample application including the new composition table can be obtained from the URL http://www.informatik.uni-bremen.de/~till/Oslsa.tar.gz (which also provides the composition table and other data for the GQR reasoning tool https://sfbtr8.informatik.uni-freiburg.de/R4LogoSpace/Resources/). 16 SparQ

19

subsets: 1. (S2 (RRLLP) S6)(S2 (RRLLP) S5) (S1 (RRLLP) S6)(S1 (RRLLP) S5) 2. (S2 (RRLL-) S6)(S2 (RRLL-) S5) (S1 (RRLL-) S6)(S1 (RRLL-) S5) 3. (S2 (RRLL+) S6)(S2 (RRLL+) S5) (S1 (RRLL+) S6)(S1 (RRLL+) S5) All the other relations were already assigned a single base relation in the refined network which is shown above as a result of the application of the algebraic closure algorithm. This result can be visualized with a diagram and can be interpreted in terms of the goals of the reasoning task (see Section 2.5). 2.7. Limits of Algebraic Closure We now consider the question of whether algebraic closure decides consistency. This has been open for DRAf . Recall from Section 2.4 that the set of constraints between all dipoles at hand is called a constraint network. If no constraint between two dipoles is given, we agree that they are in the universal relation. Further recall that by a scenario, we denote a constraint network in which all constraints are base relations17 . With the help of the embedding of the interval algebra into DRAf (see Proposition 1), we can show that algebraic closure decides the consistency of DRAf scenarios that only involve images of relations of the interval algebra. Moreover, for calculi such as RCC8 [46], the interval algebra [41], etc., (maximal) tractable subsets (see [50]) have been determined, i.e., sets of relations for which algebraic closure decides the consistency also of non-atomic constraint networks involving these relations. We then also obtain that algebraic closure in DRAf decides the consistency of any constraint network involving (the image of) a maximal tractable subset of the interval algebra only. Similar remarks apply to DRAfp . However, the situation changes if we move to the full calculus. The scenario consistency problem for the DRAf calculus is already NP-hard, see [62], and hence algebraic closure (which is polynomial) does not decide scenario consistency in this case (assuming P 6= N P ). This means that there are essentially no tractable subsets. To illustrate the failure of algebraic closure to decide consistency, we now construct constraint networks which are geometrically unrealizable but still algebraically closed. This also gives some insight into the calculi: note that for the LR calculus, such counterexamples can be extremly simple [30], which is not the case here. We obtain such a counterexample by constructing constraint networks that are consistent and algebraically closed, and then we will change a relation in such a way that they remain algebraically closed but become inconsistent. We follow the approach of [52] in using a simple geometric shape for 17 In

this case, a base relation between every pair of distinct dipoles has to be provided.

20

which scenarios exist, where algebraic closure fails to decide consistency. In our case, the basic shape is a convex hexagon (see Figure 10). First we will show that algebraic closure does not decide consistency for DRAf . Consider a convex hexagon consisting of the dipoles A, B, C, D, E and F . Such an object is described as (A errs B)(B errs C)(C errs D)(D errs E)(E errs F )(F errs A)(F rrrr C) (A rrrr D)(B rrrr E)(A rrrr C)(F rrrr D)(B rrrr D)(A rrrr E)(C rrrr E) (B rrrr F ) where the relations rrrr make sure that none of the dipoles intersect and together with the components r of the relations errs ensure convexity, since they enforce an angle between 0 and π between the respective first and second dipole, i.e., the endpoint of consecutive dipoles always lies to the right of the preceding dipole. Such an object is given in Figure 10. Any object inside the hexagon lies

Figure 10: Convex hexagon

to the right of all the dipoles, otherwise it is on the border or outside. To this scenario we add dipoles G and H inside the hexagon (F rrrl H)(C rrlr G)(H efbs G) that are collinear and such that the endpoint of H is the startpoint of G. This gives us the constraint network (A errs B)(B errs C)(C errs D)(D errs E)(E errs F )(F errs A)(F rrrr C) (A rrrr D)(B rrrr E)(A rrrr C)(F rrrr D)(B rrrr D)(A rrrr E)(C rrrr E) (B rrrr F )(F rrrl H)(C rrlr G)(H efbs G) We construct an inconsistency by postulating that H (i.e., its start- and endpoint) lies to the left of E, meaning that it lies outside the hexagon by introducing the constraint (EllrrH). By applying algebraic closure, we get a

21

refinement of our network that does not contain the empty set: (H efbs G)(F rrrl G)(F rrrl H)(E llrr G)(E llrr H)(E errs F ) (D( llrr rrrr )G)(D( llrr rrrr )H)(D rrrr F )(D errs E)(C rrlr G) (C rrlr H)(C rrrr F )(C rrrr E)(C errs D)(B( llll rrll )G) (B( llll rrll )H)(B rrrr F )(B rrrr E)(B rrrr D)(B errs C) (A( llll rrll )G)(A( llll rrll )H)(A rser F )(A rrrr E) (A rrrr D)(A rrrr C)(A errs B) But H has to lie to the left of E, meaning outside the convex hexagon and inside of it at the same time. This is impossible in the Euclidean plane. In fact, we can construct similar inconsistencies for several dipoles, just check the above constraint network for the relation llrr. Unfortunately algebraic closure with DRAf does not decide consistency. The constraint network can be extended to a DRAfp constraint network in a straightforward manner by replacing rrrr by {rrrr+, rrrr−, rrrrA} and llrr by {llrr+, llrr−, llrrP }. Algebraic closure with DRAfp then detects the inconsistency in the network. We drop the constraint (E( llrr+ , llrr- , llrrP)H) and observe that the relation between E and H is refined to (E( rrrr+ rrrr- rrrrA )H). This constraint has no component that demands H’s being outside of the hexagon, as in the DRAf case. We have found an example that shows that algebraic closure for DRAfp finds inconsistencies in constraint networks where it fails for DRAf . This leads to the question: Does algebraic closure decide consistency for DRAfp ? We can give a negative answer also to this question. To construct a counterexample, we begin with a point configuration with nine points A, B, . . ., I as in Figure 11. This configuration corresponds to a Pappus configuration [5]. A Pappus configuration has nine points and nine straight lines. Eight collinearities of point triples: GHI, ABC, ADH, AEI, BDG, BF I, CEG, CF H enforce the collinearity of the ninth point triple DEF (by Pappus’ Hexagon Theorem [5]). We can reconstruct this arrangement with dipoles and add an inconsistency with Pappus’ Hexagon Theorem which is not detected with the algebraic closure for DRAfp . The configuration from Figure 11 can be described as a constraint network in the following way: (GH efbs HI)(AB efbs BC) (AD efbs DH)(AE efbs EI) (BD efbs DG) (BF efbs F I) (CE efbs EG) (CF efbs F H) (DG errs GH)(DG rele EG) (F I lere HI) (F I lere EI) (AD srsl AE) (AD srsl AB) (CF lsel BC) (CF slsr CE) (GH rele DH)(GH rele F H) (AB ells BF ) (AB ells BD) (AD ells DG) (AD rele BD) (CF errs F I) (CF lere BF ) (AE rele CE) a dipole XY in this description is the dipole from point X to point Y . We observe that by Pappus’ Hexagon Theorem the points D, E and F are collinear. We now add a constraint (AE (lrrr lrrl) DF ) 22

Figure 11: Construction of the counterexample as a Pappus configuration.

that states that the carrier lines of AE and DF intersect between A and E or in front of AE, but not in E. But since D, E and F are collinear, the only possible intersection point is E, a contradiction. Any scenario based on this constraint network cannot be consistent. But applying algebraic closure with

23

DRAfp yields a refinement and dozens of possible scenarios, e.g., (F H rser DF ) (CF rele DF ) (CF efbs F H) (EG rrrr+ DF ) (EG rrll- F H) (EG brll CF ) (CE rrlr DF ) (CE rrbl F H) (CE srsl CF ) (CE efbs EG) (F I rser DF ) (F I slsr F H) (F I rser CF ) (F I llrr+ EG) (F I rlrr CE) (BF rele DF ) (BF ells F H) (BF rele CF ) (BF lllr EG) (BF rllr CE) (BF efbs F I) (DG rrrr+ DF )(DG rrllP F H) (DG rrllP CF ) (DG rele EG) (DG rrlf CE) (DG rrll- F I) (DG brll BF ) (BD rrlr DF ) (BD rrllP F H) (BD rrllP CF ) (BD rfll EG) (BD rrll+ CE)(BD rrbl F I) (BD srsl BF ) (BD efbs DG) (EI lrrr DF ) (EI rllr F H) (EI rrlr CF ) (EI slsr EG) (EI rser CE) (EI rele F I) (EI rrlf BF ) (EI llrr+ DG) (EI rlrr BD) (AE lrrr DF ) (AE rlll F H) (AE rrll+ CF ) (AE ells EG) (AE rele CE) (AE rfll F I) (AE rrll+ BF ) (AE lllr DG) (AE rllr BD) (AE efbs EI) (DH rrrrA DF ) (DH rele F H) (DH rrlf CF ) (DH rll EG) (DH rrlr CE) (DH rrll+ F I) (DH rrll+ BF ) (DH slsr DG) (DH rser BD) (DH rrll- EI) (DH brll AE) (AD rrrrA DF )(AD rfll F H) (AD rrll+ CF )(AD rlll EG) (AD rrll+ CE) (AD rrll+ F I) (AD rrll+ BF )(AD ells DG) (AD rele BD) (AD rrbl EI) (AD srsl AE) (AD efbs DH) (BC llll- DF ) (BC lllb F H) (BC ells CF ) (BC lllb EG) (BC ells CE) (BC llbr F I) (BC slsr BF ) (BC llbr DG) (BC slsr BD) (BC llrr+ EI) (BC blrr AE) (BC llrr+ DH) (BC blrr AD) (AB llrl DF ) (AB llll+ F H) (AB flll CF ) (AB llll+ EG) (AB flll CE) (AB lllb F I) (AB ells BF ) (AB lllb DG) (AB ells BD) (AB llbr EI) (AB slsr AE) (AB llbr DH) (AB slsr AD) (AB efbs BC) (HI lrrr DF ) (HI rser F H) (HI rrfr CF ) (HI rbrr EG) (HI rrrr+ CE) (HI rele F I) (HI rrlf BF ) (HI rbrr DG) (HI rrrr+ BD) (HI rele EI) (HI rrlf AE) (HI rser DH) (HI rrfr AD) (HI rrllP BC) (HI rrllP AB) (GH lrrr DF ) (GH rele F H) (GH rrlf CF ) (GH rser EG) (GH rrfr CE) (GH rfll F I) (GH rrll+ BF ) (GH rser DG) (GH rrfr BD) (GH rfll EI) (GH rrll+ AE) (GH rele DH) (GH rrlf AD) (GH rrllP BC) (GH rrllP AB) (GH efbs HI) For DRAfp also, algebraic closure does not decide consistency even for scenarios. This counterexample can also be used for DRAf , but the above is simpler and shows differences in the reasoning effectiveness of algebraic closure for DRAfp and DRAf . 3. A Condensed Semantics for the Dipole Calculus Since the domains of most spatial calculi are infinite (e.g., the Euclidean plane), it is impossible just to enumerate all possible configurations relative to 24

the composition operation when deriving a composition table18 . Hence, the question remains how a composition table can be computed in an effective and automatic way. To start, we tried generating the composition table of DRAf directly, using the resulting quadratic inequalities as described in [36] and derived exhaustively on page 11. However, it turned out that it is infeasible to base the reasoning on these inequalities, even with the aid of interactive theorem provers such as Isabelle/HOL [43] and HOL-light [20] (the latter is dedicated to proving facts about real numbers) and Gröbner base reasoners19 . This infeasibility is probably related to the above-mentioned NP-hardness of the consistency problem for dipole base relations. Therefore, we developed a qualitative abstraction instead which we call condensed semantics. It provides a level of abstraction from the metrics of the underlying space. We observe the Euclidean plane with respect to all possible line configurations that are distinguishable within the DRA calculi. From a more formal point of view, a key insight is that two configurations are qualitatively different if they cannot be transformed into each other by maps that keep that part of the spatial structure invariant that is essential for the calculus. In our case, these maps are the (orientation preserving) affine bijections. A set of configurations that can be transformed into each other by appropriate maps is an orbit of a suitable automorphism group. Here, we use primarily the affine group GA(R2 ) and show in detail how this leads to qualitatively different spatial configurations. The results of this analysis can be mapped onto an efficient method for computing the composition tables for DRAf and DRAfp . 3.1. Seven qualitatively different configurations For the binary composition operation of DRA calculi, we have to consider all qualitatively different configurations of three lines. In order to formalize “qualitatively different configurations,” we regard the DRA calculus as a firstorder structure, with the Euclidean plane as its domain, together with all the 18 It can be shown that the exhaustive inspection of a finite number of configurations in a finite grid would suffice to compute the composition table of the dipole calculi. The size of the grid needs to be double-exponential in the number of points [17], and therefore the number of grids to consider is triple-exponential. This is practically infeasible: even for three points, 23

already 22 ≈ 1077 grids would need to be inspected. 19 For the computation of the DRA composition table reported in [36], Gröbner base reac soning needed to be complemented by a grid method. In general, the research history of QSR about dipoles shows that it is necessary to use methods that yield more reliable results. The dipole composition on which we focus in this section involves configurations of three dipoles. However, even the much simpler question about a complete list of distinguishable dipole base relations characterized by certain properties (e.g., dipole to point relations) is not trivial. This question can be answered by configurations of just two dipoles and how to list them exhaustively. Deriving manually the 72 base relations of DRAf , or the 80 base relations of DRAfp , is an error-prone procedure. For this reason, the manually derived sets of base relations for the finer-grained dipole calculi described in [36, 53], as well as the composition tables, contained errors.

25

base relations. Let us start with having a look at the automorphism groups for DRAf and DRAfp . Definition 3. An affine map f from the Euclidean plane to itself is given by a 2 × 2 transformation matrix A and a translation vector (bx , by ) such that   x + (bx , by ) f (x, y) = A y f is a bijection iff det(A) is non-zero, and f is orientation preserving iff det(A) is positive. Proposition 4. All orientation preserving affine bijections are DRAf and DRAfp automorphisms. (In [39], the converse is also shown.) Proof. It suffices to show that orientation preserving affine bijections preserve the LR relations. Now, any orientation preserving affine bijection is a product of translations, rotations, scalings and shears. It is straightforward to see that these mappings preserve the LR relations. Automorphisms and their compositions form a group which acts on the set of points (and tuples of points, lines, etc.) by function application. Recall that if a group G acts on a set, an orbit consists of the set reachable from a fixed element by performing the action of all group elements: G x = {f (x)|f ∈ G}. The importance of this notion is the following: Two configurations which are qualitatively different belong to disjoint orbits of the automorphism group. Note that while this is related to the theory of line arrangements [19], we here work in a slightly different setting. First, the theory of line arrangements uses a weaker notion of isomorphism than we do. Second, work about line arrangements mostly uses the projective plane where there are only two configurations of three lines, instead of the Euclidean plane where parallelism is possible. Here we are only interested in the Euclidean plane and have to distinguish the cases where two or more lines are parallel or even identical. The reason is that, e.g., DRAfp distinguishes between A llrrP B (A and B point into the same direction and have distinct parallel carrier lines) and A and B being in some Allen relation (A and B point into the same direction and have the same carrier line). Third, we also consider triples of lines (later on), not just sets of three lines. Further note that Cristani’s 2DSLA calculus [6], which can be used to reason about sets of lines, is too coarse for our purposes: our orbits (1) and (2) introduced below cannot be distinguished in 2DSLA. We start with configurations consisting of from one up to three lines in the Euclidean plane, i.e., we consider the orbits of all sets {l1 , l2 , l3 } where l1 , l2 and l3 are not necessarily distinct. We consider two such configurations to be 26

isomorphic if they can be mapped into each other by an affine bijection. That is, we work with orbits in the group of all affine bijections (and not just the orientation preserving ones—orientations will come in at a later stage). This group is usually called the affine group of R2 and denoted by GA(R2 ). A line in the Euclidean plane is given by the set of all points (x, y) for which y = mx + b. Given three lines y = mi x + bi (i = 1, 2, 3), we list their orbits by giving a defining property. In each case, it is fairly obvious that the defining property is preserved by affine bijections. Moreover, in each case, we show a transformation property, namely that given two instances of the defining properties, the first instance can be transformed into the second by an affine bijection. Together, this means that the defining property exactly specifies an orbit. The transformation property often follows from the following basic facts about affine bijections, see [14]: 1. An affine frame [14] is for an affine space what a basis is for a vector space; in particular, any point of an affine space is a unique affine combination of points from the frame. An affine frame for an n-dimensional affine space consists of n + 1 points; in particular, an affine frame for the Euclidean plane is a point triple in general position. The importance of this notion in the present context is the following: An affine bijection is uniquely determined by its action on an affine frame, the result of which is given by another affine frame. Hence, given any two point triples in the Euclidean plane in general position, there is a unique affine bijection mapping the first point triple to the second. 2. Affine maps transform lines into lines. 3. Affine maps preserve parallelism of lines. That is, it suffices to show that an instance of the defining property is determined by three points in general position and drawing lines and parallel lines. We will consider the intersection of line i with line j (i 6= j ∈ {1, 2, 3}). This is given by the system of equations {y = mi x + bi , y = mj x + bj }. This does not cover the case of the line x = 0; however, without loss of generality, we can assume that this case does not occur: we always can apply an appropriate affine bijection mapping the three lines away from the line x = 0. For mi 6= mj , the above system of equations has a unique solution: x=−

mi bj − mj bi bi − bj , y= . mi − mj mi − mj

For mi = mj , there is either is no solution (bi 6= bj ; the lines are parallel), or there are infinitely many solutions (bi = bj ; the lines are identical). We can now distinguish seven cases: 1. All mi are distinct and the three systems of equations {y = mi x + bi , y = mj x + bj } (i 6= j ∈ {1, 2, 3}) yield three different solutions. Geometrically, 27

this means that all three lines intersect with three different intersection points. The transformation property follows from the fact that the three intersection points determine the configuration. In the theory of line arrangements, this is called a simple arrangement [19].

2. All mi are distinct and at least two of the three systems of equations {y = mi x+bi , y = mj x+bj } (i 6= j ∈ {1, 2, 3}) have a common solution. Then, obviously, the single solution is common to all three equation systems. Geometrically, this means that all three lines intersect at the same point. In the theory of line arrangements, this is called a trivial arrangement [19].

Take this point and a second point on one of the lines. By drawing parallels through this second point, we obtain two more points, one on each of the other two lines, such that the four points form a parallelogram. The transformation property now follows from the fact that any two nondegenerate parallelograms can be transformed into each other by an affine bijection.

28

3. mi = mj 6= mk and bi 6= bj for distinct i, j, k ∈ {1, 2, 3}. Geometrically, this means that two lines are parallel but not coincident, and the third line intersects them. Such a configuration is determined by three points: the points of intersection, plus a further point on one of the parallel lines. Hence, the transformation property follows.

4. mi = mj 6= mk and bi = bj for distinct i, j, k ∈ {1, 2, 3}. Geometrically, this means that two lines are equal and the third one intersects them. Again, such a configuration is determined by three points: the intersection point plus a further point on each of the (two) different lines. Hence, the transformation property follows.

5. All mi are equal, but the bi are distinct. Geometrically, this means that all three lines are parallel, but not coincident. We cannot show the transformation property here, which means that this case comprises several orbits. Actually, we get one orbit for each distance ratio b1 − b2 . b1 − b3 An affine bijection f (x, y) = A

  x + (bx , by ) y

transforms a line y = mx + b to y = m0 x + b0 , with b0 = c1 (m)b + c2 (m), where c1 and c2 depend nonlinearly on m. However, since m = m1 = m2 = m3 , this nonlinearity does not matter. This means that b01 − b02 c1 (m)b1 − c1 (m)b2 b1 − b2 = = , b01 − b03 c1 (m)b1 − c1 (m)b3 b1 − b3 29

i.e., the distance ratio is invariant under affine bijections (which is wellknown in affine geometry). Given a fixed distance ratio, we can show the transformation property: three points suffice to determine two parallel lines, and the position of the third parallel line is then determined by the distance ratio. For a distance ratio 1, this configuration looks as follows:

Actually, for the qualitative relations between dipoles placed on parallel lines, their distance ratio does not matter. Hence, we will ignore distance ratios when computing the composition table below, and the fact that we get infinitely many orbits does not matter. 6. All mi are equal and two of the bi are equal but different from the third. Geometrically, this means that two lines are coincident, and the third one is parallel but not coincident. Such a configuration is determined by three points: two points on the coincident lines and a third point on the third line. Hence, the transformation property follows.

7. All mi are equal, and the bi are equal as well. This means that all three lines are equal. The transformation property is obvious.

Since we have exhaustively distinguished the various possible cases based on relations between the mi and bi parameters, this describes all possible orbits of three lines under the action of the group of affine bijections. Although we get infinitely many orbits for case (5), in contexts where the distance ratio introduced in case (5) does not matter, we will speak of seven qualitatively different configurations, and it is understood that the infinitely many orbits for case (5) are conceptually combined into one equivalence class of configurations. Recall that we have considered sets of (up to) three lines. If we consider triples of lines instead, cases (3) to (6) split up into three sub-cases, because they feature distinguishable lines. We then get 15 different configurations, which we name 1, 2, 3a, 3b, 3c, 4a, 4b, 4c, 5a, 5b, 5c, 6a, 6b, 6c and 7. While 5a, 5b and 5c correspond to case (5) above and therefore comprise infinitely many orbits, the remaining configurations comprise a single orbit.

30

Figure 12: The 17 qualitatively different configurations of triples of oriented lines w.r.t. orientation preserving affine bijections

The next split appears at the point when we consider qualitatively different configurations of triples of unoriented lines with  respect to orientation preserving affine bijections. An affine map f (x, y) = A xy +(bx , by ) is orientation preserving if det(A) is positive. In the above arguments, we now have to consider oriented affine frames. Let us call an affine frame (p1 , p2 , p3 ) positively (+) oriented, if the angle ∠p1 p2 p3 is positive, otherwise, it is negatively (−) oriented. Two given affine frames with the same orientation determine a unique orientation 31

preserving affine bijection transforming the first one into the second. Thus, the orientation of the affine frame matters, and hence cases 1 and 2 above are split into two sub-cases each. For all the other cases, we have the freedom to choose the affine frames so that their orientations coincide. In the end, we get 17 different orbits of triples of oriented lines: 1+, 1-, 2+, 2-, 3a, 3b, 3c, 4a, 4b, 4c, 5a, 5b, 5c, 6a, 6b, 6c and 7. They are shown in Figure 12 The structure of the orbits already gives us some insight into the nature of the dipole calculus. The fact that sub-case (1) corresponds to one orbit means that neither angles nor ratios of angles can be measured in the dipole calculus. By way of contrast, the presence of infinitely many orbits in sub-case (5) means that ratios of distances in a specific direction (not distances themselves) can be measured in the dipole calculus. Indeed, in DRAfp , it is even possible to replicate a given distance arbitrarily many times, as indicated in Figure 13. That is, DRAfp can be used to generate a one-dimensional coordinate system. Note however that, due to the lack of well-defined angles, a two-dimensional coordinate system cannot be constructed. The ability to “count” in the DRAfp calculus stems from the existence of relations able to capture the feature of parallelism. Consider a sequence of parallelograms described in DRAfp as (Ai ells Bi ) (Ai llrrP Ci ) (Bi lere Ci ) (Bi llrrP Di ) (Ci rser Di ) (Ci srsl Ei ) (Di errs Ei ).

(Ai slsr Di ) (Bi lsel Ei )

(Ai lere Ei )

Such a sequence is depicted in Figure 13. The counting can be established by replicating such parallelograms by adding relations (Bi sese Di+1 ) which claim that Bi and Di+1 of two consecutive parallelograms coincide. Such parallelograms can be constructed with all relations describing parallelism. The construction for anti-parallelism is a little more involved, in this case sequences of two parallelograms will be replicated.

Figure 13: Example for replication of a given distance in DRAfp

32

3.2. Computing the composition table with condensed semantics The purpose of condensed semantics is to provide a way of computing composition tables in a finite way. Therefore, we need to reduce the infinite space of possible dipole configurations to a finite one. For each of the 17 oriented orbits in Figure 12 we introduce a canonical configuration in the Euclidean plane (depicted in Figure 14), i.e., a configuration with a suitable number of positions for the start and end points of the dipoles on each line that suffice to compute the composition table. The number of points needed is a function of the unoriented orbits, we call these points (that are displayed in Figure 14) prototypical points. We call a configuration from Figure 14 with three assigned dipoles a prototypical configuration. The computation of the composition table needs the orientation in order to be exhaustive. Algorithm 1 Composition Table Computation of composition table for DRA 1: Conf := the set of prototypical configurations from Figure 14 2: R := ∅ 3: for all configurations c ∈ Conf do 4: for all dipoles dA = (sA , eA ) of different prototypical points on A in c do 5: for all dipoles dB = (sB , eB ) of different prototypical points on B in c do 6: for all dipoles dC = (sC , eC ) of different prototypical points on C in c do 7: compute the relations dA R1 dB , dB R2 dC , dA R3 dC by the formula

on page 12 and add the triple (R1 , R2 , R3 ) to R. 8: end for 9: end for 10: end for 11: end for 12: collect the triples in R in such a way that there is exactly one entry for every R1

and R2 having the union of all R3 as third component

The algorithm for computing the composition table is given in Algorithm 1. We place the configurations of Figure 14 into an arbitrary orthogonal coordinate system. Each configuration provides a finite number of prototypical points with specific coordinates, which serve as start and end points of prototypical dipoles. For each triple of such prototypical dipoles we compute the DRA-relations using the atan2-method as described in Section 2.3. Each triple that is obtained in this way corresponds to an entry in the composition table. A program has been implemented in Java that uses Algorithm 1 and on a notebook with an Intel Core 2 T7200 with 1.5 Gbyte of RAM, the computation of the composition tables for DRAf and DRAfp takes approximately 14 seconds. 3.3. Soundness and completeness of composition By the soundness of Algorithm 1 we mean that the computed composition table contains enough entries to make it over-approximate geometric reality (i.e., no false conclusions can be drawn by qualitative reasoning). Conversely, completeness means that there are not more entries than necessary, that is, the 33

Figure 14: The 17 canonical configurations. composition table does not lead to overly weak conclusions. (However note that even in case of completeness it still can be the case that algebraic closure leads to overly weak conclusions, e.g., inconsistencies are not detected, see Section 2.7). More specifically, completenes means that Algorithm 1 outputs only triples of dipole relations that are geometrically realizable, while soundness means that

34

it outputs all such triples.20 Soundness and completeness together imply that prototypical dipole triples are representative for all dipole triples, at least for what concerns dipole relations. Proposition 5. Algorithm 1 is complete. Proof. Easy, since the triples of dipole relations are generated from prototypical dipole triples, which provide geometric realizations. Showing the soundness of Algorithm 1 is more involved. We need to identify a lower bound of points that is needed on our oriented orbits in Figure 12 with respect to the DRA semantics. We can identify those lower bounds for intersecting and collinear lines separately. In a first step, we consider collinear lines. For soundness of the construction, we need to show that for two or three dipoles on the same line there is a lower bound for the number of prototypical points needed to distinguish between the possible DRA relations on a line. Consider any configuration of collinear n ∈ {2, 3} dipoles A, B (and C). We use an order induced by eA < sA on the line, i.e., if B points into the same direction as A, we have eB < sB , otherwise sB < eB , and the same for C. This construction reflects the fact that dipoles always have non-zero length. We translate the 13 Allen relations and the “opposite” Allen relations componentwise into our order for two dipoles A and B: A b___ B

7→ sA < sB ∧ eA < sB

A s___ B

7→ sA = sB ∧ eA < sB

A i___ B

7→ sB < sA ∧ eA < sB

A e___ B

7→ sB < sA ∧ eA = sB

A f ___ B

7→

sB < sA ∧ sB < eA

and likewise for the other components of the relations in question. Example 6. Consider the relation (A bbff B). Since both dipoles point into the same direction, we can derive eA < sA ∧ eB < sB . Now, we apply the translation rules for each component: sA < sB sA < eB sA < eB eA < sB

∧ eA < sB ∧ eA < eB ∧ sA < sB ∧ eA < eB

∧ ∧ ∧

we observe that the overall inequalities can be simplified to eA < sA sA < sB sA < eB

∧ eB < sB ∧ eA < sB ∧ eA < eB

∧ ∧

20 Actually, the algorithm will output many triples more than once; these duplicates could be filtered out.

35

By transitivity of