Informltion Processing North-Holland
Letters
27 April 1992
42 (1992) 25-27
A lower bound for the nondeterministic complexity of context-free recognition Helmut
space
Alt
Fachbereich Mathematik, Freie Unicersitiit Berlin, Arnimallee 2 - 6, W-l 000 Berlin 33, Germany
Viliam
Geffert
Department of Computer Science, Jesenna 5, 04154 Kosice, Czechoslovakia
Kurt Mehlhorn Max-Planck-lnstitut fiir Informatik, Im Stadtwald, W-6600 Saarbriicken, Germany and Fachbereich Informatik, UniL~ersitiitdes Saarlandes, W-6600 Saarbriicken, Germany Communicated by J. Hgstad Received 9 October 1991 Revised 25 January 1992
Abstract Alt, H., V. Geffert and K. Mehlhorn, A lower bound Information Processing Letters 42 (1992) 25-27. We prove language.
a logn
lower bound
Keywords: Computational
for the nondeterministic
on the nondeterministic
complexity,
context-free
We show that the nondeterministic space complexity of every nonregular deterministic contextfree language is at least log n. Previously, this was only known for the deterministic space complexity [1,21. For a function s : N + N call a nondeterministic Turing machine s(n)-space-bounded if for all n E N all computations on inputs of length n use
0020-0190/92/$05.00
0 1992 - Elsevier
Max-PlanckSaarbriicken,
Science Publishers
complexity
of context-free
recognition,
of every nonregular
deterministic
context-free
languages
1. Introduction
Correspondence to: Professor K. Mehlhorn, Institut fiir Informatik, Im Stadtwald, W-6600 Germany.
space
space complexity
at most s(n) cells on the worktape and call it weakly-s(n)-space-bounded if for all n E N and all accepted inputs of length n there is at least one accepting computation path that uses at most s(n) cells on the worktape. Let NSPACE(s(n)) be the class of languages that are accepted by s(n)space-bounded nondeterministic machines and let WEAKNSPACE(s(n)) be the class of languages that are accepted by weakly-s(n)-space-bounded nondeterministic machines. The following theorem is essential for the proof of our lower bound. Theorem 1. Let s : N + N be any function, let and let (a ,, . . . , uk) be a finite set of symbols, L c a; ... uk* be a language. Then L E
B.V. All rights reserved
25
Volume 42, Number
NSPACE(s(n)) some constant
INFORMATION
1 implies
z E NSPACE(cs(n))
PROCESSING
for
c.
Theorem 1 is a partial extension of the Immermann-Szelepscenyi result [.5,8] to space bounds below log n. The extension is partial because it only applies to languages L which are subsets of a: ... ok* for some finite set (a,, a2,. . . , uk} of symbols. A language L is called deterministic context-free if it is accepted by a deterministic pushdown automaton. A language L is called strictly nonregulur if there are strings u, L’, w, x, and y such that L n UL’* wx *y is context-free and nonregular. A context-free language L is bounded if there are strings w,, . . . , wk such that L c WI*w: ...
WC.
For functions f : N -+ N and g : N - M we write c > 0 such that f = a*(g) if th ere is a constant f(n) > c . g(n) for infinitely many n. Theorem 2. Let s : N -+ N be any function, u nonregular
deterministic
context-free,
nonregular language, or a nonregular and let L E NSPACE(s(n)). n).
guage, R*(log
Theorem
2 generalizes
let L be a strictly
bounded Then
the following
lans =
theorem.
Theorem 3 [l]. Let s : N -+ N be any function, be a nonregular
deterministic
context-free,
let L a strictly
nonregular language, or a nonregular bounded language, and let L,z E WEAKNSPACE(s(n)). Then s = Q(log n).
We prove both theorems in Section 2. Section 3 discusses the results and puts them into context.
2. Proofs For a function f :FV + B$ a language L G (0, I} * is called f(n)-zero-bounded if every w E L of length n contains at most f(n) zeroes. A function s: ki - N is called fully space constructible if there is a deterministic Turing machine which on every input of length n uses exactly s(n) cells of the worktape. 26
27 April lYY2
LETTERS
In 131 the following Immermann-Szelepcsenyi below log n was shown:
partial extension of the result to space bounds
Theorem 4 [3, Theorem 31. Let s : N + N be fully space constructible, let d > 0 be a constant, let f : N + N be such that f(n) < d”(“) for all n, and let L E (0, l]* n NSPACE(s(n)) bounded. Then z E NSPACE(cs(n)) stant c > 0.
be f(n>-zerofor some con-
The proof of Theorem 4 in [3] actually works under slightly weaker hypotheses. It is only required that the value f(n) can be computed using no more than O(s(n>) space; the full space constructibility of s is not needed. Assume that f(n) = k for some constant k and all n. Then the value f(n) can clearly be computed in O(s(n>) space, no matter what the function s is. We have thus established the following lemma. Lemma 4. Let s : N + N be any function, let k E N be a constant, and let L E IO, 1) * n NSPACE(s(n)) be k-zero-bounded. Then z E NSPACE(cs(n)) for some constant c > 0. Theorem 1 is a direct consequence 4. Let L Cu*a* - I 2 . . . sky. Define M, = {“I()“? Then
M,
NSPACE(s(n))
of Lemma
. . ~Ol’kIa;la;~...a~EL}. is
(k - l&zero-bounded and L E implies M, E NSPACE( s( n)).
Thus M, E NSPACE(c,s(n)) according to Lemma 4 and hence z E NSPACE(c,s(n>> for some constants c,,c* > 0. This proves Theorem 1. We now turn to the proof of Theorem 2. Assume first that L E NSPACE(s(n)) is a nonregular bounded context-free language, i.e., L c wI*w2* ... w: for some strings w,, w2,. . . , wk. Let a,, . . . , a, be k distinct symbols. Define
Then Mz is nonregular and context-free and belongs to NSPACE(c,s(n)) for some constant c, > 0. Hence M, E NSPACE(c,s(n)) for some constant c2 > 0 according to Theorem 1. But then M,,M, E WEAKSPACE(cs(n)) for some constant
VoluGe
42, Number
INFORMATION
1
PROCESSING
c, since NSPACE(s(n)) C WEAK.SPACE(s(n)) for all bounds s(n)>, and therefore s = R*(log n> according to Theorem 3. Assume next that L E NSPACE(s(n)) is strictly nonregular, i.e., there are strings U, L:, w, X, y, such that L’ = L f3 uu* wx *y is context-free and nonregular. Clearly, L’ E NSPACE(s(n)). Also, L’ is bounded and hence s = R*(log n) according to the preceding paragraph. Assume finally that L E NSPACE(s(n)) is nonregular and deterministic context-free. Then L is strictly nonregular as Stearns [7] has shown. Thus s = sZ*(log n). This completes the proof of Theorem 2.
3. Discussion We have shown a logarithmic lower bound on the deterministic space complexity of every nonregular deterministic context-free language. The lower bound does not extend to WEAKNSPACE. In fact, in [2] it was observed that the nonregular deterministic context-free language L,={a’~b’“In,mE~,n#m} belongs to WEAKNSPACE(log log n). Table 1 summarizes the current knowledge about the space complexity of context-free lan-
Table 1 Current bounds for the space complexity of context-free recognition. All upper bounds are for deterministic machines. all lower bounds are for nondeterministic machines. Entries shown in bold are known to be tight. Type of bound
nonregular deterministic CFL
nonregular CFL
existential upper universal upper existential lower universal lower
log n 10g% log n log n
log log n log2n log n log log n
27 April
LETTERS
1992
guages. Every nonregular deterministic contextfree language requires nondeterministic space R*(log n) [this paper] and every nonregular context-free language requires nondeterministic space R*(loglog n) [4,61. The language
is nonregular deterministic context-free (also bounded and strictly nonregular) and belongs to DSPACEOog n). The language
L, = (0, I, #]*\ . . . #bin(n)m
(hin(l)#hin(2)R#
n E N},
where bin(i) is the binary representation of integer i and wR denotes the reversal of string w, is nonregular context-free and belongs to DSPACE(log log n) [4,6]. Finally, every contextfree language belongs to DSPACE(10g2n) [4,61.
References [I] H. Alt, Lower bounds on space complexity for context-free recognition, Acta Inform. 12 (1979) 33-61. [2] H. Alt and K. Mehlhorn, Lower bounds for the space complexity of context-free recognition, in: Proc. 3rd ICALP (Edinburgh University Press, Edinburgh, 1976) 338-354. [3] V. Geffert. Tally versions of Savitch’s and ImmermannSzelepcsenyi theorems for sublogarithmic space. SIAM J. Comput., to appear. [4] J.E. Hopcroft and J.D. Ullman, Formal Languages and their Relation to Automata (Addison-Wesley, Reading, MA, 1969). [5] N. Immermann, Nondeterministic space is closed under complementation, SIAM J. Comput. 17 (1988) 935-938. [6] P.M. Lewis. J. Hartmanis and R.E. Stearns, Memory bounds for the recognition of context-free and contextsensitive languages, in: IEEE Con& Record on Switching Circuit Theory and Logical [7] R.E.
Stearns,
A regularity
Inform. and Control [8] R. Szelepcsenyi,
nondeterministic
Design (1965)
179-202.
test for pushdown-machines,
(1967) 323-340.
The method of forced enumeration automata, Acta Inform. 26 (1988)
for 279-
284.
27