Grammars and the Pumping Lemma
10/2/19 (Using slides adapted from the book)
Grammars and the Pumping Lemma 10/2/19 (Using slides adapted from - - PowerPoint PPT Presentation
Grammars and the Pumping Lemma 10/2/19 (Using slides adapted from the book) Administrivia No class Friday A Little English An article can be the word a or the : A a A the A noun can be the word dog , cat or rat : N dog N
10/2/19 (Using slides adapted from the book)
A → a A → the
N → dog N → cat N → rat A noun phrase is an article followed by a noun: P → AN
V → loves V → hates V → eats A sentence can be a noun phrase, followed by a verb, followed by another noun phrase: S → PVP
unpunctuated English:
substitution
S → PVP A → a P → AN A → the V → loves N → dog V → hates N → cat V → eats N → rat
applied
– P loves P ⇒ AN loves P – P loves P ⇒ P loves AN
every step, but that is not a requirement
have at least one derivation from the start symbol S
S → PVP A → a P → AN A → the V → loves N → dog V → hates N → cat V → eats N → rat
hand side
S → PVP P → AN V → loves | hates | eats A → a | the N → dog | cat | rat
https://www.pakin.org/complaint/
– V is an alphabet, the nonterminal alphabet – Σ is another alphabet, the terminal alphabet, disjoint from V – S ∈ V is the start symbol – P is a finite set of productions, each of the form x → y, where x and y are strings over Σ ∪ V and x ≠ ε
Lemma 11.3: The Pumping Lemma for Regular Languages
– We know such a state exists because we have |y| ≥ |Q|…
For all regular languages L there exists some integer k such that for all xyz ∈ L with |y| ≥ k, there exist uvw = y with |v| >0, such that for all i ≥ 0, xuviwz ∈ L. x y z
In state r here
And again here
Lemma 11.3: The Pumping Lemma for Regular Languages
For all regular languages L there exists some integer k such that for all xyz ∈ L with |y| ≥ k, there exist uvw = y with |v| >0, such that for all i ≥ 0, xuviwz ∈ L. x z
In state r here
And again here
u v w
Lemma 11.3: The Pumping Lemma for Regular Languages
For all regular languages L there exists some integer k such that for all xyz ∈ L with |y| ≥ k, there exist uvw = y with |v| >0, such that for all i ≥ 0, xuviwz ∈ L. x z u v w v v …
Pumping Lemma Structure
For all regular languages L there exists some integer k such that for all xyz ∈ L with |y| ≥ k, there exist uvw = y with |v| >0, such that for all i ≥ 0, xuviwz ∈ L.
languages are not regular
lemma holds for L. Let k be as given by the pumping lemma.
x = ak y = bk z = ε Now xyz = akbk ∈ L and |y| ≥ k as required. 3 Let u, v, and w be as given by the pumping lemma, so that uvw = y, |v| > 0, and for all i ≥ 0, xuviwz ∈ L. 4 Choose i = 2. Since v contains at least one b and nothing but bs, uv2w has more bs than uvw. So xuv2wz has more bs than as, and so xuv2wz ∉ L. 5 By contradiction, L = {anbn} is not regular.