1

How can we show that the class of regular languages is closed under the following operation?

Let $L_1$ and $L_2$ be laguages over $\Sigma=\{0, 1\}$.

The operation is: $$\{x \in L_1 \mid \text{ for some } y \in L_2, \text{ strings } x \text{ and } y \text{ contains equal numbers of } 1s \}$$

Is the only way to show this to create a NFA of the new language?

I have done the following:

Let $M_{L_1}=(Q_{L_1},\Sigma ,\delta_{L_1},q_{L_1},F_{L_1})$ the DFA that recognizes $L_1$ and $M_{L_2}=(Q_{L_2},\Sigma ,\delta_{L_2},q_{L_2},F_{L_2})$ the DFA that recognizes $L_2$.

Let $M=(Q,\Sigma ,\delta,q,F)$ the NFA that recognizes the operation.

$Q=Q_{L_1}\times Q_{L_2}, \ \ q=(q_{L_1},q_{L_2})$.

Is this correct? Which is the transition function?

Raphael
  • 72,336
  • 29
  • 179
  • 389
Mary Star
  • 431
  • 4
  • 13

2 Answers2

4

Let $$ L = \{ x \in L_1 \mid \text{there exists }y \in L_2 \text{ such that } |x|_1 = |y|_1\} $$ Let $\pi: \Sigma^* \to a^*$ be the homomorphism defined by $\pi(u) = a^{|u|_1}$. I claim that $$ L = L_1 \cap \pi^{-1}(\pi(L_2)) $$ Since regular languages are closed under homomorphisms, inverses of homomorphisms and intersection, it will follow that $L$ is regular.

Proof of the claim. \begin{align} L_1 \cap \pi^{-1}(\pi(L_2)) &= \{ x \in L_1 \mid \pi(x) \in \pi(L_2) \} \\ &= \{ x \in L_1 \mid \text{there exists }y \in L_2 \text{ such that } \pi(x) = \pi(y)\}\\ &= \{ x \in L_1 \mid \text{there exists }y \in L_2 \text{ such that } |x|_1 = |y|_1\} \\ &= L \end{align}

J.-E. Pin
  • 6,129
  • 18
  • 36