Suppose that $ L$ is some language over the alphabet $ \Sigma$ . I was asked to show that the following languages is decidable:

$ $ L’ = \{w \in \Sigma^* | \text{ there exists a word } w’\in L \text{ such that } |w’| \leq |w| \}$ $

I.e., $ w \in L’$ if $ L$ has some word with length smaller than $ |w|$ .

The way I was thinking to show that is observing that $ L \cap\Sigma^{|w|}$ is finite, and $ (L \cap \Sigma) \cup (L \cap \Sigma^2) \cup \ldots\cup (L\cap \Sigma^{|w|})$ is finite too, hence decidable. But the main thing I am struggling with is how can any algorithm for $ L’$ know if some $ u \in L$ ? this is undecidable, so it’s unclear to me how any algorithm for $ L’$ can verify that indeed some word is in $ L$