Ambiguity Hierarchy of Regular Infinite Tree Languages

An automaton is unambiguous if for every input it has at most one accepting computation. An automaton is k-ambiguous (for k>0) if for every input it has at most k accepting computations. An automaton is boundedly ambiguous if it is k-ambiguous for some $k \in \mathbb{N}$. An automaton is finitely (respectively, countably) ambiguous if for every input it has at most finitely (respectively, countably) many accepting computations. The degree of ambiguity of a regular language is defined in a natural way. A language is k-ambiguous (respectively, boundedly, finitely, countably ambiguous) if it is accepted by a k-ambiguous (respectively, boundedly, finitely, countably ambiguous) automaton. Over finite words every regular language is accepted by a deterministic automaton. Over finite trees every regular language is accepted by an unambiguous automaton. Over $\omega$-words every regular language is accepted by an unambiguous B\"uchi automaton and by a deterministic parity automaton. Over infinite trees Carayol et al. showed that there are ambiguous languages. We show that over infinite trees there is a hierarchy of degrees of ambiguity: For every k>1 there are k-ambiguous languages that are not k - 1 ambiguous; and there are finitely (respectively countably, uncountably) ambiguous languages that are not boundedly (respectively finitely, countably) ambiguous.


Introduction
Degrees of Ambiguity. The relationship between deterministic and nondeterministic machines plays a central role in computer science. An important topic is a comparison of expressiveness, succinctness and complexity of deterministic and nondeterministic models. Various restricted forms of nondeterminism were suggested and investigated (see [Col15,HSS17] for recent surveys).
Probably, the oldest restricted form of nondeterminism is unambiguity. An automaton is unambiguous if for every input there is at most one accepting run. For automata over finite words there is a rich and well-developed theory on the relationship between deterministic, unambiguous and nondeterministic automata [HSS17]. All three models have the same expressive power. Unambiguous automata are exponentially more succinct than deterministic ones, and nondeterministic automata are exponentially more succinct than unambiguous ones [Lei81,Leu05].
Some problems are easier for unambiguous than for nondeterministic automata. As shown by Stearns and Hunt [SHI85], the equivalence and inclusion problems for unambiguous automata are in polynomial time, while these problems are PSPACE-complete for nondeterministic automata.
The complexity of basic regular operations on languages represented by unambiguous finite automata was investigated in [JJŠ16], and tight upper bounds on state complexity of intersection, concatenation and many other operations on languages represented by unambiguous automata were established.
It is well-known that the tight bound on the state complexity of the complementation of nondeterministic automata is 2 n . In [JJŠ16], it was shown that the complement of the language accepted by an n-state unambiguous automaton is accepted by an unambiguous automaton with 2 0.79n+log n states.
Many other notions of ambiguity were suggested and investigated. A recent paper [HSS17] surveys works on the degree of ambiguity and on various nondeterminism measures for finite automata on words.
An automaton is k-ambiguous if on every input it has at most k accepting runs; it is boundedly ambiguous if it is k-ambiguous for some k; it is finitely ambiguous if on every input it has finitely many accepting runs.
It is clear that an unambiguous automaton is k-ambiguous for every k > 0, and a k-ambiguous automaton is finitely ambiguous. The reverse implications fail. For -free automata over words (and over finite trees), on every input there are at most finitely many accepting runs. Hence, every -free automaton on finite words and on finite trees is finitely ambiguous. However, over ω-words there are nondeterministic automata with uncountably many accepting runs. Over ω-words and over infinite trees, finitely ambiguous automata are a proper subclass of the class of countably ambiguous automata, which is a proper subclass of nondeterministic automata.
The cardinality of the set of accepting computations of an automaton over an infinite tree t is bounded by the cardinality of the set of functions from the nodes of t to the state of the automaton, and therefore, it is at most continuum 2 ℵ 0 . The set of accepting computations on t is definable in Monadic Second-Order Logic (MSO). In Bárány et al. in [BKR10] it was shown that the continuum hypothesis holds for MSO-definable families of sets. Therefore, if the set of accepting computations of an automaton on a tree t is uncountable, then its cardinality is 2 ℵ 0 . Hence, there are exactly two infinite degrees of ambiguity.
The degree of ambiguity of a regular language is defined in a natural way. A language is k-ambiguous (respectively, boundedly, finitely, countably ambiguous) if it is accepted by a k-ambiguous (respectively, boundedly, finitely, countably ambiguous) automaton.
Over finite words, every regular language is accepted by a deterministic automaton. Over finite trees, every regular language is accepted by a deterministic bottom-up tree automaton and by an unambiguous top-down tree automaton. Over ω-words every regular language is accepted by an unambiguous Büchi automaton [Arn83] and by a deterministic parity automaton.
Hence, the regular languages over finite words, over finite trees and over ω-words are unambiguous.
In [CLNW10] it was shown that the aforementioned situation is different for infinite trees. Carayol et al. [CLNW10] proved that the language L ∃a of infinite full-binary trees over the alphabet {a, c}, defined as L ∃a := {t | t has at least one node labeled by a} is ambiguous. The proof is based on the undefinability of a choice function in Monadic Second-Order logic (MSO) [GS83,CL07].
Our results imply that the complement of every countable regular language is not finitely ambiguous. Since L ∃a is the complement (with respect to the alphabet {a, c}) of the language that consists of a single tree (i.e. the tree with all nodes labeled by c), we conclude that L ∃a is not finitely ambiguous (this strengthens the above mentioned result of [CLNW10]). Our main result states that over infinite trees there is a hierarchy of degrees of ambiguity: Theorem 1.1 (Hierarchy).
(2) There are finitely ambiguous languages that are not boundedly ambiguous.
(3) There are countably ambiguous languages that are not finitely ambiguous.
(4) There are uncountably ambiguous languages that are not countably ambiguous.
Some natural tree languages that witness items (1), (3) and (4) of Theorem 1.1 are described in the examples below. We have not found a "natural" finitely ambiguous language which is not boundedly ambiguous (Theorem 1.1(2)).
Examples 1.2. Let T ω Σ be the set of all infinite full-binary trees over an alphabet Σ. Let Σ k = {c, a 1 , a 2 , ..., a k }, and let L ¬a i := {t ∈ T ω Σ k | no node in t is labeled by a i } for 1 ≤ i ≤ n. Define: (1) L ¬a 1 ∨···∨¬a k := L ¬a 1 ∪ · · · ∪ L ¬a k . We show that this language is k-ambiguous, but is not (k − 1)-ambiguous (see Section 5). In [BS13] it was shown that L ¬a 1 ∨¬a 2 is two ambiguous.
(2) L ∃a 1 := {t ∈ T ω Σ 1 | there exists an a 1 -labeled node in t}. This is a countably ambiguous language that is not finitely ambiguous (see Section 4).
(3) L no−max −a 1 := {t ∈ T ω Σ 1 | above every a 1 -labeled node in t there is an a 1 -labeled node}. This is an uncountably ambiguous language that is not countably ambiguous (see Section 7).
Organization of the Paper: In Section 2 we recall notations and basic results about automata and monadic second-order logic. In Section 3 simple properties of languages are proved. Section 4 gives a sufficient condition for a language to be not finitely ambiguous. The proof techniques used in Section 4 refine the proof techniques of [CLNW10] -we rely on the fact that a choice function is not MSO-definable to obtain a lower bound for degree of ambiguity that is higher than the bound which was presented in [CLNW10]. Section 5 deals with k-ambiguous languages -for every k ∈ N, we describe a k-ambiguous language that is not (k − 1)-ambiguous. Section 6 provides an example of a finitely ambiguous language which is not boundedly ambiguous. Section 7 introduces a scheme for obtaining uncountably ambiguous languages from languages that are not boundedly ambiguous, and presents some natural examples of uncountably ambiguous languages. In Section 8, relying on the characterization of countable regular languages given by Niwiński [Niw91], we prove that every countable tree language is unambiguous. The conclusion is given in Section 9.
An extended abstract of this paper was published in [RT20]. Here we added the proofs that were sketched or missing in [RT20], presented natural examples of uncountably ambiguous languages (in Section 7), and added Section 8 in which we prove that countable languages are unambiguous using Niwiński's Representation for Countable Languages.

Preliminary
We recall here standard terminology and notations about trees, automata and logic [PP04,Rab69]. In Subsection 2.3 we also recall Gurevich-Shelah's theorem about undefinability of choice function and derive Lemma 2.5 which plays an important role in our proofs.
2.1. Trees. We view the set {l, r} * of finite words over alphabet {l, r} as the domain of a full-binary tree, where the empty word is the root of the tree, and for each node v ∈ {l, r} * , we call v · l the left child of v, and v · r the right child of v.
We define a tree order "≤" as a partial order such that ∀u, v ∈ {l, r} * : u ≤ v iff u is a prefix of v. Nodes u and v are incomparable -denoted by u ⊥ v -if neither u ≤ v nor v ≤ u; a set U of nodes is an antichain, if its elements are incomparable with each other.
We say that an infinite sequence If Σ is a finite alphabet, then a Σ-labeled full-binary tree t is a labeling function t : {l, r} * → Σ. We denote by T ω Σ the set of all Σ-labeled full-binary trees. We often use "tree" for "labeled full-binary tree." Given a Σ-labeled tree t and a node v ∈ {l, r} * , the tree t ≥v (called the subtree of t, Grafting. Given two labeled trees t 1 and t 2 and a node v ∈ {l, r} * , the grafting of t 2 on v in t 1 , denoted by t 1 [t 2 /v], is the tree t that is obtained from t 1 by replacing the subtree of t 1 rooted at v by t 2 . Formally, t(u) := t 2 (w) ∃w ∈ {l, r} * : u = v · w t 1 (u) otherwise More generally, given a tree t 1 , an antichain Y ⊆ {l, r} * and a tree t 2 , the grafting of t 2 on Y in t 1 , denoted by t 1 [t 2 /Y ], is obtained by replacing each subtree of t 1 rooted at a node y ∈ Y by the tree t 2 .
Tree Language. A language L over an alphabet Σ is a set of Σ-labeled trees. We denote by L := T ω Σ \ L the complement of L.
2.2. Automata. We define the following notions of automata: Parity ω-word Automata (PWA). A PWA is a tuple (Q A , Σ, Q I , δ, C) where Σ is a finite alphabet, Q is a finite set of states, Q I ⊆ Q is a set of initial states, δ ⊆ Q × Σ × Q is a transition relation, and C : Q → N is a coloring function. A run of A on an ω-word y = a 0 a 1 . . . is an infinite sequence ρ = q 0 q 1 . . . such that q 0 ∈ Q I , and (q i , a i , q i+1 ) ∈ δ for all i ∈ N. We say that ρ is accepting if the maximal number that occurs infinitely often in C(q 0 )C(q 1 ) . . . is even.
Language. We denote the set of all accepting runs of A on y by ACC(A, y). The language of A is defined as L(A) := {y ∈ Σ ω | ACC(A, y) = ∅}. Parity Tree Automata (PTA) on Infinite Trees. A PTA is a tuple (Q A , Σ, Q I , δ, C) where δ ⊆ Q × Σ × Q × Q, and Σ, Q, Q I , F are defined as in PWA. A computation of A on a tree t is a function φ : {l, r} * → Q such that φ( ) ∈ Q I , and ∀v ∈ {l, r} * : We say that φ is accepting if for each tree branch π = v 0 v 1 . . . , the maximal number that occurs infinitely often in C(φ(v 0 ))C(φ(v 1 )) . . . is even. Given a PTA A = (Q A , Σ, Q I , δ A , C A ) and a set Q ⊆ Q A , we define A Q := (Q A , Σ, Q , δ A , C A ) as the automaton obtained from A by replacing the set of initial states Q I with Q . For a singleton Q = {q}, we simplify this notation by A q := A Q .
Language. We denote the set of all accepting computations of A on t by ACC(A, t). The language of A is defined as L(A) := {t ∈ T ω Σ | ACC(A, t) = ∅}. A tree language is said to be regular if it is accepted by a PTA.
A state q ∈ Q of a PTA A is called useful if there is a tree t ∈ L(A), a computation φ ∈ ACC(A, t) and a node v ∈ {l, r} * such that φ(v) = q. Throughout the paper we will assume that all states of PTA are useful.
Degree of Ambiguity of an Automaton. We denote by |X| the cardinality of a set X.
The degree of ambiguity of A (notation da(A)) is defined by da(A) := k if A is kambiguous and either k = 1 or A is not k − 1 ambiguous, da(A) := f inite if A is finitely ambiguous and not boundedly ambiguous, da(A) := ℵ 0 if A is countably ambiguous and not finitely ambiguous, and da(A) := 2 ℵ 0 if A is not countably ambiguous.
We order the degrees of ambiguity in a natural way: i < j < f inite < ℵ 0 < 2 ℵ 0 , for i < j ∈ N.
Degree of Ambiguity of a Language. We say that a regular tree language L is unambiguous (respectively, k-ambiguous, finitely ambiguous, countably ambiguous) if it is accepted by an unambiguous (respectively, k-ambiguous, finitely ambiguous, countably ambiguous) automaton. We define da(L) := min A {da(A) | L(A) = L}.
Let τ be a relational signature. A structure (for τ ) is a tuple M = (D, {R M | R ∈ τ }) where D is a domain, and each symbol R ∈ τ is interpreted as a relation R M on D.
MSO-formulas use first-order variables, which are interpreted by elements of the structure, and monadic second-order variables, which are interpreted as sets of elements. Atomic MSO-formulas are of the following form: • R(x 1 , . . . , x n ) for an n-ary relational symbol R and first order variables x 1 , . . . , x n • x = y for two first-order variables x and y • x ∈ X for a first-order variable x and a second-order variable X MSO-formulas are constructed from the atomic formulas, using boolean connectives, the first-order quantifiers, and the second-order quantifiers.
We write ψ(X 1 , . . . , X n , x 1 , . . . , x m ) to indicate that the free variables of the formula ψ are X 1 , . . . , X n (second order variables) and x 1 , . . . , x m (first order variables). We write M |= ψ(A 1 , . . . , A n , a 1 , . . . a m ) if ψ holds in M when subsets A i are assigned to X i for i = 1, . . . , n and elements a i are assigned to variables x 1 , . . . , x m for i = 1, . . . , m.
Coding. Let ∆ be a finite set. We can code a function from a set D to ∆ by a tuple of unary predicates on D. This type of coding is standard, and we shall use explicit variables that range over such mappings and expressions of the form "F (u) = d" (for d ∈ ∆) in MSO-formulas, rather than their codings.
Formally, for each finite set ∆ we have second-order variables X ∆ 1 , X ∆ 2 , . . . that range over the functions from D to ∆, and atomic formulas X ∆ i (u) = d for d ∈ ∆ and u a first order variables [TB73]. Often the type of the second order variables will be clear from the context and we drop the superscript ∆.
Definable Relations. The powerset of D is denoted by P(D). We say that a relation R ⊆ P(D) n × D m is MSO-definable in a structure S with universe D if there is an MSOformula ψ(X 1 , . . . , X n , x 1 , . . . , x m ) such that R = {(D 1 , . . . , D n , u 1 , . . . , u m ) ∈ P(D) n ×D m | S |= ψ(D 1 . . . , D n , u 1 . . . , u m )}. An The unlabeled binary tree is the structure ({l, r} * , {E l , E r }) where E l and E r are binary symbols, respectively interpreted as It is easy to verify the correctness of the following lemma: Lemma 2.1. The following relations are MSO-definable in the unlabeled full-binary tree.
• "A set of nodes is a branch," "A set of nodes is an antichain." • Let A = (Q, Σ, Q I , δ, C) be a PTA. We use φ for a function {l, r} * → Q and σ for a function {l, r} * → Σ.
-"φ is a computation of A on the tree σ." -"φ is an accepting computation of A on the tree σ." The following two fundamental theorems were proved by Rabin in his famous 1969 paper [Rab69].
Theorem 2.2 (Rabin [Rab69]). A tree language is regular iff it is MSO-definable in the unlabeled binary tree structure.
A labeled tree is regular iff it has finitely many different subtrees. An equivalent definition is: a tree is regular iff its labeling is MSO-definable [Rab69]. Hence, for every regular Σ-labeled tree t 0 there is an MSO-formula ψ t 0 (σ Σ ), where σ Σ is the coding of {l, r} * → Σ, that is satisfied by t : {l, r} * → Σ iff t = t 0 .
Choice Function. A choice function is a mapping that assigns to each non-empty set of nodes one element from the set.
Theorem 2.4 (Gurevich and Shelah [GS83]). There is no MSO-definable choice function on the full-binary tree. The following lemma follows from Theorem 2.4. It plays a key role in our proofs in Section 4, where sufficient conditions are provided for a language to be not finitely ambiguous.
Lemma 2.5. There is no MSO-definable function that assigns to every non-empty antichain Y a finite non-empty subset X ⊆ Y .
Proof. Assume, for the sake of contradiction, that a function that returns a finite non-empty subset for each non-empty antichain is MSO-definable in the unlabeled full-binary tree, by an MSO-formula F initeAntichainSubset(X, Y ).
Claim 2.5.1 (Choice function over finite sets). There is an MSO-definable function that assigns to each non-empty finite set X ⊆ {l, r} * an element x ∈ X.
Proof. We first define a lexicographic order "≤ lex " on {l, r} * , by u ≤ lex v iff u is a prefix of v or u = w · l · u and v = w · r · v for some w, u , v ∈ {l, r} * .
It is easy to verify that ≤ lex is MSO-definable in the unlabeled full-binary tree. ≤ lex is a linear order, and therefore each non-empty finite set has exactly one ≤ lex -minimal element. We conclude that a finite set choice function is definable by F initeChoice(X, x) :="x is the ≤ lex -minimal element in X".
Let F initeChoice(X, x) be an MSO-formula that defines a function as in Claim 2.5.1. We will use formulas F initeAntichainSubset(X, Y ) and F initeChoice(X, x) to define a choice function by an MSO-formula Choice(X, x) which is the conjunction of the following conditions: (1) ∃Z : "Z is the set of ≤-minimal elements in X" For each non-empty set X there is a unique subset Z ⊆ X of the ≤-minimal elements in X. This set is a non-empty antichain, and therefore F initeAntichainSubset(Z, Y ) returns a finite subset Y ⊆ Z. Therefore, F initeChoice(Y, x) returns an element in Y . We conclude that Choice(X, x) returns an element x ∈ X and therefore defines a choice function in the unlabeled full-binary tree, in contradiction to Theorem 2.4.

Simple Properties of Automata and Languages
In this section some simple lemmas are collected.

A. Rabinovich and D. Tiferet
Vol. 17:3 infinitely often in the first coordinate of w and the maximal color that appears infinitely often in the second coordinate of w are both even. Therefore (by McNaughton's Theorem iff the maximal color that appears infinitely often in the first coordinate of w and the maximal color that appears infinitely often in the second coordinate of w are both even.
We will use the automata A 1 , A 2 and D to define a PTA B : Assume, for the sake of contradiction, that there exists t such that |ACC( Therefore, there is a tree branch π = v 0 , v 1 , . . . such that the maximal color that C 1 assigns to the states that occurs infinitely often in φ 1 (π) is odd. By definition of D we conclude that w : Hence, by definition of B we conclude that the sequence of colors that C B assigns to the states φ(π) is exactly w, and therefore φ / ∈ ACC(B, t) -a contradiction.
From Lemma 3.1, we obtain: Corollary 3.2. Boundedly, finitely and countably ambiguous tree languages are closed under finite union and intersection.
We often use implicitly the following simple Lemma.
Lemma 3.3 (Grafting). Let A be an automaton, t, t 1 trees, v ∈ {l, r} * and φ ∈ ACC(A, t), A similar lemma holds for general grafting. As an immediate consequence, we obtain the following lemma: Corollary 3.5. Let A be a boundedly (respectively, finitely, countably) ambiguous PTA with a set Q of useful states, and let Q ⊆ Q. Then A Q is boundedly (respectively, finitely, countably) ambiguous.
Lemma 3.6. Let L 1 and L 2 be two tree languages such that da(L 1 ) = da(L 2 ) and L 1 ⊆ L 2 . Then, there exists a tree t ∈ L 2 \ L 1 .
Let t ∈ L(A), and let g t be a function from ACC(A, t) to ACC(B, t) that maps each computation φ ∈ ACC(A, t) to a computation φ that assigns q B I to node , and φ(v) to other nodes. It is easy to see that φ ∈ ACC(B, t), and that g t is surjective, and therefore ∀t : |ACC(A, t)| ≥ |ACC(B, t)|, as requested.
Definition 3.8 (Moore machine). A Moore machine is a tuple M = (Σ, Γ, Q, q I , δ, out), where Σ is a finite input alphabet, Q is a finite set of states, q I ∈ Q is an initial state, δ : Q × Σ → Q is a transition function, Γ is an output alphabet, and out : Q → Γ is an output function.
Let us state another well-known characterization of regular trees.
Fact 3.11. A tree t is regular iff its labeling t : {l, r} * → Σ is definable by a Moore machine.

Not-Finitely Ambiguous Languages
We provide here sufficient conditions for a language to be not finitely ambiguous. These conditions will allow us to present some natural languages which are countably ambiguous and not finitely ambiguous, proving Theorem 1.1(3). In addition, these results are used in Sects. 5-7 where it is proved that for every k > 1 there is a language of ambiguity degree equal to k and there are languages with finite and uncountable degrees of ambiguity. First, we state our main technical result -Proposition 4.1. Then, we derive some consequences. Finally, a proof of Proposition 4.1 is given. Our proof relies on the fact that there is no MSO-definable function that assigns to every non-empty antichain Y a finite non-empty subset X ⊆ Y (Lemma 2.5), and our proof techniques refine the proof techniques of [CLNW10].
Recall that for trees t and t and an antichain Y , we denote by t[t /Y ] the tree obtained from t by grafting t at every node in Y .
Proposition 4.1. Let t 0 and t 1 be regular trees and L be a regular language such that t 0 ∈ L and t 0 [t 1 /Y ] ∈ L for every non-empty antichain Y . Then L is not finitely ambiguous.
Definition 4.2. For a tree language L over alphabet Σ, we denote by Subtree(L) the tree language {t ∈ T ω Σ | ∃t ∈ L ∃v : t ≥v = t}. Corollary 4.3. Let L be a non-empty regular language over an alphabet Σ such that Subtree(L) = T ω Σ . Then, the complement of L is not finitely ambiguous. Proof. Let L be as in Corollary 4.3. We claim that there are regular Σ-labeled trees t 0 ∈ L and t 1 ∈ Subtree(L). Indeed, by Rabin's basis theorem there is a regular t 0 ∈ L. Since L is regular, there is an automaton B = (Q, Σ, {q I }, δ, C) (with only useful states) that accepts L. It is clear that B Q accepts Subtree(L), and therefore Subtree(L) is regular. The complement of Subtree(L) is regular (as the complement of a regular language) and non-empty (since Subtree(L) = T ω Σ ), and therefore contains a regular tree t 1 (by Rabin's basis theorem). Note that t 0 [t 1 /Y ] ∈ L for every non-empty antichain Y .
The complement of L satisfies the assumption of Proposition 4.1. Therefore, it is not finitely ambiguous.
Corollary 4.4 (Not finitely ambiguous languages). The following languages are not finitely ambiguous: (1) The complement of a non-empty regular countable tree language.
(2) The complement of a regular language that contains a single tree.
(1) Let L be a non-empty regular countable tree language. Every tree has countably many subtrees, and since L is countable we conclude that Subtree(L) is countable. Therefore, Subtree(L) does not contain all trees. By Corollary 4.3, we conclude that L is not finitely ambiguous.
(3) By the definition of L ∃a 1 we have L ∃a 1 ∩ T ω {c,a 1 } = T ω {c,a 1 } \ {t c }, and therefore by (2), L ∃a 1 ∩ T ω {c,a 1 } is not finitely ambiguous. It is easy to see that T ω {c,a 1 } is unambiguous (since there is a deterministic automaton that accepts it). Therefore, by Corollary 3.2 we conclude that L ∃a 1 is not finitely ambiguous. It is easy to prove that the complement of every finite language (i.e. a language which consists of finitely many trees) is countably ambiguous. Therefore, we obtain: Corollary 4.5. If L is regular and its complement is finite and non-empty, then da(L) = ℵ 0 .
Proof of Corollary 4.5. We first prove the following claim: Claim 4.5.1. Let L be a regular tree language containing a single tree. Then L is countably ambiguous.
Proof. Assume that L = {t}. L is a regular language, and therefore t is regular. By Fact 3.11 there is a Moore machine We will use M to construct a countably ambiguous automaton A that accepts L by For each computation φ of A on t , the Q M component is determined deterministically by M and t. If φ is accepting, there are finitely many nodes v such that the first component of φ(v) is q -otherwise, there would be a branch where the maximal color assigned infinitely often by C is odd, in contradiction to φ being an accepting computation. Therefore, there are countably many accepting computations on each tree t ∈ L(A), and A is countably ambiguous.
L is finite and therefore there are t 1 , . . . , t k ∈ T ω Σ such that L = {t 1 , . . . , t k }. A finite tree language does not contain a non-regular tree, and therefore t 1 , . . . , t k are regular. By Claim 4.5.1, for each tree t i ∈ L, there is a countably ambiguous automaton A i such that , and therefore by Lemma 3.1 we conclude that L is countably ambiguous.
On the Proof of Proposition 4.1. In the rest of this section, Proposition 4.1 is proved. Let us sketch some ideas of the proof. For a language L, as in Proposition 4.1, and any non-empty antichain Y we show that if A does not accept t 0 and accepts t := t 0 [t 1 /Y ], then every φ ∈ ACC(A, t) chooses (in an MSO-definable way) an element from Y . Hence, the computations in ACC(A, t) choose together a subset X of Y of cardinality ≤ |ACC(A, t)| (each computation chooses a single element). Therefore, if A accepts L and is finitely ambiguous, then X is finite -a contradiction to Lemma 2.5. To implement this plan, in Subsection 4.1 we recall a game theoretical interpretation of "a tree is accepted by an automaton." Then, in Subsection 4.2 we analyze which concepts related to these games are MSO-definable. Finally, in Subsection 4.3, the proof is completed. From a position (v, q) ∈ {l, r} * × Q Automaton chooses a tuple (q l , q r ) ∈ Q × Q such that ∃a ∈ Σ : (q, a, q l , q r ) ∈ δ, and moves to the position (v, q l , q r ). From a position (v, q l , q r ) ∈ {l, r} * × Q × Q Pathfinder chooses a direction d ∈ {l, r}, and moves to the position (v · d, q d ).
We define a play s := e 0 , d 0 , e 1 , d 1 , . . . , e i , d i , · · · ∈ (Q × Q × {l, r}) ω as an infinite sequence of moves, corresponding to the choices of Automaton and Pathfinder from the initial position. We say that the move e i = (q l , q r ) from position (v, q) is invalid for Automaton if (q, t(v), q l , q r ) / ∈ δ. A strategy for a player in G t,A is a function that determines the next move of the player based on previous moves of both players.
A positional strategy for a player in G t,A is a strategy that determines the next move of the player based only on the current position. A positional strategy for Automaton is a function str : {l, r} * × Q → Q × Q, and a positional strategy for Pathfinder is a function Let C G be a coloring function that maps each position in G t,A to a color in N. We define C G (v, q) := C(q) for Automaton's positions, and C G (v, q l , q r ) := 0 for Pathfinder's positions.
For each play s define π s as the infinite sequence of positions corresponding to the moves in s. A play s is winning for Automaton iff s does not contain an invalid move for Automaton, and the maximal color that C G assigns infinitely often to the positions in π s is even. Since all Pathfinder's positions are colored by 0, it is sufficient to consider the coloring of Automaton's positions in π s .
We say that a play is consistent with a strategy of a player if all moves of the player are according to the strategy. A winning strategy for a player is a strategy such that each play that is consistent with the strategy is winning for the player.
Parity games are positionally determined [EJ91], i.e., for each parity game, one of the players has a positional winning strategy. Therefore, if a player has a winning strategy, then he has a positional winning strategy. Additionally, if a positional strategy of a player wins against all positional strategies of the other player, then it is a winning strategy.
We recall standard definitions and facts about the connections between games and tree automata [GH82,PP04].
The next claim describes what happens when Pathfinder plays his winning strategy in G t,A against an Automaton's winning strategy in G t ,A (for t = t).
Proof. Assume, for the sake of contradiction, that s does not contain an invalid move for Automaton, and let (v i , q i ) be the i-th position of Automaton in π s . By definition of G t,A it is easy to see that π = v 0 , . . . , v i , . . . is a branch in the full-binary tree. Since φ is an accepting computation of A on t , we conclude that the maximal color that C assigns infinitely often to states in φ(π) is even. By Claim 4.1.1(1) we have φ(v i ) = q i , and therefore φ(π) = q 0 . . . q i . . . . By the definition of C G we have C G (v i , q i ) = C(q i ) and we conclude that the maximal color that C assigns infinitely often in π s is even, and therefore the play is winning for Automaton -a contradiction to ST R being a winning strategy of Pathfinder.
Therefore, Automaton makes an invalid move in s. Let e i = (q l , q r ) be the first invalid move of Automaton in s. Since e i is invalid we have (q i , t(v i ), q l , q r ) / ∈ δ, and by definition of ) ∈ δ, and we conclude that t(v i ) = t (v i ). Notice that by the definition of G t,A we have v i = d 0 . . . d i−1 , and the claim follows.
4.2. MSO-definability. Throughout this section we will use the following conventions and terminology. Positional Pathfinder strategies as labeled trees: We will define a positional strategy ST R for Pathfinder as a function in {l, r} * ×Q×Q → {l, r}. Hence, it can be considered as a Q × Q → {l, r} labeled tree. Below we will not distinguish between a positional Pathfinder's strategy and the corresponding Q × Q → {l, r} labeled full-binary tree.
In particular, we call such a strategy regular, if the corresponding tree is regular. MSO-definability: We will use "MSO-definable" for "MSO-definable in the unlabeled full-binary tree." The rest of the proof deals with MSO-definability. By Claim 4.1.2, there is a function Invalid A (φ, ST R, t, v) that, for every accepting computation φ of A on t , returns a node v such that t (v) = t(v). This function depends on the strategy ST R of Pathfinder. The restriction of Invalid A to the Pathfinder positional winning strategies in G t,A is MSOdefinable (with parameters t and ST R) by the following formula Leads A (φ, ST R, t, v), that Define Leads A (φ, ST R, t, v) as the conjunction of: (1) φ( ) = q I -the play starts from the initial position.
are consistent with ST R and are along the path from the root to v, i.e., d 0 d 1 . . . d j ≤ v. To sum up, we have the following claim: The following claim is folklore. Due to the lack of references, it is proved in the Appendix.
Claim 4.1.4. Let t 0 be a regular tree such that t 0 / ∈ L(A). Then, Pathfinder has a regular positional winning strategy in G t 0 ,A .
Let t 0 be a regular tree such that t 0 / ∈ L(A). By Claim 4.1.4 there is a regular positional winning strategy ST R of Pathfinder in G t 0 ,A . Now, we can substitute ST R and t 0 for arguments ST R and t of Leads A and obtain the following Proposition: Proposition 4.6. For every regular tree t 0 / ∈ L(A) and a regular positional winning strategy ST R for Pathfinder in G t 0 ,A , there is an MSO-definable function that, for each accepting computation φ of A on t , returns a node v such that t 0 (v) = t (v).
Proof. Let ψ t 0 (σ) and ψ ST R (ST R) be MSO-formulas that define t 0 and ST R. Then, by Claim 4.1.3, ∃σ∃ST R : Let us continue with the proof of Proposition 4.1. Recall that for trees t and t and an antichain Y , we denote by t[t /Y ] the tree obtained from t by grafting t at every node in Y .
Claim 4.1.5. Let t 0 and t 1 be regular trees. Then, there is an MSO-formula graft t 0 ,t 1 (Y, σ) defining a function that for every antichain Y returns the tree t 0 [t 1 /Y ].
Proof of Claim 4.1.5. t 0 and t 1 are regular, and therefore there are MSO-formulas ψ t 0 (σ) and ψ t 1 (σ) that defines t 0 and t 1 .
Let A be such that L(A) = L, and let α t 0 ,A, ST R (φ, v) be a formula that defines the function from Proposition 4.6 (t 0 [t 1 /Y ] now takes the role of t ).
Define a formula: Claim 4.1.6. Choice A,t 0 ,t 1 , ST R (Y, φ, y) defines a function that for every non-empty antichain Y and an accepting computation φ of A on t 0 [t 1 /Y ], returns a node y ∈ Y .
Proof. By Proposition 4.6, Define ChooseSubset A,t 0 ,t 1 , ST R (Y, X) := ∀x : x ∈ X iff the following conditions hold: defines "φ is an accepting computation of A on the tree σ." Proof. If Y is non-empty, then t 0 [t 1 /Y ] ∈ L. Hence, A has at least one accepting computation on t 0 [t 1 /Y ]. Therefore, X is non-empty, by Claim 4.1.6. The "Moreover" part immediately follows from Claim 4.1.6.
Let A be such that L(A) = L and assume, for the sake of contradiction, that A is finitely ambiguous. In particular, there are finitely many accepting computations of A on t 0 [t 1 /Y ], and therefore by Claim 4.1.7, we conclude that ChooseSubset A,t 0 ,t 1 , ST R (Y, X) assigns to every non-empty antichain Y a finite non-empty X ⊆ Y -a contradiction to Lemma 2.5.

k-Ambiguous Languages
In this section we prove that for every 0 < k ∈ N, there is a tree language with the degree of ambiguity equal to k. First, we introduce some notations. For a letter σ, we denote by t σ , the full-binary tree with all nodes labeled by σ. Let L ¬a 1 ∨···∨¬a k := L ¬a 1 ∪ · · · ∪ L ¬a k be a tree language over alphabet Σ n = {c, a 1 , a 2 , ..., a n }, where L ¬a i := {t ∈ T ω Σn | no node in t is labeled by a i }.
Proposition 5.1. The degree of ambiguity of L ¬a 1 ∨···∨¬a k for k ≤ n is k.
It is easy to see that L ¬a i are accepted by deterministic PTA. Therefore, by Lemma 3.1, we obtain that L ¬a 1 ∨···∨¬a k is k-ambiguous. In the rest of this section we will show that L ¬a 1 ∨···∨¬a k is not (k − 1)-ambiguous. It was shown in [BS13] that L ¬a 1 ∨¬a 2 is ambiguous.
Lemma 5.2. Let L ∃a 1 ∧···∧∃am := {t ∈ T ω Σn | for every i ≤ m there is a node in t labeled by a i }, and let L be a tree language such that t c / ∈ L and L ∃a 1 ∧···∧∃am ∩ T ω {c,a 1 ,...,am} ⊆ L. Then, L is not finitely ambiguous.
It is easy to see that F is definable by a Moore machine, and ∀t ∈ T ω Σ : t ∈ L ∃a 1 iff F (t) ∈ L. Therefore, by Lemma 3.10 we conclude that da(L) ≥ da(L ∃a 1 ). Since L ∃a 1 is not finitely ambiguous (by Corollary 4.4 (3)), we conclude that L is not finitely ambiguous.
Lemma 5.3. Let A be a finitely ambiguous automaton over alphabet Σ n such that L(A) = L ¬a 1 ∨···∨¬a k for k ≤ n. Then |ACC(A, t c )| ≥ k.
Proof. We will prove by induction on k. For k = 1 the claim holds trivially, since t c ∈ L(A) implies that |ACC(A, t c )| ≥ 1.
Assume the claim holds for all k < m ≤ n and prove for k = m. Let A = (Q, Σ, Q I , δ, C) be a finitely ambiguous automaton that accepts L ¬a 1 ∨···∨¬am . Define R := {(q 1 , q 2 ) ∈ Q × Q | ∃q i ∈ Q I : (q i , c, q 1 , q 2 ) ∈ δ)}, and let R[1] and R[2] be the projections of the first and second coordinate of R on Q, respectively. Define By definition of Q ∃am∧¬tc we have t c / ∈ L(A Q ∃am∧¬tc ) and therefore L( The language T ω {c,am} \ {t c } is not finitely ambiguous by Corollary 4.4 (2). L(A Q ∃am∧¬tc ) is finitely ambiguous (by Corollary 3.5) and since T ω {c,am} is unambiguous we conclude that L(A Q ∃am∧¬tc ) ∩ T ω {c,am} is finitely ambiguous, by Corollary 3.2. Therefore, by Lemma 3.6, there is a tree t ∈ T ω {c,am} \ {t c } = L ∃am ∩ T ω {c,am} such that t / ∈ L(A Q ∃am∧¬tc ), and since L ∃am ∩T ω {c,am} ⊆ L(A Q ∃am ) = L(A Q ∃am∧tc )∪L(A Q ∃am∧¬tc ) we conclude that t ∈ L(A Q ∃am∧tc ).
, t c )}. g(φ) ≥r = φ and therefore g is injective, and we conclude that We now need to find an additional computation φ ∈ ACC(A, t c ) such that φ / ∈ Φ, resulting |ACC(A, t c )| ≥ m.
Let t be a tree as in Claim 5.3.1. We have t ∈ L ∃a 1 ∧···∧∃a m−1 ∩ T ω {c,a 1 ,...,a m−1 } , and therefore T ree(c, t c , t ) ∈ L ¬a 1 ∨···∨¬am = L(A), and there is a computation φ ∈ ACC(A, T ree(c, t c , t )). Let q := φ(r). By definition of t , we have q ∈ Q tc∧∃a 1 ∧···∧∃a m−1 and therefore t c ∈ L(A q ). Let φ c ∈ ACC(A q , t c ), and let φ be the computation obtained from φ by grafting φ c on r. We conclude that φ ∈ ACC(A, t c ).

Finitely Ambiguous Languages
Definition 6.1. Let Σ = {a 1 , a 2 , c}. We define the following languages over Σ: • For k, m ∈ N such that k < m, we define L k,m as the set of trees that are obtained from t c by grafting a tree t ∈ L ¬a 1 ∨¬a 2 on node l k r, and grafting t a 1 on node l m . • For m ∈ N we define L m := ∪ k<m L k,m . • L f a := ∪ m∈N L m .
In this section we prove the following proposition: Proposition 6.2. The degree of ambiguity of L f a is finite.
The proposition follows from Lemma 6.3 and Lemma 6.6 proved below. Lemma 6.3. There is a finitely ambiguous automaton that accepts L f a Proof. On a tree t ∈ L m the automaton "guesses" a position i < m, checks that t ≥l i r ∈ L ¬a 1 ∨¬a 2 (using a 2-ambiguous automaton), checks that t ≥l j r = t c for all j = i ∧ j < m, and checks that t ≥l m = t a 1 (using deterministic automata). Below, a more detailed proof is given.
First, notice that there are deterministic PTA A c , A a 1 , A ¬a 1 and A ¬a 2 that accepts languages {t c }, {t a 1 }, L ¬a 1 and L ¬a 2 , respectively.
By Lemma 3.1, there is a 2-ambiguous automaton A ¬a 1 ∨¬a 2 that accepts the language L ¬a 1 ∨¬a 2 := L ¬a 1 ∪ L ¬a 2 .
We will construct an automaton B := (Q B , Σ B , Q I B , δ B , C B ) that accepts L f a . • Q B is defined as the union of states of A a 1 , A c and A ¬a 1 ∨¬a 2 , along with additional states q 1 , q 2 . • Σ B := {a 1 , a 2 , c} 18:18

A. Rabinovich and D. Tiferet
Vol. 17:3 • Q I B := {q 1 } • δ B will consists of the transitions of A a 1 , A c and A ¬a 1 ∨¬a 2 , along with additional transitions: -(q 1 , c, q 1 , p) ∈ δ B for p an initial state in A c -(q 1 , c, q 2 , p) ∈ δ B for p an initial state in A ¬a 1 ∨¬a 2 -(q 2 , c, q 2 , p) ∈ δ B for p an initial state in A c -(q 2 , a 1 , p, p) ∈ δ B for p an initial state in A a 1 • C B (q 1 ) := 1, C B (q 2 ) := 1, and for other states, the assigned color would be the same as in the automaton the state has originated from (A a 1 , A c or A ¬a 1 ∨¬a 2 ) It is easy to see that L(B) = L f a . Let t ∈ L(B). By definition of L f a , there is m ∈ N such that t ∈ L m . If φ is an accepting computation on t, then φ assigns to the first m + 2 nodes on the leftmost branch the sequence q 1 , . . . , q 1 i times · q 2 , . . . , q 2 m − i + 1 times ·q a 1 for some i ∈ {1, . . . , m}, where q a 1 is the initial state of A a 1 (total m possibilities). φ assigns to l j · r the initial state of A c if j < i − 1 or i − 1 < j < m; the initial state of A ¬a 1 ∨¬a 2 if j = i − 1; and the initial state of A a 1 if j ≥ m. Since A c and A a 1 are deterministic and A ¬a 1 ∨¬a 2 is 2-ambiguous, the number of accepting computations on t is at most 2m, hence, finite.
Lemma 6.4. Let L be a tree language such that L m ⊆ L ⊆ L f a . Then, L is not m − 1 ambiguous.
Relying on the fact that T ω {c,a 1 } \ {t c } is not finitely ambiguous (by Corollary 4.4 (2)), we derive the following claim: Claim 6.4.1. There is a tree t ∃a 1 ∈ T ω {c,a 1 } \ {t c } ∩ L(A Q tc∧∃a 1 ) \ L(A Q ¬tc∧∃a 1 ) . Recall that t m is the tree that is obtained from t c by grafting t a 1 on node l m . For each i < m, define t m i as the tree that is obtained from t m by grafting t ∃a 1 on node l i r. It is clear that t m i ∈ L(A), and therefore there is an accepting computation φ i of A on t m i . t ∃a 1 ∈ L(A Q tc∧∃a 1 ) \ L(A Q ¬tc∧∃a 1 ) and since t ∃a 1 ∈ A φ i (l i r) we conclude that φ i (l i r) ∈ Q tc∧∃a 1 and therefore t c ∈ L(A φ i (l i r) ). Let φ c i ∈ ACC(A φ i (l i r) , t c ), and construct a computation φ i from φ i by grafting φ c i on l i r. This tree that is obtained from t m i by grafting t c on l i r is the tree t m and therefore φ i ∈ ACC(A, t m ).
We are going to show that for all i < j < m, the computations φ i , φ j ∈ ACC(A, t m ) are different. Assume towards a contradiction φ i = φ j and let φ := φ i . Define p i := φ(l i r), p j := φ(l j r), and let φ p i ∈ ACC(A p i , t ∃a 1 ) and φ p j ∈ ACC(A p 2 , t ∃a 1 ). Construct t from t m by grafting t ∃a 1 on nodes l i r and l j r, and construct φ from φ by grafting φ p i on l i r and φ p 2 on l j r. It follows that φ is an accepting computation of A on t . That is a contradiction, since t / ∈ L f a (since t ≥l j r = t ≥l i r = t ∃a 1 = t c ) and therefore t / ∈ L (since L ⊆ L f a ). We conclude that there are at least m different accepting computations of A on t m .
Remark 6.5. The language L m is 2m ambiguous but not m − 1 ambiguous. This implies that the hierarchy of ambiguous languages is infinite. The point of the more complex construction in Section 5 is to show that this hierarchy is populated at every level. Lemma 6.6. L f a is not boundedly ambiguous Proof. ∀m ∈ N : L m ⊆ L f a , and therefore from Lemma 6.4 it follows that L f a is not (m − 1)-ambiguous. That is, L f a is not boundedly ambiguous.

Uncountably Ambiguous Languages
In this section we introduce a scheme for obtaining uncountably ambiguous languages from languages that are not boundedly ambiguous. We then use this scheme to obtain natural examples of uncountably ambiguous tree languages.
Definition 7.1. Let L ¬ba be an arbitrary regular tree language over alphabet Σ that is not boundedly ambiguous, and let L 0 be an arbitrary regular tree language over alphabet Σ such that L 0 ∩ L ¬ba = ∅. Let c ∈ Σ and define a language L[L 0 , L ¬ba ] over alphabet Σ: t ∈ L[L 0 , L ¬ba ] iff the following conditions hold: • ∀v ∈ l * : t(v) = c • There is an infinite set I ⊆ N such that ∀i ∈ I : t ≥l i ·r ∈ L ¬ba and ∀i ∈ I : t ≥l i ·r ∈ L 0 .
Proof. Let A = (Q, Σ, Q I , δ, C) be a PTA that accepts L[L 0 , L ¬ba ]. We will show that da(A) = 2 ℵ 0 . Let Q := {φ(u) | u ∈ l * · r and ∃t : φ ∈ ACC(A, t)}, and define Q unamb∧¬L 0 := {q ∈ Q | A q is unambiguous and L(A q ) ∩ L 0 = ∅}. Proof. Assume, for the sake of contradiction, that there is a tree t ∈ L(A Q unamb∧¬L 0 ) such that t / ∈ L ¬ba . By definition of Q unamb∧¬L 0 we conclude that t / ∈ L 0 . Let q ∈ Q unamb∧¬L 0 such that t ∈ L(A q ) and let φ ∈ ACC(A q , t). Recall that q ∈ Q (since Q unamb∧¬L 0 ⊆ Q ) and therefore there is a tree t ∈ L(A), a computation φ ∈ ACC(A, t ) and a node u ∈ l * · r such that φ (u) = q. By the grafting lemma we conclude that φ [φ/u] is an accepting computation of A on t [t/u]. Therefore, t [t/u] ∈ L(A) for t / ∈ L ¬ba ∪ L 0 -a contradiction to the definition of A.
Notice that L(A Q unamb∧¬L 0 ) is boundedly ambiguous by Corollary 3.2 (as a finite union of unambiguous languages), and since L ¬ba is not boundedly ambiguous we conclude that da(L(A Q unamb∧¬L 0 )) = da(L ¬ba ). By Claim 7.2.1 we obtain L(A Q unamb∧¬L 0 ) ⊆ L ¬ba , and applying Lemma 3.6 we conclude that there is a tree t ¬ba ∈ L ¬ba such that t ¬ba / ∈ L(A Q unamb∧¬L 0 ).
Let c ∈ Σ be as in the definition of L[L 0 , L ¬ba ], and let t c be a tree where all nodes are labeled by c. Let A := l * ·r be an antichain, and define t := t c [t ¬ba /A]. By the definition of A it is clear that t ∈ L(A). Let φ ∈ ACC(A, t ), and let B : For each u ∈ B there is a tree t u ∈ L 0 and a computation φ u ∈ ACC(A φ (u) , t u ). Therefore, by the grafting lemma, we conclude that the tree t that is obtained from t by grafting t u on each node u ∈ B is in L(A).
Assume, for the sake of contradiction, that A \ B is finite. By definition of t , for each i ∈ N such that u := l i · r ∈ B we have t ≥l i ·r = t u ∈ L 0 . Therefore, |{i ∈ N | t ≥l i ·r ∈ L ¬ba }| = 18:20

A. Rabinovich and D. Tiferet
Vol. 17:3 |{u ∈ A | t ≥u ∈ L ¬ba }| = |{u ∈ A \ B | t ≥u ∈ L ¬ba }| = |A \ B| < ℵ 0 , and by definition of L[L 0 , L ¬ba ] we conclude that t / ∈ L[L 0 , L ¬ba ] -a contradiction to the definition of A. A \ B is infinite, and therefore there is a state q and an infinite set A ⊆ A \ B such that φ (u) = q for all u ∈ A. Recall that ∀u ∈ A : t ≥u = t ¬ba . Notice that for each u ∈ A we have u / ∈ B, and by definition of B we obtain L(A φ (u) ) ∩ L 0 = L(A q ) ∩ L 0 = ∅. Since t ¬ba / ∈ L(A Q unamb∧¬L 0 ) we conclude that q / ∈ Q unamb∧¬L 0 -hence, A q is ambiguous. Let t amb ∈ L(A q ) be a tree having at least two accepting computations φ 1 , φ 2 ∈ ACC(A q , t amb ). Let t := t [t amb / A], and φ := φ[φ 1 / A]. By the grafting lemma we obtain φ ∈ ACC(A, t). For each A ⊆ A, define a computation φ A := φ[φ 2 /A ]. Notice that φ A ∈ ACC(A, t) (by the grafting lemma) and that ∀A 1 , A 2 ⊆ A : . Therefore, |ACC(A, t)| ≥ |{A | A ⊆ A}| = 2 ℵ 0 , and da(A) = 2 ℵ 0 , as requested.
We will now introduce a couple of definitions, and present three natural examples of infinite tree languages that are not countably ambiguous.
Definition 7.4. For a set U ⊆ {l, r} * we define U ↓ as the downward closure of U .
Definition 7.5. A set X ⊆ {l, r} * is called perfect if X = ∅ and ∀u ∈ X : ∃v 1 , v 2 ∈ X such that v 1 and v 2 are incomparable and greater than u.
Proposition 7.6. The following regular languages are not countably ambiguous: (1) L X⊆Y ↓ := {t[X, Y ] | X ⊆ Y ↓} -"for each node in X there is a greater or equal node in Y ." (2) L no−max := {t[X] | X has no maximal element} -"for each node in X there is a greater node in X." (3) L perf := {t[X] | X is perfect } -"for each node in X there are at least two greater incomparable nodes in X." In the rest of this section we will prove Proposition 7.6.
Proof of Proposition 7.6(1). Let L left := {t[X, Y ] | X = l * and Y ∩ l * = ∅}. It is easy to see that L left can be accepted by a deterministic PTA, and therefore da(L left ) = 1. By Lemma 3.1 we conclude that da(L X⊆Y ↓ ∩L left ) ≤ da(L X⊆Y ↓ )·da(L left ) = da(L X⊆Y ↓ ). We will show that L X⊆Y ↓ ∩ L left is not countably ambiguous. By the above inequality, this implies that L X⊆Y ↓ is not countably ambiguous.  (1, 0) if v ∈ l * , or t (v) = (0, 0) otherwise. Hence, ∀v ≥ u : v / ∈ Y , in contradiction to t ∈ L X⊆Y ↓ . ⇐: Assume that the conditions hold for t . It is easy to see that t ∈ L left . We will show that t ∈ L X⊆Y ↓ . Assume, for the sake of contradiction, that there is a node u ∈ X such that v / ∈ Y for each node v ≥ u. Since all nodes in X are in l * we conclude that there is i ∈ N such that u = l i . Notice that the set I ⊆ N is infinite, and therefore there is j > i such that t ≥l j ·r ∈ L X=∅,Y =∅ . Therefore, there is a node v ≥ l j · r > l i = u such that v ∈ Ya contradiction. To prove Proposition 7.6(2), we will first prove the following lemma: Lemma 7.7. L no−max is not finitely ambiguous.
Proof. Let A = (Q, Σ, Q I , δ, C) be a PTA that accepts L no−max . Let Q := {q ∈ Q | ∃q i ∈ Q I ∃q ∈ Q : (q i , 1, q, q ) ∈ δ and t[∅] ∈ L(A q )}. By the definition of L no−max we obtain t ∈ L no−max . Therefore, there is a computation φ ∈ ACC(A, t ) such that φ(l) ∈ Q and t ∈ L(A φ(l) ), as requested.
(2) Assume, for the sake of contradiction, that t[∅] ∈ L(A Q ). Then there is a transition (q i , 1, q 1 , q 2 ) ∈ δ from an initial state q i such that t[∅] ∈ L(A q 1 ) and t[∅] ∈ L(A q 2 ). Therefore, we conclude that t : It is easy to see that F is definable by a Moore machine. We show that F reduces L ¬∅ to L(A Q ).
Proof of Proposition 7.6(3). Let L contains−l * := {t[X] | l * ⊆ X}. It is easy to see that L contains−l * can be accepted by a deterministic PTA, and therefore da(L contains−l * ) = 1. Look at the language L perf ∩ L contains−l * . By Lemma 3.1 we obtain da(L perf ∩ L contains−l * ) ≤ da(L perf )·da(L contains−l * ) = da(L perf ). We will show that L perf ∩L contains−l * is not countably ambiguous. By the above inequality, this implies that da(L perf ) = 2 ℵ 0 .
Claim 7.7.2. L perf is not finitely ambiguous.
It is easy to see that F is definable by a Moore machine, and that ∀t ∈ T ω } is not finitely ambiguous (by Corollary 4.4(2)), and therefore by Lemma 3.10 we conclude that L perf is not finitely ambiguous.
Proof. ⇒: Let t ∈ L perf ∩ L contains−l * . By definition of L contains−l * it is clear that condition (1) holds for t . Notice that ∀i ∈ N : t ≥l i ·r ∈ L perf or t ≥l i ·r = t[∅]. Assume, for the sake of contradiction, that {i ∈ N | t ≥l i ·r ∈ L perf } is finite. Therefore, there is k ∈ N such that ∀i ≥ k : t ≥l i ·r = t[∅]. Let u := l k , and notice that t (u) = 1, and ∀v > u : t (v) = 1 ↔ v ∈ l * . Hence, each pair of 1-labeled nodes that are greater than u are comparable -a contradiction to the definition of L perf .
⇐: Let t such that the conditions hold. By the first condition it is clear that t ∈ L contains−l * . We will prove that t ∈ L perf , and the claim will follow. First, notice that t ( ) = 1, and therefore t = t[∅]. Let u be a node such that t (u) = 1. If u ∈ l * then by the second condition, there is a node v ∈ l * · r such that v > u and t ≥v ∈ L perf . Therefore, there are two nodes w 1 , w 2 > v > u such that w 1 ⊥ w 2 and t (w 1 ) = t (w 2 ) = 1. Otherwise (u / ∈ l * ), there is a node v ∈ l * · r, such that u > v and t ≥v ∈ L perf , and by definition of L perf we conclude that there are two nodes w 1 , w 2 > u such that w 1 ⊥ w 2 and t (w 1 ) = t (w 2 ) = 1hence, t ∈ L perf . It is easy to see that L perf ∩ L contains−l * = L[L 0 , L ¬ba ] for L ¬ba := L perf (which is not boundedly ambiguous, by Claim 7.7.2) and L 0 := {t[∅]}. Therefore, by Proposition 7.2 we conclude that L perf ∩ L contains−l * = 2 ℵ 0 , as requested.
Observe that our proof shows that L perf ∧min := {t[X] | X is perfect and has the ≤minimal element} is also uncountably ambiguous. We conclude with an instructive example of an unambiguous language which is similar to L perf ∧min . Let X ⊆ {l, r} * be a set of nodes. We say that u ∈ X is a X-successor of v if u > v and there is no node w ∈ X such that v < w < u. We call X a full-binary subset-tree if X has a minimal node, and each node in X has two X-successors.
Note that if X is a full-binary subset tree then X is perfect and has the ≤-minimal element. However the language L binary := {t[X] | X is a full-binary subset tree} is unambiguous.

Countable Languages are Unambiguous
In this section we prove the following Proposition: Proposition 8.1. Each regular countable tree language is unambiguous This section is self-contained and lacks technical connections to the previous sections. It is instructive to compare the above Proposition with Corollary 4.4(1) which states that the complement of every countable tree language is not finitely ambiguous.
To prove Proposition 8.1 we first recall finite tree automata (Subsection 8.1). Then, we present Niwiński's Representation for Countable Languages (Subsection 8.2). Finally, the proof of Proposition 8.1 is given (Subsection 8.3).

Finite Trees and Finite Tree Automata.
Finite Trees. A finite tree is a finite set U ⊆ {l, r} * that is closed under prefix relation. U is called a finite binary tree if ∀u ∈ U : u · l ∈ U ↔ u · r ∈ U .
Finite Σ-labeled Binary Trees. Let Σ be partitioned into two sets: Σ 2 -labels of internal nodes, and Σ 0 -labels of leaves. A finite Σ-labeled binary tree is a function t U : U → Σ, where U ⊆ {l, r} * is a finite binary tree, t U (v) ∈ Σ 0 if v is a leaf, and t U (v) ∈ Σ 2 if v has children.
When it is clear from the context, we will use "finite tree" or "labeled finite tree" for "Σ-labeled finite binary tree".
Finite Tree Automata (FTA). An automaton over Σ-labeled finite trees is a tuple B = (Q, Σ, Q I , δ), where Q is a finite set of states, Σ = Σ 0 ∪ Σ 2 is an alphabet, Q I is a set of initial states, and δ ⊆ (Q × Σ 0 ) ∪ (Q × Σ 2 × Q × Q) is a set of transitions.
An accepting computation of B on a finite tree t U is a function φ : U → Q, such that φ( ) ∈ Q I , and for each node u ∈ U , if u is not a leaf then (φ(u), t U (u), φ(u · l), φ(u · r)) ∈ δ, and otherwise (φ(u), t U (u)) ∈ δ.
The language of a FTA B is the set of finite trees t such that B has an accepting computation on t. A finite tree language is regular iff it is accepted by a FTA. It is wellknown that every regular finite tree language is unambiguous (i.e., for every finite tree language there is an unambiguous automaton that accepts it).
Let τ ∈ T f in Σ({x 1 ,...,xn}) be a finite tree, and let t 1 , . . . , t n ∈ T ω Σ be infinite binary trees over alphabet Σ. We define τ [t 1 /x 1 , . . . , t n /x n ] as the infinite tree that is obtained from τ by grafting t i on leaves labeled by Theorem 8.3 (D. Niwiński [Niw91]). Let L be a countable regular tree language over alphabet Σ. Then there is a finite set of trees {t 1 , . . . , t n } such that the following hold: (1) For each tree t ∈ L and a tree branch π, there is a node v ∈ π and a number 1 ≤ i ≤ n such that t ≥v = t i . The following lemma strengthen item (2) of Theorem 8.3 by adding another condition on M , implying a unique representation of each tree in L: Lemma 8.4. Let L be a countable regular tree language over alphabet Σ, and let {t 1 , . . . , t n } be a finite set of trees as in Theorem 8.3. Then there is a regular finite trees language M ⊆ T f in Σ({x 1 ,...,xn}) such that L = M [t 1 /x 1 , . . . , t n /x n ], and for each t ∈ L there is a unique finite tree τ ∈ M such that t = τ [t 1 /x 1 , . . . , t n /x n ].
Proof. For each tree t ∈ L, let g(t) be the tree that is obtained from t by changing the label of each node v ∈ {l, r} * where t ≥v = t i to x i , and removing all descendants of {x 1 , . . . , x n }-labeled node.
Claim 8.4.1. g(t) is finite for all t ∈ L.
Proof. Assume, for the sake of contradiction, that there is t ∈ L such that the set of nodes U ⊆ {l, r} * of g(t) is infinite. The number of children of each node in U is bounded by 2, and therefore, by König's Lemma, there is a tree branch π such that ∀v ∈ π : v ∈ U . Therefore, by definition of g(t), we conclude that t ≥v = t i for each v ∈ π and 1 ≤ i ≤ n -a contradiction to item (1) of Theorem 8.3.
Notice that for each t ∈ L we obtain g(t)[t 1 /x 1 , . . . , t n /x n ] = t, and therefore g is injective. Hence, L = M [t 1 /x 1 , . . . , t n /x n ] where M := {g(t) | t ∈ L}. We will show that M is a regular language of finite trees.
It is easy to see that for each t ∈ L and finite tree τ ∈ T f in Σ({x 1 ,...,xn}) , τ = g(t) iff the following conditions hold: • t = τ [t 1 /x 1 , . . . , t n /x n ] • t ≥v = t i for each node v in τ that is not a leaf, and for each 1 ≤ i ≤ n.
Since both conditions could be formulated in MSO, we conclude that M is MSO-definable, and therefore regular. 8.3. Proof of Proposition 8.1. Let L be a countable regular tree language over alphabet Σ. We will show that L can be accepted by an unambiguous PTA. By Lemma 8.4, there is a regular finite tree language M ⊆ T f in Σ({x 1 ,...,xn}) and regular infinite trees t 1 , . . . , t n such that L = M [t 1 /x 1 , . . . , t n /x n ]. Additionally, for each t ∈ L there is a unique τ ∈ M such that t = τ [t 1 /x 1 , . . . , t n /x n ].
Each infinite tree t i : {l, r} * → Σ is regular, and therefore, by Fact 3.11, is definable by a Moore machine M i = ({l, r}, Σ, Q i , q i I , δ M i , out M i ). Let A i := (Q i , Σ, q i I , δ i , F i ) where F i := Q i , and (q, a, q 1 , q 2 ) ∈ δ i iff q 1 = δ(q, l), q 2 = δ(q, r) and a = out M i (q). It is easy to verify that A i is unambiguous, and L(A i ) = {t i }. M is regular and therefore can be accepted by an unambiguous FTA B = (Q B , Σ ∪ {x 1 , . . . , x n }, q B I , δ B ). We use these automata to construct a PTA A := (Q, Σ, Q I , δ, C), by: I , x i ) ∈ δ B } • δ is the union of the following: -{(q, a, q 1 , q 2 ) ∈ δ B | a ∈ Σ} (all transitions of B on inner nodes) -∪ 1≤i≤n δ i -{(q, a, q i I , q j I ) | ∃(q, a, q 1 , q 2 ) ∈ δ B : (q 1 , x i ) ∈ δ B and (q 2 , x j ) ∈ δ B } -{(q, a, q 1 , q j I ) | ∃(q, a, q 1 , q 2 ) ∈ δ B : (q 2 , x j ) ∈ δ B } -{(q, a, q i I , q 2 ) | ∃(q, a, q 1 , q 2 ) ∈ δ B : (q 1 , x i ) ∈ δ B } • C(q) := C i (q) ∃i : q ∈ Q i 1 otherwise It is easy to see that L(A) = M [t 1 /x 1 , . . . , t n /x n ] = L. We will show that A is unambiguous. For each accepting computation φ ∈ ACC(A, t), define a set of nodes U φ := {u ∈ {l, r} * | ∀v < u : φ(v) ∈ Q B }. It is easy to see that U φ is downward closed. Assume towards contradiction that U φ is infinite -by König Lemma, U φ contains an infinite tree branch π. By definition of U φ all states in φ(π) are in Q B , and therefore colored by 1. That is a contradiction to φ being an accepting computation.
Define a labeled finite tree t φ : U φ → Σ ∪ {x 1 , . . . , x n } by: t φ := x i ∃i : φ(u) = q i I t(u) otherwise By definition of t φ we obtain t = t φ [t 1 /x 1 , . . . , t n /x n ], and by definition of B we conclude that t φ ∈ M .

Conclusion and Open Questions
We proved that the ambiguity hierarchy is strict for regular languages over infinite trees.
For each level of the ambiguity hierarchy we provided a language which occupies this level. It is not difficult to see that all these languages are definable by MSO-formulas without the second-order quantifiers (formulas of the first-order fragment of MSO). Concerning the topological complexity, Olivier Finkel [Fin20] observed that these languages have low topological complexity: L ¬a 1 ∨···∨¬a k are closed languages; L f a and L ∃a 1 are countable unions 18:26

A. Rabinovich and D. Tiferet
Vol. 17:3 of closed sets, i.e., a Σ 0 2 -sets; the uncountably ambiguous language L no−max is Π 0 2 . On the other hand, Skrzypczak [Skr18] proved that unambiguous languages climb up the whole index hierarchy and are topologically as complex as arbitrary regular tree languages.
A natural question is whether the ambiguity degree is decidable. However, this is not a trivial matter. In [BS13] some partial solutions for variants of the problem whether a given language is unambiguous are provided. We proved that countable regular languages are unambiguous. Since it is decidable whether a language is countable [Niw91], this provides a decidable sufficient condition for a langauge to be unambiguous.
A less ambitious task is to develop techniques for computing degrees of ambiguity and compute the degree of ambiguity of some natural languages. Let Σ 1 := {c, a 1 } and L ∃ ∞ a 1 := {t ∈ T ω Σ 1 | there are infinitely many a 1 -labeled nodes in t}. L ∃ ω a 1 := {t ∈ T ω Σ 1 | there is a branch with infinitely many a 1 -labeled nodes in t}. L a 1 −∞antichain := {t ∈ T ω Σ 1 | the set of a 1 -labeled nodes in t contain an infinite antichain}. All these languages are regular. There are (Moore) reductions from L ∃a 1 to these languages, hence they are not finitely ambiguous. We believe that their ambiguity degree is uncountable, but we were unable to prove this.
We provided sufficient conditions for a language to be not finitely ambiguous and for a language to have uncountable degree of ambiguity. In particular, we proved that the degree of ambiguity of the complement of a countable regular language is ℵ 0 or 2 ℵ 0 , and provided natural examples of such languages with countable degree of ambiguity. We proved that the degree of ambiguity of the complement of a finite regular language is ℵ 0 . Yet, it is open whether the degree of ambiguity of the complement of countable regular languages is ℵ 0 .