I'm really new to this stuff so I apologize for the noobishness here.
construct a Deterministic Finite Automaton
DFA recognizing the following language:
L= { w : w has at least two a's and an odd number of b's}.
The automate for each part of this (at least 2 a's, odd # of b's)
are easy to make separately... Can anyone please explain a systematic way to combine them into one? Thanks.
You can use following simple steps to construct combined DFA.
Let Σ = {a1 , a2 , ...,ak }.
1st step: Design DFA for both languages and name their state Q0, Q1, ...
2nd step : Rename every state in both DFA uniquely i.e. rename all states in DFA as Q0, Q1, Q2, Q3 , ... assuming you have started with subscript 0; that means none of the state would have same name.
3rd Step: Construct transition table(δ) by using following steps
3a. Start state of the combined DFA:
Take start state of both DFAs(DFA1 and DFA2) and name them as Q[ i , j ] where i and j are the subscript of start state of DFA1 and DFA2 respectively; i.e. Qi is start state of 1st DFA and Qj is start state of 2nd DFA and mark Q[i , j] as start state of combined DFA.
3b. Map state of both DFAs as
if δ(Qi,ak) = Qp1 and δ(Qj,ak) = Qp2 , where Qp1 belongs to DFA1 and Qp2 belongs to DFA2 then δ(Q[ i , j ] , ak) = Q[p1,p2]
3c. fill entire table while there is any Q[i,j] remaining in transition table.
3d. Final state of the combined DFA:
For AND
case final state would be all Q[i , j] where Qi and Qj are final state of DFA1 and DFA2 respectively.
For OR
case final state would be all Q[i , j] where either Qi or Qj is the final state of DFA1 and DFA2.
4th step: Rename all Q[i, j] (uniquely) and draw DFA this will be your result.
Example:
L= {w: w has at least two a's and an odd number of b's}.
Step1:
DFA for odd number of b's .
DFA for at least 2 a's.
Step2:
Rename the stae of DFA1
Step3(a,b,c):
Constructed transition table will be as.
Step3d:
Since we have to take AND of both DFA so final state would be Q[2,4] , since it contains final state of both DFA .
If we have to take OR of both DFA the final state would be Q[0,4],Q[2,3],Q[1,4],Q[2,4] .
Transition table would like this after adding final state .
Step4:
Rename all states Q[i,j]
Q[0,3] to Q0
Q[1,3] to Q2
Q[0,4] to Q1
Q[2,3] to Q4
Q[1,4] to Q3
Q[2,4] to Q5
So final DFA would will look like as below .