The Isomorphism Problem On Classes of Automatic Structures Dietrich Kuske1, Jiamou Liu2, and Markus Lohrey2, ⋆ 1 Centre national dela recherchescientifique(CNRS) and Laboratoire Bordelais de Rechercheen Informatique(LaBRI), Bordeaux, France 2 Universit¨at Leipzig, Institut fu¨r Informatik, Germany 0 1 [email protected], [email protected], [email protected] 0 2 n Abstract. Automaticstructuresarefinitelypresentedstructureswheretheuniverseandall a relationscanberecognizedbyfiniteautomata.Itisknownthattheisomorphismproblemfor J 3 automaticstructuresiscompleteforΣ11;thefirstexistentialleveloftheanalyticalhierarchy. Several new results on isomorphism problems for automatic structures are shown in this 1 paper: (i) The isomorphism problem for automatic equivalence relations is complete for Π0 (first universal level of the arithmetical hierarchy). (ii) The isomorphism problem for ] 1 O automatic trees of height n ≥ 2 is Π20n−3-complete. (iii) The isomorphism problem for L automaticlinearordersisnotarithmetical.ThissolvessomeopenquestionsofKhoussainov, Rubin,and Stephan. . s c [ 1 Introduction 1 v The idea of an automatic structure goes back to Bu¨chi and Elgot who used finite automata to 6 8 decide,e.g.,Presburgerarithmetic [5].Automatondecidable theories [8] andautomatic groups[6] 0 are similar concepts. A systematic study was initiated by Khoussainov and Nerode [13] who also 2 coined the name “automatic structure”.In essence,a structure is automatic if the elements of the 1. universe can be representedas strings from a regular languageand everyrelation of the structure 0 can be recognized by a finite state automaton with several heads that proceed synchronously. 0 Automatic structures received increasing interest over the last years [1,3,11,14,15,16,22]. One of 1 the main motivations for investigating automatic structures is that their first-order theories can : v be decided uniformly (i.e., the input is an automatic presentation and a first-order sentence). i Automatic structures form a subclass of recursive (or computable) structures. A structure is X recursive,ifitsdomainaswellasallrelationsarerecursivesetsoffinitewords(ornaturals).Awell- r a studiedproblemforrecursivestructuresistheisomorphismproblem,whereitisaskedwhethertwo given recursive structures over the same signature (encoded by Turing-machines for the domain and all relations) are isomorphic. It is well known that the isomorphism problem for recursive structures is complete for the first level of the analytical hierarchy Σ1. In fact, Σ1-completeness 1 1 holds for many subclasses of recursive structures, e.g., for linear orders, trees, undirected graphs, Boolean algebras, Abelian p-groups, see [4,7]. Σ1-completeness of the isomorphism problem for a 1 class of recursive structures implies non-existence of a good classification (in the sense of [4]) for that class [4]. In [14], it was shown that also for automatic structures the isomorphism problem is Σ1- 1 complete. By a direct interpretation, it follows that for the following classes the isomorphism problem is still Σ1-complete [18]: automatic successor trees, automatic undirected graphs, auto- 1 matic commutative monoids, automatic partial orders, automatic lattices of height 4, and auto- matic 1-ary functions. On the other hand, the isomorphism problem is decidable for automatic ordinals[15] and automatic Booleanalgebras[14]. An intermediate class is the class of alllocally- finite automatic graphs,for which the isomorphismproblemis complete for Π0 (third levelof the 3 arithmetical hierarchy1) [21]. ⋆ The second and third author are supported by theDFG research project GELO. 1 For background on the arithmetical hierarchy see, e.g., [19]. For many interesting classes of automatic structures, the exact status of the isomorphism problem is open. In the recent survey [22] it was asked for instance, whether the isomorphism problem is decidable for automatic equivalence relations and automatic linear orders. For the latter class,this questionwas alreadyaskedin [15]. In this paper, we answer these questions. Our main results are: – The isomorphism problem for automatic equivalence relations is Π0-complete. 1 – The isomorphism problem for automatic successor trees of finite height k ≥ 2 (where the height of a tree is the maximal number of edges along a maximal path) is Π0 -complete. 2k−3 – Theisomorphismproblemforautomaticlinearordersishardforeverylevelofthearithmetical hierarchy. Most hardness proofs for automatic structures, in particular the Σ1-hardness proof for the iso- 1 morphism problem of automatic structures from [14], use transition graphs of Turing-machines (these graphs are easily seen to be automatic). This technique seems to fail for inherent reasons, when trying to prove our new results. The reason is most obvious for equivalence relations and linearorders.Thesestructuresaretransitivebutthe transitiveclosureofthe transitiongraphofa Turing-machine cannot be automatic in general (it’s first-order theory is undecidable in general). Hence, we have to use a new strategy. Our proofs are based on the undecidability of Hilbert’s 10th problem. Recall that Matiyasevich proved that every recursively enumerable set of natural numbersisDiophantine[17].ThisfactwasusedbyHonkalatoshowthatitisundecidablewhether the range of a rational power series is N [9]. Using a similar encoding, we show that the isomor- phismproblemforautomaticequivalencerelationsisΠ0-complete.Next,weextendourtechnique 1 in order to show that the isomorphism problem for automatic successor trees of height k ≥ 2 is Π0 -complete. In some sense, our result for equivalence relations makes up the induction base 2k−3 k = 2. Finally, using a similar but technically more involved reduction, we can show that the isomorphism problem for automatic linear orders is hard for every level of the arithmetical hier- archy.Infact,since our proofis uniformonthe levelsin the arithmeticalhierarchy,it followsthat the isomorphism problem for automatic linear orders is at least as hard as true arithmetic (the first-ordertheoryof(N;+,×)).Atthemomentitremainsopenwhethertheisomorphismproblem for automatic linear orders is Σ1-complete. 1 2 Preliminaries LetN ={1,2,3,...}.Letp(x ,...,x )∈N[x ,...,x ]beapolynomialwithnon-negativeinteger + 1 n 1 n coefficients. We define Img (p)={p(y ,...,y )|y ,...,y ∈N }. + 1 n 1 n + If p is not the zero-polynomial,then Img (p)⊆N . + + Detailsonthe arithmeticalhierarchycanbe foundforinstance in[19].With Σ0 wedenote the n nth (existential) level of the arithmetical hierarchy; it is the class of all subsets A ⊆ N such that there exists a recursive predicate P ⊆Nn+1 with A={a∈N|∃x ∀x ···Qx :(a,x ,...,x )∈P}, 1 2 n 1 n where Q = ∃ (Q = ∀) for n odd (even). The set of complements of Σ0-sets is denoted by Π0. n n By fixing some effective encoding of strings by natural numbers, we can talk about Σ0-sets and n Π0-sets of strings over an arbitrary alphabet. A typical example of a set, which does not belong n to the arithmetical hierarchy is true arithmetic, i.e., the first-order theory of (N;+,×), which we denote by FOTh(N;+,×). We assume basic terminologies and notations in automata theory (see, for example, [10]). For a fixed alphabet Σ, a non-deterministic finite automaton is a tuple A = (S,∆,I,F) where S is the set of states, ∆ ⊆ S ×Σ ×S is the transition relation, I ⊆ S is a set of initial states, and F ⊆ S is the set of accepting states. A run of A on a word u = a a ···a (a ,a ...,a ∈Σ) is 1 2 n 1 2 n 2 a word over ∆ of the form r = (q ,a ,q )(q ,a ,q )···(q ,a ,q ), where q ∈ I. If moreover 0 1 1 1 2 2 n−1 n n 0 q ∈ F, then r is an accepting run of A on u. We will only apply these definitions in case n >0, n i.e., we will only speak of (accepting) runs on non-empty words. Given two automata A = (S ,∆ ,I ,F ) and A = (S ,∆ ,I ,F ) over the same alphabet 1 1 1 1 1 2 1 2 1 1 Σ, we use A ⊎A to denote the automaton obtained by taking the disjoint union of A and A . 1 2 1 2 Note thatforanywordu∈Σ+,the numberofacceptingrunsofA ⊎A onuis equaltothe sum 1 2 of the numbers of accepting runs of A and A on u. We use A ×A to denote the Cartesian 1 2 1 2 product of A and A . It is the automaton (S ×S ,∆,I ×I ,F ×F ), where 1 2 1 2 1 2 1 2 ∆={((p ,p ),σ,(q ,q ))|(p ,σ,q )∈∆ ,(p ,σ,q )∈∆ }. 1 2 1 2 1 1 1 2 2 2 Then, clearly, the number of accepting runs of A ×A on a word u ∈ L(A )∩L(A ) is the 1 2 1 2 product ofthe numbers of accepting runs of A and A onu. Inparticular,if A is deterministic, 1 2 1 then the number of accepting runs of A ×A on u ∈L(A )∩L(A ) is the same as the number 1 2 1 2 of accepting runs of A on u. In the following, if A is a non-deterministic automaton and D is a 2 regularlanguage,we write D⊎A(resp. D∩A) for the automatonA ⊎A (resp. A ×A), where D D A is some deterministic automaton for the language D. D Weusesynchronous n-tape automatatorecognizen-aryrelations.Suchautomatahaveninput tapes,eachofwhichcontainsoneoftheinputwords.Thentapesarereadinparalleluntilallinput wordsareprocessed.Formally,letΣ =Σ∪{⋄}where⋄∈/ Σ.Forwordsw ,w ,...,w ∈Σ∗,their ⋄ 1 2 n convolution is a wordw ⊗···⊗w ∈(Σn)∗ with length max{|w |,...,|w |}, andthe kth symbol 1 n ⋄ 1 n of w ⊗···⊗w is (σ ,...,σ ) where σ is the kth symbolof w if k ≤|w |, and σ =⋄ otherwise. 1 n 1 n i i i i An n-ary relation R is FA recognizable if the set of all convolutions of tuples (w ,...,w )∈R is 1 n a regular language. A relational structure S consists of a domain D and atomic relations on the set D. We will only consider structures with countable domain. If S and S are two structures over the same 1 2 signature and with disjoint domains, then we write S ⊎S for the union of the two structures. 1 2 Hence, when writing S ⊎S , we implicitly express that the domains of S and S are disjoint. 1 2 1 2 More generally, if {S | i ∈ I} is a class of pairwise disjoint structures over the same signature, i then we denote with ⊎{S |i∈I} the union of these structures.A structure S is calledautomatic i over Σ if its domain is a regular subset of Σ∗ and each of its atomic relations is FA recognizable; any tuple P of automata that accept the domain and the relations of S is called an automatic presentation of S; in this case, we write S(P) for S. If an automatic structure S is isomorphic to a structure S′, then S is called an automatic copy of S′ and S′ is automatically presentable. In this paperwe sometimesabusethe terminologyreferringtoS′ assimply automaticandcallingan automaticpresentationofS alsoautomaticpresentationofS′.Wealsosimplifyourstatementsby saying “given/computeanautomatic structure S” for “given/computean automatic presentation P of a structure S(P)”. The structures (N;≤,+) and (Q;≤) are both automatic structures. On the other hand, (N;×) and (Q;+) have no automatic copies (see [12,22] and [24]). Consider FO+∃∞ +∃n,m, the first-order logic extended by the quantifiers ∃∞ (there exist infinitelymany)and∃n,mx(thereexistfinitelymanyandtheexactnumberiscongruentnmodulo m, where m,n ∈ N). The following theorem from [2,8,13,21] lays out the main motivation for investigating automatic structures. Theorem 1. From an automatic presentation P and a formula ϕ(x¯) ∈ FO+∃∞ +∃n,m in the signature of S(P), one can compute an automaton whose language consists of those tuples a¯ from S(P) that make ϕ true. In particular, the FO+∃∞+∃n,m theory of any automatic structure S is (uniformly) decidable. LetKbeaclassofautomaticstructuresclosedunderisomorphism.TheisomorphismproblemforK is the set of pairs (P ,P ) of automatic presentations with S(P )∼=S(P )∈K. The isomorphism 1 2 1 2 problemfortheclassofallautomaticstructuresiscompleteforΣ1—thefirstleveloftheanalytical 1 hierarchy[14](thisholdsalreadyforautomaticsuccessortrees).However,ifonerestrictstospecial subclasses of automatic structures, this complexity bound can be reduced. For example, for the class of automatic ordinals and also the class of automatic Boolean algebras, the isomorphism 3 problemis decidable.Another interesting result is that the isomorphismproblemfor locally finite automatic graphs is Π0-complete [21]. All these classes of automatic structures have the nice 3 property that one can decide whether a given automatic presentation describes a structure from this class. Theorem1 implies that this property also holds for the classes of equivalence relations, trees of height at most k, and linear orders, i.e., the classes considered in this paper. 3 Automatic Equivalence Structures An equivalence structure is of the form E = (D;E) where E is an equivalence relation on D. In this section, we prove that the isomorphism problem for automatic equivalence structures is Π0-complete.This resultcanbe alsodeducedfromourresultforautomatictrees(Section4).But 1 the case of equivalence structures is a good starting point for introducing our techniques. Let E be an automatic equivalence structure. Define the function h : N∪{ℵ } → N∪{ℵ } E 0 0 such that for all n ∈ N∪{ℵ }, h (n) equals the number of equivalence classes (possibly infinite) 0 E in E of size n. Note that for given n∈N∪{ℵ }, the value h (n) can be computed effectively: one 0 E can define in FO+∃∞ the set of all ≤ -least elements2 that belong to an equivalence class of llex size n. Given two automatic equivalence structures E = (D ;E ) and E = (D ;E ), deciding if 1 1 1 2 2 2 E1 ∼= E2 amounts to checking if hE1 = hE2. Therefore, the isomorphism problem for automatic equivalence structures is in Π0. 1 For the Π0 lower bound, we use a reduction from Hilbert’s 10th problem: Given a polynomial 1 p(x ,...,x )∈Z[x ,...,x ], decide whether the equation p(x ,...,x )=0 has a solution in N 1 k 1 k 1 k + (for technical reasons, it is useful to exclude 0 in solutions). This problem is well-known to be undecidable, see e.g. [17]. In fact, Matiyasevich constructed from a given (index of a) recursively enumerablesetX ⊆N apolynomialp(x ,...,x )∈Z[x ,...,x ]suchthatforalln∈N :n∈X + 1 k 1 k + if and only if ∃y ,...,y ∈N :p(n,y ,...,y )=0. Hence, the following set is Π0-complete: 2 k + 2 k 1 {(p (x),p (x))∈N[x ,...,x ]2 |∀c∈Nk :p (c)6=p (c)}. 1 2 1 k + 1 2 For a symbol a, let Σa denote the alphabet k Σa ={a,⋄}k\{(⋄,...,⋄)} k and let σ denote the ith component of σ ∈Σa. For e=(e ,...,e )∈Nk, write ae for the word i k 1 k + ae1 ⊗ae2 ⊗···⊗aek . For a language L, we write ⊗ (L) for the language k {u ⊗u ⊗···⊗u |u ,...,u ∈L}. 1 2 k 1 k Lemma 2. Thereexistsanalgorithmthat,givenanon-zeropolynomialp(x)∈N[x]inkvariables, constructs a non-deterministic automaton A[p(x)] on the alphabet Σa with L(A[p(x)]) = ⊗ (a+) k k such that for all c∈Nk: A[p(x)] has exactly p(c) accepting runs on input ac. + Proof. The automaton A[p(x)] is build by induction on the construction of the polynomial p, the base case is provided by the polynomials 1 and x . i LetA[1]be adeterministicautomatonaccepting⊗ (a+).Next,supposep(x ,...,x )=x for k 1 k i some i∈{1,...,k}. Let S ={q ,q }, I ={q } and F ={q }. Define ∆ as 1 2 1 2 ∆={(q ,σ,q )|j ∈{1,2},σ∈Σa,σ =a}∪{(q ,σ,q )|σ ∈Σa}. 1 j k i 2 2 k When the automaton A[p(x)] = (S,I,∆,F) runs on an input word ac, it has exactly c many i times the chance to move from state q to the final state q . Therefore there are exactly c =p(c) 1 2 i many accepting runs on ac. 2 ≤llex denotes thelength-lexicographical order on words. 4 Letp (x)andp (x)bepolynomialsinN[x].Assumeasinductivehypothesisthattherearetwo 1 2 automata A[p (x)] and A[p (x)] such that for i∈{1,2} the number of accepting runs of A[p (x)] 1 2 i on ac equals p (c). i For p(x) = p (x)+p (x), set A[p(x)] = A[p (x)]⊎A[p (x)]. Then, the number of accepting 1 2 1 2 runs of A[p(x)] on ac is p (c)+p (c). 1 2 Forp(x)=p (x)·p (x),letA[p(x)]=A[p (x)]×A[p (x)].Then,thenumberofacceptingruns 1 2 1 2 of A[p(x)] on ac is p (c)·p (c). ⊓⊔ 1 2 Let A = (S,I,∆,F) be a non-deterministic finite automaton with alphabet Σ. We define an automaton Run =(S,I,∆′,F) with alphabet ∆ and A ∆′ ={(p,(p,a,q),q)|(p,a,q)∈∆}. Let π : ∆∗ → Σ∗ be the projection morphism with π(p,a,q) = a. The following lemma is imme- diate from the definition. Lemma 3. For u ∈ ∆+ we have: u ∈ L(Run ) if and only if u forms an accepting run of A on A π(u) (which in particular implies π(u)∈L(A)). Thislemmaimpliesthatforallwordsw ∈Σ+,|π−1(w)∩L(Run )|equalsthenumberofaccepting A runs of A on w. Note that this does not hold for w =ε. Consider a non-zero polynomial p(x) ∈ N[x ,...,x ]. Let the automaton A = A[p(x)] satisfy 1 k the properties guaranteed by Lemma 2 and let Run be as defined above. Define an automatic A equivalencestructureE(p)whosedomainisL(Run )\{ε}.Moreover,twowordsu,v ∈L(Run )\ A A {ε} are equivalent if and only if π(u) = π(v). By definition and Lemma 2, a natural number y ∈N belongs to Img (p) if and only if there exists a word u∈L(A) with precisely y accepting + + runs, if and only if E(p) contains an equivalence class of size y. It is well known that the function C :N×N→N with C(x,y)=(x+y)2+3x+y (1) is injective (C(x,y)/2 defines a pairing function, see e.g. [9]). In the following, let E denote Good the countably infinite equivalence structure with ∞ if n∈{C(y,z)|y,z ∈N ,y 6=z} + h (n)= EGood (0 otherwise. Proposition 4. The set of automatic presentations P with S(P)∼=E is hard for Π0. Good 1 Proof. Fornon-zeropolynomialsp (x),p (x)∈N[x ,...,x ],definethefollowingthree(non-zero) 1 2 1 k polynomials from N[x ,...,x ] (with k≥2): 1 k S (x)=C(p (x),p (x)), S (x)=C(x +x ,x ), S (x)=C(x ,x +x ). 1 1 2 2 1 2 1 3 1 1 2 LetE(S ), E(S ),andE(S )be the automatic equivalencestructurescorrespondingtothese poly- 1 2 3 nomials according to the above definition. Finally, let E be the disjoint union of ℵ many copies 0 of these three equivalence structures. Ifp (c)=p (c)forsomec∈Nk,thenthereisy ∈N suchthatC(y,y)∈Img (S ).Therefore 1 2 + + + 1 inE thereisanequivalenceclassofsizeC(y,y)andnosuchequivalenceclassexistsinE .Hence Good E ≇E . Good Conversely, suppose that p (c) 6= p (c) for all c ∈ Nk. For all y,z ∈ N , E contains an 1 2 + + equivalenceclassofsizeC(y,z)ifandonlyifC(y,z)belongstoImg (S )∪Img (S )∪Img (S ), + 1 + 2 + 3 ifandonlyify 6=z,ifandonlyifE containsanequivalenceclassofsizeC(y,z).Therefore,for Good any s∈N , E contains an equivalence class of size s if and only if E contains an equivalence + Good class of size s. Hence E ∼=E . Good In summary, we have reduced the Π0-hard problem 1 {(p (x),p (x))∈N[x ,...,x ]2 |k ≥2,∀c∈Nk :p (c)6=p (c)} 1 2 1 k + 1 2 to the set of automatic presentations of E . Hence the proposition is proved. ⊓⊔ Good 5 Theorem 5. The isomorphism problem for automatic equivalence structures is Π0-complete. 1 Proof. Atthebeginningofthissection,wealreadyarguedthattheisomorphismproblemisinΠ0; 1 hardness follows immediately from Proposition 4, since E is necessarily automatic. ⊓⊔ Good 4 Automatic Trees A tree is a structure T =(V;≤), where ≤ is a partial order with a least element, called the root, and such that for every x∈V, the order ≤ restricted to the set {y |y ≤x} of ancestors of x is a finite linearorder.Thelevelofanodex∈V is|{y |y <x}|∈N.Theheight ofT isthesupremum of the levels of all nodes in V; it may be infinite, but this paper deals with trees of finite height only.One mayalsoview atreeasadirectedgraph(V,E),wherethere isanedge (u,v)∈E ifand only if u is the largest element in {x | x < v}. The edge relation E is FO-definable in (V;≤). In this paper, we assume the partial order definition for trees, but will quite often refer to them as graphs for convenience. We use T to denote the class of automatic trees with height at most n. n Let n be fixed. Then the tree order ≤ is FO-definable in T and this holds even uniformly for all trees fromT . Moreover,it is decidable whether a givenautomatic graphbelongs to T (since the n n class of trees of height n can be axiomatized in first-order logic). As a corollary to Proposition 4, we get immediately that the isomorphism problem for auto- matic trees of height at most 2 is undecidable: Corollary 6. There exists an automatic tree T of height 2 such that the set of automatic Good presentations P with S(P) ∼= T is Π0-hard. Hence, the isomorphism problem for the class T Good 1 2 of automatic trees of height at most 2 is Π0-hard. 1 Proof. Let E =(V;≡)be anautomatic equivalence structure.Now build the tree T(E)as follows: – the set of nodes is V ∪{r}∪{au | u ∈ V,u is ≤ -minimal in [u] } where r and a are two llex ≡ new letters – r is the root, its children are the words starting with a, and the children of au are the words from [u] . ≡ Then it is clear that T(E) is a tree of height at most 2 and that an automatic presentation for T(E) can be computed from one for E. Furthermore, E ∼= E if and only if T(E) ∼= T(E ). Good Good Hence, indeed, the statement follows from Proposition 4. ⊓⊔ The hardnessstatementofTheorem18belowis ageneralizationofthis corollaryto allthe classes T for n≥2. But first, we prove an upper bound for the isomorphism problem for T : n n Proposition 7. The isomorphism problem for the class T of automatic trees of height at most n n is – decidable for n=1 and – in Π0 for all n≥2. 2n−3 Proof. We firstshowthatT ∼=T is decidableforautomatictreesT ,T ∈T ofheightatmost1: 1 2 1 2 1 It suffices to compute the cardinality of T (i∈{1,2}) which is possible since the universes of T i 1 and T are regular languages. 2 Nowletn≥2andconsiderT ,T ∈T .LetT =(V ,E ),w.l.o.g.V ∩V =∅,andV =V ∪V , 1 2 n i i i 1 2 1 2 E = E ∪E . For any node u in V, let T(u) denote the subtree (of either T or T ) rooted at 1 2 1 2 u and let E(u) be the set of children of u. For k = n−2,n−3,...,0, we will define inductively a Π20n−2k−3-predicate isok(u1,u2) for u1,u2 ∈ V. This predicate expresses that T(u1) ∼= T(u2) provided u and u belong to level at least k. The result will follow since T ∼= T if and only if 1 2 1 2 iso (r ,r ) holds, where r is the root of T . 0 1 2 σ σ 6 Fork =n−2,thetreesT(u )andT(u )haveheightatmost2andwecandefineiso (u ,u ) 1 2 n−2 1 2 as follows: ℓ ∃x ,...,x ∈E(u ): x 6=x ∧ |E(x )|=κ 1 ℓ 1 i j i ∀κ∈N∪{ℵ0} ∀ℓ≥1 1≤i^<j≤ℓ i^=ℓ1 ⇐⇒ ∃y ,...,y ∈E(u ): y 6=y ∧ |E(y )|=κ 1 ℓ 2 i j i 1≤i<j≤ℓ i=1 ^ ^ In other words: for every κ∈N∪{ℵ }, u and u have the same number of children with exactly 0 1 2 κ children. Since FO+∃∞ is uniformly decidable for automatic structures, this is indeed a Π0- 1 sentence (note that 2n−2k−3 = 1 for k = n−2). For 0 ≤ k < n−2, we define iso (u ,u ) k 1 2 inductively as follows: ℓ ∃x ,...,x ∈E(u ): x 6=x ∧ iso (v,x ) 1 ℓ 1 i j k+1 i ∀v ∈E(u1)∪E(u2) ∀ℓ≥1 1≤i^<j≤ℓ i^=ℓ1 ⇐⇒ ∃y ,...,y ∈E(u ): y 6=y ∧ iso (v,y ) 1 ℓ 2 i j k+1 i 1≤i<j≤ℓ i=1 ^ ^ By quantifying over all v ∈ E(u )∪E(u ), we quantify over all isomorphism types of trees that 1 2 occurasasubtreerootedatachildofu oru .Foreachofthese isomorphismtypesτ,weexpress 1 2 that u and u have the same number of children x with T(x) of type τ. Since by induction, 1 2 iso (v,x )andiso (v,y )areΠ0 -statements,iso (u ,u ) isa Π0 -statement. ⊓⊔ k+1 i k+1 i 2n−2k−5 k 1 2 2n−2k−3 The rest of this section is devoted to proving that the isomorphism problem for the class T of n automatictreesofheightatmostn≥2isalsoΠ0 -hard(andthereforecomplete).SoletP (x ) 2n−3 n 0 be a Π0 -predicate.In the following lemma and its proof, all quantifiers with unspecified range 2n−3 run over N . + Lemma 8. For 2 ≤ i ≤ n, there are Π0 -predicates P (x ,x ,y ,x ,y ,...,x ,y ) such 2i−3 i 0 1 1 2 2 n−i n−i that (i) P (x) is logically equivalent to ∀x ∃y :P (x,x ,y ) for 2≤i<n and i+1 n−i n−i i n−i n−i (ii) ∀y :¬P (x,x ,y ) implies ∀x′ ≥x ∀y :¬P (x,x′ ,y ), n−i i n−i n−i n−i n−i n−i i n−i n−i where x=(x ,x ,y ,...,x ,y ). 0 1 1 n−i−1 n−i−1 Proof. The predicates P are constructed by induction, starting with i = n−1 down to i = 2 i where the construction of P does not assume that (i) or (ii) hold true for P . i i+1 Solet2≤i<nsuchthatP (x)isaΠ0 -predicate.ThenthereexistsaΠ0 -predicate i+1 2(i+1)−3 2i−3 P(x,x ,y ) such that P (x) is logically equivalent to n−i n−i i+1 ∀x ∃y :P(x,x ,y ) . n−i n−i n−i n−i But this is logically equivalent to ∀x ∀x′ ≤x ∃y :P(x,x′ ,y ) . (2) n−i n−i n−i n−i n−i n−i Let ϕ(x,x ) be n−i ∀x′ ≤x ∃y :P(x,x′ ,y ) . n−i n−i n−i n−i n−i Then for any x ∈N, n−i ¬ϕ(x,x ) =⇒ ∀x≥x :¬ϕ(x,x) . (3) n−i n−i Since ∀x′ ≤ x is a bounded quantifier, the formula ϕ(x,x ) belongs to Σ0 (see for n−i n−i n−i 2i−2 example [23, p. 61]). Thus there is a Π0 -predicate P (x,x ,y ) such that 2i−3 i n−i n−i ϕ(x,x ) ⇐⇒ ∃y :P (x,x ,y ) . (4) n−i n−i i n−i n−i 7 Therefore (2) (and therefore P (x)) is logically equivalent to ∀x ∃y : P (x,x ,y ). i+1 n−i n−i i n−i n−i Moreover, (4) ∀y :¬P (x,x ,y ) ⇐⇒ ¬ϕ(x,x ) n−i i n−i n−i n−i (3) =⇒ ∀x≥x :¬ϕ(x,x) n−i (4) ⇐⇒ ∀x≥x ∀y :¬P (x,x,y ) n−i n−i i n−i This shows (ii). ⊓⊔ Let us fix the predicates P for the rest of Section 4. By induction on 2≤i≤n, we will construct i the following trees: – test trees Ti ∈T for c∈N1+2(n−i) (which depend on P ) and c i + i – trees Ui ∈T for κ∈N ∪{ω} (we assume the standard order on N ∪{ω}). κ i + + TheideaisthatTci ∼=Uκi ifandonlyifκ=1+inf({xn−i |∀yn−i ∈N+ :¬Pi(c,xn−i,yn−i)}∪{ω}). We will not prove this equivalence, but the following simpler consequences for any c∈N1+2(n−i): + (P1) Pi(c) holds if and only if Tci ∼=Uωi. (P2) Pi(c) does not hold if and only if Tci ∼=Umi for some m∈N+. The first property is certainly sufficient for proving Π0 -hardness (with i = n), the second 2n−3 property and therefore the trees Ui for m < ω are used in the inductive step. We also need the m following property for the construction. (P3) No leaf of any of the trees Ti or Ui is a child of the root. c κ In the following section, we will describe the trees Ti and Ui of height at most i and prove (P1) c κ and (P2). Condition (P3) will be obvious from the construction. The subsequent section is then devoted to prove the effective automaticity of these trees. 4.1 Construction of trees We startwithafew definitions:Aforestisadisjointunionoftrees.LetH andH be twoforests. 1 2 TheforestHω isthedisjointunionofcountablymanycopiesofH .Formally,ifH =(V,E),then 1 1 1 Hω =(V ×N,E′) with ((v,i),(w,j))∈E′ if and only if (v,w)∈E and i=j. We write H ∼H 1 1 2 forHω ∼=Hω.ThenH ∼H iftheyareformed,uptoisomorphism,bythesamesetoftrees(i.e., 1 2 1 2 any tree is isomorphic to some connected component of H if and only if it is isomorphic to some 1 connected component of H ). If H is a forest and r does not belong to the domain of H, then we 2 denote with r◦H the tree that results from adding r to H as new least element. 4.1.1 Induction base: construction of T2 and U2 Fornotationalsimplicity, we write k for c κ 1+2(n−2). Hence, P is a k-ary predicate. By Matiyasevich’s theorem, we find two non-zero 2 polynomials p (x ,...,x ), p (x ,...,x )∈N[x], ℓ>k, such that for any c∈Nk: 1 1 ℓ 2 1 ℓ + P (c) holds ⇐⇒ ∀x∈Nℓ−k :p (c,x)6=p (c,x) . 2 + 1 2 For two numbers m,n ∈ N , let T[m,n] denote the tree of height 1 with exactly C(m,n) leaves, + where C is the injective polynomial function from (1). Then define the following forests: H2 = {T[m,n]|m,n∈N ,m6=n} + H2 =]H2⊎ {T[p (c,x)+x ,p (c,x)+x ]|x∈Nℓ−k,x ∈N } c 1 ℓ+1 2 ℓ+1 + ℓ+1 + J2 =H2⊎]{T[x,x]|x∈N ,x>κ} for κ∈N ∪{ω} κ + + ] 8 r r ∀xℓ+1∈N+ ∀m,n ∀x>κ ∀m,n ∀x∈Nℓ−k m6=n m6=n + T[p1(c,x)+xℓ+1, T[m,n] T[x,x] T[m,n] p2(c,x)+xℓ+1] The tree Tc2 The tree Uκ2 Fig.1. The tree T2 and U2 c κ Note that J2 = H2. Moreover, the forests J2 (κ ∈ N ∪{ω}) are pairwise non-isomorphic, since ω κ + C is injective. The trees T2 and U2, resp., are obtained from H2 and J2, resp., by taking countably many c κ c κ copies and adding a root: T2 =r◦(H2)ω U2 =r◦(J2)ω, (5) c c κ κ see Figure 1. The following lemma (stating (P1)for the Π0-predicate P , i.e., for i=2)can be provedin a 1 2 similar way as Theorem 5. Lemma 9. For any c∈Nk, we have: + P (c) holds ⇐⇒ H2 ∼J2 ⇐⇒ T2 ∼=U2 . 2 c ω c ω Proof. By (5), it suffices to show the first equivalence. So first assume P (c) holds. We have to 2 provethattheforestsH2 andJ2 =H2 containthesametrees(uptoisomorphism).Clearly,every c ω tree from H2 is contained in H2. For the other direction, let x∈Nℓ−k and x ∈N . Then the c + ℓ+1 + tree T[p (c,x)+x ,p (c,x)+x ] occurs in H2. Since P (c) holds, we have p (c,x)6=p (c,x) 1 ℓ+1 2 ℓ+1 c 2 1 2 and therefore p (c,x)+x 6=p (c,x)+x . Hence this tree also occurs in H2. 1 ℓ+1 2 ℓ+1 Conversely suppose H2 ∼ H2 and let x ∈ Nℓ−k. Then the tree T[p (c,x)+1,p (c,x)+1] c + 1 2 occurs in H2 and therefore in H2. Hence p (c,x) 6= p (c,x). Since x was chosen arbitrarily, this c 1 2 implies P (c). ⊓⊔ 2 Now consider the forest H2 once more. If it contains a tree of the form T[m,m] for some m c (necessarily m ≥ 2), then it contains all trees T[x,x] for x ≥ m. Hence, H2 ∼ J2 for some c κ κ∈N ∪{ω}, which implies T2 ∼=U2 for some κ∈N ∪{ω}. Thus, with Lemma 9 we get: + c κ + P (c) does not hold ⇐⇒ T2 6∼=U2 ⇐⇒ ∃m∈N :T2 ∼=U2 2 c ω + c m Hence we proved the following lemma, which states (P2) for the Π0-predicate P , i.e., for i=2. 1 2 Lemma 10. For any c∈Nk, we have: + P (c) does not hold ⇐⇒ ∃m∈N :T2 ∼=U2 . 2 + c m This finishes the construction of the trees T2 and U2 for κ ∈ N ∪{ω}, and the verification of c κ + properties (P1) and (P2). Clearly, also (P3) holds for T2 and U2 (all maximal paths have length c κ 2). 4.1.2 Induction step: construction of Ti+1 and Ui+1 For notational simplicity, we write c κ again k for 1+2(n−i−1) such that P is a k-ary predicate and P a (k+2)-ary one. i+1 i Wenowapply the inductionhypothesis.Foranyc∈Nk, x,y ∈N , κ∈N ∪{ω}letTi and + + + cxy Ui be trees of height at most i such that: κ 9 r r ∀x,m∈N+ ∀x,y∈N+ ∀x,m∈N+ ∀1≤x<κ ... ... ... ... |{z} |{z} |{z} |{z} x x x x Ui Ti Ui Ui m cxy m ω The treeTci+1 The tree Uκi+1 Fig.2. The tree Ti+1 and Ui+1 c κ – Pi(c,x,y) holds if and only if Tcixy ∼=Uωi. – Pi(c,x,y) does not hold if and only if Tcixy ∼=Umi for some m∈N+. In a first step, we build the trees T′ and U′ (x ∈ N ) from Ti and Ui, resp., by adding x cxy κ,x + cxy κ leaves as children of the root. This ensures Tc′xy ∼=Tc′x′y′ ⇐⇒ x=x′∧Tcixy ∼=Tcix′y′ and (6) Tc′xy ∼=Uκ′,x′ ⇐⇒ x=x′∧Tcixy ∼=Uκi , (7) since, by property (P3), no leaf of any of the trees Ti or Ui is a child of the root. Next, we cxy κ collect these trees into forests as follows: Hi+1 = {U′ |x,m∈N } , m,x + Hi+1 =H]i+1⊎ {T′ |x,y ∈N } , and c cxy + Ji+1 =Hi+1⊎]{U′ |1≤x<κ} for κ∈N ∪{ω}. κ ω,x + ] ThetreesTi+1 andUi+1,resp.,arethenobtainedfromtheforestsHi+1 andJi+1,resp.,bytaking c κ c κ countably many copies and adding a root: Ti+1 =r◦(Hi+1)ω and Ui+1 =r◦(Ji+1)ω, (8) c c κ κ see Figure 2. Note that the height of any of these trees is one more than the height of the forests defining themandthereforeatmosti+1.SincenoneoftheconnectedcomponentsoftheforestsHi+1 and c Ji+1 is a singleton,none ofthe trees in(8)has a leafthatis a childofthe rootandtherefore(P3) κ holds. Lemma 11. For all c∈Nk we have + Pi+1(c) holds ⇐⇒ Hci+1 ∼Jωi+1 ⇐⇒ Tci+1 ∼=Uωi+1 . Proof. Again, we only have to prove the first equivalence. FirstassumeHi+1 ∼Ji+1 andletx≥1bearbitrary.Wehavetoexhibitsomey ≥1suchthat c ω Pi(c,x,y)holds.NotethatUω′,x belongstoJωi+1 andthereforetoHci+1.SinceUω′,x 6∼=Um′ ,x′ forany m,x,x′ ∈N+, this implies the existence of x′,y′ ≥1 with Tc′x′y′ ∼=Uω′,x. By (7), this is equivalent with x = x′ and Tcixy′ ∼= Uωi. Now the induction hypothesis implies that Pi(c,x,y′) holds. Since x≥1 was chosen arbitrarily,we can deduce P (c). i+1 Conversely suppose P (c). Let T belong to Hi+1. By the induction hypothesis, it is one of i+1 c the trees U′ for some x ∈ N , κ ∈ N ∪{ω}. In any case, it also belongs to Ji+1. Hence it κ,x + + ω remainsto showthatanytreeofthe formU′ belongsto Hi+1.So letx∈N .Then,byP (c), ω,x c + i+1 thereexistsy ∈N+ withPi(c,x,y).Bytheinductionhypothesis,wehaveTcixy ∼=Uωi andtherefore T′ ∼=U′ (which belongs to Hi+1 by the very definition). ⊓⊔ cxy ω,x c 10