I'm having trouble convincing myself of the proof for the following theorem:
$E_{TM} = \{\langle M\rangle\mid M$ is a TM and $L(M) = \emptyset\}$ is undecidable.
I think I understand why we reduce $A_{TM}$ to this problem, where $A_{TM} = \{\langle M, w\rangle\mid M$ is a TM and $M$ accepts $w\}$, but here is where I get lost. We create a modified TM $M_1$ such that:
$M_1=$ "On input $x$:
- If $x\neq w$, reject.
- If $x = w$, run $M$ on input $w$ and accept if $M$ does."
and consequently create a TM $S$ that decides $A_{TM}$:
$S=$ "On input $\langle M, w\rangle$, an encoding of a TM $M$ and a string $w$:
- Use the description of $M$ and $w$ to construct the TM $M_1$ just described.
- Run $R$ on input $\langle M_1\rangle$.
- If $R$ accepts, reject; if $R$ rejects, accept."
My issue here lies with line 3 of TM $S$. If $R$ accepted, then we must have had $x = w$ and $L(M) = \emptyset$, and $S$ would have rejected. Likewise, if $R$ rejected, then we must have had $x\neq w$ (where $x$ could be any string but $w$). Yet $S$ would accept this, even though the 'goal' for $S$ was to accept string $w$. Can someone show me how to think about this correctly? It would be very much appreciated.