Tree automaton explained

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.

As with classical automata, finite tree automata (FTA) can be either a deterministic automaton or not. According to how the automaton processes 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 in expressive power, 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 as a tuple(Q, F, Qf, Δ),where Q is a set of states, F is a ranked alphabet (i.e., an alphabet whose symbols have an associated arity), is a set of final states, and Δ is a set of transition rules of the form f(q1(x1),...,qn(xn)) → q(f(x1,...,xn)), for an n-ary, and xi variables denoting subtrees. That is, members of Δ are 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.

For n=0, that is, for a constant symbol f, the above transition rule definition reads fq(f); often the empty parentheses are omitted for convenience: fq(f).Since these transition rules for constant symbols (leaves) do not require a state, no explicitly defined initial states are needed.A bottom-up tree automaton is run on a ground term over F, starting at all its leaves simultaneously and moving upwards, associating a run state from Q with each subterm.The term is accepted if its root is associated to an accepting state from .

A top-down finite tree automaton over F is defined as a tuple(Q, F, Qi, Δ),with two differences with bottom-up tree automata. First,, the set of its initial states, replaces ; second, its transition rules are oriented conversely:q(f(x1,...,xn)) → f(q1(x1),...,qn(xn)), for an n-ary, and xi variables denoting subtrees.That is, members of Δ are here rewrite rules from nodes whose roots are states to nodes whose children's roots are states.A top-down automaton starts in some of its initial states at the root and moves downward along branches of the tree, associating along a run a state with each subterm inductively.A tree is accepted if every branch can be gone through this way.

A tree automaton is called deterministic (abbreviated DFTA) if no two rules from Δ have the same left hand side; otherwise it is called nondeterministic (NFTA). Non-deterministic top-down tree automata have the same expressive power as non-deterministic bottom-up ones; the transition rules are simply reversed, and the final states become the initial states.

In contrast, deterministic top-down tree automata[1] are less powerful than their bottom-up counterparts, because in a deterministic tree automaton 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.

Infinite-tree automata extend top-down automata to infinite trees, and can be used to prove decidability of S2S, the monadic second-order theory with two successors. Finite tree automata (nondeterministic if top-down) suffice for WS2S.[2]

Examples

Bottom-up automaton accepting boolean lists

Employing coloring to distinguish members of F and Q, and using the ranked alphabet F=, with having arity 2 and all other symbols having arity 0, a bottom-up tree automaton accepting the set of all finite lists of boolean values can be defined as (Q, F, Qf, Δ) with and Δ consisting of the rules

(1),
(2),
(3), and
((x1),(x2)) ((x1,x2))       (4).

In this example, the rules can be understood intuitively as assigning to each term its type in a bottom-up manner; e.g. rule (4) can be read as "A term (x1,x2) has type, provided x1 and x2 has type and, respectively".An accepting example run is

ALIGN=RIGHT (ALIGN=RIGHT ,ALIGN=RIGHT (ALIGN=RIGHT ,ALIGN=RIGHT ))
ALIGN=RIGHT (ALIGN=RIGHT ,ALIGN=RIGHT (ALIGN=RIGHT ,ALIGN=RIGHT ))by (3)
ALIGN=RIGHT (ALIGN=RIGHT ,ALIGN=RIGHT (ALIGN=RIGHT ,ALIGN=RIGHT ))by (2)
ALIGN=RIGHT (ALIGN=RIGHT ,ALIGN=RIGHT ((ALIGN=RIGHT ,ALIGN=RIGHT )))by (4)
ALIGN=RIGHT (ALIGN=RIGHT ,ALIGN=RIGHT ((ALIGN=RIGHT ,ALIGN=RIGHT )))by (1)
ALIGN=RIGHT ((ALIGN=RIGHT ,ALIGN=RIGHT (ALIGN=RIGHT ,ALIGN=RIGHT )))      by (4), accepted.

Cf. the derivation of the same term from a regular tree grammar corresponding to the automaton, shown at Regular tree grammar#Examples.

A rejecting example run is

ALIGN=RIGHT (ALIGN=RIGHT ,ALIGN=RIGHT )
ALIGN=RIGHT (ALIGN=RIGHT ,ALIGN=RIGHT )by (1)
ALIGN=RIGHT (ALIGN=RIGHT ,ALIGN=RIGHT )      by (2), no further rule applicable.
Intuitively, this corresponds to the term not being well-typed.

Top-down automaton accepting multiples of 3 in binary notation

ALIGN=center (A)ALIGN=center (B)ALIGN=center (C)ALIGN=center (D)
ALIGN=center String
grammar
rules
ALIGN=center String
automaton
transitions
ALIGN=center Tree
automaton
transitions
ALIGN=center Tree
grammar
rules
ε
 
δ =
δ =
δ =
δ =
δ =
δ =
((x)) ((x))
((x)) ((x))
((x)) ((x))
((x)) ((x))
((x)) ((x))
((x)) ((x))

Using the same colorization as above, this example shows how tree automata generalize ordinary string automata.The finite deterministic string automaton shown in the picture accepts all strings of binary digits that denote a multiple of 3.Using the notions from Deterministic finite automaton#Formal definition, it is defined by:

In the tree automaton setting, the input alphabet is changed such that the symbols and are both unary, and a nullary symbol, say is used for tree leaves.For example, the binary string "" in the string automaton setting corresponds to the term "" in the tree automaton setting; this way, strings can be generalized to trees, or terms.The top-down finite tree automaton accepting the set of all terms corresponding to multiples of 3 in binary string notation is then defined by:

For example, the tree "" is accepted by the following tree automaton run:

(((())))
(((()))) by 2
(((()))) by 4
(((()))) by 1
((()))       by 0

In contrast, the term "" leads to following non-accepting automaton run:

⇒ ((()))
((()))) by 2
((())))       by 3, no further rule applicable

Since there are no other initial states than to start an automaton run with, the term "" is not accepted by the tree automaton.

For comparison purposes, the table gives in column (A) and (D) a (right) regular (string) grammar, and a regular tree grammar, respectively, each accepting the same language as its automaton counterpart.

Properties

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 is an initial state.

The tree language L(A) accepted, or 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 accepts it.

A linear (that is, arity-preserving) tree homomorphism preserves recognizability.[3]

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(t).An NFTA is reduced if all its states are accessible.

Pumping lemma

Every sufficiently large[4] ground term t in a recognizable tree language L can be vertically tripartited[5] such that arbitrary repetition ("pumping") of the middle part keeps the resulting term in L.[6]

For the language of all finite lists of boolean values from the above example, all terms beyond the height limit k=2 can be pumped, since they need to contain an occurrence of . For example,

(),
(()),
((())), ...

all belong to that language.

Closure

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

Myhill–Nerode theorem

A congruence on the set of all trees over a ranked alphabet F is an equivalence relation such that and ... and implies, for every .It is of finite index if its number of equivalence-classes is finite.

For a given tree-language L, a congruence can be defined by if for each context C.

The Myhill–Nerode theorem for tree automata states that the following three statements are equivalent:

  1. L is a recognizable tree language
  2. L is the union of some equivalence classes of a congruence of finite index
  3. the relation is a congruence of finite index

See also

References

External links

Implementations

Notes and References

  1. In a strict sense, deterministic top-down automata are not defined by but they are used there (sect. 1.6, proposition 1.6.2, p. 38). They accept the class of path-closed tree languages (sect. 1.8, exercise 1.6, p. 43-44).
  2. Morawietz . Frank . Cornell . Tom . 1997-07-07 . Representing constraints with automata . Proceedings of the 35th Annual Meeting of the Association for Computational Linguistics and Eighth Conference of the European Chapter of the Association for Computational Linguistics . ACL '98/EACL '98 . USA . Association for Computational Linguistics . 468–475 . 10.3115/976909.979677.
  3. The notion in of tree homomorphism is more general than that of the article "tree homomorphism".
  4. Formally: height(t) > k, with k > 0 depending only on L, not on t
  5. Formally: there is a context C[.], a nontrivial context, and a ground term u such that . A "context" C[.] is a tree with one hole (or, correspondingly, a term with one occurrence of one variable). A context is called "trivial" if the tree consists only of the hole node (or, correspondingly, if the term is just the variable). The notation C[''t''] means the result of inserting the tree t into the hole of C[.] (or, correspondingly, instantiating the variable to t)., gives a formal definition.
  6. Formally: for all n ≥ 0. The notation Cn[.] means the result of stacking n copies of C[.] one in another, cf. .