2017/09/14 Chapter 2.2 in Sipser -...
Transcript of 2017/09/14 Chapter 2.2 in Sipser -...
![Page 1: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/1.jpg)
Human-awareRobo.cs
1
Pushdown Automata • 2017/09/14
• Chapter 2.2 in Sipser
Ø Announcement: q Slides for this lecture are here:
http://www.public.asu.edu/~yzhan442/teaching/CSE355/Lectures/PDA.pdf
![Page 2: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/2.jpg)
Human-awareRobo.cs
2
Last time
FA (DFA & NFA) express Regular Expressions (RE)
• Context free langauges
o Context free grammars
q Design CFGs
q Ambiguities
q Chomsky normal form
Ø Goals:
o Learned context free grammars: the generator for CFLs
CFL
![Page 3: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/3.jpg)
Human-awareRobo.cs
3
Outline for today
FA (DFA & NFA) express Regular Expressions (RE)
• Context free langauges
o Context free grammars
o Pushdown automata
q Definition of PDA
q Computation PDA
Ø Goals:
o Learn PDA, the computing machine for CFL
CFL
![Page 4: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/4.jpg)
Human-awareRobo.cs
4
Pushdown automata
FA:
PDA:
![Page 5: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/5.jpg)
Human-awareRobo.cs
5
Pushdown automata
NPDA
![Page 6: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/6.jpg)
Human-awareRobo.cs
6
Pushdown automata
![Page 7: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/7.jpg)
Human-awareRobo.cs
7
Outline for today
FA (DFA & NFA) express Regular Expressions (RE)
• Context free langauges
o Context free grammars
o Pushdown automata
q Definition of PDA
q Computation PDA
Ø Goals:
o Learn PDA, the computing machine for CFL
CFL
![Page 8: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/8.jpg)
Human-awareRobo.cs
8
Computation of PDA
input string stack
![Page 9: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/9.jpg)
Human-awareRobo.cs
9
Computation of PDA
input string stack
$
![Page 10: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/10.jpg)
Human-awareRobo.cs
10
Computation of PDA
input string stack
a $
![Page 11: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/11.jpg)
Human-awareRobo.cs
11
Computation of PDA
input string stack
a $
![Page 12: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/12.jpg)
Human-awareRobo.cs
12
Computation of PDA
input string stack
a a $
![Page 13: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/13.jpg)
Human-awareRobo.cs
13
Computation of PDA
input string stack
a $
![Page 14: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/14.jpg)
Human-awareRobo.cs
14
Computation of PDA
input string stack
$
![Page 15: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/15.jpg)
Human-awareRobo.cs
15
Computation of PDA
input string stack
ACCEPT
![Page 16: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/16.jpg)
Human-awareRobo.cs
16
Computation of PDA
input string stack
ACCEPT
what is the language here?
![Page 17: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/17.jpg)
Human-awareRobo.cs
17
Computation of PDA
input string stack
ACCEPT
what is the language here? { anbn | n = 0, 1, … }
![Page 18: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/18.jpg)
Human-awareRobo.cs
18
Computation of PDA
![Page 19: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/19.jpg)
Human-awareRobo.cs
19
Computation of PDA
• Why do we need the $ sign for stack?
• Does the stack have to be empty to accept?
• What if a PDA only pushes and never pops?
• What if a PDA always pops after pushes?
• What if a PDA can only keep one symbol on the stack?
![Page 20: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/20.jpg)
Human-awareRobo.cs
20
Example
![Page 21: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/21.jpg)
Human-awareRobo.cs
21
Example
{ a+b }
![Page 22: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/22.jpg)
Human-awareRobo.cs
22
Example
![Page 23: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/23.jpg)
Human-awareRobo.cs
23
Example
{ ambn | } m n 2m,m > 0
![Page 24: 2017/09/14 Chapter 2.2 in Sipser - public.asu.eduyzhan442/teaching/CSE355/Lectures/PDA.pdfHuman-aware Robo.cs 2 Last time FA (DFA & NFA) express Regular Expressions (RE) • Context](https://reader030.fdocuments.net/reader030/viewer/2022041213/5e02fde8d9e2ea2f2041400e/html5/thumbnails/24.jpg)
Human-awareRobo.cs
24
Outline for today
FA (DFA & NFA) express Regular Expressions (RE)
• Reading assignment for the next class:
o Sipser Sec. 2.2 (remaining) – Quiz link will
be sent out; due date is before the
beginning of the next class on Sep 21
CFL
• Context free langauges
o Context free grammars
o Pushdown automata
q Definition of PDA
q Computation PDA
Ø Goals:
o Learned PDA, the computing machine for CFL