# Is $L_{half} = \{w : \text{for some } z \in L, x \in \Sigma^*, z = wx \wedge |w| = |x| \}$ regular? [duplicate]

Suppose we have some regular language $L$, then can we say that $$L_{half} = \{w : \text{for some } z \in L, x \in \Sigma^*, z = wx \wedge |w| = |x| \}$$ is also regular?

I have a 'feeling' that it is, but I can't sketch a proof for it.

## marked as duplicate by Raphael♦Sep 9 '13 at 10:16

Yes, the language is regular: Consider a DFA A such that $L(A)=L$ Now, assume that you know, somehow, that when given a word $w$, the run of $A$ will end up in state $q$.

All you need to check now is that there is a run of $A$ on some word of length $|w|$ that gets from $q$ to an accepting state. This can be done by using the product automaton $A\times A$, where the first component acts exactly like $A$, and the second acts like $A$, but starts from state $q$ and ignores the input - that is, for each letter it nondeterministically goes anywhere that $A$ can go. Then, a run is accepting if the first component ends up in $q$, and the second component ends in an accepting state.

Finally, you can drop the assumption by taking $|Q|$ copies of this construction, where each copy "guesses" in which state $A$ will end up in. You end up with a nondeterministic construction of size $|Q|^3$

• Do you want me to move your answer (maybe in modified form) to the question this is a duplicate of? – Raphael Sep 9 '13 at 10:16
• As you see fit. The duplicate already has its answers, so move mine only if you think it has any additional value. – Shaull Sep 9 '13 at 15:50