M searches for an instance of the string on tape 3. If found , then it goes to next step; otherwise the computation halts and M rejects w.
The string on tape 3 is replaced by the string (in the RHS of the production ). [ This step minimies one step in the derivation of w in G.]
The string of tape 3 is compared with that on tape 1 (i.e. with the input w). If there is a match , the computation halts in an accepting state (i.e. M accpets w).
Repeat step 3 through 7 , to apply other productions.
Note: In step 5, if tape 3 contains and is replaced by , then it says . Since and may be of different length, the symbols of may have to be shifted to fit between and .
Let . Then . This derivation will eventually be discovered by one of the nondeterministic computations of M by using the steps given above. Hence, .
Conversely, let wL(G). Then there is an accepting computation of M for the string w. The actions of M on tape 3 are precisely the strings derivable from S and the only string accepted by M are terminal string in L(G). Hence w L(G) giving L(M)=L(G). That is,Maccepts exactlyL(G) and hence L(G) is recursively enumerable.