{'fraction_non_alphanumeric': 0.0632483671988389, 'fraction_numerical': 0.010273040638606677, 'mean_word_length': 3.3873246443139986, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Undecidable First-Order Theories of Affine Geometries

Tarski initiated a logic-based approach to formal geometry that studies first-order structures with a ternary betweenness relation \beta, and a quaternary equidistance relation \equiv. Tarski established, inter alia, that the first-order (FO) theory of (R^2,\beta,\equiv) is decidable. Aiello and van Benthem (2002) conjectured that the FO-theory of expansions of (R^2,\beta) with unary predicates is decidable. We refute this conjecture by showing that for all n>1, the FO-theory of the class of expansions of (R^2,\beta) with just one unary predicate is not even arithmetical. We also define a natural and comprehensive class C of geometric structures (T,\beta), and show that for each structure (T,\beta) in C, the FO-theory of the class of expansions of (T,\beta) with a single unary predicate is undecidable. We then consider classes of expansions of structures (T,\beta) with a restricted unary predicate, for example a finite predicate, and establish a variety of related undecidability results. In addition to decidability questions, we briefly study the expressivities of universal MSO and weak universal MSO over expansions of (R^n,\beta). While the logics are incomparable in general, over expansions of (R^n,\beta), formulae of weak universal MSO translate into equivalent formulae of universal MSO.


Introduction
Decidability of theories of (classes of) structures is a central topic in various different fields of computer science and mathematics, with different motivations and objectives depending on the field in question. In this article we investigate formal theories of geometry in the framework introduced by Tarski [21,22]. The logic-based framework was originally presented in a series of lectures given in Warsaw in the 1920's. The system is based on first-order structures with two predicates: a ternary betweenness relation β and a quaternary equidistance relation ≡. Within this system, β(u, v, w) is interpreted to mean that the point v is between the points u and w, while xy ≡ uv means that the distance from x to y is equal to the distance from u to v. The betweenness relation β can be considered to simulate the action of a ruler, while the equidistance relation ≡ simulates the action of a compass. See [22] for information about the history and development of Tarski's geometry.
Tarski established in [21] that the first-order theory of (R 2 , β, ≡) is decidable. In [1], Aiello and van Benthem pose the question: "What is the complete monadic Π 1 1 theory of the affine real plane?" By affine real plane, the authors refer to the structure (R 2 , β). The monadic Π 1 1 -theory of (R 2 , β) is of course essentially the same as the first-order theory of the class of expansions (R 2 , β, (P i ) i∈N ) of the the affine real plane (R 2 , β) by unary predicates P i ⊆ R 2 . Aiello and van Benthem conjecture that the theory is decidable. Expansions of (R 2 , β) with unary predicates are especially relevant in investigations related to the geometric structure (R 2 , β), since in this context unary predicates correspond to regions of the plane R 2 .
In this article we study structures of the type of (T, β), where T ⊆ R n and β is the canonical Euclidean betweenness predicate restricted to T , see Section 2.3 for the formal definition. Let E (T, β) denote the class of expansions (T, β, (P i ) i∈N ) of (T, β) with unary predicates. We identify a significant collection of canonical structures (T, β) with an undecidable first-order theory of E (T, β) . Informally, if there exists a flat two-dimensional region R ⊆ R n , no matter how small, such that T ∩R is in a certain sense sufficiently dense with respect to R, then the first-order theory of the class E (T, β) is undecidable. If the related density conditions are satisfied, we say that T extends linearly in 2D, see Section 2.3 for the formal definition. We prove that for any T ⊆ R n , if T extends linearly in 2D, then the FO-theory of E (T, β) is Σ 0 1 -hard. In addition, we establish that for all n ≥ 2, the first-order theory of E (R n , β) is Π 1 1 -hard, and therefore not even arithmetical. We thereby refute the conjecture of Aiello and van Benthem from [1]. The results are ultimately based on tiling arguments. The result establishing Π 1 1 -hardness relies on the recurrent tiling problem of Harel [14]-once again demonstrating the usefulness of Harel's methods.
Our results establish undecidability for a wide range of monadic expansion classes of natural geometric structures (T, β). In addition to (R 2 , β), such structures include for example the rational plane (Q 2 , β), the real unit cube ([0, 1] 3 , β), and the plane of algebraic reals (A 2 , β) -to name a few.
In addition to investigating monadic expansion classes of the type E (T, β) , we also study classes of expansions with restricted unary predicates. Let n be a positive integer and let T ⊆ R n . Let F (T, β) denote the class of structures (T, β, (P i ) i∈N ), where the sets P i are finite subsets of T . We establish that if T extends linearly in 2D, then the first-order theory of F (T, β) is undecidable. An alternative reading of this result is that the weak universal monadic second-order theory of (T, β) is undecidable. We obtain a Π 0 1 -hardness result by an argument based on the periodic torus tiling problem of Gurevich and Koryakov [12]. The torus tiling argument can easily be adapted to deal with various different kinds of natural classes of expansions of geometric structures (T, β) with restricted unary predicates. These include the classes with unary predicates denoting-for example-polygons, finite unions of closed rectangles, and real algebraic sets (see [8] for the definition).
Our results could turn out useful in investigations concerning logical aspects of spatial databases. It turns out that there is a canonical correspondence between (R 2 , β) and (R, 0, 1, ·, +, <), see [13]. See the survey [17] for further details on logical aspects of spatial databases.
The betweenness predicate is also studied in spatial logic [3]. The recent years have witnessed a significant increase in the research on spatially motivated logics. Several interesting systems with varying motivations have been investigated, see for example the articles [1,4,5,15,16,18,20,23,24]. See also the surveys [2] and [6] in the Handbook of Spatial Logics [3], and the Ph.D. thesis [11]. Several of the above articles investigate fragments of first-order theories by way of modal logics for affine, projective, and metric geometries. Our results contribute to the understanding of spatially motivated first-order languages, and hence they can be useful in the search for decidable (modal) spatial logics.
In addition to studying issues of decidability, we briefly compare the expressivities of universal monadic second-order logic ∀MSO and weak universal monadic second-order logic ∀WMSO. It is straightforward to observe that in general, the expressivities of ∀MSO and ∀WMSO are incomparable in a rather strong sense: ∀MSO ≤ WMSO and ∀WMSO ≤ MSO. Here MSO and WMSO denote monadic second-order logic and weak monadic second-order logic, respectively. The result ∀WMSO ≤ MSO follows from already existing results (see [10] for example), and the result ∀MSO ≤ WMSO is more or less trivial to prove. While ∀MSO and ∀WMSO are incomparable in general, the situation changes when we consider expansions (R n , β, (R i ) i∈I ) of the stucture (R n , β), i.e., structures embedded in the geometric structure (R n , β). Here (R i ) i∈I is an arbitrary vocabulary and I an arbitrary related index set. We show that over such structures, sentences of ∀WMSO translate into equivalent sentences of ∀MSO. The proof is based on the Heine-Borel theorem.
The structure of the current article is as follows. In Section 2 we define the central notions needed in the later sections. In Section 3 we compare the expressivities of ∀MSO and ∀WMSO. In Section 4 we show undecidability of the first-order theory of the class of monadic expansions of any geometric structure (T, β) such that T exends linearly in 2D. In addition, we show that for n ≥ 2, the first-order theory of monadic expansions of (R n , β) is not on any level of the arithmetical hierarchy. In Section 5 we modify the approach in Section 4 and show undecidability of the FO-theory of the class of expansions by finite unary predicates of any geometric structure (T, β) such that T extends linearly in 2D.

Interpretations
Let σ and τ be relational vocabularies. Let A be a nonempty class of σ-structures and C a nonempty class of τ -structures. Assume that there exists a surjective map F from C onto A and a first-order τ -formula ϕ Dom (x) in one free variable, x, such that for each structure B ∈ C, there is a bijection f from the domain of F (B) to the set Assume, furthermore, that for each relation symbol R ∈ σ, there is a first-order τ -formula ϕ R (x 1 , ..., x Ar (R) ) such that we have for every tuple (a 1 , ..., a Ar (R) ) ∈ (Dom(F (B))) Ar (R) . Here Ar (R) is the arity of R. We then say that the class A is uniformly first-order interpretable in C. If A is a singleton class {A}, we say that A is uniformly first-order interpretable in C.
Assume that a class of σ-structures A is uniformly first-order interpretable in a class C of τ -structures. Let P be a set of unary relation symbols such that P ∩ (σ ∪ τ ) = ∅. Define a map I from the set of first-order (σ ∪ P)-formulae to the set of first-order (τ ∪ P)-formulae as follows.
We call the map I the P-expansion of a uniform interpretation of A in C. When A and C are known from the context, we may call I simply a P-interpretation. In the case where P is empty, the map I is a uniform interpretation of A in C.
Lemma 2.1. Let σ and τ be finite relational vocabularies. Let A be a class of σ-structures and C a class of τ -structures. Assume that A is uniformly first-order interpretable in C. Let P be a set of unary relation symbols such that P ∩ (σ ∪ τ ) = ∅. Let I denote a related P-interpretation. Let ϕ be a first-order (σ ∪ P)-sentence. The following conditions are equivalent.
1. There exists an expansion A * of a structure A ∈ A to the vocabulary σ ∪ P such that A * |= ϕ.
2. There exists an expansion B * of a structure B ∈ C to the vocabulary τ ∪ P such that B * |= I(ϕ).

Logics and structures
Monadic second order logic, MSO, extends first-order logic with quantification of relation symbols ranging over subsets of the domain of a model. In universal (existential) monadic second order logic, ∀MSO (∃MSO), the quantification of monadic relations is restricted to universal (existential) prenex quantification in the beginning of formulae. The logics ∀MSO and ∃MSO are also known as monadic Π 1 1 and monadic Σ 1 1 . Weak monadic second-order logic, WMSO, is a semantic variant of monadic second-order logic in which the quantified relation symbols range over finite subsets of the domain of a model. The weak variants ∀WMSO and ∃WMSO of ∀MSO and ∃MSO are defined in the obvious way.
Let L be any fragment of second-order logic. The L-theory of a structure M of a vocabulary τ is the set of τ -sentences ϕ of L such that M |= ϕ.
Define two binary relations H, V ⊆ N 2 × N 2 as follows.
We let G denote the structure (N 2 , H, V ), and call it the grid. The relations H and V are called the horizontal and vertical successor relations of G, respectively. A supergrid is a structure of the vobabulary {H, V } that has G as a substructure. We denote the class of supergrids by G. Let (G, R) be the expansion of G, where R = { (0, i), (0, j) ∈ N 2 × N 2 | i < j }. We denote the structure (G, R) by R, and call it the recurrence grid.
Let m and n be positive integers. Define two binary relations H m,n , V m,n ⊆ (m × n) 2 as follows. (Note that we define m = {0, ..., m − 1}, and analogously for n.) We call the structure (m × n, H m,n , V m,n ) the m × n torus and denote it by T m,n . A torus is essentially a finite grid whose east border wraps back to the west border and north border back to the south border.
Below we study geometric betweenness structures of the type (T, β T ) where T ⊆ R n and β T = β T . Here β T is the restriction of the betweenness predicate β of R n to the set T . To simplify notation, we usually refer to these structures by (T, β).
Let T ⊆ R n and let β the corresponding betweenness relation. We say that L ⊆ T is a line in T if the following conditions hold.
1. There exist points s, t ∈ L such that s = t.
2. For all s, t, u ∈ L, the points s, t, u are collinear.
3. Let s, t ∈ L be points such that s = t. For all u ∈ T , if β(s, u, t) or β(s, t, u), then u ∈ L.
Let T ⊆ R n and let L 1 and L 2 be lines in T . We say that L 1 and L 2 intersect if L 1 = L 2 and L 1 ∩ L 2 = ∅. We say that the lines L 1 and . . , r m ∈ R}. None of the vectors v i is allowed to be the zero-vector.
A set U ⊆ R n is a linearly regular m-dimensional flat, where 0 ≤ m ≤ n, if the following conditions hold.
1. There exists an m-dimensional flat S such that U ⊆ S.

There does not exist any
3. U is linearly complete, i.e., if L is a line in U and L ⊇ L the corresponding line in R n , and if r ∈ L is a point in L and ∈ R + a positive real number, then there exists a point s ∈ L such that d(s, r) < . Here d is the canonical metric of R n .
4. U is linearly closed, i.e., if L 1 and L 2 are lines in U and L 1 and L 2 intersect in R n , then the lines L 1 and L 2 intersect. In other words, there exists a point s ∈ U such that s ∈ L 1 ∩ L 2 .
A set T ⊆ R n extends linearly in mD, where m ≤ n, if there exists a linearly regular m-dimensional flat S, a positive real number ∈ R + and a point x ∈ S ∩ T such that { u ∈ S | d(x, u) < } ⊆ T. It is easy show that for example Q 2 extends linearly in 2D.

Tilings
A function t : 4 −→ N is called a tile type. Define the set TILES := { P t | t is a tile type } of unary relation symbols. The unary relation symbols in the set TILES are called tiles. The numbers t(i) of a tile P t are the colours of P t . The number t(0) is the top colour, t(1) the right colour, t(2) the bottom colour, and t(3) the left colour of P t .
Let T be a finite nonempty set of tiles. We say that a structure that the following conditions hold.
1. Each point of A belongs to the extension of exactly one symbol P t in T .
2. If uHv for some points u, v ∈ A, then the right colour of the tile P t s.t. P t (u) is the same as the left colour of the tile P t such that P t (v).
3. If uV v for some points u, v ∈ A, then the top colour of the tile P t s.t. P t (u) is the same as the bottom colour of the tile P t such that P t (v).
Let t ∈ T . We say that the grid G is t-recurrently T -tilable if there exists an expansion of G to the vocabulary {H, V } ∪ { P t | t ∈ T } such that the above conditions 1 − 3 hold, and additionally, there exist infinitely many points (0, i) ∈ N 2 such that P t (0, i) . Intuitively this means that the tile P t occurs infinitely many times in the leftmost column of the grid G. Let F be the set of finite, nonempty sets T ⊆ TILES, and let Define the following languages The tiling problem is the membership problem of the set T with the input set F. The recurrent tiling problem is the membership problem of the set R with the input set H.
The periodic tiling problem is the membership problem of S with the input set F.
The tiling problem is Π 0 1 -complete. Theorem 2.3. [14] The recurrent tiling problem is Σ 1 1 -complete. Theorem 2.4. [12] The periodic tiling problem is Σ 0 1 -complete. Lemma 2.5. There is a computable function associating each input T to the (periodic) tiling problem with a first-order sentence ϕ T of the vocabulary τ : Lemma 2.6. There is a computable function associating each input (t, T ) of the recurrent tiling problem with a first-order sentence ϕ (t,T ) of the vocabulary τ := {H, V, R} ∪ T such that the grid G is t-recurrently T -tilable iff there exists an expansion R * of the recurrence grid R to the vocabulary τ such that R * |= ϕ (t,T ) .

Proof. Straightforward.
It is easy to see that the grid G is T -tilable iff there exists a supergrid G that is T -tilable.
3 Expressivity of universal MSO and weak universal MSO over affine real structures (R n , β) In this section we investigate the expressive powers of ∀WMSO and ∀MSO. While it is rather easy to conclude that the two logics are incomparable in a rather strong sense (see Proposition 3.1), when attention is limited to structures (R n , β, (R i ) i∈I ) that expand the affine real structure (R n , β), sentences of ∀WMSO translate into equivalent sentences of ∀MSO.
Let L and L be fragments of second-order logic. We write L ≤ L , if for every vocabulary σ, any class of σ-structures definable by a σ-sentence of L is also definable by a σ-sentence of L . Let τ be a vocabulary such that β ∈ τ . The class of all expansions of (R n , β) to the vocabulary {β} ∪ τ is called the class of affine real τ -structures. Such structures can be regarded as τ -structures embedded in the geometric structure (R n , β). We say that L ≤ L over (R n , β), if for every vocabulary τ s.t. β ∈ τ , any subclass definable w.r.t. the class C of all affine real τ -structures by a sentence of L is also definable w.r.t. C by a sentence of L .
We sketch a canonical proof of the following very simple observation. The result ∀WMSO ≤ MSO follows from already existing results (see [10] for example), and the result ∀MSO ≤ WMSO is easy to prove. Proof Sketch. It is easy to observe that ∀WMSO ≤ MSO: consider the sentence ∀X∃y ¬Xy. This ∀WMSO sentence is true in a model iff the domain of the model is infinite. A straightforward monadic second-order Ehrenfeucht-Fraïssé game argument can be used to establish that infinity is not expressible by any MSO sentence.
To show that ∀MSO ≤ WMSO, consider the structures (R, <) and (Q, <). The structures can be separated by a sentence of ∀MSO stating that every subset bounded from above has a least upper bound. To see that the two structures cannot be separated by any sentence of WMSO, consider the variant of the MSO Ehrenfeucht-Fraïssé game where the players choose finite sets in addition to domain elements. It is easy to establish that this game characterizes the expressivity of WMSO. To see that the duplicator has a winning strategy in a game of any finite length played on the structures (R, <) and (Q, <), we devise an extension of the folklore winning strategy in the corresponding first-order game. Firstly, the duplicator can obviously always pick an element whose betweenness configuration corresponds exactly to that of the element picked by the spoiler. Furthermore, even if the spoiler picks a finite set, it is easy to see that the duplicator can pick his set such that each of its elements respect the betweenness configuration of the set picked by the spoiler.
Theorem 3.2 (Heine-Borel). A set S ⊆ R n is closed and bounded iff every open cover of S has a finite subcover. Theorem 3.3. Let C be the class of expansions (R n , β, P ) of (R n , β) with a unary predicate P , and let F ⊆ C be the subclass of C where P is finite. The class F is first-order definable with respect to C.
Proof. We shall first establish that a set T ⊆ R n is finite iff it is closed, bounded and consists of isolated points of T . Recall that an isolated point u of a set U ⊆ R n is a point such that there exists some open ball B such that B ∩ U = {u}.
Assume T ⊆ R n is finite. Since T is finite, we can find a minimum distance between points in the set T . Therefore it is clear that each point t in T belongs to some open ball B such that B ∩ T = {t}, and hence T consists of isolated points. Similarly, since T is finite, each point b in the complement of T has some minimum distance to the points of T , and therefore b belongs to some open ball B ⊆ R n \ T . Hence the set T is the complement of the union of open balls B such that B ⊆ R n \ T , and therefore T is closed. Finally, since T is finite, we can find a maximum distance between the points in T , and therefore T is bounded.
Assume then that T ⊆ R n is closed, bounded and consists of isolated points of T . Since T consists of isolated points, it has an open cover C ⊆ Pow(R n ) such that each set in C contains exactly one point t ∈ T . The set C is an open cover of T , and by the Heine-Borel theorem, there exists a finite subcover D ⊆ C of the set T . Since D is finite and each set in D contains exactly one point of T , the set T must also be finite.
We will then define first-order {β}-formulae basis k (x 0 , . . . , x k ) and flat k (x 0 , . . . , x k , z) using simultaneous recursion. The first formula states that the vectors corresponding to the pairs (x 0 , x i ), 1 ≤ i ≤ k, form a basis of a k-dimensional flat. The second formula states the points z are exactly the points in the span of the basis defined by the vectors (x 0 , x i ), the origin being x 0 . First define basis 0 (x 0 ) := x 0 = x 0 and flat 0 (x 0 , z) := x 0 = z. Then define flat k and basis k recursively in the following way. We then define a first-order {β, P }-formula sepr (x, P ) asserting that x belongs to an open ball B such that each point in B \ {x} belongs to the complement of P . The idea is to state that there exist n + 1 points x 0 , . . . , x n that form an n-dimensional triangle around x, and every point contained in the triangle (with x being a possible exception) belongs to the complement of P . Every open ball in R n is contained in some n-dimensional triangle in R n and vice versa. We will recursively define first-order formulae opentriangle k (x 0 , . . . , x k , z) stating that z is properly inside a k-dimensional triangle defined by x 0 , . . . , x k . First define opentriangle 1 (x 0 , x 1 , z) := β * (x 0 , z, x 1 ), and then define opentriangle k (x 0 , . . . , x k , z) := basis k (x 0 , . . . , x k ) ∧ ∃y opentriangle k−1 (x 0 , . . . , x k−1 , y) ∧ β * (y, z, x k ) .
We are now ready to define sepr (x, P ). Let sepr (x, P ) := ∃x 0 , . . . , x n opentriangle n (x 0 , . . . , x n , x) ∧ ∀y (opentriangle n (x 0 , . . . , x n , y) ∧ y = x) → ¬P y . Now, the sentence ϕ 1 := ∀x ¬P x → sepr (x, P ) states that each point in the complement of P is contained in an open ball B ⊆ R n \ P . The sentence therefore states that the complement of P is a union of open balls. Since the set of unions of open balls is exactly the same as the set of open sets, the sentence states that P is closed.
The sentence ϕ 2 := ∀x P x → sepr (x, P ) clearly states that P consists of isolated points.
Corollary 3.4. Limit attention to expansions of (R n , β). Sentences of ∀WMSO translate into equivalent sentences of ∀MSO, and sentences of WMSO into equivalent sentences of MSO.

Undecidable theories of geometric structures with an affine betweenness relation
In this section we prove that the universal monadic second-order theory of any geometric structure (T, β) that extends linearly in 2D is undecidable. In addition we show that the universal monadic second-order theories of structures (R n , β) with n ≥ 2 are highly undecidable. In fact, we show that the theories of structures extending linearly in 2D are Σ 0 1 -hard, while the theories of structures (R n , β) with n ≥ 2 are Π 1 1 -hard-and therefore not even arithmetical. We establish the results by a reduction from the (recurrent) tiling problem to the problem of deciding whether a particular {β}-sentence of monadic Σ 1 1 is satisfied by (T, β) (respectively, (R n , β)). The argument is based on interpreting supergrids in corresponding {β}-structures.

Lines and sequences
Let T ⊆ R n . Let L be a line in T . Any nonempty subset Q of L is called a sequence in T . Let E ⊆ T and s, t ∈ T . If s = t and if u ∈ E for all points u ∈ T such that β * (s, u, t), we say that the points s and t are linearly E-connected (in (T, β)). If there exists a point v ∈ T \ E such that β * (s, v, t), we say that s and t are linearly disconnected with respect to E (in (T, β)).
Definition 4.1. Let Q be a sequence in T ⊆ R n . Suppose that for each s, t ∈ Q such that s = t, there exists a point u ∈ T \ {s} such that 1. β(s, u, t) and 2. ∀r ∈ T β * (s, r, u) → r ∈ Q , i.e., the points s and u are linearly (T \ Q)connected.
Then we call Q a discretely spaced sequence in T.  It is easy to see that a discretely infinite sequence has at most one zero point.
Definition 4.4. Let Q be a discretely infinite sequence in T ⊆ R n with a zero. Assume that for each r ∈ T such that there exist points s, u ∈ Q \ {r} with β(s, r, u), there also exist points s , u ∈ Q \ {r} such that 1. β(s , r, u ) and Then we call Q an ω-like sequence in T (cf. Lemma 4.7).
Lemma 4.5. Let P be a unary relation symbol. There is a first-order sentence ϕ ω (P ) of the vocabulary {β, P } such that for every T ⊆ R n and for every expansion (T, β, P ) of (T, β), we have (T, β, P ) |= ϕ ω (P ) if and only if the interpretation of P is an ω-like sequence in T .
The formula sequence(P ) states that P is a sequence. By inspection of Definition 4.1, it is easy to see that there is a first-order formula ψ such that the conjunction sequence(P ) ∧ ψ states that P is a discretely spaced sequence. Continuing this trend, it is straightforward to observe that Definitions 4.2, 4.3 and 4.4 specify first-order properties, and therefore there exists a first-order formula ϕ ω (P ) stating that P is an ω-like sequence.
Definition 4.6. Let P be a sequence in T ⊆ R n and s, t ∈ P . The points s, t are called adjacent with respect to P , if the points are linearly (T \ P )-connected. Let E ⊆ P × P be the set of pairs (u, v) such that 1. u and v are adjacent with respect to P , and 2. β(z, u, v) for some zero point z of P .
We call E the successor relation of P .
We let succ denote the successor relation of N, i.e., succ : Lemma 4.7. Let P be an ω-like sequence in T ⊆ R n and E the successor relation of P . There is an embedding from (N, succ) into (P, E) such that 0 ∈ N maps to the zero point of P . If T = R n , then (N, succ) is isomorphic to (P, E).
Proof. We denote by i 0 the unique zero point of P . Since P is a discretely infinite sequence, it has a base point. Clearly i 0 has to be the only base point of P . It is straightforward to establish that since P is an ω-like sequence with the base point i 0 , there exists a sequence (a i ) i∈N of points a i ∈ P such that i 0 = a 0 and a i+1 is the unique E-successor of a i for all i ∈ N. Define the function h : N → P such that h(i) = a i for all i ∈ N. It is easy to see that h is an embedding of (N, succ) into (P, E). Assume then that T = R n . We shall show that the function h : N −→ P is a surjection. Let d denote the canonical metric of R, and let d R be the restriction of the canonical metric of R n to the line R in R n such that P ⊆ R. Let g : R −→ R be the isometry from (R, d) to (R, d R ) such that g(0) = i 0 = h(0) and such that for all r ∈ ran(h), we have β i 0 , g(1), r or β i 0 , r, g (1) . Let (R, ≤ R ) be the structure, where is not bounded from above w.r.t. ≤ R , then h must be a surjection. Therefore assume that ran(h) is bounded above. By the Dedekind completeness of the reals, there exists a least upper bound s ∈ R of ran(h) w.r.t. ≤ R . Notice that since h is an embedding of (N, succ) into (P, E), we have s ∈ ran(h). Due to the definition of E, it is sufficient to show that { t ∈ P | s ≤ R t } = ∅ in order to conclude that h maps onto P .
Assume that the least upper bound s belongs to the set P . Since P is a discretely spaced sequence, there is a point u ∈ R n \ {s} such that β(s, u, i 0 ) and ∀r ∈ R n β * (s, r, u) → r ∈ P . Now u < R s and the points u and s are linearly (R n \ P )-connected, implying that s cannot be the least upper bound of ran(h). This is a contradiction. Therefore s ∈ P .
Assume, ad absurdum, that there exists a point t ∈ P such that β(i 0 , s, t). Now, since P is an ω-like sequence, there exists points u , v ∈ P \ {s} such that β(u , s, v ) and ∀r ∈ R n β * (u , r, v ) → r ∈ P . We have β(s, u , i 0 ) or β(s, v , i 0 ). Assume, by symmetry, that β(s, u , i 0 ). Now u < R s, and the points u and s are linearly (R n \ P )-connected. Hence, since s ∈ ran(h), we conclude that s is not the least upper bound of ran(h). This is a contradiction.

Geometric structures (T, β) with an undecidable monadic Π 1 1 -theory
Let Q be an ω-like sequence in T ⊆ R n and let q 0 be the unique zero point of Q. Assume there exists a point q e ∈ T \ Q such that β(q 0 , q, q e ) holds for all q ∈ Q. We call Q ∪ {q e } an ω-like sequence with an endpoint in T . The point q e is the endpoint of Q ∪ {q e }. Notice that the endpoint q e is the only point x in Q ∪ {q e } such that the following conditions hold.
1. There does not exist points s, t ∈ Q ∪ {q e } such that β * (s, x, t).
Definition 4.8. Let P and Q be ω-like sequences with an endpoint in T ⊆ R n . Let p e and q e be the endpoints of P and Q, respectively. Assume that the following conditions hold.
1. There exists a point z ∈ P ∩ Q such that z is the zero-point of both P \ {p e } and Q \ {q e }.
2. There exists lines L P and L Q in T such that L P = L Q , P ⊆ L P and Q ⊆ L Q .
3. For each point p ∈ P \ {p e } and q ∈ Q \ {q e }, the unique lines L p and L q in T such that p, q e ∈ L p and q, p e ∈ L q intersect.
We call the structure (T, β, P, Q) a Cartesian frame.
Lemma 4.9. Let T ⊆ R n , n ≥ 2, and let C be the class of all expansions (T, β, P, Q) of (T, β) by unary relations P and Q. The class of Cartesian frames with the domain T is definable with respect to C by a first-order sentence.
Proof. Straightforward by virtue of Lemma 4.5.
Lemma 4.10. Let T ⊆ R n , n ≥ 2. Let C be the class of Cartesian frames with the domain T , and assume that C is nonempty. Let G be the class of supergrids and G the grid. There is a class A ⊆ G that is uniformly first-order interpretable in the class C, and furthermore, G ∈ A.
Proof. Let C = (T, β, P, Q) be a Cartesian frame. Let p e ∈ P and q e ∈ Q be the endpoints of P an Q, respectively. We shall interpret a supergrid G C in the Cartesian frame C. The domain of the interpretation of G C in C will be the set of points where the lines that connect the points of P \ {p e } to q e and the lines that connect the points of Q \ {q e } to p e intersect. First let us define the following formula which states in C that x is the endpoint of P .
end P (P, Q, x) := P x ∧ ¬Qx ∧ ¬∃y∃z P y ∧ P z ∧ β * (y, x, z) In the following, we let atomic expressions of the type x = p e and β * (x, y, q e ) abbreviate corresponding first-order formulae ∃z end P (P, Q, z) ∧ x = z and ∃z end Q (Q, P, z) ∧ β * (x, y, z) of the vocabulary {β, P, Q} of C. We define Call D C := { r ∈ T | C |= ϕ Dom (r) } and define the structure and analogously for V D C . By Lemma 4.7, it is easy to see that there exists an injection f from the domain of the grid G = (G, H, V ) to D C such that the following three conditions hold for all u, v ∈ G.
Hence there is a supergrid G C = (G C , H, V ) such that there exists an isomorphism f from G C to D G such that the above two conditions hold. Let A := { G C ∈ G | C is a Cartesian frame with the domain T }. Clearly G ∈ A, and furthermore, A is uniformly first-order interpretable in the class of Cartesian frames with the domain T . Theorem 4.12. Let T ⊆ R n be a set and let β be the corresponding betweenness relation. Assume that T extends linearly in 2D. The monadic Π 1 1 -theory of (T, β) is Σ 0 1 -hard.
Proof. Since T extends linearly in 2D, we have n ≥ 2. Let σ = {H, V } be the vocabulary of supergrids, and let τ = {β, X, Y } be the vocabulary of Cartesian frames. By Lemma 4.9, there exists a first-order τ -sentence that defines the class of Cartesian frames with the domain T with respect to the class of all expansions of (T, β) to the vocabulary τ . Let ϕ Cf denote such a sentence. By Lemma 2.5, there is a computable function that associates each input S to the tiling problem with a first-order σ ∪ S-sentence ϕ S such that a structure A of the vocabulary σ is S-tilable if and only if there is an expansion A * of the structure A to the vocabulary σ ∪ S such that A * |= ϕ S .
Since T extends linearly in 2D, the class of Cartesian frames with the domain T is nonempty. By Lemma 4.10 there is a class of supergrids A such that G ∈ A and A is uniformly first-order interpretable in the class of Cartesian frames with the domain T . Therefore there exists a uniform interpretation I of A in the class of Cartesian frames with the domain T . Let S be a finite nonempty set of tiles. Note that S is by definition a set of proposition symbols P t , where t is a tile type. Let I be the S-expansion of the uniform interpretation I of A in the class of Cartesian frames with the domain T .
Define ψ S := ∃X ∃Y (∃P t ) Pt ∈ S ϕ Cf ∧ I( ϕ S ) . We will prove that for each input S to the tiling problem, we have (T, β) |= ψ S if and only if the grid G is S-tilable. Thereby we establish that there exists a computable reduction from the complement problem of the tiling problem to the membership problem of the monadic Π 1 1 -theory of (T, β). Since the tiling problem is Π 0 1 -complete, its complement problem is Σ 0 1 -complete. 1 Let S be an input to the tiling problem. Assume first that there exists an S-tiling of the grid G. Therefore there exists an expansion G * of the grid G to the vocabulary {H, V } ∪ S such that G * |= ϕ S . Hence, by Lemma 2.1 and since G ∈ A, there exists a Cartesian frame C with the domain T such that for some expansion C * of C to the vocabulary {β, X, Y } ∪ S, we have C * |= I(ϕ S ). On the other hand, since C is a Cartesian frame, we have C * |= ϕ Cf . Therefore C * |= ϕ Cf ∧ I(ϕ S ), and hence (T, β) |= ψ S .
For the converse, assume that (T, β) |= ψ S . Therefore there exists an expansion B * of (T, β) to the vocabulary {β, X, Y } ∪ S such that we have B * |= ϕ Cf ∧ I(ϕ S ). Since B * |= ϕ Cf , the {β, X, Y }-reduct of B * is a Cartesian frame with the domain T . Therefore, we conclude by Lemma 2.1 that A * |= ϕ S for some expansion A * of some supergrid A ∈ A to the vocabulary {H, V } ∪ S. Thus there exists a supergrid that S-tilable. Hence the grid G is S-tilable.
Corollary 4.13. Let T ⊆ R n be such that T extends linearly in 2D. Let C be the class of expansions (T, β, (P i ) i∈N ) of (T, β) with arbitrary unary predicates. The first-order theory of C is undecidable.
We note that T extending linearly in 1D is not a sufficient condition for undecidability of the monadic Π 1 1 -theory of (T, β). The monadic Π 1 1 -theory of (R, β) is decidable; this follows trivially from the known result that the monadic Π 1 1 -theory (R, ≤) is decidable, see [9]. Also the monadic Π 1 1 -theory of (Q, β) is decidable since the MSO theory of (Q, ≤) is decidable [19].
Proof. The proof is essentially the same as the proof of Theorem 4.12. The main difference is that we use Lemma 4.11 and interpret the recurrence grid R instead of a class of supergrids and hence obtain a reduction from the recurring tiling problem instead of the ordinary tiling problem. Thereby we establish Π 1 1 -hardness instead of Σ 0 1 -hardness. Due to the recurrence condition of the recurrent tiling problem, the result of Lemma 4.7 that there is an isomorphism from (N, succ) to (P, E)-rather than an embedding-is essential.
Corollary 4.15. Let n ≥ 2 be an integer. Let C be the class of expansions (R n , β, (P i ) i∈N ) of (R n , β) with arbitrary unary predicates. The first-order theory of C is not on any level of the arithmetical hierarchy. 1 It is of course a well-known triviality that the complement A of a problem A is Σ 0 1 -hard if A is Π 0 1 -hard. Choose an arbitrary problem B ∈ Σ 0 1 . By definition B ∈ Π 0 1 . By the hardness of A, there is a computable reduction f such that 5 Geometric structures (T, β) with an undecidable weak monadic Π 1 1 -theory In this section we prove that the weak universal monadic second-order theory of any structure (T, β) such that T extends linearly in 2D is undecidable. In fact, we show that any such theory is Π 0 1 -hard. We establish this by a reduction from the periodic tiling problem to the problem of deciding truth of {β}-sentences of weak monadic Σ 1 1 in (T, β). The argument is based on interpreting tori in (T, β). Most notions used in this section are inherited either directly or with minor modification from Section 4.
Let Q be a subset of T ⊆ R n . We say that Q is a finite sequence in T if Q is a finite nonempty set and the points in Q are all collinear.
Definition 5.1. Let T ⊆ R n and let β be the corresponding betweenness relation. Let P and Q be finite sequences in T such that the following conditions hold.
1. P ∩ Q = {a 0 }, where a 0 is a zero point of both P and Q.
2. P and Q are non-singleton sequences.
3. There exists lines L P , L Q in T such that L P = L Q , P ⊆ L P and Q ⊆ L Q .
We call the structure (T, β, P, Q) a finite Cartesian frame with the domain T . The unique intersection point of P and Q is called the origo of the frame. If |P | = m + 1 and |Q| = n + 1, we call (T, β, P, Q) an m × n Cartesian frame with the domain T .
Lemma 5.2. Let T ⊆ R n , n ≥ 2. Let C be the class of all expansions (T, β, P, Q) of (T, β) by finite unary relations P and Q. The class of finite Cartesian frames with the domain T is definable with respect to C by a first-order sentence.
Proof. Straightforward. Lemma 5.3. Let T ⊆ R n , n ≥ 2. Assume that T extends linearly in 2D. The class of tori is uniformly first-order interpretable in the class of finite Cartesian frames with the domain T .
Proof. Let C = (T, β, P, Q) be a finite Cartesian frame. We denote by p e ∈ P and q e ∈ Q the limit points of P and Q, respectively. Clearly p e and q e are definable by a first-order formula with one free variable.
Define ϕ fin Dom (u) := ϕ Dom (u). Also define the following variants of the {β, P, Q}formulas ϕ H (u, v) and ϕ V (u, v) definined in Lemma 4.10. Let . where It is straightforward to check that if C is an m × n Cartesian frame, then there exists a bijection f from the domain of the m × n torus T m,n = (T m,n , H m,n , V m,n ) to F C such that the following conditions hold for all u, v ∈ T m,n .
). Notice that since T extends linearly in 2D, there exist finite Cartesian frames of all sizes in the class of finite Cartesian frames with the domain T . Hence the class of finite tori is uniformly first-order interpretable in the class of finite Cartesian frames with the domain T .
Theorem 5.4. Let T ⊆ R n and let β be the corresponding betweenness relation. Assume that T extends linearly in 2D. The weak monadic Π 1 1 -theory of (T, β) is Π 0 1 -hard. Proof. Since T extends linearly in 2D, we have n ≥ 2. Let σ = {H, V } be the vocabulary of tori, and let τ = {β, X, Y } be the vocabulary of finite Cartesian frames. Let C = { (T, β, X, Y ) | X and Y are finite sets, X, Y ⊆ T }. By Lemma 5.2, there exists a firstorder τ -sentence that defines the class of finite Cartesian frames with the domain T with respect to the class C. Let ϕ fcf denote such a sentence.
By Lemma 2.5, every input S to the periodic tiling problem can be effectively associated with a first-order σ ∪ S-sentence ϕ S such that for all tori B, the torus B is S-tilable iff there is an expansion B * of B to the vocabulary σ ∪ S such that B * |= ϕ S . By Lemma 5.3, the class of tori is uniformly first-order interpretable in the class of finite Cartesian frames with the domain T . Let S be a finite nonempty set of tiles and let J be the S-expansion of the uniform interpretation of the class of tori in the class of finite Cartesian frames with the domain T . Let φ S denote the following monadic Σ 1 1 -sentence.
We will show that (T, β) |= φ S if and only if there exists an S-tilable torus D. First assume that there is an S-tilable torus D. Therefore, by Lemma 2.5, there is an expansion D * of D to the vocabulary σ ∪ S such that D * |= ϕ S . Since the class of tori is J-interpretable in the class of finite Cartesian frames with the domain T and D * |= ϕ S , it follows by Lemma 2.1 that there is a finite Cartesian frame C with the domain T and an expansion C * of C to the vocabulary τ ∪ T such that C * |= J(ϕ S ). Therefore C |= (∃P t ) Pt∈S J(ϕ S ). Since there exists a finite Cartesian frame with the domain T that satisfies (∃P t ) Pt∈S J(ϕ S ), we can conclude that (T, β) |= ∃X∃Y (∃P t ) Pt∈S (ϕ fcf ∧ J(ϕ S )).
If, on the other hand, it holds that (T, β) |= ∃X∃Y (∃P t ) Pt∈S ((ϕ fcf ∧ J(ϕ S )), it follows that there is a finite Cartesian frame C with the domain T such that C |= (∃P t ) Pt∈S J(ϕ S ). Therefore there exists an expansion C * of C to the vocabulary τ ∪ T such that C * |= J(ϕ T ). Since the class of tori is uniformly J-interpretable in the class of finite Cartesian frames with the domain T and C * |= J(ϕ S ), there is by Lemma 2.1 an expansion D * of a torus D to the vocabulary σ ∪ S such that D * |= ϕ S . Now by Lemma 2.5, D is S-tilable. Hence there is a torus which is S-tilable.
We have now shown that for any finite set of tiles S it holds that there is a torus which is S-tilable if and only if (T, β) |= φ S . Hence we have reduced the periodic tiling problem to the problem of deciding truth of {β}-sentences of weak monadic Σ 1 1 in (T, β). From the Σ 0 1 -completeness of the periodic tiling problem (Theorem 2.4), we conclude that the weak monadic Σ 1 1 -theory of the structure (T, β) is Σ 0 1 -hard. Therefore the membership problem of the weak monadic Π 1 1 -theory of the structure (T, β), is Π 0 1 -hard.
Corollary 5.5. Let T ⊆ R n be a set such that T extends linearly in 2D. Let C be the class of expansions (T, β, (P i ) i∈N ) of (T, β) with finite unary predicates. The first-order theory of C is undecidable.

Conclusions
We have studied first-order theories of geometric structures (T, β), T ⊆ R n , expanded with (finite) unary predicates. We have established that for n ≥ 2, the first-order theory of the class of all expansions of (R n , β) with arbitrary unary predicates is highly undecidable (Π 1 1 -hard). This refutes a conjecture from the article [1] of Aiello and van Benthem. In addition, we have established the following for any geometric structure (T, β) that extends linearly in 2D.
1. The first-order theory of the class of expansions of (T, β) with arbitary unary predicates is Σ 0 1 -hard.
2. The first-order theory of the class of expansions of (T, β) with finite unary predicates is Π 0 1 -hard.
Geometric structures that extend linearly in 2D include, for example, the rational plane (Q 2 , β) and the real unit rectangle ([0, 1] 2 , β), to name a few. The techniques used in the proofs can be easily modified to yield undecidability of first-order theories of a significant variety of natural restricted expansion classes of the affine real plane (R 2 , β), such as those with unary predicates denoting polygons, finite unions of closed rectangles, and real algebraic sets, for example. Such classes could be interesting from the point of view of applications.
In addition to studying issues of decidability, we briefly compared the expressivities of universal monadic second-order logic and weak universal monadic second-order logic. While the two are incomparable in general, we established that over any class of expansions of (R n , β), it is no longer the case. We showed that finiteness of a unary predicate is definable by a first-order sentence, and hence obtained translations from ∀WMSO into ∀MSO and from WMSO into MSO.
Our original objective to study weak monadic second order logic over (R n , β) was to identify decidable logics of space with distinguished regions. Due to the ubiquitous applicability of the tiling methods, this pursuit gave way to identifying several undecidable theories of geometry. Hence we shall look elsewhere in order to identify well behaved natural decidable logics of space. Possible interesting directions include considering natural fragments of first-order logic over expansions of (R n , β), and also other geometries. Related results could provide insight, for example, in the background theory of modal spatial logics.