A shrinking lemma for random forbidding context languages

Similar documents
Left-Forbidding Cooperating Distributed Grammar Systems

Note On Parikh slender context-free languages

Parikh s theorem. Håkan Lindqvist

Note Watson Crick D0L systems with regular triggers

P Systems with Symport/Antiport of Rules

HENNING FERNAU Fachbereich IV, Abteilung Informatik, Universität Trier, D Trier, Germany

Properties of Fibonacci languages

Hybrid Transition Modes in (Tissue) P Systems

Power and size of extended Watson Crick L systems

Einführung in die Computerlinguistik

CS 275 Automata and Formal Language Theory

On Controlled P Systems

Chapter 6. Properties of Regular Languages

Introduction to Formal Languages, Automata and Computability p.1/42

Grammars (part II) Prof. Dan A. Simovici UMB

Some hierarchies for the communication complexity measures of cooperating grammar systems

Independence of certain quantities indicating subword occurrences

Solvability of Word Equations Modulo Finite Special And. Conuent String-Rewriting Systems Is Undecidable In General.

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Decision Problems Concerning. Prime Words and Languages of the

Foundations of Informatics: a Bridging Course

Theory of Computation

Characterizations of Catalytic Membrane Computing Systems

Minimizing finite automata is computationally hard

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

ON MINIMAL CONTEXT-FREE INSERTION-DELETION SYSTEMS

To make a grammar probabilistic, we need to assign a probability to each context-free rewrite

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

Accepting H-Array Splicing Systems and Their Properties

Computability and Complexity

Properties of Context-Free Languages

Non-context-Free Languages. CS215, Lecture 5 c

How to Pop a Deep PDA Matters

Languages. Languages. An Example Grammar. Grammars. Suppose we have an alphabet V. Then we can write:

Fundamenta Informaticae 30 (1997) 23{41 1. Petri Nets, Commutative Context-Free Grammars,

Languages, regular languages, finite automata

This lecture covers Chapter 7 of HMU: Properties of CFLs

Einführung in die Computerlinguistik

On P Systems with Active Membranes

Descriptional Complexity of Formal Systems (Draft) Deadline for submissions: April 20, 2009 Final versions: June 18, 2009

Chapter 4: Context-Free Grammars

Computability and Complexity

Fall 1999 Formal Language Theory Dr. R. Boyer. 1. There are other methods of nding a regular expression equivalent to a nite automaton in

On the number of occurrences of all short factors in almost all words

Section Summary. Relations and Functions Properties of Relations. Combining Relations

Context-free grammars and languages

Computational Models - Lecture 5 1

290 J.M. Carnicer, J.M. Pe~na basis (u 1 ; : : : ; u n ) consisting of minimally supported elements, yet also has a basis (v 1 ; : : : ; v n ) which f

What we have done so far

State Complexity of Two Combined Operations: Catenation-Union and Catenation-Intersection

Einführung in die Computerlinguistik Kontextfreie Grammatiken - Formale Eigenschaften

Context Free Grammars

Fall 1999 Formal Language Theory Dr. R. Boyer. Theorem. For any context free grammar G; if there is a derivation of w 2 from the

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

P Finite Automata and Regular Languages over Countably Infinite Alphabets

Computational Models: Class 3

Comment: The induction is always on some parameter, and the basis case is always an integer or set of integers.

Hashing Techniques For Finite Automata

The Minimal Cost Reachability Problem in Priced Timed Pushdown Systems

Classication of greedy subset-sum-distinct-sequences

Automata Theory (2A) Young Won Lim 5/31/18

CS375: Logic and Theory of Computing

On Rice s theorem. Hans Hüttel. October 2001

Chomsky and Greibach Normal Forms

UNIT-VI PUSHDOWN AUTOMATA

Section 1 (closed-book) Total points 30

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

P systems based on tag operations

10. The GNFA method is used to show that

Theoretical Computer Science. State complexity of basic operations on suffix-free regular languages

Semi-simple Splicing Systems

On Stateless Multicounter Machines

Properties of Context-free Languages. Reading: Chapter 7

NOTES ON AUTOMATA. Date: April 29,

Syntactical analysis. Syntactical analysis. Syntactical analysis. Syntactical analysis

Chapter 3. Regular grammars

3515ICT: Theory of Computation. Regular languages

Grammars with Regulated Rewriting

Solution. S ABc Ab c Bc Ac b A ABa Ba Aa a B Bbc bc.

Decidability (What, stuff is unsolvable?)

c 1998 Society for Industrial and Applied Mathematics Vol. 27, No. 4, pp , August

Combinatorial Interpretations of a Generalization of the Genocchi Numbers

615, rue du Jardin Botanique. Abstract. In contrast to the case of words, in context-free tree grammars projection rules cannot always be

Nonterminal complexity of programmed grammars

Insertion operations: closure properties

DM17. Beregnelighed. Jacob Aae Mikkelsen

Introduction to Theory of Computing

Watson-Crick ω-automata. Elena Petre. Turku Centre for Computer Science. TUCS Technical Reports

The Accepting Power of Finite. Faculty of Mathematics, University of Bucharest. Str. Academiei 14, 70109, Bucharest, ROMANIA

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010

Computational Models - Lecture 4

Properties of context-free Languages

Characterizations of Catalytic Membrane Computing Systems?

Ogden s Lemma for ET0L Languages

UNRESTRICTED GRAMMARS

On Properties and State Complexity of Deterministic State-Partition Automata

Context-Free and Noncontext-Free Languages

Computability and Complexity

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

Transcription:

Theoretical Computer Science 237 (2000) 149 158 www.elsevier.com/locate/tcs A shrinking lemma for random forbidding context languages Andries van der Walt a, Sigrid Ewert b; a Department of Mathematics, University of Stellenbosch, Private Bag X1, Matieland, 7602 Stellenbosch, South Africa. e-mail: apjw@land.sun.ac.za b Department of Computer Science, University of Stellenbosch, Private Bag X1, Matieland, 7602 Stellenbosch, South Africa. e-mail: sewert@cs.sun.ac.za Received November 1997; revised March 1998 Communicated by A. Salomaa Abstract Random context grammars belong to the class of context-free grammars with regulated rewriting. Their productions depend on context that may be randomly distributed in a sentential form. Context is classied as either permitting or forbidding, where permitting context enables the application of a production and forbidding context inhibits it. We concentrate on non-erasing grammars that use forbidding context only. We show that they are strictly weaker than the non-erasing random context grammars and prove a shrinking lemma for their languages. c 2000 Elsevier Science B.V. All rights reserved. Keywords: Formal languages; Regulated rewriting; Random context languages; Random forbidding context; Shrinking lemma 1. Introduction Random context grammars [6] belong to the class of context-free grammars with regulated rewriting [1], i.e. the productions of a grammar are context-free, but are applied in a non-context-free manner. In the case of random context grammars, the application of a production at any step in a derivation may depend on the set of symbols that appear in the sentential form of the derivation at that step. As opposed to context-sensitive grammars, the context may be distributed in a random manner in the sentential form. Context is classied as either permitting or forbidding: permitting context enables the application of a production, Corresponding author. 0304-3975/00/$ - see front matter c 2000 Elsevier Science B.V. All rights reserved. PII: S0304-3975(98)00160-1

150 A. van der Walt, S. Ewert / Theoretical Computer Science 237 (2000) 149 158 while forbidding context inhibits it. When a grammar uses permitting context only, it is called a random permitting context grammar, analogously for forbidding context. Dassow and Paun [1] showed that random context grammars without erasing productions lie strictly between the context-free and context-sensitive grammars. When erasing productions are allowed, random context grammars are as powerful as the recursively enumerable grammars. Dassow and Paun [1] and Rozenberg [5] also studied nite index random context grammars, where the index of a grammar is the maximal number of nonterminals simultaneously appearing in its terminal derivations, considering the most economical derivations for each string. Rozenberg [5] showed that under this restriction the random context, random permitting context and random forbidding context grammars are equally powerful, whether erasing productions are allowed or not. Dassow and Paun [1] generalized the well-known pumping lemma for context-free languages [3] to nite index random context languages: if L is an innite random context language of nite index n, there is a word z L which can be written in the form z = u 1 v 1 x 1 y 1 u 2 v 2 x 2 y 2 u k v k x k y k u k+1 with k6n, v 1 y 1 v 2 y 2 v k y k 0, and u 1 v i 1 x 1y i 1 u 2v i 2 x 2y i 2 u kv i k x ky i k u k+1 L for all i 1. We drop the nite index restriction and concentrate on random forbidding context grammars without erasing productions. We show that they are strictly weaker than the non-erasing random context grammars and prove a shrinking lemma for their languages. In another paper [2] we studied non-erasing random permitting context grammars; we proved a pumping lemma for their languages that generalizes and renes the pumping lemma above and showed that these grammars are also strictly weaker than the nonerasing random context grammars. We formally introduce random context grammars in Section 2. In Section 3 we consider grammars that use forbidding context only and develop a shrinking lemma for their languages. 2. Random context grammars In this section we present the necessary notation and terminology. A random context grammar (rcg) G =(V N ;V T ;P;S) has a nite alphabet V of symbols, consisting of the disjoint subsets V N of variables and V T of terminals. P is a nite set of productions of the form A (P; F), where A V N, V + and P; F V N. Finally, there is a start symbol S, S V N. If there is a production A (P; F) ing and if 1, 2 are in V, then we may write 1 A 2 G 1 2 if every B in P is in the string 1 2 and no B in F is in the string 1 2. As usual, G denotes the reexive transitive closure of G. The random context language (rcl) L(G) generated by an rcg G is the set {z V T S G z}. An rcg G is said to be of index n if each word in L(G) has a derivation such that no sentential form in it contains more than n occurrences of nonterminal symbols. In such a case we also say that G is of nite index.

A. van der Walt, S. Ewert / Theoretical Computer Science 237 (2000) 149 158 151 If every production in an rcg G has P = F =, G is a context-free grammar; if F = for every production, we call G a random permitting context grammar (rpcg), and if P = for every production, we call G a random forbidding context grammar (rfcg). We call the corresponding languages context-free language, random permitting context language (rpcl) and random forbidding context language (rfcl), respectively. In [6] it was shown that for every rfcl L there exists an rfcg G in standard form such that L = L(G) and every production of G is of one of the following three forms: (1) A B 1 B 2 (; F), A, B 1, B 2 in V N, F V N, (2) A B(; F), A, B in V N, F V N,or (3) A a, A in V N, a in V T. 3. Forbidding context only In this section we concentrate on grammars that use forbidding context only. We show that they are strictly weaker than the rcgs and develop a shrinking lemma for their languages. We rst introduce some notation. For z V T we denote the length of z with z. For w, z V T we write w z if z can be written z = z 1wz 2 ; we write w @ z if z 1 z 2 0. In either case we call w a factor of z. The derivation tree corresponding to a derivation is dened in the usual way [3]. In the following it will often be more convenient to view a sentential form = A 1 A 2 A m not as a string of symbols, but as a cut in the derivation tree. Such a cut we write as {(A 1 ; 1 ); (A 2 ; 2 );:::;(A m ; m )}, where i indicates the address of the node A i in the tree. Since we will not be concerned with the specic method used to address the nodes in the tree, but simply need to distinguish between several occurrences of a symbol, we will assume that every node has a unique address and that the root has address 0. We will use capital Greek letters when referring to a sentential form in this way. For sentential forms and we write if there is a bijection : such that ((A;))=(A;) for every (A;) ; we write 6 if there is such that. Let 0 0 by 0. Suppose 0 G n by 0 G 1 G G n. Clearly 0 can derive one or more sentential forms n such that n n by some bijection n. However, in order to keep track of the situation, we arrange matters such that n is as close to 0 as possible. We do this as follows: for 06i6n 1, let i G i+1 by means of a production p applied to (A;) i and suppose i ((A;))=(A;). Then i+1 is the sentential form derived from i by means of p applied to (A;), and i+1 coincides with i on i \{(A;)} and is dened in the obvious manner on the remaining elements of i+1. We shall say the derivation 0 G 1 G G n copies the derivation 0 G 1 G G n and that the bijections i,16i6n, are induced by 0 and the derivation on 0.

152 A. van der Walt, S. Ewert / Theoretical Computer Science 237 (2000) 149 158 Lemma 1. Let L be an rfcl and z L. If the derivation of z can be written {(S; 0)} G 0 G 1 G z; where 0 1 ; and the union is disjoint; then there exists a number l; 16l6 0 ; such that (1) z contains l mutually disjoint nonempty factors w 1 ;:::;w l and l mutually disjoint nonempty factors x 1 ;:::;x l ; these being related by a function # : {1;:::;l} {1;:::;l} such that for each i; 16i6l; x i w #(i) and for at least one i; 16i6l; @ x i w#(i) ; (2) the word z 0 obtained from z by substituting x i for w i for all i; 16i6l; is in L. Proof. Let c = 0 1, 0 = 0\ c and 1 = 1\ c. Let 0 = {(A 1; 1 );:::; (A l ; l )} and 1 = {(A 1; 1 );:::;(A l ; l )}. For i, 16i6l, let w i be the factor of z generated by (A i ; i ) and x i the factor generated by (A i ; i ). Since 0 c G 1 c, there exists a function # : {1;:::;l} {1;:::;l} such that x i w #(i),16i6l. Moreover, since, there exists at least one i, 16i6l, such @ that x i w#(i). Since 0 c 1 c, we can dene a bijection : 1 0 such that for each (A i ; i ) 1, ((A i; i ))=(A i ; i ), and for each (A;) c, ((A;))=(A;). We can now start at 0 = ( 1 ) and copy the derivation sequence that leads from 1 to that subset of z that is derived from 1, since the lack of the context provided by cannot inhibit the application of any of the productions. Then (A i ; i ), 16i6l, will generate the word x i. More formally, we generate z 0 as follows: We rst execute {(S; 0)} G 0. Now suppose 1 derives z in the derivation sequence 1 = 1 G 2 G G s = z: This derivation consists of two spatially disjoint but temporally interlaced derivation sequences starting from 1 and respectively, say and 1 = 1 G 2 G G s (1) = 1 G 2 G G s ; (2) where s + s = s and s s = z. Then 0 = ( 1 ) derives z 0 by copying the derivation sequence (1). The sequence (2) is simply ignored. In Lemma 1 the word obtained from z by substituting w i for x i for all i, 16i6l, is not necessarily in L, since at the stage 1 the additional context may forbid the application of productions that could be applied at 0.

A. van der Walt, S. Ewert / Theoretical Computer Science 237 (2000) 149 158 153 In the case of context-free grammars we need consider derivations of single symbols (A;) only. Thus, the variable l equals 1 and both the words obtained from z by substituting x 1 for w 1 and by substituting w 1 for x 1 are in L. We now want to show that for any rfcl L, if a word z L is suciently long, then any derivation of z produces the situation described in Lemma 1. We rst need more notation. Suppose an alphabet V has n elements and that V is somehow ordered so that it makes sense to speak of a function v which maps a sentential form to an n-vector of nonnegative integers, such that if v()=(m 1 ;:::;m n ), then contains exactly m i elements labeled with the i-th symbol from V. (The mapping v corresponds to the well-known Parikh mapping for sentential forms considered as strings of symbols and not as cuts in derivation trees.) Using 6 between n-vectors to denote componentwise ordering, we observe that v()6v( ) if and only if 6. Finally, for an n-vector c, we denote by c the sum of its components. Lemma 2. Let n 1. Every innite sequence c 1 ; c 2 ;::: of n-vectors over the nonnegative integers contains an innite subsequence c i1 ; c i2 ;::: such that c i1 6c i2 6 :::. Proof. This lemma, which is easily proven by induction, is apparently known as Dickson s lemma [4]. Lemma 3. Suppose that p 1 ;p 2 ;::: is any sequence of nonnegative integers and that n is any positive integer. For any integer t 2 there exists an integer b = b(t) such that if c 1 ; c 2 ;::: is any sequence of n-vectors of nonnegative integers with c i 6p i ; i 1; then there are t indices i 1 ;i 2 ;:::;i t with 16i 1 i 2 i t 6b such that c i1 6c i2 6 6c it. Proof. Assume the contrary. Then there exists for every m 1 a sequence c m1 ; c m2 ;::: such that c mi 6p i, i 1, and c m1 ; c m2 ;:::;c mm contains no monotonic nondecreasing subsequence of length t. Since for every c m1 ; c m1 6p 1, there are only a nite number of possibilities for the c m1, and there is thus an innite index set m 1 ;m 2 ;::: such that c mi1 = c mj1 for all i; j. Choose d 1 = c m11. Similarly, of the c mi2 there are also an innite number which are equal; choose d 2 equal to one of them. Continue in this manner. Now consider the sequence d 1 ; d 2 ;:::: According to Lemma 2, it contains an in- nite subsequence d i1 ; d i2 ; d i3 ;::: such that d i1 6d i2 6d i3 6. Consider d 1 ; d 2 ;:::;d it. By construction there is an m 1 such that d 1 = c m1,anm 2 such that d 1 = c m1 and d 2 = c m2, and in general an m i t such that d j = c mj for all j, 16j6i t. This contradicts the assumption. We use Lemmas 3 and 1 to nd an rcl that cannot be generated using forbidding context only. Lemma 4. L = {z 1 ;z 2 ;:::}; where z 1 =[a]; z i =([a i ]) 4 zi 1 ; i 1; and a; [ and ] are terminal symbols; cannot be generated by an rfcg.

154 A. van der Walt, S. Ewert / Theoretical Computer Science 237 (2000) 149 158 Proof. Suppose G is an rfcg in standard form that generates L. Let G have n variables. Let b = b(2) be the integer of Lemma 3 that corresponds to n and the sequence of nonnegative integers z 1 +1; z 2 +1;:::. Consider a derivation of the word z b+1 : {(S; 0)} = 1 G 2 G G s = z b+1 : We rewrite this sequence as {(S; 0)} G i1 G i2 G G ib G z b+1 ; where ij = z j +1, 16j 6b, and the labels in each ij are all variables. According to Lemma 3, there are indices i q1 and i q2,16q 1 q 2 6b, such that iq1 6 iq2.by construction, iq1 iq2. Thus, according to Lemma 1, z b+1 contains l6 iq1 mutually disjoint nonempty factors w 1 ;:::;w l and l mutually disjoint nonempty factors x 1 ;:::;x l, these being related by a function # : {1;:::;l} {1;:::;l} such that for each i, 16i6l, x i w #(i) and @ for at least one i, 16i6l, x i w#(i), and the word obtained from z b+1 by substituting x i for w i for all i, 16i6l, is in L. Since all x i need not be distinct from the corresponding w #(i), we can choose l = iq1. Let z r be the word obtained through this substitution. Since therefore Thus z r iq1 = z q1 +1; r 1 q 1 ; z r =4(r +2) z r 1 4(r +2) z q1 : Let g denote the average length of the factors x 1 ;:::;x l of z r. Then z r = gl = g iq1 = g( z q1 +1) 4(r +2) z q1 : g 4(r +2) z q 1 z q1 +1 4(r +2) z q 1 =2(r +2): 2 z q1 Then at least one factor x i has length 2(r + 2) or more. That x i must then contain the string [a r ]. Then z b+1 contains [a r ], which is impossible. Lemma 5. L of Lemma 4 can be generated by an rcg. Proof. Let G = ({S; A; L; R; T; A t ;M;X e ;X t ;E x ;A e ;Z x ;X;L x ;Y e ;Y t ;B;B e ;E y ;Y;Z y ;L y }, {[ ; ];a};p;s), where P is the set: S LAR (3)

A. van der Walt, S. Ewert / Theoretical Computer Science 237 (2000) 149 158 155 A A t (; {B; B e ;A e ;A t }) (4) A a ({A t }; ) (5) L [({A t }; ) (6) R ]({A t }; ) (7) T a ({A t }; ) (8) A t a (; {A; L; R; T}) (9) A AA e (; {B; B e ;A e ;A t }) (10) L MMMM ({A e }; ) (11) R MMMM ({A e }; {L x }) (12) T MMMM ({A e }; ) (13) M L x X e R ({A e }; {L; R; T; L x }) (14) X e X t X e ({A}; {X t ;E x }) (15) X t X ({E x }; ) (16) A E x ({X t }; {E x }) (17) E x Z x (; {X t }) (18) A e MM (; {A; E x }) (19) Z x MMMM ({Z x }; {A e }) (20) Z x MM (; {Z x ;A e }) (21) X B (; {A e }) (22) X e B e (; {A e }) (23) L x L (; {A e ;Z x ;X;X e }) (24) M L y Y e R ({B e }; {L x ;L y }) (25) Y e Y t Y e ({B}; {Y t ;E y }) (26) Y t Y ({E y }; ) (27) B E y ({Y t }; {E y }) (28) E y Z y (; {Y t }) (29) Y T (; {Y t ;E y ;B}) (30)

156 A. van der Walt, S. Ewert / Theoretical Computer Science 237 (2000) 149 158 Y e T (; {Y t ;E y ;B}) (31) Z y B (; {Y; Y e }): (32) L y L (; {Z y ;Y e }) (33) B A (; {M; L y }) (34) B e A (; {M; L y }): (35) Then G generates L in the following manner: At the beginning of the ith, i 1, iteration of the main loop (rules 4 35), the sentential form is 1 = LAR or i =(LT i R) j (LA i R)(LT i R) 4 zi 1 1 j, i 1, 06j 64 z i 1 1. The sentential form i, i 1, can derive the word z i (rules 4 9) or the form i+1 (rules 10 35). The decision is made by any A. IfA decides to terminate (4), then i derives z i by replacing each A and T by a, each L by [ and each R by ]. Alternatively (10), i derives i+1 by replacing each but one of the variables in i by (LT i+1 R) 4, while the remaining variable generates (LT i+1 R) j (LA i+1 R)(LT i+1 R) 3 j,06j63. The derivation of i+1 proceeds as follows: First an (i+1)th A, called A e, is generated in order to obtain the string A j A e A i j,16j6i (10). Then each L, R and T is changed into M 4 (rules 11 13). Now any M is chosen (14) and the string L x X i X e R created, using A j A e A i j as template for X i X e (rules 15 18). This process leaves A j A e A i j stored in Zx j A e Zx i j. Since information on the total number of A s present in i has now been transferred from i to i+1, all Z x s but one can be changed into M 4 (20), while A e and the remaining Z x both change into M 2 (rules 19 and 21). Now X i X e is transferred to B i B e (rules 22 23) and L x set to L (24) to indicate the end of this phase. The string B i B e serves as template for generating the string LT i+1 R from each of the existing 4 z i 1 1 M s (rules 25 33). Finally, B i B e is placed into A i+1 (rules 34 and 35) and the main loop thereby ended. From Lemmas 4 and 5 follows one of the main results of this paper: Theorem 6. The rfcgs are strictly weaker than the rcgs. In [2] we showed that the rpcgs are also strictly weaker than the rcgs. We use the technique demonstrated in Lemma 4 to prove a shrinking lemma for rfcls: Theorem 7. Let L be an rfcl. For any integer t 2 there exists an integer b; which depends only on L and t; such that for any word z L with z b there are t words z 1 ;:::;z t = z in L and t 1 numbers l 2 ;:::;l t ; 16l 2 ;:::;l t 6b; such that for each j; 26j 6t; (1) z j contains l j mutually disjoint nonempty factors w j1 ;:::;w jlj and l j mutually disjoint nonempty factors x j1 ;:::;x jlj ; these being related by a function # j : {1;:::;l j }

A. van der Walt, S. Ewert / Theoretical Computer Science 237 (2000) 149 158 157 {1;:::;l j } such that for each i; 16i6l j ; x ji w j#j(i) and for at least one @ i; 16i6l j ;x ji wj#j(i); (2) the word z j 1 is obtained by substituting x ji for w ji for all i; 16i6l j ; in z j. Proof. Let G be an rfcg in standard form generating L. Let its alphabet V have n elements. Let b = b(t) be the integer of Lemma 3 that corresponds to n and the sequence of integers 1; 2; 3;:::. Let z be a word in L with z b. Let {(S; 0)} = 1 G 2 G G s = z be a derivation of z. We rewrite this sequence as {(S; 0)} G i1 G i2 G G i z G z; where ij = j, j =1; 2;:::; z. Then there are t indices q 1 ;q 2 ;:::;q t with 16q 1 q 2 q t 6b such that iq1 6 iq2 6 6. By construction, iq t i q1 iq2. Thus, for all j, 26j 6t, iq t i qj can be written i qj 1 j, where i qj 1 iqj 1, j, and the union is disjoint. Furthermore, i qj 6b for all j, 16j 6t 1. The theorem now follows from Lemma 1. Example 8. Consider L = {a(10) i=2 bc(01) i=2 d i e; i = 0; 2;:::} {bc(01) (i 1)=2 0a (10) (i 1)=2 1d i e; i =1; 3;:::}, where {a; b; c; d; e; 0; 1} is the terminal set. L is generated by the grammar G =({S; A; B; C; E; A 1 ;B 1 ;C 1 ;E 1 ;H}, {a; b; c; d; e; 0; 1};P;S), where P is the set: S ABCE A B 1 C 1 0(;{E; H}) a (; {E; E 1 }) B A 1 (; {E; H}) b (; {E; E 1 }) C 1(;{E; H}) c (; {E; E 1 }) E de 1 (; {A 1 ;B 1 ;C 1 }) H (; {A 1 ;B 1 ;C 1 }) A 1 A (; {E 1 }) B 1 B (; {E 1 }) C 1 C (; {E 1 }) E 1 E (; {A; B; C}) H e (; {A; B; C}): Consider z 3 = bc010a101d 3 e L. By drawing the derivation tree the reader can verify that we can dene w 31 = bc0, w 32 = a, w 33 = the second 1 and w 34 = de, furthermore x 31 = a, x 32 = b, x 33 = c and x 34 = e. Here l 3 = 4 and # 3 (1)=2, # 3 (2) = # 3 (3) = 1 and # 3 (4)=4.

158 A. van der Walt, S. Ewert / Theoretical Computer Science 237 (2000) 149 158 z 2 = a10bc01d 2 e is obtained by substituting x 3i for w 3i for all i, 16i64, in z 3. Now consider z 2. By drawing its derivation tree the reader can verify that we can dene w 21 = a10, w 22 = bc0, w 23 = the second 1 and w 24 = d 2 e, furthermore x 21 = bc0, x 22 = a, x 23 = 1 and x 24 = de. Here l 2 = 4 and # 2 (1)=2, # 2 (2) = # 2 (3) = 1 and # 2 (4)=4. z 1 = bc0a1de is obtained by substituting x 2i for w 2i for all i, 16i64, in z 2. For completeness sake we state a result already derived in [6]: Corollary 9. The emptiness problem is solvable for rfcgs. It is easily veried that the grammar of Example 8 is of nite index, namely of index 5. Therefore its language can also be generated by a grammar that uses permitting context only. In another paper [2] we presented such a grammar. In that paper we also proved a pumping lemma for rpcls. That lemma applied to the above example shows that the words z 2 and z 3 cannot only be shrunk, but also pumped. Acknowledgements We thank the referees for their helpful comments. References [1] J. Dassow, G. Paun, Regulated Rewriting in Formal Language Theory, EATCS Monographs on Theoretical Computer Science, vol. 18, Springer, Berlin, 1989. [2] S. Ewert, A. van der Walt, A pumping lemma for random permitting context languages, Theoret. Comput. Sci., to appear. [3] J.E. Hopcroft, J.D. Ullman, Introduction to Automata Theory, Languages, and Computation, Addison- Wesley Series in Computer Science, Addison-Wesley, Reading, MA, 1979. [4] E.W. Mayr, An algorithm for the general Petri net reachability problem, SIAM J. Comput. 13(3) (1984) 441 460. [5] G. Rozenberg, More on ET0L systems versus random context grammars, Inform. Process. Lett. 5(4) (1976) 102 106. [6] A.P.J. van der Walt, Random context languages, Inform. Process. (71) (1972) 66 68.