Lecture 6 NFA Subset Construction - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Lecture 6 NFA Subset Construction

Description:

Subset construction converting NFA equivalent DFA. TEST 1 September 29th ... 2.2.9 page 54 Prove If d(q0, a) = d(qf, a) for all a in S then for all w ! ... – PowerPoint PPT presentation

Number of Views:1015
Avg rating:3.0/5.0
Slides: 22
Provided by: mantonm5
Category:

less

Transcript and Presenter's Notes

Title: Lecture 6 NFA Subset Construction


1
Lecture 6NFA Subset Construction Epsilon
Transitions
CSCE 355 Foundations of Computation
  • Topics
  • Examples Subset Construction
  • Authors Website again
  • Epsilon transitions
  • Ruby - dfa1.rb

Sept 15, 2008
2
  • Last Time Readings 2.3
  • HW Hints and Induction example
  • Review
  • Induction
  • DFA for Union, revisit Example 2.4
  • Pop Quiz
  • Uses of Finite automata
  • NFA
  • Delta-hat, a string accepted by an NFA, the
    language accepted
  • Subset construction converting NFA ? equivalent
    DFA
  • TEST 1 September 29th
  • New Readings section 2.2.3-2.4
  • Examples Subset construction converting NFA?
    equivalent DFA
  • Authors Website Solutions Online

3
NFA example Figure 2.9
  • x
  • What does the ?p mean?
  • What does the r mean?
  • What is d(s, x) informally?
  • Page 56
  • Transition Table (NFA)

0
1
p
q
r
0,1
4
Subset Construction example Figure 2.9
  • Page 56 of text

0
1
p
q
r
Equivalent DFA Table
0,1
5
Subset Construction example Figure 2.9
  • Page 56 of text

0
1
p
q
r
Equivalent DFA Table
0,1
6
Subset Construction Significance
  • Constructing an equivalent DFA from and NFA
  • What does equivalent mean?
  • Does equivalent mean have the same number of
    states?
  • Equivalent means ?
  • Why convert?
  • What is better about an NFA?
  • What is better about a DFA?
  • We are interested in the power of these models?
  • Can an NFA recognize a language that a DFA cant?
  • Can a DFA recognize a language that an NFA cant?

7
Exercise 2.2.9 Solutions Online
  • Authors Website for Text
  • http//infolab.stanford.edu/ullman/ialc.html
  • HW Solutions for starred () problems
  • http//infolab.stanford.edu/ullman/ialcsols/sol2.
    html
  • 2.2.9 page 54 Prove If d(q0, a) d(qf, a) for
    all a in S then for all w ! e we have d(q0, w)
    d(qf, w) by induction on the length of w.
  • Basis
  • Assume
  • Then we need to show that
  • Dr. Ullmans (Jeffs) slides from CS 154
  • http//infolab.stanford.edu/ullman/ialc/jdu-slide
    s.html

8
Homework and Test 1
  • HW 2
  • Extra Credit
  • http//infolab.stanford.edu/ullman/ialc/slides/sl
    ides1.pdf
  • HW 3
  • 4a
  • 4b
  • 5
  • 6
  • HW 4
  • Pop Quiz

9
Subset Example from Authors website slides2.pdf
10
Mutual Induction Proof
  • Write up on back of Lecture Overview

11
Consider our old friend from HW 2.2.5bL w e
0,1 the tenth symbol from the right end of w
is a 1
0,1
0,1
0,1
1
0,1
10
3
4

0
1
2
0,1
  • If we convert an NFA with n states to a DFA using
    the subset construction what is the max number
    states in the DFA?
  • Can we do better?
  • Subset construction an example of lazy
    evaluation i.e. consider only states we can
    get to from q0
  • DFA minimization is a topic for later

12
Ruby Strings and DFAs (dfa1.rb)
  • DFA1.rb on Handouts page
  • Now consider how to generate all strings in S
    of length 6
  • Idea generate them from a list of the strings
    of length n-1
  • by concatenating onto each string w of length
    n-1 each a e S (a recursive definition)
  • lists of strings of length n-1 and n
  • strnm1 Array.new()
  • strn Array.new()
  • strnm1 "a", "b"
  • print "strnm1 strnm1\n

13
  • 2,3,4,5, 6, 7, 8.each len
  • numstrings 0
  • strnm1.each str
  • alphabet.each chr
  • x chr str
  • strnnumstrings x
  • numstrings numstrings 1
  • print "Strings of length len\n"
  • strn.each str print "str\n"
  • strnm1 strn
  • strn Array.new
  • numstrings 0

14
Theorem 2.11 For NFA there is Eq. DFA
15
Theorem 2.12 L is accepted by DFA if and only if
L is accepted by NFA
16
Epsilon (e)-Transitions
  • Keyword Searching Example for, format, font

17
(No Transcript)
18
(No Transcript)
19
Epsilon Closure
20
Equivalent NFA (without e) for an NFA with e
  • Convert NFA with e to an equivalent NFA without e
  • Compute transitive closure of e arcs
  • If p can reach state q by e arcs and d(r, a)
    contains p (there is a transition from r to q on
    input a) then add q to d(r, a) i.e. add a
    transition from r to q on input a
  • xx

21
References and Homework
  • Ruby pickaxe book Online
  • http//whytheluckystiff.net/ruby/pickaxe/
  • Authors Website for Text
  • http//infolab.stanford.edu/ullman/ialc.html
  • Slides, HW, Exams
Write a Comment
User Comments (0)
About PowerShow.com