; TOC- PDA
Documents
User Generated
Resources
Learning Center
Your Federal Quarterly Tax Payments are due April 15th

# TOC- PDA

VIEWS: 20 PAGES: 20

• pg 1
```									CSI 3104 /Winter 2006: Introduction to Formal Languages Chapter 14: Pushdown Automata

Chapter 14: Pushdown Automata
I. Theory of Automata  II. Theory of Formal Languages III. Theory of Turing Machines …
Zaguia/Stojmenovic 1

Chapter 14: Pushdown Automata

Pushdown Automata : A new model for theoretical machines.
Input tape

…

cells

Input word
a a b a D D

…
2

symbol for blank
Zaguia/Stojmenovic

Chapter 14: Pushdown Automata

all letters of 
+
START ACCEPT

all letters of 

REJECT

Termination states
a

b D
Zaguia/Stojmenovic 3

Chapter 14: Pushdown Automata

b

a a b +

Example
START

–

b b

a

D

D
REJECT
Zaguia/Stojmenovic

a
ACCEPT
4

Chapter 14: Pushdown Automata

b

a,b
a b b b a

Example

–

a

+

a,b a

START

D
REJECT

D
REJECT
Zaguia/Stojmenovic

D
ACCEPT
5

Chapter 14: Pushdown Automata

b d

Operations POP and PUSH

c
b a

D
. . .

push push push push push push pop

a b c d b c

a
POP

b

D
PUSH a

PUSH b
6

Zaguia/Stojmenovic

Chapter 14: Pushdown Automata

A pushdown automaton (PDA) is: 1. an alphabet  of input letters 2. an input tape, finite on the left but infinite to the right and separated into cells. The input tape initially contains the sequence of input letters starting in the first cell. The rest of the tape contains only blanks Δ. 3. one start state with at least one outgoing edge and no incoming edges 4. a set of halt states with incoming edges only 5. a set of READ states. The outgoing arrows are labeled with letters from  or blanks.
ACCEPT

START
REJECT Zaguia/Stojmenovic 7

Chapter 14: Pushdown Automata

A pushdown automaton (PDA) is: … 6. an alphabet Γ for stack characters 7. a pushdown stack, infinite in one direction. The stack is initially empty. 8. a finite set of PUSH states that put characters onto the top of the stack 9. a finite set of POP states. Outgoing edges are labeled with letters of Γ and blanks. (There can be none or many edges labeled with the same character. There can be many incoming edges: NonDetreministic).
POP PUSH x

Zaguia/Stojmenovic

8

Chapter 14: Pushdown Automata



The language accepted or recognized by a pushdown automaton is the set of words whose paths end in an ACCEPT state. Theorem. For every regular language L, there is some PDA that accepts it. Proof: There is an FA that accepts L because it is regular. We transform the FA into a PDA using the constructive algorithm already discussed.
Zaguia/Stojmenovic 9



Chapter 14: Pushdown Automata

a(a+b)*
{b}
START

START

a

ACCEPT

b

D

D
D D

ACCEPT

D

10

Zaguia/Stojmenovic

Chapter 14: Pushdown Automata

START
a a a b b b Δ

…

PUSH a

a

D b a READ a D
ACCEPT

b b,D
POP

D POP a,b
REJECT
11

REJECT

REJECT

Zaguia/Stojmenovic

PALINDROMEX = {X,aXa,bXb,aaXaa,abXba,baXab,…}
START

a
PUSH a

a

X

a b

POP

PUSH b

b

D
POP

b

ODDPALINDROME
abbXbba
POP
Zaguia/Stojmenovic

D

ACCEPT
12

Chapter 14: Pushdown Automata

EVENPALINDROME
POP START

a

a
PUSH a

b
POP

a
b

b
D

b

a

PUSH b

D
POP

{Λ, aa, bb, aaaa, abba, baab, bbbb, …}
Zaguia/Stojmenovic

D
ACCEPT
13

Chapter 14: Pushdown Automata

Languages accepted by nondeterministic pushdown automata Languages accepted by deterministic pushdown automata Languages accepted by
1. 2. 3. finite automata nondeterministic finite automata transition graphs

Zaguia/Stojmenovic

14

Chapter 14: Pushdown Automata

START

An infinite path

ACCEPT

a

a
b
PUSH a

POP

b

ACCEPT

Zaguia/Stojmenovic

15

Chapter 14: Pushdown Automata

4

+

*

S

+
POP

* D

ACCEPT

D

PUSH S

S PUSH S PUSH + PUSH S

S
PUSH S PUSH * PUSH S
Zaguia/Stojmenovic

START

Example: S  S+S | S*S | 4
4+4*4
16

Zaguia/Stojmenovic

17

Example: Accept 4+4*4+4*4


    

Develop stack to ‘mask’ the input: S S*S S+S*S S*S+S*S S+S*S+S*S Pop from stack & read from input in parallel, Match S with 4, + with +, * with * 4+4*4+4*4 S+S*S+S*S

Zaguia/Stojmenovic

18

Chapter 14: Pushdown Automata



Theorem. Let L be a language accepted by a PDA. There is another PDA that accepts L such that whenever a path leads to ACCEPT, the stack and the input tape contain only blanks.

Zaguia/Stojmenovic

19

Chapter 14: Pushdown Automata

It is enough to replace each
ACCEPT

All letters of S

BY

D
POP

All letters of G

D
ACCEPT
Zaguia/Stojmenovic 20

```
To top