You are on page 1of 20
On Context-Free Languages and Push-Down Automata M. P. ScutirzENBERGER International Business Machines Corporation, Thomas J. Watson Research Center, Yorktown Heights, New York This note describes a special type of one-way, one-tape automata in the sense of Rabin and Scott that idealizes some of the elementary formal features used in the so-called “push-down store”’ programming techniques. It is verified that the sets of words accepted by these automata form a proper subset of the family of the unambiguous context-free languages of Chomsky’s and that this property admits a weak converse. INTRODUCTION This note is concerned with some relations observed by N. Chomsky and myself between context-free languages and what will be called push- down automata.' Informally, a push-down automaton is a special type of one-way, one-tape automaton in the sense of Rabin and Scott in which the memory is a (potentially infinite) tape, used in a certain restricted manner. For each successive letter of the input word, the word stored on the tape is modified by deletion or adjunction at its right end. This is done under the control of a finite state device which can scan the word stored on the tape and carry some additional information. The input word is accepted iff after reading its last letter both the word written on the tape and the state of the finite part belong to a finite prescribed set. This operation appears as an abstraction of some elementary features of the programming technique known as “push-down store” (Newell and Shaw, 1957). I am indebted to C. C. Elgot for enlightening discussions which have lead to the clarification of many points and to a definition of push-down automata which may be less unrealistic than the ones I had previously considered. 1 Note added in proof: Our definition does not coincide with the one introduced by Shepherdson and Sturgis (1963). Schutzenberger: From Inform. & Control, 1963, 6, 246-264. Reprinted with permission. 204 M. P. SCHUTZENBERGER 205 We recall that a context-free language on an alphabet X is a subset L of the set F of all words in this alphabet that can be obtained by the following procedure, which is a special type of a Post production: Let = = {&}(1 Sj S n) be another set of letters and H be the set of all words in the letters of XU =. In Chomsky’s terminology = is the nonterminal alphabet. A grammar is an assignment to each & € = of a finite set p; of words of H that does not contain the empty word e or any word consisting of a single letter of 2. Both X and Z are finite. Let ZL; be the least subset of H that contains & and every word Whh” (h, hh” © H) if it contains h’h” (1 Sj Sn) and if h € p;. Then by definition L = L,/ F is the context-free language produced. by the grammar {p;}. In the first part of the paper we verify the equivalence of this defini- tion with another one which relates context-free languages with al- gebraic formal power series in noncommuting variables. The treatment given here is more elementary than that of Ginsburg and Rice (1962) and the notation introduced in this part is needed later on. Furthermore, except for trivial changes, the main bulk of the notation carries over to the still simpler case of the power series. In the second part of the paper we verify that the set of words accepted by any push-down automaton (as defined here!) is a context-free lan- guage and, as an example, we consider the simplest nondegenerate. type of such automata. The corresponding languages are called “standard context-free languages.” In the fourth part we verify a weak converse of the first property. More explicitly, let F and F” be the set of all words in the letters of the alphabets X and X’ (ie., the free monoids generated by these sets). A homomorphism (of monoid) 6: F — F’ is any mapping from F to F’ given by a mapping 6: from X to F’ and the rule that @ = e (e = the empty word) and that for all f = 2,2; +++ ti, € F, (m > 0), Of = Ot Ortig + * Tin» We verify that for any context-free language L’ C F’ one can find a set X, a homomorphism 6: F > F’ and a standard context-free language LC F such that L’ = 6b (= {@f:f € L’}). A closer connection between push-down devices and context-free languages is to be found in (Chomsky, 1962). I. DEFINITIONS Let X, 2, F, H be as in the introduction. $(H) is the collection of all subsets of H. We shall consider $(H) as an algebraic system (in 206 READINGS IN MATHEMATICAL PSYCHOLOGY fact, a semiring) with respect to the usual operations of set union and set product (the intersection is not used). We shall reserve the notation x» (resp. wr) for the projection of 8(H) onto the union of the elements of H of length Sm (resp. onto B(F)). Thus, for H’ € B(H), mH’ = ¢ iffe € H’ and we say then, as usual, that H’ is quasi regular. For any n-tuple q = (91,92, °*- , 9x) of elements of $(H), we denote by \, the homomorphism (of semiring) of $(H) induced by the sub- stitution {£;} > q;forl Sj Sn. Now let L be a (nonempty) context-free language with grammar p = (pi, 2, °** , Pa) and nonterminal alphabet =. We can assume that no p; is empty and we recall that by hypothesis (1) p is quasi regular (ie., op; = ¢ for each j); (2) no p; contains a word consisting of a single nonterminal letter. Let @ (resp. Pr) be the set of all quasi-regular n-tuples of subsets of H (resp. of F’). For any mapping ¢ of (H) andr € @, ¢r denotes the a-tuple (gr, dr2, °+* , on). Now let q be any element of ©. The conditions (1) and (2) on p imply the following identity or all m 2 0: “) TmiMeP = TmteqaP- Indeed, by the very definition of d, for each j and m, m’ = 0, A\rmaPs © Armamea; and so, with obvious notations mip D tnit\xncP- On the other hand, any word f of length | f| 2 m + 1 belonging to some component of q can only intervene in yp by being substituted for some £ € = which (by condition (2)) is a factor of a word of length at least two. Thus the word resulting from this substitution has length at least |f| + 1 = m + 2, and it disappears after the application of Of Fmt + Similar reasoning shows that rr\gp = ArpaD- Let us consider the sequence p(m) (m = 0) of elements of defined inductively by p(0) = (¢)(=(¢, 4, > ¢)), and, for each m 2 0, p(m + 1) = AymP- ‘We prove that, for each m’, m” = 0, tmp(m’) = map(m’ -+ m”) and p(m’) € Pr. The relations are trivial for m’ < 1. Assume that they hold for m’ < m. Then: mmup(m + 1) = mmyrpmp (by definition) = tmyt\eqpmD (by (*)) = wns \eqaininy? (by the induction hypothesis) = tmithyintnrsP M, P, SCHUTZENBERGER 207 (by (*)) = mnayp(m + m” + 1) (by definition). This gives the first relation, and p(m + 1) € @r follows by induction from p(0) € Or. Hence the limit form — © of p(m) is a well defined quasi-regular n-tuple of subsets of F which we denote by p() and which satisfies the identity p( ©) = Apcoyp. Let us verify that any p’ € @ which satisfies p’ = dp is equal to p( ). Indeed, if mp’ = mnp() for some m = 0, the same relation holds for m + 1 since mip’ = tnpArayD = Tntiixnp(o)P = Tm4ip( ©). Since the hypothesis of quasi regularity on p’ implies wp’ = rop(), the verification is completed. It remains to show that L = zl, is equal to the first component of p(~). For this, let \p’p = p and, inductively, \p**p = Xp"(App). The classical identity dy = M,¢ (valid for any g, q’ € ©) shows that, for all m, tmp(m + 1) = amytdp"p. Thus p(%) can also be defined as Timpsco Xp"D- Consider now p’ = p U (£) where (£) is the n-tuple ({&}, {&},--°, {&}) and where U is to be performed component-wise. By definition the relation apy 'p’ = weX3"'p is true for m’ = 0; if it is true for m’ = m, it is still true for m’ = m + 1 because, setting p” = Xp-p’ and p” = ,"p, mpdgi ip! = me(Xp(Ayp’)) = wey! = Repo P = AeporP = Tryp = tedp*'p. Hence limps tr\3’p’ = p(). Since our original definition amounts to the definition of Z; as the first component of limm..\p-p’ the result is entirely verified. For the sake of completeness we recall the proof of the following theorem which is needed later on. To simplify notation, + and = are used instead of U; &(F) is the set of all regular events on F; for each @€ BUF), g* = Z{g":m > O}. Turorem (Chomsky and Miller, 1956). If for all j (1 Sj Sn) i= Gat Uéae1 Si Sn} with qj € R(F) for allj, 7 (1 Sj Sn), (0S 7’ S n), then every component of p() belongs to R(F). Proor: The result follows by induction on n from the unicity property of p(<) mentioned above. Indeed for n = 1, p’ = qiogis satisfies dep = p’ and thus p() = p’ € &(/’). Assume now the result: proved 208 READINGS IN MATHEMATICAL PSYCHOLOGY forn G is given by: (1) a finite homomorphism x: G > K, (2) a mapping a: K > G; (3) a mapping p: K — $(K). For each g € G, ug = psxo(g-exg)- In more concrete manner, one may think of a device ® which performs the following cycle of operations: (1’) & reads g and determines xg € K; (2') & writes the word axg € G to the right of the word g; (3’) & reads from right to left the word g-axg erasing successively each letter (eventually none) till it reaches a state belonging to the sub- set pxg of K or until it has erased the whole word g-axg. The word left is ug. Thus, either g is a left factor of yg (in symbols g|ug) or ug |g; we shall refer to this situation by saying that g and ug are comparable. M. P. SCHUTZENBERGER 209 Now let S be a finite set in which a subset 8 and an element s. € J have been distinguished. We denote by U (resp. U, resp. U..) the set of all pairs (s, g) with s € S (resp. s € 8, resp. s = 8.) andg € G. We call states the elements of U. It will be understood that for u, u’ € U, the notation u|u’ (resp. u + u’) means that u = (s,g) u’ = (s’, g’) with g |g’ (resp. with not g | 9’). Derinrrion 1. A x-push-down mapping wu: U — U is given by: (1) A mapping o: (S, K) > S such that forall k € K,o(so,k) = 80; (2) For each s € S an elementary x-push-down mapping yu, on @ with the restriction that for all u € Us, wou = u. For each u = (s,g) € U, nu = (o(s, xg), ug). For simplicity, we shall rather deal with the mapping an defined as follows. Let pu = pw and for each i > 0, uu = a(n’ ‘u). The 9 Jargest positive i (possibly infinite) such that, for all positive i’ < i, u”u € U will be denoted by j(u). Then wu = wu if J(u) < 0; = (80,9) if j(u) = © and u = (s,g). Thus u* = p iff for all u € U, wu € U. Derinition 2. A push-down automaton @ is given by: 1) The finite alphabets X and Y; 2) A finite homomorphism x: @ — K; 3) A finite set S (with §, s. and U as above) and a x-push-down mapping »: U — U; 4) A mapping 8: (5, X) — S with B(s», 2) = 8« identically; 5) An initial state uw € U\Ue (ie., uw € U and um € U.); a finite set Uyin C U\U. of final states. For each u = (s, g) € U and x € X, the “next state” u-z is u*((s, 2), g). For each f € F, u-f = wif f is the empty word and uf = (u-f)-ciff = f'x (f € F, 2 € X). The set Ace @ of the words accepted by @ is Ace @ = {f € F: uf € Uyin}. Finally @ is simple iff § = S, and then, clearly, » = u*. According to Definition 2 the cycle of the automaton that is initiated i each input letter consists of two successive operations: the mapping 8: (8, X) — S and the mapping »*: U — U; further, any state u € Us is a sink, ie. for all u € U. and f € F, one has u-f = wu. Intuitively, one might think of a device @» acting in the following manner for each state (s, 9) € U and incoming input letter 1 € X: 210 READINGS IN MATHEMATICAL PSYCHOLOGY @» goes first to the state u = (8(s, x), 9) and it performs the push- down mapping psc.) Which brings it to u’ = (s’, g’), say. If s’ belongs to § the cycle initiated by x is already completed and @o reads the next input letter (this is always the case when @ is simple). If s’ does not belong to 8, @ performs 4, and goes to u” = peu’, Again, if wv” € 0 the cycle is completed; if it is not so, @> goes on performing a succession of push down mappings till, eventually, it reaches a state of U. Clearly, in the general case, @ may never reach this subset and consequently it may happen that @ does not read the input word further than z. Our more formal definition of @ by the mapping nu” is intended to obviate this minor notational difficulty. Proprrty 1. For any push-down automaton @ there exists a simple push-down automaton @! such that Acc @ = Acc@’. Proor: The property amounts to the statement that for any given push- down mapping u: U — U there exists a finite set S’, a surjection (ie, mapping onto) $: ‘S’ > S and a push-down mapping p: (S’, G’) > (s, @ ) that have the following properties: @) a = 5 fi) for all g € G, s' € S’, the relation u’(s’,g) = (s”, g’) implies u*(gs', 9) = (58",9')- To simplify notation we first verify that there is no loss in generality in assuming that y satisfies the conditions (1), (2), and (3) below. For u = (8,9) € U, we write xu = (s, xg) and xU = {(s,k):s € S,k € K}; x0 = ((3,k):8 € 8k € K}. Conprrion (1). There corresponds to each (s, &) € xU a subset K(s, k) of K (eventually empty) such that g € x"K(s, ® (ie., xg € K(s, k)) iff for all g € Gone has Prong ga(8, k) = g’ (where Be k) denotes the subset of K defined by the function j associated with the elementary push-down mapping p.). Indeed let the quotient monoid K; of @ and the epimorphism (= homo- morphism onto) x1: @ — K, be defined by the condition that, for any a9 € G, xg = x9’ iff for all K’, K” C K one has: pxg | px-g is equivalent to px-g’ | px’. Clearly K; is finite and there exists a homomorphism %: Ki > K such that xx: = x. Hence, any of the x-push-down mappings entering in the definition of @ could have been defined as well as a x:-push-down mapping. Thus we can assume that x has been replaced by x in the definition of @ and condition (1) is trivially satisfied. M. P. SCHUTZENBERGER 211 Conprtton (2). For each u € U, if u| wu then wu € U. Indeed let j*(w) denote the largest number i (possibly infinite) such that, for all positive ¢’ < i, one has p”u € U and u| uu. By construc- tion j*(u) S j(u). Let »’: U — U be defined by: plu = pn if j*(u) if finite; = p"uif j*(u) is infinite. Clearly u/* = y* and it suffices to verify that y’ is a x-push-down mapping since, by construction, u’ satisfies Condition (2). Consider u = (s, g) such that j*(u) > 1. Thus ifj’ 0, we define G,(v) (resp. G(v)) as the set of all g’ € G satisfying kxg’ = k’ which are such. that for some g € xk one has j(s’, gg’) = m + land u%(s', gg’) = (8,9) (resp. i(s, 9g’) arbitrary and u(#’, gg’) = (s,9)). Thus for» € Vi, Gi(v) = G(r). Because of the definition of z it is easily seen that if g’ € Gn(v) (resp. € G(v)) then for all g € xk one has j(s’, gg’) = n + 1 and u"(s, 99”) = (3,9) (resp. u(s’, go’) = (8, 9)). For v € Vi(v = (8, k, 8’, k’)) let G(v) be the union of the sets G,(v) over all positive n; also let (v’, v”) € w(v) mean that there exist (s”, k”) € x0 (= {xu: u € U}) such that o’ = (8, k, 8”, k”) (hence v’ € Vi) and v” = (s”, k”, 8’, k’). Thus, by construction, G(v) © G(v) and, forn > 0, o’ € Gasa(2) iff there exist (2, »”) € o(v) and a factorization g’ = g’g” such that g” € G,(v’) and g” € G(v”). Introduce now a set {&} of new letters indexed by the elements of Vi and, for each v € V1, define Pe = Gv) + BlEvrG(v”): (v', »”) € w(v)}. The system (p) = (ps)vev, defines a grammar and, by construction, pl 0) = G(v) for each € Vi. However, for arbitrary v = (s, k, s’, k’), the condition that a word g’ belongs to G(v) can be explicitly stated as: a= ols',k); B= kyg’s forall 9 Exh, 9 = preny'a(s, k). Thus, because of Condition (1), each of the sets G(v) (v € Vi) isa regular event. By the theorem recalled at the end of the first section, it follows that each of the sets G(v) (v € V1) is also a regular event. In other terms, there exists a homomorphism x’ of G onto a finite monoid K’ and for eachv € Via subset K’(v) of K’ such that G(v) = x'*K’(v). Since x’ may be chosen so that K’ admits K as a homomorphie image, we may argue as in the verification of Condition (1) that in fact x = x. Under this hypothesis it is immediate that a can be defined as a x-push- down mapping and Condition (3) is verified. ‘The rest of the proof (i.e., that under the conditions (1), (2), and (3), M. P. SCHUTZENBERGER 213 the mapping »* = yf can be defined as a push-down mapping) is trivial and it is omitted. Property 2. For any push-down automaton @ the set Acc @ is a con- text-free language. Proor: By Property 1 we can assume that @ is simple. Hence for each s € S, x € X,g € G, the operation performed by @ consists of a transition s — s-x € S and of an elementary push-down mapping Maz on G. For simplicity we shall speak of the states as if they consisted only of a word. Thus the length | u| of u = (s, g) is the length |g| of g; visa left factor of u’ = (s' g’) if g is a left factor of g’ ete. Let f = 24,2; --- 2; be an input word of length |f| = m 2 2. For any state u we consider the m — 1 intermediate states um = u-2i,, Us = UG lig, 6+ Uma = UE Ly “°° Tin_, and we define min (u; f) to be the minimum of their length. If uj (1 $j S m — 1) is such that |u;| = min (u-f) and if further either j = m — 1 or |uj| > | u;| for i 2) and consider f = fr;, of length m = |f| + 1. The intermediate states of f at u are those of f at u plus the state @ = uma = u-f. Hence we dis- tinguish two cases: (i) |@| > min (u, f). Then, u; (1 Sj S m — 2) is at the same time the critical state of f and f. (ii) |a| S min (u, f). Then @ is the critical state of f. In case (i), because of the induction hypothesis we have only to prove that uj; isa left factor of a comparable with u’ = w-f. The first statement follows directly from the hypothesis that @ is comparable with u; and that lus| < ||. The second statement follows from the first, the fact that u’ = a-z,, and the remark that if a is a left factor of b and if b is com- parable with c then in turn a is comparable with c. In case (ii), the in- 214 READINGS IN MATHEMATICAL PSYCHOLOGY duction hypothesis and | Z| S | u;| show that a is a left factor of u; , hence a left factor of every intermediate state of f. By our last remark above it follows that @ is comparable with u and since @ is comparable with w’ = u-a,,,, the verification is completed. Let us introduce the notation C(u, uw’, n) for denoting the set (even- tually empty) of all input words f # e such that u-f = w’ and either | f| = Lor min (u, f) = n. The symbols + and = denote disjoint union of sets. Finally |a| is the maximum of the lengths of the words «(s, &) used in the definition of the push-down mappings 4. Thus for any wu and f.€ F of length at least two, we have min (u, f) $ |a| + |u| since this is an upper bound to the length of the first intermediate word. Our definition of the critical factors is summarized by the following relations: Remark 2. For any triple (u, u’, n) C(u, uw’, n) = XN Clu, wn) + 2(C(u, u”, |w" [)C(u", wu’, |w" | + 1):u" € U, ns|u"| Ss lu] + lal} where Z{ } is understood to be unless n S$ |u| + lal. Proor: The left member is contained in the right member because any f € C(u, u’, n) of length two or more has critical factors f* and f” and a critical state wu” satisfying the condition indicated. ; Conversely if f’ € C(u, u”, |u|) and f” € C(u”, u, | u”| + 1) for some u” such that n <|-u"| S |u| + a, the product f = f/f” belongs to C(u, uw’, n) and has w” as its critical state. Finally, the right member is a disjoint union of sets because of the unicity of the critical factorization. Let J: (resp. J,) be the set of all triples (wu, un) such that C(u, u’,n) is a nonempty set of words which can be left (resp. right) critical factors of other words. According to the definition and to Remark 1, (u, un) € Jr (resp. € J+) iff C(u, u’, n) * , wand u’ are comparable, n= |w | (resp. n = |u| +1). For fixed d > 0 we consider the following subsets of J: U J, : Tie = {(u,w, |u|): [ul S |u’]} Jit = {(u, uy [u! |): [u] = [a] +d} = {yw Jul + 1:|ul 2 lu’ l} Je = {(u, uw’, ul + 1):]u"| = [ul + dh. M. P. SCHUTZENBERGER 215 Remark 3. For each finite d there exists only a finite number of distinct sets C(u, uw, n) with (u,u',n) €J(d) =J UST US, US Proor: For any quadruple of states of the formu = (s, gg’), @ = (s, gg’), u’ = (s', gg”), @ = (s', Gg”) with xg = xg, the definition of pushdown mappings and the hypothesis that x is a homomorphism shows that C(u, wi, |g| +’) = Ca, w, |g] +n')(n' 2 0). This proves directly the statement for J7? U Jf*. For Ji* we need to observe first that, if| u| <|u’|,C(w, w,|u’|) ~¢onlyif|u’| S| ul + |a|. For J, it suffices to check that (with x: as defined in the proof of Property (1)) the relations xg = x19, xg’ = x49’ imply identically C((s, 99"), (8, 9), Lgg°| + 1) = C((s, 99’), (s', 9), 199’ | + DD. Remark 4, Each set C(u, u’, n) is a context-free language. Proor: Let the triple (u, u’, n) = jo be fixed. Let d = max(|u| —n, | u’| — n, |a|) and consider a minimal set J* of triples (containing jo) such that any set C(j) with j € J(d) = J(0) U J(1) «++ U J(d) is equal to one and only one set C(j’) with j’ € J*. By Remark 3 we know that J* is finite. Furthermore, by construction, any critical (left or right) factor of a word from a set C(j) with j € J(d) or j = jo belongs itself to some set C(j’) with j’ € J(d)—hence to some set C(j”) = C(7’) with j” € J*. Hence, by Remark 2, there corresponds to each j € J* an equation Ci) = Xj + BCG)C0"): G9") € oH} where X; = XN C(j) and where w(j) denote a finite set of pairs of triples 7’, 7” € J*. We introduce a set = = {&}(j € J*) of new letters and, for each j € J* we define the set p, as the union of X, and of the products Epkje where (j’, 7”) € w(j). This reduces the problem to the proof of equiva- lence of the two definitions of a context-free language described in the first part of the paper. Taking into account that the set of all context-free languages is closed under (finite) union, Property 2 is verified. TI. EXAMPLE Let us recall briefly the definition of the free group I’ generated by a set Y’ = {yv: 1 Si S nj. Let Y consist of 2n letters y; (i = +7, 216 READINGS IN MATHEMATICAL PSYCHOLOGY 17 Sn) and say that a word of G (the set of all words in the letters of Y) is reduced if it does not contain a pair of adjacent letters having opposite indices. Clearly to each g € G is associated a unique reduced word 7g obtained by successive cancellation of such pairs of adjacent letters. For instance, r(yy-wy-s) = r(yya) = € and r(ysysyy-2) = yysyy—a- The homomorphism yo : G > I’ is defined by yg = yo’ iff rg = 79’. We shall identify I with the set 7G of all reduced words of G endowed with the (associative) multiplication r(rg-79’)(= r(gg’)). Thus, in particular, yoy; = (yoys)* for all y; € Y. With this no- tation, any homomorphism y: F — I is given by a homomorphism ': F Gand the rule yf = vf iff yor'f = 7's’ (ie, iff rf = 17'f'). We verify that the inverse image y "I" by 7 of any finite subset I” of T is a context-free language, by constructing a pushdown automaton @. For this, consider a state s and, for each word 7’ 2; € 7X, introduce n, new states $31, 8;.2, *** 8jm, Where 7, is the length of the word 7’z; . Let S be the union of s and all the states s;, and § consist of s) only. The state s.. is not needed. Now, in the notation of Definition 2 we define for each x; € X, B(8, 2;) = 81 and to each state s;, we associate (1) a mapping a: S— S defined by 8397 = Sigur IEG < my5 = 8 fj =n;. (We do not need to introduce K explicitly.) (2) A push-down mapping u; on G where i(—n S i Sn) is determined by y; = y;,# (i.e. where y; is the j’th letter of y’x;) and where for each y € G: ng =o if g=0'ys ( €@); = yi otherwise. For instance, if y’x1 = y-ay2 the resulting transformation on G is pus and it has the following effect: g > 9’ ifg = yy239 7 g'y2 ifg = g'yandg’ € Gy-2; 9 > gy-12 in any other case. Induction of the length of the input word f shows that if the initial M. P. SCHUTZENBERGER 217 word stored in the memory is a reduced word g € 7G, the word stored after reading f is r(gy’f). Thus, in particular, taking g = e (the empty word), Property 2 shows that for any finite subset I” of P the set y“I" = {f € F: 1f € 1’} is a context language. Clearly, for any regular event R on F, it is possible to add enough new states to the finite part of the automaton that it accepts a set of the form RN y"T"’. Let us consider the special case where X = {2;:i = 47,1 0 the identity yp'(m) = p(m). Hence L = gp: («) and, without loss of generality, we shall assume henceforth that L is pi(o) itself, that is, X = X'; H = H’, (p;) = (p/)(1 Sj Sn). Under this as- sumption we shall write 2(h, d, e) instead of z(j, h, d, e) since every word h € P = U{p;: 1 Sj S n} appears in one and only one set Di (lL Sj Sn). For 1 $d Sd’ S$ nwe define: ath, d,d’) = g(h, d,d)q(h, d+ 1,d +1) +++ g(h,d,d’). (Thus 9(h, d, d’) is defined only when none or both of d and d’ are 0.) Finally: Q=(hdd):heP, d=d=0 o 1sdsdsa¥} T = {Xyarg(h, d, a’): g(h, d, a’) € Qh. We now define the standard (right) context-free language DN RN H; by: (i) D is the Dyck set D = {f € F:f * e; vf = e} where the homo- morphism 7: H — T is defined by: for all € &, yE=e for all 2(h, d,e) € X, — (ye(h, d,e))* = ya(h,d, —e). (ii) B is the set of the words f € F such that each of their factors of length two belongs to V = V’U V”U ¥” where: V’ is the set of all products 2(h, d, +1)2(h’, 0, —1) and 2(h’, 0, +1) 2(h, d, —1) for which d, h, and h’ are such that g(h, d, d) = 2(h, d, + 1)&:,0(h, d, —1) with h! € py. V” is the set of all products 2(h, d, +1) 2(h, d, —1) with h € P and th 2. We consider the factorization f = g’g’(g’, g” € F) where g’ is defined as the shortest left factor of f that belongs to D. Since f € D, this implies yg” = (y9’) “vf = e and we distinguish two cases: (i) g” # e. Then g” € D; Ig’ |, 19” | 0, this implies f = af’b with a,b € X,f € F,|f'| > 0. M. P. SCHUTZENBERGER 221 Because of the definition of y, yf = e and the hypothesis that f has no left factor in D imply yf’ = yab = e. Thus f’ € DN R and, by the in- duction hypothesis, f’ € Amonag(h’, d, d’) for some h’ € P,O Sd S d sd". It follows that f’ = x(h’, d, «)f’x(h', d’, e) either with 1 Sd < d' Sd@*,e= +1,¢ = —lorwithd =d' =0,e= —1,¢ = +1. Let v = az(h’, d, «), v = 2(h’, d’, eb. Since f € R, both belong to V. Clearly v, o' € V”. Further, v, x’ ¢ V” because, for instance, v € V” would imply 1 Sd

You might also like