Finite Automata
• Definition :• Finite Automata is a five Tuple (Q,∑,δ,q0,F)– Q is a finite set called states– ∑ is a finite set called alphabets– Q X ∑ -> Q is a transition function– Q0 is a start state– F is a set of accept states
Cont……..
• Formal Description of M1 :• ({ q1,q2},{0,1}, δ,q1,{q2}) The transition
function :•
• L(M1) = {ω | ω ends in a 1 }
0 1
q1 q1 q2
q2 q1 q2
Designing a Finite Automata
• Example 1 : Design a finite automata for the language that has strings with odd number of 1s.
• Step 1 : construct two states q-even(even so far) and q-odd (odd so far).
• Step2 : Make q-odd the accepting state because the language has odd number of ones.
• Example 2 : Language for all strings that contain substring 001.
• Step1 : Assign states q,q0,q00,q001.• Step2 : Start state q.• Step3 : Accept state q001.
Class of Regular Languages is Closed Under Union Operation
Let M1 recognize A1 where M1=(Q1,∑,δ1,q1,F1)
Let M2 recognize A2 where M2=(Q2,∑,δ2,q2,F2 )
Construct M to recognize A1 U A2 where M==(Q,∑,δ,q0,F)
Step 1: Q= {(r1,r2) | r1 Є Q1 and r2 Є Q2}
This is cartesian product of sets Q1 and Q2
Step2 : ∑ is the same for M1 and M2
Step3 : For each (r1,r2) Є Q and each a Є ∑ δ((r1,r2),a) = (δ(r1,a), δ(r2,a))Step 4: q0 is the pair (q1, q2)
Step5 : F= {(r1,r2) | r1 Є F1 and r2 Є F2}
Example Problem
• Each of the following languages is the intersection of two simpler language
• In each part construct DFA’s for the simpler language then combine them using the construction discussed in footnote 3 of pg46 in the book to give state diagram of a DFA for the language given.In all parts the alphabets are {a,b}
• .{ω | ω has atleast 3 a’s and atleast 2 b’s }
Solution
• M1 = ({q0,q1,q2,q3,},{a,b}, δ,q0,{q3})
• M2= ({q0,q1,q2,},{a,b}, δ,q0,{q2}) • Transition δ for M1 : Transition of M2:
a b
q0 q1 q0
q1 q2 q1
q2 q3 q2
q3 q3 q3
a b
q0 q0 q1
q1 q1 q2
q2 q2 q2
Step1 : Q= {(r1,r2) | r1 Є Q1 and r2 Є Q2}
Q = {(q0, q0),(q0, q1),(q0, q2), (q1, q0),(q1, q1),(q1, q2),(q2, q0),(q2, q1),(q2, q2),(q3, q0),(q3, q1), (q3, q2)}
Step2 : δ ((q0, q0),a) = (q1, q0 )
δ ((q0, q1),a) = (q1, q1 )
And so on…..
a b
q0, q0 q1, q0 q0, q1
q0, q1 q1, q1 q0, q2
q0, q2 q1, q2 q0, q2
q1, q0 q2, q0 q1, q1
q1, q1 q2, q1 q1, q2
q1, q2 q2, q2 q1, q2
q2, q0 q3, q0 q2, q1
q2, q1 q3, q1 q2, q2
q2, q2 q3, q2 q2, q2
Q3, q0 q3, q0 q3, q1
q3, q1 q3, q1 q3, q2
q3, q2 q3, q2 q3, q2
Construction
• N= (Q1,∑,δ1,q1,F1)
• Q1 = ({1},{2})
• DFA M = (Q2,∑,δ2,q2,F2)
• Q2 = P(Q1)
• Q2 = {{e},{1},{2},{1,2}}
Top Related