Prove or disprove: The following language $L$ is decidable:
$\{ \langle M, t\rangle: M \text{ is a Turing machine and } \forall w \in \{0,1\}^* [M(w) \text{ halts in at most } t \text{ steps} ]\}$
So for proving I need to construct a TM $U$. If it accepts $L$, so L is decidable, otherwise not.
My steps are:
$U$ = "On input $ \langle M, t\rangle$:
- $i:=1$;
- Simulate one step of $M$ on $w$.
If $M$ accepted $w$ then $U$ accepts.
If $M$ rejected $w$ then $U$ rejects.
If $i ≥ t$ then $U$ rejects.
Else $i:=i+1$; goto step 2."
Because $U$ is the decider machine (finite number of steps) $\longrightarrow$ $L$ is the decidable language.
Is this solution correct? Or I should do it in another way?