patternMinor
Proving the language which consists of all strings in some language is the same length as some string in another language is regular
Viewed 0 times
provingsametheallconsistslengthregularlanguagesomeanother
Problem
So I've been scratching my head over this problem for a couple of days now. Given some language $A$ and $B$ that is regular, show that the language $L$ which consists of all strings in $A$ whose length is equal to some string in $B$ is a regular language.
In equation form:
$$L = \{x \in A \mid \exists y \in B \text{ s.t. } |x| = |y| \}$$
My initial thought was to try and come up with some DFA for both languages $A$ and $B$ and map the two states to each other and hopefully get a 1:1 ratio that way I can generate a new DFA which proves that $L$ is regular. But then I realized that $A$ and $B$ don't have to be over the same set of symbols.
I think the correct way to solve this is to use the closure properties of regular language, but I'm not sure of how to begin/use the properties for "lengths" of strings instead of strings themselves.
Could someone point me in the right direction?
In equation form:
$$L = \{x \in A \mid \exists y \in B \text{ s.t. } |x| = |y| \}$$
My initial thought was to try and come up with some DFA for both languages $A$ and $B$ and map the two states to each other and hopefully get a 1:1 ratio that way I can generate a new DFA which proves that $L$ is regular. But then I realized that $A$ and $B$ don't have to be over the same set of symbols.
I think the correct way to solve this is to use the closure properties of regular language, but I'm not sure of how to begin/use the properties for "lengths" of strings instead of strings themselves.
Could someone point me in the right direction?
Solution
Remember (or come up with) the proof for
$\qquad \displaystyle L_1, L_2 \in \mathsf{REG} \implies L_1 \cap L_2 \in \mathsf{REG}$.
Do you see how to modify the proof for your setting?
Abstracting the equality of lengths thing, come up with a construction for an automaton for
$\qquad \displaystyle L_l = \{ w \in \Sigma^* \mid \exists x \in L.\, |x|=|w|\}$
for given, arbitrary $L \in \mathsf{REG}$ over $\Sigma$.
Do you see the connection?
Now note that $L = A \cap B_l$.
$\qquad \displaystyle L_1, L_2 \in \mathsf{REG} \implies L_1 \cap L_2 \in \mathsf{REG}$.
Do you see how to modify the proof for your setting?
Abstracting the equality of lengths thing, come up with a construction for an automaton for
$\qquad \displaystyle L_l = \{ w \in \Sigma^* \mid \exists x \in L.\, |x|=|w|\}$
for given, arbitrary $L \in \mathsf{REG}$ over $\Sigma$.
Do you see the connection?
Now note that $L = A \cap B_l$.
Context
StackExchange Computer Science Q#6484, answer score: 4
Revisions (0)
No revisions yet.