
218 Automata for Unranked Trees
If we are working with DFHA, then for each p ∈ Pos(t) there is at most one
state in ρ(p). This means that there is at most one sequence q
1
· · · q
k
to consider.
From this observation we easily obtain (2), and also (4) in combination with the
fact that the uniform membership problem for AFAs is solvable in polynomial
time.
For (1) we just note that the condition in the if-statement can be decided in
polynomial time for NFAs: One starts at the initial state of the NFA and then
collects all states of the NFA that are reachable by using elements from ρ(p1)
as input, and then continues to compute all states reachable from there with
inputs from ρ(p2), and so on. If the last set contains a final state of the NFA,
then the condition is satisfied.
To prove (3) we do not use the generic algorithm because we have to provide a
nondeterministic one for the upper bound. It is r ather easy to see that guessing
an accepting run of A and then verifying it can be done in polynomial time
because the uniform membership problem for AFAs is solvable in polynomial
time.
We show the NP-hardness even for horizontal languages represented by in-
tersections of regular expressions instead of the more general formalism of alter-
nating automata. We use a reduction from the satisfiability problem for Boolean
formulas.
Let ϕ = c
1
∧· · ·∧c
m
be such a formula in CNF using the variables x
1
, . . . , x
n
,
where the c
i
are disjunctions of literals, i.e. variables or their negations. An
assignment to the variables is coded as a string of length n over the alphabet
{0, 1}, where 1 in position i codes that variable x
i
is set to true and 0 that it
is set to false. A literal x
j
is now translated to a regular expression describing
all strings of length n with 1 in position j. Correspondingly, the literal ¬x
j
is
translated to an expression requiring 0 in position j of the string. A clause c
i
corresponds to the regular expression e
i
obtained as the union of the expressions
for the literals in c
i
. The expression e
ϕ
, finally, corresponds to the intersection
of all the e
i
.
The NFHA A = (Q, Σ, Q
f
, ∆) uses a singleton alphab et Σ = {a}, three
states Q = {0, 1, q} with Q
f
= {q}, and the transitions
a({ε}) → 0, a({ε}) → 1, a(e
ϕ
) → q.
Now it is rather easy to observe that A accepts the tree a(a · · · a
|
{z}
n
) iff ϕ is satis-
fiable because an accepting run has to code a satisfying assignment for ϕ at the
leaves of the tree.
Finally, (5) follows easily from the NP-completeness of the uniform mem-
bership problem for RE
k
(see Theorem 8.5.3).
One should note here that the first two items of Theorem 8.5.6 can easily be
obtained by using the extension encoding and the results from Section 1.7 on
the uniform membership problem for ranked tree automata.
On the other hand, this approach is not optimal for (3) and (4). One might
think that hedge automata with horizontal languages represented by alternating
word automata can directly be translated to alternating tree automata working
on encodings. But (3) from the above theorem indicates that this is not possible
unless P=NP because the uniform membership problem for alternating tree
automata is solvable in polynomial time (compare Section 7.5).
TATA — November 18, 2008 —