5

Let $A$ be a regular set. Consider the two sets below.

\begin{align*} L_1 &= \{ x \mid \exists{n}\geq 0 , \exists{y} \in A : y =x^{n} \}, \\ L_2 &= \{ x \mid \exists{n}\geq 0 , \exists{y} \in A : x =y^{n} \}. \end{align*}

Which of the following is true?

  1. $L_1$ and $L_2$ are regular
  2. $L_1$ is regular but $L_2$ is not
  3. $L_2$ is regular but $L_1$ is not
  4. Both are not regular

What I knew

$Y \in A $ only but now the relation between $y$ and $x$ is: $Y = X^{n}$ and given the clause there exist associated with the value of $n$, so we can assign any value of $n$ which is $\geq 0$. So if $n = 1$, then $Y = X$ and hence $X$ is obviously regular set.

Similarly on setting $n = 2$, we get $Y = X^{2}$ meaning $Y$ can be partitioned on exactly 2 halves and hence we can say $X$ is $\mathrm{half}(Y)$. And we know given a language or a set $L$ is regular, then $\mathrm{half}(L)$ is also regular.

With this understanding I came to a conclusion that $L_1$ is regular.

But, How to check the regularity of $L_2$? I also wanted to confirm my approach to $L_1$ being regular is correct.

Akhil Nadh PC
  • 348
  • 3
  • 15

2 Answers2

7

Your reasoning regarding $L_1$ is wrong. What you show is that for each $n$, the following language is regular whenever $A$ is regular: $$ L_1^{(n)} = \{ x : x^n \in A \}. $$ The language $L_1$ is the infinite union of $L_1^{(n)}$ for all $n \geq 0$. Unfortunately, regular languages are not closed under infinite union (for example, every unary language is an infinite union of singleton languages).

Nevertheless, $L_1$ is regular. Given a DFA $\langle Q,q_0,F,\delta \rangle$ for $A$, we construct a DFA for $L_1$ whose set of states is the set of all functions $Q \to Q$. The initial state $id$ is the identity function, and we construction the automaton so that $\delta_{L_1}(id,w)$ is the function that maps $\sigma \in Q$ to $\delta(\sigma,w)$. This gives us enough information to determine whether any power of $w$ belongs to $A$.

The language $L_2$, in contrast, is not necessarily regular. For example, if $A = ab^*$ then $L_2 \cap ab^*ab^* = \{ ab^n ab^n : n \geq 0 \}$, which isn't regular.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
4

A possible way to prove that $L_1$ is regular is to use finite monoids. A language $A$ of $\Sigma^*$ is recognised by a finite monoid $M$ if there is a surjective monoid morphism $f:\Sigma^* \to M$ and a subset $P$ of $M$ such that $f^{-1}(P) = A$.

Now let $Q = \{ x \in M \mid \text{there exists $n\geqslant 0$ such that $x^n \in P$}\}$. Then \begin{align} f^{-1}(Q) &= \{ u \in \Sigma^* \mid f(u) \in Q \} = \{ u \in \Sigma^* \mid \text{there exists $n\geqslant 0$ such that $f(u)^n \in P$} \}\\ &= \{ u \in \Sigma^* \mid \text{there exists $n \geqslant 0$ such that $f(u^n) \in P$} \} \\ &= \{ u \in \Sigma^* \mid \text{there exists $n \geqslant 0$ such that $u^n \in A$}\} = L_1 \end{align} Thus $L_1$ is regular. This method actually shows that if $M$ recognizes $A$, then it also recognizes $L_1$. This is useful to prove further properties: for instance if $A$ is star-free, so is $L_1$.

EDIT. See Yuval Filmus' answer for a proof that $L_2$ is not regular. My first answer for this part was plain wrong and has been deleted.

J.-E. Pin
  • 6,219
  • 21
  • 39