4

The exercise says

"Show that the grammar $G = \langle\{S\}, \{a, b\}, S, \{S \to \lambda, S \to aSb\}\rangle$ generates the language $L = \{a^i b^i \mid i = 0, 1, 2, \ldots\}$."

Now, I'm new to this subject although I'm familiar with the theory of Turing machines and automata. I'm teaching myself (not in a class, completely independently) from scratch. Please go easy on me.

Now, two questions:

(1) I suspect the way to do this proof is by induction on $i$, which is to say induction on the iterations of letters in the alphabet or the length of the word formed by iterations of $a, b$. Is this assumption correct?

(2) If the assumption in (1) is not correct, what is the correct strategy?

2 Answers2

4

Generally speaking, you need to do two things:

  1. Prove that every word generated by $G$ is in $L$.
  2. Prove that every word in $L$ can be generated by $G$.

Hints for (1): Prove by induction on the length of the derivation.

Hints for (2): Prove by induction on $i$.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
2

Ok, so here's my attempt at a solution, after not having looked at the problem since April. I think this is on the right track.

Given Yuval's helpful comment, we are to show (1) that every word $w$ generated by $G$ is in $L$ (2) every word $W$ in $L$ is in $G$

To show (1), we proceed by induction on the length $m$ of a derivation using the rules of $G$. There are two cases: either (i) $m$ = 1 (ii) $m$ $>$ 1.

Basis: $m$ = 1. Thus we have applied the first rule once, and must be $S$ $\rightarrow$ $\lambda$ and so we have $\lambda$ = $a$$^0$$b$$^0$, which is in $L$.

Induction step: $m$ $>$ 1. Suppose for inductive hypothesis the claim holds for all $n$ $<$ $m$ to show $m$, i.e. every stage $n$ $<$ $m$ in the derivation using rules of $G$ is in $L$ to show that the entire derivation of length $m$ is in $L$. Then the rule applied must be of the form $S$ $\rightarrow$ $a$$S$$b$, and we have a derivation of $a$$^m$$S$$b$$^m$. By inductive hypothesis, we can apply the rule $S$ $\rightarrow$ $\lambda$ once and have $a$$^m$$b$$^m$ which is in $L$.

To show (2): Induction on $i$, which is the number of repetitions symbols $a$, $b$ which is held constant.

Basis: $i$ = 0. Then $a$$^0$$b$$^0$ = $\lambda$, and clearly $\lambda$ $\in$ $G$ by the production rule $S$ $\rightarrow$ $\lambda$.

Induction step: $i$ $+$ 1 $>$ $i$. Suppose for induction hypothesis that the claim holds for all $i$ $<$ $i$ + 1 i.e. for all $i$ < $i$ + 1, words $w$ having $i$ $+$ 1-many repetitions $a$ and $i$ $+$-many repetitions of $b$ (consecutively) are in $G$. We wish to show that a word $w$ with $i$ $+$ 1-many consecutive repetitions of $a$, $b$ is in $G$. To this end, we simply apply the second rule $S$ $\rightarrow$ $a$$S$$b$ Until we get to the desired length.