Sipser in his book provided the following proof for undecidability of REGULAR$_{TM}$:
S = “On input $<M,w>$, where $M$ is a TM and w is a string:
Construct the following TM $M_2$.
$M_2$= “On input $x$:
If $x$ has the form $0^n1^n$, accept .
If $x $ does not have this form, run $M$ on input $w$ and accept if $M$ accepts $w$.”
Run $R$ on input $<M_2>$.
If $R$ accepts, accept; if $R$ rejects, reject .”
and it also states:
Note that the TM $M_2$ is not constructed for the purposes of actually running it on some input. We construct $M_2$ only for the purpose of feeding its description into the decider for REGULAR$_{TM}$ that we have assumed to exist.
So it means we don't run the $M$ on $w$ at all. I would like to know why when the $M_2$ accepts regular languages we conclude that the $M$ accepts $w$ while we never run $M$ on $w$? The reduction must have a meaningful relationship between the problems. I can't understand this relation in this problem.
thanks