Tree transducer


In theoretical computer science and formal language theory, a tree transducer is an abstract machine taking as input a tree, and generating output – generally other trees, but models producing words or other structures exist. Roughly speaking, tree transducers extend tree automata in the same way that word transducers extend word automata.
Manipulating tree structures instead of words enable TT to model syntax-directed transformations of formal or natural languages. However, TT are not as well-behaved as their word counterparts in terms of algorithmic complexity, closure properties, etcetera. In particular, most of the main classes are not closed under composition.
The main classes of tree transducers are:

Top-Down Tree Transducers (TOP)

A TOP T is a tuple such that:
For instance,
is a rule – one customarily writes instead of the pair – and its intuitive semantics is that, under the action of q, a tree with f at the root and three children is transformed into
where, recursively, and are replaced, respectively, with the application of on the first child and
with the application of on the third.

Semantics as term rewriting">Term rewriting system">term rewriting

The semantics of each state of the transducer T, and of T itself, is a binary relation between input trees and output trees.
A way of defining the semantics formally is to see as a term rewriting system, provided that in the right-hand sides the calls are written in the form, where states q are unary symbols. Then the semantics of a state q is given by
The semantics of T is then defined as the union of the semantics of its initial states:

Determinism and domain

As with tree automata, a TOP is said to be deterministic if no two rules of δ share the same left-hand side, and there is at most one initial state. In that case, the semantics of the DTOP is a partial function from input trees to output trees, as are the semantics of each of the DTOP's states.
The domain of a transducer is the domain of its semantics. Likewise, the image of a transducer is the image of its semantics.

Properties of DTOP

As in the simpler case of tree automata, bottom-up tree transducers are defined similarly to their top-down counterparts, but proceed from the leaves of the tree to the root, instead of from the root to the leaves. Thus the main difference is in the form of the rules, which are of the form.