CSCE 355 Foundations of Computation Lecture 5 NFAs
- Slides: 21
CSCE 355 Foundations of Computation Lecture 5 NFAs Topics: n Induction review/Pop. Quiz n NFAs Delta, delta hat Strings accepted, languages accepted Subset Construction n Sept 10, 2008
• Last Time: Readings through 2. 2 n n Induction Proofs format, Examples from HW, Pseudo Pop Quiz Review of Previous Lecture Ruby Simulation - dfa 0. rb More Examples l given DFA find L (Example 2. 4) l given L find DFA (Exercise 2. 2. 4) n Given L 1 and L 2 and Machines M 1 and M 2 with L 1 = L(M 1) and L 2 = L(M 2) construct the DFA for L 1 Union L 2 • New: Readings section 2. 3 n n HW Hints and Induction example Review l Induction l DFA for Union, revisit Example 2. 4 n n n – 2– Pop Quiz Uses of Finite automata NFA Delta-hat, a string accepted by an NFA, the language accepted Subset construction converting NFA equivalent DFA CSCE 355 Fall 2008
Induction Revisited – 3– CSCE 355 Fall 2008
Induction HW – 4– CSCE 355 Fall 2008
Induction Pseudo Pop Quiz – 5– CSCE 355 Fall 2008
Dfa. rb implementation glitch def delta(state, input. Char) pacolet> ruby dfa 0. rb case Enter the input string: ababxgaaa when state == 0 line=ababxgaaa case when input. Char == 'a' then return 1; delta(=0, char=a) = 1 delta(=1, char=b) = 0 when input. Char == 'b' then return 3 delta(=0, char=a) = 1 end delta(=1, char=b) = 0 when state == 1 case when input. Char == 'a' then return 2 when input. Char == 'b' then return 0 end delta(=0, char=x) = delta(=, char=g) = 999 delta(=999, char=a) = 999 . Reject –. 6 – CSCE 355 Fall 2008
# foreach x in inp. each { |x| nextstate = delta(state, x) print "delta(=#{state}, char=#{x}) = #{nextstate}n" state = nextstate } if accepting. State[state] == 1 then puts "Accept" else puts "Reject" end – 7– CSCE 355 Fall 2008
Example 2. 4 revisited – 8– CSCE 355 Fall 2008
– 9– CSCE 355 Fall 2008
– 10 – CSCE 355 Fall 2008
Uses of Finite Automata Recognize strings: lexical anlayzers Text processing Unix tools: lex, flex, grep – 11 – CSCE 355 Fall 2008
Nondeterministic Finite Automata (NFAs) • Nondeterminism – n nextstate function not “determined” δ could map a state and an input into several states or none n These could be viewed as “choices” for the nextstate n Formally • N = (Q, Σ, δ, q 0, F) with everything defined as before except δ : Q x Σ 2 Q, – 12 – CSCE 355 Fall 2008
Example: Tenth symbol from the right is ‘ 1’ – 13 – CSCE 355 Fall 2008
Example from Author’s website Process input 211 – 14 – CSCE 355 Fall 2008
Delta hat for NFAs Recursive definition Basis δ(q, ε ) = { q } Recursive assume w = xa Assume δ(q, x ) = { p 1, p 2, p 3 … pk } Then δ(q, x ) = – 15 – CSCE 355 Fall 2008
String accepted by an NFA – 16 – CSCE 355 Fall 2008
Language accepted by an NFA – 17 – CSCE 355 Fall 2008
Mutual Induction proof L(N) = L L = { Third symbol from right is 1. } M Show L contains L(M) and show L(M) contains L Mutual Induction – 18 – CSCE 355 Fall 2008
Subset Construction • Constructing an equivalent DFA from and NFA • What does equivalent mean? • Why? – 19 – CSCE 355 Fall 2008
Subset example from Figure 2. 9 – 20 – CSCE 355 Fall 2008
Subset Example from Author’s website slides 2. pdf – 21 – CSCE 355 Fall 2008
- Nfas are ___ dfas.
- Csce 355
- Csce 355
- 01:640:244 lecture notes - lecture 15: plat, idah, farad
- Zoomology
- C-355 de 2006,
- Factors of 355
- Iat 355
- Iat 355
- Ie 355
- Kj355
- 4 8 13 19 26,… 3 suku berikut ? *
- Sentencia c-355 de 2006
- Sanglier attila 355 kg
- 645 rounded to the nearest ten
- Ece 355
- Sanglier turquie
- Ece 355 understanding behavior & family dynamics
- Iat 355
- Iat 355
- Cuts of a distributed computation
- Computation history