13.11.2014 Views

Introduction to Computational Linguistics

Introduction to Computational Linguistics

Introduction to Computational Linguistics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

20. Greibach Normal Form 80<br />

The first reduction of grammars we look at is the elimination of superfluous<br />

symbols and rules. Let G = 〈S, A, N, R〉 be a CFG. Call X ∈ N reachable if<br />

G ⊢ ⃗α ⌢ X ⌢ ⃗β for some ⃗α and ⃗β. X is called completable if there is an ⃗x such that<br />

X ⇒ ∗ R ⃗x.<br />

(206)<br />

S → AB A → CB<br />

B → AB A → x<br />

D → Ay C → y<br />

In the given grammar A, C and D are completable, and S, A, B and C are reachable.<br />

Since S, the start symbol, is not completable, no symbol is both reachable and<br />

completable. The grammar generates no terminal strings.<br />

Let N ′ be the set of symbols which are both reachable and completable. If<br />

S N ′ then L(G) = ∅. In this case we put N ′ := {S} and R ′ := ∅. Otherwise, let R ′<br />

be the restriction of R <strong>to</strong> the symbols from A∪ N ′ . This defines G ′ = 〈S, N ′ , A, R ′ 〉.<br />

It may be that throwing away rules may make some nonterminals unreachable or<br />

uncompletable. Therefore, this process must be repeated until G ′ = G, in which<br />

case every element is both reachable and completable. Call the resulting grammar<br />

G s . It is clear that G ⊢ ⃗α iff G s ⊢ ⃗α. Additionally, it can be shown that every<br />

derivation in G is a derivation in G s and conversely.<br />

Definition 28 A CFG is called slender if either L(G) = ∅ and G has no nonterminals<br />

except for the start symbol and no rules; or L(G) ∅ and every nonterminal<br />

is both reachable and completable.<br />

Two slender grammars have identical sets of derivations iff their rule sets are identical.<br />

Proposition 29 Let G and H be slender. Then G = H iff der(G) = der(H).<br />

Proposition 30 For every CFG G there is an effectively constructible slender<br />

CFG G s = 〈S, N s , A, R s 〉 such that N s ⊆ N, which has the same set of derivations<br />

as G. In this case it also follows that L B (G s ) = L B (G).<br />

□<br />

Definition 31 Let G = 〈S, N, A, R〉 be a CFG. G is in Greibach (Normal) Form if<br />

every rule is of the form S → ε or of the form X → x ⌢ ⃗Y.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!