762 views

3 Answers

Best answer
2 votes
2 votes

let us consider the string abbabbabbabb
In this string, number of occurrences of abb are 4 but when we see here bba is also occurred and the number of occurrence of bba is 3.

Note that if i add a 'a' at the last of string we can have same number of occurrences of abb and bba so this string is accepted. We can say if the string is ending with abb so by appending a 'a' we can make bba also.

Now string2: bbabbabbabba in this number of occurrences of bba is 4 and abb is 3 which already satisfy the condition.

So we can observe here that whenever bba will be there string will be accepted

So with this idea we can build an automata for this.

Hence, it is regular.

selected by
1 votes
1 votes

Regular. The key observation here is that successive occurrences of $abb$ and of $bba$ in any string over $\left\{a, b\right\}$ must alternate along the string. To see this, one can show that in any string $w$, between any two occurrences of $abb$ there is an occurrence of $bba$ and vice versa. Consider an arbitrary substring of $w$ delimited by two occurrences of $abb$. This string has the form $abbuabb$, where u is a possibly empty string. If u contains no a symbols, then the string bbua ends in $bba$. Otherwise, suppose that the first $a$ in u occurs at position i; then the string $bbu_1 . . . u_i$ ends in $bba$. For the other direction, again consider an arbitrary substring of $w$ delimited by two occurrences of bba. Then the reversal $w^R$ of w has the form abbuabb for some string u. By the above argument, $w^R$ must contain bba as a substring, so $w$ itself contains an occurrence of abb. For a string $w$, let $D\left(w\right)$ denote the difference between the number of occurrences of $abb$ and of $bba$ in $w$. By the above argument, for any$ w, \mid D\left(w\right)\mid \leq 1$. At this point it is not difficult to see what a DFA for our language should look like. The states should keep track of the last two symbols seen, as well as the sign of the quantity D(w). (See diagram; the start state is qst, and the accept states are marked in thicker lines.)

Related questions

0 votes
0 votes
1 answer
1
admin asked Sep 23, 2015
1,310 views
Identify the class of the language $L = \Bigl \{a^n b^m \mid n \leq m \leq 2n\Bigr \}$.a) CFL but not DCFLb) DCFL but not regularc) not CFL