$L = \{y \in (a+b)^* \mid ||y|_a - |y|_b| \leq 10 \}$
Any idea? I have problem with this kind of task.
$L = \{y \in (a+b)^* \mid ||y|_a - |y|_b| \leq 10 \}$
Any idea? I have problem with this kind of task.
I am afraid that you cannot construct a DFA for $L$ since it is not regular.
Intuitively, a finite automaton cannot even make sure the number of $a$'s and the number of $b$'s are the same since its finite memory cannot keep track of the number of the $a$'s in the initial part of $a^nb^n$ when $n$ become sufficient large.
How to prove that language is not regular?
Exercise 1. Let $\lfloor x\rfloor_a$ be the minimum number of consecutive $a$'s in $x$ and $\lceil x\rceil_a$ be the maximum number of consecutive $a$'s in $x$, where $x\in\{a,b\}^*$ contains $a$. $\lfloor x\rfloor_a=\lceil x\rceil_a=0$ if $x$ does not contain $a$. Is the following language regular? $$L = \{x \in \{a, b\}^* \mid \lceil x\rceil_a - \lfloor x\rfloor_a \le 10 \}$$ Exercise 2. Is the following language regular? $$L = \{xy \mid x,y\in \{a,b\}^* \wedge ||x|_a - |y|_a| \leq 10 \}$$