a note on grammatical covers

3
Volume 11, number 3 INFORMATION PRWESSING LETTERS 18 November 1980 A NOTE ON GRAMMATICAL COVERS * Arnaldo MOURA Computer Science Division, Department of Electrical Engineering and Computer Sciences. University of Califbrnia. B&&J. CA 94720, U.S.A. Received 2? May 1980:revised version received 28 July 1980 Grcibach normal form, grammatical covers, right parses Although Theorem 1 below has been quoted sev- eral times in the literature [ 1,2,4-61, its published proofs [1,2] are all incorrect. The aim of the present paper is to give a correct proof for Theorem 1. All grammars are assumed to be context-free gram- mars. Any concepts not defined here may be found in [3]. We say that a grammar G = (V, X, P, S) is in Creibach normal form if every production is of the form A + a(Y, where a E E, a E V*. The null string will be denoted by r. If (YEV* and R C_ V, then #R(~) denotes the number of occurrences of symbols from R that are in CY. The concept of grammatical covers was first intro- duced in [1,2] using the notion of spurst derivations as follows. Let G = (V, X, P, S) be a grammar and let HcP.Then,ifn=pl es- pn, where pi E P, for each i, I <i <n, n > 0 is a derivation in G, its H-sparse deri- vation iS the maximal sequence 71~such that nH = Pi, *** Pi, , where ij < ij+j , I Q j < m and pij E H, 1 <j <m,m>O. Definition 1 ([1,2]).LetG=(V,f:,P,S)andC’= (V’, z, P’, S’) be grammars and let H C_ P, H’ C_ P’ with h a mapping from H’ into H. (G’, H’) is said to cuue~ (G , H) under h if and only if L(G) = L(G’) and, for all z E L(G), (i) if 71 is an H-sparse derivation far z in G then there is an H’-sparse derivation u for z in G’ such that h(u) = R, and * Support from CNPq-Brazil grant 1112.0749/75 and NSf: grant MCS79-15763. (ii) if u is an HI-sparse derivation for z in C’ then h(o) js an H-sparse deri::ution of z in C. Clearly, we can assume, without loss of generaii:y, that G’ is reduced, Definition 2 ([k-6]). Let G = (V, C, P, S) and G’ = (V’, X, P’, S’) be grammars and let h be a mapping from P’ into P”. G’ right to right covers G utz(I’cr 11 (G’[r/r]hG for siiort) if and only if, for all Z E C’. (i) if II is a right parse for z in G then there is a right parse (I for z in G’ such that h(a) = r. and (ii) if u is a right parse for z in G’ then h(u) is a right parse for z in G, Assume that (G’, M’) covers (G, P) under h and let g be the mapping from P’ into P* obtained by letting g(p) = h(p) for all p in H’ and g(p) = c for all p in P’ - H’. Clearly, G’[r/r]sG. In other words, the sec- ond de’:nition includes the first one when H = P. Theorem 1 ([1,2]).Let G=(V,S.P.S) be thegram- mar specified by the productions S-+S~ISl IO] 1. Then there is no grammar G’ = (V’, S. P’. S’) in Greibach normal form such that. (G’. H’) covers (G.P) under h, for any H’ C_ P’ and any cover mapping It. It is important to notice that this ~reg&ive res\Jt is obtained only when we require that 11 maps from H’ 5 P’ into P. Allowing h to map from P’ into I’* leads to a positive result for the grammar G above;

Upload: arnaldo-moura

Post on 28-Aug-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Volume 11, number 3 INFORMATION PRWESSING LETTERS 18 November 1980

A NOTE ON GRAMMATICAL COVERS *

Arnaldo MOURA Computer Science Division, Department of Electrical Engineering and Computer Sciences. University of Califbrnia. B&&J. CA 94720, U.S.A.

Received 2? May 1980:revised version received 28 July 1980

Grcibach normal form, grammatical covers, right parses

Although Theorem 1 below has been quoted sev- eral times in the literature [ 1,2,4-61, its published proofs [1,2] are all incorrect. The aim of the present paper is to give a correct proof for Theorem 1.

All grammars are assumed to be context-free gram- mars. Any concepts not defined here may be found in [3]. We say that a grammar G = (V, X, P, S) is in Creibach normal form if every production is of the form A + a(Y, where a E E, a E V*. The null string will be denoted by r. If (YE V* and R C_ V, then #R(~) denotes the number of occurrences of symbols from R that are in CY.

The concept of grammatical covers was first intro- duced in [1,2] using the notion of spurst derivations as follows. Let G = (V, X, P, S) be a grammar and let HcP.Then,ifn=pl es- pn, where pi E P, for each i, I <i <n, n > 0 is a derivation in G, its H-sparse deri- vation iS the maximal sequence 71~ such that nH =

Pi, *** Pi, , where ij < ij+j , I Q j < m and pij E H, 1 <j <m,m>O.

Definition 1 ([1,2]).LetG=(V,f:,P,S)andC’= (V’, z, P’, S’) be grammars and let H C_ P, H’ C_ P’ with h a mapping from H’ into H. (G’, H’) is said to cuue~ (G , H) under h if and only if L(G) = L(G’) and, for all z E L(G),

(i) if 71 is an H-sparse derivation far z in G then there is an H’-sparse derivation u for z in G’ such that h(u) = R, and

* Support from CNPq-Brazil grant 1112.0749/75 and NSf: grant MCS79-15763.

(ii) if u is an HI-sparse derivation for z in C’ then h(o) js an H-sparse deri::ution of z in C.

Clearly, we can assume, without loss of generaii:y, that G’ is reduced,

Definition 2 ([k-6]). Let G = (V, C, P, S) and G’ = (V’, X, P’, S’) be grammars and let h be a mapping from P’ into P”. G’ right to right covers G utz(I’cr 11

(G’[r/r]hG for siiort) if and only if, for all Z E C’. (i) if II is a right parse for z in G then there is a

right parse (I for z in G’ such that h(a) = r. and (ii) if u is a right parse for z in G’ then h(u) is a

right parse for z in G,

Assume that (G’, M’) covers (G, P) under h and let g be the mapping from P’ into P* obtained by letting g(p) = h(p) for all p in H’ and g(p) = c for all p in P’ - H’. Clearly, G’[r/r]sG. In other words, the sec- ond de’:nition includes the first one when H = P.

Theorem 1 ([1,2]).Let G=(V,S.P.S) be thegram- mar specified by the productions

S-+S~ISl IO] 1.

Then there is no grammar G’ = (V’, S. P’. S’) in Greibach normal form such that. (G’. H’) covers (G.P) under h, for any H’ C_ P’ and any cover mapping It.

It is important to notice that this ~reg&ive res\Jt is obtained only when we require that 11 maps from H’ 5 P’ into P. Allowing h to map from P’ into I’* leads to a positive result for the grammar G above;

Ctaim X * W’ = P”.

65 I