Consider the following CFL.
$L = \{a^nb^n|n≥1\}$
Then which of the following string can be accepted by the kleene star of the language.
- $aaabbb$
- $aabbaaabbab$
- $abbaab$
- $λ$
My attempt:
The application of the Kleene star to a set $V$ is written as $V^*$. It is widely used for regular expressions, which is the context in which it was introduced by Stephen Kleene to characterise certain automata, where it means "zero or more".
- If $V$ is a set of strings then $V^*$ is defined as the smallest superset of $V$ that contains the empty string $ε$ and is closed under the string concatenation operation.
- If $V$ is a set of symbols or characters then $V^*$ is the set of all strings over symbols in $V$, including the empty string $ε$.
Therefore,
$L^*=\{\in, ab, aabb, aaabbb, \dots\}^*$.
So, statement $(1)\space aaabbb$ and $(4)\space λ$ are in $L^*$.
But, I'm stuck at point $(2)$ and $(3)$, are these also in $L^*$?
Can you explain, please?
A string us in $L^*$ if and only if it is the concatenation of zero or more strings that for some fixed $k$ consist of $k$ occurrences of $a$ followed by $k$ occurrences of $b$. Thus the string first of all must consist only of $a$'s and $b$'s, and must start with an $a$. We can use run length encoding to describe a string of this form, replacing the string by the sequence of integers describing the length of each string of $a$'s or $b$'s. Then the encoded sequence $r_1,r_2,\ldots,r_p$ must satisfy $$r_{2q-1}=r_{2q}$$ for all $q$, and $p$ must be even. This provides an algorithm for recognizing the strings.
For example, given $$aaabbbaabbabaaaabbbb$$ The sequence is $$3,3,2,2,1,1,4,4$$ which satisfies the condition. However the sequence for $$aabbbabaaaabab$$ is $$2,3,1,1,4,1,1,1$$ which violates the condition because the second element is not equal to the first.