We are given the following language
B = {$<M,i>$ : M is a turing machine and $i \in \mathcal{N}$ and M accepts some string in atmost $i$ steps }
Is language B decidable ?
As per a hint from another fellow user, I decided to construct the following decider for B. Call it D.
D = On input
- Enumerate all the strings in $\Sigma^*$ in lexicographical order (shortlex). Let the generated sequence be $s_1,s_2,...$ where each $s_k$ denotes all strings of lenght $k$
- Simulate each string in $s_k$ on M for atmost i steps.
- If any of them is accepted, ACCEPT.
- When we have finished evaluating strings for length $s_i$, output REJECT.
Is this the correct decider for B ?