-1
$\begingroup$
  1. The set of all words with the same number of 0’s and 1’s.
  2. The set of all words contained in {0,1}* that have an even number of 0’s and an odd number of 1’s.

I guess first one is NO. Second one seems no too as we get {0,1,00,11,000,111,...}. Not all of them contains even number of 0s and odd number of 1s.

Am I on the right track? If not, then give me a detailed explanation.

Thanks.

$\endgroup$
1

2 Answers 2

2
$\begingroup$

For question 1: try to come up with a proof that the language is not regular.

Hint: Let your language be $L$ and suppose towards a contradiction that it is regular. Use the closure properties of regular languages (in particular, regular languages are closed under intersection) to show that there is some regular language $L'$ such that $L \cap L'$ is a well-known non regular language.

Question 2 is not asking you whether all words in $\{0,1\}^*$ contain an even number of $0$s and an odd number of $1$s (that's clearly false). Rather, it wants you to consider the language defined as the set of all possible words (i.e., words from $\{0,1\}^*$) that also satisfy some additional property. This additional property is having both an even number of $0$s and an odd number of $1$s.

Hint: Try to design a DFA $D$ for this language. Suppose you are reading a word from left-to-right and you want to determine whether it satisfies the above property. What do you need to remember? Encode this information in the states of $D$.

$\endgroup$
0
$\begingroup$

The set of all words with the same number of 0’s and 1’s.

Isn't regular.

Proof (by contradiction):

Let $\ell=\{w\in\Sigma^*\mid \#w_a=\#w_b\}$, and suppose $\ell$ is regular, and let $M=\{a^nb^n\mid n\geq 0\}$ that $M\subseteq \ell$.

It's clear that $M$ isn't regular, on the other hand, we know that intersection of two regular languages are regular (by construction method on fsm), so $$\ell\cap a^*b^*=M$$ But $M$ isn't regular and it contradict with the fact that intersection of two regular languages are regular, hence, $\ell$ isn't regular.

The set of all words contained in {0,1}* that have an even number of 0’s and an odd number of 1’s.

Check this.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.