# Proving that a language is not Recursive

I have the following language:

T = {M | there exists w such that M accepts w within |w| steps}

I am trying to prove that this language is not recursive and that it is recursive-enumerable. To prove that it is NOT recursive I considered the following steps:

1) Assume that it was recursive 2) Conside input w of infinite length 3) Meaning, we get infinite steps that M can perform before halting. So we get the halting problem when considering this infinite input, and we are saying that we can decide it 4) halting problem is not decidable. contradiction

What do you think about this proof? I'm not sure that I can consider an infinite length input, and I'm not sure wither turing machines in general should deal with infinite inputs lengths.

I tried to search for answers with no luck so far. Any help would be much appreciated. Thanks.

• TMs are defined over finite inputs only, so you cannot consider an input of infinite length. Regarding proving that the language is not recursive - have you tried proving it using a reduction from some non-recursive language? – Shaull Sep 15 '15 at 18:51
• But why the infinite memory then? if you can consider only finite inputs. This what made me think that you can consider such input. About the reduction, I did. I can only use halting or looping languages in order to prove this but I couldn't build such reduction with them – Hanna Sep 15 '15 at 18:58
• The tape is infinite since you want to allow unbounded contents, that's not the same as infinite contents. – Shaull Sep 15 '15 at 18:59
• Are you talking about unbounded computation that the machine can perform? And do you have any tip for me in order to build the right reduction form halting/looping? Thanks – Hanna Sep 15 '15 at 19:02
• I guess our reference question contains all you need, specifics aside. – Raphael Sep 16 '15 at 6:54

Proving that the language is in RE is quite easy: simulate the machine on every input $w\in \Sigma^*$, in minlex order, for $|w|$ steps. If an input is accepted - accept.
Proving that the language is undecidable can be done by reduction from $$A_{TM}=\{<M,w>: M\text{ accepts }w\}.$$ A possible reduction:
Given input $<M,w>$, construct a new TM $M'$ that works as follows: given input $x$, simulate $M$ on $w$. If $M$ accepts, accept. If $M$ rejects, reject, and of course if $M$ does not halt then so will $M'$.
Now, if $<M,w>\in A_{TM}$, then $M$ accepts $w$ within $t$ steps, for some $t\in \mathbb{N}$. Thus, for a word $x$ with $|x|>>t$ (the size of $|x|$ needed depends on the manner of simulation, but can be done with $O(t\log t)$), the simulation of $M$ on $w$ will terminate within $|x|$ steps, and $M$ will accept $w$, so $M'$ will accept $x$, and $<M'>\in L$.
Conversely, if $<M,w>\notin A_{TM}$, then $M'$ will not accept any input, so $<M'>\notin L$, and you are done.