DFA that accepts strings where there are odd number of 1's, and any number of 0's.
The alphabet $\Sigma=\{0,1\}$
Well since it's odd $1$'s, then there must be at least one 1.
So I think the regex is the following:
$$R=0^*10^*$$
This is correct because I can have any number of $0's$, but also incorrect because I do not offer a way to add more 1's. How do I modify this $R$ so that I can have $3,5,7,\dots$ ones?
Best Answer
I hope it can help you
DFA that accepts strings having an odd number of $1$'s: There are several methods for reading a regular expression from a DFA. If we use the state removal technique:
this DFA are in Final form , regular expression for DFA is : $0^*1(0+1{0}^*1)^*$
If we use the Brzozowski Algebraic Method: \begin{align} &q_0=q_00+q_11+\epsilon \\ &q_1=q_01+q_10 \end{align}
by Arden's theorem ($r=rp+q$ has only solution $r=qp^*$) for $q_1$ we have: \begin{align} &q_1=q_010^* \tag{1} \end{align}
\begin{align} &q_0=q_00+q_010^*1+\epsilon \\ &\,\,\,\,\,=q_0(0+10^*1)+\epsilon \end{align} by Arden's theorem for $q_0$ we have:
\begin{align} &q_0=(0+10^*1)^* \tag{2} \end{align}
final regular expression is: $$(0+1{0}^*1)^*10^* \tag{1,2}$$