Title: Languages and Finite Automata
1Formal Languages Deterministic PDAs Hinrich
Schütze IMS, Uni Stuttgart, WS 2007/08 Slides
based on RPI CSCI 2400 Thanks to Costas Busch
2Deterministic PDA DPDA
Allowed transitions
(deterministic choices)
3Allowed transitions
(deterministic choices)
4Not allowed
(non deterministic choices)
5DPDA example
6Definition
A language is deterministic context-free if
there exists some DPDA that accepts it
Example
The language
is deterministic context-free
7Example of Non-DPDA (PDA)
8Not allowed in DPDAs
9PDAs Have More Power thanDPDAs
10Trivially
Deterministic Context-Free Languages (DPDA)
Context-Free Languages PDAs
Since every DPDA is also a PDA
11We will actually show
Deterministic Context-Free Languages (DPDA)
Context-Free Languages (PDA)
12The language is
We will show
- is not deterministic context-free
13Proof?
14Language is context-free
15Theorem
The language
is not deterministic context-free
(there is no DPDA that accepts )
16Proof
Assume for contradiction that
is deterministic context free
Therefore
there is a DPDA that accepts
17DPDA with
accepts
accepts
18DPDA with
Such a path exists due to determinism
19Fact 1
The language is not
context-free
(we will prove this in a later class
using pumping lemma for context-free languages)
20Fact 2
The language is not
context-free
(we can prove this using pumping lemma for
context-free languages)
21We will construct a PDA that accepts
which is a contradiction!
22DPDA
Replace with
Modify
DPDA
23A PDA that accepts
Connect the final states of with the
final states of
24Since is accepted by a
PDA
it is context-free
Contradiction!
(since is not
context-free)
25Therefore
Is not deterministic context free
There is no DPDA that accepts it
End of Proof
26Positive Propertiesof Context-Free languages
27Union
Context-free languages are closed under
Union
is context free
is context free
is context-free
28Proof?
29Example
Language
Grammar
Union
30In general
For context-free languages with context-free
grammars and start variables
The grammar of the union has new start
variable and additional production
31Concatenation
Context-free languages are closed under
Concatenation
is context free
is context free
is context-free
32Proof?
33Example
Language
Grammar
Concatenation
34In general
For context-free languages with context-free
grammars and start variables
The grammar of the concatenation has new
start variable and additional production
35Star Operation
Context-free languages are closed under
Star-operation
is context free
is context-free
36Proof?
37Example
Language
Grammar
Star Operation
38In general
For context-free language with context-free
grammar and start variable
The grammar of the star operation has new
start variable and additional production
39Negative Propertiesof Context-Free Languages
40Intersection
Context-free languages are not closed under
intersection
is context free
is context free
not necessarily context-free
41Example
Context-free
Context-free
Intersection
NOT context-free
42Complement
Context-free languages are not closed under
complement
is context free
not necessarily context-free
43Example
Context-free
Context-free
Complement
NOT context-free
44Intersectionof Context-free languagesand
Regular Languages
45The intersection of a context-free
language and a regular language is
a context-free language
context free
regular
context-free
46Machine
Machine
for
DFA
for
NPDA
regular
context-free
Construct a new NPDA machine that accepts
simulates in parallel and
47NPDA
DFA
transition
transition
NPDA
transition
48NPDA
DFA
transition
NPDA
transition
49NPDA
DFA
initial state
initial state
NPDA
Initial state
50NPDA
DFA
final state
final states
NPDA
final states
51Example
context-free
NPDA
52regular
DFA
53Intersection?
54context-free
Automaton for
NPDA
55In General
simulates in parallel and
accepts string
if and only if
accepts string and
accepts string
56Therefore
is NPDA
is context-free
is context-free
57Applications of Regular Closure
58The intersection of a context-free
language and a regular language is
a context-free language
Regular Closure
context free
regular
context-free
59An Application of Regular Closure
Prove that
is context-free
60We know
is context-free
61We also know
is regular
is regular
62regular
context-free
context-free
(regular closure)
is context-free
63Another Application of Regular Closure
Prove that
is not context-free
64Proof?
65is context-free
If
(regular closure)
Then
context-free
regular
context-free
Impossible!!!
66Decidable Propertiesof Context-Free Languages
67Membership Question
for context-free grammar find if string
68Membership Question
for context-free grammar find if string
69Empty Language Question
for context-free grammar find if
70Empty Language Question
for context-free grammar find if
71Infinite Language Question
for context-free grammar find if
is infinite
72Infinite Language Question
for context-free grammar find if
is infinite
73Example
Infinite language
Dependency graph
74(No Transcript)