8' Pushdown Automata - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

8' Pushdown Automata

Description:

Means : it does not accepted by any finite automaton. ... Pushdown Automata and Contact-Free Language. Every cfg is accepted by an extended PDA ... – PowerPoint PPT presentation

Number of Views:109
Avg rating:3.0/5.0
Slides: 32
Provided by: drz5
Category:

less

Transcript and Presenter's Notes

Title: 8' Pushdown Automata


1
8. Pushdown Automata Context-free Languages
2
8.1 Pushdown Automata
  • Theorem 7.5.1 says the language aibi i gt 0
    is not regular.
  • Means it does not accepted by any finite
    automaton.
  • To accept this language, a machine needs to
    record the processing of any finite number of
    as.
  • So, PDA machine is introduced using stack
    operation

3
Definition 8.1.1
  • A PDA is sixtuple (Q, ?, ?, ?, q0, F),
  • Q a finite states
  • ? a finite set of input alphabet
  • ? a finite set of stack alphabet
  • q0 the start state
  • F ? Q a set of final state, and
  • ? a transition function from
  • Q X (???) X (???) to
    subset Q X (???)
  • PDA has 2 alphabets
  • An input alphabet ? (input string)
  • A stack alphabet ? (stored on the stack)

4
  • Example

R
L
A
a
a
b
b
Top
A
Input string, ?
B
B
Stack, ?
5
  • The computation of a PDA begins with machine in
  • state q0,
  • ?(qi, a,A) qj , B,qk, C
  • means the transition function, ? lists all
    possible transitions for
  • a given state, symbol, and stack top
    combination.
  • ? Here, ? indicates 2 transitions are possible
    when the automaton is in the state qj , scanning
    an a with A on the top of the stack.

6
  • qj, B ? ?qi, a, A

Current stack top
New state
Current input symbol
New stack top
Current state
7
  • Causes the machine to
  • Change the state from qi to qj
  • Process the symbol, a (advance the tape head)
  • Remove A from the top of the stack (pop the
    stack)
  • Push B onto the stack

8
State diagram of PDA
qi
qj
a A/B
?qi, a, A qj, B
A/B replacing A on the top by B
9
? Transition
  • A transition
  • qj, B ? ?qi, a, ?
  • will enter qj and add B to the top, whenever the
    machine is in state qi scanning an a.
  • If the input position is ? , the transition doest
    not process any symbol.

10
  • qi, ? ? ?qi, ?, A
  • ii) qi, A ? ?qi, ?, ?

qi
Pop symbol A without altering the state
? A/?
qi
qi
Push symbol A without altering the state
? ?/A
11
  • iii) qj, ? ? ?qi, a, ?
  • That PDA is equivalent to a finite automaton
    transition
  • Configuration of PDA
  • qj, ?, ?

a ?/?
qi
qj
Machine state
The stack
Unprocessed input
12
  • qj, ?, ? ---- qj, ?, ?

M
Can be obtained from by a single transition of
PDA M
13
The construction of PDA M to accept the language
ai bi , i? 0
  • Start with input string , w and empty stack
  • Process a, ? push A onto the stack
  • Process b, ? pop the stack
  • Match the number of as to bs
  • M Q q0, q1
  • ? a,b
  • ? A
  • F q0, q1

14
Actions of M to process input string aabb
  • q0, aabb, ?
  • --- q0, abb, A
  • --- q0, bb, AA
  • --- q1, b, A
  • --- q1, ?, ?
  • ?(q0, a, ?) q0, A
  • ?(q0, b, A) q1, ?
  • ?(q1, b, A) q1, ?

a ?/A
b A/?
b A/?
q0
q1
Halt in an accepting with empty stack
15
Definition 8.1.2
  • Let M (Q, ?, ?, ?, q0, F be a PDA. A string
    is accepted by M if there is a computation
  • q0, ?, ? --- qi, ?, ?
  • where qi ? F, language L(M)
  • Example 8.1.1
  • The PDA M accept the language wcwR w ?
    a,b


16
  • M Q q0, q1 ?(q0, a,
    ?) q0, A
  • ? a,b,c
    ?(q0, b, ?) q0, B
  • ? A,B ?(q0,
    c, ?) q1, ?
  • F q1
    ?(q1, a, A) q1, ?

  • ?(q1, b, B) q1, ?

b ?/B
a A/?
a ?/A
b B/?
c ? /?
q0
q1
17
  • The computation of M with input abcba is given
    below
  • q0, abcba, ?
  • --- q0, bcba, A
  • --- q0, cba, BA
  • --- q1, ba, BA
  • --- q1, a, A
  • --- q1, ?, ?
  • A PDA is deterministic if there is at most one
    transition that is applicable for each
    combination of state, input symbol, and stack
    top.

18
Example 8.1.2
  • Suppose we want to construct a NDPA that accept
    the language
  • L w ? a,b w contains equally may as and
    bs
  • We must count the occurrences of as and bs.
    This can be done by pushing symbols on the stack
    when one input character is seen and removing
    them when the other is seen.

19
Pushdown Automata and Contact-Free Language
  • Every cfg is accepted by an extended PDA
  • Let L is a contact-free language, and G is a
    garmmar in Greibach Normal Form (GNF)
  • ? L(G) L
  • The rules of G, accepts for
  • S ? ?, have the form
  • A ? aA1 A2 A3 An

20
Greibach Normal Form
  • A contact-free grammar G (V, ,P,S) is in in GNF
    if each rule has one of the following forms
  • A ? aA1 A2 A3 An
  • A ? a
  • S ? ?
  • Where a ? ?, and Ai ? V S for I1,2,3,,n

21
  • The GNF, G that accepts ai bi i gt 0 is used
    to illustrate the construction of an equivalent
    PDA
  • G S ? aAB aB
  • A ? aAB aB
  • B ? b
  • PDA has two states
  • q0 start state
  • q1 accepting state

22
  • S ? aA1 A2 A3 An
  • Generates a transition that processes the
    terminal symbol a, pushes the variables aA1 A2 A3
    An onto the stack, and enter state q1
  • - ? given as follows
  • ?(q0, a, ?) q1, AB, (q1, B)
  • ?(q1, a, A) q1, AB, (q1, B)
  • ?(q1, b, B) q1, ?

23
Computation of string aaabbb
  • GNF
  • S ? aAB
  • ? aaABB
  • ? aaaBBB
  • ? aaabBB
  • ? aaabbB
  • ? aaabbb
  • PDA
  • q0, aaabbb, ?
  • --- q1, aabbb, AB
  • --- q1, abbb, ABB
  • --- q1, bbb, BBB
  • --- q1, bb, BB
  • --- q1, b, B
  • --- q1, ?, ?

24
Introduction
  • State the purpose of the discussion
  • Identify yourself

25
Topics of Discussion
  • State the main ideas youll be talking about

26
Topic One
  • Details about this topic
  • Supporting information and examples
  • How it relates to your audience

27
Topic Two
  • Details about this topic
  • Supporting information and examples
  • How it relates to your audience

28
Topic Three
  • Details about this topic
  • Supporting information and examples
  • How it relates to your audience

29
Real Life
  • Give an example or real life anecdote
  • Sympathize with the audiences situation if
    appropriate

30
What This Means
  • Add a strong statement that summarizes how you
    feel or think about this topic
  • Summarize key points you want your audience to
    remember

31
Next Steps
  • Summarize any actions required of your audience
  • Summarize any follow up action items required of
    you
Write a Comment
User Comments (0)
About PowerShow.com