Tree walking automaton
A tree walking automaton (TWA) is a type of finite automaton that deals with tree structures rather than strings. The concept was originally proposed in Aho & Ullman (1971).
The following article deals with tree walking automata. For a different notion of tree automaton, closely related to regular tree languages, see branching automaton.
Contents |
[edit] Definition
All trees are assumed to be binary, with labels from a fixed alphabet Σ.
Informally, a tree walking automaton A (TWA) is a finite state device which walks over the tree in a sequential manner. At each moment A visits node v in state q. Depending on the state q, the label of the node v, and whether the node is the root, a left child, a right child or a leaf, A changes its state from q to q' and moves to the parent of v or its left or right child. A TWA accepts a tree if it enters an accepting state, and rejects if its enters a rejecting state or makes an infinite loop. As with string automata, a TWA may be deterministic or nondeterministic.
More formally, a (nondeterministic) tree walking automaton over alphabet Σ is a tuple: A = (Q,Σ,I,F,R,δ)
where Q is a finite set of states,
are the sets of respectively initial, accepting and rejecting states, and δ is the transition relation:
.
[edit] Example
A simple example of a tree walking automaton is a TWA that performs depth-first search (DFS) on the input tree. The automaton A has 3 states, Q = {q0,qleft,qright}. A begins in the root in state q0 and descends to the left subtree. Then it processes the tree recursively. Whenever A enters a node v in state qleft, it means that the left subtree of v has just been processed, so it proceeds to the right subtree of v. If A enters a node v in state qright, it means that the whole subtree with root v has been processed and A walks to the parent of v and changes its state to qleft or qright, depending on whether v is a left or right child.
[edit] Properties
Unlike branching automata, tree walking automata are difficult to analyze and even simple properties are nontrivial to prove. The following list summarizes some known facts related to TWA:
- As shown by Bojanczyk & Colcombet (2006), deterministic TWA are strictly weaker than nondeterministic ones (
) - deterministic TWA are closed under complementation (but it is not known whether the same holds for nondeterministic ones)
- the set of languages recognized by TWA is strictly contained in regular tree languages (
), i.e. there exist regular languages which are not recognized by any tree walking automaton (Bojanczyk & Colcombet 2008).
[edit] See also
- Pebble automata, an extension of tree walking automata
[edit] References
- Aho, A; Ullman, J (1971). "Translations on a context free grammar". Information and Control 19 (5): 439–475. doi:10.1016/S0019-9958(71)90706-6.
- Bojanczyk, Mikołaj; Colcombet, Thomas (2006). "Tree-walking automata cannot be determinized". Theoretical Computer Science 350 (2-3): 164–173. doi:10.1016/j.tcs.2005.10.031.
- Bojaczyk, Mikołaj; Colcombet, Thomas (2008). "Tree-Walking Automata Do Not Recognize All Regular Languages". SIAM Journal on Computing 38 (2): 658. doi:10.1137/050645427.
[edit] External links
- Mikołaj Bojanczyk: Tree-walking automata. A brief survey.
)
), i.e. there exist regular languages which are not recognized by any tree walking automaton (