I'm studying for a test on formal languages and automata.
I came upon the following question (translating, so i apologize for the non-formal english):
$L_1$ is the language composed of all words over $\{0,1\}^*$ in which every prefix $u$ satisfies $-10 \leqslant |u|_a - |u|_b \leqslant 10$.
$L_2$ has similar definition, with the same boundaries over $v$, only $v$ can be any substring in $L_2$.
what can we say about $L_1 \cap L_1^R$, and $L_2$? (if someone could refer me to MathJax guide..).
I thought that Since $L_1$ also include $|u|_a - |u|_b = 0$, it includes the string $a^n b^n$, thus making it context free (at the very least).
Answers declare that both are regular. Could someone help me understand why? I know that regular languages are closed under reverse and intersection, so the main question could refer to $L_1$, $L_2$ alone.
Many thanks, yoad.
$L_2^c$" />
Hint 1. Does any prefix of $a^nb^n$ satisfies your condition?
EDIT (in answer to your comment)
Hint 2. Consider words of the form $(ab)^n$. Do they belong to $L_1$? You should first try to solve your exercise with the bounds $1$ and $-1$ instead of $10$ and $-10$.