2

Let $\Sigma=\{0,1\}$ and $L$ be a regular language. Prove that $$Z(L) = \{x \in \Sigma^* : \exists w \in \Sigma^* \ xww \in L \}$$ is a regular language.

I tried to build a NFA based on the DFA that accepts $L$ but failed to do so. I don't know how to ensure the $\, ww \,$ part. Please advise.

John L.
  • 39,205
  • 4
  • 34
  • 93
Dennis
  • 165
  • 7

2 Answers2

2

Let $A = (Q, \delta, q_0, F)$ a DFA that accepts $L$. For $q, q' \in Q$, define:

  • $L_{q,q'} = \{u\in \Sigma^*, \delta^*(q, u) = q'\}$;
  • $L_{q',F} = \{u\in \Sigma^*, \delta^*(q', u) \in F\}$.

It is quite easy (can you prove it?) to see that those languages are regular.

Now the language $\{x\in \Sigma^*\mid \exists w\in\Sigma^*, xww\in L\}$ can be written as: $$\bigcup\limits_{q\in Q}L_{q_0,q}\cdot M(q)$$ Where $M(q) = \left\{\begin{array}{rl}\emptyset&\text{if }\bigcup\limits_{q'\in Q}L_{q,q'}\cap L_{q',F}=\emptyset\\\{\varepsilon\}&\text{otherwise}\end{array}\right.$

$M(q)$ is regular since it is either $\emptyset$ or $\{\varepsilon\}$, so that means that $Z(L)$ is regular.

Nathaniel
  • 18,309
  • 2
  • 30
  • 58
2

The operator $Z(L) = \{ x \mid xww\in L \text{ for some } w\}$ takes strings from the original language $L$ but keeps only prefixes $x$ that are obtained by chopping a suffix of the form $ww$.

This is a special application of the right quotient operation: $L/K = \{ x \mid xy\in L \text{ for some } y\in K\}$.

It is known that the family of regular languages is closed under right quotient of arbitrary languages, see Show L1 /L2 is regular. For your problem take $K = \{ww\mid w\in \Sigma^*\}$.

Hendrik Jan
  • 31,459
  • 1
  • 54
  • 109