1

Given a regular language $L$ over the alphabet $\Sigma = \{a,b,c,d\}$, is the language $\mathrm{Perm}(L)$ consisting of all permutations of words in $L$ also regular?

My intuition says it is, since each word in $L$ only has finitely many permutations, but I don't know how to prove it.

Any help would be great.

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
Galyoss
  • 51
  • 3
  • Are you asking whether this holds for every regular language? (it doesn't), or whether this is a decidable problem? – Shaull Apr 23 '21 at 11:40
  • @Shaull - the first option - does this hold for every regular language. can you give an example for such L? – Galyoss Apr 23 '21 at 11:43
  • 3
    try to think of languages that are not regular, but are closed under permutations. Hint: automata cannot "count". If you still can't find an example, detail some of your attempts in the post, and we'll help. – Shaull Apr 23 '21 at 11:47
  • Got it. Thank you @Shaull ! – Galyoss Apr 23 '21 at 11:49

2 Answers2

6

You can consider the regular language $(ab)^*$. We have $$ \mathrm{Perm}((ab)^*) \cap a^*b^* = \{ a^n b^n : n \geq 0 \}, $$ which isn't regular. If you take instead $(abc)^*$ and intersect with $a^*b^*c^*$, you get the language $\{ a^nb^nc^n : n \geq 0 \}$, which isn't even context-free.

In contrast, the class of context-sensitive languages is closed under permutation. To see this, it suffices to observe that you can nondeterministically permute the input without any additional space (for example, by applying an arbitrary number of transpositions).

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
3

It is not regular.

Counter example:

Take $L= L((ab)^*)$. Now look at $Perm(L)$. It is the language of all words $w$ such that $|w|_a =|w|_b$.

Now, show that the pumping lemma doesn't apply.

Hint:

Take the word $a^Nb^N$ for $N$ the pumping length.

SaharCo
  • 43
  • 6