



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




David Evans http://www.cs.virginia.edu/evans
cs302: Theory of Computation University of Virginia Computer Science
Lecture 10: NDPDAs/CFGs/PDAs 2
Lectures 1- Sipser Ch 0-
Problem Sets 1-3 + Comments
Exam 1
Note: unlike nearly all other sets we draw in this class, all of these sets are finite, and the size represents the relative size.
Lecture 10: NDPDAs/CFGs/PDAs 3
Lecture 10: NDPDAs/CFGs/PDAs 4
Lecture 10: NDPDAs/CFGs/PDAs 5
Regular Languages
Context-Free Languages
Violates Pumping Lemma For RLs
Violates Pumping Lemma
For CFLs
Described by DFA, NFA, RegExp, RegGram Described by CFG, NDPDA
0 n 1 n^
0 n 1 n 2 n
0 n
w
wwR^ ww
Lecture 10: NDPDAs/CFGs/PDAs 6
Lecture 10: NDPDAs/CFGs/PDAs 7
Lecture 10: NDPDAs/CFGs/PDAs 8
Lecture 10: NDPDAs/CFGs/PDAs 9
Regular Languages
Context-Free Languages
Violates Pumping Described by DFA, NFA, Lemma For RLs RegExp, RegGram Described by CFG, NDPDA
0 n 1 n^
0 n 1 n 2 n
0 n
w
wwR ww
Sensible option 1: LR(NDPDA) ⊃⊃⊃⊃ LR(DPDA) ⊃⊃⊃⊃ LR(NFA) = LR(DFA)
Sensible option 2: LR(NDPDA) = LR(DPDA) ⊃⊃⊃⊃ LR(NFA) = LR(DFA)
To eliminate =, we need to find some language L that can be recognized by an NDPDA and prove it cannot be recognized by a DPDA
Lecture 10: NDPDAs/CFGs/PDAs 10
ε, ε→$
0 , ε→ +
ε, (^) ε→ ε
1 , +→ε ε, $ → ε
ε,
ε
ε^
1 , +→ε
1 , ε→ε
ε, $ → ε
Lecture 10: NDPDAs/CFGs/PDAs 11
Proof by contradiction. Suppose there is a DPDA P that recognizes A. It must be in accept states only after processing 0 i 1 i^ and 0 i 12 i
0 ,^ α→ … β^1 , α→β
2 i transitions, consuming 0 i 1 i
,^ α→
β 1 , α→ β
i transitions, consuming 1 i
Lecture 10: NDPDAs/CFGs/PDAs 12
Proof by contradiction. Suppose there is a DPDA P that recognizes A. It must be in accept states only after processing 0 i 1 i^ and 0 i 12 i
0 ,^ α→ …
β 1 , α→β
2 i transitions, consuming 0 i 1 i
, α→
β (^1) , α→ β
i transitions, consuming 2 i
2
2
Lecture 10: NDPDAs/CFGs/PDAs 19
Lecture 10: NDPDAs/CFGs/PDAs 20
Proof-by-construction: There is a CFG GAUB that recognizes A ∪ B. Since A and B are CFLs, there are CFGs GA = (VA, ΣA, RA, SA) and GB = (VB, ΣB, RB, SB) that generate A and B.
GAUB = (VA ∪ VB, ΣA ∪ ΣB, RAUB, S 0 ) RAUB = RA ∪ RB ∪ { S 0 → SA } ∪ { S 0 → SB }
Assumes VA and VB are disjoint (easy to arrange this by changing variable names.)
Lecture 10: NDPDAs/CFGs/PDAs 21
Lecture 10: NDPDAs/CFGs/PDAs 22
Not a counterexample…but not a proof either.
Lecture 10: NDPDAs/CFGs/PDAs 23
So, we have found a pair: P, P where one is a CFL and the other is not. Thus, CFLs are not closed under complement.
Opps! As Danni pointed out in class, this is badly broken. We will fix it next class…
Lecture 10: NDPDAs/CFGs/PDAs 24
(possibly on Exam 1)
Lecture 10: NDPDAs/CFGs/PDAs 25