Can a Turing Machine tell if an input string is a description of itself?

Can some Turing Machine $$M$$ with description $$\langle M\rangle$$, check if an input string $$w$$ is a description of itself? That is, can $$M$$ be constructed such that $$M$$ can tell if $$w$$ = $$\langle M\rangle$$?

The closest related problem I could find was: Can I construct a Turing machine that accepts only its own encoding?

But I want to consider the case where $$M$$ must recognize its own description as an intermediate step, and then accept or reject based on that and some additional criteria. Is this possible?

• The construction in the linked question doesn’t care what exactly the machine does. Any TM can be transformed in such a way, that it has access to its own encoding, no matter what further operations are. – Dmitri Urbanowicz Nov 29 '18 at 6:01

You have a description of the machine you want, with a "gap" - a point where you want to insert the code for the machine itself. This really defines a family of machines, where we have $$M_k$$ being the version where we stick in the number "$$k$$."
The process of building $$M_k$$, given $$k$$, is recursive; that is, the function sending $$k$$ to the index for $$M_k$$ is recursive.
Now on the face of it, that doesn't help since we just get an infinite regress: $$M_0$$ has index $$5$$, $$M_5$$ has index $$17$$, $$M_{17}$$ has index $$2$$, ... However, the recursion theorem lets us catch our tail. Let $$f$$ be the recursive function mentioned above, which sends $$k$$ to the index for $$M_k$$. Then by the recursion theorem, we get a fixed point for $$f$$: some $$c$$ such that the machine with index $$c$$ behaves identically to the machine with index $$f(c)$$.
But this means exactly that the machine $$M_c$$ - whose index is $$f(c)$$ - behaves as if it was given its own index! (Intuitively, it "thinks" it has index $$c$$, and that's good enough: index $$c$$ and index $$f(c)$$ are "the same.")