CSCI 2670 Introduction to Theory of Computing - PowerPoint PPT Presentation

About This Presentation
Title:

CSCI 2670 Introduction to Theory of Computing

Description:

Title: PowerPoint Presentation Author: Wim van Dam Last modified by: Shelby Funk Created Date: 8/27/2001 7:35:01 AM Document presentation format: Letter Paper (8.5x11 in) – PowerPoint PPT presentation

Number of Views:91
Avg rating:3.0/5.0
Slides: 15
Provided by: Wim136
Learn more at: http://cobweb.cs.uga.edu
Category:

less

Transcript and Presenter's Notes

Title: CSCI 2670 Introduction to Theory of Computing


1
CSCI 2670Introduction to Theory of Computing
September 21, 2005
2
Agenda
  • Yesterday
  • Pushdown automata
  • Today
  • Quiz
  • More on pushdown automata
  • Pumping lemma for CFGs

3
Finite automata and PDA schematics
State control
FA
State control
PDA
Stack Infinite LIFO (last in first out) device
4
Definition of pushdown automaton
  • A pushdown automaton is a 6-tuple (Q,?,?,?,q0,F),
    where Q,?,?, and F are all finite sets, and
  • Q is the set of states
  • ? is the input alphabet
  • ? is the stack alphabet
  • ? Q ? ?e ? ?e ? P(Q ? ?e) is the transition
    function
  • q0 ? Q is the start state, and
  • F ? Q are the accept states.

5
Strings accepted by a PDA
  • Let w be a string in ? and P a PDA. w is in
    L(P) iff w can be written ww1w2wn, where each
    wi??e, and there exist r0,r1,,rn?Q and
    s0,s1,,sn?? satisfying the following
  • r0q0 and s0e
  • M starts in the start state with an empty stack
  • (ri1,b)??(ri,wi1,a), where siat and si1bt
    for some a,b??e and t??
  • M moves according to transition rules for the
    state, input and stack
  • rm?F
  • accept state occurs at input end

6
A closer look at the transition rule
  • (ri1,b)??(ri,wi1,a), where siat and si1bt
    for some a,b??e and t??
  • The top symbol is
  • Pushed if ae and b?e
  • Popped if a?e and be
  • Changed if a?e and b?e
  • Unchanged if ae and be
  • Symbols below the top of the stack may be
    considered, but not changed
  • This is ts role

7
Example
  • Find ? for the PDA that accepts all strings in
    0,1 with the same number of 0s and 1s
  • Need to keep track of equilibrium point with a
    on the stack
  • If stack top is not , it contains the symbol
    currently dominating in the string

8
Example
  • Find ? for the PDA that accepts all strings in
    0,1 with the same number of 0s and 1s
  • Push a symbol on the stack as its read if
  • It matches the top of the stack, or
  • The top of stack is
  • Pop the symbol off the top of the stack if you
    read a 0 and the top of stack is 1 or vice versa

9
Example
10
Example
This PDA is equivalent to the one on the previous
slide
11
Example
  • Nested parentheses

12
Equivalence of PDAs and CFGs
  • Theorem A language is context free if and only
    if some pushdown automaton recognizes it
  • Proved in two lemmas one for the if direction
    and one for the only if direction

13
CFGs are recognized by PDAs
  • Lemma If a language is context free, then some
    pushdown automaton recognizes it
  • Proof idea Construct a PDA following CFG rules

14
Constructing the PDA
  • You can read any symbol in ? when that symbol is
    at the top of the stack
  • Transitions of the form a,a?e
  • The rules will be pushed onto the stack when a
    variable A is on top of the stack and there is a
    rule A?w, you pop A and push w
  • You can go to the accept state only if the stack
    is empty
Write a Comment
User Comments (0)
About PowerShow.com