Languages and Finite Automata - PowerPoint PPT Presentation

1 / 74
About This Presentation
Title:

Languages and Finite Automata

Description:

Membership Algorithms: Parsers. Exhaustive search parser. CYK parsing ... then the language is infinite. 73. Example: Dependency graph. Infinite language. 74 ... – PowerPoint PPT presentation

Number of Views:52
Avg rating:3.0/5.0
Slides: 75
Provided by: cost70
Category:

less

Transcript and Presenter's Notes

Title: Languages and Finite Automata


1
Formal Languages Deterministic PDAs Hinrich
Schütze IMS, Uni Stuttgart, WS 2007/08 Slides
based on RPI CSCI 2400 Thanks to Costas Busch
2
Deterministic PDA DPDA
Allowed transitions
(deterministic choices)
3
Allowed transitions
(deterministic choices)
4
Not allowed
(non deterministic choices)
5
DPDA example
6
Definition
A language is deterministic context-free if
there exists some DPDA that accepts it
Example
The language
is deterministic context-free
7
Example of Non-DPDA (PDA)
8
Not allowed in DPDAs
9
PDAs Have More Power thanDPDAs

10
Trivially
Deterministic Context-Free Languages (DPDA)
Context-Free Languages PDAs
Since every DPDA is also a PDA
11
We will actually show
Deterministic Context-Free Languages (DPDA)
Context-Free Languages (PDA)
12
The language is
We will show
  • is context-free
  • is not deterministic context-free

13
Proof?

14
Language is context-free
15
Theorem
The language
is not deterministic context-free
(there is no DPDA that accepts )
16
Proof
Assume for contradiction that
is deterministic context free
Therefore
there is a DPDA that accepts
17
DPDA with
accepts
accepts
18
DPDA with
Such a path exists due to determinism
19
Fact 1
The language is not
context-free
(we will prove this in a later class
using pumping lemma for context-free languages)
20
Fact 2
The language is not
context-free
(we can prove this using pumping lemma for
context-free languages)
21
We will construct a PDA that accepts
which is a contradiction!
22
DPDA
Replace with
Modify
DPDA
23
A PDA that accepts
Connect the final states of with the
final states of
24
Since is accepted by a
PDA
it is context-free
Contradiction!
(since is not
context-free)
25
Therefore
Is not deterministic context free
There is no DPDA that accepts it
End of Proof
26
Positive Propertiesof Context-Free languages

27
Union
Context-free languages are closed under
Union
is context free
is context free
is context-free
28
Proof?

29
Example
Language
Grammar
Union
30
In general
For context-free languages with context-free
grammars and start variables
The grammar of the union has new start
variable and additional production
31
Concatenation
Context-free languages are closed under
Concatenation
is context free
is context free
is context-free
32
Proof?

33
Example
Language
Grammar
Concatenation
34
In general
For context-free languages with context-free
grammars and start variables
The grammar of the concatenation has new
start variable and additional production
35
Star Operation
Context-free languages are closed under
Star-operation
is context free
is context-free
36
Proof?

37
Example
Language
Grammar
Star Operation
38
In 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
39
Negative Propertiesof Context-Free Languages

40
Intersection
Context-free languages are not closed under
intersection
is context free
is context free
not necessarily context-free
41
Example
Context-free
Context-free
Intersection
NOT context-free
42
Complement
Context-free languages are not closed under
complement
is context free
not necessarily context-free
43
Example
Context-free
Context-free
Complement
NOT context-free
44
Intersectionof Context-free languagesand
Regular Languages

45
The intersection of a context-free
language and a regular language is
a context-free language
context free
regular
context-free
46
Machine
Machine
for
DFA
for
NPDA
regular
context-free
Construct a new NPDA machine that accepts
simulates in parallel and
47
NPDA
DFA
transition
transition
NPDA
transition
48
NPDA
DFA
transition
NPDA
transition
49
NPDA
DFA
initial state
initial state
NPDA
Initial state
50
NPDA
DFA
final state
final states
NPDA
final states
51
Example
context-free
NPDA
52
regular
DFA
53
Intersection?

54
context-free
Automaton for
NPDA
55
In General
simulates in parallel and
accepts string
if and only if
accepts string and
accepts string
56
Therefore
is NPDA
is context-free
is context-free
57
Applications of Regular Closure
58
The intersection of a context-free
language and a regular language is
a context-free language
Regular Closure
context free
regular
context-free
59
An Application of Regular Closure
Prove that
is context-free
60
We know
is context-free
61
We also know
is regular
is regular
62
regular
context-free
context-free
(regular closure)
is context-free
63
Another Application of Regular Closure
Prove that
is not context-free
64
Proof?

65
is context-free
If
(regular closure)
Then
context-free
regular
context-free
Impossible!!!
66
Decidable Propertiesof Context-Free Languages
67
Membership Question
for context-free grammar find if string
68
Membership Question
for context-free grammar find if string
69
Empty Language Question
for context-free grammar find if
70
Empty Language Question
for context-free grammar find if
71
Infinite Language Question
for context-free grammar find if
is infinite
72
Infinite Language Question
for context-free grammar find if
is infinite
73
Example
Infinite language
Dependency graph
74
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com