29 29 votes Consider the following two statements: $S_1: \left\{ 0^{2n} \mid n \geq 1 \right\}$ is a regular language $S_2: \left\{0^m1^n0^{m+n} \mid m \geq 1 \text{ and } n \geq 1 \right\}$ is a regular language Which of the following statement is correct? Only $S_1$ is correct Only $S_2$ is correct Both $S_1$ and $S_2$ are correct None of $S_1$ and $S_2$ is correct Theory of Computation gatecse-2001 theory-of-computation easy regular-language + – Kathleen 19.6k views answer comment Share Follow Print See 1 comment 1 1 comment reply Aman Shukla commented Apr 14 reply Follow flag my logic is Statement 1: there is no need of counting so ii is counting statement 2 : is wrong because we need to count m+n in 0 0 0 replyShare Please log in or register to add a comment.
Best answer 34 34 votes Only $S_1$ is correct! A DFA with $3$ states will be needed, as the strings in the language $S_1$ are $00, 0000, 000000,$ and so on. which is the set of all strings with even number of $0's$ and with length greater than $0$. We would have needed only $2$ sates had empty string also been in the language but $n\geq 1$ prohibits it and so we need $3$ states in our DFA. This assumes that the language is over $\{0\}$ and not $\{0,1\}.$ $S_2$ is DCFL as we need to do infinite counting of $0's$ and $1's$ here. Bhagirathi answered Sep 21, 2014 • edited Jun 15, 2018 by Milicevic3306 Bhagirathi comment Share Follow See all 7 Comments 7 7 Comments reply Show 4 previous comments shefali1 commented Jul 17, 2017 reply Follow flag s1 is dfa with 4 states bcoz it is given in question that n>=1.so yes it will be regular. and s2 is context free language. option A) is correct. 0 0 replyShare joshi_nitish commented Jul 24, 2017 reply Follow flag S1 can't be accepted with 2 states dfa since min string is '00'..to accept it we require min 3 state dfa.. if it would be n>=0, then 2 state dfa needed.. 5 5 replyShare Golam Murtuza commented Aug 18, 2019 reply Follow flag If input Symbol consist of only {0} then only 3 states are enough for S1,if it contains {0,1} then we need 4 states bcz addtion of one dead state. 1 1 replyShare Please log in or register to add a comment.
17 17 votes DFA For S1 : S2 is PDA since stack is needed for comparision finite memory is not sufficient Till 1 push in stack after that pop from stack for every 0. Prashant. answered Apr 13, 2017 Prashant. comment Share Follow See all 6 Comments 6 6 Comments reply Show 3 previous comments Chhotu commented Nov 22, 2017 i edited by Chhotu Nov 22, 2017 reply Follow flag Hi @sourav ji, Thank You. I think this answer is corrected. If you assume you have only 0 then selected answer is correct. In that case also, I think we can not do in 2 states. Min 3 states are required because n>=1. 0 0 replyShare sourav. commented Nov 22, 2017 reply Follow flag $\text{And why do you think so ?}$Chhotu 1 1 replyShare sourav. commented Nov 22, 2017 reply Follow flag Chhotu $\text{both selected as well as non selected answer are correct}$ Actually the question itself is little bit unclear because set of possible input symbols are not given. If you assume you have only $0$ then selected answer is correct. If you assume you have $0,1$ then Prashant's answer is correct. 1 1 replyShare Please log in or register to add a comment.
0 0 votes Please see pdf explanation that answers S2 using pumping lemma. sadhak_25 answered Oct 28, 2024 sadhak_25 comment Share Follow 0 reply Please log in or register to add a comment.