Formal Language: Defining functions for alphabets

68 Views Asked by At

Let $A = \{a,b\} $ be an alphabet.

$s: \mathbb{N} \rightarrow \{0,1\}$

$f_s: A^*\times \mathbb{N_0}\rightarrow A^*$

$\forall i\in \mathbb{N_0}: f_s(\epsilon,i) = \epsilon$

$\forall i\in \mathbb{N_0}$ $\forall w\in A^*$ $\forall x \in A: f_s(xw,i) = \begin{cases} xf_s(w,i+1), & \text{if}\ s(i)=1 \\ f_s(w,i+1), & \text{if}\ s(i) =0 \end{cases}$

$s(i) = \begin{cases}1, \text{if i is odd} \\ 0, \text{if i is even} \end{cases}$

[So basically what $f_s$ does is, it will extract or delete a letter from the word.]

I finished the first five tasks but got stuck on the last three.

f) Let $w= abbabab.$ Define $s: \mathbb{N_0} \rightarrow \{0,1\}$ so that $f_s(w,0) = aaa.$

$\Rightarrow$ That means for the steps $i=0, 3,5$ we have to extract a letter and for the steps $1, 2, 4, 6$ we have to delete a letter.

My answer: $s(i)= \begin{cases}1, \text{if } i\in \mathbb{N_0}\setminus \{1\}: i=0 \text{ or i is odd}\\ 0,\text{ if } i\in \mathbb{N_0}\setminus \{0\}: i=1 \text{ or i is even}\end{cases}$

I think this is the right solution. I left the $0$ in $\mathbb{N_0}$ to emphasize that the $0$ has been taken out from one part.

g)$s: \mathbb{N} \rightarrow \{0,1\}$ and $i \in \mathbb{N_0}$. Define $s_i: \mathbb{N} \rightarrow \{0,1\}$ with the following condition: $\forall w \in A^*: f_{s_i}(w,0) = f_s(w,i)$

So from my understanding $f_{s_i}(w,0)$ starts when $f_s(w,i)$ is at step $i$. But if $f_s(w,i)$ is at an odd number a letter will be extracted while $f_{s_i}(w,0)$ would start at $0$ and would delete that letter. I also think the index $i$ is confusing me here.

h) $r_1, r_2: \mathbb{N_0} \rightarrow \{0,1\}$

$v_{r_1,r_2}: \mathbb{N_0} \rightarrow \{0,1\}$

$\forall i \in \mathbb{N_0}: v_{r_1,r_2}= \begin{cases} 0, \text{ if } r_1(i) = r_2(i) = 0 \\ 1, \text{ other cases} \end{cases}$

Give a necessary and sufficient condition for $r_1$ and $r_2$ so that the following applies:

$\forall w \in A^*: f_{v_{r_1,r_2}}(w,0) = f_{r_1}(w,0)f_{r_2}(w,0)$

I thought about $r_1$ and $r_2$ doing the opposite of each other so that all numbers would be covered but the condition for $0$ is that $r_1(i) = r_2(i) = 0$. I don't think this is the right idea.

1

There are 1 best solutions below

2
On BEST ANSWER

It helps to understand right away what $f_s$ does.

Let $S = \{k \in \Bbb{N}_0 \mid s(k) = 1\}$. If $w = a_0a_1 \dotsm a_n$, I let you verify (this really needs a proof) that $f_s(w,0)$ is obtained from $w$ by deleting the letters $a_i$ such that $i \notin S$. Roughly speaking, you filter $w$ through $S$ to get $f_s(w,0)$. Thus a more convenient notation for $f_s(w,0)$ is $w[S]$. The second thing you need to verify (this also requires a proof) is that $f_s(w,i) = f_{i+s}(w,0)$.

Now, one can answer your questions.

(f) To get $aaa$ from $abbabab$, just apply the filter $\{0, 3, 5\}$. Thus you can take $s(0) = s(3) = s(5) = 1$ and $s(i) = 0$ otherwise.

(g) Take $s_i = i + s$.

(h) Let $R_1$ and $R_2$ be the filters defined by $r_1$ and $r_2$, respectively. Then the filter defined by $v_{r_1,r_2}$ is just $R_1 \cup R_2$ and the condition in (h) means that, for all $w \in A^*$, $w[R_1 \cup R_2] = w[R_1]w[R_2]$. If I am not mistaken, this is equivalent to have $R_1$ finite and $\max R_1 \leqslant \min R_2$ (this includes the case $R_2 = \emptyset$, if you agree that $\min \emptyset = +\infty$).