Download presentation
Presentation is loading. Please wait.
1
1 A Non Context-Free Language (We will prove it at the next class)
2
2 Regular languages Context-free languages Non Context-free languages
3
3 Deterministic PDAs DPDAs
4
4 DPDAs Allowed:
5
5 Not allowed:
6
6 Allowed: Something must be matched from the stack
7
7 Not allowed:
8
8 DPDA example
9
9 The language is deterministic context-free
10
10 Definition: A language is deterministic context-free if some DPDA accepts it
11
11 Example of Non-DPDA (NPDA)
12
12 Not allowed in DPDAs
13
13 NPDAs Have More Power than DPDAs
14
14 We will show: there is a context-free language which is not deterministic context-free (accepted by a NPDA) (not accepted by a DPDA)
15
15 The language is:
16
16 The language is context-free Context-free grammar for : there is an NPDA that accepts
17
17 is not deterministic context-free Theorem: The language (there is no DPDA that accepts )
18
18 Proof: Assume for contradiction that is deterministic context free Therefore: there is a DPDA that accepts
19
19 DPDA with accepts
20
20 The language is not context-free (we will prove it at the next class) Fact 1:
21
21 The language is not context-free (we will prove later today that the union of two context-free languages is context-free) Fact 2:
22
22 We will construct a NPDA that accepts: Contradiction!
23
23 We modify Modified Replace with
24
24 The NPDA that accepts Modified Original
25
25 Since is accepted by a NPDA it is context-free Contradiction! (since is not context-free)
26
26 Therefore: There is no DPDA that accepts End of Proof Not deterministic context free
27
27 Positive Properties of Context-Free languages
28
28 Context-free languages are closed under: Union is context free is context-free Union
29
29 Example Union LanguageGrammar
30
30 In general: The grammar of the union has new start variable and additional production For context-free languages with context-free grammars and start variables
31
31 Context-free languages are closed under: Concatenation is context free is context-free Concatenation
32
32 Example Concatenation LanguageGrammar
33
33 In general: The grammar of the concatenation has new start variable and additional production For context-free languages with context-free grammars and start variables
34
34 Context-free languages are closed under: Star-operation is context freeis context-free Star Operation
35
35 Example Language Grammar Star Operation
36
36 In general: The grammar of the star operation has new start variable and additional production For context-free language with context-free grammar and start variable
37
37 Negative Properties of Context-Free Languages
38
38 Context-free languages are not closed under: intersection is context free not necessarily context-free Intersection
39
39 Example Context-free: NOT context-free Intersection
40
40 Context-free languages are not closed under: complement is context freenot necessarily context-free Complement
41
41 NOT context-free Example Context-free: Complement
42
42 Intersection of Context-free languages and Regular Languages
43
43 The intersection of a context-free language and a regular language is a context-free language context free regular context-free
44
44 for NPDA DFA Construct a new NPDA machine that accepts Machine context-free regular simulates in parallel and
45
45 transition NPDADFA transition NPDA
46
46 initial state NPDADFA Initial state NPDA
47
47 final state final states NPDADFA final states NPDA
48
48 simulates in parallel and accepts stringif and only if accepts string and accepts string
49
49 Therefore: (since is NPDA) is context-free
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.