0

I'm trying to decide whether $L_c=${$w=uxu, | \ u,x\in \Sigma ^* \ and \ |u|=c $} for some constant $c\in \mathbb{N}$ is context free or not.

initialliy, I've thought about choosing $x=\epsilon$ which will lead to $w=uu, \ u\in \Sigma ^* $ but I've been told that since $c$ is a constant, it wont be the same language as $L=${$uu | u\in \Sigma ^* $} which put me in a standstill.

I've also thought about some examples that will make the pumping lemma not work on $L_c$, yet they all seem to fail (I couldent find a pumping constant that throws me out of $L_c$)

any ideas on how to progress from here?

Aishgadol
  • 377
  • 2
  • 12

1 Answers1

2

Observe that for some $c \in \mathbb{N}$ and finite alphabet $\Sigma$, $\Sigma^c$ with $|\Sigma^c| = |\Sigma|^c$ is finite. Therefore

$$L_c = \bigcup_{u \in \Sigma^c} u\Sigma^*u$$

is the union of a finite number of regular languages. So $L_c$ must be regular/context-free.


Assume that $\Sigma$ and $c$ are chosen as above and that $\sim_c$ is the indistinguishability relation for $L_c$. By the Myhill-Nerode theorem, $L_c$ is regular if and only if $\Sigma^*/\sim_c$ is finite. We now prove $L_c$ regular by showing that each string in $\Sigma^*$ is indistinguishable to one of length $\leq 2c$, so the number of classes in $\Sigma^*/\sim_c$ must be bounded by $|\Sigma|^{2c}$.

Choose $w \in \Sigma^*$, if $|w| \leq c$ then $w \sim_c w$. If $|w| > c$ then there must be $u \in \Sigma^c$, $y \in \Sigma^+$ such that $w = uy$. Now take the greatest prefix $u_1$ of $u$ such that $y = xu_1$ for some $x \in \Sigma^*$. If $z \in \Sigma^*$ with $|z| \geq c$, then

$$wz = uyz \in L_c \iff u \text{ is a suffix of } z \iff uu_1z \in L_c.$$

Because $u_1$ is the greatest prefix of $u$ with $w = uxu_1$, it follows that if $|z| < c$ then also

$$wz = uyz \in L_c \iff u_2z = u \text{ for a suffix } u_2 \text{ of } u_1 \iff uu_1z \in L.$$

So $w \sim_c uu_1$ and $|uu_1| \leq |uu| = 2c$, done.

Knogger
  • 2,049
  • 3
  • 15