if df has 2 states and one of the state is initial and final then it would accept empty string too which is not part of the language as n>=1 if incase n>=o then it would be regular

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

## 2 Answers

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.

### 7 Comments

if df has 2 states and one of the state is initial and final then it would accept empty string too which is not part of the language as n>=1 if incase n>=o then it would be regular

**DFA For S _{1 }:**

**S _{2} 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.

### 6 Comments

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.

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.