Is this intersection of DFAs correct?

Question Detail: 

I'm constructing a deterministic finite automata (DFA) for a language of all strings defined over $\{0,1\}$ whose length is even and number of $1$s is odd. I constructed each DFA separately and then combined:

dfas and their union

  • Is the given procedure for combining DFAs correct?
    EDIT: Originally wrote union; actually taking the intersection.
  • Would someone suggest material on constructing DFAs
    given restrictions on length and number of $0$s or $1$s?

According to link given by Merbs, I have developed this FA. enter image description here
This FA does not accept a language of even length.

Asked By : Rafay Zia Mir
Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/6893

Answered By : Merbs

Yes, this is called the Product Constuction - given DFAs $M_1$ and $M_2$, we can construct $M=M_1\times M_2$:

  • $M$ consists of pairs of states from its constituent DFAs, so if the original DFAs have states $A,B,C$ and $x,y,z$, the product would be $\{Ax,Ay,Az,Bx,By,Bz,Cx,Cy,Cz\}$.
  • The transition function is updated such that if on a particular step, a string would cause $M_1$ to transition from state $A$ to $B$ and $M_2$ to transition from $x$ to $y$, then the product would transition from $Ax$ to $By$
  • The initial state is the pair consisting of the initial states of the constituent DFAs (i.e. $Ax$).
  • If we are constructing the DFA that determines whether both of the two constituent DFAs would accept the string, then the accept states of $M$ is the intersection (those pairs made up of accept states from both).
    If we are constructing the DFA that determines whether either of the two constituent DFAs would accept the string, then the accept states of $M$ is the union (those pairs made up of accept states from either).
    In your example, $x_1$ and $y_0$ are the accept states of $M_1$ and $M_2$; the intersection would be $\{x_1y_0\}$ while the union would be $\{x_1y_0,x_1y_1,x_0y_0\}$.

I've included some other DFAs regarding restrictions on length for reference.

example dfas

No comments

Powered by Blogger.