00:01
We are asked to show that the grammar from example 7 generates the set of all strings, 0 to the 1, 1, 2 to the n, or n is a non -negative integer.
00:14
So recall from example 7, the grammar has the set of productions c from s, 0c, ab from c, lambda from s, ab from b, a, 0, 1 from 0 ,0 .1 from 0 .a.
01:24
1a produces 1 1 1, 1b produces 1 2, and 2b produces 22.
01:58
So first let's consider the different kinds of strings that we can just derive with these rules.
02:10
So we see that starting from s, we must derive either lambda or c.
02:24
So we can derive lambda, or from s we can derive c.
02:32
And then from c, we see that we must derive 0cab.
02:48
And so we see that if we use the rule of production, c produces 0cab, n times, then we add n zeros to the start of the string.
03:16
And once we've added these zeros, well, there has to be a way out of using the c.
03:25
I have left off a rule here.
04:15
It appears the book made a mistake.
04:17
It left off the rule of production.
04:20
Lambda can be produced from c.
04:24
And this makes sense.
04:28
So after applying 0cab can be applied so many times, we can add n zeros to the start.
04:38
And then we apply c produces lambda to get a string that starts with 0 to the n ab.
04:54
Now, looking at a, we see that a would be easier to do if we do it by induction.
05:23
So instead, let's do this by induction.
05:29
So starting at n equals 0, we want to show that this language generates in its first step, the string 0 to the 0, 1 to the 0, 2 to the 0, which is just lambda.
05:47
So all we have to do is simply apply s produces lambda, which is equal to 0, 02 ,000.
05:56
The end, 1 to the end, 2 to the n.
06:03
So we see that the statement is true at that point.
06:08
Now suppose the grammar generates 0 to the k, 1 to the k, 2 to the k, for some k greater than or equal to 0.
06:29
We want to show that it also produces the string 0 to k plus 1, 1 to the k plus 1, and 2 to the k plus 1.
06:41
So we'll break this into a couple different cases.
06:44
Suppose that the string starts with k plus 1 zeros.
07:06
Then we'll use the rule c to 0 c -a -b, k -plus -1 times to obtain this start, followed by c to lambda.
07:47
So we get the string 0 to the k -plus -1, and then on top of that we get ab, ab, ab, and so on...