I have the following proof that the Empty String problem:
ES = {M | M accepts $\epsilon$}
is undecidable:
$f<M,w>$ = Construct a new machine $M_2$ such that:
$M_2$ = given input x erase x from the tape and run M on w:
if M accepts w $\longrightarrow$ accept
if M rejects w $\longrightarrow$ accept
if M loops on w $\longrightarrow$ loop
I see how the function only accepts when the halting problem accepts since it only accepts when M accepts/rejects (halts). However I don't see how it only accepts when M accepts $\epsilon$ too. If for example M rejects $\epsilon$ then $M_2$ would accept since M halted on w. Wouldn't this be a flaw in the reduction? How does this reduction account for $\epsilon$?