World's most popular travel blog for travel bloggers.

Is this language regular or non-regular: {ww : w ∈ {a,b}* }

, , No Comments
Problem Detail: 

This is a question from a text book that's giving me some trouble. The question is:

Determine whether or not this language is regular. Justify your answer. $$L = \{ww : w \in \{a,b\}^* \}$$

I think this language is not regular because $w$ can be of arbitrary length and adheres to no pattern. So, therefore, it cannot be determined whether $ww$ is part of the language using a finite number of states. Am I correct in this assumption, and does my explanation make sense? Thanks for any help you can give me!

My answer, after reading the comments below:

Let $w = ww = (a^p)(b^p)(a^p)(b^p)$. Then consider the Pumping Lemma. Since $|xy| \leq p $ and $|y| \geq 1$, then the $y$ part of the string must be a's. But if we pump up, we'll have more a's in the first part than the second, and $w \neq w \in ww$. Hence, the language can't be regular.

Asked By : Victor Brunell

Answered By : jkff

Your explanation is correct. To make it more rigorous, assume that L can be recognized by a finite automaton $D$ with $N$ states.

Consider feeding a string $w$ longer than $N$ characters to $D$. Since $D$ has only $N$ states, that means it will go through some state twice. Suppose $w$ can be represented as $w = pqr$, where the state of the DFA is the same before and after $q$.

Then the strings $ww = pqrpqr$ and $pqqq...rpqr$ must be both accepted by $D$, but probably only the first one is in $L$ (some more rigor may be needed to prove that there exists such a string $w$ such that the second string really cannot be in $L$, for some number of repetitions of $q$).

P.S. looks like I unknowingly used the Pumping Lemma.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/38459

0 comments:

Post a Comment

Let us know your responses and feedback