Prove that if the language L is regular , then K is also regular

automatacomputer scienceformal-languagesregular-language

Let $L$ be any language over $\{a,b\}$.

Let $K$ be the language : $K=\{v:va \in L \}$

In other words, the word $v$ is in $K$ if he has the properties that if we add an $a$ at the end of $v$ we get a word of $L$

Show that if $L$ is regular then $K$ is also regular.

Watch out : Do not mistake $K$ with $L \circ\{a\} $
Example : if $L$ is represented by the regular expression $(ba)^*$ then $K$ is represented by $(ba)^*b$

So now it's said that to proove this, an option could be that we can show how we can modify an automaton that recognize $L$ to get an automaton that recognize $K$. A formal proof is not required but we have to be clear. We can also show an example.

Based on this last paragraph i started to draw an automaton for both $L$ and $K$ but i am not sure what to do next and how can this proove that $K$ is regular..

Drawing tool if u need it : http://madebyevan.com/fsm/
Thanks for your help.

enter image description here
enter image description here

Best Answer

You can use almost the same automaton for $K$, changing just which states are accept. State $x$ will be accept state for new automaton iff $\delta(x, a)$ is accept state for old automata.

Assume word $va \in L$. Then original automaton accepts this word in some state $y$, and after reading $v$ it will in in state $x$ s.t. $\delta(x, a) = y$ - so $x$ will be accept state for new automaton. Thus new automaton accepts all words $v$ s.t. $va \in L$.

Now, assume new automaton accepts word $v$ in state $x$. Then $\delta(x, a)$ is accept state in old automaton, so old automaton accepts $va$. Thus if new automaton accepts word $v$, then $va \in L$.