0

I was trying to solve these two questions for a while, can I know how can I use pumping lemma to solve them?

a) $\{a^i b^j \mid i, j \geq 0 \text{ and }i + j = 5\}$.

b) $\{w = xy \mid x, y \in \{a, b\}^* \text{ and } |x| = |y| \text{ and } \#a(x) \geq \#a(y) \}$.

and thanks

1 Answers1

1

Language a) is regular.

To see this, observe that there are only finitely many strings in this language (all strings of length $5$ such that the string is composed of zero or more $a$s followed by zero or more $b$s). Thus, we can compose a DFA, which has a finite number of accepting states corresponding to these strings, and all other states are not accepting. In general, any finite language is regular.

Language b) is not regular.

To see this, we need to use the pumping lemma. Suppose language b) was regular, and was the language corresponding to some DFA $D$, which has $N$ states. The pumping length of this language must be $\leq N$.

Clearly, $w = b^{N+1}ab^{N+1}a$ is part of this language. Using the pumping lemma on $w$, we need to decompose $w=xyz$, where $|xy|\leq N$ and $|y|\geq 1$. The only way this can happen is if $y=b^i$ for some $i\geq 1$. Then, by pumping $w$, we see that $xy^2z=b^{N+1+i}ab^{N+1}a$ must be in this language, but it is not as the first half of the language contains only $b$s but the second half has at least one $a$.

This is a contradiction, and hence the assumption that language b) was regular is false.