HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

$\mathcal{G} = \{ v_2 v_4 \ldots v_{k} : v_1 v_2 v_3 v_4 \ldots v_{k-1} v_{k} \in \mathcal{L}, \text{ $k$ even} \} $ is context free language

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
v_1freev_2textldotslanguagev_3contextevenmathcal

Problem

Let $\mathcal{L}$ be context free language over alphabet $\Sigma$. Define $\mathcal{G}$ as
$$\mathcal{G} = \{ v_2 v_4 \ldots v_{k} : v_1 v_2 v_3 v_4 \ldots v_{k-1} v_{k} \in \mathcal{L}, \text{ $k$ even} \} $$

I have seen a similar question (asked 5 years ago) but I am not sure how it can work.

Proposition

$\mathcal{L}$ is CFL so it has own push-down automata. So let copy states of $\mathcal{L}$ and if it has a state called $S$ and it gets to state $T$ upon letter $x$ then $\mathcal{G}$ will have states $S_1, S_2, T_1, T_2$ and letter $x$ turns $S_1$ to $T_2$ and $S_2$ to $T_1$.

My question is why it is correct apporach? $\mathcal{G}$ automata won't read any of $v_1, v_3, v_5,... v_{k-1}$ so how it can ensure that this word belongs to $\mathcal{L}$?

Solution

This answer assumes that $v_i \in \Sigma$ are individual symbols.

You can prove this using closure properties. The advantage is that any class of languages closed under the requisite closure properties will be closed under this operation. Specifically, we will need closure under homomorphism, reverse homomorphism, and intersection with regular language, which are exactly the so-called "full trio".

Let $\Sigma' = \{ \sigma' : \sigma \in \Sigma \}$ be a copy of $\Sigma$. Define homomorphisms $r,d\colon \Sigma \cup \Sigma' \to \Sigma$ by $r(\sigma) = r(\sigma') = \sigma$ and $d(\sigma) = \sigma$, $d(\sigma') = \epsilon$. Then
$$
\mathcal{G} = d(r^{-1}(\mathcal{L}) \cap (\Sigma' \Sigma)^*).
$$

Some families of languages, for example context-sensitive languages, are closed under the so-called "trio", in which homomorphism is replaced with $\epsilon$-free homomorphism (meaning $h(\sigma) \neq \epsilon$ for all letters $\sigma$). We can accommodate these as well with a slightly more complicated argument.

Let $e\colon \Sigma' \times \Sigma \to \Sigma \cup \Sigma$ be given by $e(\sigma',\sigma) = \sigma' \sigma$, and let $p\colon \Sigma' \times \Sigma \to \Sigma$ be given by $p(\sigma',\sigma) = \sigma$. Then
$$
\mathcal{G} = p(e^{-1}(r^{-1}(\mathcal{L}) \cap (\Sigma'\Sigma)^*)).
$$

Context

StackExchange Computer Science Q#126068, answer score: 3

Revisions (0)

No revisions yet.