210 likes | 1.19k Views
Last Time: Readings 2.3HW Hints and Induction exampleReviewInductionDFA for Union, revisit Example 2.4Pop Quiz Uses of Finite automataNFADelta-hat, a string accepted by an NFA, the language acceptedSubset construction converting NFA ? equivalent DFATEST 1 ? September 29th New: Readings section 2.2.3-2.4Examples Subset construction converting NFA? equivalent DFAAuthor's Website Solutions Online.
E N D
1. Lecture 6NFA Subset Construction & Epsilon Transitions Topics:
Examples Subset Construction
Author’s Website again
Epsilon transitions
Ruby - dfa1.rb
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
Author’s 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?
4. Subset Construction example Figure 2.9 Page 56 of text
5. Subset Construction example Figure 2.9 Page 56 of text
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 can’t?
Can a DFA recognize a language that an NFA can’t?
7. Exercise 2.2.9 Solutions Online Author’s 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. Ullman’s (Jeff’s) slides from CS 154
http://infolab.stanford.edu/~ullman/ialc/jdu-slides.html
8. Homework and Test 1 HW 2
Extra Credit
http://infolab.stanford.edu/~ullman/ialc/slides/slides1.pdf
HW 3
4a
4b
5
6
HW 4
Pop Quiz
9. Subset Example from Author’s website slides2.pdf
10. Mutual Induction Proof Write up on back of Lecture Overview
11. Consider our old friend from HW 2.2.5b:L = {w e {0,1}* | the tenth symbol from the right end of w is a ‘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
strn[numstrings] = 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
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/
Author’s Website for Text
http://infolab.stanford.edu/~ullman/ialc.html
Slides, HW, Exams