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.

23. Some Metatheorems 91<br />

If the lookahead is 0 and we are interested in acceptance by stack, then the PDA<br />

also tells us when the string should be finished. Because in consuming the last<br />

letter it should know that this is the last letter because it will erase the symbol # at<br />

the last moment. Unlike nondeterministic PDAs which may have alternative paths<br />

they can follow, a deterministic PDA with out lookahead must make a firm guess:<br />

if the last letter is there it must know that this is so. This is an important class.<br />

Language of this form have the following property: no proper prefix of a string<br />

of the language is a string of the language. The language B = {a n b n : n ∈ N} of<br />

balanced strings is in LR(0), while for example B + is not (if contains the string<br />

abab, which has a proper prefix ab.)<br />

23 Some Metatheorems<br />

It is often useful <strong>to</strong> know whether a given language can be generated by geammars<br />

of a given type. For example: how do we decide whether a language is regular?<br />

The following is a very useful citerion.<br />

Theorem 35 Suppose that L is a regular language. Then there exists a number<br />

k such that every ⃗x ∈ L of length at least k has a decomposition ⃗x = ⃗u⃗v⃗w with<br />

nonempty ⃗v such that for all n ∈ N:<br />

(222) ⃗u⃗v n ⃗w ∈ L<br />

Before we enter the proof, let us see some consequences of this theorem. First,<br />

we may choose n = 0, in which case we get ⃗u⃗w ∈ L.<br />

The proof is as follows. Since L is regular, there is a fsa A such that L = L(A).<br />

Let k be the number of states of A. Let ⃗x be a string of length at least k. If ⃗x ∈ L<br />

then there is an accepting run of A on ⃗x:<br />

x 0 x 1 x 2<br />

x n−1<br />

(223) q 0 → q 1 → q2 → q3 · · · q n−1 → q n<br />

This run visits n + 1 states. But A has at most n states, so there is a state, which<br />

has been visited twice. There are i and j such that i < j and q i = q j . Then put<br />

⃗u := x 0 x 1 · · · x i−1 , ⃗v := x i x i+1 · · · x j−1 and ⃗w := x j x j+1 · · · x n−1 . We claim that there

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

Saved successfully!

Ooh no, something went wrong!