pushdown automata pdas l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Pushdown Automata PDAs PowerPoint Presentation
Download Presentation
Pushdown Automata PDAs

Loading in 2 Seconds...

play fullscreen
1 / 90

Pushdown Automata PDAs - PowerPoint PPT Presentation


  • 1183 Views
  • Uploaded on

Pushdown Automata PDAs Pushdown Automaton -- PDA Input String Stack States Initial Stack Symbol Stack Stack stack head top bottom special symbol Appears at time 0 The States Pop symbol Input symbol Push symbol input stack top Replace input stack top Push input stack

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Pushdown Automata PDAs' - Sophia


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
pushdown automata pdas

Pushdown AutomataPDAs

Costas Busch - RPI

pushdown automaton pda
Pushdown Automaton -- PDA

Input String

Stack

States

Costas Busch - RPI

slide3

Initial Stack Symbol

Stack

Stack

stack

head

top

bottom

special symbol

Appears at time 0

Costas Busch - RPI

the states
The States

Pop

symbol

Input

symbol

Push

symbol

Costas Busch - RPI

slide5

input

stack

top

Replace

Costas Busch - RPI

slide6

input

stack

top

Push

Costas Busch - RPI

slide7

input

stack

top

Pop

Costas Busch - RPI

slide8

input

stack

top

No Change

Costas Busch - RPI

slide9

Empty Stack

input

stack

empty

Pop

top

When the stack gets empty,

the automaton HALTS

(no more transitions after )

Costas Busch - RPI

slide10

A Possible Transition

input

stack

Pop

top

Costas Busch - RPI

non determinism
Non-Determinism

PDAs are non-deterministic

Allowed non-deterministic transitions

Costas Busch - RPI

example pda
Example PDA

PDA :

Costas Busch - RPI

slide13

Basic Idea:

  • Push the a’s
  • on the stack

2. Match the b’s on input

with a’s on stack

3. Match

found

Costas Busch - RPI

slide14

Execution Example:

Time 0

Input

Stack

current

state

Costas Busch - RPI

slide15

Time 1

Input

Stack

Costas Busch - RPI

slide16

Time 2

Input

Stack

Costas Busch - RPI

slide17

Time 3

Input

Stack

Costas Busch - RPI

slide18

Time 4

Input

Stack

Costas Busch - RPI

slide19

Time 5

Input

Stack

Costas Busch - RPI

slide20

Time 6

Input

Stack

Costas Busch - RPI

slide21

Time 7

Input

Stack

Costas Busch - RPI

slide22

Time 8

Input

Stack

accept

Costas Busch - RPI

slide23

A string is accepted if there is

a computation such that:

All the input is consumed

AND

The last state is an accepting state

At the end of the computation,

we do not care about the stack contents

(the stack can be empty at the last state)

Costas Busch - RPI

slide24

The input string

is accepted by the PDA:

Costas Busch - RPI

slide25

In general,

is the language accepted by the PDA:

Costas Busch - RPI

slide26

Rejection Example:

Time 0

Input

Stack

current

state

Costas Busch - RPI

slide27

Rejection Example:

Time 1

Input

Stack

current

state

Costas Busch - RPI

slide28

Rejection Example:

Time 2

Input

Stack

current

state

Costas Busch - RPI

slide29

Rejection Example:

Time 3

Input

Stack

current

state

Costas Busch - RPI

slide30

Rejection Example:

Time 4

Input

Stack

current

state

Costas Busch - RPI

slide31

Rejection Example:

Time 4

Input

Stack

reject

current

state

Costas Busch - RPI

slide32

The input string

is rejected by the PDA:

Costas Busch - RPI

slide33

A string is rejected if there is

no computation such that:

All the input is consumed

AND

The last state is an accept state

At the end of the computation,

we do not care about the stack contents

Costas Busch - RPI

another pda example
Another PDA example

PDA :

Costas Busch - RPI

slide35

Basic Idea:

  • Push v
  • on stack

3. Match on input

with v on stack

2. Guess

middle

of input

4. Match

found

Costas Busch - RPI

slide36

Execution Example:

Time 0

Input

Stack

Costas Busch - RPI

slide37

Time 1

Input

Stack

Costas Busch - RPI

slide38

Time 2

Input

Stack

Costas Busch - RPI

slide39

Time 3

Input

Guess the middle

of string

Stack

Costas Busch - RPI

slide40

Time 4

Input

Stack

Costas Busch - RPI

slide41

Time 5

Input

Stack

Costas Busch - RPI

slide42

Time 6

Input

Stack

accept

Costas Busch - RPI

slide43

Rejection Example:

Time 0

Input

Stack

Costas Busch - RPI

slide44

Time 1

Input

Stack

Costas Busch - RPI

slide45

Time 2

Input

Stack

Costas Busch - RPI

slide46

Time 3

Input

Guess the middle

of string

Stack

Costas Busch - RPI

slide47

Time 4

Input

Stack

Costas Busch - RPI

slide48

Time 5

There is no possible transition.

Input

Input is not consumed

Stack

Costas Busch - RPI

slide49

Another computation on same string:

Input

Time 0

Stack

Costas Busch - RPI

slide50

Time 1

Input

Stack

Costas Busch - RPI

slide51

Time 2

Input

Stack

Costas Busch - RPI

slide52

Time 3

Input

Stack

Costas Busch - RPI

slide53

Time 4

Input

Stack

Costas Busch - RPI

slide54

Time 5

Input

No final state

is reached

Stack

Costas Busch - RPI

slide55

There is no computation

that accepts string

Costas Busch - RPI

another pda example56
Another PDA example

PDA

Costas Busch - RPI

slide57

Execution Example:

Time 0

Input

Stack

Costas Busch - RPI

slide58

Time 1

Input

Stack

Costas Busch - RPI

slide59

Time 2

Input

Stack

Costas Busch - RPI

slide60

Time 3

Input

Stack

accept

Costas Busch - RPI

slide61

Rejection example:

Time 0

Input

Stack

Costas Busch - RPI

slide62

Time 1

Input

Stack

Costas Busch - RPI

slide63

Time 2

Input

Stack

Costas Busch - RPI

slide64

Time 3

Input

Stack

Costas Busch - RPI

slide65

Time 4

Input

Stack

Halt and Reject

Costas Busch - RPI

pushing strings
Pushing Strings

Pop

symbol

Input

symbol

Push

string

Costas Busch - RPI

slide67

Example:

input

pushed

string

stack

top

Push

Costas Busch - RPI

another pda example68
Another PDA example

PDA

Costas Busch - RPI

slide69

Execution Example:

Time 0

Input

Stack

current

state

Costas Busch - RPI

slide70

Time 1

Input

Stack

Costas Busch - RPI

slide71

Time 3

Input

Stack

Costas Busch - RPI

slide72

Time 4

Input

Stack

Costas Busch - RPI

slide73

Time 5

Input

Stack

Costas Busch - RPI

slide74

Time 6

Input

Stack

Costas Busch - RPI

slide75

Time 7

Input

Stack

Costas Busch - RPI

slide76

Time 8

Input

Stack

accept

Costas Busch - RPI

formalities for pdas

Formalities for PDAs

Costas Busch - RPI

slide78

Transition function:

Costas Busch - RPI

slide79

Transition function:

Costas Busch - RPI

formal definition
Formal Definition

Pushdown Automaton (PDA)

Accept

states

States

Input

alphabet

Stack

start

symbol

Transition

function

Initial

state

Stack

alphabet

Costas Busch - RPI

instantaneous description
Instantaneous Description

Current

state

Current

stack

contents

Remaining

input

Costas Busch - RPI

slide82

Example:

Instantaneous Description

Input

Time 4:

Stack

Costas Busch - RPI

slide83

Example:

Instantaneous Description

Input

Time 5:

Stack

Costas Busch - RPI

slide84

We write:

Time 4

Time 5

Costas Busch - RPI

slide85

A computation:

Costas Busch - RPI

slide86

For convenience we write:

Costas Busch - RPI

formal definition87
Formal Definition

Language accepted by PDA :

Initial state

Accept state

Costas Busch - RPI

slide88

Example:

PDA :

Costas Busch - RPI

slide89

PDA :

Costas Busch - RPI

slide90

Therefore:

PDA :

Costas Busch - RPI