{'fraction_non_alphanumeric': 0.0549276019966173, 'fraction_numerical': 0.009941834082752362, 'mean_word_length': 3.595109468296844, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Automatic Structures: Richness and Limitations

We study the existence of automatic presentations for various algebraic structures. An automatic presentation of a structure is a description of the universe of the structure by a regular set of words, and the interpretation of the relations by synchronised automata. Our first topic concerns characterising classes of automatic structures. We supply a characterisation of the automatic Boolean algebras, and it is proven that the free Abelian group of infinite rank, as well as certain Fraisse limits, do not have automatic presentations. In particular, the countably infinite random graph and the random partial order do not have automatic presentations. Furthermore, no infinite integral domain is automatic. Our second topic is the isomorphism problem. We prove that the complexity of the isomorphism problem for the class of all automatic structures is \Sigma_1^1-complete.


Introduction
Classes of infinite structures with nice algorithmic properties (such as decidable model checking) are of increasing interest in a variety of fields of computer science. For instance the theory of infinite state transition systems concerns questions of symbolic representations, model checking, specification and verification. Also, string query languages in databases may be captured by (decidable) infinite string structures. In these and other areas there has been an effort to extend the framework of finite model theory to infinite models that have finite presentations.
Automatic structures are (usually) infinite relational structures whose domain and atomic relations can be recognised by finite automata operating synchronously on their input. Consequently, automatic structures have finite presentations and are closed under first order interpretability (as well as some of extensions of first order logic). Moreover, the model checking problem for automatic structures is decidable. Hence automatic structures and tools developed for their study are well suited to these fields of computer science, see for instance [2].
From a computability and logical point of view, automatic structures are used to provide generic examples of structures with decidable theories, to investigate the relationship between automata and definability, and to refine the ideas and approaches in the theory of computable structures. This paper investigates the problem of characterising automatic structures in algebraic, model theoretic or logical terms.
Specifically this paper addresses two foundational problems in the theory of automatic structures. The first is that of providing structure theorems for classes of automatic structures. Fix a class C of structures (over a given signature), closed under isomorphism. For instance, C may be the class of groups (G, ·) or the class of linear orders (L, ≤). A structure theorem should be able to distinguish whether a given member of C has an automatic presentation or not (a special case of this is telling whether a given structure is automatically presentable or not). This usually concerns the interactions between the combinatorics of the finite automata presenting the structures and properties of the structures themselves. The second problem, which is related to the first, is the complexity of the isomorphism problem for classes of automatic structures. Namely, fix a class of automatic structures C. The isomorphism problem asks, given automatic presentations of two structures from C, are the structures isomorphic?
With regard to the first problem, we provide new techniques for proving that some foundational structures in computer science and mathematics do not have automatic presentations. For example, we show that the Fraïssé limits of many classes of finite structures, such as finite partial orders or finite graphs, do not have automatic presentations. This shows that the infinite random graph and random partial order do not have automatic presentations. The idea is that the finite amount of memory intrinsic to the finite automata presenting the structure can be used to extract algebraic and model theoretic properties (invariants) of the structure, and so used to classify such structures up to isomorphism. This line of research has indeed been successful in investigating automatic ordinals, linear orders, trees and Boolean algebras. For example there is a full structure theorem for the automatically presentable ordinals; namely, they are those strictly less than ω ω [7]. There are also partial structure theorems saying that automatic linear orders and automatic trees have finite Cantor-Bendixson rank [13]. In this paper we provide a structure theorem for the (infinite) automatic Boolean algebras; namely, they are those isomorphic to finite products of the Boolean algebra of finite and co-finite subsets of N.
With regard to the second problem, it is not surprising that the isomorphism problem for the class of all automatic structures in undecidable [5]. The reason for the undecidability is that the configuration space of a Turing machine, considered as a graph, is an automatic structure. Moreover, the reachability problem in the configuration space is undecidable. Thus with some extra work, as in [4] or [11], one can reduce the reachability problem to the isomorphism problem for automatic structures. In addition, the isomorphism problem for automatic ordinals [13] and Boolean algebras (Corollary 3.5) is decidable. For equivalence structures it is in Π 0 1 (though not more is known), and for configuration spaces of Turing machines is Π 0 3 -complete [16].
Hence it is somewhat unexpected that the complexity of the isomorphism problem for the class of automatic structures is Σ 1 1 -complete. The Σ 1 1 -completeness is proved by reducing the isomorphism problem for computable trees, known to be Σ 1 1 -complete [9], to the isomorphism problem for automatic structures.
The two problems are related in the following way. If one has a 'nice' structure theorem for a class C of automatic structures, then one expects that the isomorphism problem for C be computationally 'reasonable'. For instance, as corollaries of the structure theorems for automatic ordinals and for automatic Boolean algebras, one obtains that their corresponding isomorphism problems are decidable. In contrast, the Σ 1 1 -completeness of the isomorphism problem of the class of all automatic structures tells us that the language of first order arithmetic is not powerful enough to give a structure theorem for the class of all automatic structures. In other words we should not expect a 'nice' structure theorem for the class of all automatic structures.
Here is an outline of the rest of the paper. The next section is a brief introduction to the basic definitions. Section 3 provides some counting techniques sufficient to prove non-automaticity of many classical structures such as fields, integral domains and Boolean algebras. Section 4 provides a technique that is used to show non-automaticity of several structures, such as the infinite random graph and the random partial order. The last section is devoted to proving that the isomorphism problem for automatic structures is Σ 1 1 -complete. Finally, we note that automatic structures can be generalised in several directions: for instance, by using finite automata on infinite strings [4,5], finite ranked trees [4,1], or finite unranked trees [14]. Although this paper only deals with the finite word case, some of the ideas presented here should give rise to a better understanding of the generalisations. Indeed, Delhommé, who independently proved that the random graph has no automatic presentation (using a similar technique as the one presented here) has extended the technique to tree-automatic structures [7]. The authors would like to thank referees for comments on improvement of this paper.

Preliminaries
A thorough introduction to automatic structures can be found in [4] and [12]. We assume familiarity with the basics of finite automata theory though to fix notation the necessary definitions are included. A finite automaton A over an alphabet Σ is a tuple (S, ι, ∆, F ), where S is a finite set of states, ι ∈ S is the initial state, ∆ ⊂ S × Σ × S is the transition table and F ⊂ S is the set of final states. A computation of A on a word σ 1 σ 2 . . . σ n (σ i ∈ Σ) is a sequence of states, say q 0 , q 1 , . . . , q n , such that q 0 = ι and (q i , σ i+1 , q i+1 ) ∈ ∆ for all i ∈ {0, 1, . . . , n − 1}. If q n ∈ F , then the computation is successful and we say that automaton A accepts the word. The language accepted by the automaton A is the set of all words accepted by A. In general, D ⊂ Σ ⋆ is finite automaton recognisable, or regular, if D is the language accepted by a finite automaton A.
The following definitions extends recognisability to relations of arity n, called synchronous n-tape automata. A synchronous n-tape automaton can be thought of as a one-way Turing machine with n input tapes [8]. Each tape is regarded as semi-infinite having written on it a word in the alphabet Σ followed by an infinite succession of blanks, ⋄ symbols. The automaton starts in the initial state, reads simultaneously the first symbol of each tape, changes state, reads simultaneously the second symbol of each tape, changes state, etc., until it reads a blank on each tape. The automaton then stops and accepts the n-tuple of words if it is in a final state. The set of all n-tuples accepted by the automaton is the relation recognised by the automaton. Here is a definition.
where 3 is a symbol not in Σ. The convolution of a tuple (w 1 , · · · , w n ) ∈ Σ ⋆n is the string ⊗(w 1 , · · · , w n ) of length max i |w i | over alphabet (Σ ⋄ ) n defined as follows. Its k'th symbol is (σ 1 , . . . , σ n ) where σ i is the k'th symbol of w i if k ≤ |w i | and ⋄ otherwise.
The convolution of a relation R ⊂ Σ ⋆n is the relation ⊗R ⊂ (Σ ⋄ ) n⋆ formed as the set of convolutions of all the tuples in R. That is ⊗R = {⊗w | w ∈ R}.
Definition 2.2. An n-tape automaton on Σ is a finite automaton over the alphabet (Σ ⋄ ) n . An n-ary relation R ⊂ Σ ⋆n is finite automaton recognisable (in short FA recognisable) or regular if its convolution ⊗R is recognisable by an n-tape automaton.
We now relate n-tape automata to structures. A structure A consists of a countable set A called the domain and some relations and operations on A. We may assume that A only contains relational predicates as the operations can be replaced with their graphs. We The relation R i are sometimes called basic or atomic relations. We assume that the function i → n i is always a computable one. Definition 2.3. A structure A is automatic over Σ if its domain A ⊂ Σ ⋆ is finite automata recognisable, and there is an algorithm that for each i produces a finite automaton recognising the relation R A i ⊂ (Σ ⋆ ) n i . A structure is called automatic if it is automatic over some alphabet. If B is isomorphic to an automatic structure A, then call A an automatic presentation of B and say that B is called automatically presentable (over Σ).
An example of an automatic structure is the word structure ({0, 1} ⋆ , L, R, E, ), where for all x, y ∈ {0, 1} ⋆ , L(x) = x0, R(x) = x1, E(x, y) iff |x| = |y|, and is the lexicographical order. The configuration graph of any Turing machine is another example of an automatic structure. Examples of automatically presentable structures are (N, +), (N, ≤), (N, S), the group (Z, +), the order on the rationals (Q, ≤), and the Boolean algebra of finite or cofinite subsets of N. Note that every finite structure is automatically presentable. We use the following important theorem without reference.
Theorem 2.1. [12] Let A be an automatic structure. There exists an algorithm that from a first order definition (with possible use of the additional quantifier 'there exists infinitely many') in A of a relation R produces an automaton recognising R.

Proving Non-Automaticity via Counting
The first technique for proving non-automaticity was presented in [12] and later generalised in [4]. The technique is based on a pumping argument and exhibits the interplay between finitely generated (sub) algebras and finite automata. We briefly recall the technique for completeness.
A relation R ⊂ (Σ ⋆ ) n is called locally finite if there exists k, l with k + l = n so that for everyā (of size k) there are at most a finite number ofb (of size l) such that (ā,b) ∈ R. We write R ⊂ (Σ ⋆ ) k+l . For b = (b 1 , · · · , b m ), write b ∈ b to mean b = b i for some i.
We start with the following elementary but important proposition.
Proposition 3.1. Let R ⊂ (Σ ⋆ ) k+l be locally finite, with k and l as in the definition above. Suppose further that R is a regular relation, and that the automaton for ⊗(R) has p states. Then max{|y| | y ∈ y} − max{|x| | x ∈ x} ≤ p for every (x, y) ∈ R where x has k elements and y has l elements.
Proof. Fix (x, y) ∈ R and say x ′ ∈ x has length max{|x| | x ∈ x} and say y ′ ∈ y has length max{|y| | y ∈ y}. So |y ′ | − |x ′ | > p implies that we can pump the string ⊗(x, y) between positions |x ′ | and |y ′ |. Then either the automaton for ⊗(R) accepts a string that is not in ⊗((Σ ⋆ ) n ) (because one of the components contains a subword of the form ⋄Σ) or otherwise it accepts strings of the form ⊗(x, z) for infinitely many z, contradicting that R is locally finite.
The typical application of this proposition is to prove that certain structures do not have automatic presentations. Assume A is an automatic structure in which each atomic relation R i is a graph of a function f i , i = 1, . . . , m. Let a 1 , a 2 , . . . be a sequence of some elements of A such that the relation {(a i , a j ) | j = i + 1} is regular. Consider the sequence . . , m}. By the proposition there is a constant p such that the length of all elements in G n is bounded by p · n. Therefore the number of elements in G n is bounded by 2 O(n) . Some combinatorial reasoning combined with this observation can now be applied to provide examples of structures with no automatic presentations, see [4] and [12]. For example, the following structures have no automatic presentation: (1) The free group on k > 1 generators; (2) The structure (N, |); (3) The structure (N, p), where p : N 2 → N is a bijection; (4) The term algebra generated by finitely many constants with at least one non-unary atomic operation 1 . Note that each of these structures has a decidable first order theory.
In the next sections we provide other more intricate techniques for showing that particular structures do not have automatic presentations. We then apply those techniques to give a characterisation of Boolean algebras that have automatic presentations. We also prove that (Q + , ×) has no automatic presentation and show that no infinite integral domain (in particular no infinite field) has an automatic presentation. We also study automaticity of some Fraïssé limits.
First we introduce a very useful property true of every automatic monoid (M, ×).
where k is the number of states in the automaton recognising the graph of ×.
Proof. Here logarithm is to base 2 and ⌈log n⌉ is the least i such that 2 i ≥ n. We use induction on m. For m = 1, the inequality becomes |s 1 | ≤ |s 1 |. If m > 1 let m = u + v where u = ⌊m/2⌋. Apply Proposition 3.1 to the graph of the monoid operation × and elements x = u i=1 s i and y = m i=u+1 s i . Then, by induction, | i s i | ≤ k + max(|x|, |y|) which is equal to k + max( max 1≤i≤u |s i | + k⌈log u⌉, max u+1≤i≤m |s i | + k⌈log v⌉), 1 Thus, elements of the term algebra are all the ground terms, and the operations are defined in a natural way: the value of a function f of arity n from the language on ground terms g1, . . . , gn is f (g1, . . . , gn). which is at most max i |s i | + k⌈log m⌉, since 1 + max(⌈log u⌉, ⌈log v⌉) ≤ ⌈log m⌉.
3.1. Automatic Boolean algebras. All finite Boolean algebras are automatic. Thus, in this section we deal with infinite countable Boolean algebras only. Our goal in this section is to give a full characterisation of infinite automatic Boolean algebras. Our characterisation can then be applied to show that the isomorphism problem for automatic Boolean algebras is decidable. Compare this with the result from computable algebra that the isomorphism problem for computable Boolean algebras is Σ 1 1 -complete [9]. Recall that a Boolean algebra B = (B, ∪, ∩, \, 0, 1) is a structure, where ∩ and ∪ and \ operations satisfy all the basic properties of the set-theoretic intersection, union, and complementation operations; In B the relation a ⊆ b ⇐⇒ a ∩ b = a is a partial order in which 0 is the smallest element, and 1 is the greatest element. The complement of an element b ∈ B is 1 \ b and is denoted byb.
A linearly ordered set determines a Boolean algebra in a natural way described as follows. Let L = (L, ≤) be a linearly ordered set with a least element. An interval is a The interval algebra denoted by B L is the collection of all finite unions of intervals of L, with the usual set-theoretic operations of intersection, union and complementation. Every interval algebra is a Boolean algebra. Moreover for every countable Boolean algebra A there exists an interval algebra B L isomorphic to A. We write L 1 × L 2 for the ordered sum l∈L 2 L 1 . Proof. The Boolean algebra B ω has an automatic presentation. Indeed, every element X of B ω can be represented by a string that codes the characteristic function of X. For example, the element [1, 3) ∪ [6, 10) can be represented by the string 0#0110001111 while N \ [3,4) can be represented by the string 1#0001. The boolean operations under this representation are regular, hence this is an automatic presentation of B ω . Now, B ω×i is isomorphic to the Cartesian product of i copies of B ω . Automatic structures are closed under the Cartesian product, and this completes the proof.
An atom in a Boolean algebra is a non-zero element a such that for every b ≤ a we have a = b or b = 0. Assume that B is an automatic Boolean algebra not isomorphic to any of the algebras B ω×i . Call two elements a, b ∈ B F -equivalent if the element (a ∩b) ∪ (b ∩ā) is a union of finitely many atoms. Factorise B with respect to the equivalence relation. Denote the factor algebra by B/F . Due to the assumption on B the algebra B/F is not finite. Call x in B large if its image in B/F is not a finite union of atoms or 0. For example the element 1 is large in B because B is not isomorphic to B ω×i . Call an element x in B infinite if there are infinitely many elements below it. Say that x splits y, for x, y ∈ B, if x ∩ y = 0 andx ∩ y = 0. For every large element l ∈ B there exists an element x ∈ B that splits l such that x ∩ l is large andx ∩ l is infinite. Also for every infinite element i ∈ B there exists an element x ∈ B that splits i such that either x ∩ i orx ∩ i is infinite.
We are now ready to prove the following theorem characterising infinite automatic Boolean algebras. Proof. We first construct a sequence T n of trees and elements a σ ∈ B corresponding to elements σ ∈ T n as follows. The tree T n will be a set of binary strings closed under prefixes. Therefore it suffices to define leaves of T n . Initially, we set T 0 = {λ} and a λ = 1. Assume that T n has been constructed. By induction hypothesis we may assume that the leaves of T n satisfy the following properties: (1) There exists at least one leaf σ such that a σ is large in B. Call the element a σ leading in T n . (2) There exist n leaves σ 1 , . . ., σ n such that each a σ i is an infinite element in B. Call these elements sub-leading elements. (3) The number of leaves in T n is greater than or equal to n · (n + 1)/2. (4) For every pair of leaves x, y of T n it holds that x ∩ y = 0.
For each leaf σ ∈ T n proceed as follows: (1) If σ is leading then find the first length lexicographical b that splits a σ such that both a σ ∩ b and a σ ∩b are infinite and one of them is large. Put σ0 and σ1 into T n+1 . Set a σ0 = a σ ∩ b and a σ1 = a σ ∩b.
(2) If σ is a sub-leading then find the first length lexicographical b that splits a σ such that one of a σ ∩ b or a σ ∩b is infinite. Put σ0 and σ1 into T n+1 . Set a σ0 = a σ ∩ b and a σ1 = a σ ∩b. Thus, we have constructed the tree T n+1 and elements a σ corresponding to the leaves of the tree. Note that the inductive hypothesis holds for T n+1 . This completes the definition of the trees. Lemma 3.2 is now used a number of times to justify the following steps. There exists a constant c 1 such that |a σǫ | ≤ |a σ | + c 1 for all defined elements a σ . Now for every n consider the set X n = {a σ | σ is a leaf of T n }. There exists a constant c 2 such that for all x ∈ X n we have |x| ≤ c 2 · n. Therefore X n ⊂ Σ c 2 ·n and the number of leaves in T n is greater than or equal to n · (n + 1)/2. Now for every pair of elements a, b in X n we have a ∩ b = 0. Therefore the number of elements of the Boolean algebra generated by the elements in X n is 2 |Xn| . Now let Y = {b 1 , . . . , b k } ⊂ X n . Consider the element ∪Y = b 1 ∪ . . . ∪ b k . By Lemma 3.2 applied to the binary operation ∪ there exists a constant c 3 such that | ∪ Y | ≤ c 3 · n. This gives us a contradiction because the number of elements generated by elements of X n clearly exceeds the cardinality of Σ O(n) . Corollary 3.5. It is decidable whether two automatic Boolean algebras are isomorphic.
Proof. Every automatic Boolean algebra is isomorphic to the Cartesian product of i copies of B ω , the Boolean algebra of finite and co-finite subsets of N. This i can be obtained effectively: Given an FA-presentation of a structure A in the signature of Boolean algebras, one can decide if A is a Boolean algebra, and if so compute the largest i such that A models "there are i disjoint elements each with infinitely many atoms below." Thus the isomorphism problem is decidable.

3.2.
Commutative monoids and Abelian groups. Note that for groups and monoids the term 'automatic' is used in a different way [6]. So to avoid confusion we say such a structure is 'FA presented' instead of saying it is 'automatic', and it is 'FA presentable' instead of 'automatically presentable'.
We prove that (Q + , ×), or equivalently, the free Abelian group of rank ω, is not FA presentable. Proof. Assume for a contradiction that an FA presentation of M is given . Let a 0 , a 1 , . . . be the prime numbers, viewed as elements of M , and listed in length-lexicographical order (with respect to this presentation of M ). Let r n be such that a 0 , . . . , a rn−1 are the primes of length at most n. Let By Lemma 3.2, each term a β i i has length at most n + k log β i ≤ n(1 + k). Again by the lemma, each product has length at most n(1 + k) + k log r n . Since all the products are distinct, 2 nrn ≤ |F n | ≤ |Σ| (1+k)n+k log rn .
Thus nr n ≤ log |Σ|[(1 + k)n + k log r n ] and r n ∈ O(log r n )/n, a contradiction because r n goes to infinity.
In [15] a stronger form is proved: if (N, +) r is a submonoid of M , then r ≤ log |Σ|(k + 1), where Σ is the alphabet and k the number of states needed to recognize the graph of the operation of M .
For a prime p, let Z[1/p] be the additive group of rationals of the form z/p m , z an integer, m ∈ N, and let Z p ∞ be the Prüfer group Z[1/p]/Z. Using representations to base p, it is easy to give FA presentations of these groups. Hence finite direct sums of those groups are also FA presentable. The proof of the following uses similar methods to the ones of Theorem 3.6.
Theorem 3.8. Let A (ω) denote the direct sum of infinitely many copies of the group A. The infinite direct sums Z[1/p] (ω) and Z (ω) p ∞ are not FA presentable. Proof. The proof is similar to the proof of Theorem 3.6. Suppose there is an FA presentation, and the i-th copy of the group in question is generated by all elements of the form a i /p m , i, m ∈ N, where the elements a 0 , a 1 , . . . are listed in length-lexicographical order. Define r n as before, and consider sums i<rn β i a i /p n , where 0 ≤ β i < p n . By Proposition 3.1, the definable operation x → x/p increases the length by at most a constant. So, using Lemma 3.2 each term β i a i /p n has length at most n + cn + kn log p for appropriate c ∈ N. Thus each sum has length at most c ′ n + k log r n . As there are p nrn distinct sums, this yields a contradiction as before.
3.3. Integral domains. In our next result we prove that no infinite integral domain is FA presentable. The following definition and lemma will be used in the next section as well.  (2) |D ≤n+k | ∈ Θ(|D ≤n |) for every constant k ∈ N.
Proof. Suppose the automaton recognising D has c states. Then for x ∈ P n (D) there exists z ∈ Σ ⋆ with |z| ≤ c such that xz ∈ D ( †). If n ≥ c then |P n (D)| ≤ |Σ| c × |P n−c (D)| since the map associating x ∈ P n (D) with the word consisting of the first n − c letters of x, is |Σ| c -to-one. But by using ( †) we see that |P n−c (D)| ≤ |D ≤n |. So |P n (D)| ≤ |Σ| c × |D ≤n | as required for the first part.
Fix k ∈ N. The mapping associating x ∈ D ≤n+k to the prefix of x of length n is |Σ| k -to-one. Hence Since D ≤n ⊂ D ≤n+k one has that |D ≤n | ≤ |D ≤n+k | and |D ≤n+k | ∈ O(|D ≤n |). This completes the proof of the lemma.
Recall that an integral domain (D, +, ·, 0, 1) is a commutative ring with identity such that x · y = 0 only if x = 0 or y = 0. For example every field is an integral domain. Proof. Suppose that (D, +, ·, 0, 1) is an infinite automatic integral domain. For each n ∈ N recall that D ≤n = {u ∈ D | |u| ≤ n}. We claim that there exists an x in D such that for all a, b, a ′ , b ′ ∈ D ≤n the condition a · x + b = a ′ · x + b ′ implies that a = a ′ and b = b ′ . We say such x separates D ≤n . Indeed, assume that such an x does not exist. Then for each for infinitely many x. Thus, for infinitely many x we have (a − a ′ ) · x = b ′ − b. But a = a ′ for otherwise also b = b ′ , contrary to assumption. Also there exist distinct x 1 and x 2 such that (a − a ′ ) · x 1 = (a − a ′ ) · x 2 . Since D is an integral domain we conclude that x 1 = x 2 which is a contradiction.
For each D ≤n we can select the length-lexicographically first x n separating D ≤n . Now the set E n = {y | ∃a, b ∈ D ≤n [y = ax n + b]} has at least |D ≤n | 2 many elements. However by Proposition 3.1 there exists a constant C such that E n ⊂ D ≤n+C , and by Lemma 3.9 the number of elements in D ≤n+C is in O(|D ≤n |). Thus, we have a contradiction. The theorem is proved.
Corollary 3.11. No infinite field is FA presentable.

Non-automaticity of some Fraïssé Limits
We briefly recall the definition of Fraïssé limit; see for instance [10]. In this section we restrict consideration to relational structures of finite signature, although the definition can be extended to signatures with function symbols. Let K be a class of finite structures closed under isomorphism. We say that K has the hereditary property (HP) if for A ∈ K every substructure of A is also in K. We say that K has the joint embedding property (JEP) if for all A, B ∈ K there exists C ∈ K such that A and B are both embeddable into C. We say that K is the age of a structure D if K coincides with the class of all finite substructures of D. It clear that the age of a structure has HP and JEP. In fact, it is not hard to prove that a class K has HP and JEP if and only if K coincides with the class of all finite substructure of some structure. However, note that non-isomorphic structures may have the same age. The following property guarantees that a class K with HP and JEP defines a unique structure up to isomorphism: Theorem 4.1. Let K be a nonempty class of finite structures which has HP, JEP, and AP. Then there exists a up to isomorphism unique countable structure A, called the Fraïssé limit of K, such that A is ultra-homogeneous and K is the age of A.   Example 4.4. Let K be the class of all finite graphs. The Fraïssé limit of K is known as the random graph. The following is an algebraic property that gives a characterisation (of the isomorphism type) of the random graph R = (V, E) (see [10]). For every disjoint partition X 1 , X 2 of every finite set Y of vertices there exists a vertex y such that for all x 1 ∈ X 1 and x 2 ∈ X 2 we have (y, x 1 ) ∈ E and (y, x 2 ) ∈ E. An explicit description of a random graph is the following. The set V of vertices is N and (n, m) ∈ E if in the binary representation of n, the term 2 m has coefficient 1.
Example 4.5. Let K be the class of all finite structures of a given signature L. The Fraïssé limit of K is known as the random L-structure.
Example 4.6. Denote by K p the complete graph (every pair of vertices are connected by an edge) on p vertices. For p ≥ 3, consider the class of all finite graphs which do not contain K p as a subgraph. The Fraïssé limit of K is known as the random K p -free graph. It has the following property. For every finite K p−1 -free subgraph, say with domain Y , and every disjoint partition X 1 , X 2 of Y , there exists a vertex x that is edge connected to every vertex in X 1 and no vertex in X 2 .
Recall that an anti-chain in a partial order is a set of pairwise incomparable elements. A chain in a partial order is a set in which every pair of elements are comparable.
Example 4.7. Let K be the class of all finite partially ordered set. The Fraïssé limit U of K is known as the random partial order. The following is an algebraic characterisation (of the isomorphism type) of the random partial order U = (U, ≤) (see [10]).
(1) If Z is a finite anti-chain of U and X and Y partition Z then there exists an element z ∈ U such that for every x ∈ X, z > x and for every y ∈ Y , element z is not comparable with y.
(2) If Z is a finite chain of U with least element x and largest element y then there exists an element z ∈ U such that z > x and z < y and z is not comparable with every v ∈ X \ {x, y}.
Example 4.8. Let K be the class of all finite Boolean algebras. The Fraïssé limit of K is isomorphic to the atomless Boolean algebra. This is the Boolean algebra that satisfies the following property. For every non-zero element x there exists a nonzero y strictly below x (that is y < x). By Theorem 3.4 this Fraïssé limit has no automatic presentation.
Example 4.9. Let K be the class of all finite Abelian p-groups. The Fraïssé limit of K is Note that G has no FA-presentation by Theorem 3.8.
Proof. The class K has HP, JEP and AP, so the Fraïssé limit exists. To show this Fraïssé limit is isomorphic to G, by [10,Lemma 7.1.4] it suffices to show that the age of G is K (clear) and that G is weakly homogeneous. To do so, suppose A ⊆ B are in K. We have to show that each embedding of A into G extends to an embedding of B. We may assume that |B : A| = p. Since B is a direct product of cyclic groups whose order is a power of p, either B = A × Z p or there is x ∈ A such that x is not divisible by p in A, and py = x for some y ∈ B. In either case we can extend the embedding.
Below are examples of Fraïssé limits that have automatic presentations.  We now provide some methods for proving non-automaticity of structures. These methods are then applied to prove that some Fraïssé limits do not have automatic presentations. Let A be an automatic structure over the alphabet Σ. Recall A ≤n = {v ∈ A | |v| ≤ n}. Let Φ(x, y) be a two variable formula in the language of this structure. We do not exclude that Φ(x, y) has a finite number of parameters from the domain of the structure. Now for each y ∈ A and n ∈ N we define the following function c Φ n,y : A ≤n → {0, 1}: We may drop the superscript Φ if there is no danger of ambiguity. In the next theorem we count the number of functions c Φ n,y using the fact that A is an automatic structure. We will use this as a criterion for proving that a given structure is not automatically presentable.
Theorem 4.2. Let A be an automatic structure and Φ(x, y) a first order formula (possibly with parameters) over the language of A. Then the number of functions c Φ n,y is in O(|A ≤n |). Proof. It is sufficient to prove that there is a constant k so that the number of functions of the form c n,y with y ∈ A ∩ Σ >n is at most k(|A ≤n |); this is because the y's in A ≤n can supply at most |A ≤n | many additional functions c n,y .
We claim that if (J y , Q y ) = (J y ′ , Q y ′ ) then c n,y = c n,y ′ . So suppose that (J y , Q y ) = (J y ′ , Q y ′ ), and let x ∈ A ≤n be given. Say ⊗(x, y) = σ 1 · · · σ k , and ⊗(x, y ′ ) = δ 1 · · · δ l . Then Then c n,y = c n,y ′ as claimed. Thus the number of functions of the form c n,y (y ∈ A ∩ Σ >n ) is at most the number of distinct pairs of the type (J y , Q y ). Now the number of Q y is at most 2 |Q| , so we concentrate on bounding the number of distinct functions J y by O(|A ≤n |).
Note that J y depends only on the first n letters of y in the sense that for |v| ≥ n and w, w ′ ∈ Σ ⋆ , J vw = J vw ′ . Now every y ∈ A ∩ Σ >n can be decomposed as y = vw with |v| = n. But the first part of Lemma 3.9 says that there are O(|A ≤n |) many such y, and so the result follows.
We give several applications of this theorem. First we apply the theorem to random graphs. Proof. Let (A, E) be an automatic presentation of the random graph and let Φ(x, y) be E(x, y). For every partition X 1 , X 2 of the set A ≤n of vertices there exists a vertex y such that for all x 1 ∈ X 1 and x 2 ∈ X 2 it holds that (x 1 , y) ∈ E and (x 2 , y) ∈ E. Hence, for every n, we have 2 |A ≤n | number of functions of type c n,y , contradicting Theorem 4.2. Hence the random graph has no automatic presentation. Proof. Let R be a non-unary predicate of L of arity k. Consider the following formula E(x, y) = R(x, y, a 1 , . . . , a k−2 ), where a 1 , . . . , a k−2 are fixed constants from the domain of A. It is not hard to prove that (A, E) is isomorphic to the random graph. But if A is automatically presentable then so is the random graph (A, E), hence contradicting the previous corollary.
The next goal is to show that the random K p -free graph has no automatic presentation. For this one needs to have a finer analysis than the one for the random graph. Let F = (V, E) be a finite graph. For a vertex v, write E(v) for the set of vertices adjacent to v. The degree of a vertex is the cardinality of E(v). Write ∆(F) for the maximum degree over all the vertices of F . Call a subgraph G with no edges an independent graph. Let α(F) be the number of vertices of a largest independent subgraph of F. K p denotes the complete graph on p vertices; that is, there is an edge between every pair of vertices. A graph is called K p -free if it has no subgraph isomorphic to K p . Lemma 4.5. For every p ≥ 3, there is a polynomial Q p (x) of degree p − 1 so that if F is a finite K p -free graph then Q p (α(F)) ≥ |F |.
Proof. We first prove that for every finite graph F, α(F) ≥ |F |/(∆(F) + 1). (4.1) Let G be an independent subgraph of F with a maximal number of vertices. That is, is the set of vertices in F adjacent to d. Then since G is maximal, for every x ∈ F there is some (not necessarily unique) d ∈ G such that x ∈ N (d). Hence F = ∪ d∈G N (d). But |N (d)| equals the degree (in F) of d plus one, and so the largest cardinality amongst the N (d)'s is at most ∆(F) + 1.
Hence |F | ≤ |G| × (∆(F) + 1) as required. The lemma is proved by induction on p. We will show that Q p (x) = Σ p−1 i=1 x i . For the case p = 3 note that for every vertex v, the subgraph on domain E(v) is independent. For otherwise if x, y ∈ E(v) were joined by an edge then the subgraph of F on {x, y, v} is K 3 . In particular, α(F) ≥ ∆(F). Combining this with Inequality (4.1), we get α(F)[α(F)+1] ≥ |F | as required.
For the inductive step, let F be a K p -free graph with p > 3. For every vertex v, the set E(v) is K p−1 -free for otherwise the subgraph of F on E(v)∪{v} has a copy of K p . Applying the induction hypothesis to E(v) such that |E(v)| = ∆(F), we get that E(v) must have an independent set X so that Q p−1 (|X|) ≥ |E(v)|. But X is also independent in F so Q p−1 (α(F)) ≥ ∆(F). Combining this with Inequality 4.1, we get that α(F)[Q p−1 (α(F)) + 1] ≥ |F |. Hence Q p (α(F)) ≥ |F | as required.
Corollary 4.6. For p ≥ 3, the random K p -free graph is not automatically presentable.
Proof. Fix p ≥ 3 and let (D, E) be a copy of the random K p -free graph. Then for every K p−1 -free subset K ⊂ D ≤n there exists an x ∈ D that is connected to every vertex in K and none in D ≤n \ K. So let G n be an independent subgraph of D ≤n so that Q p (|G n |) ≥ |D ≤n | as in the lemma. So letting Φ(x, y) be E(x, y), for a fixed n the number of functions c n,y as y varies over D is at least 2 |Gn| which is not linear in |D ≤n |. Hence by Theorem 4.2 the random K p graph D is not automatically presentable.
As the fourth application we prove that the random partial order U does not have an automatic presentation. For the proof we need the following combinatorial result that connects the size of a finite partial order (B, ≤) with the cardinalities of its chains and anti-chains. Proof. For 1 ≤ i ≤ c define X i as the set of all elements x such that the size of the largest chain in the subpartial order (↑ x) = {y ∈ B | x y} is i. Then the X i 's partition B. Moreover if a ≺ b and b ∈ X i then the size of the largest chain in (↑ a) is > i. Hence each X i is an anti-chain. Thus B can be partitioned into exactly c many anti-chains. If a is the size of the largest anti-chain in B then n ≤ ac as required.
Corollary 4.8. The random partial order U = (U, ≤) has no automatic presentation.
Proof. Recall that the random partial order has the following property (1) If Z is a finite anti-chain of U, and X and Y partition Z, then there exists an element z ∈ U such that z > x for every x ∈ X, and z is not comparable with y for every y ∈ Y . (2) If Z is a finite chain of U with least element x and largest element y, then there exists an element z ∈ U such that z > x and z < y and z is not comparable with every v ∈ X \ {x, y}. Assume that U has an automatic presentation (A, ≤). The formula Φ(x, y) is x ≤ y ∨ y ≤ x. Now let us take A ≤n .
Let Z be an anti-chain of A ≤n . Consider a subset X of Z. There exists an element y ∈ U such that for every x ∈ X, y > x and for every x ′ ∈ Z \ X, element y is not comparable with x ′ . From this we conclude that (⋆) #(functions of type c n,y ) ≥ 2 |Z| .
Let Z be a chain of A ≤n with least element v and largest element w. Then there exists an element y ∈ U such that y > v and y < w and y is not comparable with x for every x ∈ Z. From this we conclude that Let X be the largest anti-chain and Y be the largest chain of A ≤n with cardinalities a and c, respectively. Using Dilworth Lemma, substituting a for |Z| in (⋆), and c for |Z| in (⋆⋆), one can, with a little algebra, derive a contradiction to the bound in the statement of Theorem 4.2.

The Isomorphism Problem
The results in the previous sections give us hope that one can characterise automatic structures for certain classes of structures, e.g. Boolean algebras. However, in this section we prove that the isomorphism problem is Σ 1 1 -complete, thus showing that the problem is as hard as possible when considering the class of all automatic structures. Then complexity of the isomorphism problem for automatic structures consists in establishing the complexity of the set {(A, B) | A and B are automatic structures and A is isomorphic to B}.
Let M be a Turing machine over input alphabet Σ. Its configuration graph C(M) is the set of all configurations of M, with an edge from c to d if T can move from c to d in a single transition. The following is an easy lemma: Lemma 5.1. For every Turing machine T the configuration graph C(T ) is automatic. Further, the set of all vertices with outdegree (indegree) 0 is FA-recognisable.
Definition 5.1. A Turing machine R is reversible if every vertex in C(R) has both indegree and outdegree at most one. Now let R be a reversible Turing machine. Consider its configuration space C(R). The machine R can be modified so that it only halts in an accepting state; so, instead of halting in a rejecting state, it loops forever. Let x be a configuration of R. Consider the sequence: where E is the edge relation of the configuration space. Call this sequence the chain defined by x. We say that x is the base of chain X. If x does not have a predecessor then the chain defined by x is maximal. Since R is reversible, the configuration space C(R) is a disjoint union of maximal chains such that each chain is either finite, or isomorphic to (N, S), or isomorphic to (Z, S), where (x, y) ∈ S iff y = x + 1. It is known that every Turing machine can be converted into an equivalent reversible Turing machine (see for example [3]). Our next lemma states this fact and provides some additional structural information about the configuration space of reversible Turing machines: Lemma 5.2. A deterministic Turing machine can be converted into an equivalent reversible Turing machine R such that every maximal chain in C(R) is either finite or isomorphic to (N, S).
Denote by N ⋆ the set of all finite strings from N. A set T ⊂ N ⋆ is a special tree if T is closed downward, namely xy ∈ T implies x ∈ T , for x, y ∈ N ⋆ . We view these special trees as structures of the signature E, where E(x, y) if and only if y = xz for some z ∈ N. Thus, for every x ∈ N ⋆ the set {y | E(x, y)} can be thought as the set of all immediate successors of x.
A special tree T is recursively enumerable if the set T is the domain of the function computed by a Turing machine. We will use the following fact from computable model theory [9, Thm 3.2].
Lemma 5.3. The isomorphism problem for recursively enumerable special trees is Σ 1 1complete. In fact, the trees can be chosen to be subtrees of {2n : n ∈ N} * .
It is clear from the proof in [9] that the trees obtained are special (namely, subtrees of N ⋆ ). By a mere change of notation one obtains subtrees of {2n : n ∈ N} * . Lemma 5.4. The special tree N ⋆ has an automatic presentation A 1 .
Proof. Consider the prefix relation ≤ p on the set of all binary strings. The tree N ⋆ is isomorphic to the automatic successor tree A 1 = ({0, 1} ⋆ 1 ∪ {λ}; E 1 ), where E 1 is the set of all pairs (x, y) such that y is the immediate < p -successor of x. The isomorphism is established via the computable mapping sending n 1 . . . n k to 0 n 1 1 . . . 0 n k 1 and the root to λ.
Define S = {0, 1} ⋆ 1 ∪ {λ}. From now on we make the following conventions: (1) All special trees we consider will be viewed as subsets of (S, ≤ p ).
(2) The set of inputs for all Turing machines considered are strings from S. Each w ∈ S is identified with the initial configuration starting from w. (3) All Turing machines considered are reversible. (4) The domains of the functions computed by the Turing machines are assumed to be downward closed. Thus, these domains form recursively enumerable special trees. Our goal is to transform every recursively enumerable tree T ⊂ S into an automatic structure A R , where R is the reversible machine with domain T . The idea is to attach computations of R to the initial configurations in S. For all recursively enumerable trees T 1 and T 2 , T 1 and T 2 are isomorphic if and only if the automatic structures A R 1 and A R 2 are isomorphic. To ensure this we also have to attach infinitely many chains of each finite length to the initial configurations, for in that case the length of a halting computation does not make a difference.
Let R be a reversible Turing machine. A chain is an initial segment of (N, S). Let J be the graph consisting of infinitely many finite chains of every finite length. We denote by J the set of vertices of J , and the bases of the chains in J by b 1 , b 2 , . . .. The following is not hard to prove: Lemma 5.5. The graph J has an automatic presentation.
To construct A R , with every w ∈ A 1 associate a graph J w defined as follows. The vertex set of J w consists of all {(w, j) | j ∈ J} and edges between (w, j) and (w, j ′ ) if and only if (j, j ′ ) is an edge in J . Put connecting edges from w into each (w, b i ). Let A 2 be the graph consisting of A 1 and every J w and the connecting edges. Clearly, the graph A 2 is automatic.
To the set A 2 add all the configurations of the Turing machine R and all the edges of the configuration space of R. Note that each w ∈ S, which is an initial configuration of R is by Convention 2 already in A 2 . In addition, add a disjoint automatic copy of the graph J , and an automatic copy of infinitely many infinite chains. Call all chains added at this stage junk chains. The resulting graph is denoted by A R .
The proof of the following is straightforward and is omitted.
Lemma 5.6. The graph A R is automatic.
We summarise the structure of the graph A R . Firstly, in A R there are infinitely many junk chains of every (finite and infinite) length. An isolated chain of A R is one in which every vertex, except the base, has exactly one successor in A R . With each element w in A 1 there is an associated structure J w , which consists of infinitely many isolated chains of every finite length, and no infinite isolated chain. Finally with every initial configuration w (which is an element of A R and belongs to the infinitely branching tree A 1 ) there is an isolated chain with base w that is the computation path from the configuration space of Turing machine T . These observations prove the following.
Lemma 5.7. Let w be an initial configuration of A R . Then w is the base of infinitely many isolated chains of every finite length. Also the Turing machine T halts on w if and only if there is no infinite isolated chain with base w. In case T does not halt on w there is exactly one infinite isolated chain with base w.
Lemma 5.8. Let T 1 and T 2 be computable trees which are domains of reversible Turing machines R 1 and R 2 respectively. Then the trees T 1 and T 2 are isomorphic if and only if the automatic graphs A R 1 and A R 2 are isomorphic.
Proof. First note that the domain T of R consists of all w in A R that are initial configurations and are not the base of an infinite isolated chain. Hence T may be thought of as a subgraph of A R . Now suppose A R 1 is isomorphic to A R 2 via the map φ. Note that w is the base of an infinite isolated chain if and only if φ(w) is the base of an infinite isolated chain. Hence φ is an isomorphism between the trees T 1 and T 2 viewed as subgraphs of A R 1 and A R 2 respectively.
Conversely assume T 1 and T 2 are isomorphic via ψ (as before we may assume that T i is a subgraph of A R i ). Consider the sets I 1 and I 2 of all junk chains in A R 1 and A R 2 . There is an isomorphism between I 1 and I 2 , since both consist of infinitely many chains of every length (finite and infinite), independently of the chains of the configuration graphs that are not defined by initial configurations. Therefore it suffices to establish an isomorphism extending ψ on the rest of the structure.
If w ∈ T 1 then there is an isomorphism between all the isolated chains with base w and all the isolated chains with base ψ(w). Indeed each is the base of infinitely many isolated chains of every finite length and no isolated chain of infinite length, independently of the (possibly different) lengths of the finite computations of R 1 on w and R 2 on ψ(w). Hence extend ψ from the chains defined by elements of T 1 to the chains defined by elements of T 2 .
Suppose w ∈ T 1 and consider the set S 1 of immediate successors of w that are initial configurations but not in T 1 . Similarly write S 2 for the set of immediate successors of ψ(w) that are initial configurations but not in T 2 . By the extra condition in Lemma 5.3 that the trees be subtrees of {2n : n ∈ N} * , both S 1 and S 2 are infinite. So we may extend ψ to those immediate successors by adding a bijection between S 1 and S 2 .
Finally, for any initial configurations v 1 ∈ S−T 1 and v 2 ∈ S−T 2 , there is an isomorphism between the nodes in S extending v 1 and the ones extending v 2 . This isomorphism extends to the attached chains (as there is one infinite isolated chain and infinitely many isolated chains of each finite length). So we may extend ψ to an isomorphism of A R 1 and A R 2 .
Hence we have reduced the isomorphism problem for recursively enumerable trees to the isomorphism problem for automatic graphs. The main result now follows.
Theorem 5.9. The isomorphism problem for automatic structures is Σ 1 1 -complete.