I’m trying to show $ L^2 \in \mathsf{REG} \implies L \in \mathsf{REG}$ with $ L^2 = \{w = w_1w_2 \mid w_1, w_2 \in L\}$ but I cant seem to find a proof that feels right.

I first tryed to show $ L \in \mathsf{REG} \implies L^2 \in \mathsf{REG}$ , by constructing an machine $ M$ that consists of two machines $ A=A’$ with $ A$ recognizing $ L$ . $ M$ has the same start states as $ A$ but the final states of $ A$ are put together with the starting states of $ A’$ . Further $ M$ uses the same accepting states as $ A’$ . Hope that makes sens so far ðŸ˜€

Now to show $ L^2 \in \mathsf{REG} \implies L \in \mathsf{REG}$ I’d argue the same way, but:

The machine $ M’$ that accepts $ L^2$ has to recognize $ w_i \in L$ in some way, and because $ L^2$ is regular, $ M’$ has to be a NFA/DFA. So the machine has to check if $ w_i \in L$ and this cant be done by using something else than a NFA/DFA.

This feels wrong and not very mathematical, so maybe somebody knows how to do this?