Definitions

# Tree automaton

A tree automaton is a type of state machine. Tree automata deal with tree structures, rather than the strings of more conventional state machines.

The following article deals with branching tree automata, which correspond to regular languages of trees. For a different notion of tree automaton, see tree walking automaton.

As with classical automata, finite tree automata (FTA) can be either a Deterministic automaton or not. According to how the automata run on the input tree, finite tree automata can be of two types: (a) bottom up, (b) top down. This is an important issue, as although non-deterministic (ND) top-down and ND bottom-up tree automata are equivalent, deterministic top-down automata are strictly less powerful than their deterministic bottom-up counterparts, because tree properties specified by deterministic top-down tree automata can only depend on path properties. (Deterministic bottom-up tree automata are as powerful as ND tree automata.)

## Definitions

A bottom-up finite tree automaton over $F$ is defined by: $\left(Q, F, Q_\left\{f\right\}, Delta\right)$

Here $Q$ is a set of unary states, $F$ is a ranked alphabet, $Q_\left\{f\right\} subseteq Q$ is a set of final states, and $Delta$ is a set of transition rules, that is, rewrite rules from nodes whose childs' roots are states, to nodes whose roots are states. Thus the state of a node is deduced from the states of its children.

There is no initial state as such, but the transition rules for constant symbols (leaves) can be considered as initial states. The tree is accepted if the state labeled at the root is an accepting state.

A top-down finite tree automaton over $F$ is defined by: $\left(Q, F, I, Delta\right)$

There are two differences with bottom-up tree automata : first, $I subseteq Q$, the set of its initial states, replaces $Q_F$ ; second, its transition rules are the converse, that is, rewrite rules from nodes whose roots are states to nodes whose child's roots are states. The tree is accepted if every branch can be gone through this way.

One can easily guess that non-deterministic top-down tree automata are equivalent to non-deterministic bottom-up ones ; the transition rules are simply reversed, and the final states become the initial states.

Why then are deterministic top-down FTA less powerful than their bottom-up counterparts? Because a deterministic TA is by definition one where no two transition rules have the same left-hand side. For tree automata, transition rules are rewrite rules ; and for top-down ones, the left-hand side will be parent nodes. Consequently a deterministic top-down tree automaton will only be able to test for tree properties that are true in all branches, because the choice of the state to write into each child branch is determined at the parent node, without knowing the child branches contents.

## Properties

### Determinism

As said before, a deterministic tree automaton is one where no two transition rules have the same left-hand side. This definition matches the intuitive idea that for an automaton to be deterministic, one and only one transition must be possible for a given node.

### Recognizability

For a bottom-up automaton, a ground term $t$ (that is, a tree) is accepted if there exists a reduction that starts from t and ends with q(t), where q is a final state. For a top-down automaton, a ground term $t$ is accepted if there exists a reduction that starts from q(t) and ends with t, where q(t) is an initial state.

The tree language $L\left(A\right)$ recognized by a tree automaton $A$ is the set of all ground terms accepted by $A$. A set of ground terms is recognizable if there exists a tree automaton that recognizes it.

One important property is that linear (that is, arity-preserving) homomorphisms preserve recognizability.

### Completeness and Reduction

A non-deterministic finite tree automaton is complete if there is at least one transition rule available for every possible symbol-states combination. A state $q$ is accessible if there exists a ground term $t$ such that there exists a reduction from $t$ to $q\left(t\right)$. An FTA is reduced if all its states are accessible.

### Pumping Lemma

Let $L$ be a recognizable set of ground terms. Then, there exists a constant $k > 0$ satisfying: for every ground term $t$ in $L$ such that $Height\left(t\right) > k$, there exists a context $C in C\left(F\right)$, a non trivial context $C\text{'} in C\left(F\right)$ and a ground term $u$ such that $t = C\left[C\text{'}\left[u\right]\right]$ and, for all $n geq 0$ $C\left[C\text{'}^n\left[u\right]\right] in L$.

### Closure

The class of recognizable tree languages is closed under union, under complementation, and under intersection.

### Myhill-Nerode Theorem

The following three statements are equivalent: (i) L is a recognizable tree language (ii) L is the union of some equivalence classes of congruence of finite index (iii) the relation $equiv_L$ is a congruence of finite index

Definitions necessary for this theorem: A congruence on tree languages is a relation such that $u_i equiv v_i 1 leq i leq n Rightarrow f\left(u_1,ldots,u_n\right) equiv f\left(v_1,ldots,v_n\right)$ It is of finite index if its number of equivalence-classes is finite. For a given tree-language $L$, $u equiv_L v$ if for all contexts $C in C\left(F\right)$, $C\left[u\right] in L$ if and only if $C\left[v\right] in L$.