Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1 Introduction
One of the central tasks on the border between formal language theory and
complexity theory is to describe infinite objects such as languages by finite for-
malisms such as automata, grammars, expressions etc., and to investigate the
descriptional complexity and capabilities of these formalisms. Formalisms like
expressions and finite automata have proven to be very useful in building com-
pilers, and techniques converting one formalism into the other are used as basic
tools in the design of computer systems [Tho68] such as UNIX (see [HMU01],
p. 123). A typical application in lexicographical analysis starts with a regular
expression that has to be converted into an ε-free nondeterministic finite au-
tomaton. Here, the descriptional complexity of an expression is its length and
the descriptional complexity of a nondeterministic finite automaton (NFA) is
the number of its transitions (edges).
Surprisingly ε-free NFA are capable of simulating regular expressions of length
n with at most O(n(log2 n)2 ) transitions [HSW97] and hence in this case the loss
of ε-transitions does only weakly deteriorate the conciseness of ε-free NFAs. In
[Lif03] a lower bound of Ω(n(log2 n)2 / log2 log2 n) is shown and as a consequence
the upper bound of [HSW97] is almost tight.
In contrast to translating regular expressions into ε-free NFAs, no subqua-
dratic transformation from NFAs into ε-free NFAs is known. Since any regular
Supported in part by SNF grant 200021-107327/1 and DFG grant SCHN 503/2-2.
L. Caires et al. (Eds.): ICALP 2005, LNCS 3580, pp. 385–396, 2005.
c Springer-Verlag Berlin Heidelberg 2005
386 J. Hromkovič and G. Schnitger
(i) Ln is defined over the alphabet {0, 1}n , Kn is defined over the alphabet
{0, 1},
(ii) Ln and Kn can be accepted by NFAs with O(n · 2n ) transitions,
(iii) every ε-free NFA accepting Ln has at least Ω(22n )√ transitions and
(iv) every ε-free NFA accepting Kn has at least Ω(2n+c n ) transitions for every
constant c < 1/2.
Hence, for m = 2n , Ln and Kn can be accepted by NFAs with O(m log2 m)
transitions, but every ε-free NFA for L√n has at least Ω(m2 ) transitions, whereas Kn
requires ε-free NFAs of size O(m · 2c· log2 m ) for every c < 1/2. Thus ε-free NFAs
for Ln require almost quadratically more transitions than unrestricted NFAs for
Ln and the obvious transformation from NFAs to ε-free NFAs cannot be improved
considerably. The provable gap for binary alphabets is smaller, but still a far larger
than poly-logarithmic gap is required. Moreover, for a large class of NFAs, we show
in Lemma 4 that the lower bound of Theorem 1 (iv) is almost optimal.
We use methods from communication complexity. However communication
arguments can be applied to ε-free NFAs and NFAs alike and hence we have to
carefully mix communication arguments with graph-theoretical arguments.
The rest of this paper is organized as follows. In Section 2 we describe the
languages Ln which are hard for ε-free NFAs. Lower bounds for large and small
alphabets are presented in Sections 3 and 4 respectively. Conclusions and open
problems are stated in Section 5.
To show this fact replace any 1 (resp. −1) by a 0 (resp. 1) and call the resulting
matrix H n . Another inductive argument verifies that H n is the matrix of inner
products modulo two: we may label rows and columns by vectors u, v ∈ ZZ2n
such that H n [u, v] = u, v mod 2. If the sets X, Y ⊆ ZZ2n define a 0-chromatic
submatrix of H n , then we may close X and Y under addition to obtain vector
spaces X and Y (with X ⊆ X and Y ⊆ Y ) which still define a 0-chromatic
submatrix. Thus X and Y are orthogonal vector spaces and dim(X)+ dim(Y ) ≤
n follows. Hence |X| · |Y | ≤ 2n .
The language Ln is defined over the alphabet Σn = {0, 1}n and we set
Ln = {ε} ∪ Σn ∪ Ln,k , where (2)
k≥2
Ln,k = {u1 · · · uk ∈ Σnk | Hn [ui , ui+1 ] = 1 for all i < k}. (3)
3 Large Alphabets
We first sketch the argument verifying that every ε-free NFA for Ln has at
least Ω(22n ) transitions (edges). We state without proof that Ln,k (see (3)) has
surprisingly small ε-free NFA’s for small values of k and, as a consequence, our
argument has to concentrate on Ln,k for large values of k.
n
Lemma 1. Ln,k is recognizable by ε-free NFA’s of size at most O(k · 22n− k ).
Let An be an NFA without ε-transitions which recognizes Ln and let k be
an arbitrary integer. We first observe that An implicitly also recognizes Ln,k : we
unravel the transition diagram of An into a layered directed acyclic graph Fn,k
with k + 1 layers. Layer Vi (for 0 ≤ i ≤ k) consists of all vertices (x, i) such that
x is a vertex of the transition diagram of An and x is endpoint of a path of An
which starts in q0 and traverses i edges. Observe that layer V0 consists only of
the starting state q0 . We insert an edge ((x, i), (y, i + 1)) with label a ∈ {0, 1}n
into Fn,k iff (x, y) is an edge of An with label a.
Next we remove all vertices of Fn,k which are not traversed by an accepting
path starting in q0 and ending in a vertex of the last layer Vk . Finally we replace
388 J. Hromkovič and G. Schnitger
all vertices of Vk by the new vertex qf and insert an edge from (u, k − 1) ∈ Vk−1
to qf with label a, provided there was an a-transition from (u, k − 1) to an
accepting vertex of Vk . Let Fn,k be the resulting labelled graph.
Proposition 2. (a) Fn,k is a layered acyclic graph with k + 1 layers.
∗
(b) Fn,k has a path q0 → qf with label sequence (u1 , . . . , uk ) iff u1 · · · uk ∈ Ln .
(c) For any i, the number of edges between vertices in Vi and Vi+1 is bounded
by the number of edges of the transition diagram of An .
Our goal is to show that there are successive layers Vi and Vi+1 such that
the number of edges between Vi and Vi+1 has to be large, provided the total
number k + 1 of layers is sufficiently large. We utilize that the Hadamard matrix
Hn has only monochromatic submatrices of size at most 2n (see (1)). To apply
this property we show that any inner vertex x of Fn,k (i.e., any vertex different
from q0 and qf ) defines a monochromatic submatrix of Hn spanned by the rows
with labels in S(x) (resp. columns with labels in T (x)), where S(x) and T (x)
are the sets of incoming and leaving labels of v respectively. As a consequence
of (1) we obtain |S(x)| × |T (x)| ≤ 2n , whereas in total at least 22n−1 pairs of
labels, namely all pairs (u, v) with Hn [u, v] = 1, have to be supported. Hence,
if thesets S(x) and T (x) are all of identical size s respectively t, then s · t ≤ 2n
and x∈V1 |S(x)| · |T (x)| = x∈V1 s · t ≥ 22n−1 holds. Thus V1 has to consist
of at least 2n−1 vertices and it is optimal to choose s = t = 2n/2 . Thus at least
23n/2 transitions are required.
We apply this procedure to vertices of the second layer by considering paths
of length three starting in q0 . However this time we select for any label v a label
u(v) such that the pair u(v)v is supported by the least number of paths of length
two originating in q0 . Thus when considering all label sequences u(v)vw we have
in effect decreased the “fanin multiplicity” of label v for vertices of the second
layer and this reduction can only be compensated for by increasing the “fanout
multiplicity” of labels w for vertices of the second layer. (The construction in
Lemma 1 also explicitly increases fanout multiplicity by copying edges.) We
repeat this procedure n times to verify the required large number of transitions.
for an arbitrary subset K of labels. We say that vertex x ∈ V1 covers the 1-entry
(u, v) of Hn with multiplicity mx (u, v) = a · b, if u occurs in fanin∗ (x) with
multiplicity a and v occurs in fanout∗ (x) with multiplicity
b. Finally we say that
(u, v) is covered with multiplicity m(u, v) = x∈V1 mx (u, v).
For a given set K ⊆ {0, 1}n of labels we define Ln,k (K) as the subset of
Ln consisting of all words of length k beginning with a letter in K. Finally let
Fn,k (K) be the subgraph of Fn,k obtained by removing all edges between q0
and V1 with label outside of K. We say that a graph G recognizes Ln,k (K), if
G is a layered directed acyclic graph with k + 1 layers V0 , . . . , Vk . Moreover V0
and Vk consist of exactly one state each and exactly the words from Ln,k (K)
appear as label sequences of paths starting in V0 and ending in Vk . Observe that
Proposition 2 implies that Fn,k (K) recognizes Ln,k (K).
Assume that graph G recognizes Ln,k (K). We show that G has many edges
incident with vertices in V1 , provided many 1-entries have to be covered often.
Lemma 2. Let K ⊆ {0, 1}n be an arbitrary subset of at least 2n−1 labels. As-
sume that the graph G recognizes Ln,k (K) and that
| fanin∗ (x)| = a1 · 2n and | fanout∗ (x)| = a2 · 2n
x∈V1 x∈V1
holds for layer V1 of G. If at least |K| · 2n−2 1-entries from K × {0, 1}n are
covered with multiplicity at least b, then a1 · a2 ≥ b · 2n−8 .
∗
vertex x ∈∗ V1 is large, ifn|fanin (x)| ≥ 2 · a1 , and
4
Proof. We say that small
n−4
otherwise. Since x∈V1 | fanin (x)| = a1 · 2 , there are at most 2 large
vertices. But according to (4) the submatrix fanin(x) × fanout(x) of a vertex
x ∈ V1 covers at most 2n 1-entries and hence fanin∗ (x) × fanout∗ (x) also covers
at most 2n 1-entries, since no new 1-entries are introduced. Therefore at most
2n−4 · 2n = 22n−4 1-entries of Hn are covered by large vertices.
By assumption at least |K| · 2n−2 ≥ 22n−3 1-entries from K × {0, 1}n are
covered with multiplicity at least b. But then at least 22n−3 − 22n−4 = 22n−4
1-entries from K × {0, 1}n have to be covered with multiplicity at least b by
small vertices only. We have
b · 22n−4 ≤ | fanin∗ (x)| · |fanout∗ (x)|
x∈V1 ,x small
≤ 24 · a1 · |fanout∗ (x)| = 24 · a1 · a2 · 2n
x∈V1
390 J. Hromkovič and G. Schnitger
Lemma 3. Let K ⊆ {0, 1}n be an arbitrary subset of at least 2n−1 labels. As-
sume that the graph G recognizes Ln,k (K) and that
| fanin∗ (x)| = a1 · 2n and | fanout∗ (x)| = a2 · 2n
x∈V1 x∈V1
holds for layer V1 of G. Then there is a subset K ⊆ {0, 1}n of size 2n−1 and
a graph G which accepts exactly all words in Ln,k−1 (K ). G results from G by
removing the first layer of G and introducing at most 29 · a1 · a2 new edges from
the starting state to the new first layer.
Proof. We first observe that less than |K|·2n−2 pairs from K×{0, 1}n are covered
with multiplicity at least b = a1 · a2 /2n−9 , since otherwise we get a1 · a2 /2n−8 ≥
b = a1 · a2 /2n−9 with Lemma 2.
For every label v select a label u = u(v) such that the multiplicity m(u, v)
is minimal among all labels u with Hn [u, v] = 1. Observe that m(u(v), v) ≥ b
holds for less than 2n−2 labels v ∈ {0, 1}n , since m(u(v), v) ≥ b implies that the
|K| pairs K × {v} are covered with multiplicity at least b. Thus we find a set K
of more than 2n − 2n−2 ≥ 2n−1 labels v with m(u(v), v) ≤ b.
We say that edge e belongs to label v, if e leaves a vertex of layer V1 and e is
traversed by an accepting path for some input with prefix u(v)v. We say that e
belongs to K iff e belongs to a label of K . A label v ∈ K appears on at most b
accepting paths with prefix u(v)v and hence at most b · |K | edges belong to K .
In order to construct G from G we remove all vertices of layer V1 and insert
an edge (q0 , x) (with label v ∈ K ) from q0 to a vertex x ∈ V2 iff there is an
accepting path from q0 to x with prefix u(v)v. The number of layers decreases
from k + 1 to k after insertion of at most b · |K | ≤ b · 2n edges. The new graph G
recognizes Ln,k−1 (K ). We are done, since b · 2n = a1 a2 /2n−9 · 2n = 29 · a1 a2 .
We can now conclude the argument. Let us assume that Fn,k has ai · 2n edges
(1)
ending in a vertex of Vi . We apply Lemma 3 and obtain a graph Fn,k as well as
a subset K1 of at least 2n−1 labels such that Fn,k accepts Ln,k−1 (K1 ). We set
(1)
(i−1)
(0) (i) 29 · a1 · ai+1
a1 = a1 and a1 =
2n
and instead of a1 · 2n edges between layers V0 and V1 we now have at most
(0)
29 · a1 · a2 = a1 · 2n edges between layer zero and the new layer one. We repeat
(0) (1)
NFAs With and Without ε-Transitions 391
this procedure i times and obtain a graph Fn,k as well as a set Ki of 2n−1 labels
(i)
(i−1)
29 ·a ·a
· 2n = a1 · 2n
(i) (i)
such that Fn,k recognizes Ln,k−i (Ki ) with at most 1
2n
i+1
edges between layer zero and the new layer one. Hence we obtain
(k−3)
(k−2) 29 · a1 · ak−1 29(k−2) · a1 · · · ak−1
a1 = = ··· = .
2n 2(k−2)·n
(k−1)
We apply Lemma 2 to G = Fn,k (with b = 1) and obtain
29(k−2) · a1 · · · ak
· ak ≥ 2n−8 .
(k−2)
= a1
2(k−2)·n
Thus a1 · · · ak ≥ 2(k−1)·n /(28 · 29(k−2) ) ≥ 2(k−1)·n /29(k−1) and we have to solve
the optimization problem
Theorem 1 follows, if we set k = n. Observe that we have also shown that the
construction in Lemma 1 is almost optimal.
4 Small Alphabets
We apply our approach for large alphabets to small aphabets and first show
an upper bound. In Section 4.1 we investigate a family of languages over {0, 1}
which is hard for ε-free NFAs. The argument concludes in Section 4.2.
The regular language Ln,2 can be recognized by an NFA whose transition
diagram consists of a layered acyclic graph with 2n sources, 2n sinks and O(n)
layers. Sources and sinks have to be expanded into edges labelled by letters from
the alphabet {0, 1}n . What happens, if we work with the binary alphabet instead
and expand sources and sinks into 0-1 labelled paths of length n? We call the
corresponding class of NFAs “n-bipartite” NFAs.
Definition 1. An NFA N is called n-bipartite iff its transition diagram G is a
layered acyclic graph with 2n sources and 2n sinks. Each source (resp. sink) is
starting point (resp. endpoint) of its own 0-1 labelled path of length n; the paths
are node-disjoint. The endpoints of source paths and the starting points of sink
paths are connected by n layers of 2n vertices each. (The endpoints of source
paths define layer one and the starting points of sink paths define layer n.) All
edges between two layers are ε-transitions. The 2n sources are the only initial
states and the 2n sinks are the only accepting states.
The advantage of ε-transition decreases for the binary alphabet in comparison
to large alphabets as the following observation shows.
392 J. Hromkovič and G. Schnitger
We omit the proof due to space limitations. Observe that we do not obtain
asymptotically larger bounds, if arbitrary sequences of n-bit strings, as in the
language Ln , have to be accepted: it suffices to provide transitions from a sink
path back to the corresponding source path.
|V |
|f ({0, 1}n−l w) ∩ V | ≤ 2n · .
2l
n
(c) |fanin (u)| ≤ 7 · n or |fanout (u)| ≤ 5 · n for any vertex u ∈ i=0 Vi , provided
Fn (f ) has at most 22n vertices.
Proof. It suffices to show that any property (a), (b) or (c) does not hold with
probability at most 14 , provided n is sufficiently large.
NFAs With and Without ε-Transitions 393
that the overall fanin or the overall fanout of vertices in Vn has to be large. We
begin by showing that X has to be large, if X is hit by many strings.
Lemma 5. Let α > 0 be arbitrary. If at least α · 22n strings hit vertices in X,
2n+l
then |X| ≥ α · 10n 2.
√ l
Proof. Remember l = c · n. For √ w ∈ {0, 1} let X(w) be the set of vertices
n
in X which are hit by at least 2 strings from {0, 1}n−l · w · {0, 1}n . We pick
an arbitrary vertex u ∈ X(w) which is hit by t strings α1 wβ1 , . . . , αt wβt . We
define Vu (w) as the vector space spanned
√ by f (α1 w), . . . , f (αt w) and observe
that Vu (w) has dimension at least n ≥ l. Hence we may apply Proposition
3(b) and obtain that t ≤ |f ({0, 1}n−l w) ∩ Vu (w)| ≤ 2n · |Vu2(w)| l .
2n
But then vertex u hits at most 2n · |Vu2(w)|
l · |Vu (w)| = 2n · 2 n−l
strings from
n−l n
{0, 1} · w · {0, 1} , since all n-bit suffices belong to the orthogonal space
Vu (w)⊥ . If x(w) is the number of strings from {0, 1}n−l · w · {0, 1}n hitting X,
x(w)
then X(w) has to consist of at least 2n·2 n−l vertices. We observe as a consequence
receives more than √ β · et /2n edges and if |fanin (u)| > 7n. Observe that there is
n
a total of at most c n · 2β fat vertices in Vt for t0 ≤ t < n.
We claim that not too many strings hit fat vertices u. To see why, we first
observe |fanout (u)| ≤ 5n. Hence there are at most 5n vector spaces V1 ×
V1⊥ , . . . , V5n × V5n
⊥
such that (f (x), f (y)) belongs to one of the spaces
√ for any
string xy that hits u. Thus, with Proposition 3(a) at most 5n · (2 n)2 · 2n =
√ n 2n
20n2 · 2n strings hit u and at most (c n · 2β ) · (20n2 · 2n ) = 20c · n2.5 · 2β strings
hit fat vertices. Set β = 320c · n2.5 .
√ for at most 2 /16
2n
We remove all fat vertices and destroy accepting paths
t−1
strings. An inductive argument shows that |fanin (u)| ≤ 2 · Πτ =t0 (βeτ /2n ) for
n
t √
all vertices u ∈ Vt for t0 ≤ t < n. Hence, since e = τ =t0 eτ ≤ 2n+ n /(320 · n2 )
by assumption, all fanin sets have size bounded by
√
n e √
c· n
√
n 320 · n2 · e c·√n √
n
2 · (β · √ ) = 2 · ( ) ≤ 2 · 2c·n .
c n · 2n 2n
We repeat this procedure, but now utilize the fanout restrictions. We remove (a
new set of) fat vertices and lose additionally 22n−4 strings. Counting also the
strings lost by removing X ∪ X and observing α = 1/16, we have lost at most
2α22n + 2 · 22n−4 = 22n−2 strings and at least 22n−2 strings are still “alive”.
Hence, if Fn (f ) is not too large, then one half of all strings hit vertices in Vn
with small fanin and small fanout. However we now show that the overall fanin
or the overall fanout of Vn∗ has to be large.
23n/2
|fanin (v)|, |fanout (v)| ≤ √ as well as (6)
16 n
v∈Vn∗ v∈Vn∗
References
[HMU01] J.E. Hopcroft, R. Motwani, J.D. Ullman, ”Introduction to Automata Theory,
Languages and Computation”, Addison-Wesley, 2001.
[HSW97] J. Hromkovič, S. Seibert, and T. Wilke, Translating regular expression into
small ε-free nondeterministic automata, Journal of Computer and System
Sciences, 62 (4), pp. 565-588, 2001.
[KN97] E. Kushilevitz and N. Nisan, Communication Complexity, Cambridge Uni-
versity Press, 1997.
[Lif03] Y. Lifshits, A lower bound on the size of ε-free NFA corresponding to a
regular expression, Inf. Process. Lett. 85(6), pp. 293-299, 2003.
[Tho68] K. Thompson, Regular expression search, Comm. ACM 11, pp. 419-422,
1968.