I was checking this question and wondered how to apply it to the following language to prove it is in $RE$: $$ L = \{ \langle M \rangle : \exists P \text{ such that } M \text{ halts on every input } w \text{ within } P(|w|) \text{ steps} \},$$
where $P(x)$ is a polynomial with coefficients $a_1,\ldots,a_n \in \mathbb{N}$.
Those are the two approaches I am thinking of so far, in order to build a Turing Machine $M_L$ which accepts $L$ above:
- Let $d$ be the degree of the polynomial $P$. For each $d=1,2,3,\ldots$, iterate over all possible $d$ coefficients, and check whether the current $P$ satisfies $L$'s condition above. I think it might work because if there is no such $P$, then the Turing machine $M$ won't stop and this is OK.
- Here I am taking $P$ to be a constant (i.e. $P(x)=k \in \mathbb{N}$), and then iterate over all $k$ and apply the Turing machine from the question I linked at the beginning, where the language at the question above is in $R$ then there is a Turing machine $M_k$ which decides it, thus, while we get Rejection from $M_k$ for the $k$ values we're iterating on, $M_L$ does not stop.
I am not sure even where I made a mistake above, since the concept of iterating over all $k \in \mathbb{N}$ does not seems robust.
Does the approach of building a Turing machine work? Since I could not get to a reduction which proves that $L \in RE$.