This problem has its own class. The problem says,
Let $\Sigma=\{0,1\}$ and let \[D=\{w|w \textrm{ contains an equal number of occurances of the substring }01 \textrm{ and }10\}\] Thus $101 \in D$ but $1010$ doesn't. Prove that $D$ is a regular language.
Refer to Sipser 1.48. Well, at a first glace, this language doesn't seem like regular at all, because it involves memory to an extent ("an equal occurance"). But I gave it a try, and tried to develop a DFA (well, an NFA, so to say). It gave me a hard time, so I tried to develop a regular grammar, which seemed even more difficult.
I came across this DFA somewhere in net, which looks flawless. It surfaces up some interesting properties indeed. Starting with $0$, no matter how many $10$ (and only $10$) you have in the string, you will have the same number of occurrences of $01$ and $10$ substrings. Symmetrically, starting with $1$, no matter how many $01$ (and only $01$) you have in the string, you will have the same number of occurrences of $01$ and $10$ substrings.
Another interesting problem which looks closely nonregular can be found in Sipser 1.44. The problem again deals with equal occurance, as follows:
Another interesting problem which looks closely nonregular can be found in Sipser 1.44. The problem again deals with equal occurance, as follows:
Let $B$ and $C$ be languages over $\Sigma=\{0,1\}$. Define \[B \sqsubset C=\{w\in B| \textrm{ for some }y \in C, \textrm{ strings }w\textrm{ and }y\textrm{ contains equal number of 1s}\}\] Show that the class of regular language is closed under $\sqsubset$ operation.The construction of $M$ from $M_B$ and $M_C$ can be done as follows.
- $Q=Q_B X Q_C$
- For $(q,r) \in Q$ and $a \in \Sigma$, we define
- $\delta((q,r),a)=\{(\delta_B(q,0),r)\}$ if $a=0$
- $\delta((q,r),a)=\{(\delta_B(q,1),\delta_C(r,1))\}$ if $a=1$
- $\delta((q,r),a)=\{(q,\delta_C(r,0))\}$ if $a=\epsilon$. This step nondeterministically selects the strings of $C$. (Power of nondeterminism at its best!)
- $q_0=(q_B,q_C)$
- $F=F_B X F_C$
No comments:
Post a Comment