CSCE 355 Foundations of Computation Lecture 4 NFAs
- Slides: 28
CSCE 355 Foundations of Computation Lecture 4 NFAs Topics: n Induction review n DFAs again NFAs Delta, delta hat Strings accepted, languages accepted n n n Sept 8, 2008
Induction Revisited – 2– CSCE 355 Fall 2008
Induction HW – 3– CSCE 355 Fall 2008
Common Mistakes in HW – 4– CSCE 355 Fall 2008
Induction Pseudo Pop Quiz – 5– CSCE 355 Fall 2008
– 6– CSCE 355 Fall 2008
– 7– CSCE 355 Fall 2008
Review DFA • Delta hat • Path determined by input • DFA accepting a string • Language accepted by DFA – 8– CSCE 355 Fall 2008
Pigeon Hole Principle application – 9– CSCE 355 Fall 2008
Homework from Email – 10 – CSCE 355 Fall 2008
DFA Simulation in Ruby • # !/usr/bin/ruby • #MMM 9/5/2008 • # Simulation/Implementation of a DFA in Ruby • # the DFA M=(Q, Sigma, delta, q 0, F) • numstates = 4 # Q = [0, 1, 2, 3] • alphabet = ['a', 'b'] # Sigma = {a, b} • # delta implemented as function • q 0 = 0 # Start state is state 0 • accepting. State = Array. new(4, 0) • accepting. State[1] = 1 – 11 – #F={1} CSCE 355 Fall 2008
def delta(state, input. Char) case when state == 0 case when input. Char == 'a' then return 1; when input. Char == 'b' then return 3 end when state == 1 case when input. Char == 'a' then return 2 when input. Char == 'b' then return 0 end. . . else return 999 end – 12 – CSCE 355 Fall 2008
# Start Simulation state = 0 print "alphabet = #{alphabet}n" print "accepting. State = #{accepting. State}n" # print "Enter the input string: " line = gets puts "line=#{line}" inp = line. chomp. split(//) – 13 – CSCE 355 Fall 2008
# foreach x in inp. each { |x| break x if x =="n" ###break x if x =='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 – 14 – CSCE 355 Fall 2008
Example 2. 4 – 15 – CSCE 355 Fall 2008
Exercise 2. 2. 4 – 16 – CSCE 355 Fall 2008
DFA that accepts Union – 17 – CSCE 355 Fall 2008
Nondeterministic Finite Automata – 18 – CSCE 355 Fall 2008
– 19 – CSCE 355 Fall 2008
– 20 – CSCE 355 Fall 2008
– 21 – CSCE 355 Fall 2008
– 22 – CSCE 355 Fall 2008
– 23 – CSCE 355 Fall 2008
– 24 – CSCE 355 Fall 2008
– 25 – CSCE 355 Fall 2008
– 26 – CSCE 355 Fall 2008
– 27 – CSCE 355 Fall 2008
– 28 – CSCE 355 Fall 2008
- Nfas are ___ dfas.
- Csce 355
- Csce 355
- 01:640:244 lecture notes - lecture 15: plat, idah, farad
- Zoomology
- Vertical
- Factors of 355
- Iat 355
- Iat
- Ie 355
- Kj no 355
- Jumlah deret 5+12+19+26+...+355 adalah
- Sentencia c-355 de 2006
- Sanglier attila 355 kg
- 355 rounded to the nearest hundred
- Ece 355
- Sanglier turquie record
- Ece 355 understanding behavior & family dynamics
- Iat 355
- Iat 355
- Computation history
- Cuts of a distributed computation
- Computation history
- Union set operation
- Theory of computation quiz
- Privacy-enhancing computation
- Dqage
- Uva lookup computing id
- Computation