 Hello, welcome to the session on Convergence of Contacts Pregrammer to Chomsky Normal Form. At the end of this session, the student will be able to convert a Contacts Pregrammer to Chomsky Normal Form. Let's define Chomsky Normal Form. A CFG is in Chomsky Normal Form if all productions are in the form A producing AX. Here capital A is non-terminal, small A is terminal, capital X is again non-terminal. This means all productions are of the type non-terminal producing non-terminals preceding by terminals. Every CFG with its associated language has an equivalent grammar in CNF. Chomsky Normal Form is a straightforward ways of improving a grammar without changing its resultant language. Now, when we are converting grammar from CFG to CNF, first we need to follow some steps. In this first start with a grammar G which is in the form of V, T, P, S that is non-terminal terminal production and start symbol. Then eliminate useless variable that cannot become terminal. Then eliminate useless variable that cannot be reached. Eliminate null productions, eliminate unit productions. After this, we can convert grammar into the Chomsky Normal Form. We will see elimination of useless variables that cannot become terminals. Consider a grammar where a non-terminal A produced by S is producing a terminal but non-terminal B is not producing any terminal. So, see in this grammar, S is producing A and B that are both are non-terminal. A is producing this is a terminal symbol but B is not producing any single symbol. So, in this grammar, whatever the S is defining or S is producing B and that is not going to the terminals. So, B from the production S producing B is useless and it can be eliminated. Now, next step is we need to check whether a grammar production contains non-terminals which cannot be read or which cannot be reached while deriving the language. Now, consider the following grammar. Here S is producing A, A or B, B, A is producing A, A, A, B is producing B, B, D is producing A, B or E, A and E is producing A, C, D. Now in this grammar, A and B they are used in the starting symbol. But we don't find any path to reach D and E. So, these are the symbols, these are variables are nowhere used since they cannot be reached. So, the production of D and E can be eliminated. Now, check for nullable. A variable A in a CFG is defined as a nullable if production contains the production A producing null. For eliminating null production, we have to define new production that will be P1. Then in this example, we have to see if any nullable is present. Here A producing B, B, C, D then next is B is producing null. So, here B is a nullable. Now, which will lead to the values, different values. Now, here we are producing one more time A. So, we are rewriting wherever the B is there, first we will keep this B is equal to null. Then our production will be B, C, D. Next B will be as a null. So, again we are getting B, C, D. Then both B we are keeping null. So, we are getting C. So, totally we are kept wherever the B is and all combination of B's. Then we will check this newly created production B, C, D, B, C, D, C, D. But B, C, D and B, C, D are duplicate productions. So, finally we will remove that and our final production will be A producing B, C, D, C, D. Before going to unit production elimination, CNF grammar must be first eliminate all null production. Then we can go to eliminate unit production. Now, in this example we will see, we will check is there any unit productions are there. Now, here in this grammar unit productions are there, here single C. B is defining or B is producing C, C is producing D and then D is having some value. But here C is not having any terminal values and it is a single production. So, directly we can put instead of C, D here. So, whatever the newly grammar will be A, first one, S producing AB, then A producing A. Then instead of C, we are putting all where the D, B is producing D and instead of C here, now D is there and immediately it is going to the next production. So, here we are eliminating the unit production. To summarize, here we have seen just now that to convert the given grammar into Chomsky normal form, we followed following steps. That is we started our grammar with the G in the format of V, T, P, S. Then eliminated useless variable that cannot become terminal. Then eliminated useless variable that cannot be reached. Then eliminated null production, eliminated unit production. Now, in this production or in this grammar, find out what is the unit productions are present. So, there are three unit production in the grammar. B is defining C, C is defining D and D is defining E. So, these are unit productions. Thank you.