Download presentation
Presentation is loading. Please wait.
1
CSCE 355 Foundations of Computation
Lecture 4 DFAs II Topics: Induction review DFAs again Delta, delta hat Strings accepted, languages accepted NFAs June 4, 2015
2
Text site .
3
DFA Deterministic finite automata
Transition function δ(q, a) – really a function δ : States x ∑ States, henceforth Q= set of States and δ : Q x ∑ Q To be explicit in a DFA for each state there is one and only one transition for each input ∑* =
4
Set Formers – Defining languages
{w ἐ ∑* | some restriction on the string w} or just {w | some restriction on the string w} if ∑ is understood Examples . Variation with variables on the left {x01y | Examples that we will return to {0n1n | n >= 1} {0i1j | 0 <= i <= j}
5
Induction Pseudo Pop Quiz
6
Review DFA Delta hat Path determined by input DFA accepting a string
Language accepted by DFA
7
Pigeon Hole Principle application
8
DFA Simulation in Ruby # !/usr/bin/ruby #MMM 9/5/2008 # Simulation/Implementation of a DFA in Ruby # the DFA M=(Q, Sigma, delta, q0, F) numstates = 4 # Q = [0, 1, 2, 3] alphabet = ['a', 'b'] # Sigma = {a, b} # delta implemented as function q0 = 0 # Start state is state 0 acceptingState = Array.new(4, 0) acceptingState[1] = 1 # F = { 1 }
9
def delta(state, inputChar) case when state == 0 when inputChar == 'a' then return 1; when inputChar == 'b' then return 3 end when state == 1 when inputChar == 'a' then return 2 when inputChar == 'b' then return 0 . else return 999
10
# Start Simulation state = 0 print "alphabet = #{alphabet}\n" print "acceptingState = #{acceptingState}\n" # print "Enter the input string: " line = gets puts "line=#{line}" inp = line.chomp.split(//)
11
# foreach x in inp 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 acceptingState[state] == 1 then puts "Accept" else puts "Reject" end
12
DFA that accepts Union
13
Example 2.4 L = { w | w has both an even number of 0’s and an even number of 1’s}
14
DFA that accepts the Intersection
15
Exercise 2.2.4 A “*” on a exercise, what does this mean?
2.2.4 *a { w | w ends in 00} Homework 2.2.4 b,c 2.2.2
16
Nondeterministic Finite Automata
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.