 In the last lecture, I have started discussing what are the PDA that we have introduced that is equivalent to CFG in the sense that all the context free grammars for every context free grammar, you know you will have a PDA accepting that particular context free language and any language which is accepted by a PDA that is a context free language. So, this gives you you know a better tool to understand context free languages in the line up of automata this is this push down automata. So, in the last lecture itself I have started discussing PDA and CFGs are equivalent. In fact, we have done the construction one side that you give me a context free grammar how to construct a PDA. In fact, I have constructed a PDA with two states. So, as given here, you give you take a CFG and TPS you consider two states P and Q terminals whatever the set of terminals will be the input alphabet. And N union T the terminals and non terminals we are taking stack symbols and transitions we have defined the P is initial state and the second state will be the final states only two states. And then the rules we have declared the transitions we have declared like this without you know you start initially by putting in S into the stack change to the state Q that is of course, the final state for us. And then what are the string that you are generating by the grammar through certain rules corresponding to that you are actually giving transitions like this. So, we have done some sample this thing also that A power and B power and N is equal to 0 that we generate through these two rules S goes to A S B epsilon these two rules. Now, these are the transitions and I have shown a sample computation also in PDA and here you understand that we are first putting S into the stack and then we are generating what are the string that you generate through that and then match with the string given in the input that is what we are doing. But here we have a special feature that you know the derivation that you are applying if you are having some derivation in which say for example, you start like this and you have some derivation which is getting you know x 1 one non terminal sample say for example, A 1 some x 2 another non terminal A 2 and say for example, x 3 suppose after finally, many steps and then if you are applying in case if it is the situation like this in this say this say for example, another final. So, this A 2 if it is making some terminal string y 1 say x 3 now you are matching with this is the non terminal that you are getting in the stack on the top this is the A 1 and the rest of the strings, but you have generated some string y 1 in place of A 2 say if A 2 is there. So, but we are not accessing this unless you access this A 2 you cannot apply that rule and then generate the string respective string and then you match with the input suppose if this is the symbol that you know for which this is applied. So, what is the requirement you understand that if you have a derivation if you have a derivation and in the stack if you are generating the string which you want to match with that you have to first replace you know for a first non terminal symbol in the string. That means, such a derivation we have already talked about such a derivation is called left most derivation left most derivations. So, you know that for every derivation there is an equivalent left most derivation. So, if you have such a derivation in hand then what you can do you can generate the string in the stack and match with that because you are having you are applying left you have having left most derivation. So, then the what is the rule that you are applying on the left most non terminal symbol you apply and generate the terminal string and match with the input. So, this is the idea. So, what do we do first we recall this statement if you take a contested grammar g and t p s and correspond to every derivation say for example, s generates x infinitely many step for some x and t star. We know that there is an equivalent left most derivation I take this into count to you know prove that what are the construction we did in fact that works. So, for that purpose what I will do I will just let me state these things if s produces the string x alpha through left most derivation infinitely many steps for x and sigma star and alpha you know is a string for which the first symbol is a non terminal symbol n v star when I am writing union epsilon if alpha is there you know the first non terminal symbol. So, this is a left most derivation x is a terminal string. So, till this point suppose if you have generated then what I am saying say from this configuration on the top of the stack if you have s if in the not in the stack if you have s and you can consume this x in the input from the in the state q to reach to the configuration in which the stack content is alpha. So, corresponding to each such you know derivation you can have this kind of computation in the in the constructed push down automaton and conversely if you take any configuration of this sort q x s and infinitely many steps you can you know finish x and left if you are left with some stack alpha for some x in sigma star and alpha in v star then we can certainly have you know a derivation in the given c f g of the form s gives x alpha infinitely many steps as a left most derivation you can have. By observing these two claims you know we can quickly conclude from these two claims you can we can conclude that whatever the push down automaton that we have constructed indeed that works. Now, how to prove this claim one and claim two in claim one we are starting with a derivation and we wanted to observe this computation. Now, what is the idea proof idea here is we can apply induction on the number of steps in the derivation to get this computation you can see the basis and inductive hypothesis and you can action the induction. And similarly in the for conversely if you take the computation in this in the given in the constructed grammar which is of this form you can apply induction on the number of steps in the computation and you get and you can prove that this derivation in the grammar is possible. So, this as I mentioned we will apply induction and do that I will be working for other other other converse part of the construction when equivalence between p d a and c f g. So, these two I will leave it as exercise it is not a big deal because I will be doing this in this lecture itself for other part. So, you can imitate and this is a very simple thing that I hope you can you will be able to do and to conclude that the what are the push down automaton we have constructed indeed is equivalent to the given c f g. Now, I will look for the converse part that means you give me a push down automaton you can construct a corresponding contested grammar. So, I start this with the same concept called simple p d a because this is one correspond to every p d a an equivalent simple p d a we can have first let me tell you what is let me introduce what is p d a. A p d a q sigma gamma delta q naught a f is said to be simple if you take any transition p x alpha q beta here you will have you know the stack string the stack string that you are popping of length should be less than equal to 1 that means either empty string or a single symbol that you will pop at one time and the second condition is if you have epsilon here you know then for all a in gamma for all stack symbols I should have this kind of transition also. Now, I give this remark for every p d a there exist an equivalent simple p d a now the question is how do you get it what are the two conditions the transitions they have to satisfy any time if you want to pop any symbol from the stack either it should be epsilon or you know it should be of length 1 or if you are having a transition with epsilon here then there should there should there should be a transition for each symbol a in gamma with this kind of thing. Now, the second one can be achieved very easily whenever you have such a transition you take each symbol a from gamma and then write a production rule of this sort corresponding to each element of gamma through which you know you will achieve this and we are not going to lose anything we are not going to you know change the language the reason is because this transition whatever that is changing when I introduce this is such a transition what it says whenever you are accessing a on the top of the stack you are temporarily removing and immediately you are putting a in the stack and what are the beta. So, this particular by introducing this kind of transitions the number of transitions with respect to the size of the stack we are not going to gain or lose anything with on the language. So, language remains same from the given p d a to this now corresponding to this I will just give me a simple technique that say for example, if you have something of this sort say p x a 1 a 2 a 3 say for example, you have 3 symbols and the transition say for example, of this form say q beta suppose this is your transition then what I would suggest you you just simply remove this transition and place this transitions of this form with some new states you choose some new states which you have not used which you do not have earlier say for example, p 1 and then epsilon. So, this is one transition I put what I am trying to do here is instead of removing 3 symbols at once I will remove one after another that is what I do. So, now I am in p 1 in p 1 without taking the input I simply remove now the second symbol a 2 and change to another state p 2 and then since I am in p 2 now what I will do this x need to be consumed in the input. So, now I just consume the at the end so a 3 I will pop and then connect to this state whatever you require that is q here. So, you change to the state q. So, what I will do corresponding to this particular transition I remove this transition from the set and I introduce these 3 transitions in low of this. That means, what are the purpose of this particular transition it is exactly doing this because this p 1 p 2 what I have chosen they are new states here. Say for example, if you have n number of symbols here choose n minus 1 states you remove one after the symbols and the new states corresponding to each transition you know you choose and remove one symbol after another from the stack and by the time you know remove the last symbol you consume what are the input that you have to consume through in this particular transition given and then change to the required state here for example, q here. So, change to the required state and put whatever that you have to put it in the stack. So, through this you can understand that these 2 rules you know these 2 conditions can be you know you know achieved we can achieve these 2 conditions and to make the given p d a to a simple p d a. So, thus every p d a can be converted to an equivalent simple p d a. So, this concept I will use this particular concept I will use simple p d a and given a p d a a simple p d a because now you give me a p d a first I will construct I will construct an equivalent simple p d a from the simple p d a I will construct a given construct a grammar c f g contested grammar. So, now this side I will consider for every p d a there exist an equivalent c f g well let me start formally the construction part let me first tell you without loss of generality let a q sigma gamma delta q naught f v a simple p d a you start with a simple p d a. Now, I construct a c f g n t here t the input alphabet sigma p s as described below now I consider non terminals of this form 1 non terminal s for the start symbol I consider here and then the non terminals I will consider of this form for that let me first tell you some philosophy about this non terminal symbols in a p d a what we are doing we are having this kind of situation. So, you are consulting the stack whatever and you are reading the input in the given state now what do what is the construction non terminal symbol construction we consider things of this form p a q this kind of non terminals we have consider for a it is a stack symbol or it may be epsilon what is the philosophy with the non terminal symbol that we consider here is when you are in the state p when the top of the stack is a say for example, when you have a here now your for example, reading and writing it is this here for example, at the particular position. So, here after you will be reading some input here in the tape say some x you are reading. So, when you are reading this input the possibility in this push down automaton is when a is on the top of the stack you may have you may add some more symbols on the stack certain symbols and you will remove because you know accepting a string input string what you have to do you have to ultimately make the stack empty we know that. So, between you know the situation say your current state is p when you have a on the top of the stack from here you might be adding some more symbols on the stack here and then finally, anyway you have to remove a to make the stack empty. So, by that before by the time you a remove a from the stack that means, we are not we are not touching in between because what you may have some additions on the top on the top of this and by the time you remove a from the stack if you reach to the state q from here to here. So, it is not two things. So, this you may come to for example, state q whatever the portion of the input that you may be able to read that set will be denoted by this non-terminal symbol. So, this non-terminal symbol denotes set of all those strings in the input such that the current state is p the current state is p what I am explaining is this the current state is p and when you have a on the a is on the top of the stack by the time you remove a if you reach to the state q whatever the amount of input that you read whatever the input that you read at a given instance. So, all those strings will be represented or assumed to be derived through this kind of non-terminal symbol that is the philosophy we use and for example, if a is epsilon that means, say I do not have you may have something in the stack let me a is epsilon that means, whatever that you have say for example, this portion say alpha on the top of this you might be adding some more things in the stack. That means, without consulting the stack whatever the amount of input that you read between the states p and q without consulting this stack that means, the stack information whatever is lying that will be there I am not saying here stack is empty if you have a is equal to epsilon here stack you may have something, but without consulting the stack I mean without touching whatever the stack information already existing you may add some more things in this between states p and q and you may remove them and you come to this same point that means, whatever is existing that I am not going to change. So, within this between these two times whatever the input that you read that is represented here through this non-terminal symbol I hope you understand this philosophy. Now, this philosophy is taken to consider this non-terminal symbols. So, S start symbol for start symbol for the contrast to grammar and then between given any two states p and q I consider non-terminal symbols of this form p a q where a is a stack symbol or epsilon and then we include the following types of rules. First rule you can quickly understand because from the start symbol I if I connect to this what is the idea from the initial state because what are the strings you have to generate in this grammar from the initial state to some final state. You know the stack to start with it will be epsilon you do not have anything now from there you come back to the same status. So, that means here you require epsilon. So, explaining this rule is much easier that is not a big deal I hope you understand. So, S should be connected to this kind of non-terminal symbols for each you know this kind of non-terminal symbols you will get one rule one for each final state of the given p d a and then I have you know type b rule I will explain you this and then type c rule and then the type d rule again will be easy to explain. For each state if I have this p epsilon sorry say q epsilon q type of non-terminal symbol you know I can nullify that because from the state to the state q you know without changing the stack what kind of symbols whatever that you are reading that is represented by this you know anyway and in addition to that you know I can say that epsilon can be derived through that. So, this rule is easy to understand now let me come to the type b and type c rules in general you know if I explain type b with n is equal to 0 you are essentially having type c rule. If you take a transition of this form p x a which is in the state p by consuming the input a and as a stack symbol a. So, a can be a stack symbol or epsilon right so because it is simple p d a now if you have done this that means you are changing to the state q and you are putting x 1 x 2 x n inside the stack. Then what we are suggesting here is from p you are changing to the state q that means eventually I will leave you in the state q. So, the corresponding non-terminal may be you know the production rule may be this p a r that means you are consulting the stack with a and now a is removed x 1 x 2 x n is inserted. So, that means corresponding to x 1 x 2 x n this non-terminal symbols this stack symbols you know are representing some information of the input right when we are putting x 1 x 2 x n these are representing some information of the input when you are removing them systematically what are the string that you wanted to accept that needs to be generated in the grammar that we are going to construct. So, that means whatever the input that you have consumed that is generated here that is clearly mentioned whatever the input that you have consumed in p d a that need to be generated. So, that is what is this and then corresponding to this x 1 x 2 x n now for all the possible states q 1 q 2 and so on r q n minus 1 and r all possible states because I am choosing this all possible states I give such a rule this q x 1 q 1 q 1 x 2 q 2 and so on q n minus 1 x n r and this r q i's are arbitrary. So, now the connection between this from the state p to q now I will give you a sample construction then you will understand this better you know this p d a. So, for 0 power n 1 power n greater than equal to 0 you can consider the p d a as follows you take the state p read 0 you know and insert 0 in the stack and non deterministically I am changing after some point of time I will change to q and then when I have a match I will remove you know when the input is 0 power n 1 power n whenever there is a match you will be in final state by consuming all the entire input and making the stack empty through this rules that you can quickly understand and see that this particular p d a accept 0 power n 1 power n. Now, here notice that I have considered two states and sigma 0 1 of course in gamma I am using only 0 I am putting only 0 in the stack. However, I have considered 1 also just for the sake of you know showing this particular construction anyway final state is 1 is like this. Now, corresponding to this p d a I will just give a sample construction of contrast with grammar. So, first converting simple p d a you know that what are the things that I have to introduce because here is epsilon in the first rule. Now, for all the possible non terminal stack symbols I have to have this thing and here type 1 sort of that first condition of p simple p d a because it is anyway satisfied because in this third position all are the lengths are less than equal to 1. So, condition 1 is of simple p d a is anyway satisfied condition 2 that I have to consider. So, then what do I do I have to introduce the rules like this because the example considered here is p 0 epsilon here is 1 and p epsilon goes to q epsilon these two rules that I have. So, p 0 epsilon now p 0 0 that is p 0 0 that is what because now by taking the possibility of 0 of the stack symbol and now similarly here by taking the possibility of 1 as a stack symbol. I hope you understand here although this is not very much used in the stack since I have considered stack symbol 0 1 I am putting this. So, that you see that when I am constructing all and since in the p d a this has no role this has no role in the you know the constructed c f g also, but just for the sake of example I have considered that and I am showing this rule also. Now, corresponding to p epsilon epsilon where we are changing it to q epsilon we are changing the state changing to final state. Now, by choosing 0 non terminal stack symbol and similarly the possibility of choosing 1 as a stack symbol. So, this productions that I have to add in addition to the given 3 there are 4 rules. Now, you can quickly see that this is a simple p d a because now the conditions both the conditions of simple p d a satisfied. Now, using the simple p d a we construct c f g from a. So, how do I construct the first rule is saying that I have to give a production rule of this form s goes to p epsilon q this I have to give such a rule for 1 for each final state here of course, only one final states therefore, we have only one rule here. And type b remember corresponding to each transition of this form I have to give 1 because here the transition means for n greater than equal to for n greater than 0 I am giving whatever that you are putting inside x 1 x 2 x n. If something non non empty that we are putting I am using this if you are putting empty then these things are not there simply x is produced q epsilon r. So, this is the distinction as that it is type b rule or type c types of rule fine. Now, let us look at that. So, in type b type of rule by taking first rule and this kind of transitions we need to introduce r equal to p when you choose the possibility p here because you look at in the rules I have mentioned for all the possibilities of the states I have to write this kind of rule. Now, by taking the possibility p I write this rule and then by taking the possibility q for r I take the I write this rule. Now, then you know by taking r is equal to p and the possibility is 0 p 0 by considering this because this is for rule 4 you look at rule 4 how it is because there are 2 0s. So, in between I consider p that means in between this I mean because I have mentioned it like this for the possibility of rule 4 you have 0 0 there. So, what I am doing by considering p here that is one possibility r is p and then again for 4 you have in between you can consider q this is one possibility and r is p. Now, you can consider r may be q and in between 0 0 you can you can consider p I mean this the possibility of the state and then r can be q in between you can consider q. So, this is for rule 4 the corresponding and for rule 5 similarly this and for rule 5 by considering q in between we look at in general for r you have the possibility of p for r you have the possibility of q there are the 2 possessor 2 states possibility. When I have considering a string whose length is greater than greater than 1 I can actually here there are actually 2 symbols sort of. So, in between what do you want to consider because this we will introduce for every state for every possibility of the state. So, for rule 5 like this and one more you get now for rule 6 this rule they are all coming under type b. This rule by choosing r the possibility p and q for rule 7 again by choosing the possibility of p and q these 2 rules 22 rules. And then type c you see now by choosing r to be p you have got this and by choosing r to be q corresponding to rule 2 we have this 23 and 24 rules. And then for rule 3 corresponding to 3 that is of type c that is coming under type c you know type c means this because when you are inserting epsilon in the you know you are just popping something and that is just a pop rule if it is of this form. So, essentially rule 2 and rule 3 the transitions 2 and 3 are of this form. So, we are introducing these 2 production rules these 4 production rules now type c and in type d you see there are 2 states. So, how to nullify this particular non-terminal symbol that p epsilon p goes to epsilon q epsilon q goes to epsilon. So, these are the 2 rules type d that we introduce I hope you understand this construction. So, what did we do we have considered a p d a for 0 power and 1 power and there are only 3 rules, but first by introducing another 4 there are only 4 3 transitions by introducing another 4 transitions we made that simple. And using the simple p d a what are the 4 types of rules that we have mentioned we have constructed you know a context with grammar now let me just give you a small derivation in this context in this context with grammar corresponding to a computation for 0 0 1 1 in the given p d a. You can see that this is how we are actually accepting 0 0 1 1 in the given p d a you start from the initial state 0 0 1 1 with the stack empty you know you are reading those 2 0s in the state p. And then non-termistically you are changing to the state q then when you have 1 and you have 0 on the top of the stack you just match them like that this we know and you are in the final state. So, this is how the computation is considered now corresponding to this let us observe the derivation in the g I am just marking this rules in the production rules in the constructed c f g. So, from as we will consider this you know because this is the only possibility that we have and then you see I am reading 0 in the input and we I am putting 0 in the stack that is what we did in the first step of the computation the same thing here is shown. So, the targeted stage the final state is q that is anyway there, but what is the current state now I am continuing the state p. So, that is the state p here it is shown that 0 is in the stack and I have consumed 0 in the input that means I have derived now in this derivation 0 that is what is this marked. Now, when I have consumed 2 0s in the input here I derive 2 0s and then in the stack you have 2 0s those 2 0s are shown up. So, the respective production rules that I am marking here rule production 10 here production 14 as I have constructed and now I can use 20 to make this as p 0 q I can make it as q 0 q and now I can rule 26 use you produce 1 then q epsilon q then q epsilon q can be nullified and then this 0 0 1. So, the left over thing is q 0 q and then 0 0 1 1 q epsilon q rule 26 I use and then finally, you know this q epsilon q again I use 28 rule production rule 28 to show that 0 0 1 1 is generated in this now. So, this is just a sample construction and this philosophy I hope you know through this particular example what are the corresponding to the computation what are the derivation I have shown I hope you understand what is the philosophy behind in you know introducing such a non terminal symbol and then once you understand that then the proof part of proof part will be easy. So, just I display this derivation because the non terminals the importance of the non to the way that it is you know introduced you understand. Now, what I prove the construction is valid to show the construction is valid that means the what are the grammar constructed indeed generates the language actually the given p d a what I do I prove this statement you take any 2 states p q and a symbol or epsilon and any string terminal string that means input string I can call here sigma star we claim that this non terminal symbol p a q in finitely many steps if it can derive x this non terminal x of course, the grammar then this kind of configuration that means this is a stack information of course, there is nothing else right this is a configuration p x a from this configuration I will be able to get the configuration q epsilon epsilon and conversely this is what I am going to prove by proving this you know that the constructed grammar indeed generates the language actually given p d a how if you know the first one you will connect to this the first one you will connect to the first one you will connect to this because in the one rule that you produce p epsilon q to this you will connect and thereafter in finitely many steps suppose if you have produced x you see in this then the corresponding to the computation you know you have this computation and conversely. So, what what happens here so this production you have considered now in the computation suppose if you have the computation which produce which says that I will reach to this final state q. So, from the configuration x epsilon if I can get in finitely many steps q epsilon epsilon then what is the meaning of that through this you know we are getting this x as this and conversely because this if and only if what I am going to prove if p a q derives x in finitely many steps if and only if p x a in finitely many steps you are getting this kind of configuration. So, by getting this kind of configuration so correspond to this computation this you have p epsilon q produces x in finitely many steps. So, if I have corresponding 1 to 1 correspondence between these two type of things correspond to this derivation if I have this computation and vice versa you understand this x can be generated in the grammar and whenever you generate from here x some terminal string you know there is a computation in this. So, that you can understand that the language generated by the constructed grammar is same as language actually the given p d a. So, we get this how do we do this this I will. So, let me just say that x belongs to L of g if and only if x is in L of a which is equivalent to this statement. Now, the only if part that means p a q produces x in finitely many steps then we have to prove this thing we prove this this computation by induction on the length of the derivation. If the derivation p a q has only 1 step because see here I can start with because this is a reflexive transitive closure one can ask that what about you know for the basis considering 0 steps you know this is a non terminal symbol this is a terminal string you know here non terminal symbol cannot be you know a terminal symbol here this type of a special type of symbols that we have constructed and therefore here I cannot assume 0 number of steps. So, let me assume you are getting this in one step that is how the basis I have started with then automatically you understand this arrow x this non terminal symbol arrow x has to be a production rule if it is in one step. So, then it is a production rule of type d if it is a production rule of type d you can understand a equal to x equal to epsilon and p equal to q. So, that you have p x a is equal to q epsilon epsilon. So, this configuration and this configuration they are equal and hence you are producing this configuration in 0 number of steps and finitely many steps and if you this is the basis. So, basis is very clear from this now inductive hypothesis if you take a derivation of this form p a q produces x in you know if you are getting that in k or fewer steps then this configuration gives this configuration in finitely many steps. So, if the derivation is of length k or less than that then you are getting this in some finitely many steps that is what is inductive hypothesis. Now, you take a derivation of k plus 1 steps p a q gives x in k plus 1 steps then let me rewrite this derivation of this form p a q produces alpha in the first step and after that this alpha produces x in finitely many steps let me assume like that. Now, what is the possibility for this alpha now then the rule p a q alpha is either of type b or type c you know it cannot be type a type a is of the form s goes to something of this kind of non-terminal symbol. So, it is not of type a or it is not of type it is not of type you know d because we have here k plus 1 steps. So, it is not of that we have considered. So, this is either type b or type c form now if it is of type b let me consider this case then alpha then for n greater than equal to 1 we write alpha is equal to y p naught x 1 p 1 and so on something of this form. So, that you know you have this transition rule in the given p d a I have this kind of production rule means there should be corresponding to this transition. Now, what I will do I will write x 2 b you know of this form y y 1 and so on y n because this is a terminal string. Now, I will break them into this y 1 y 2 y n of course, y is already shown corresponding to each non-terminal symbol that it is deriving in the given derivation such that this particular non-terminal symbol here is producing y i the component y i in the terminal string that y i can be epsilon also that is a different I mean that can be the situation. So, thus for each i this derivations because the total derivation is of k r fewer steps whatever we have considered here and thus whatever that we are producing this string since it has k r fewer step I mean it is in k steps. So, this each such derivation is of k r fewer steps very clearly and therefore, by inductive hypothesis you know you get from this configuration to this configuration in the p d a this is the inductive hypothesis. Now, you see now combining this computations I can observe that p x a that is p y 1 y 1 and so on y n a can give that p naught. So, that y you have consumed that means you have right and you have x 1 x 2 x n in the stack and then when x 1 is removed you have consumed y 1 in the input and so on when p n you have this. So, if it is so what do you what did I get then p x a infinitely many steps I have q epsilon epsilon if this is rule of type c then it is very quick then it is of the form y r epsilon q and this can be the transition corresponding to that and where now x can be written as this y z for some that in sigma star. So, that you have this computation you will get this computation in the p d a. So, if you have the derivation what did I get. So, by assuming what is called by inductive band active hypothesis on the length of the derivation we have observed that you get that particular computation in the p d a. Now, conversely that if part if I assume this computation I have to show the derivation. So, we prove this derivation by induction on the length of the computation. So, what are the computation under consideration if this computation has 0 number of steps here I am saying say for the basis I am saying 0 number of steps because the possibility is there then why it is 0 number of steps means these two configurations are same that means p equal to q x equal to epsilon a equal to x a is also epsilon. So, in which case you see this derivation holds trivially as p epsilon p goes to epsilon this is a type p type d production rule you see the production rule we have this kind of rule. And therefore, it is possible in the constructed grammar and hence we have the basis. Now, for inductive hypothesis if a computation is having k r fewer steps then assume this derivation is possible that means this p a q produces x in finitely many steps. So, for inductive step you know use just assume k plus 1 steps computation p d a and now for n greater than or equal to 0 I can write like this because this say for example, in the first step of the computation you are having this kind of thing that means from the stack a you have removed a and x 1 x 2 x n you would have introduced or the possibility is this x n can be a and you have consumed some input and you have z left over in the input. And after k number of steps you have the final configuration sort of this q epsilon epsilon. So, this is a possibility. So, then there is y in sigma such that x is equal to y z that means that y. So, p y a is a transition you know r epsilon x 1 x 2 x n is the thing this implies that you have either this kind of transition or you know for n greater than or equal to 1 this a is equal to x n p y epsilon is r x 1 x 2 x n minus 1 this kind of transition because this a may be there you are not removing that, but you would have added x 1 x 2 x n minus 1, but since what are the p d a that we have considered it is simple you know it is sufficient like the latter case implies the former one and in any case we have this kind of production rule. Now, you see the situation is correspond to this computation. So, p x a that is p y z a that is how we are writing now y is consumed that what I have this r z x 1 x 2 x n this is what is there in k number of steps you are getting this q epsilon epsilon, but in between you have to remove x 1 x 2 and so on x n this stack symbols need to be removed. So, whenever you are remove x 1 whatever this whatever the string that you are consuming from the input I call it as you know z 1 and similarly for x 2 z 2 and so on by the time you remove x x n I assume that z n is consumed in the input. So, I appropriately mention that under respective states intermediate states p 1 p 2 and so on. So, the computation is presented like this. So, r z x 1 x 2 x n by the time I finish remove x 1 from the stack then I have consumed z 1 the remaining is z 2 and so on z n. So, similarly all this and so on by the time you finish x n you have that q epsilon epsilon is a configuration this is the computation that we have considered. Now, you see this total computation here we shown up is care fewer steps and therefore, by inductive hypothesis notice that each computation has care fewer steps. Now, by inductive hypothesis you have this p i x i plus 1 p i plus 1 gives z i plus 1 you know in finitely many steps that is inductive hypothesis and then since p y a is you know this is the transition you have to combine all this corresponding to that then you have this kind of production rule this is a type b. Now, combining this you get you start from p a q and then you apply that production rule type b production rule then there after you know corresponding to each of this symbols first you produce z 1 that from the inductive hypothesis I have got this then z 1 then this is non terminal symbol is lying and so on you will be producing y z 1 z 2 and so on z n that is how you will be producing because this z 1 you have produced and then you have a symbol which can be nullified. So, then this p 1 x 2 p 2 from which you can produce z 2 and so on this p n minus 1 x and p n you can produce z n. So, you have produced x. So, thus you have a derivation for x. So, this is one case and if n is 0 because you look at here if for under the equal to 1 then I have shown this. So, corresponding to this I have this particular type b type b production rule and then I have this derivation in the grammar. If n is 0 then simply you have the situation k steps you are getting this. Now, by inductive hypothesis this r epsilon q produces z in finitely many steps and since this p a q produces y r epsilon q is a rule this is of type c then you have this kind of derivation and thus you know we have the proof. So, now you understand like you know whatever the contested grammar I have constructed I have shown this particular statement that whenever I have some computation there corresponding to I have a derivation. So, for which what I did I have applied induction on the number of steps in the computation and derived it and conversely if you consider a derivation in the grammar we have shown that the computation the corresponding to the derivation there is a computation also in this. So, that you know we have observed that the language generated by the grammar constructed is essentially same as the language accepted by the given p d a. So, we have shown the equivalence like this. So, this I hope you know gives an idea how to prove based on the number of steps by induction on the number of steps of the derivation or the computation for the previous one also whatever I left is an exercise. I hope you can complete that exercise. So, that you observe that p d a that push down automata and contested grammars they are equivalent. So, with this I conclude this lecture.